MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / readData

Function readData

src/iptc.cpp:464–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462// local definitions
463namespace {
464int readData(Exiv2::IptcData& iptcData, uint16_t dataSet, uint16_t record, const Exiv2::byte* data, uint32_t sizeData) {
465 Exiv2::TypeId type = Exiv2::IptcDataSets::dataSetType(dataSet, record);
466 auto value = Exiv2::Value::create(type);
467 int rc = value->read(data, sizeData, Exiv2::bigEndian);
468 if (0 == rc) {
469 Exiv2::IptcKey key(dataSet, record);
470 iptcData.add(key, value.get());
471 } else if (1 == rc) {
472 // If the first attempt failed, try with a string value
473 value = Exiv2::Value::create(Exiv2::string);
474 rc = value->read(data, sizeData, Exiv2::bigEndian);
475 if (0 == rc) {
476 Exiv2::IptcKey key(dataSet, record);
477 iptcData.add(key, value.get());
478 }
479 }
480 return rc;
481}
482
483} // namespace

Callers 1

decodeMethod · 0.85

Calls 3

getMethod · 0.80
readMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected