From 69e4c95a1db16235f2f0e5ab57528ce1df6b6fe9 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <borisk@apache.org>
Date: Tue, 16 Sep 2008 15:57:44 +0000
Subject: [PATCH] Fix the remaining VC++ warnings (loss of data and sign
 change).

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@695949 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/framework/XMLFormatter.cpp        |  4 +-
 src/xercesc/internal/DGXMLScanner.cpp         |  8 ++--
 src/xercesc/internal/IGXMLScanner2.cpp        |  8 ++--
 src/xercesc/internal/SGXMLScanner.cpp         |  4 +-
 src/xercesc/internal/WFXMLScanner.cpp         |  4 +-
 src/xercesc/internal/XSerializeEngine.cpp     | 22 +++++-----
 src/xercesc/util/XMLString.cpp                | 32 +++++++++++++++
 src/xercesc/util/XMLString.hpp                | 40 +++++++++++++++++++
 src/xercesc/util/regx/RegularExpression.cpp   |  2 +-
 .../datatype/AbstractStringValidator.cpp      |  8 ++--
 .../datatype/AbstractStringValidator.hpp      |  2 +-
 .../Base64BinaryDatatypeValidator.cpp         | 16 ++++----
 .../Base64BinaryDatatypeValidator.hpp         |  2 +-
 .../datatype/HexBinaryDatatypeValidator.cpp   | 14 +++----
 .../datatype/HexBinaryDatatypeValidator.hpp   |  2 +-
 .../datatype/ListDatatypeValidator.cpp        | 16 ++++----
 .../datatype/ListDatatypeValidator.hpp        |  2 +-
 17 files changed, 130 insertions(+), 56 deletions(-)

diff --git a/src/xercesc/framework/XMLFormatter.cpp b/src/xercesc/framework/XMLFormatter.cpp
index 70d86669e..d4b19373d 100644
--- a/src/xercesc/framework/XMLFormatter.cpp
+++ b/src/xercesc/framework/XMLFormatter.cpp
@@ -582,13 +582,13 @@ void XMLFormatter::writeCharRef(const XMLCh &toWrite)
 
 void XMLFormatter::writeCharRef(XMLSize_t toWrite)
 {
-    XMLCh tmpBuf[32];
+    XMLCh tmpBuf[64];
     tmpBuf[0] = chAmpersand;
     tmpBuf[1] = chPound;
     tmpBuf[2] = chLatin_x;
 
     // Build a char ref for the current char
-    XMLString::binToText(toWrite, &tmpBuf[3], 8, 16, fMemoryManager);
+    XMLString::sizeToText(toWrite, &tmpBuf[3], 32, 16, fMemoryManager);
     const XMLSize_t bufLen = XMLString::stringLen(tmpBuf);
     tmpBuf[bufLen] = chSemiColon;
     tmpBuf[bufLen+1] = chNull;
diff --git a/src/xercesc/internal/DGXMLScanner.cpp b/src/xercesc/internal/DGXMLScanner.cpp
index d6bdd1cfd..0ad284836 100644
--- a/src/xercesc/internal/DGXMLScanner.cpp
+++ b/src/xercesc/internal/DGXMLScanner.cpp
@@ -3572,8 +3572,8 @@ DGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
@@ -3630,8 +3630,8 @@ DGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp
index 09ad0bbf3..7c34a4ed4 100644
--- a/src/xercesc/internal/IGXMLScanner2.cpp
+++ b/src/xercesc/internal/IGXMLScanner2.cpp
@@ -3080,8 +3080,8 @@ IGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
@@ -3138,8 +3138,8 @@ IGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp
index f9cedfde7..067fd916c 100644
--- a/src/xercesc/internal/SGXMLScanner.cpp
+++ b/src/xercesc/internal/SGXMLScanner.cpp
@@ -4626,8 +4626,8 @@ SGXMLScanner::scanEntityRef(  const   bool
     // here's where we need to check if there's a SecurityManager,
     // how many entity references we've had
     if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-        XMLCh expLimStr[16];
-        XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+        XMLCh expLimStr[32];
+        XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
         emitError
         (
             XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/WFXMLScanner.cpp b/src/xercesc/internal/WFXMLScanner.cpp
index 8670eb531..b1d542ffb 100644
--- a/src/xercesc/internal/WFXMLScanner.cpp
+++ b/src/xercesc/internal/WFXMLScanner.cpp
@@ -2116,8 +2116,8 @@ WFXMLScanner::scanEntityRef(const bool
     // here's where we need to check if there's a SecurityManager,
     // how many entity references we've had
     if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-        XMLCh expLimStr[16];
-        XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+        XMLCh expLimStr[32];
+        XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
         emitError
         ( 
             XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/XSerializeEngine.cpp b/src/xercesc/internal/XSerializeEngine.cpp
index 506880fc3..3c708a290 100644
--- a/src/xercesc/internal/XSerializeEngine.cpp
+++ b/src/xercesc/internal/XSerializeEngine.cpp
@@ -835,7 +835,7 @@ XSerializable* XSerializeEngine::lookupLoadPool(XSerializedObjectId_t objectTag)
       ***/
     TEST_THROW_ARG2( (objectTag > fLoadPool->size())
               , objectTag
-              , fLoadPool->size()
+              , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText directly.
               , XMLExcepts::XSer_LoadPool_UppBnd_Exceed
               )
 
@@ -853,7 +853,7 @@ void XSerializeEngine::addLoadPool(void* const objToAdd)
 
     TEST_THROW_ARG2( (fLoadPool->size() != fObjectCount)
                , fObjectCount
-               , fLoadPool->size()
+               , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_LoadPool_NoTally_ObjCnt
                )
 
@@ -899,16 +899,16 @@ void XSerializeEngine::fillBuffer()
     /***
      * InputStream MUST fill in the exact amount of bytes as requested
      * to do: combine the checking and create a new exception code later
-     ***/
+    ***/
     TEST_THROW_ARG2( (bytesRead < fBufSize)
-               , (unsigned long)bytesRead
-               , (unsigned long)fBufSize
+               , (unsigned long)bytesRead // @@ Need to use sizeToText directly.
+               , (unsigned long)fBufSize  // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_InStream_Read_LT_Req
                )
 
     TEST_THROW_ARG2( (bytesRead > fBufSize)
-               , (unsigned long)bytesRead
-               , (unsigned long)fBufSize
+               , (unsigned long)bytesRead // @@ Need to use sizeToText directly.
+               , (unsigned long)fBufSize  // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_InStream_Read_OverFlow
                )
 
@@ -943,7 +943,7 @@ void XSerializeEngine::flushBuffer()
 inline void XSerializeEngine::checkAndFlushBuffer(XMLSize_t bytesNeedToWrite)
 {
     TEST_THROW_ARG1( (bytesNeedToWrite <= 0)
-                   , (unsigned long)bytesNeedToWrite
+                   , (unsigned long)bytesNeedToWrite // @@ Need to use sizeToText directly.
                    , XMLExcepts::XSer_Inv_checkFlushBuffer_Size
                    )
 
@@ -956,7 +956,7 @@ inline void XSerializeEngine::checkAndFillBuffer(XMLSize_t bytesNeedToRead)
 {
 
     TEST_THROW_ARG1( (bytesNeedToRead <= 0)
-                   , (unsigned long)bytesNeedToRead
+                   , (unsigned long)bytesNeedToRead // @@ Need to use sizeToText directly.
                    , XMLExcepts::XSer_Inv_checkFillBuffer_Size
                    )
 
@@ -972,8 +972,8 @@ inline void XSerializeEngine::ensureStoreBuffer() const
 {
 
     TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufEnd))
-                    , (unsigned long)(fBufCur - fBufStart)
-                    , (unsigned long)(fBufEnd - fBufCur)
+                    , (unsigned long)(fBufCur - fBufStart) // @@ Need to use sizeToText directly.
+                    , (unsigned long)(fBufEnd - fBufCur)   // @@ Need to use sizeToText directly.
                     , XMLExcepts::XSer_StoreBuffer_Violation
                     )
 
diff --git a/src/xercesc/util/XMLString.cpp b/src/xercesc/util/XMLString.cpp
index 56ec13ccb..6b8251df4 100644
--- a/src/xercesc/util/XMLString.cpp
+++ b/src/xercesc/util/XMLString.cpp
@@ -80,6 +80,22 @@ MemoryManager* XMLString::fgMemoryManager = 0;
 // ---------------------------------------------------------------------------
 //  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
                             ,       char* const          toFill
@@ -837,6 +853,22 @@ bool XMLString::isHex(XMLCh const theChar)
 // ---------------------------------------------------------------------------
 //  Wide char versions of most of the string methods
 // ---------------------------------------------------------------------------
+
+void XMLString::sizeToText(  const  XMLSize_t            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
+    // 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
diff --git a/src/xercesc/util/XMLString.hpp b/src/xercesc/util/XMLString.hpp
index f555796c1..dbd3a5b64 100644
--- a/src/xercesc/util/XMLString.hpp
+++ b/src/xercesc/util/XMLString.hpp
@@ -901,6 +901,46 @@ public:
     /** @name Conversion functions */
     //@{
 
+      /** Converts size to a text string based a given radix
+      *
+      * @param toFormat The size 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 sizeToText
+    (
+        const   XMLSize_t           toFormat
+        ,       char* const         toFill
+        , const XMLSize_t           maxChars
+        , const unsigned int        radix
+        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
+    );
+
+    /** Converts size to a text string based a given radix
+      *
+      * @param toFormat The size 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 sizeToText
+    (
+        const   XMLSize_t           toFormat
+        ,       XMLCh* 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
diff --git a/src/xercesc/util/regx/RegularExpression.cpp b/src/xercesc/util/regx/RegularExpression.cpp
index deadcc8bd..b9552d967 100644
--- a/src/xercesc/util/regx/RegularExpression.cpp
+++ b/src/xercesc/util/regx/RegularExpression.cpp
@@ -835,7 +835,7 @@ XMLCh* RegularExpression::replace(const XMLCh* const matchString,
         tokStart = match->getEndPos(0);
     }
 
-    if(end > tokStart)
+    if(end > (XMLSize_t)tokStart)
         result.append(matchString + tokStart, end - tokStart);
 
     return XMLString::replicate(result.getRawBuffer(), manager);
diff --git a/src/xercesc/validators/datatype/AbstractStringValidator.cpp b/src/xercesc/validators/datatype/AbstractStringValidator.cpp
index f3bb7541d..4f18ba643 100644
--- a/src/xercesc/validators/datatype/AbstractStringValidator.cpp
+++ b/src/xercesc/validators/datatype/AbstractStringValidator.cpp
@@ -585,7 +585,7 @@ void AbstractStringValidator::checkContent( const XMLCh*             const conte
         return;
 
     checkValueSpace(content, manager);
-    int length = getLength(content, manager);
+    XMLSize_t length = getLength(content, manager);
 
     if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) &&
         (length > getMaxLength()))
@@ -713,10 +713,10 @@ void AbstractStringValidator::assignAdditionalFacet( const XMLCh* const key
             , manager);
 }
 
-int AbstractStringValidator::getLength(const XMLCh* const content
-                                   , MemoryManager* const) const
+XMLSize_t AbstractStringValidator::getLength(const XMLCh* const content
+                                           , MemoryManager* const) const
 {
-    return (int)XMLString::stringLen(content);
+    return XMLString::stringLen(content);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/AbstractStringValidator.hpp b/src/xercesc/validators/datatype/AbstractStringValidator.hpp
index 349a6d771..ff2b9d447 100644
--- a/src/xercesc/validators/datatype/AbstractStringValidator.hpp
+++ b/src/xercesc/validators/datatype/AbstractStringValidator.hpp
@@ -110,7 +110,7 @@ protected:
     virtual void checkAdditionalFacet(const XMLCh* const content
                                     , MemoryManager* const manager) const;
 
-    virtual int getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
         , MemoryManager* const manager) const;
     
     virtual void checkValueSpace(const XMLCh* const content
diff --git a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
index 229ca4c8b..7763eafce 100644
--- a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -70,8 +70,9 @@ void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
 {
     if (!content || !*content)
         return;
-    if (getLength(content, manager) < 0)
-    { 
+
+    if (Base64::getDataLength(content, manager, Base64::Conf_Schema) < 0)
+    {
         ThrowXMLwithMemMgr1(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_Not_Base64
                 , content
@@ -79,12 +80,13 @@ void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
     }
 }
 
-int Base64BinaryDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t Base64BinaryDatatypeValidator::getLength(const XMLCh* const content
                                          , MemoryManager* const manager) const
 {
     if (!content || !*content)
         return 0;
-    return Base64::getDataLength(content, manager, Base64::Conf_Schema);
+
+    return (XMLSize_t)Base64::getDataLength(content, manager, Base64::Conf_Schema);
 }
 
 void Base64BinaryDatatypeValidator::normalizeEnumeration(MemoryManager* const manager)
@@ -101,7 +103,7 @@ void Base64BinaryDatatypeValidator::normalizeEnumeration(MemoryManager* const ma
 void Base64BinaryDatatypeValidator::normalizeContent(XMLCh* const content
                                                      , MemoryManager* const manager) const
 {
-    XMLString::removeWS(content, manager);     
+    XMLString::removeWS(content, manager);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
index 2877d7aa3..595084b75 100644
--- a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
@@ -74,7 +74,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                             , MemoryManager* const manager);
 
-    virtual int  getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
                        , MemoryManager* const manager) const;
 
     virtual void normalizeEnumeration(MemoryManager* const manager);
diff --git a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
index 918974ddc..b95ff4b52 100644
--- a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -65,10 +65,10 @@ DatatypeValidator* HexBinaryDatatypeValidator::newInstance
 //  Utilities
 // ---------------------------------------------------------------------------
 
-void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
-                                                 , MemoryManager* const manager)
+void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content,
+                                                 MemoryManager* const manager)
 {
-    if (getLength(content, manager) < 0)
+    if (HexBin::getDataLength(content) < 0)
     {
         ThrowXMLwithMemMgr1(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_Not_HexBin
@@ -77,10 +77,10 @@ void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
     }
 }
 
-int HexBinaryDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t HexBinaryDatatypeValidator::getLength(const XMLCh* const content
                                       , MemoryManager* const) const
 {
-    return HexBin::getDataLength(content);
+    return (XMLSize_t)HexBin::getDataLength(content);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
index 23050595d..b2815026d 100644
--- a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
@@ -75,7 +75,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                                 , MemoryManager* const manager);
 
-    virtual int  getLength(const XMLCh* const content
+    virtual XMLSize_t  getLength(const XMLCh* const content
                        , MemoryManager* const manager) const;
 
 private:
diff --git a/src/xercesc/validators/datatype/ListDatatypeValidator.cpp b/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
index a721e33db..1c92fe682 100644
--- a/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
@@ -175,8 +175,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(getMaxLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(getMaxLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_GT_maxLen
@@ -191,8 +191,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(getMinLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(getMinLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_LT_minLen
@@ -207,8 +207,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_NE_Len
@@ -286,13 +286,13 @@ void ListDatatypeValidator::checkValueSpace(const XMLCh* const
                                             , MemoryManager* const)
 {}
 
-int ListDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t ListDatatypeValidator::getLength(const XMLCh* const content
                                      , MemoryManager* const manager) const
 {
     BaseRefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(content, manager);
     Janitor<BaseRefVectorOf<XMLCh> > janName(tokenVector);
 
-    return (int)tokenVector->size();
+    return tokenVector->size();
 }
 
 void ListDatatypeValidator::inspectFacetBase(MemoryManager* const manager)
diff --git a/src/xercesc/validators/datatype/ListDatatypeValidator.hpp b/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
index ea1ef7fc8..8ef1fa1cb 100644
--- a/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
@@ -139,7 +139,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                                 , MemoryManager* const manager);
 
-    virtual int getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
             , MemoryManager* const manager) const;
 
     //
-- 
GitLab