Author: amassari
Date: Wed Jan 4 09:54:56 2012
New Revision: 1227093
URL: http://svn.apache.org/viewvc?rev=1227093&view=rev
Log:
Avoid scanning the string twice (XERCESC-1854)
Modified:
xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp?rev=1227093&r1=1227092&r2=1227093&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMLSSerializerImpl.cpp Wed Jan 4
09:54:56 2012
@@ -1742,10 +1742,15 @@ bool DOMLSSerializerImpl::isNamespaceBin
void DOMLSSerializerImpl::ensureValidString(const DOMNode* nodeToWrite, const
XMLCh* string)
{
// XERCESC-1854: prevent illegal characters from being written
- XMLSize_t count=XMLString::stringLen(string);
- for(XMLSize_t i=0;i<count;i++)
- if((fIsXml11 && !XMLChar1_1::isXMLChar(string[i])) || (!fIsXml11 &&
!XMLChar1_0::isXMLChar(string[i])))
+ if(string==0)
+ return;
+ const XMLCh* cursor=string;
+ while(*cursor!=0)
+ {
+ if((fIsXml11 && !XMLChar1_1::isXMLChar(*cursor)) || (!fIsXml11 &&
!XMLChar1_0::isXMLChar(*cursor)))
reportError(nodeToWrite, DOMError::DOM_SEVERITY_FATAL_ERROR,
XMLDOMMsg::INVALID_CHARACTER_ERR);
+ cursor++;
+ }
}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]