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

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


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

The following commit has been merged in the master branch:
commit fe5a4c0022afefc14ce6f5cf97eb56a475aafd8a
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Tue Apr 26 15:27:41 2005 +0000

    Fixed changes introduced in previous revision. Added call to _commit() before stat() instead of insisting that the file is closed. Reverted changes to iotest.cpp introduced in the previous revision.
---
 src/basicio.cpp | 26 ++++++++++++++------------
 src/iotest.cpp  | 19 +++----------------
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/src/basicio.cpp b/src/basicio.cpp
index 2b56d24..fd3d454 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -28,9 +28,6 @@
 #include "rcsid.hpp"
 EXIV2_RCSID("@(#) $Id$");
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // *****************************************************************************
 // included header files
 #ifdef _MSC_VER
@@ -57,6 +54,10 @@ EXIV2_RCSID("@(#) $Id$");
 # include <unistd.h>                    // for getpid, stat
 #endif
 
+#if defined WIN32 && !defined __CYGWIN__
+# include <io.h>
+#endif
+
 // *****************************************************************************
 // class member definitions
 namespace Exiv2 {
@@ -99,6 +100,8 @@ namespace Exiv2 {
     {
         assert(fp_ != 0);
         if (opMode_ == opMode) return 0;
+        OpMode oldOpMode = opMode_;
+        opMode_ = opMode;
 
         bool reopen = true;
         std::string mode = "r+b";
@@ -125,11 +128,10 @@ namespace Exiv2 {
         if (!reopen) {
             // Don't do anything when switching _from_ opSeek mode; we
             // flush when switching _to_ opSeek.
-            if (opMode_ == opSeek) return 0;
+            if (oldOpMode == opSeek) return 0;
 
             // Flush. On msvcrt fflush does not do the job
             fseek(fp_, 0, SEEK_CUR);
-            opMode_ = opMode;
             return 0;
         }
 
@@ -137,7 +139,6 @@ namespace Exiv2 {
         long offset = ftell(fp_);
         if (offset == -1) return -1;
         if (open(mode) != 0) return 1;
-        opMode_ = opMode;
         return fseek(fp_, offset, SEEK_SET);
     }
 
@@ -233,8 +234,8 @@ namespace Exiv2 {
             assert(pos == BasicIo::end);
             fileSeek = SEEK_END;
         }
-        
-        opMode_ = opSeek;
+
+        if (switchMode(opSeek) != 0) return 1;
         return fseek(fp_, offset, fileSeek);
     }
         
@@ -247,13 +248,14 @@ namespace Exiv2 {
 
     long FileIo::size() const
     {
-#if defined WIN32 && !defined __CYGWIN__
-        // On msvcrt stat only works if the file is not open, or so it seems
-        assert(fp_ == 0);
-#endif
         if (fp_ != 0) {
             fflush(fp_);
+#if defined WIN32 && !defined __CYGWIN__
+            // This is required on msvcrt before stat after writing to a file
+            _commit(_fileno(fp_));
+#endif
         }
+
         struct stat buf;
         int ret = stat(path_.c_str(), &buf);
         
diff --git a/src/iotest.cpp b/src/iotest.cpp
index 441c593..ac82a60 100644
--- a/src/iotest.cpp
+++ b/src/iotest.cpp
@@ -73,11 +73,6 @@ try {
     memIo1.seek(0, BasicIo::beg);
     fileOut1.write(memIo1);
 
-    // On Win32 files must be closed before stat
-    memIo1.close();
-    fileIn.close();
-    fileOut1.close();
-
     // Make sure they are all the same size
     if(fileIn.size() != memIo1.size() || memIo1.size() != fileOut1.size()) {
         std::cerr << argv[0] << 
@@ -102,10 +97,7 @@ try {
     if (rc != 0) return rc;
     
     // Another test of reading and writing
-    if (fileOut1.open() != 0)  {
-        throw Error(9, fileOut1.path(), strError());
-    }
-
+    fileOut1.seek(0, BasicIo::beg);
     memIo2.seek(0, BasicIo::beg);
     FileIo fileOut2(argv[3]);
     if (fileOut2.open("w+b") != 0) {
@@ -154,18 +146,13 @@ int WriteReadSeek(BasicIo &io)
         std::cerr << ": WRS initial write failed
";
         return 2;
     }
-
-    // On Win32 files must be closed before stat    
-    io.close();
-
+    
     if (io.size() != len1) {
         std::cerr << ": WRS size is not " << len1 << "
";
         return 2;
     }
 
-    if (io.open() != 0)  {
-        throw Error(9, io.path(), strError());
-    }
+    io.seek(-len1, BasicIo::cur);
 
     int c = EOF;
     memset(buf, -1, sizeof(buf));

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list