code cleanup

This commit is contained in:
Michał Walenciak 2017-09-09 14:04:29 +02:00
parent 1c4026fd56
commit 63403ac0bb

View File

@ -300,13 +300,16 @@ void printIFD(Exiv2::BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption
Exiv2::DataBuf buf(size*count + pad); // allocate a buffer
std::memcpy(buf.pData_, &data, 8); // copy data into buffer (short strings)
if ( count*size > 8 ) { // read into buffer
size_t restore = io.tell(); // save
io.seek(offset, Exiv2::BasicIo::beg); // position
io.read(buf.pData_,count*size); // read
io.seek(restore, Exiv2::BasicIo::beg); // restore
// big data? Use 'data' as pointer to real data
if ( count*size > 8 ) // read into buffer
{
size_t restore = io.tell(); // save
io.seek(data, Exiv2::BasicIo::beg); // position
io.read(buf.pData_,count*size); // read
io.seek(restore, Exiv2::BasicIo::beg); // restore
}
else // use 'data' as data :)
std::memcpy(buf.pData_, &data, 8); // copy data
if ( bPrint ) {
uint64_t address = offset + 2 + i*12 ;