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


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

The following commit has been merged in the master branch:
commit 82950ffc9e046cfa8d9813846e6e02ef1616f444
Author: brad <chickb at gmail.com>
Date:   Wed Feb 2 21:09:18 2005 +0000

    Added size method to basicio and test cases.
---
 src/basicio.cpp | 18 ++++++++++++++++++
 src/basicio.hpp | 19 +++++++++++++++++++
 src/iotest.cpp  | 15 ++++++++++++++-
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/src/basicio.cpp b/src/basicio.cpp
index bf43123..467e38e 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -196,6 +196,19 @@ namespace Exiv2 {
         return ftell(fp_);
     }
 
+
+    long FileIo::size() const
+    {
+        if (fp_ != 0) {
+            fflush(fp_);
+        }
+        struct stat buf;
+        int ret = stat(path_.c_str(), &buf);
+        
+        if (ret == 0) return -1;
+        return buf.st_size; 
+    }
+
     int FileIo::open()
     {
         // Default open is in read-write binary mode
@@ -371,6 +384,11 @@ namespace Exiv2 {
     {
         return (long)idx_;
     }
+
+    long MemIo::size() const
+    {
+        return (long)data_.size();
+    }
     
     int MemIo::open()
     {
diff --git a/src/basicio.hpp b/src/basicio.hpp
index 4738576..b0dd783 100644
--- a/src/basicio.hpp
+++ b/src/basicio.hpp
@@ -184,6 +184,12 @@ namespace Exiv2 {
                  -l if failure;
          */
         virtual long tell() const = 0;
+        /*!
+          @brief Get the current size of the IO source in bytes.
+          @return Size of the IO source in bytes;<BR>
+                 -l if failure;
+         */
+        virtual long size() const = 0;
         //!Returns true if the IO source is open, otherwise false.
         virtual bool isopen() const = 0;
         //!Returns 0 if the IO source is in a valid state, otherwise nonzero.
@@ -394,6 +400,13 @@ namespace Exiv2 {
                  -l if failure;
          */
         virtual long tell() const;
+        /*!
+          @brief Flush any buffered writes and get the current file size
+              in bytes. 
+          @return Size of the file in bytes;<BR>
+                 -l if failure;
+         */
+        virtual long size() const;
         //!Returns true if the file is open, otherwise false.
         virtual bool isopen() const;
         //!Returns 0 if the file is in a valid state, otherwise nonzero.
@@ -568,6 +581,12 @@ namespace Exiv2 {
           @return Offset from the start of the memory block
          */
         virtual long tell() const;
+        /*!
+          @brief Get the current memory buffer size in bytes. 
+          @return Size of the in memory data in bytes;<BR>
+                 -l if failure;
+         */
+        virtual long size() const;
         //!Always returns true
         virtual bool isopen() const;
         //!Always returns 0
diff --git a/src/iotest.cpp b/src/iotest.cpp
index 6c47679..a3105d8 100644
--- a/src/iotest.cpp
+++ b/src/iotest.cpp
@@ -25,7 +25,7 @@
   File     : iotest.cpp
   Version  : $Rev$
   Author(s): Brad Schick (brad) <brad at robotbattle.com>
-  History  : 13-Jul-04, brad: created
+  History  : 04-Dec-04, brad: created
  */
 // *****************************************************************************
 // included header files
@@ -74,6 +74,13 @@ try {
     memIo1.seek(0, BasicIo::beg);
     fileOut1.write(memIo1);
 
+    // Make sure they are all the same size
+    if(fileIn.size() != memIo1.size() || memIo1.size() != fileOut1.size()) {
+        std::cerr << argv[0] << 
+            ": Sizes do not match
";
+        return 1;
+    }
+
     // Read writereadseek test on MemIo
     MemIo memIo2;
     int rc = WriteReadSeek(memIo2);
@@ -145,6 +152,12 @@ int WriteReadSeek(BasicIo &io)
         std::cerr << ": WRS initial write failed
";
         return 2;
     }
+    
+    if (io.size() != len1) {
+        std::cerr << ": WRS size is not " << len1 << "
";
+        return 2;
+    }
+
     io.seek(-len1, BasicIo::cur);
 
     int c = EOF;

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list