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

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


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

The following commit has been merged in the master branch:
commit 3b60f986a0637541f9f2a06014e83e6678bf33b5
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu Apr 1 01:51:36 2004 +0000

    Added advance arg to isThisType()
---
 src/image.cpp | 16 ++++++----------
 src/image.hpp | 20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/image.cpp b/src/image.cpp
index e732054..cad5733 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -20,14 +20,14 @@
  */
 /*
   File:      image.cpp
-  Version:   $Name:  $ $Revision: 1.6 $
+  Version:   $Name:  $ $Revision: 1.7 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.6 $ $RCSfile: image.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.7 $ $RCSfile: image.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -149,12 +149,10 @@ namespace Exif {
     int JpegImage::readExifData(std::istream& is)
     {
         // Check if this is a JPEG image in the first place
-        if (!isThisType(is)) {
+        if (!isThisType(is, true)) {
             if (!is.good()) return 1;
             return 2;
         }
-        // isThisType does not advance the stream, so do this now
-        is.seekg(2, std::ios::cur);
 
         // Read and check section marker and size
         char tmpbuf[10];
@@ -213,12 +211,10 @@ namespace Exif {
     int JpegImage::writeExifData(std::ostream& os, std::istream& is) const
     {
         // Check if this is a JPEG image in the first place
-        if (!isThisType(is)) {
+        if (!isThisType(is, true)) {
             if (!is.good()) return 1;
             return 2;
         }
-        // isThisType does not advance the stream, so do this now
-        is.seekg(2, std::ios::cur);
 
         // Read and check section marker and size
         char tmpbuf[12];
@@ -263,7 +259,7 @@ namespace Exif {
         return new JpegImage(*this);
     }
 
-    bool JpegImage::isThisType(std::istream& is) const
+    bool JpegImage::isThisType(std::istream& is, bool advance) const
     {
         char c;
         is.get(c);
@@ -278,7 +274,7 @@ namespace Exif {
             is.seekg(-2, std::ios::cur);
             return false;
         }
-        is.seekg(-2, std::ios::cur);
+        if (advance == false) is.seekg(-2, std::ios::cur);
         return true;
     }
 
diff --git a/src/image.hpp b/src/image.hpp
index 8a09e6e..000a14d 100644
--- a/src/image.hpp
+++ b/src/image.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    image.hpp
   @brief   Class JpegImage to access JPEG images
-  @version $Name:  $ $Revision: 1.6 $
+  @version $Name:  $ $Revision: 1.7 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    09-Jan-04, ahu: created
@@ -93,10 +93,24 @@ namespace Exif {
         /*!
           @brief Determine if the content of the stream is an image of the type
                  of this class.
+
+          The advance flag determines if the read position in the stream is
+          moved (see below). This applies only if the image type matches and the
+          function returns true. If the image type does not match, the stream
+          position is not changed. However, if reading from the stream fails,
+          the stream position is undefined. Consult the stream state to obtain 
+          more information in this case.
+          
+          @param is Input stream with the image.
+          @param advance Flag indicating whether the read position in the stream
+                         should be advanced by the number of characters read to
+                         analyse the image stream (true) or left at its original
+                         position (false). This applies only if the image type 
+                         matches.
           @return  true  if the type of the image matches that of this;<BR>
                    false if the type of the image does not match.
          */
-        virtual bool isThisType(std::istream& is) const =0;
+        virtual bool isThisType(std::istream& is, bool advance =false) const =0;
         /*!
           @brief Write the %Exif data to file path.
           @param path Path to the file.
@@ -281,7 +295,7 @@ namespace Exif {
                   the stream may or may not have been advanced by 1 or 2 
                   characters.
          */
-        bool isThisType(std::istream& is) const;
+        bool isThisType(std::istream& is, bool advance) const;
         /*!
           @brief Write the %Exif data to file path, which must contain a JPEG
                  image. If an %Exif APP1 section exists in the file, it is

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list