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

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


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

The following commit has been merged in the master branch:
commit 9f06ff2971ee4fa935ad317aaf576aed346497d0
Author: Robin Mills <robin at clanmills.com>
Date:   Wed Feb 15 20:53:58 2017 +0000

    #1272 Submitting modified version of Ben's patch.
---
 include/exiv2/basicio.hpp |  6 ++++-
 include/exiv2/config.h    |  3 +++
 include/exiv2/exv_msvc.h  |  2 +-
 include/exiv2/types.hpp   |  1 -
 src/actions.cpp           |  6 ++++-
 src/basicio.cpp           | 58 ++++++++++++++++++++++++++++++++---------------
 6 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp
index 4deef29..39a14bc 100644
--- a/include/exiv2/basicio.hpp
+++ b/include/exiv2/basicio.hpp
@@ -551,7 +551,11 @@ namespace Exiv2 {
         /*!
           @brief Returns the path to a temporary data storage location.
          */
-        static std::string temporaryPath();
+#ifdef EXV_UNICODE_PATH
+        static std::wstring temporaryPath();
+#else
+        static std::string  temporaryPath();
+#endif
 
     private:
         // NOT IMPLEMENTED
diff --git a/include/exiv2/config.h b/include/exiv2/config.h
index 83fef53..15e0e23 100644
--- a/include/exiv2/config.h
+++ b/include/exiv2/config.h
@@ -165,6 +165,9 @@ typedef int pid_t;
 # ifdef  EXV_HAVE_REGEX
 #  undef EXV_HAVE_REGEX
 # endif
+#ifdef EXV_UNICODE_PATH
+#error EXV_UNICODE_PATH is not supported for MinGW builds
+#endif
 #endif
 
 #ifndef __CYGWIN__
diff --git a/include/exiv2/exv_msvc.h b/include/exiv2/exv_msvc.h
index e809ee6..b335ced 100644
--- a/include/exiv2/exv_msvc.h
+++ b/include/exiv2/exv_msvc.h
@@ -51,7 +51,7 @@
 #endif /* !EXV_COMMERCIAL_VERSION */
 
 /* Define Windows unicode path support. */
-/* #undef EXV_UNICODE_PATH */
+/* #define EXV_UNICODE_PATH */
 
 
 /* Define to `const' or to empty, depending on the second argument of `iconv'. */
diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp
index c22b71c..2f7a8a3 100644
--- a/include/exiv2/types.hpp
+++ b/include/exiv2/types.hpp
@@ -363,7 +363,6 @@ namespace Exiv2 {
     EXIV2API std::wstring s2ws(const std::string& s);
     //! Convert a unicode std::wstring s to an std::string.
     EXIV2API std::string ws2s(const std::wstring& s);
-
 #endif
     /*!
       @brief Return a \em long set to the value represented by \em s.
diff --git a/src/actions.cpp b/src/actions.cpp
index bb5f7df..c999dd7 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -2071,7 +2071,11 @@ namespace {
         Action::Modify::applyCommands(sourceImage.get());
 
         // Open or create the target file
-        std::string target = bStdout ? Exiv2::FileIo::temporaryPath() : tgt;
+#ifdef EXV_UNICODE_PATH
+        std::string target = bStdout ? Exiv2::ws2s(Exiv2::FileIo::temporaryPath()) : tgt;
+#else
+        std::string target = bStdout ?             Exiv2::FileIo::temporaryPath()  : tgt;
+#endif
 
         Exiv2::Image::AutoPtr targetImage;
         if (Exiv2::fileExists(target)) {
diff --git a/src/basicio.cpp b/src/basicio.cpp
index f3f7970..d2fadec 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -577,46 +577,56 @@ namespace Exiv2 {
 #else
         nlink_t nlink = buf.st_nlink;
 #endif
-
+#ifdef EXV_UNICODE_PATH
+        std::wstring tmpname;
+#else
+        std::string tmpname;
+#endif
         // If file is > 1MB and doesn't have hard links then use a file, otherwise
         // use a memory buffer. I.e., files with hard links always use a memory
         // buffer, which is a workaround to ensure that the links don't get broken.
-        if (ret != 0 || (buf.st_size > 1048576 && nlink == 1)) {
+        if (ret != 0 || (buf.st_size > 1048576 && nlink == 1))
+		{
             pid_t pid = ::getpid();
             std::auto_ptr<FileIo> fileIo;
 #ifdef EXV_UNICODE_PATH
-            if (p_->wpMode_ == Impl::wpUnicode) {
-                std::wstring tmpname = wpath() + s2ws(toString(pid));
-                fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname));
-            }
-            else
+            tmpname = temporaryPath() + s2ws(toString(pid));
+            fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname));
+#else
+            tmpname = temporaryPath() + toString(pid);
+            fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname));
 #endif
-            {
-                std::string tmpname = path() + toString(pid);
-                fileIo = std::auto_ptr<FileIo>(new FileIo(tmpname));
-            }
             if (fileIo->open("w+b") != 0) {
 #ifdef EXV_UNICODE_PATH
-                if (p_->wpMode_ == Impl::wpUnicode) {
-                    throw WError(10, wpath(), "w+b", strError().c_str());
+#if    defined(_MSC_VER)
+                if( !DeleteFileW( tmpname.c_str()) )
+                {
+                    perror("Error deleting file");
+                    throw WError(10, ws2s(tmpname).c_str(), "w+b", strError().c_str());
                 }
-                else
+#endif
+#else
+#if defined(_MSC_VER) || defined(__MINGW__)
+                if( !DeleteFile( tmpname.c_str() ) )
+#else
+                if( remove( tmpname.c_str() ) != 0 )
+#endif
 #endif
                 {
-                    throw Error(10, path(), "w+b", strError());
+                        perror("Error deleting file");
                 }
+                throw Error(10, tmpname.c_str(), "w+b", strError());
             }
             fileIo->p_->copyXattrFrom(*this);
             basicIo = fileIo;
-        }
-        else {
+        } else {
             basicIo.reset(new MemIo);
         }
 
         return basicIo;
     }
 
-    std::string FileIo::temporaryPath()
+    static std::string tempPath()
     {
         static int  count = 0 ;
         char       sCount[12];
@@ -638,6 +648,18 @@ namespace Exiv2 {
         return result;
     }
 
+#ifdef EXV_UNICODE_PATH
+    std::wstring FileIo::temporaryPath()
+    {
+		return s2ws(tempPath());
+    }
+#else
+    std::string FileIo::temporaryPath()
+    {
+		return tempPath();
+    }
+#endif
+
     long FileIo::write(const byte* data, long wcount)
     {
         assert(p_->fp_ != 0);

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list