Hi,

the workaround is attached. Please tell me what you think of it.
(I needed another one that will be in the next e-mail to ease
reviewing). I build-tested it, not anything else.



________________________________
From: Svetlana Watkins <svetlana.watk...@gmail.com>
To: "podofo-users@lists.sourceforge.net" <podofo-users@lists.sourceforge.net> 
Sent: 8:41 Sunday, 8 November 2015
Subject: [Podofo-users] (no subject)



This library is starting to look impossible to use. 

Why, after the last svn update am I now getting this error???

I even went to the trouble to include <cstring> with no luck.

I'm using Win32 on a mingw compiler???

Going crazy here.







c:\podofo-0.9.3D>mingw32-make -f Makefile
[  0%] Building CXX object 
src/CMakeFiles/podofo_static.dir/base/PdfArray.cpp.obj
In file included from C:\podofo-0.9.3D\src\base\PdfDefinesPrivate.h:9:0,
                 from C:\podofo-0.9.3D\src\base\PdfArray.cpp:37:
C:\podofo-0.9.3D\src\base\PdfCompilerCompatPrivate.h: In function 'int 
PoDoFo::compat::strcasecmp(const char*, const char*)':
C:\podofo-0.9.3D\src\base\PdfCompilerCompatPrivate.h:92:16: error: '::stricmp' 
has not been declared
         return ::stricmp(s1, s2);
                ^
In file included from C:\podofo-0.9.3D\src\base\PdfDefinesPrivate.h:9:0,
                 from C:\podofo-0.9.3D\src\base\PdfArray.cpp:37:
C:\podofo-0.9.3D\src\base\PdfCompilerCompatPrivate.h: In function 'int 
PoDoFo::compat::strncasecmp(const char*, const char*, size_t)':
C:\podofo-0.9.3D\src\base\PdfCompilerCompatPrivate.h:107:16: error: 
'::strnicmp' has not been declared
         return ::strnicmp(s1, s2, n);
                ^
src\CMakeFiles\podofo_static.dir\build.make:53: recipe for target 
'src/CMakeFiles/podofo_static.dir/base/PdfArray.cpp.obj' failed
mingw32-make[5]: *** [src/CMakeFiles/podofo_static.dir/base/PdfArray.cpp.obj] 
Error 1
CMakeFiles\Makefile2:105: recipe for target 
'src/CMakeFiles/podofo_static.dir/all' failed
mingw32-make[4]: *** [src/CMakeFiles/podofo_static.dir/all] Error 2
Makefile:112: recipe for target 'all' failed
mingw32-make[3]: *** [all] Error 2

c:\podofo-0.9.3D>
------------------------------------------------------------------------------

_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 1690)
+++ CMakeLists.txt	(working copy)
@@ -287,6 +294,10 @@
 
     ADD_DEFINITIONS(-std=c++98)
 
+    include(CheckFunctionExists)
+    CHECK_FUNCTION_EXISTS(stricmp PODOFO_HAVE_STRICMP)
+    CHECK_FUNCTION_EXISTS(strnicmp PODOFO_HAVE_STRNICMP)
+
     ADD_DEFINITIONS(
         -Wall
         -Woverloaded-virtual
Index: src/base/PdfCompilerCompatPrivate.h
===================================================================
--- src/base/PdfCompilerCompatPrivate.h	(revision 1690)
+++ src/base/PdfCompilerCompatPrivate.h	(working copy)
@@ -84,7 +84,22 @@
         // MSVC++
         return ::_stricmp(s1, s2);
 #   else
-        return ::stricmp(s1, s2);
+#       if defined(PODOFO_HAVE_STRICMP)
+            return ::stricmp(s1, s2);
+#       else
+#           include <cctype>
+            int returnval = 0;
+            while (*s1 && *s2 && !returnval) {
+                returnval =
+                    ((::tolower(*s1) < ::tolower(*s2)) ? -1: (
+                     (::tolower(*s1) > ::tolower(*s2)) ? +1 : 0));
+                s1++;
+                s2++;
+            }
+            if (!returnval) {
+                return (!*s1) ? (*s2 ? -1: 0) : 1;
+            } else return returnval;
+#       endif
 #   endif
 #else
     // POSIX.1-2001
@@ -98,7 +113,23 @@
         // MSVC++
         return ::_strnicmp(s1, s2, n);
 #   else
-        return ::strnicmp(s1, s2, n);
+#       if defined(PODOFO_HAVE_STRICMP)
+            return ::strnicmp(s1, s2, n);
+#       else
+#           include <cctype>
+            int returnval = 0;
+            while ((n > 0) && !returnval && *s1 && *s2) {
+                returnval =
+                    ((::tolower(*s1) < ::tolower(*s2)) ? -1: (
+                     (::tolower(*s1) > ::tolower(*s2)) ? +1 : 0));
+                s1++;
+                s2++;
+                n--;
+            }
+            if ((n > 0) && !returnval) {
+                return (!*s1) ? (*s2 ? -1: 0) : 1;
+            } else return returnval;
+#       endif
 #   endif
 #else
     // POSIX.1-2001
Index: podofo_config.h.in
===================================================================
--- podofo_config.h.in	(revision 1690)
+++ podofo_config.h.in	(working copy)
@@ -22,6 +22,10 @@
 #cmakedefine PODOFO_HAVE_MEM_H 1
 #cmakedefine PODOFO_HAVE_CTYPE_H 1
 
+/* platform-specific functions */
+#cmakedefine PODOFO_HAVE_STRICMP
+#cmakedefine PODOFO_HAVE_STRNICMP
+
 /* Integer types - headers */
 #cmakedefine PODOFO_HAVE_STDINT_H 1
 #cmakedefine PODOFO_HAVE_BASETSD_H 1 
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to