amassari 2005/03/08 01:04:09 Modified: c/src/xercesc/util XMLString.cpp XMLString.hpp Log: Improve performances of XMLString::tokenizeString (jira# 1363) - patch by Christian Will Revision Changes Path 1.43 +10 -4 xml-xerces/c/src/xercesc/util/XMLString.cpp Index: XMLString.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- XMLString.cpp 2 Feb 2005 09:29:48 -0000 1.42 +++ XMLString.cpp 8 Mar 2005 09:04:09 -0000 1.43 @@ -1414,9 +1414,16 @@ XMLPlatformUtils::fgTransService->lowerCase(toLowerCase); } +void XMLString::subString(XMLCh* const targetStr, const XMLCh* const srcStr + , const int startIndex, const int endIndex + , MemoryManager* const manager) +{ + subString(targetStr, srcStr, startIndex, endIndex, stringLen(srcStr), manager); +} void XMLString::subString(XMLCh* const targetStr, const XMLCh* const srcStr , const int startIndex, const int endIndex + , const int srcStrLength , MemoryManager* const manager) { //if (startIndex < 0 || endIndex < 0) @@ -1425,11 +1432,10 @@ if (targetStr == 0) ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_ZeroSizedTargetBuf, manager); - const int srcLen = stringLen(srcStr); const int copySize = endIndex - startIndex; // Make sure the start index is within the XMLString bounds - if ( startIndex < 0 || startIndex > endIndex || endIndex > srcLen) + if ( startIndex < 0 || startIndex > endIndex || endIndex > srcStrLength) ThrowXMLwithMemMgr(ArrayIndexOutOfBoundsException, XMLExcepts::Str_StartIndexPastEnd, manager); for (int i= startIndex; i < endIndex; i++) { @@ -1479,7 +1485,7 @@ (skip+1-index) * sizeof(XMLCh) );//new XMLCh[skip+1-index]; - XMLString::subString(token, tokenizeStr, index, skip, manager); + XMLString::subString(token, tokenizeStr, index, skip, len, manager); tokenStack->addElement(token); index = skip; } 1.32 +25 -2 xml-xerces/c/src/xercesc/util/XMLString.hpp Index: XMLString.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.hpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- XMLString.hpp 21 Dec 2004 16:02:51 -0000 1.31 +++ XMLString.hpp 8 Mar 2005 09:04:09 -0000 1.32 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.32 2005/03/08 09:04:09 amassari + * Improve performances of XMLString::tokenizeString (jira# 1363) - patch by Christian Will + * * Revision 1.31 2004/12/21 16:02:51 cargilld * Attempt to fix various apidoc problems. * @@ -805,7 +808,7 @@ /** @name Substring function */ //@{ - /** Create a substring of a givend string. The substring begins at the + /** Create a substring of a given string. The substring begins at the * specified beginIndex and extends to the character at index * endIndex - 1. * @param targetStr The string to copy the chars to @@ -823,13 +826,32 @@ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); - /** Create a substring of a givend string. The substring begins at the + /** Create a substring of a given string. The substring begins at the + * specified beginIndex and extends to the character at index + * endIndex - 1. + * @param targetStr The string to copy the chars to + * @param srcStr The string to copy the chars from + * @param startIndex beginning index, inclusive. + * @param endIndex the ending index, exclusive. + * @param manager The MemoryManager to use to allocate objects + */ + static void subString + ( + XMLCh* const targetStr + , const XMLCh* const srcStr + , const int startIndex + , const int endIndex + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); + + /** Create a substring of a given string. The substring begins at the * specified beginIndex and extends to the character at index * endIndex - 1. * @param targetStr The string to copy the chars to * @param srcStr The string to copy the chars from * @param startIndex beginning index, inclusive. * @param endIndex the ending index, exclusive. + * @param srcStrLength the length of srcStr * @param manager The MemoryManager to use to allocate objects */ static void subString @@ -838,6 +860,7 @@ , const XMLCh* const srcStr , const int startIndex , const int endIndex + , const int srcStrLength , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager );
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]