jdonohue    00/03/22 12:15:00

  Modified:    c/src/PlatformSupport DOMStringHelper.hpp
  Log:
  Workaround for problem with substring when starting index is 0
  
  Revision  Changes    Path
  1.11      +16 -0     xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp
  
  Index: DOMStringHelper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DOMStringHelper.hpp       2000/03/08 20:59:35     1.10
  +++ DOMStringHelper.hpp       2000/03/22 20:14:59     1.11
  @@ -506,6 +506,22 @@
                                                                                
                        theEndIndex - theStartIndex;
                assert(theStartIndex + theLength <= theStringLength);
   
  +             // @@ JMD:
  +             // If this is the case, the DOMString class doesn't create a 
new string,
  +             // and in any case, does not null terminate the string, just 
points to
  +             // the beginning, so we have to manually extract 'theLength' 
characters
  +             // and create a new buffer
  +             if (0 == theStartIndex)
  +             {
  +                     const XMLCh *ptr = theString.rawBuffer();
  +                     XMLCh *newStr = new XMLCh[theLength+1];
  +                     for (size_t u = 0; u < theLength; u++)
  +                             newStr[u] = ptr[u];
  +                     newStr[u] = 0;
  +                     DOMString domStr = newStr;
  +                     delete []newStr;
  +                     return domStr;
  +             }
                return theString.substringData(theStartIndex, theLength);
        }
   }
  
  
  

Reply via email to