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


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

The following commit has been merged in the master branch:
commit 006625e116dea99d07ef84489505f2002ef0e6de
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun May 10 09:37:34 2015 +0000

    Removed helper functions binaryToString() and stringFormat() from the API and from class Image and made them internal helpers. Renamed type printStructureOption_e to PrintStructureOption to conform with the common naming convention.
---
 include/exiv2/image.hpp                 | 16 +-----
 include/exiv2/jpgimage.hpp              |  2 +-
 include/exiv2/pngimage.hpp              |  2 +-
 include/exiv2/tiffimage.hpp             |  2 +-
 src/actions.cpp                         |  2 +-
 src/image.cpp                           | 97 ++++++++++++++++++---------------
 src/{rw2image_int.hpp => image_int.hpp} | 38 +++++--------
 src/jpgimage.cpp                        |  9 +--
 src/pngimage.cpp                        |  7 ++-
 src/tiffimage.cpp                       | 13 +++--
 10 files changed, 88 insertions(+), 100 deletions(-)

diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp
index 97f1900..83d1534 100644
--- a/include/exiv2/image.hpp
+++ b/include/exiv2/image.hpp
@@ -72,9 +72,9 @@ namespace Exiv2 {
     typedef std::vector<NativePreview> NativePreviewList;
 
     /*!
-      @brief options for printStructure
+      @brief Options for printStructure
      */
-    typedef enum { kpsNone, kpsBasic, kpsXMP } printStructureOption_e ;
+    typedef enum { kpsNone, kpsBasic, kpsXMP } PrintStructureOption;
 
     /*!
       @brief Abstract base class defining the interface for an image. This is
@@ -113,7 +113,7 @@ namespace Exiv2 {
                 not valid (does not look like data of the specific image type).
           @caution This function is not thread safe and intended for exiv2 -pS for debugging.
          */
-        virtual void printStructure(std::ostream& out,printStructureOption_e option=kpsNone);
+        virtual void printStructure(std::ostream& out, PrintStructureOption option =kpsNone);
         /*!
           @brief Read all metadata supported by a specific image format from the
               image. Before this method is called, the image metadata will be
@@ -412,16 +412,6 @@ namespace Exiv2 {
         bool writeXmpFromPacket() const;
         //! Return list of native previews. This is meant to be used only by the PreviewManager.
         const NativePreviewList& nativePreviews() const;
-        /*!
-          @brief format a string in the pattern of \em sprintf \em .
-        */
-		std::string stringFormat(const char* format, ...) const;
-
-        /*!
-          @brief format binary for display in \em printStructure() \em .
-        */
-        std::string binaryToString(DataBuf& buf,size_t size,size_t start=0) const;
-
         //@}
 
     protected:
diff --git a/include/exiv2/jpgimage.hpp b/include/exiv2/jpgimage.hpp
index 9731a78..50eaffd 100644
--- a/include/exiv2/jpgimage.hpp
+++ b/include/exiv2/jpgimage.hpp
@@ -159,7 +159,7 @@ namespace Exiv2 {
                 not valid (does not look like data of the specific image type).
           @caution This function is not thread safe and intended for exiv2 -pS for debugging.
          */
-        void printStructure(std::ostream& out,Exiv2::printStructureOption_e option);
+        void printStructure(std::ostream& out, PrintStructureOption option);
         //@}
 
     protected:
diff --git a/include/exiv2/pngimage.hpp b/include/exiv2/pngimage.hpp
index c668ae0..2fa940d 100644
--- a/include/exiv2/pngimage.hpp
+++ b/include/exiv2/pngimage.hpp
@@ -93,7 +93,7 @@ namespace Exiv2
                 not valid (does not look like data of the specific image type).
           @caution This function is not thread safe and intended for exiv2 -pS for debugging.
          */
-        void printStructure(std::ostream& out,Exiv2::printStructureOption_e option);
+        void printStructure(std::ostream& out, PrintStructureOption option);
         //@}
 
         //! @name Accessors
diff --git a/include/exiv2/tiffimage.hpp b/include/exiv2/tiffimage.hpp
index 4b2a756..7ca67ad 100644
--- a/include/exiv2/tiffimage.hpp
+++ b/include/exiv2/tiffimage.hpp
@@ -93,7 +93,7 @@ namespace Exiv2 {
                 not valid (does not look like data of the specific image type).
           @caution This function is not thread safe and intended for exiv2 -pS for debugging.
          */
-        void printStructure(std::ostream& out,Exiv2::printStructureOption_e option);
+        void printStructure(std::ostream& out, PrintStructureOption option);
 
         /*!
           @brief Not supported. TIFF format does not contain a comment.
diff --git a/src/actions.cpp b/src/actions.cpp
index 6d8806e..4568764 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -252,7 +252,7 @@ namespace Action {
         return 1;
     } // Print::run
 
-    int Print::printStructure(std::ostream& out,Exiv2::printStructureOption_e option)
+    int Print::printStructure(std::ostream& out, Exiv2::PrintStructureOption option)
     {
         if (!Exiv2::fileExists(path_, true)) {
             std::cerr << path_ << ": "
diff --git a/src/image.cpp b/src/image.cpp
index f134aca..e443da7 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -36,6 +36,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "config.h"
 
 #include "image.hpp"
+#include "image_int.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 
@@ -167,7 +168,8 @@ namespace Exiv2 {
     Image::~Image()
     {
     }
-    void Image::printStructure(std::ostream&, printStructureOption_e)
+
+    void Image::printStructure(std::ostream&, PrintStructureOption)
     {
         throw Error(13, io_->path());
     }
@@ -356,50 +358,6 @@ namespace Exiv2 {
         return ImageFactory::checkMode(imageType_, metadataId);
     }
 
-    std::string Image::stringFormat(const char* format, ...) const
-    {
-        std::string result;
-
-        int     need   = (int) std::strlen(format)*2;          // initial guess
-        char*   buffer = NULL;
-        int     again  =    4;
-        int     rc     =   -1;
-
-        while (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 ( rc > 0 ) result = std::string(buffer) ;
-        if ( buffer ) delete[] buffer;                         // free buffer
-        return result;
-    }
-
-    std::string Image::binaryToString(DataBuf& buf,size_t size,size_t start /* = 0 */) const
-    {
-        std::string result = "";
-        byte* buff = buf.pData_;
-
-        size += start;
-
-        while (start < size) {
-            int   c             = (int) buff[start++] ;
-            bool  bTrailingNull = c == 0 && start == size;
-            if ( !bTrailingNull ) {
-                if (c < ' ' || c > 127) c = '.' ;
-                result +=  (char) c ;
-            }
-        }
-        return result;
-    }
-
     AccessMode ImageFactory::checkMode(int type, MetadataId metadataId)
     {
         const Registry* r = find(registry, type);
@@ -619,3 +577,52 @@ namespace Exiv2 {
     } // append
 
 }                                       // namespace Exiv2
+
+namespace Exiv2 {
+    namespace Internal {
+
+    std::string stringFormat(const char* format, ...)
+    {
+        std::string result;
+
+        int     need   = (int) std::strlen(format)*2;          // initial guess
+        char*   buffer = NULL;
+        int     again  =    4;
+        int     rc     =   -1;
+
+        while (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 ( rc > 0 ) result = std::string(buffer) ;
+        if ( buffer ) delete[] buffer;                         // free buffer
+        return result;
+    }
+
+    std::string binaryToString(DataBuf& buf, size_t size, size_t start /*=0*/)
+    {
+        std::string result = "";
+        byte* buff = buf.pData_;
+
+        size += start;
+
+        while (start < size) {
+            int   c             = (int) buff[start++] ;
+            bool  bTrailingNull = c == 0 && start == size;
+            if ( !bTrailingNull ) {
+                if (c < ' ' || c > 127) c = '.' ;
+                result +=  (char) c ;
+            }
+        }
+        return result;
+    }
+
+}}                                      // namespace Internal, Exiv2
diff --git a/src/rw2image_int.hpp b/src/image_int.hpp
similarity index 67%
copy from src/rw2image_int.hpp
copy to src/image_int.hpp
index d141cdf..fbc54b8 100644
--- a/src/rw2image_int.hpp
+++ b/src/image_int.hpp
@@ -19,19 +19,18 @@
  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
  */
 /*!
-  @file    rw2image_int.hpp
-  @brief   Internal classes to support RW2 image format
-  @version $Rev$
+  @file    image_int.hpp
+  @brief   Internal image helpers
+  @version $Rev: 3777 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    06-Jan-09, ahu: created
+  @date    10-May-15, ahu: created
  */
-#ifndef RW2IMAGE_INT_HPP_
-#define RW2IMAGE_INT_HPP_
+#ifndef IMAGE_INT_HPP_
+#define IMAGE_INT_HPP_
 
 // *****************************************************************************
 // included header files
-#include "tiffimage_int.hpp"
 #include "types.hpp"
 
 // + standard includes
@@ -46,26 +45,15 @@ namespace Exiv2 {
 // class definitions
 
     /*!
-      @brief Panasonic RW2 header structure.
+      @brief format a string in the pattern of \em sprintf \em .
      */
-    class Rw2Header : public TiffHeaderBase {
-    public:
-        //! @name Creators
-        //@{
-        //! Default constructor
-        Rw2Header();
-        //! Destructor.
-        ~Rw2Header();
-        //@}
+    std::string stringFormat(const char* format, ...);
 
-        //! @name Accessors
-        //@{
-        //! Not yet implemented. Does nothing and returns an empty buffer.
-        DataBuf write() const;
-        //@}
-
-    }; // class Rw2Header
+    /*!
+      @brief format binary for display in \em printStructure() \em .
+     */
+    std::string binaryToString(DataBuf& buf, size_t size, size_t start =0);
 
 }}                                      // namespace Internal, Exiv2
 
-#endif                                  // #ifndef RW2IMAGE_INT_HPP_
+#endif                                  // #ifndef IMAGE_INT_HPP_
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index e76b783..3721390 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -35,6 +35,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "config.h"
 
 #include "jpgimage.hpp"
+#include "image_int.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 
@@ -515,9 +516,9 @@ namespace Exiv2 {
         return true ;
     }
 
-#define REPORT_MARKER if ( option == kpsBasic ) out << stringFormat("%8ld | %#02x %-5s",io_->tell(), marker,nm[marker].c_str())
+#define REPORT_MARKER if ( option == kpsBasic ) out << Internal::stringFormat("%8ld | %#02x %-5s",io_->tell(), marker,nm[marker].c_str())
 
-    void JpegBase::printStructure(std::ostream& out,printStructureOption_e option)
+    void JpegBase::printStructure(std::ostream& out, PrintStructureOption option)
     {
         if (io_->open() != 0) throw Error(9, io_->path(), strError());
         // Ensure that this is the correct image type
@@ -589,7 +590,7 @@ namespace Exiv2 {
                 ){
                     size = getUShort(buf.pData_, bigEndian);
                 }
-                if ( option == kpsBasic ) out << stringFormat(" | %7d ", size);
+                if ( option == kpsBasic ) out << Internal::stringFormat(" | %7d ", size);
 
                 // only print the signature for appn
                 if (marker >= app0_ && marker <= (app0_ | 0x0F)) {
@@ -624,7 +625,7 @@ namespace Exiv2 {
                             bufRead = size;
                         }
                     } else if ( option == kpsBasic ) {
-                        out << "| " << binaryToString(buf,32,size>0?2:0);
+                        out << "| " << Internal::binaryToString(buf,32,size>0?2:0);
                     }
                 }
 
diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index df30d5d..78d6ba4 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -37,6 +37,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "pngimage.hpp"
 #include "jpgimage.hpp"
 #include "image.hpp"
+#include "image_int.hpp"
 #include "basicio.hpp"
 #include "error.hpp"
 #include "futils.hpp"
@@ -91,7 +92,7 @@ namespace Exiv2 {
         return "image/png";
     }
 
-    void PngImage::printStructure(std::ostream& out,printStructureOption_e option)
+    void PngImage::printStructure(std::ostream& out, PrintStructureOption option)
     {
         if (io_->open() != 0) {
             throw Error(9, io_->path(), strError());
@@ -145,10 +146,10 @@ namespace Exiv2 {
                     DataBuf buff(blen+1);
                     io_->read(buff.pData_,blen);
                     dataOffset -=  blen ;
-                    dataString  = binaryToString(buff,blen);
+                    dataString  = Internal::binaryToString(buff, blen);
                 }
 
-                if ( option == kpsBasic ) out << stringFormat("%8d | %5d | %10s |%8d | ",(uint32_t)address, index++,chType,dOff) << dataString << std::endl;
+                if ( option == kpsBasic ) out << Internal::stringFormat("%8d | %5d | %10s |%8d | ",(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 3d4ec32..cb848b2 100644
--- a/src/tiffimage.cpp
+++ b/src/tiffimage.cpp
@@ -38,6 +38,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "tiffvisitor_int.hpp"
 #include "makernote_int.hpp"
 #include "image.hpp"
+#include "image_int.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 #include "types.hpp"
@@ -438,14 +439,14 @@ namespace Exiv2 {
             || isRationalType(type)
             ;
     }
-    static bool isPrintXMP(uint16_t type,Exiv2::printStructureOption_e option)
+    static bool isPrintXMP(uint16_t type, Exiv2::PrintStructureOption option)
     {
         return type == 700 && option == kpsXMP;
     }
 
 #define MIN(a,b) ((a)<(b))?(b):(a)
 
-    void TiffImage::printStructure(std::ostream& out,Exiv2::printStructureOption_e option)
+    void TiffImage::printStructure(std::ostream& out, Exiv2::PrintStructureOption option)
     {
         if (io_->open() != 0) throw Error(9, io_->path(), strError());
         // Ensure that this is the correct image type
@@ -468,13 +469,13 @@ namespace Exiv2 {
                         ;
 
             if ( option == kpsBasic ) {
-                out << stringFormat("STRUCTURE OF TIFF FILE (%c%c): ",c,c) << io_->path() << std::endl;
+                out << Internal::stringFormat("STRUCTURE OF TIFF FILE (%c%c): ",c,c) << io_->path() << std::endl;
                 out << " address |    tag                           |      type |    count |   offset | value
";
             }
 
             uint32_t start = byteSwap4(dir,4,bSwap);
             while  ( start ) {
-                // if ( option == kpsBasic ) out << stringFormat("bSwap, start = %d %u
",bSwap,offset);
+                // if ( option == kpsBasic ) out << Internal::stringFormat("bSwap, start = %d %u
",bSwap,offset);
 
                 // Read top of directory
                 io_->seek(start,BasicIo::beg);
@@ -516,7 +517,7 @@ namespace Exiv2 {
 
                     if ( option == kpsBasic ) {
                         uint32_t address = start + 2 + i*12 ;
-                        out << stringFormat("%8u | %#06x %-25s |%10s |%9u |%9u | ",address,tag,tagName(tag,25),typeName(type),count,offset);
+                        out << Internal::stringFormat("%8u | %#06x %-25s |%10s |%9u |%9u | ",address,tag,tagName(tag,25),typeName(type),count,offset);
 
                         if ( isShortType(type) ){
                             for ( uint16_t k = 0 ; k < kount ; k++ ) {
@@ -542,7 +543,7 @@ namespace Exiv2 {
                                 sp = " ";
                             }
                         } else if ( isStringType(type) ) {
-                            out << sp << binaryToString(buf,kount);
+                            out << sp << Internal::binaryToString(buf, kount);
                         }
                         sp = kount == count ? "" : " ...";
                         out << sp << std::endl;

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list