Author: scantor
Date: Sat Feb 28 02:26:43 2015
New Revision: 1662888

URL: http://svn.apache.org/r1662888
Log:
XERCESC-1978

Modified:
    xerces/c/branches/xerces-3.1/src/xercesc/dom/impl/DOMDocumentImpl.hpp

Modified: xerces/c/branches/xerces-3.1/src/xercesc/dom/impl/DOMDocumentImpl.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/branches/xerces-3.1/src/xercesc/dom/impl/DOMDocumentImpl.hpp?rev=1662888&r1=1662887&r2=1662888&view=diff
==============================================================================
--- xerces/c/branches/xerces-3.1/src/xercesc/dom/impl/DOMDocumentImpl.hpp 
(original)
+++ xerces/c/branches/xerces-3.1/src/xercesc/dom/impl/DOMDocumentImpl.hpp Sat 
Feb 28 02:26:43 2015
@@ -380,7 +380,8 @@ inline const XMLCh*  DOMDocumentImpl::ge
   // declared in the struct, so we don't need to add one again to
   // account for the trailing null.
   //
-  XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + 
XMLString::stringLen(in)*sizeof(XMLCh);
+  XMLSize_t n = XMLString::stringLen(in);
+  XMLSize_t sizeToAllocate = sizeof(DOMStringPoolEntry) + n*sizeof(XMLCh);
   *pspe = spe = (DOMStringPoolEntry *)allocate(sizeToAllocate);
   spe->fNext = 0;
   XMLString::copyString((XMLCh*)spe->fString, in);
@@ -388,8 +389,7 @@ inline const XMLCh*  DOMDocumentImpl::ge
   return spe->fString;
 }
 
-inline const XMLCh* DOMDocumentImpl::
-getPooledNString(const XMLCh *in, XMLSize_t n)
+inline const XMLCh* DOMDocumentImpl::getPooledNString(const XMLCh *in, 
XMLSize_t n)
 {
   if (in == 0)
     return 0;
@@ -401,7 +401,7 @@ getPooledNString(const XMLCh *in, XMLSiz
   pspe = &fNameTable[inHash];
   while (*pspe != 0)
   {
-    if (XMLString::equalsN((*pspe)->fString, in, n))
+    if (XMLString::stringLen((*pspe)->fString) == n && 
XMLString::equalsN((*pspe)->fString, in, n))
       return (*pspe)->fString;
     pspe = &((*pspe)->fNext);
   }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org

Reply via email to