Author: jberry
Date: Fri Jun 10 17:29:40 2005
New Revision: 190045

URL: http://svn.apache.org/viewcvs?rev=190045&view=rev
Log:
Rewrite endian test of avoid dependence on XMLCh being 16 bit. For other 
reasons we 
need it always to be 16 bit, but this chunk of code doesn't need to rely on 
that.


Modified:
    xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp

Modified: 
xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp?rev=190045&r1=190044&r2=190045&view=diff
==============================================================================
--- xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp 
(original)
+++ xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp 
Fri Jun 10 17:29:40 2005
@@ -39,8 +39,6 @@
 #      include <sys/timeb.h>
 #endif
 
-#include <assert.h>
-
 #include <xercesc/util/Mutexes.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
 #include <xercesc/util/RefVectorOf.hpp>
@@ -243,13 +241,12 @@
     
     
     // Determine our endianness (with regard to a XMLCh 16-bit word)
-    assert(sizeof(XMLCh) == 2);
     union {
        XMLCh ch;
-       unsigned char ar[2];
+       unsigned char ar[sizeof(XMLCh)];
     } endianTest;
-    endianTest.ch = 0x0102;
-    fgXMLChBigEndian = (endianTest.ar[0] == 0x01);
+    endianTest.ch = 1;
+    fgXMLChBigEndian = (endianTest.ar[sizeof(XMLCh)-1] == 1);
     
     
     // Initialize the platform-specific mutex file, and atomic op mgrs



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to