xerces-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=801299&view=rev
Log:
Allow GNUiconv to be compiled on Solaris (XERCESC-1856)

Modified:
    xerces/c/trunk/configure.ac
    xerces/c/trunk/m4/xerces_transcoder_selection.m4
    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=801299&r1=801298&r2=801299&view=diff
==============================================================================
--- xerces/c/trunk/configure.ac (original)
+++ xerces/c/trunk/configure.ac Wed Aug  5 16:54:22 2009
@@ -98,7 +98,7 @@
                   sys/param.h sys/socket.h sys/time.h sys/timeb.h \
                   unistd.h wchar.h wctype.h \
                   CoreServices/CoreServices.h \
-                  endian.h machine/endian.h \
+                  endian.h machine/endian.h arpa/nameser_compat.h \
                  ])
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -157,7 +157,7 @@
                  )
 AC_MSG_CHECKING([for wcsrtombs])
 AC_COMPILE_IFELSE(  [AC_LANG_PROGRAM([[#include <wchar.h>]],
-                                     [[mbstate_t st; char buffer[2]; wchar_t src[2]; wcsrtombs(buffer,
&src, 2, &st);]])],
+                                     [[mbstate_t st; char buffer[2]; const wchar_t* src=0;
wcsrtombs(buffer, &src, 2, &st);]])],
                     [
                       AC_MSG_RESULT([yes])
                       AC_DEFINE_UNQUOTED([HAVE_WCSRTOMBS], 1, [Define to 1 if you have the
`wcsrtombs' function.])
@@ -169,7 +169,7 @@
                  )
 AC_MSG_CHECKING([for mbsrtowcs])
 AC_COMPILE_IFELSE(  [AC_LANG_PROGRAM([[#include <wchar.h>]],
-                                     [[mbstate_t st; wchar_t buffer[2]; char src[2]; mbsrtowcs(buffer,
&src, 2, &st);]])],
+                                     [[mbstate_t st; wchar_t buffer[2]; const char* src=0;
mbsrtowcs(buffer, &src, 2, &st);]])],
                     [
                       AC_MSG_RESULT([yes])
                       AC_DEFINE_UNQUOTED([HAVE_MBSRTOWCS], 1, [Define to 1 if you have the
`mbsrtowcs' function.])

Modified: xerces/c/trunk/m4/xerces_transcoder_selection.m4
URL: http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_transcoder_selection.m4?rev=801299&r1=801298&r2=801299&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_transcoder_selection.m4 (original)
+++ xerces/c/trunk/m4/xerces_transcoder_selection.m4 Wed Aug  5 16:54:22 2009
@@ -24,8 +24,18 @@
 	# Check for GNU iconv support
 	no_GNUiconv=false
 	AC_CHECK_HEADERS([iconv.h wchar.h string.h stdlib.h stdio.h ctype.h locale.h errno.h], [],
[no_GNUiconv=true])
-    # The code in iconv loads either endian.h or machine/endian.h, so verify that at least
one is present
-	AC_CHECK_HEADER([endian.h], [], [AC_CHECK_HEADER([machine/endian.h],[],[no_GNUiconv=true])])
+        # The code in iconv needs just on of these include files
+	AC_CHECK_HEADER([endian.h], 
+                        [], 
+                        [
+                         AC_CHECK_HEADER([machine/endian.h],
+                                         [],
+                                         [
+                                          AC_CHECK_HEADER([arpa/nameser_compat.h],
+                                                          [],
+                                                          [no_GNUiconv=true])
+                                         ])
+                        ])
 	AC_CHECK_FUNCS([iconv_open iconv_close iconv], [], [no_GNUiconv=true])
 	AC_MSG_CHECKING([whether we can support the GNU iconv Transcoder])
 	list_add=

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=801299&r1=801298&r2=801299&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 16:54:22 2009
@@ -22,44 +22,23 @@
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
+#if HAVE_CONFIG_H
+  #include <config.h>
+#endif
+
 #include <ctype.h>
 
 #include <locale.h>
 #include <errno.h>
+
 #if HAVE_ENDIAN_H
   #include <endian.h>
 #elif HAVE_MACHINE_ENDIAN_H
   #include <machine/endian.h>
+#elif HAVE_ARPA_NAMESER_COMPAT_H
+  #include <arpa/nameser_compat.h>
 #endif
 
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/XMLUni.hpp>
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/TranscodingException.hpp>
-#include <xercesc/util/Janitor.hpp>
-#include "IconvGNUTransService.hpp"
-
-XERCES_CPP_NAMESPACE_BEGIN
-
-// ---------------------------------------------------------------------------
-// Description of encoding schemas, supported by iconv()
-// ---------------------------------------------------------------------------
-typedef struct __IconvGNUEncoding {
-    const char*    fSchema;    // schema name
-    size_t    fUChSize;    // size of the character
-    unsigned int fUBO;        // byte order, relative to the host
-} IconvGNUEncoding;
-
-static const IconvGNUEncoding    gIconvGNUEncodings[] = {
-    { "UTF-16LE",        2,    LITTLE_ENDIAN },
-    { "UTF-16BE",        2,    BIG_ENDIAN },
-    { "UCS-2LE",         2,    LITTLE_ENDIAN },
-    { "UCS-2BE",         2,    BIG_ENDIAN },
-    { "UCS-2-INTERNAL",  2,    BYTE_ORDER },
-    { NULL,              0,    0 }
-};
-
 #define MAX_UCHSIZE 4
 
 //--------------------------------------------------
@@ -124,12 +103,39 @@
 # endif /* BYTE_ORDER == LITTLE_ENDIAN */
 
 #include <wchar.h>
-
-
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+#include <xercesc/util/XMLUni.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/util/TranscodingException.hpp>
+#include <xercesc/util/Janitor.hpp>
+#include "IconvGNUTransService.hpp"
+
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+// ---------------------------------------------------------------------------
+// Description of encoding schemas, supported by iconv()
+// ---------------------------------------------------------------------------
+typedef struct __IconvGNUEncoding {
+    const char*    fSchema;    // schema name
+    size_t    fUChSize;    // size of the character
+    unsigned int fUBO;        // byte order, relative to the host
+} IconvGNUEncoding;
+
+static const IconvGNUEncoding    gIconvGNUEncodings[] = {
+    { "UTF-16LE",        2,    LITTLE_ENDIAN },
+    { "UTF-16BE",        2,    BIG_ENDIAN },
+    { "UCS-2LE",         2,    LITTLE_ENDIAN },
+    { "UCS-2BE",         2,    BIG_ENDIAN },
+    { "UCS-2-INTERNAL",  2,    BYTE_ORDER },
+    { NULL,              0,    0 }
+};
+
 // ---------------------------------------------------------------------------
 //  Local, const data
 // ---------------------------------------------------------------------------
@@ -236,7 +242,7 @@
     xmlChToMbc (ch, wcbuf);
 
     char    tmpArr[4];
-    char*    ptr = wcbuf;
+    const char* ptr = wcbuf;
     size_t    len = fUChSize;
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
@@ -265,7 +271,7 @@
     xmlChToMbc (ch, wcbuf);
 
     char    tmpArr[4];
-    char*    ptr = wcbuf;
+    const char* ptr = wcbuf;
     size_t    len = fUChSize;
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
@@ -366,7 +372,7 @@
                  char        **toPtr,
                  size_t        toLen )
 {
-    char ** tmpPtr = (char**)&fromPtr;
+    const char ** tmpPtr = &fromPtr;
     return ::iconv (fCDFrom, tmpPtr, fromLen, toPtr, &toLen);
 }
 
@@ -375,7 +381,7 @@
                    char        **toPtr,
                    size_t        toLen )
 {
-    char ** tmpPtr = (char**)&fromPtr;
+    const char ** tmpPtr = &fromPtr;
     return ::iconv (fCDTo, tmpPtr, fromLen, toPtr, &toLen);
 }
 
@@ -409,7 +415,7 @@
         strcmp (fLocalCP, "POSIX") == 0)
         fLocalCP = "iso-8859-1";    // fallback locale
     else {
-        char    *ptr = strchr (fLocalCP, '.');
+        const char *ptr = strchr (fLocalCP, '.');
         if (ptr == NULL)
             fLocalCP = "iso-8859-1";    // fallback locale
         else



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


Mime
View raw message