comparison src/exiv2-r2469.patch @ 1688:1e4b0f1f9252

include important bugfix patch for package exiv2
author Volker Grabsch <vog@notjusthosting.com>
date Fri, 25 Mar 2011 18:20:33 +0100
parents
children
comparison
equal deleted inserted replaced
1687:795aba5b9440 1688:1e4b0f1f9252
1 # This file is part of mingw-cross-env.
2 # See doc/index.html for further information.
3
4 This patch has been taken from:
5 http://dev.exiv2.org/issues/764
6
7 Index: trunk/src/psdimage.cpp
8 ===================================================================
9 --- trunk/src/psdimage.cpp (revision 2468)
10 +++ trunk/src/psdimage.cpp (revision 2469)
11 @@ -400,7 +400,7 @@
12 uint32_t resourceType = getULong(buf, bigEndian);
13
14 if (resourceType != kPhotoshopResourceType) {
15 - break; // bad resource type
16 + throw Error(3, "Photoshop"); // bad resource type
17 }
18 uint16_t resourceId = getUShort(buf + 4, bigEndian);
19 uint32_t resourceNameLength = buf[6];
20 @@ -416,13 +416,13 @@
21 if (io_->read(buf, 4) != 4) throw Error(3, "Photoshop");
22
23 uint32_t resourceSize = getULong(buf, bigEndian);
24 + uint32_t pResourceSize = (resourceSize + 1) & ~1; // padded resource size
25 uint32_t curOffset = io_->tell();
26
27 // Write IPTC_NAA resource block
28 if ((resourceId == kPhotoshopResourceID_IPTC_NAA ||
29 resourceId > kPhotoshopResourceID_IPTC_NAA) && iptcDone == false) {
30 newResLength += writeIptcData(iptcData_, outIo);
31 - resourceSize = (resourceSize + 1) & ~1; // adjust for padding
32 iptcDone = true;
33 }
34
35 @@ -430,7 +430,6 @@
36 else if ((resourceId == kPhotoshopResourceID_ExifInfo ||
37 resourceId > kPhotoshopResourceID_ExifInfo) && exifDone == false) {
38 newResLength += writeExifData(exifData_, outIo);
39 - resourceSize = (resourceSize + 1) & ~1; // adjust for padding
40 exifDone = true;
41 }
42
43 @@ -438,7 +437,6 @@
44 else if ((resourceId == kPhotoshopResourceID_XMPPacket ||
45 resourceId > kPhotoshopResourceID_XMPPacket) && xmpDone == false) {
46 newResLength += writeXmpData(xmpData_, outIo);
47 - resourceSize = (resourceSize + 1) & ~1; // adjust for padding
48 xmpDone = true;
49 }
50
51 @@ -467,10 +465,9 @@
52
53 readTotal = 0;
54 toRead = 0;
55 - resourceSize = (resourceSize + 1) & ~1; // pad to even
56 - while (readTotal < resourceSize) {
57 - toRead = static_cast<long>(resourceSize - readTotal) < lbuf.size_
58 - ? static_cast<long>(resourceSize - readTotal) : lbuf.size_;
59 + while (readTotal < pResourceSize) {
60 + toRead = static_cast<long>(pResourceSize - readTotal) < lbuf.size_
61 + ? static_cast<long>(pResourceSize - readTotal) : lbuf.size_;
62 if (io_->read(lbuf.pData_, toRead) != toRead) {
63 throw Error(3, "Photoshop");
64 }
65 @@ -478,11 +475,11 @@
66 if (outIo.write(lbuf.pData_, toRead) != toRead) throw Error(21);
67 }
68 if (outIo.error()) throw Error(21);
69 - newResLength += resourceSize + adjResourceNameLen + 12;
70 + newResLength += pResourceSize + adjResourceNameLen + 12;
71 }
72
73 - io_->seek(curOffset + resourceSize, BasicIo::beg);
74 - oldResLength -= (12 + adjResourceNameLen + resourceSize);
75 + io_->seek(curOffset + pResourceSize, BasicIo::beg);
76 + oldResLength -= (12 + adjResourceNameLen + pResourceSize);
77 }
78
79 // Append IPTC_NAA resource block, if not yet written