Author: borisk
Date: Wed Nov 11 10:03:53 2009
New Revision: 834826

URL: http://svn.apache.org/viewvc?rev=834826&view=rev
Log:
Rework the binToText implementation and usage so that we don't need the
XERCES_SIZEOF_* macros. This should allow using the same set of headers
for 32 and 64-bit builds (XERCESC-1874).


Modified:
    xerces/c/trunk/m4/xerces_int_types.m4
    xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp
    xerces/c/trunk/src/xercesc/internal/XProtoType.cpp
    xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
    xerces/c/trunk/src/xercesc/util/XMLString.cpp
    xerces/c/trunk/src/xercesc/util/XMLString.hpp
    xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.borland.hpp
    xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.hpp.in
    xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp
    xerces/c/trunk/src/xercesc/util/regx/RegxParser.cpp
    xerces/c/trunk/src/xercesc/validators/datatype/AbstractStringValidator.cpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp

Modified: xerces/c/trunk/m4/xerces_int_types.m4
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_int_types.m4?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_int_types.m4 (original)
+++ xerces/c/trunk/m4/xerces_int_types.m4 Wed Nov 11 10:03:53 2009
@@ -179,9 +179,5 @@
        AC_DEFINE_UNQUOTED([XERCES_U32BIT_INT], $xerces_cv_type_u32bit_int, [An 
appropriate unsigned 32 bit integer type])
        AC_DEFINE_UNQUOTED([XERCES_S64BIT_INT], $xerces_cv_type_s64bit_int, [An 
appropriate signed 64 bit integer type])
        AC_DEFINE_UNQUOTED([XERCES_U64BIT_INT], $xerces_cv_type_u64bit_int, [An 
appropriate unsigned 64 bit integer type])
-
-       AC_DEFINE_UNQUOTED([XERCES_SIZEOF_INT], $ac_cv_sizeof_int, [Size of the 
int type as returned by sizeof])
-       AC_DEFINE_UNQUOTED([XERCES_SIZEOF_LONG], $ac_cv_sizeof_long, [Size of 
the long type as returned by sizeof])
-       AC_DEFINE_UNQUOTED([XERCES_SIZEOF_INT64], $xerces_cv_sizeof_int64, 
[Size of the presumably int64 type which on lesser platforms can be int32])
        ]
 )

Modified: xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp (original)
+++ xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp Wed Nov 11 
10:03:53 2009
@@ -297,13 +297,8 @@
 void PSVIWriterHandlers::error(const SAXParseException& e) {
        XMLCh* temp1 = new XMLCh[10];
        XMLCh* temp2 = new XMLCh[10];
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-       XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
-       XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
-#else
         XMLString::binToText((unsigned long)e.getLineNumber(), temp1, 9, 10);
        XMLString::binToText((unsigned long)e.getColumnNumber(), temp2, 9, 10);
-#endif
        *fErrorFormatter << fgError << fgAtFile << chSpace << e.getSystemId()
                << chComma << fgLine << chSpace << temp1
                << chComma << fgChar << chSpace << temp2
@@ -315,13 +310,8 @@
 void PSVIWriterHandlers::fatalError(const SAXParseException& e) {
        XMLCh* temp1 = new XMLCh[10];
        XMLCh* temp2 = new XMLCh[10];
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-       XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
-       XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
-#else
         XMLString::binToText((unsigned long)e.getLineNumber(), temp1, 9, 10);
        XMLString::binToText((unsigned long)e.getColumnNumber(), temp2, 9, 10);
-#endif
        *fErrorFormatter << fgFatalError << fgAtFile << chSpace << 
e.getSystemId()
                << chComma << fgLine << chSpace << temp1
                << chComma << fgChar << chSpace << temp2
@@ -334,13 +324,8 @@
 void PSVIWriterHandlers::warning(const SAXParseException& e) {
        XMLCh* temp1 = new XMLCh[10];
        XMLCh* temp2 = new XMLCh[10];
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-       XMLString::binToText(e.getLineNumber(), temp1, 9, 10);
-       XMLString::binToText(e.getColumnNumber(), temp2, 9, 10);
-#else
         XMLString::binToText((unsigned long)e.getLineNumber(), temp1, 9, 10);
        XMLString::binToText((unsigned long)e.getColumnNumber(), temp2, 9, 10);
-#endif
        *fErrorFormatter << fgWarning << fgAtFile << chSpace << e.getSystemId()
                << chComma << fgLine << chSpace << temp1
                << chComma << fgChar << chSpace << temp2
@@ -1636,7 +1621,7 @@
 
 const XMLCh* PSVIWriterHandlers::getIdName(XSObject* obj) {
        XMLCh* objLoc = new XMLCh[9];
-       XMLString::binToText((unsigned long)(XMLSize_t)obj, objLoc, 8, 16);
+       XMLString::sizeToText((XMLSize_t)obj, objLoc, 8, 16);
        XMLCh* idName = fIdMap->get(objLoc);
        if (!idName) {
                idName = createID(obj);

Modified: xerces/c/trunk/src/xercesc/internal/XProtoType.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XProtoType.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XProtoType.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XProtoType.cpp Wed Nov 11 10:03:53 2009
@@ -66,8 +66,8 @@
     {
         XMLCh value1[17];
         XMLCh value2[17];
-        XMLString::binToText((unsigned long)inNameLen,    value1, 16, 10, 
manager);
-        XMLString::binToText((unsigned long)classNameLen, value2, 16, 10, 
manager);
+        XMLString::sizeToText(inNameLen,    value1, 16, 10, manager);
+        XMLString::sizeToText(classNameLen, value2, 16, 10, manager);
 
         ThrowXMLwithMemMgr2(XSerializationException
                 , XMLExcepts::XSer_ProtoType_NameLen_Dif

Modified: xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp Wed Nov 11 
10:03:53 2009
@@ -50,8 +50,8 @@
 #define TEST_THROW_ARG1(condition, data, err_msg) \
 if (condition) \
 { \
-    XMLCh value1[17]; \
-    XMLString::binToText(data, value1, 16, 10, getMemoryManager()); \
+    XMLCh value1[64]; \
+    XMLString::sizeToText(data, value1, 65, 10, getMemoryManager()); \
     ThrowXMLwithMemMgr1(XSerializationException \
             , err_msg  \
             , value1 \
@@ -61,10 +61,10 @@
 #define TEST_THROW_ARG2(condition, data1, data2, err_msg) \
 if (condition) \
 { \
-    XMLCh value1[17]; \
-    XMLCh value2[17]; \
-    XMLString::binToText(data1, value1, 16, 10, getMemoryManager()); \
-    XMLString::binToText(data2, value2, 16, 10, getMemoryManager()); \
+    XMLCh value1[64]; \
+    XMLCh value2[64]; \
+    XMLString::sizeToText(data1, value1, 65, 10, getMemoryManager()); \
+    XMLString::sizeToText(data2, value2, 65, 10, getMemoryManager()); \
     ThrowXMLwithMemMgr2(XSerializationException \
             , err_msg  \
             , value1   \
@@ -385,14 +385,21 @@
        else
        {
         // what follows class tag is an XSerializable object
-               XSerializedObjectId_t classIndex = (obTag & ~fgClassMask);
+       XSerializedObjectId_t classIndex = (obTag & ~fgClassMask);
         XSerializedObjectId_t loadPoolSize = 
(XSerializedObjectId_t)fLoadPool->size();
 
-        TEST_THROW_ARG2(((classIndex == 0 ) || (classIndex > loadPoolSize))
-                  , classIndex
-                  , loadPoolSize
-                  , XMLExcepts::XSer_Inv_ClassIndex
-                  )
+        if ((classIndex == 0 ) || (classIndex > loadPoolSize))
+        {
+          XMLCh value1[64];
+          XMLCh value2[64];
+          XMLString::binToText(classIndex, value1, 65, 10, getMemoryManager());
+          XMLString::binToText(loadPoolSize, value2, 65, 10, 
getMemoryManager());
+          ThrowXMLwithMemMgr2(XSerializationException
+                              , XMLExcepts::XSer_Inv_ClassIndex
+                              , value1
+                              , value2
+                              , getMemoryManager());
+        }
 
         ensurePointer(lookupLoadPool(classIndex));
    }
@@ -833,11 +840,19 @@
       *  an object tag read from the binary refering to
       *  an object beyond the upper most boundary of the load pool
       ***/
-    TEST_THROW_ARG2( (objectTag > fLoadPool->size())
-              , objectTag
-              , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText 
directly.
-              , XMLExcepts::XSer_LoadPool_UppBnd_Exceed
-              )
+
+    if (objectTag > fLoadPool->size())
+    {
+      XMLCh value1[64];
+      XMLCh value2[64];
+      XMLString::binToText(objectTag, value1, 65, 10, getMemoryManager());
+      XMLString::sizeToText(fLoadPool->size(), value2, 65, 10, 
getMemoryManager());
+      ThrowXMLwithMemMgr2(XSerializationException
+                          , XMLExcepts::XSer_LoadPool_UppBnd_Exceed
+                          , value1
+                          , value2
+                          , getMemoryManager());
+    }
 
     if (objectTag == 0)
         return 0;
@@ -853,7 +868,7 @@
 
     TEST_THROW_ARG2( (fLoadPool->size() != fObjectCount)
                , fObjectCount
-               , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText 
directly.
+               , fLoadPool->size()
                , XMLExcepts::XSer_LoadPool_NoTally_ObjCnt
                )
 
@@ -864,12 +879,18 @@
 
 void XSerializeEngine::pumpCount()
 {
-
-    TEST_THROW_ARG2( (fObjectCount >= fgMaxObjectCount)
-               , fObjectCount
-               , fgMaxObjectCount
-               , XMLExcepts::XSer_ObjCount_UppBnd_Exceed
-               )
+    if (fObjectCount >= fgMaxObjectCount)
+    {
+      XMLCh value1[64];
+      XMLCh value2[64];
+      XMLString::sizeToText(fObjectCount, value1, 65, 10, getMemoryManager());
+      XMLString::binToText(fgMaxObjectCount, value2, 65, 10, 
getMemoryManager());
+      ThrowXMLwithMemMgr2(XSerializationException
+                          , XMLExcepts::XSer_ObjCount_UppBnd_Exceed
+                          , value1
+                          , value2
+                          , getMemoryManager());
+    }
 
     fObjectCount++;
 
@@ -901,14 +922,14 @@
      * to do: combine the checking and create a new exception code later
     ***/
     TEST_THROW_ARG2( (bytesRead < fBufSize)
-               , (unsigned long)bytesRead // @@ Need to use sizeToText 
directly.
-               , (unsigned long)fBufSize  // @@ Need to use sizeToText 
directly.
+               , bytesRead
+               , fBufSize
                , XMLExcepts::XSer_InStream_Read_LT_Req
                )
 
     TEST_THROW_ARG2( (bytesRead > fBufSize)
-               , (unsigned long)bytesRead // @@ Need to use sizeToText 
directly.
-               , (unsigned long)fBufSize  // @@ Need to use sizeToText 
directly.
+               , bytesRead
+               , fBufSize
                , XMLExcepts::XSer_InStream_Read_OverFlow
                )
 
@@ -943,7 +964,7 @@
 inline void XSerializeEngine::checkAndFlushBuffer(XMLSize_t bytesNeedToWrite)
 {
     TEST_THROW_ARG1( (bytesNeedToWrite <= 0)
-                   , (unsigned long)bytesNeedToWrite // @@ Need to use 
sizeToText directly.
+                   , bytesNeedToWrite
                    , XMLExcepts::XSer_Inv_checkFlushBuffer_Size
                    )
 
@@ -956,7 +977,7 @@
 {
 
     TEST_THROW_ARG1( (bytesNeedToRead <= 0)
-                   , (unsigned long)bytesNeedToRead // @@ Need to use 
sizeToText directly.
+                   , bytesNeedToRead
                    , XMLExcepts::XSer_Inv_checkFillBuffer_Size
                    )
 
@@ -970,10 +991,12 @@
 
 inline void XSerializeEngine::ensureStoreBuffer() const
 {
+    XMLSize_t a = (XMLSize_t) (fBufCur - fBufStart);
+    XMLSize_t b = (XMLSize_t) (fBufEnd - fBufCur);
 
     TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufEnd))
-                    , (unsigned long)(fBufCur - fBufStart) // @@ Need to use 
sizeToText directly.
-                    , (unsigned long)(fBufEnd - fBufCur)   // @@ Need to use 
sizeToText directly.
+                    , a
+                    , b
                     , XMLExcepts::XSer_StoreBuffer_Violation
                     )
 
@@ -981,10 +1004,12 @@
 
 inline void XSerializeEngine::ensureLoadBuffer() const
 {
+    XMLSize_t a = (XMLSize_t) (fBufCur - fBufStart);
+    XMLSize_t b = (XMLSize_t) (fBufLoadMax - fBufCur);
 
     TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufLoadMax))
-                    , (unsigned long)(fBufCur - fBufStart)
-                    , (unsigned long)(fBufLoadMax - fBufCur)
+                    , a
+                    , b
                     , XMLExcepts::XSer_LoadBuffer_Violation
                     )
 

Modified: xerces/c/trunk/src/xercesc/util/XMLString.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.cpp Wed Nov 11 10:03:53 2009
@@ -81,23 +81,7 @@
 //  XMLString: Public static methods
 // ---------------------------------------------------------------------------
 
-void XMLString::sizeToText(  const   XMLSize_t           toFormat
-                            ,       char* const          toFill
-                            , const XMLSize_t            maxChars
-                            , const unsigned int         radix
-                            , MemoryManager* const       manager)
-{
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Call the int 64-bit version.
-    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
-#else
-    // Call the unsigned long version.
-    binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
-#endif
-}
-
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-void XMLString::binToText(  const   XMLUInt64            toFormat
+void XMLString::sizeToText(  const  XMLSize_t           toFormat
                             ,       char* const          toFill
                             , const XMLSize_t            maxChars
                             , const unsigned int         radix
@@ -124,7 +108,7 @@
     XMLSize_t tmpIndex = 0;
 
     // A copy of the conversion value that we can modify
-    XMLUInt64 tmpVal = toFormat;
+    XMLSize_t tmpVal = toFormat;
 
     //
     //  Convert into a temp buffer that we know is large enough. This avoids
@@ -153,7 +137,7 @@
     {
         while (tmpVal)
         {
-            const XMLUInt64 charInd = (tmpVal & 0xFUL);
+            const XMLSize_t charInd = (tmpVal & 0xFUL);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal >>= 4;
         }
@@ -162,7 +146,7 @@
     {
         while (tmpVal)
         {
-            const XMLUInt64 charInd = (tmpVal % radix);
+            const XMLSize_t charInd = (tmpVal % radix);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal /= radix;
         }
@@ -186,7 +170,6 @@
     // And cap off the caller's buffer
     toFill[outIndex] = char(0);
 }
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
 
 void XMLString::binToText(  const   unsigned long   toFormat
                             ,       char* const     toFill
@@ -194,10 +177,6 @@
                             , const unsigned int    radix
                             , MemoryManager* const  manager)
 {
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Just call the 64-bit version
-    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
-#else
     static const char digitList[16] =
     {
           '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
@@ -219,7 +198,7 @@
     XMLSize_t tmpIndex = 0;
 
     // A copy of the conversion value that we can modify
-    unsigned int tmpVal = toFormat;
+    unsigned long tmpVal = toFormat;
 
     //
     //  Convert into a temp buffer that we know is large enough. This avoids
@@ -248,7 +227,7 @@
     {
         while (tmpVal)
         {
-            const unsigned int charInd = (tmpVal & 0xFUL);
+            const unsigned long charInd = (tmpVal & 0xFUL);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal >>= 4;
         }
@@ -257,7 +236,7 @@
     {
         while (tmpVal)
         {
-            const unsigned int charInd = (tmpVal % radix);
+            const unsigned long charInd = (tmpVal % radix);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal /= radix;
         }
@@ -280,7 +259,6 @@
 
     // And cap off the caller's buffer
     toFill[outIndex] = char(0);
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
 }
 
 void XMLString::binToText(  const   unsigned int    toFormat
@@ -293,50 +271,12 @@
     binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
 }
 
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-void XMLString::binToText(  const   XMLInt64        toFormat
-                            ,       char* const     toFill
-                            , const XMLSize_t       maxChars
-                            , const unsigned int    radix
-                            , MemoryManager* const  manager)
-{
-    //
-    //  If it's negative, then put a negative sign into the output and flip
-    //  the sign of the local temp value.
-    //
-    XMLSize_t startInd = 0;
-    XMLUInt64 actualVal;
-    if (toFormat < 0)
-    {
-        toFill[0] = '-';
-        startInd++;
-        // Signed integers can represent one extra negative value
-        // compared to the positive values. If we simply do (v * -1)
-        // we will overflow on that extra value.
-        //
-        XMLInt64 v = toFormat;
-        v++;
-        actualVal = (XMLUInt64)(v * -1);
-        actualVal++;
-    }
-    else
-        actualVal = (XMLUInt64)(toFormat);
-
-    // And now call the XMLUInt64 version
-    binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
-}
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
-
 void XMLString::binToText(  const   long            toFormat
                             ,       char* const     toFill
                             , const XMLSize_t       maxChars
                             , const unsigned int    radix
                             , MemoryManager* const  manager)
 {
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Just call the 64-bit version
-    binToText((XMLInt64)toFormat, toFill, maxChars, radix, manager);
-#else
     //
     //  If its negative, then put a negative sign into the output and flip
     //  the sign of the local temp value.
@@ -363,8 +303,6 @@
 
     // And now call the unsigned long version
     binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
-
 }
 
 void XMLString::binToText(  const   int             toFormat
@@ -860,22 +798,6 @@
                             , const unsigned int         radix
                             , MemoryManager* const       manager)
 {
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Call the int 64-bit version.
-    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
-#else
-    // Call the unsigned long version.
-    binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
-#endif
-}
-
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-void XMLString::binToText(  const   XMLUInt64            toFormat
-                            ,       XMLCh* const         toFill
-                            , const XMLSize_t            maxChars
-                            , const unsigned int         radix
-                            , MemoryManager* const       manager)
-{
     static const XMLCh digitList[16] =
     {
             chDigit_0, chDigit_1, chDigit_2, chDigit_3, chDigit_4, chDigit_5
@@ -898,7 +820,7 @@
     XMLSize_t tmpIndex = 0;
 
     // A copy of the conversion value that we can modify
-    XMLUInt64 tmpVal = toFormat;
+    XMLSize_t tmpVal = toFormat;
 
     //
     //  Convert into a temp buffer that we know is large enough. This avoids
@@ -927,7 +849,7 @@
     {
         while (tmpVal)
         {
-            const XMLUInt64 charInd = (tmpVal & 0xFUL);
+            const XMLSize_t charInd = (tmpVal & 0xFUL);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal >>= 4;
         }
@@ -936,7 +858,7 @@
     {
         while (tmpVal)
         {
-            const XMLUInt64 charInd = (tmpVal % radix);
+            const XMLSize_t charInd = (tmpVal % radix);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal /= radix;
         }
@@ -960,7 +882,6 @@
     // And cap off the caller's buffer
     toFill[outIndex] = chNull;
 }
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
 
 void XMLString::binToText(  const   unsigned long   toFormat
                             ,       XMLCh* const    toFill
@@ -968,10 +889,6 @@
                             , const unsigned int    radix
                             , MemoryManager* const  manager)
 {
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Just call the 64-bit version
-    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
-#else
     static const XMLCh digitList[16] =
     {
             chDigit_0, chDigit_1, chDigit_2, chDigit_3, chDigit_4, chDigit_5
@@ -994,7 +911,7 @@
     XMLSize_t tmpIndex = 0;
 
     // A copy of the conversion value that we can modify
-    unsigned int tmpVal = toFormat;
+    unsigned long tmpVal = toFormat;
 
     //
     //  Convert into a temp buffer that we know is large enough. This avoids
@@ -1023,7 +940,7 @@
     {
         while (tmpVal)
         {
-            const unsigned int charInd = (tmpVal & 0xFUL);
+            const unsigned long charInd = (tmpVal & 0xFUL);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal >>= 4;
         }
@@ -1032,7 +949,7 @@
     {
         while (tmpVal)
         {
-            const unsigned int charInd = (tmpVal % radix);
+            const unsigned long charInd = (tmpVal % radix);
             tmpBuf[tmpIndex++] = digitList[charInd];
             tmpVal /= radix;
         }
@@ -1055,7 +972,6 @@
 
     // And cap off the caller's buffer
     toFill[outIndex] = chNull;
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
 }
 
 void XMLString::binToText(  const   unsigned int    toFormat
@@ -1068,52 +984,12 @@
     binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
 }
 
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-void XMLString::binToText(  const   XMLInt64        toFormat
-                            ,       XMLCh* const    toFill
-                            , const XMLSize_t       maxChars
-                            , const unsigned int    radix
-                            , MemoryManager* const  manager)
-{
-    //
-    //  If its negative, then put a negative sign into the output and flip
-    //  the sign of the local temp value.
-    //
-    XMLSize_t startInd = 0;
-    XMLUInt64 actualVal;
-    if (toFormat < 0)
-    {
-        toFill[0] = chDash;
-        startInd++;
-        // Signed integers can represent one extra negative value
-        // compared to the positive values. If we simply do (v * -1)
-        // we will overflow on that extra value.
-        //
-        XMLInt64 v = toFormat;
-        v++;
-        actualVal = (XMLUInt64)(v * -1);
-        actualVal++;
-    }
-     else
-    {
-        actualVal = (XMLUInt64)(toFormat);
-    }
-
-    // And now call the XMLUInt64 version
-    binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
-}
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
-
 void XMLString::binToText(  const   long            toFormat
                             ,       XMLCh* const    toFill
                             , const XMLSize_t       maxChars
                             , const unsigned int    radix
                             , MemoryManager* const  manager)
 {
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    // Just call the 64-bit version
-    binToText((XMLInt64)toFormat, toFill, maxChars, radix, manager);
-#else
     //
     //  If its negative, then put a negative sign into the output and flip
     //  the sign of the local temp value.
@@ -1140,7 +1016,6 @@
 
     // And now call the unsigned long version
     binToText(actualVal, &toFill[startInd], maxChars, radix, manager);
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
 }
 
 void XMLString::binToText(  const   int             toFormat
@@ -1153,7 +1028,6 @@
     binToText((long)toFormat, toFill, maxChars, radix, manager);
 }
 
-
 void XMLString::catString(XMLCh* const target, const XMLCh* const src)
 {
     // Get the starting point for the cat on the target XMLString

Modified: xerces/c/trunk/src/xercesc/util/XMLString.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.hpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.hpp Wed Nov 11 10:03:53 2009
@@ -1020,48 +1020,6 @@
         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
     );
 
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    /** Converts binary data to a text string based a given radix
-      *
-      * @param toFormat The number to convert
-      * @param toFill The buffer that will hold the output on return. The
-      *        size of this buffer should at least be 'maxChars + 1'.
-      * @param maxChars The maximum number of output characters that can be
-      *         accepted. If the result will not fit, it is an error.
-      * @param radix The radix of the input data, based on which the conversion
-      * @param manager The MemoryManager to use to allocate objects
-      * will be done
-      */
-    static void binToText
-    (
-        const   XMLUInt64           toFormat
-        ,       char* const         toFill
-        , const XMLSize_t           maxChars
-        , const unsigned int        radix
-        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
-    );
-
-    /** Converts binary data to a text string based a given radix
-      *
-      * @param toFormat The number to convert
-      * @param toFill The buffer that will hold the output on return. The
-      *        size of this buffer should at least be 'maxChars + 1'.
-      * @param maxChars The maximum number of output characters that can be
-      *         accepted. If the result will not fit, it is an error.
-      * @param radix The radix of the input data, based on which the conversion
-      * @param manager The MemoryManager to use to allocate objects
-      * will be done
-      */
-    static void binToText
-    (
-        const   XMLUInt64           toFormat
-        ,       XMLCh* const        toFill
-        , const XMLSize_t           maxChars
-        , const unsigned int        radix
-        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
-    );
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
-
     /** Converts binary data to a text string based a given radix
       *
       * @param toFormat The number to convert
@@ -1142,48 +1100,6 @@
         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
     );
 
-#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 
!= 4
-    /** Converts binary data to a text string based a given radix
-      *
-      * @param toFormat The number to convert
-      * @param toFill The buffer that will hold the output on return. The
-      *        size of this buffer should at least be 'maxChars + 1'.
-      * @param maxChars The maximum number of output characters that can be
-      *         accepted. If the result will not fit, it is an error.
-      * @param radix The radix of the input data, based on which the conversion
-      * @param manager The MemoryManager to use to allocate objects
-      * will be done
-      */
-    static void binToText
-    (
-        const   XMLInt64        toFormat
-        ,       char* const     toFill
-        , const XMLSize_t       maxChars
-        , const unsigned int    radix
-        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
-    );
-
-    /** Converts binary data to a text string based a given radix
-      *
-      * @param toFormat The number to convert
-      * @param toFill The buffer that will hold the output on return. The
-      *        size of this buffer should at least be 'maxChars + 1'.
-      * @param maxChars The maximum number of output characters that can be
-      *         accepted. If the result will not fit, it is an error.
-      * @param radix The radix of the input data, based on which the conversion
-      * @param manager The MemoryManager to use to allocate objects
-      * will be done
-      */
-    static void binToText
-    (
-        const   XMLInt64        toFormat
-        ,       XMLCh* const    toFill
-        , const XMLSize_t       maxChars
-        , const unsigned int    radix
-        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
-    );
-#endif // XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && 
XERCES_SIZEOF_INT64 != 4
-
     /**
       * Converts a string of decimal chars to a binary value
       *

Modified: xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.borland.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.borland.hpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.borland.hpp 
(original)
+++ xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.borland.hpp Wed Nov 
11 10:03:53 2009
@@ -57,10 +57,6 @@
 #define XERCES_S64BIT_INT   INT64
 #define XERCES_U64BIT_INT   UINT64
 
-#define XERCES_SIZEOF_INT   4
-#define XERCES_SIZEOF_LONG  4
-#define XERCES_SIZEOF_INT64 8
-
 #define XERCES_XMLCH_T      wchar_t
 
 #define XERCES_SIZE_T       SIZE_T

Modified: xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.hpp.in
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.hpp.in?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.hpp.in (original)
+++ xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.hpp.in Wed Nov 11 
10:03:53 2009
@@ -61,9 +61,6 @@
 #undef XERCES_U16BIT_INT
 #undef XERCES_U32BIT_INT
 #undef XERCES_U64BIT_INT
-#undef XERCES_SIZEOF_INT
-#undef XERCES_SIZEOF_LONG
-#undef XERCES_SIZEOF_INT64
 #undef XERCES_XMLCH_T
 #undef XERCES_SIZE_T
 #undef XERCES_SSIZE_T

Modified: xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Xerces_autoconf_config.msvc.hpp Wed Nov 11 
10:03:53 2009
@@ -70,15 +70,6 @@
 #  define XERCES_U64BIT_INT   UINT32
 #endif
 
-#define XERCES_SIZEOF_INT   4
-#define XERCES_SIZEOF_LONG  4
-
-#if (_MSC_VER >= 1300)
-#  define XERCES_SIZEOF_INT64 8
-#else
-#  define XERCES_SIZEOF_INT64 4
-#endif
-
 #ifdef _NATIVE_WCHAR_T_DEFINED
 #define XERCES_XMLCH_T      wchar_t
 #else

Modified: xerces/c/trunk/src/xercesc/util/regx/RegxParser.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RegxParser.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RegxParser.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RegxParser.cpp Wed Nov 11 10:03:53 2009
@@ -103,7 +103,7 @@
 
     if (fOffset != fStringLen) {
         XMLCh value1[65];
-        XMLString::binToText((unsigned long)fOffset, value1, 64, 10, 
fMemoryManager);
+        XMLString::sizeToText(fOffset, value1, 64, 10, fMemoryManager);
         ThrowXMLwithMemMgr2(ParseException,XMLExcepts::Parser_Parse1, value1, 
fString, fMemoryManager);
     }
 

Modified: 
xerces/c/trunk/src/xercesc/validators/datatype/AbstractStringValidator.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/datatype/AbstractStringValidator.cpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/datatype/AbstractStringValidator.cpp 
(original)
+++ xerces/c/trunk/src/xercesc/validators/datatype/AbstractStringValidator.cpp 
Wed Nov 11 10:03:53 2009
@@ -36,20 +36,20 @@
 #define  REPORT_FACET_ERROR(val1, val2, except_code, manager)    \
     XMLCh value1[BUF_LEN+1]; \
     XMLCh value2[BUF_LEN+1]; \
-   XMLString::binToText((unsigned long)val1, value1, BUF_LEN, 10, manager);    
 \
-   XMLString::binToText((unsigned long)val2, value2, BUF_LEN, 10, manager);    
 \
-   ThrowXMLwithMemMgr2(InvalidDatatypeFacetException             \
+   XMLString::sizeToText(val1, value1, BUF_LEN, 10, manager);     \
+   XMLString::sizeToText(val2, value2, BUF_LEN, 10, manager);     \
+   ThrowXMLwithMemMgr2(InvalidDatatypeFacetException              \
            , except_code                                \
            , value1                                     \
            , value2                                     \
            , manager);
 
-#define  REPORT_VALUE_ERROR(data, val1, val2, except_code, manager)      \
+#define  REPORT_VALUE_ERROR(data, val1, val2, except_code, manager)       \
     XMLCh value1[BUF_LEN+1]; \
     XMLCh value2[BUF_LEN+1]; \
-   XMLString::binToText((unsigned long)val1, value1, BUF_LEN, 10, manager);    
         \
-   XMLString::binToText((unsigned long)val2, value2, BUF_LEN, 10, manager);    
         \
-   ThrowXMLwithMemMgr3(InvalidDatatypeValueException                     \
+   XMLString::sizeToText(val1, value1, BUF_LEN, 10, manager);             \
+   XMLString::sizeToText(val2, value2, BUF_LEN, 10, manager);             \
+   ThrowXMLwithMemMgr3(InvalidDatatypeValueException                      \
            , except_code                                        \
            , data                                               \
            , value1                                             \

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp?rev=834826&r1=834825&r2=834826&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp Wed Nov 11 
10:03:53 2009
@@ -858,7 +858,7 @@
 
     XMLCh anonCountStr[16]; // a count of 15 digits should be enough
 
-    XMLString::binToText(fAnonXSTypeCount++, anonCountStr, 15, 10, 
fMemoryManager);
+    XMLString::sizeToText(fAnonXSTypeCount++, anonCountStr, 15, 10, 
fMemoryManager);
     fBuffer.set(prefix);
     fBuffer.append(anonCountStr);
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to