Author: amassari
Date: Mon Jul 29 15:52:25 2013
New Revision: 1508112
URL: http://svn.apache.org/r1508112
Log:
When the characters are of fixed size, write in the charSizes array just the
data for the decoded chars, not for the number of bytes available in the target
buffer (XERCESC-2020)
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=1508112&r1=1508111&r2=1508112&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
(original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Mon Jul
29 15:52:25 2013
@@ -483,7 +483,7 @@ ICUTranscoder::transcodeFrom(const XMLB
UChar* startTarget;
if (sizeof(XMLCh) == sizeof(UChar))
startTarget = (UChar*)toFill;
- else
+ else
startTarget = (UChar*) getMemoryManager()->allocate
(
maxChars * sizeof(UChar)
@@ -546,9 +546,9 @@ ICUTranscoder::transcodeFrom(const XMLB
if (fFixed)
{
const unsigned char fillSize = (unsigned
char)ucnv_getMaxCharSize(fConverter);
- memset(charSizes, fillSize, maxChars);
+ memset(charSizes, fillSize, charsDecoded);
}
- else
+ else
{
//
// We have to convert the series of offsets into a series of
@@ -560,7 +560,7 @@ ICUTranscoder::transcodeFrom(const XMLB
{
charSizes[0] = (unsigned char)bytesEaten;
}
- else
+ else
{
// ICU does not return an extra element to allow us to figure
// out the last char size, so we have to compute it from the
@@ -711,7 +711,7 @@ bool ICUTranscoder::canTranscodeTo(const
srcBuf[1] = UChar(toCheck & 0x3FF) + 0xDC00;
srcCount++;
}
- else
+ else
{
srcBuf[0] = UChar(toCheck);
}
@@ -920,7 +920,7 @@ char* ICULCPTranscoder::transcode(const
{
actualSrc = (const UChar*)toTranscode;
}
- else
+ else
{
// Allocate a non-const temp buf, but store it also in the actual
ncActual = convertToUChar(toTranscode, 0, manager);
@@ -1070,7 +1070,7 @@ XMLCh* ICULCPTranscoder::transcode(const
{
actualRet = (XMLCh*)targetBuf;
}
- else
+ else
{
actualRet = convertToXMLCh(targetBuf, manager);
manager->deallocate(targetBuf);//delete [] targetBuf;
@@ -1183,7 +1183,7 @@ bool ICULCPTranscoder::transcode( cons
{
actualSrc = (const UChar*)toTranscode;
}
- else
+ else
{
// Allocate a non-const temp buf, but store it also in the actual
ncActual = convertToUChar(toTranscode, 0, manager);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]