[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:37:40 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=4ecf818

The following commit has been merged in the master branch:
commit 4ecf81832d24bd7474f9fb390019c1c5284dc95f
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun May 28 05:55:01 2006 +0000

    Fixed subtle vector bug and cleaned-up setIptcIrb
---
 src/jpgimage.cpp | 63 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index 54f77a4..5cff890 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -124,6 +124,12 @@ namespace Exiv2 {
                                   long            sizePsData,
                                   const IptcData& iptcData)
     {
+        if (sizePsData > 0) assert(pPsData);
+#ifdef DEBUG
+        std::cerr << "IRB block at the beginning of Photoshop::setIptcIrb
";
+        if (sizePsData == 0) std::cerr << "  None.
";
+        else hexdump(std::cerr, pPsData, sizePsData);
+#endif
         const byte* record    = pPsData;
         uint16_t    sizeIptc  = 0;
         uint16_t    sizeHdr   = 0;
@@ -133,33 +139,40 @@ namespace Exiv2 {
 
         Blob psBlob;
         // Data is rounded to be even
-        const int sizeOldData = sizeHdr + sizeIptc + (sizeIptc & 1);
-        if (sizePsData > sizeOldData || iptcData.count() > 0) {
-            const long sizeFront = static_cast<long>(record - pPsData);
-            const long sizeEnd = sizePsData - sizeFront - sizeOldData;
-
-            // Write data before old record.
-            if (sizePsData > 0) append(psBlob, pPsData, sizeFront);
-
-            // Write new iptc record if we have it
-            DataBuf rawIptc(iptcData.copy());
-            if (rawIptc.size_ > 0) {
-                byte tmpBuf[12];
-                memcpy(tmpBuf, Photoshop::bimId_, 4);
-                us2Data(tmpBuf + 4, iptc_, bigEndian);
-                tmpBuf[6] = 0;
-                tmpBuf[7] = 0;
-                ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian);
-                append(psBlob, tmpBuf, 12);
-                append(psBlob, rawIptc.pData_, rawIptc.size_);
-                // Data is padded to be even (but not included in size)
-                if (rawIptc.size_ & 1) psBlob.push_back(0x00);
-            }
+        const uint16_t sizeOldData = sizeHdr + sizeIptc + (sizeIptc & 1);
+        const uint16_t sizeFront = static_cast<uint16_t>(record - pPsData);
+        const uint16_t sizeEnd = static_cast<uint16_t>(sizePsData - sizeFront - sizeOldData);
 
-            // Write existing stuff after record
-            if (sizePsData > 0) append(psBlob, record + sizeOldData, sizeEnd);
+        // Write data before old record.
+        if (sizePsData > 0 && sizeFront > 0) {
+            append(psBlob, pPsData, sizeFront);
+        }
+        // Write new iptc record if we have it
+        DataBuf rawIptc(iptcData.copy());
+        if (rawIptc.size_ > 0) {
+            byte tmpBuf[12];
+            memcpy(tmpBuf, Photoshop::bimId_, 4);
+            us2Data(tmpBuf + 4, iptc_, bigEndian);
+            tmpBuf[6] = 0;
+            tmpBuf[7] = 0;
+            ul2Data(tmpBuf + 8, rawIptc.size_, bigEndian);
+            append(psBlob, tmpBuf, 12);
+            append(psBlob, rawIptc.pData_, rawIptc.size_);
+            // Data is padded to be even (but not included in size)
+            if (rawIptc.size_ & 1) psBlob.push_back(0x00);
         }
-        return DataBuf(&psBlob[0], psBlob.size());
+        // Write existing stuff after record
+        if (sizePsData > 0 && sizeEnd > 0) {
+            append(psBlob, record + sizeOldData, sizeEnd);
+        }
+        DataBuf rc;
+        if (psBlob.size() > 0) rc = DataBuf(&psBlob[0], psBlob.size());
+#ifdef DEBUG
+        std::cerr << "IRB block at the end of Photoshop::setIptcIrb
";
+        if (rc.size_ == 0) std::cerr << "  None.
";
+        else hexdump(std::cerr, rc.pData_, rc.size_);
+#endif
+        return rc;
 
     } // Photoshop::setIptcIrb
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list