DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6122>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6122

DOMString::transcode() maybe have something wrong,





------- Additional Comments From [EMAIL PROTECTED]  2002-05-25 12:22 
-------
Linebreaks are accidentaly removed in my previous mail,
so I retry.

If the first size estimates fails(in char* DOMString::transcode()), 
retP should be capped at charsNeeded2, not charsNeeded
, as the size of buffer retP is increased to charsNeeded2.


*** DOMString.cpp.orig  Sat May 25 06:57:51 2002
--- DOMString.cpp       Sat May 25 06:46:55 2002
***************
*** 1099,1110 ****
--- 1099,1112 ----
      //  we start with this estimate, and if overflow, then call calcRequiredSize for 
actual size
      const unsigned int charsNeeded = fHandle->fLength;
      char* retP = new char[charsNeeded + 1];
+     retP[charsNeeded] = 0;
  
      if (!getDomConverter()->transcode(srcP, retP, charsNeeded))
      {
          delete [] retP;
          const unsigned int charsNeeded2 = getDomConverter()->calcRequiredSize(srcP);
          retP = new char[charsNeeded2 + 1];
+         retP[charsNeeded2] = 0;
          if (!getDomConverter()->transcode(srcP, retP, charsNeeded2))
          {
              // <TBD> We should throw something here?
***************
*** 1112,1119 ****
      }
      delete [] allocatedBuf;   // which will be null if we didn't allocate one.
  
-     // Cap it off and return it
-     retP[charsNeeded] = 0;
      return retP;
  }
  
--- 1114,1119 ----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to