Refactor printTiffStructure depth increment

This commit is contained in:
Kevin Backhouse 2022-07-17 15:28:34 +01:00
parent 46f2ef8009
commit 0f1ea7571b
No known key found for this signature in database
GPG Key ID: 9DD01852EE40366E
9 changed files with 11 additions and 11 deletions

View File

@ -46,7 +46,7 @@ void Cr2Image::printStructure(std::ostream& out, Exiv2::PrintStructureOption opt
if (io_->open() != 0)
throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
io_->seek(0, BasicIo::beg);
printTiffStructure(io(), out, option, depth - 1);
printTiffStructure(io(), out, option, depth);
}
void Cr2Image::setComment(const std::string&) {

View File

@ -442,7 +442,7 @@ void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStruct
DataBuf bytes(byteslen); // allocate a buffer
io.readOrThrow(bytes.data(), byteslen, ErrorCode::kerCorruptedMetadata); // read
MemIo memIo(bytes.c_data(), byteslen); // create a file
printTiffStructure(memIo, out, option, depth);
printTiffStructure(memIo, out, option, depth+1);
} else {
// tag is an IFD
uint32_t punt = bSony ? 12 : 0;
@ -486,7 +486,7 @@ void Image::printTiffStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStruc
auto c = dir.read_uint8(0);
bool bSwap = (c == 'M' && isLittleEndianPlatform()) || (c == 'I' && isBigEndianPlatform());
size_t start = byteSwap4(dir, 4, bSwap);
printIFDStructure(io, out, option, start + offset, bSwap, c, depth+1);
printIFDStructure(io, out, option, start + offset, bSwap, c, depth);
}
}

View File

@ -553,7 +553,7 @@ void Jp2Image::printStructure(std::ostream& out, PrintStructureOption option, in
const char b = rawData.read_uint8(1);
if (a == b && (a == 'I' || a == 'M')) {
MemIo p(rawData.c_data(), rawData.size());
printTiffStructure(p, out, option, depth);
printTiffStructure(p, out, option, depth+1);
}
}

View File

@ -485,7 +485,7 @@ void JpegBase::printStructure(std::ostream& out, PrintStructureOption option, in
if (start < max) {
// create a copy on write memio object with the data, then print the structure
MemIo p(buf.c_data(start), size - start);
printTiffStructure(p, out, option, depth);
printTiffStructure(p, out, option, depth+1);
}
}

View File

@ -65,7 +65,7 @@ void OrfImage::printStructure(std::ostream& out, PrintStructureOption option, in
io_->seek(0, BasicIo::beg);
printTiffStructure(io(), out, option, depth - 1);
printTiffStructure(io(), out, option, depth);
} // OrfImage::printStructure
void OrfImage::readMetadata() {

View File

@ -330,7 +330,7 @@ void PngImage::printStructure(std::ostream& out, PrintStructureOption option, in
if (bExif) {
// create memio object with the data, then print the structure
MemIo p(parsedBuf.c_data(6), parsedBuf.size() - 6);
printTiffStructure(p, out, option, depth);
printTiffStructure(p, out, option, depth+1);
}
if (bIptc) {
IptcData::printStructure(out, makeSlice(parsedBuf, 0, parsedBuf.size()), depth);
@ -361,7 +361,7 @@ void PngImage::printStructure(std::ostream& out, PrintStructureOption option, in
if (eXIf && option == kpsRecursive) {
// create memio object with the data, then print the structure
MemIo p(data.c_data(), dataOffset);
printTiffStructure(p, out, option, depth);
printTiffStructure(p, out, option, depth+1);
}
if (bLF)

View File

@ -75,7 +75,7 @@ void Rw2Image::printStructure(std::ostream& out, PrintStructureOption option, in
io_->seek(0, BasicIo::beg);
printTiffStructure(io(), out, option, depth - 1);
printTiffStructure(io(), out, option, depth);
} // Rw2Image::printStructure
void Rw2Image::readMetadata() {

View File

@ -276,7 +276,7 @@ void TiffImage::printStructure(std::ostream& out, Exiv2::PrintStructureOption op
io_->seek(0, BasicIo::beg);
printTiffStructure(io(), out, option, depth - 1);
printTiffStructure(io(), out, option, depth);
}
} // namespace Exiv2

View File

@ -450,7 +450,7 @@ void WebPImage::printStructure(std::ostream& out, PrintStructureOption option, i
if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF) && option == kpsRecursive) {
// create memio object with the payload, then print the structure
MemIo p(payload.c_data(), payload.size());
printTiffStructure(p, out, option, depth);
printTiffStructure(p, out, option, depth+1);
}
bool bPrintPayload = (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_XMP) && option == kpsXMP) ||