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

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


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

The following commit has been merged in the master branch:
commit cfec8527c75690099ff3033af40f80bfb9057c81
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Jun 12 15:13:23 2009 +0000

    #638: Replaced custom copyString function with strcpy, refactored some related code. Only tested on Linux, this may not compile on Windows.
---
 src/pngchunk.cpp     | 202 +++++++++++++++------------------------------------
 src/pngchunk_int.hpp |  10 +--
 2 files changed, 63 insertions(+), 149 deletions(-)

diff --git a/src/pngchunk.cpp b/src/pngchunk.cpp
index 8e02cc0..7509f39 100644
--- a/src/pngchunk.cpp
+++ b/src/pngchunk.cpp
@@ -359,45 +359,27 @@ namespace Exiv2 {
 
     DataBuf PngChunk::makeMetadataChunk(const DataBuf& metadata, MetadataType type, bool compress)
     {
-        if (type == comment_Data)
-        {
-            DataBuf key(11);
-            memcpy(key.pData_, "Description", 11);
-            DataBuf rawData = makeUtf8TxtChunk(key, metadata, compress);
-            return rawData;
-        }
-        else if (type == exif_Data)
-        {
-            DataBuf tmp(4);
-            memcpy(tmp.pData_, "exif", 4);
-            DataBuf rawProfile = writeRawProfile(metadata, tmp);
-            DataBuf key(17 + tmp.size_);
-            memcpy(key.pData_,      "Raw profile type ", 17);
-            memcpy(key.pData_ + 17, tmp.pData_, tmp.size_);
-            DataBuf rawData = makeAsciiTxtChunk(key, rawProfile, compress);
-            return rawData;
-        }
-        else if (type == iptc_Data)
-        {
-            DataBuf tmp(4);
-            memcpy(tmp.pData_, "iptc", 4);
-            DataBuf rawProfile = writeRawProfile(metadata, tmp);
-            DataBuf key(17 + tmp.size_);
-            memcpy(key.pData_,      "Raw profile type ", 17);
-            memcpy(key.pData_ + 17, tmp.pData_, tmp.size_);
-            DataBuf rawData = makeAsciiTxtChunk(key, rawProfile, compress);
-            return rawData;
-        }
-        else if (type == xmp_Data)
-        {
-            DataBuf key(17);
-            memcpy(key.pData_, "XML:com.adobe.xmp", 17);
-            DataBuf rawData = makeUtf8TxtChunk(key, metadata, compress);
-            return rawData;
+        DataBuf buf;
+        DataBuf rawProfile;
+
+        switch (type) {
+        case comment_Data:
+            buf = makeUtf8TxtChunk("Description", metadata, compress);
+            break;
+        case exif_Data:
+            rawProfile = writeRawProfile(metadata, "exif");
+            buf = makeAsciiTxtChunk("Raw profile type exif", rawProfile, compress);
+            break;
+        case iptc_Data:
+            rawProfile = writeRawProfile(metadata, "iptc");
+            buf = makeAsciiTxtChunk("Raw profile type iptc", rawProfile, compress);
+            break;
+        case xmp_Data:
+            buf = makeUtf8TxtChunk("XML:com.adobe.xmp", metadata, compress);
+            break;
         }
 
-        return DataBuf();
-
+        return buf;
     } // PngChunk::makeMetadataChunk
 
     void PngChunk::zlibUncompress(const byte*  compressedText,
@@ -487,37 +469,38 @@ namespace Exiv2 {
 
     } // PngChunk::zlibCompress
 
-    DataBuf PngChunk::makeAsciiTxtChunk(const DataBuf& key, const DataBuf& data, bool compress)
+    DataBuf PngChunk::makeAsciiTxtChunk(const char* key, const DataBuf& data, bool compress)
     {
         DataBuf type(4);
         DataBuf data4crc;
         DataBuf chunkData;
         byte    chunkDataSize[4];
         byte    chunkCRC[4];
+        long    keylen = strlen(key);
 
         if (compress)
         {
             // Compressed text chunk using ZLib.
             // Data format    : key ("zTXt") + 0x00 + compression type (0x00) + compressed data
-            // Chunk structure: data lenght (4 bytes) + chunk type (4 bytes) + compressed data + CRC (4 bytes)
+            // Chunk structure: data length (4 bytes) + chunk type (4 bytes) + compressed data + CRC (4 bytes)
 
             memcpy(type.pData_, "zTXt", 4);
 
             DataBuf compressedData;
             zlibCompress(data.pData_, data.size_, compressedData);
 
-            data4crc.alloc(key.size_ + 1 + 1 + compressedData.size_);
-            memcpy(data4crc.pData_,                 key.pData_,            key.size_);
-            memcpy(data4crc.pData_ + key.size_,     "

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list