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

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


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

The following commit has been merged in the master branch:
commit 71fd0ae96ecd2a78d3ace4605f8fdeedc75e6f89
Author: draekko <draekko.software at gmail.com>
Date:   Fri Aug 12 11:46:51 2016 +0000

    #1199 (as was discussed) moved WebPImage::debugPrintHex to Internal::binaryToHex
---
 src/image.cpp     | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/image_int.hpp |  5 +++++
 src/webpimage.cpp | 44 ++++----------------------------------------
 3 files changed, 59 insertions(+), 40 deletions(-)

diff --git a/src/image.cpp b/src/image.cpp
index 4a08639..b7906e6 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -648,6 +648,56 @@ namespace Exiv2 {
         return binaryToString(buf.pData_,size,start);
     }
 
+    std::string binaryToHex(const byte *data, size_t size)
+    {
+        std::stringstream hexOutput;
+
+        unsigned long tl = (unsigned long)(size / 16) * 16;
+        unsigned long tl_offset = size - tl;
+
+        hexOutput << "Display Hex Dump [size:" << (unsigned long)size << "]" << std::endl;
+
+        for (unsigned long loop = 0; loop < (unsigned long)size; loop++) {
+            if (data[loop] < 16) {
+                hexOutput << "0";
+            }
+            hexOutput << std::hex << (int)data[loop];
+            if ((loop % 8) == 7) {
+                hexOutput << "  ";
+            }
+            if ((loop % 16) == 15 || loop == (tl + tl_offset - 1)) {
+                int max = 15;
+                if (loop >= tl) {
+                    max = tl_offset - 1;
+                    hexOutput << "  ";
+                    for (long offset = 0; offset < (16 - tl_offset); offset++) {
+                        if ((offset % 8) == 7) {
+                            hexOutput << "  ";
+                        }
+                        hexOutput << "   ";
+                    }
+                }
+                hexOutput << " ";
+                for (unsigned long  offset = max; offset >= 0; offset--) {
+                    if (offset == (max - 8)) {
+                        hexOutput << "  ";
+                    }
+                    if ((data[loop - offset]) >= 0x20 &&
+                        (data[loop - offset]) <= 0x7E) {
+                        hexOutput << data[loop - offset];
+                    } else {
+                        hexOutput << ".";
+                    }
+                }
+                hexOutput << std::endl;
+            }
+        }
+
+        hexOutput << std::endl << std::endl << std::endl;
+
+        return hexOutput.str();
+    }
+
 	std::string indent(int32_t d)
     {
     	std::string result ;
diff --git a/src/image_int.hpp b/src/image_int.hpp
index 7e515ee..62a845c 100644
--- a/src/image_int.hpp
+++ b/src/image_int.hpp
@@ -66,6 +66,11 @@ namespace Exiv2 {
     std::string binaryToString(const byte* buff, size_t size, size_t start /*=0*/);
 
     /*!
+      @brief format binary for display of raw data .
+     */
+    std::string binaryToHex(const byte *data, size_t size);
+
+    /*!
       @brief indent output for kpsRecursive in \em printStructure() \em .
      */
     std::string indent(int32_t depth);
diff --git a/src/webpimage.cpp b/src/webpimage.cpp
index 75fec6e..f597da6 100644
--- a/src/webpimage.cpp
+++ b/src/webpimage.cpp
@@ -43,16 +43,14 @@
 #include "tiffimage_int.hpp"
 #include "exiv2/convert.hpp"
 #include <cmath>
-#include <sstream>
 #include <iomanip>
 #include <string>
 #include <cstring>
 #include <iostream>
+#include <sstream>
 #include <cassert>
 #include <cstdio>
 
-#include <zlib.h>     // To uncompress or compress text chunk
-
 #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
 
 // *****************************************************************************
@@ -60,7 +58,6 @@
 namespace Exiv2 {
     namespace Internal {
 
-
 }}                                      // namespace Internal, Exiv2
 
 namespace Exiv2 {
@@ -668,8 +665,9 @@ namespace Exiv2 {
                 memcpy(rawExifData + offset, payload.pData_, (long)payload.size_);
 
 #ifdef DEBUG
-                debugPrintHex(rawExifData, size);
+                std::cout << Internal::binaryToHex(rawExifData, size);
 #endif
+
                 if (pos != -1) {
                     XmpData  xmpData;
                     ByteOrder bo = ExifParser::decode(exifData_,
@@ -696,7 +694,7 @@ namespace Exiv2 {
 #endif
                 } else {
 #ifdef DEBUG
-                    debugPrintHex(xmpData_, xmpData_.size());
+                    std::cout << Internal::binaryToHex(xmpData_, xmpData_.size());
 #endif
 #ifdef __USE_IPTC__
                     copyXmpToIptc(xmpData_, iptcData_);
@@ -831,38 +829,4 @@ namespace Exiv2 {
         return pos;
     }
 
-    void WebPImage::debugPrintHex(byte *data, long size) {
-        std::cout << "Display Hex Dump [size:" << size << "]" << std::endl;
-        long tl = (long)(size / 16) * 16;
-        long tl_offset = size - tl;
-        for (long loop = 0; loop < size; loop++) {
-            if (data[loop] < 16) std::cout << "0";
-            std::cout << std::hex << (int)data[loop] << " ";
-            if ((loop % 8) == 7) std::cout << "  ";
-            if ((loop % 16) == 15 || loop == (tl + tl_offset - 1)) {
-                int max = 15;
-                if (loop >= tl) {
-                    max = tl_offset - 1;
-                    std::cout << "  ";
-                    for (long offset = 0; offset < (16 - tl_offset); offset++) {
-                        if ((offset % 8) == 7) std::cout << "  ";
-                        std::cout << "   ";
-                    }
-                }
-                std::cout << " ";
-                for (long offset = max; offset >= 0; offset--) {
-                    if (offset == (max - 8)) std::cout << "  ";
-                    if ((data[loop - offset]) >= 0x20 &&
-                        (data[loop - offset]) <= 0x7E) {
-                        std::cout << data[loop - offset];
-                    } else {
-                        std::cout << ".";
-                    }
-                }
-                std::cout << std::endl;
-            }
-        }
-        std::cout << std::dec << std::endl << std::endl;
-    }
-
 } // namespace Exiv2

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list