Author: jasons
Date: Sat Dec 3 08:44:03 2005
New Revision: 351987
URL: http://svn.apache.org/viewcvs?rev=351987&view=rev
Log:
fix length of temp buffer to remove purify warnings
Modified:
xerces/xerces-p/trunk/interface/defines.i
Modified: xerces/xerces-p/trunk/interface/defines.i
URL:
http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/interface/defines.i?rev=351987&r1=351986&r2=351987&view=diff
==============================================================================
--- xerces/xerces-p/trunk/interface/defines.i (original)
+++ xerces/xerces-p/trunk/interface/defines.i Sat Dec 3 08:44:03 2005
@@ -113,13 +113,17 @@
XMLString2Perl(const XMLCh* input) {
SV *output;
unsigned int charsEaten = 0;
- int length = XMLString::stringLen(input); // string length
- XMLByte* res = new XMLByte[length * UTF8_MAXLEN]; // output string
+ int length = XMLString::stringLen(input); // string length
+ // use +1 to make room for the '\0' at the end of the string
+ // in the pathological case when each character of the string
+ // is UTF8_MAXLEN bytes long
+ XMLByte* res = new XMLByte[(length * UTF8_MAXLEN) + 1]; // output string
+
unsigned int total_chars =
UTF8_TRANSCODER->transcodeTo((const XMLCh*) input,
(unsigned int) length,
(XMLByte*) res,
- (unsigned int) (length*UTF8_MAXLEN)+1,
+ (unsigned int) (length*UTF8_MAXLEN),
charsEaten,
XMLTranscoder::UnRep_Throw
);
@@ -203,7 +207,7 @@
}
XMLException*
-copyXMLException(XMLException& e)
+copyXMLException(const XMLException& e)
{
if(e.getType() ==
XERCES_CPP_NAMESPACE::XMLUni::fgArrayIndexOutOfBoundsException_Name)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]