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

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


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

The following commit has been merged in the master branch:
commit 84bf485ebebc9fd09188495645f761bff00c8f1d
Author: Robin Mills <robin at clanmills.com>
Date:   Tue Apr 28 19:19:59 2015 +0000

    #922.  Fixing -pS and -pX on MSVC.
---
 include/exiv2/image.hpp |  2 +-
 samples/exiv2json.cpp   |  2 +-
 src/image.cpp           | 37 ++++++++++++++++++-------------------
 src/pngimage.cpp        |  3 +--
 src/tiffimage.cpp       |  6 ++++--
 5 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp
index 9f96d3c..dc7639e 100644
--- a/include/exiv2/image.hpp
+++ b/include/exiv2/image.hpp
@@ -415,7 +415,7 @@ namespace Exiv2 {
         /*!
           @brief format a string in the pattern of \em sprintf \em .
         */
-        std::string stringFormat(const std::string fmt, ...) const;
+		std::string stringFormat(const char* format, ...) const;
 
         /*!
           @brief format binary for display in \em printStructure() \em .
diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp
index 0149d86..7242ed3 100644
--- a/samples/exiv2json.cpp
+++ b/samples/exiv2json.cpp
@@ -165,7 +165,7 @@ void push(Jzon::Node& node,const std::string& key,T i)
 
         case Exiv2::tiffFloat:
         case Exiv2::tiffDouble:
-			 STORE(node,key,i->value().toFloat());
+			 STORE(node,key,std::atof(value.c_str()) );
         break;
 
         case Exiv2::unsignedRational:
diff --git a/src/image.cpp b/src/image.cpp
index 5481732..f0fe320 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -352,30 +352,29 @@ namespace Exiv2 {
         return ImageFactory::checkMode(imageType_, metadataId);
     }
 
-    std::string Image::stringFormat(const std::string fmt, ...) const
+    std::string Image::stringFormat(const char* format, ...) const
     {
         std::string result;
 
-        int     need = (int) fmt.size()*4;       // initial guess
-        char*   buffer = new char[need];         // allocate a buffer
-        va_list ap;                              // variable arg list
-
-        va_start(ap, fmt);
-        need=vsnprintf(buffer, need, fmt.c_str(), ap);
-        va_end(ap);
-
-        if (need < 0) {                          // make buffer bigger
-            delete[] buffer;
-			need   = -need ;
-            buffer = new char[need+2];
-            va_start(ap, fmt);
-            need=vsnprintf(buffer, need, fmt.c_str(), ap);
-            va_end(ap);
+		int     need   = (int) std::strlen(format);            // initial guess
+        char*   buffer = NULL;
+		int     again  =    4;
+		int     rc     =   -1;
+
+        if (rc < 0 && again--) {
+            if ( buffer ) delete[] buffer;
+			need   *= 2 ;
+            buffer = new char[need];
+			if ( buffer ) {
+				va_list  args;                                 // variable arg list
+				va_start(args, format);						   // args start after format
+				rc=vsnprintf(buffer,(unsigned int)need, format, args);
+				va_end(args);		                           // free the args
+			}
         }
 
-        if ( need > 0 ) result = std::string(buffer) ;
-
-        delete[] buffer;                         // free buffer
+        if ( rc > 0 ) result = std::string(buffer) ;
+        if ( buffer ) delete[] buffer;                         // free buffer
         return result;
     }
 
diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index ea073ef..03f3964 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -148,8 +148,7 @@ namespace Exiv2 {
                     dataString  = binaryToString(buff,blen);
                 }
 
-                if ( option == kpsBasic ) out << stringFormat("%8llu | %5ld | %10s |%8lu | ",address, index++,chType,dOff) << dataString << std::endl;
-
+                if ( option == kpsBasic ) out << stringFormat("%8lu | %5ld | %10s |%8lu | ",(uint32_t)address, index++,chType,dOff) << dataString << std::endl;
                 // for XMP, back up and read the whole block
                 const char* key = "XML:com.adobe.xmp" ;
                 size_t      start = ::strlen(key);
diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp
index 4e457a0..9cd286f 100644
--- a/src/tiffimage.cpp
+++ b/src/tiffimage.cpp
@@ -431,6 +431,8 @@ namespace Exiv2 {
         return type == 700 && option == kpsXMP;
     }
 
+#define MIN(a,b) ((a)<(b))?(b):(a)
+
     void TiffImage::printStructure(std::ostream& out,Exiv2::printStructureOption_e option)
     {
         if (io_->open() != 0) throw Error(9, io_->path(), strError());
@@ -449,7 +451,7 @@ namespace Exiv2 {
             // read header (we already know for certain that we have a Tiff file)
             io_->read(dir.pData_,  8);
             char c = (char) dir.pData_[0] ;
-#if __LITTLE_ENDIAN__
+#if __LITTLE_ENDIAN__ || defined(_MSC_VER)
             bool      bSwap   = c == 'M';
 #else
             bool      bSwap   = c == 'I';
@@ -491,7 +493,7 @@ namespace Exiv2 {
                                    : 1
                                    ;
 
-                    DataBuf  buf(size*kount + pad);  // allocate a buffer
+					DataBuf  buf(MIN(size*kount + pad,48));  // allocate a buffer
                     if ( isStringType(type) || count*size > 4 ) {          // data is in the directory => read into buffer
                         size_t   restore = io_->tell();  // save
                         io_->seek(offset,BasicIo::beg);  // position

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list