diff options
author | Christian Fetzer <fetzer.ch@googlemail.com> | 2012-03-27 23:15:03 +0200 |
---|---|---|
committer | Christian Fetzer <fetzer.ch@googlemail.com> | 2012-03-27 23:15:03 +0200 |
commit | a12dc4ad32a4f6627487861508831fd3bfeabfed (patch) | |
tree | 22d73377323d59363be525bf92301c7ea696f7d3 | |
parent | 63aafac35b24461454598a74787d93a18f7c8652 (diff) |
Cleaned up exif parser: Removed unneccessary comment, use MAX_COMMENT instead of constant, replaced sizeof(short) by 2 (might cause toubles on future platforms)
-rw-r--r-- | lib/libexif/ExifParse.cpp | 4 | ||||
-rw-r--r-- | 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; |