xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amass...@apache.org
Subject svn commit: r801335 - in /xerces/c/trunk: configure.ac src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
Date Wed, 05 Aug 2009 17:49:54 GMT
Author: amassari
Date: Wed Aug  5 17:49:53 2009
New Revision: 801335

URL: http://svn.apache.org/viewvc?rev=801335&view=rev
Log:
On Linux, iconv requires char*; on Solaris, const char*. Use autoconf to pick the correct
code

Modified:
    xerces/c/trunk/configure.ac
    xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp

Modified: xerces/c/trunk/configure.ac
URL: http://svn.apache.org/viewvc/xerces/c/trunk/configure.ac?rev=801335&r1=801334&r2=801335&view=diff
==============================================================================
--- xerces/c/trunk/configure.ac (original)
+++ xerces/c/trunk/configure.ac Wed Aug  5 17:49:53 2009
@@ -180,6 +180,25 @@
                     ]
                  )
 
+AC_MSG_CHECKING([if iconv uses const pointers])
+AC_COMPILE_IFELSE(  [AC_LANG_PROGRAM([[#include <iconv.h>]],
+                                     [[
+                                       const char *fromPtr=0;
+                                       size_t     fromLen=0;
+                                       const char *toPtr=0;
+                                       size_t     toLen=0;
+                                       iconv_t    cv=0;
+                                       iconv(cv, &tmpPtr, &fromLen, &toPtr, &toLen);
+                                      ]])],
+                    [
+                      AC_MSG_RESULT([yes])
+                      AC_DEFINE_UNQUOTED([ICONV_USES_CONST_POINTER], 1, [Define to 1 if you
have to use const char* with iconv, to 0 if you must use char*.])
+                    ],
+                    [
+                      AC_MSG_RESULT([no])
+                      AC_DEFINE_UNQUOTED([ICONV_USES_CONST_POINTER], 0, [Define to 1 if you
have to use const char* with iconv, to 0 if you must use char*.])
+                    ]
+                 )
 
 AC_SUBST([SHREXT], [$shrext_cmds])
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp?rev=801335&r1=801334&r2=801335&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp Wed Aug
 5 17:49:53 2009
@@ -242,7 +242,11 @@
     xmlChToMbc (ch, wcbuf);
 
     char    tmpArr[4];
+#if ICONV_USES_CONST_POINTER
     const char* ptr = wcbuf;
+#else
+    char* ptr = wcbuf;
+#endif
     size_t    len = fUChSize;
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
@@ -271,7 +275,11 @@
     xmlChToMbc (ch, wcbuf);
 
     char    tmpArr[4];
+#if ICONV_USES_CONST_POINTER
     const char* ptr = wcbuf;
+#else
+    char* ptr = wcbuf;
+#endif
     size_t    len = fUChSize;
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
@@ -372,7 +380,11 @@
                  char        **toPtr,
                  size_t        toLen )
 {
+#if ICONV_USES_CONST_POINTER
     const char ** tmpPtr = &fromPtr;
+#else
+    char ** tmpPtr = (char**)&fromPtr;
+#endif
     return ::iconv (fCDFrom, tmpPtr, fromLen, toPtr, &toLen);
 }
 
@@ -381,7 +393,11 @@
                    char        **toPtr,
                    size_t        toLen )
 {
+#if ICONV_USES_CONST_POINTER
     const char ** tmpPtr = &fromPtr;
+#else
+    char ** tmpPtr = (char**)&fromPtr;
+#endif
     return ::iconv (fCDTo, tmpPtr, fromLen, toPtr, &toLen);
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org


Mime
View raw message