You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2002/10/16 19:13:04 UTC

cvs commit: xml-xerces/c/src/xercesc/framework XMLFormatter.cpp

knoaman     2002/10/16 10:13:03

  Modified:    c/src/xercesc/framework XMLFormatter.cpp
  Log:
  [Bug 13695] Performance problem with large text nodes and XMLFormatter.cpp
  
  Revision  Changes    Path
  1.3       +36 -31    xml-xerces/c/src/xercesc/framework/XMLFormatter.cpp
  
  Index: XMLFormatter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLFormatter.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLFormatter.cpp	9 Sep 2002 15:41:51 -0000	1.2
  +++ XMLFormatter.cpp	16 Oct 2002 17:13:03 -0000	1.3
  @@ -358,38 +358,43 @@
               //
               if (tmpPtr > srcPtr)
               {
  -                const unsigned int srcCount = tmpPtr - srcPtr;
  -                const unsigned srcChars = srcCount > kTmpBufSize ?
  -                                          kTmpBufSize : srcCount;
  +                unsigned int srcCount = tmpPtr - srcPtr;
   
  -                const unsigned int outBytes = fXCoder->transcodeTo
  -                (
  -                    srcPtr
  -                    , srcChars
  -                    , fTmpBuf
  -                    , kTmpBufSize
  -                    , charsEaten
  -                    , unRepOpts
  -                );
  +                while (srcCount) {
   
  -                #if defined(XML_DEBUG)
  -                if ((outBytes > kTmpBufSize)
  -                ||  (charsEaten > srcCount))
  -                {
  -                    // <TBD> The transcoder is freakin out maaaannn
  -                }
  -                #endif
  +                    const unsigned srcChars = srcCount > kTmpBufSize ?
  +                                              kTmpBufSize : srcCount;
  +                
  +                    const unsigned int outBytes = fXCoder->transcodeTo
  +                    (
  +                        srcPtr
  +                        , srcChars
  +                        , fTmpBuf
  +                        , kTmpBufSize
  +                        , charsEaten
  +                        , unRepOpts
  +                    );
   
  -                // If we get any bytes out, then write them
  -                if (outBytes)
  -                {
  -                    fTmpBuf[outBytes] = 0; fTmpBuf[outBytes + 1] = 0;
  -                    fTmpBuf[outBytes + 2] = 0; fTmpBuf[outBytes + 3] = 0;
  -                    fTarget->writeChars(fTmpBuf, outBytes, this);
  -                }
  +                    #if defined(XML_DEBUG)
  +                    if ((outBytes > kTmpBufSize)
  +                    ||  (charsEaten > srcCount))
  +                    {
  +                        // <TBD> The transcoder is freakin out maaaannn
  +                    }
  +                    #endif
   
  -                // And bump up our pointer
  -                srcPtr += charsEaten;
  +                    // If we get any bytes out, then write them
  +                    if (outBytes)
  +                    {
  +                        fTmpBuf[outBytes] = 0; fTmpBuf[outBytes + 1] = 0;
  +                        fTmpBuf[outBytes + 2] = 0; fTmpBuf[outBytes + 3] = 0;
  +                        fTarget->writeChars(fTmpBuf, outBytes, this);
  +                    }
  +
  +                    // And bump up our pointer
  +                    srcPtr += charsEaten;
  +                    srcCount -= srcChars;
  +                }
               }
                else if (tmpPtr < endPtr)
               {
  
  
  

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