Skip to content

Commit

Permalink
C++ simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
clanmills committed Feb 19, 2021
1 parent e03c66a commit d455f47
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/tiffcomposite_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ namespace Exiv2 {
// Tags must be sorted in ascending order
std::sort(elements_.begin(), elements_.end(), cmpTagLt);
uint32_t idx = 0;
MemIo mio;
MemIo mio; // memory stream in which to store data
IoWrapper mioWrapper(mio, 0, 0, 0);
// Some array entries need to have the size in the first element
if (cfg()->hasSize_) {
Expand Down Expand Up @@ -1435,7 +1435,6 @@ namespace Exiv2 {
idx += fillGap(mioWrapper, idx, lastDef->idx_ + lastDef->size(lastTag, cfg()->group_));
}

bool bCopyMio = true ; // MemIo mio stream contain the the "raw" data
if (cfg()->cryptFct_) {
// Select sonyTagEncipher
CryptFct cryptFct = cfg()->cryptFct_;
Expand All @@ -1444,11 +1443,11 @@ namespace Exiv2 {
}
DataBuf buf = cryptFct(tag(), mio.mmap(), static_cast<uint32_t>(mio.size()), pRoot_);
if ( buf.size_) {
ioWrapper.write(buf.pData_, buf.size_);
bCopyMio=false ;
mio.seek(0,Exiv2::FileIo::beg);
mio.write(buf.pData_, buf.size_);
}
}
if ( bCopyMio ) ioWrapper.write(mio.mmap(), static_cast<uint32_t>(mio.size()));
ioWrapper.write(mio.mmap(), static_cast<uint32_t>(mio.size()));

return idx;
} // TiffBinaryArray::doWrite
Expand Down

0 comments on commit d455f47

Please sign in to comment.