int TimeValue::read(const std::string& buf) { // Hard coded to read H:M:S or Iptc style times int rc = 1; if (buf.length() < 9) { // Try to read (non-standard) H:M:S format rc = scanTime3(buf.c_str(), "%d:%d:%d"); } else { rc = scanTime6(buf.c_str(), "%d:%d:%d%1c%d:%d"); } #ifndef SUPPRESS_WARNINGS if (rc) { std::cerr << Error(30) << "\n"; } #endif return rc; }
int TimeValue::read(const std::string& buf) { // Hard coded to read H:M:S or Iptc style times int rc = 1; if (buf.length() < 9) { // Try to read (non-standard) H:M:S format rc = scanTime3(buf.c_str(), "%d:%d:%d"); } else { rc = scanTime6(buf.c_str(), "%d:%d:%d%1c%d:%d"); } if (rc) { rc = 1; #ifndef SUPPRESS_WARNINGS EXV_WARNING << Error(kerUnsupportedTimeFormat) << "\n"; #endif } return rc; }
int TimeValue::read(const byte* buf, long len, ByteOrder /*byteOrder*/) { // Make the buffer a 0 terminated C-string for scanTime[36] char b[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; memcpy(b, reinterpret_cast<const char*>(buf), (len < 12 ? len : 11)); // Hard coded to read HHMMSS or Iptc style times int rc = 1; if (len == 6) { // Try to read (non-standard) HHMMSS format rc = scanTime3(b, "%2d%2d%2d"); } if (len == 11) { rc = scanTime6(b, "%2d%2d%2d%1c%2d%2d"); } #ifndef SUPPRESS_WARNINGS if (rc) { std::cerr << Error(30) << "\n"; } #endif return rc; }