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


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

The following commit has been merged in the master branch:
commit 773e6c6fa144b23396cbe3353aa51d86722796f8
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun Sep 25 10:30:58 2005 +0000

    Use re-entrant system functions (gmtime_r, strerror_r) if available
---
 config/config.h.in  | 26 ++++++++++++++++++++++++++
 config/configure.ac |  8 +++++++-
 src/basicio.cpp     |  4 ++--
 src/crwimage.cpp    | 26 ++++++++++++++++----------
 src/futils.cpp      | 10 +++++++++-
 src/image.cpp       |  1 -
 6 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/config/config.h.in b/config/config.h.in
index d7ff7fb..dd9f597 100644
--- a/config/config.h.in
+++ b/config/config.h.in
@@ -18,6 +18,16 @@
    */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRERROR_R
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -37,6 +47,10 @@
 /* Define to 1 if you have the `memset' function. */
 #undef HAVE_MEMSET
 
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+   and to 0 otherwise. */
+#undef HAVE_REALLOC
+
 /* Define to 1 if `stat' has the bug that it succeeds when given the
    zero-length file name argument. */
 #undef HAVE_STAT_EMPTY_STRING_BUG
@@ -56,6 +70,9 @@
 /* Define to 1 if you have the `strerror' function. */
 #undef HAVE_STRERROR
 
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
 /* Define to 1 if you have the `strftime' function. */
 #undef HAVE_STRFTIME
 
@@ -83,6 +100,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
 /* Define to 1 if you have the <wchar.h> header file. */
 #undef HAVE_WCHAR_H
 
@@ -119,6 +139,9 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
+/* Define to 1 if strerror_r returns char *. */
+#undef STRERROR_R_CHAR_P
+
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME
 
@@ -140,6 +163,9 @@
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
 /* Define to `unsigned' if <sys/types.h> does not define. */
 #undef size_t
 
diff --git a/config/configure.ac b/config/configure.ac
index 5e79ad0..45067f8 100644
--- a/config/configure.ac
+++ b/config/configure.ac
@@ -13,6 +13,9 @@ AC_PROG_CXXCPP
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_RANLIB
 
 # Libtool support
 AC_PROG_LIBTOOL
@@ -36,9 +39,12 @@ AC_FUNC_ALLOCA
 AC_FUNC_MALLOC
 AC_FUNC_MEMCMP
 AC_FUNC_MKTIME
+AC_FUNC_REALLOC
 AC_FUNC_STAT
+AC_FUNC_STRERROR_R
 AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([memset strchr strerror strtol])
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([gmtime_r memset strchr strerror strtol])
 AC_CHECK_FUNCS([timegm], HAVE_TIMEGM=1)
 AC_SUBST(HAVE_TIMEGM,$HAVE_TIMEGM)
 
diff --git a/src/basicio.cpp b/src/basicio.cpp
index 66ca31d..ff0c753 100644
--- a/src/basicio.cpp
+++ b/src/basicio.cpp
@@ -44,7 +44,7 @@ EXIV2_RCSID("@(#) $Id$");
 // + standard includes
 #include <string>
 #include <cassert>
-#include <cstdio>                       // for remove()
+#include <cstdio>                       // for remove(), rename()
 #include <cstdlib>                      // for alloc(), realloc(), free()
 #include <sys/types.h>                  // for stat()
 #include <sys/stat.h>                   // for stat()
@@ -187,7 +187,7 @@ namespace Exiv2 {
             if (std::remove(path_.c_str()) != 0) {
                 throw Error(2, path_, strError(), "std::remove");
             }
-            if (rename(fileIo->path_.c_str(), path_.c_str()) == -1) {
+            if (std::rename(fileIo->path_.c_str(), path_.c_str()) == -1) {
                 throw Error(17, fileIo->path_, path_, strError());
             }
             std::remove(fileIo->path_.c_str());
diff --git a/src/crwimage.cpp b/src/crwimage.cpp
index b55e500..2cc3c08 100644
--- a/src/crwimage.cpp
+++ b/src/crwimage.cpp
@@ -557,17 +557,23 @@ namespace Exiv2 {
         ULongValue v;
         v.read(ciffComponent.pData(), 8, byteOrder);
         time_t t = v.value_[0];
-
-        // Todo: use _r version
+#ifdef EXV_HAVE_GMTIME_R
+        struct tm tms;
+        struct tm* tm = &tms;
+        tm = gmtime_r(&t, tm);
+#else
         struct tm* tm = std::gmtime(&t);
-        const size_t m = 20;
-        char s[m];
-        std::strftime(s, m, "%Y:%m:%d %T", tm);
-
-        ExifKey key(crwMapInfo->tag_, ExifTags::ifdItem(crwMapInfo->ifdId_));
-        AsciiValue value;
-        value.read(std::string(s));
-        image.exifData().add(key, &value);
+#endif
+        if (tm) {
+            const size_t m = 20;
+            char s[m];
+            std::strftime(s, m, "%Y:%m:%d %T", tm);
+
+            ExifKey key(crwMapInfo->tag_, ExifTags::ifdItem(crwMapInfo->ifdId_));
+            AsciiValue value;
+            value.read(std::string(s));
+            image.exifData().add(key, &value);
+        }
     } // CrwMap::extract0x180e
 
     void CrwMap::extract0x1810(const CiffComponent& ciffComponent,
diff --git a/src/futils.cpp b/src/futils.cpp
index 235be36..f97f749 100644
--- a/src/futils.cpp
+++ b/src/futils.cpp
@@ -71,7 +71,15 @@ namespace Exiv2 {
     {
         int error = errno;
         std::ostringstream os; 
-        os << strerror(error) << " (" << error << ")";
+#ifdef EXV_HAVE_STRERROR_R
+        const size_t n = 1024;
+        char buf[n];
+        strerror_r(error, buf, n);
+        os << buf;
+#else
+        os << std::strerror(error); 
+#endif
+        os << " (" << error << ")";
         return os.str();
     } // strError
 
diff --git a/src/image.cpp b/src/image.cpp
index 7c076e1..a65c87f 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -48,7 +48,6 @@ EXIV2_RCSID("@(#) $Id$");
 #include <cerrno>
 #include <cstdio>
 #include <cstring>
-#include <cstdio>                               // for rename, remove
 #include <cassert>
 #include <sys/types.h>
 #include <sys/stat.h>

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list