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

Method readMetadata

src/webpimage.cpp:472–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470/* =========================================== */
471
472void WebPImage::readMetadata() {
473 if (io_->open() != 0)
474 throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
475 IoCloser closer(*io_);
476 // Ensure that this is the correct image type
477 if (!isWebPType(*io_, true)) {
478 if (io_->error() || io_->eof())
479 throw Error(ErrorCode::kerFailedToReadImageData);
480 throw Error(ErrorCode::kerNotAJpeg);
481 }
482 clearMetadata();
483
484 byte data[12];
485 DataBuf chunkId(5);
486 chunkId.write_uint8(4, '\0');
487
488 io_->readOrThrow(data, WEBP_TAG_SIZE * 3, Exiv2::ErrorCode::kerCorruptedMetadata);
489
490 const uint32_t filesize = Safe::add(Exiv2::getULong(data + WEBP_TAG_SIZE, littleEndian), 8U);
491 Internal::enforce(filesize <= io_->size(), Exiv2::ErrorCode::kerCorruptedMetadata);
492
493 WebPImage::decodeChunks(filesize);
494
495} // WebPImage::readMetadata
496
497void WebPImage::decodeChunks(uint32_t filesize) {
498 DataBuf chunkId(5);

Callers

nothing calls this directly

Calls 12

ErrorFunction · 0.85
strErrorFunction · 0.85
isWebPTypeFunction · 0.85
addFunction · 0.85
getULongFunction · 0.85
enforceFunction · 0.85
eofMethod · 0.80
write_uint8Method · 0.80
readOrThrowMethod · 0.80
openMethod · 0.45
errorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected