From a12dc4ad32a4f6627487861508831fd3bfeabfed Mon Sep 17 00:00:00 2001 From: Christian Fetzer Date: Tue, 27 Mar 2012 23:15:03 +0200 Subject: Cleaned up exif parser: Removed unneccessary comment, use MAX_COMMENT instead of constant, replaced sizeof(short) by 2 (might cause toubles on future platforms) --- lib/libexif/ExifParse.cpp | 4 ++-- lib/libexif/IptcParse.cpp | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/libexif/ExifParse.cpp b/lib/libexif/ExifParse.cpp index a905e80c54..2386fd3dab 100644 --- a/lib/libexif/ExifParse.cpp +++ b/lib/libexif/ExifParse.cpp @@ -416,7 +416,7 @@ void CExifParse::ProcessDir(const unsigned char* const DirStart, case TAG_DESCRIPTION: { int length = max(ByteCount, 0); - length = min(length, 2000); + length = min(length, MAX_COMMENT); strncpy(m_ExifInfo->Description, (char *)ValuePtr, length); break; } @@ -452,7 +452,7 @@ void CExifParse::ProcessDir(const unsigned char* const DirStart, { const int EXIF_COMMENT_HDR_LENGTH = 8; // All comment tags have 8 bytes of header info int length = max(ByteCount - EXIF_COMMENT_HDR_LENGTH, 0); - length = min(length, 2000); + length = min(length, MAX_COMMENT); strncpy(m_ExifInfo->Comments, (char *)ValuePtr+EXIF_COMMENT_HDR_LENGTH, length); // FixComment(comment); // Ensure comment is printable } diff --git a/lib/libexif/IptcParse.cpp b/lib/libexif/IptcParse.cpp index 1ac94c0483..b58e1f0189 100644 --- a/lib/libexif/IptcParse.cpp +++ b/lib/libexif/IptcParse.cpp @@ -133,9 +133,6 @@ bool CIptcParse::Process (const unsigned char* const Data, const unsigned short if (pos + 4 >= maxpos) return false; - // Get length (Motorola format) - //unsigned long length = CExifParse::Get32(pos); - pos += 4; // move data pointer to the next field // Now read IPTC data @@ -145,13 +142,13 @@ bool CIptcParse::Process (const unsigned char* const Data, const unsigned short short signature = (*pos << 8) + (*(pos+1)); - pos += sizeof(short); + pos += 2; if (signature != 0x1C01 && signature != 0x1C02) break; unsigned char type = *pos++; unsigned short length = (*pos << 8) + (*(pos+1)); - pos += sizeof(short); // Skip tag length + pos += 2; // Skip tag length if (pos + length > maxpos) return false; -- cgit v1.2.3