[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:57 UTC 2017


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

The following commit has been merged in the master branch:
commit d321dad695dc4b0cbc9eaf93691d1bb505a378c6
Author: Robin Mills <robin at clanmills.com>
Date:   Fri Sep 16 11:19:07 2016 +0000

    #1108 Fixing issue with pngimage::printStructure() and the "Software" string in test/data/imagemagick.png
---
 src/pngimage.cpp            |  49 ++++++++++++++++++++++----------------------
 test/data/bugfixes-test.out | Bin 1912573 -> 1912573 bytes
 test/functions.source       |   1 +
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index 81e48e6..d5f95dc 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -221,7 +221,10 @@ namespace Exiv2 {
             const std::string softKey = "Software";
 
             bool bPrint = option == kpsBasic || option == kpsRecursive ;
-            bool bFirst = true ;
+            if ( bPrint ) {
+                out << "STRUCTURE OF PNG FILE: " << io_->path() << std::endl;
+                out << " address | chunk |  length | data                           | checksum" << std::endl;
+            }
 
             const long imgSize = io_->size();
             DataBuf    cheaderBuf(8);
@@ -259,6 +262,20 @@ namespace Exiv2 {
                 while ( dataString.size() < 32 ) dataString += ' ';
                 dataString  = dataString.substr(0,30);
 
+                if ( bPrint ) {
+                    io_->seek(dataOffset, BasicIo::cur);// jump to checksum
+                    byte checksum[4];
+                    io_->read(checksum,4);
+                    io_->seek(restore, BasicIo::beg)   ;// restore file pointer
+
+                    out << Internal::stringFormat("%8d | %-5s |%8d | "
+                                                  ,(uint32_t)address, chType,dataOffset)
+                        << dataString
+                        << Internal::stringFormat(" | 0x%02x%02x%02x%02x"
+                                                   ,checksum[0],checksum[1],checksum[2],checksum[3])
+                        << std::endl;
+                }
+
                 // chunk type
                 bool tEXt  = std::strcmp(chType,"tEXt")== 0;
                 bool zTXt  = std::strcmp(chType,"zTXt")== 0;
@@ -310,12 +327,12 @@ namespace Exiv2 {
                             TiffImage::printTiffStructure(*p,out,option,depth);
                         }
 
-                        if ( bSoft ) {
-                            const char* bytes = (const char*) dataBuf.pData_;
-                            uint32_t    l     = (uint32_t) std::strlen(bytes)+2;
-                            // create a copy on write memio object with the data, then print the structure
-                            BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(dataBuf.pData_+l,dataBuf.size_-l));
-                            out << Internal::indent(depth) << (const char*) buff.pData_ << ": " << (const char*) dataBuf.pData_ << std::endl;
+                        if ( bSoft && dataBuf.size_ > 0) {
+                            DataBuf     s(dataBuf.size_+1);               // allocate buffer with an extra byte
+                            memcpy(s.pData_,dataBuf.pData_,dataBuf.size_);// copy in the dataBuf
+                            s.pData_[dataBuf.size_] = 0 ;                 // nul terminate it
+                            const char* str = (const char*) s.pData_;     // give it name
+                            out << Internal::indent(depth) << (const char*) buff.pData_ << ": " << str << std::endl;
                         }
 
                         if ( bICC ) {
@@ -328,23 +345,7 @@ namespace Exiv2 {
                     }
                     delete[] data;
                 }
-                io_->seek(dataOffset, BasicIo::cur);
-
-                byte checksum[4];
-                io_->read(checksum,4);
-                if ( bPrint ) {
-                    if ( bFirst ) {
-                        out << "STRUCTURE OF PNG FILE: " << io_->path() << std::endl;
-                        out << " address | chunk |  length | data                           | checksum" << std::endl;
-                        bFirst = false;
-                    }
-                    out << Internal::stringFormat("%8d | %-5s |%8d | "
-                              ,(uint32_t)address, chType,dataOffset)
-                        << dataString
-                        << Internal::stringFormat(" | 0x%02x%02x%02x%02x"
-                              ,checksum[0],checksum[1],checksum[2],checksum[3])
-                        << std::endl;
-                }
+                io_->seek(dataOffset+4, BasicIo::cur);// jump past checksum
                 if (io_->error()) throw Error(14);
             }
         }
diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out
index 4327556..ecbd817 100644
Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ
diff --git a/test/functions.source b/test/functions.source
index 0d4bd5c..2ecd7ff 100644
--- a/test/functions.source
+++ b/test/functions.source
@@ -419,6 +419,7 @@ copyVideoFiles ()
 checkSum()
 {
     # cygwin checksum: http://esrg.sourceforge.net/utils_win_up/md5sum/
+    # macosx - built/installed coreutils 8.25 http://ftp.gnu.org/gnu/coreutils/
     md5sum $1 | cut -d' ' -f 1
 }
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list