You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2008/02/21 18:43:18 UTC

svn commit: r629886 - /xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp

Author: amassari
Date: Thu Feb 21 09:43:17 2008
New Revision: 629886

URL: http://svn.apache.org/viewvc?rev=629886&view=rev
Log:
Fixed unsigned int/XMLSize_t mismatch

Modified:
    xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp?rev=629886&r1=629885&r2=629886&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Thu Feb 21 09:43:17 2008
@@ -93,11 +93,11 @@
 //  When XMLCh and ICU's UChar are not the same size, we have to do a temp
 //  conversion of all strings. These local helper methods make that easier.
 //
-static UChar* convertToUChar( const   XMLCh* const    toConvert
-                            , const unsigned int    srcLen = 0
+static UChar* convertToUChar( const XMLCh* const   toConvert
+                            , const XMLSize_t      srcLen = 0
                             , MemoryManager* const manager = 0)
 {
-    const unsigned int actualLen = srcLen
+    const XMLSize_t actualLen = srcLen
                                    ? srcLen : XMLString::stringLen(toConvert);
 
     UChar* tmpBuf = (manager)
@@ -306,16 +306,13 @@
 
 
 template <class FunctionType>
-static void
-doCaseConvert(
-            XMLCh*          convertString,
-            FunctionType    caseFunction)
+static void doCaseConvert(XMLCh*          convertString,
+                          FunctionType    caseFunction)
 {
     // Note the semantics of this function are broken, since it's
     // possible that changing the case of a string could increase
     // its length, but there's no way to handle such a situation.
-    const unsigned int  len =
-            XMLString::stringLen(convertString);
+    const XMLSize_t len = XMLString::stringLen(convertString);
 
     size_t  readPos = 0;
     size_t  writePos = 0;
@@ -382,9 +379,9 @@
     if ( (XMLString::endsWith(encodingNameToUse, gs390Id)) ||
          (XMLString::endsWith(encodingNameToUse, gS390Id)) )
     {
-       int workBufferSize = (XMLString::stringLen(encodingNameToUse) + XMLString::stringLen(gswaplfnlId) - XMLString::stringLen(gS390Id) + 1);
+       XMLSize_t workBufferSize = (XMLString::stringLen(encodingNameToUse) + XMLString::stringLen(gswaplfnlId) - XMLString::stringLen(gS390Id) + 1);
        workBuffer = (XMLCh*) manager->allocate(workBufferSize * sizeof(XMLCh));
-       int moveSize = XMLString::stringLen(encodingNameToUse) - XMLString::stringLen(gS390Id);
+       XMLSize_t moveSize = XMLString::stringLen(encodingNameToUse) - XMLString::stringLen(gS390Id);
        XMLString::moveChars(workBuffer, encodingNameToUse, moveSize);
        XMLString::moveChars((workBuffer + moveSize), gswaplfnlId, XMLString::stringLen(gswaplfnlId));
        encodingNameToUse = workBuffer;
@@ -491,7 +488,7 @@
     UChar* orgTarget = startTarget;
 
     //
-    //  Transoode the buffer.  Buffer overflow errors are normal, occuring
+    //  Transcode the buffer.  Buffer overflow errors are normal, occuring
     //  when the raw input buffer holds more characters than will fit in
     //  the Unicode output buffer.
     //
@@ -536,7 +533,7 @@
     bytesEaten = startSrc - srcData;
 
     // And the characters decoded
-    const unsigned int charsDecoded = startTarget - orgTarget;
+    const XMLSize_t charsDecoded = startTarget - orgTarget;
 
     //
     //  Translate the array of char offsets into an array of character
@@ -869,7 +866,7 @@
             , 0
             , 0
             , srcText
-            , strlen(srcText)
+            , (int32_t)strlen(srcText)
             , &err
         );
     }
@@ -908,7 +905,7 @@
     //  Get the length of the source string since we'll have to use it in
     //  a couple places below.
     //
-    const unsigned int srcLen = XMLString::stringLen(toTranscode);
+    const XMLSize_t srcLen = XMLString::stringLen(toTranscode);
 
     //
     //  If XMLCh and UChar are not the same size, then we have to make a
@@ -1098,7 +1095,7 @@
     }
 
     // We'll need this in a couple of places below
-    const unsigned int srcLen = strlen(toTranscode);
+    const XMLSize_t srcLen = strlen(toTranscode);
 
     //
     //  Set up the target buffer. If XMLCh and UChar are not the same size
@@ -1124,9 +1121,9 @@
         (
             fConverter
             , targetBuf
-            , maxChars + 1
+            , (int32_t)maxChars + 1
             , toTranscode
-            , srcLen
+            , (int32_t)srcLen
             , &err
         );
     }
@@ -1205,7 +1202,7 @@
         (
             fConverter
             , toFill
-            , maxChars
+            , (int32_t)maxChars
             , actualSrc
             , -1
             , &err



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