You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jb...@apache.org on 2005/06/11 02:29:40 UTC
svn commit: r190045 -
/xerces/c/branches/jberry/3.0-unstable/src/xercesc/util/PlatformUtils.cpp
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: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org