[poppler] Branch 'poppler-0.22' - configure.ac ConfigureChecks.cmake test/perf-test.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Apr 14 07:37:52 PDT 2013


 ConfigureChecks.cmake |    2 ++
 configure.ac          |    1 +
 test/perf-test.cc     |    6 ++++--
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 62a5b4d5c6d5c368d190b86eab63ccb07d642c01
Author: Hib Eris <hib at hiberis.nl>
Date:   Sun Apr 14 16:37:14 2013 +0200

    Check for strcpy_s() and strcat_s() at configure time
    
    It is better to test for functions than to hardcode exceptions for
    specific compilers.
    
    This fixes compiling poppler with the latest mingw-w64 compiler which
    has strcpy_s() and strcat_s() build in.
    
    Bug #63459

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 6e547ed..5b12ac4 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -34,6 +34,8 @@ check_function_exists(popen HAVE_POPEN)
 check_function_exists(mkstemp HAVE_MKSTEMP)
 check_function_exists(mkstemps HAVE_MKSTEMPS)
 check_function_exists(rand_r HAVE_RAND_R)
+check_function_exists(strcpy_s HAVE_STRCPY_S)
+check_function_exists(strcat_s HAVE_STRCAT_S)
 
 macro(CHECK_FOR_DIR include var)
   check_c_source_compiles(
diff --git a/configure.ac b/configure.ac
index 5a29315..bb8e3ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,6 +251,7 @@ fi
 
 dnl ##### Checks for library functions.
 AC_CHECK_FUNCS(popen mkstemp mkstemps)
+AC_CHECK_FUNCS(strcpy_s strcat_s)
 
 dnl ##### Back to C for the library tests.
 AC_LANG_C
diff --git a/test/perf-test.cc b/test/perf-test.cc
index 21fbdee..cb97bcf 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -1,5 +1,5 @@
 /* Copyright Krzysztof Kowalczyk 2006-2007
-   Copyright Hib Eris <hib at hiberis.nl> 2008
+   Copyright Hib Eris <hib at hiberis.nl> 2008, 2013
    License: GPLv2 */
 /*
   A tool to stress-test poppler rendering and measure rendering times for
@@ -325,7 +325,7 @@ void sleep_milliseconds(int milliseconds)
 #endif
 }
 
-#ifndef _MSC_VER
+#ifndef HAVE_STRCPY_S
 void strcpy_s(char* dst, size_t dst_size, const char* src)
 {
     size_t src_size = strlen(src) + 1;
@@ -338,7 +338,9 @@ void strcpy_s(char* dst, size_t dst_size, const char* src)
         }
     }
 }
+#endif
 
+#ifndef HAVE_STRCAT_S
 void strcat_s(char *dst, size_t dst_size, const char* src)
 {
     size_t dst_len = strlen(dst);


More information about the poppler mailing list