[poppler] 5 commits - CMakeLists.txt cmake/modules config.h.cmake cpp/Makefile.am cpp/poppler-global.cpp cpp/tests

Pino Toscano pino at kemper.freedesktop.org
Tue Mar 2 13:30:43 PST 2010


 CMakeLists.txt                |    1 -
 cmake/modules/FindIconv.cmake |    3 +++
 config.h.cmake                |    2 +-
 cpp/Makefile.am               |    3 +++
 cpp/poppler-global.cpp        |   10 ++++++----
 cpp/tests/poppler-dump.cpp    |    9 ++++++++-
 6 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 690af1bc58de1ebe710c5e599f1cb635e4838fc8
Author: Hib Eris <hib at hiberis.nl>
Date:   Tue Mar 2 16:33:04 2010 +0100

    [cpp] define poppler_cpp_EXPORTS when building with autotools as well
    
    fixes building on Windows

diff --git a/cpp/Makefile.am b/cpp/Makefile.am
index f19428e..d8891db 100644
--- a/cpp/Makefile.am
+++ b/cpp/Makefile.am
@@ -35,6 +35,9 @@ libpoppler_cpp_la_SOURCES =			\
 	poppler-toc-private.h			\
 	poppler-version.cpp
 
+libpoppler_cpp_la_CXXFLAGS =			\
+	-Dpoppler_cpp_EXPORTS
+
 libpoppler_cpp_la_LIBADD = 			\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(LIBICONV)
commit 7492a376e7e5ec35534276ac15485123645617b0
Author: Pino Toscano <pino at kde.org>
Date:   Tue Mar 2 22:16:07 2010 +0100

    [cpp/tests] use gmtime() when gmtime_r() is not available

diff --git a/cpp/tests/poppler-dump.cpp b/cpp/tests/poppler-dump.cpp
index 693d107..cdfdcd0 100644
--- a/cpp/tests/poppler-dump.cpp
+++ b/cpp/tests/poppler-dump.cpp
@@ -31,6 +31,8 @@
 
 #include "parseargs.h"
 
+#include "config.h"
+
 static const int out_width = 30;
 
 bool show_all = false;
@@ -82,10 +84,15 @@ static std::string out_ustring(const poppler::ustring &str)
 static std::string out_date(std::time_t date)
 {
     if (date != std::time_t(-1)) {
+#ifdef HAVE_GMTIME_R
         struct tm time;
         gmtime_r(&date, &time);
+        struct tm *t = &time;
+#else
+        struct tm *t = gmtime(&date);
+#endif
         char buf[32];
-        strftime(buf, sizeof(buf) - 1, "%d/%m/%Y %H:%M:%S", &time);
+        strftime(buf, sizeof(buf) - 1, "%d/%m/%Y %H:%M:%S", t);
         return std::string(buf);
     }
     return std::string("n/a");
commit de013cc14a0621782c53f481ed7e559f241855a3
Author: Pino Toscano <pino at kde.org>
Date:   Tue Mar 2 22:05:25 2010 +0100

    [cpp] include config.h _after_ the other includes

diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp
index e1e186a..adc1f3c 100644
--- a/cpp/poppler-global.cpp
+++ b/cpp/poppler-global.cpp
@@ -16,8 +16,6 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "config.h"
-
 #include "poppler-global.h"
 
 #include "DateInfo.h"
@@ -29,6 +27,8 @@
 
 #include <iconv.h>
 
+#include "config.h"
+
 namespace
 {
 
commit 388e5d6aebcabbfc90894c86248159c63701cb0a
Author: Hib Eris <hib at hiberis.nl>
Date:   Tue Mar 2 15:51:23 2010 +0100

    Use ICONV_CONST when necessary

diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp
index e9054bd..e1e186a 100644
--- a/cpp/poppler-global.cpp
+++ b/cpp/poppler-global.cpp
@@ -16,6 +16,8 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "config.h"
+
 #include "poppler-global.h"
 
 #include "DateInfo.h"
@@ -98,13 +100,13 @@ byte_array ustring::to_utf_8() const
     char *str_data = &str[0];
     size_t me_len_char = size() * 2;
     size_t str_len_left = str.size();
-    size_t ir = iconv(ic, (char **)&me_data, &me_len_char, &str_data, &str_len_left);
+    size_t ir = iconv(ic, (ICONV_CONST char **)&me_data, &me_len_char, &str_data, &str_len_left);
     if ((ir == (size_t)-1) && (errno == E2BIG)) {
         const size_t delta = str_data - &str[0];
         str_len_left += str.size();
         str.resize(str.size() * 2);
         str_data = &str[delta];
-        ir = iconv(ic, (char **)&me_data, &me_len_char, &str_data, &str_len_left);
+        ir = iconv(ic, (ICONV_CONST char **)&me_data, &me_len_char, &str_data, &str_len_left);
         if (ir == (size_t)-1) {
             return byte_array();
         }
@@ -149,13 +151,13 @@ ustring ustring::from_utf_8(const char *str, int len)
     char *str_data = const_cast<char *>(str);
     size_t str_len_char = len;
     size_t ret_len_left = ret.size();
-    size_t ir = iconv(ic, &str_data, &str_len_char, &ret_data, &ret_len_left);
+    size_t ir = iconv(ic, (ICONV_CONST char **)&str_data, &str_len_char, &ret_data, &ret_len_left);
     if ((ir == (size_t)-1) && (errno == E2BIG)) {
         const size_t delta = ret_data - reinterpret_cast<char *>(&ret[0]);
         ret_len_left += ret.size();
         ret.resize(ret.size() * 2);
         ret_data = reinterpret_cast<char *>(&ret[delta]);
-        ir = iconv(ic, (char **)&str_data, &str_len_char, &ret_data, &ret_len_left);
+        ir = iconv(ic, (ICONV_CONST char **)&str_data, &str_len_char, &ret_data, &ret_len_left);
         if (ir == (size_t)-1) {
             return ustring();
         }
commit aaa58b26733a2f7c778632da4942b588050cf33f
Author: Pino Toscano <pino at kde.org>
Date:   Tue Mar 2 21:53:55 2010 +0100

    [CMake] properly define ICONV_CONST

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b57c0a8..299b479 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,7 +80,6 @@ if(ENABLE_CPP)
   macro_optional_find_package(Iconv)
   set(ENABLE_CPP ${ICONV_FOUND})
   set(HAVE_ICONV ${ICONV_FOUND})
-  set(ICONV_CONST ${ICONV_SECOND_ARGUMENT_IS_CONST})
 endif(ENABLE_CPP)
 if(ENABLE_ZLIB)
   find_package(ZLIB)
diff --git a/cmake/modules/FindIconv.cmake b/cmake/modules/FindIconv.cmake
index ce40ab2..338d17d 100644
--- a/cmake/modules/FindIconv.cmake
+++ b/cmake/modules/FindIconv.cmake
@@ -36,6 +36,9 @@ IF(ICONV_FOUND)
     return 0;
   }
 " ICONV_SECOND_ARGUMENT_IS_CONST )
+  IF(ICONV_SECOND_ARGUMENT_IS_CONST)
+    SET(ICONV_CONST "const")
+  ENDIF(ICONV_SECOND_ARGUMENT_IS_CONST)
 ENDIF(ICONV_FOUND)
 set(CMAKE_REQUIRED_INCLUDES)
 set(CMAKE_REQUIRED_LIBRARIES)
diff --git a/config.h.cmake b/config.h.cmake
index 1253549..70d8d5d 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -121,7 +121,7 @@
 #cmakedefine HAVE_ZLIB_H 1
 
 /* Define as const if the declaration of iconv() needs const. */
-#cmakedefine ICONV_CONST 1
+#define ICONV_CONST ${ICONV_CONST}
 
 /* Enable multithreading support. */
 #cmakedefine MULTITHREADED 1


More information about the poppler mailing list