You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by jo...@apache.org on 2009/03/30 14:07:24 UTC

svn commit: r759938 - /xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp

Author: johns
Date: Mon Mar 30 12:07:24 2009
New Revision: 759938

URL: http://svn.apache.org/viewvc?rev=759938&view=rev
Log:
Port the TranscodeToStr and TranscodeFromStr fixes to the xerces-3.0 branch [#XERCESC-1858]

Modified:
    xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp

Modified: xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp?rev=759938&r1=759937&r2=759938&view=diff
==============================================================================
--- xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp (original)
+++ xerces/c/branches/xerces-3.0/src/xercesc/util/TransService.cpp Mon Mar 30 12:07:24 2009
@@ -604,7 +604,7 @@
     XMLSize_t allocSize = len * sizeof(XMLCh);
     fString = (XMLByte*)fMemoryManager->allocate(allocSize);
 
-    XMLSize_t charsRead;
+    XMLSize_t charsRead = 0;
     XMLSize_t charsDone = 0;
 
     while(true) {
@@ -623,7 +623,7 @@
     }
 
     // null terminate
-    if(fBytesWritten > (allocSize - 4)) {
+    if(fBytesWritten + 4 > allocSize) {
         allocSize = fBytesWritten + 4;
         XMLByte *newBuf = (XMLByte*)fMemoryManager->allocate(allocSize);
         memcpy(newBuf, fString, fBytesWritten);
@@ -683,7 +683,7 @@
     ArrayJanitor<unsigned char> charSizes((unsigned char*)fMemoryManager->allocate(csSize * sizeof(unsigned char)),
                                           fMemoryManager);
 
-    XMLSize_t bytesRead;
+    XMLSize_t bytesRead = 0;
     XMLSize_t bytesDone = 0;
 
     while(true) {



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