diff --git a/src/xercesc/dom/impl/DOMAttrNSImpl.cpp b/src/xercesc/dom/impl/DOMAttrNSImpl.cpp index 3340692794c1ca95aedc773851bf41a9e1d3d832..1e93a266f849adde059981ab1714b00ce1c00e03 100644 --- a/src/xercesc/dom/impl/DOMAttrNSImpl.cpp +++ b/src/xercesc/dom/impl/DOMAttrNSImpl.cpp @@ -155,7 +155,7 @@ void DOMAttrNSImpl::setPrefix(const XMLCh *prefix) XMLCh* newName; XMLCh temp[4000]; if (newQualifiedNameLen >= 3999) - newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newName = (XMLCh*) ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->allocate ( newQualifiedNameLen * sizeof(XMLCh) );//new XMLCh[newQualifiedNameLen]; @@ -171,7 +171,7 @@ void DOMAttrNSImpl::setPrefix(const XMLCh *prefix) getPooledString(newName); if (newQualifiedNameLen >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName; + ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->deallocate(newName);//delete[] newName; } @@ -231,7 +231,7 @@ void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedNam XMLCh* newName; XMLCh temp[4000]; if (index >= 3999) - newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newName = (XMLCh*) ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->allocate ( (XMLString::stringLen(qualifiedName) + 1) * sizeof(XMLCh) );//new XMLCh[XMLString::stringLen(qualifiedName)+1]; @@ -244,7 +244,7 @@ void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedNam this -> fLocalName = ownerDoc->getPooledString(fName+index+1); if (index >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName; + ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->deallocate(newName);//delete[] newName; // Before we carry on, we should check if the prefix or localName are valid XMLName if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName)) diff --git a/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp b/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp index 987fddf4a307ca8f25a8bf16740837f6af05e2ed..f6ac1342b6de4ecbfd43639d04b1ce3efff726b7 100644 --- a/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp +++ b/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp @@ -314,7 +314,7 @@ const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t XMLCh* newString; XMLCh temp[4000]; if (len >= 3999) - newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newString = (XMLCh*) ((DOMDocumentImpl *)node->getOwnerDocument())->getMemoryManager()->allocate ( (len + 1) * sizeof(XMLCh) );//new XMLCh[len+1]; @@ -327,7 +327,7 @@ const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t const XMLCh* retString = ((DOMDocumentImpl *)node->getOwnerDocument())->getPooledString(newString); if (len >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString; + ((DOMDocumentImpl *)node->getOwnerDocument())->getMemoryManager()->deallocate(newString);//delete[] newString; return retString; diff --git a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp index a89995cf5bc3a2fbffdc388b01a3fad81e001e32..32955ab433c9432c42fed10f42df678aeb36051f 100644 --- a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp +++ b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp @@ -60,6 +60,7 @@ #include <xercesc/util/XMLString.hpp> #include <xercesc/util/XMLUniDefs.hpp> #include <xercesc/dom/DOMException.hpp> +#include <xercesc/util/Janitor.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -119,8 +120,10 @@ const XMLCh DOMConfigurationImpl::fgSCHEMA_LOCATION[] = { chLatin_s, chLatin_c, const unsigned short DOMConfigurationImpl::fDEFAULT_VALUES = 0x2596; -DOMConfigurationImpl::DOMConfigurationImpl(): featureValues(fDEFAULT_VALUES), - fErrorHandler(0), fSchemaType(0), fSchemaLocation(0) { +DOMConfigurationImpl::DOMConfigurationImpl(MemoryManager* const manager): featureValues(fDEFAULT_VALUES), + fErrorHandler(0), fSchemaType(0), fSchemaLocation(0) +, fMemoryManager(manager) + { } DOMConfigurationImpl::~DOMConfigurationImpl() { @@ -128,7 +131,9 @@ DOMConfigurationImpl::~DOMConfigurationImpl() { void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) { - XMLCh* lowerCaseName = XMLString::replicate(name); + XMLCh* lowerCaseName = XMLString::replicate(name, fMemoryManager); + ArrayJanitor<XMLCh> janName(lowerCaseName, fMemoryManager); + XMLString::lowerCase(lowerCaseName); if(!canSetParameter(lowerCaseName, value)) { @@ -169,7 +174,10 @@ void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) { // -------------------------------------- const void* DOMConfigurationImpl::getParameter(const XMLCh* name) const { - XMLCh* lowerCaseName = XMLString::replicate(name); + + XMLCh* lowerCaseName = XMLString::replicate(name, fMemoryManager); + ArrayJanitor<XMLCh> janName(lowerCaseName, fMemoryManager); + XMLString::lowerCase(lowerCaseName); bool isBooleanParameter = true; @@ -218,7 +226,9 @@ bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, const void* value) // if value is null, return true if(value == 0) return true; - XMLCh* lowerCaseName = XMLString::replicate(name); + XMLCh* lowerCaseName = XMLString::replicate(name, fMemoryManager); + ArrayJanitor<XMLCh> janName(lowerCaseName, fMemoryManager); + XMLString::lowerCase(lowerCaseName); bool isBooleanParameter = true; @@ -294,7 +304,9 @@ bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, const void* value) // ------------------------------------------- DOMConfigurationImpl::DOMConfigurationFeature DOMConfigurationImpl::getFeatureFlag(const XMLCh* name) const { - XMLCh* lowerCaseName = XMLString::replicate(name); + XMLCh* lowerCaseName = XMLString::replicate(name, fMemoryManager); + ArrayJanitor<XMLCh> janName(lowerCaseName, fMemoryManager); + XMLString::lowerCase(lowerCaseName); if(XMLString::equals(lowerCaseName, fgCANONICAL_FORM)) { diff --git a/src/xercesc/dom/impl/DOMConfigurationImpl.hpp b/src/xercesc/dom/impl/DOMConfigurationImpl.hpp index 282c1f3feb2532836932c2afffd577d789733657..0d7625fffd8c91f8d62daf0b6402b87521cebc61 100644 --- a/src/xercesc/dom/impl/DOMConfigurationImpl.hpp +++ b/src/xercesc/dom/impl/DOMConfigurationImpl.hpp @@ -92,7 +92,7 @@ public: //----------------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------------- - DOMConfigurationImpl(); + DOMConfigurationImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); ~DOMConfigurationImpl(); enum DOMConfigurationFeature { @@ -196,6 +196,8 @@ private: static const bool fFalse; static const bool fTrue; + + MemoryManager* fMemoryManager; }; XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/dom/impl/DOMDocumentImpl.cpp b/src/xercesc/dom/impl/DOMDocumentImpl.cpp index c074f11c97fbdee5f0dd517e7c08cdbea42799f5..feecda8d5b6a53831d77eb9879e533edafb1038e 100644 --- a/src/xercesc/dom/impl/DOMDocumentImpl.cpp +++ b/src/xercesc/dom/impl/DOMDocumentImpl.cpp @@ -677,7 +677,7 @@ const XMLCh* DOMDocumentImpl::getBaseURI() const DOMRange* DOMDocumentImpl::createRange() { - DOMRangeImpl* range = new (this) DOMRangeImpl(this); + DOMRangeImpl* range = new (this) DOMRangeImpl(this, fMemoryManager); if (fRanges == 0L) { //fRanges = new (this) Ranges(1, false); @@ -1022,7 +1022,7 @@ void DOMDocumentImpl::normalizeDocument() { DOMConfiguration* DOMDocumentImpl::getDOMConfiguration() const { if(!fDOMConfiguration) - ((DOMDocumentImpl*)this)->fDOMConfiguration = new ((DOMDocumentImpl*)this) DOMConfigurationImpl(); + ((DOMDocumentImpl*)this)->fDOMConfiguration = new ((DOMDocumentImpl*)this) DOMConfigurationImpl(fMemoryManager); return fDOMConfiguration; } diff --git a/src/xercesc/dom/impl/DOMElementNSImpl.cpp b/src/xercesc/dom/impl/DOMElementNSImpl.cpp index 64a385f646637c51b9f7886d50cdc8cf29a57c20..2d68887d6567ef62200b3d55ac7af769a343a58a 100644 --- a/src/xercesc/dom/impl/DOMElementNSImpl.cpp +++ b/src/xercesc/dom/impl/DOMElementNSImpl.cpp @@ -184,7 +184,7 @@ void DOMElementNSImpl::setPrefix(const XMLCh *prefix) XMLCh *newName; XMLCh temp[4000]; if (newQualifiedNameLen >= 3999) - newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newName = (XMLCh*) ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->allocate ( newQualifiedNameLen * sizeof(XMLCh) );//new XMLCh[newQualifiedNameLen]; @@ -200,7 +200,7 @@ void DOMElementNSImpl::setPrefix(const XMLCh *prefix) getPooledString(newName); if (newQualifiedNameLen >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName; + ((DOMDocumentImpl *)this->getOwnerDocument())->getMemoryManager()->deallocate(newName);//delete[] newName; } @@ -245,7 +245,7 @@ void DOMElementNSImpl::setName(const XMLCh *namespaceURI, XMLCh* newName; XMLCh temp[4000]; if (index >= 3999) - newName = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newName = (XMLCh*) ownerDoc->getMemoryManager()->allocate ( (XMLString::stringLen(qualifiedName) + 1) * sizeof(XMLCh) );//new XMLCh[XMLString::stringLen(qualifiedName)+1]; @@ -258,7 +258,7 @@ void DOMElementNSImpl::setName(const XMLCh *namespaceURI, this -> fLocalName = ownerDoc->getPooledString(fName+index+1); if (index >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newName);//delete[] newName; + ownerDoc->getMemoryManager()->deallocate(newName);//delete[] newName; // Before we carry on, we should check if the prefix or localName are valid XMLName if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName)) diff --git a/src/xercesc/dom/impl/DOMRangeImpl.cpp b/src/xercesc/dom/impl/DOMRangeImpl.cpp index 34649037d817be5ac34f756684b67edb2ee94f7f..48d05ee5e5c45e9a5471528fba6285066d40b729 100644 --- a/src/xercesc/dom/impl/DOMRangeImpl.cpp +++ b/src/xercesc/dom/impl/DOMRangeImpl.cpp @@ -81,7 +81,7 @@ XERCES_CPP_NAMESPACE_BEGIN // C'tor and D'tor //--------------------- -DOMRangeImpl::DOMRangeImpl(DOMDocument* doc) +DOMRangeImpl::DOMRangeImpl(DOMDocument* doc, MemoryManager* const manager) : fDocument(doc), fStartContainer(doc), @@ -90,7 +90,8 @@ DOMRangeImpl::DOMRangeImpl(DOMDocument* doc) fEndOffset(0), fDetached(false), fCollapsed(true), - fRemoveChild(0) + fRemoveChild(0), + fMemoryManager(manager) { } @@ -873,7 +874,7 @@ const XMLCh* DOMRangeImpl::toString() const XMLCh* tempString; XMLCh temp[4000]; if ((fEndOffset-fStartOffset) >= 3999) - tempString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + tempString = (XMLCh*) fMemoryManager->allocate ( (fEndOffset - fStartOffset + 1) * sizeof(XMLCh) );//new XMLCh[fEndOffset-fStartOffset+1]; @@ -884,7 +885,7 @@ const XMLCh* DOMRangeImpl::toString() const const XMLCh* retString = ((DOMDocumentImpl *)fDocument)->getPooledString(tempString); if ((fEndOffset-fStartOffset) >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(tempString);//delete[] tempString; + fMemoryManager->deallocate(tempString);//delete[] tempString; return retString; } else { @@ -894,7 +895,7 @@ const XMLCh* DOMRangeImpl::toString() const XMLCh* tempString; XMLCh temp[4000]; if ((length - fStartOffset) >= 3999) - tempString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + tempString = (XMLCh*) fMemoryManager->allocate ( (length - fStartOffset + 1) * sizeof(XMLCh) );//new XMLCh[length - fStartOffset+1]; @@ -905,7 +906,7 @@ const XMLCh* DOMRangeImpl::toString() const retStringBuf.append(tempString); if ((length - fStartOffset) >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(tempString);//delete[] tempString; + fMemoryManager->deallocate(tempString);//delete[] tempString; } node = nextNode(node, true); @@ -963,7 +964,7 @@ const XMLCh* DOMRangeImpl::toString() const XMLCh* tempString; XMLCh temp[4000]; if (fEndOffset >= 3999) - tempString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + tempString = (XMLCh*) fMemoryManager->allocate ( (fEndOffset+1) * sizeof(XMLCh) );//new XMLCh[fEndOffset+1]; @@ -974,7 +975,7 @@ const XMLCh* DOMRangeImpl::toString() const retStringBuf.append(tempString); if (fEndOffset >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(tempString);//delete[] tempString; + fMemoryManager->deallocate(tempString);//delete[] tempString; } } return ((DOMDocumentImpl *)fDocument)->getPooledString(retStringBuf.getRawBuffer()); @@ -1293,7 +1294,7 @@ DOMDocumentFragment* DOMRangeImpl::traverseSameContainer( int how ) XMLCh* tempString; XMLCh temp[4000]; if (fEndOffset >= 3999) - tempString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + tempString = (XMLCh*) fMemoryManager->allocate ( (fEndOffset+1) * sizeof(XMLCh) );//new XMLCh[fEndOffset+1]; @@ -1304,7 +1305,7 @@ DOMDocumentFragment* DOMRangeImpl::traverseSameContainer( int how ) cloneCurrent->setNodeValue(((DOMDocumentImpl *)fDocument)->getPooledString(tempString)); if (fEndOffset >= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(tempString);//delete[] tempString; + fMemoryManager->deallocate(tempString);//delete[] tempString; } // set the original text node to its new value @@ -1700,8 +1701,8 @@ DOMNode* DOMRangeImpl::traversePartiallySelected( DOMNode*n, int how ) */ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) { - XMLCh* txtValue = XMLString::replicate(n->getNodeValue()); - ArrayJanitor<XMLCh> janValue(txtValue); + XMLCh* txtValue = XMLString::replicate(n->getNodeValue(), fMemoryManager); + ArrayJanitor<XMLCh> janValue(txtValue, fMemoryManager); if ( isLeft ) { @@ -1717,7 +1718,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) XMLCh oldTemp[4000]; if (offset >= 3999) { - oldNodeValue = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + oldNodeValue = (XMLCh*) fMemoryManager->allocate ( (offset+1) * sizeof(XMLCh) );//new XMLCh[offset+1]; @@ -1731,7 +1732,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) n->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(oldNodeValue) ); if (offset>= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; + fMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; } if ( how==DELETE_CONTENTS ) @@ -1747,7 +1748,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) XMLCh newTemp[4000]; if (offset >= 3999) { - newNodeValue = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newNodeValue = (XMLCh*) fMemoryManager->allocate ( (offset+1) * sizeof(XMLCh) );//new XMLCh[offset+1]; @@ -1759,7 +1760,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) newNode->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(newNodeValue) ); if (offset>= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; + fMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; } return newNode; @@ -1778,7 +1779,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) XMLCh oldTemp[4000]; if (offset >= 3999) { - oldNodeValue = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + oldNodeValue = (XMLCh*) fMemoryManager->allocate ( (offset+1) * sizeof(XMLCh) );//new XMLCh[offset+1]; @@ -1792,7 +1793,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) n->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(oldNodeValue) ); if (offset>= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; + fMemoryManager->deallocate(oldNodeValue);//delete[] oldNodeValue; } if ( how==DELETE_CONTENTS ) @@ -1808,7 +1809,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) XMLCh newTemp[4000]; if (offset >= 3999) { - newNodeValue = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate + newNodeValue = (XMLCh*) fMemoryManager->allocate ( (offset+1) * sizeof(XMLCh) );//new XMLCh[offset+1]; @@ -1820,7 +1821,7 @@ DOMNode* DOMRangeImpl::traverseTextNode( DOMNode*n, bool isLeft, int how ) newNode->setNodeValue( ((DOMDocumentImpl *)fDocument)->getPooledString(newNodeValue) ); if (offset>= 3999) - XMLPlatformUtils::fgMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; + fMemoryManager->deallocate(newNodeValue);//delete[] newNodeValue; } return newNode; diff --git a/src/xercesc/dom/impl/DOMRangeImpl.hpp b/src/xercesc/dom/impl/DOMRangeImpl.hpp index 3ac626ec16224e2c8798bb6dfb41af0b66909c50..e230a6d979bcfee36c889f595ca37f240ceec187 100644 --- a/src/xercesc/dom/impl/DOMRangeImpl.hpp +++ b/src/xercesc/dom/impl/DOMRangeImpl.hpp @@ -72,6 +72,7 @@ #include <xercesc/util/XercesDefs.hpp> #include <xercesc/dom/DOMRange.hpp> +#include <xercesc/util/PlatformUtils.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -81,6 +82,7 @@ class DOMNode; class DOMDocumentFragment; class DOMDocument; class DOMText; +class MemoryManager; class CDOM_EXPORT DOMRangeImpl: public DOMRange { private: @@ -107,10 +109,11 @@ private: bool fDetached; DOMNode* fRemoveChild; + MemoryManager* fMemoryManager; public: //c'tor - DOMRangeImpl(DOMDocument* doc); + DOMRangeImpl(DOMDocument* doc, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); DOMRangeImpl(const DOMRangeImpl& other); //d'tor diff --git a/src/xercesc/framework/LocalFileInputSource.cpp b/src/xercesc/framework/LocalFileInputSource.cpp index b3d0c30d4cd05e3d1bc03918dde5788a4d0b6c7b..845a5f5ebfa8805326a776665cf5ef8ee5328b71 100644 --- a/src/xercesc/framework/LocalFileInputSource.cpp +++ b/src/xercesc/framework/LocalFileInputSource.cpp @@ -129,7 +129,7 @@ LocalFileInputSource::LocalFileInputSource( const XMLCh* const basePath // with the base path. If not, just take the relative path as the // entire path. // - if (XMLPlatformUtils::isRelative(relativePath)) + if (XMLPlatformUtils::isRelative(relativePath, manager)) { XMLCh* tmpBuf = XMLPlatformUtils::weavePaths(basePath, relativePath, manager); setSystemId(tmpBuf); @@ -155,7 +155,7 @@ LocalFileInputSource::LocalFileInputSource(const XMLCh* const filePath, // working directory rules of the current platform. Else, just take // it as is. // - if (XMLPlatformUtils::isRelative(filePath)) + if (XMLPlatformUtils::isRelative(filePath, manager)) { XMLCh* curDir = XMLPlatformUtils::getCurrentDirectory(manager); diff --git a/src/xercesc/framework/XMLValidator.cpp b/src/xercesc/framework/XMLValidator.cpp index 687670c2b7551c916342a36e576b52e574ae71de..d0b533a09593ff02e56d356e33035a478d2cd15f 100644 --- a/src/xercesc/framework/XMLValidator.cpp +++ b/src/xercesc/framework/XMLValidator.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.6 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.5 2003/12/17 00:18:34 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -275,7 +278,7 @@ void XMLValidator::emitError(const XMLValid::Codes toEmit XMLCh errText[maxChars + 1]; // load the text - if (!getMsgLoader().loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4)) + if (!getMsgLoader().loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fScanner->getMemoryManager())) { // <TBD> Should probably load a default message here } diff --git a/src/xercesc/internal/XMLScanner.cpp b/src/xercesc/internal/XMLScanner.cpp index d36bd21e7f183e373c875ef1ce59f79787a89462..df4d3db431ac52580eee0ea9f08f69bd676538ea 100644 --- a/src/xercesc/internal/XMLScanner.cpp +++ b/src/xercesc/internal/XMLScanner.cpp @@ -841,7 +841,7 @@ void XMLScanner::emitError( const XMLErrs::Codes toEmit const unsigned int maxChars = 2047; XMLCh errText[maxChars + 1]; - if (!gScannerMsgLoader().loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4)) + if (!gScannerMsgLoader().loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, fMemoryManager)) { // <TBD> Should probably load a default message here } diff --git a/src/xercesc/internal/XProtoType.cpp b/src/xercesc/internal/XProtoType.cpp index 83b131a4567a6d11856f3caab3fcb7e273f7a8fc..1ac92940a989b1edb4dfacd82e1e5df3acc9dc7b 100644 --- a/src/xercesc/internal/XProtoType.cpp +++ b/src/xercesc/internal/XProtoType.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.3 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.2 2003/12/17 00:18:34 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -133,8 +136,8 @@ void XProtoType::load(XSerializeEngine& serEng //we don't have class name exceed this length in xerces XMLCh name1[256]; XMLCh name2[256]; - XMLString::transcode((char*)inName, name1, 255); - XMLString::transcode((char*)className, name2, 255); + XMLString::transcode((char*)inName, name1, 255, manager); + XMLString::transcode((char*)className, name2, 255, manager); ThrowXMLwithMemMgr2(XSerializationException , XMLExcepts::XSer_ProtoType_Name_Dif diff --git a/src/xercesc/parsers/DOMBuilderImpl.cpp b/src/xercesc/parsers/DOMBuilderImpl.cpp index 09d84e6d0d22d17c512a88c7f17bb4d43422e22f..c67bf7ba3fa8c3a64741fd441a827dce45261348 100644 --- a/src/xercesc/parsers/DOMBuilderImpl.cpp +++ b/src/xercesc/parsers/DOMBuilderImpl.cpp @@ -545,7 +545,7 @@ DOMBuilderImpl::resolveEntity(const XMLCh* const publicId, DOMInputSource* is = fEntityResolver->resolveEntity(publicId, systemId, baseURI); if (is) - return new Wrapper4DOMInputSource(is, true, getMemoryManager()); + return new (getMemoryManager()) Wrapper4DOMInputSource(is, true, getMemoryManager()); } return 0; @@ -563,7 +563,7 @@ DOMBuilderImpl::resolveEntity( XMLResourceIdentifier* resourceIdentifier ) resourceIdentifier->getSystemId(), resourceIdentifier->getBaseURI()); if (is) - return new Wrapper4DOMInputSource(is, true, getMemoryManager()); + return new (getMemoryManager()) Wrapper4DOMInputSource(is, true, getMemoryManager()); } if (fXMLEntityResolver) { return(fXMLEntityResolver->resolveEntity(resourceIdentifier)); diff --git a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp index 99b072e96a2d5ebd2007066374b5560ffce67259..91620b07e7ff89c7f8e8faa78411c9d5084497df 100644 --- a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp +++ b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.20 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.19 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -380,30 +383,31 @@ bool ICUMsgLoader::loadMsg( const XMLMsgLoader::XMLMsgId msgToLoad bool ICUMsgLoader::loadMsg( const XMLMsgLoader::XMLMsgId msgToLoad , XMLCh* const toFill - , const unsigned int maxChars + , const unsigned int maxChars , const XMLCh* const repText1 , const XMLCh* const repText2 , const XMLCh* const repText3 - , const XMLCh* const repText4) + , const XMLCh* const repText4 + , MemoryManager* const manager ) { // Call the other version to load up the message if (!loadMsg(msgToLoad, toFill, maxChars)) return false; // And do the token replacement - XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4); + XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4, manager); return true; } bool ICUMsgLoader::loadMsg( const XMLMsgLoader::XMLMsgId msgToLoad , XMLCh* const toFill - , const unsigned int maxChars + , const unsigned int maxChars , const char* const repText1 , const char* const repText2 , const char* const repText3 , const char* const repText4 - , MemoryManager * const manager) + , MemoryManager * const manager) { // // Transcode the provided parameters and call the other version, @@ -412,29 +416,28 @@ bool ICUMsgLoader::loadMsg( const XMLMsgLoader::XMLMsgId msgToLoad XMLCh* tmp1 = 0; XMLCh* tmp2 = 0; XMLCh* tmp3 = 0; - XMLCh* tmp4 = 0; - MemoryManager *managerToUse = (manager)?manager:XMLPlatformUtils::fgMemoryManager; + XMLCh* tmp4 = 0; bool bRet = false; if (repText1) - tmp1 = XMLString::transcode(repText1, managerToUse); + tmp1 = XMLString::transcode(repText1, manager); if (repText2) - tmp2 = XMLString::transcode(repText2, managerToUse); + tmp2 = XMLString::transcode(repText2, manager); if (repText3) - tmp3 = XMLString::transcode(repText3, managerToUse); + tmp3 = XMLString::transcode(repText3, manager); if (repText4) - tmp4 = XMLString::transcode(repText4, managerToUse); + tmp4 = XMLString::transcode(repText4, manager); - bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4); + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); if (tmp1) - managerToUse->deallocate(tmp1);//delete [] tmp1; + manager->deallocate(tmp1);//delete [] tmp1; if (tmp2) - managerToUse->deallocate(tmp2);//delete [] tmp2; + manager->deallocate(tmp2);//delete [] tmp2; if (tmp3) - managerToUse->deallocate(tmp3);//delete [] tmp3; + manager->deallocate(tmp3);//delete [] tmp3; if (tmp4) - managerToUse->deallocate(tmp4);//delete [] tmp4; + manager->deallocate(tmp4);//delete [] tmp4; return bRet; } diff --git a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp index 466eebd5db74337e4b33a9b9d801c2d4e5bcd97e..3d21d52d6404aca16e8b15f1fe90dce97583b46e 100644 --- a/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp +++ b/src/xercesc/util/MsgLoaders/ICU/ICUMsgLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.7 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -140,23 +143,24 @@ public : ( const XMLMsgLoader::XMLMsgId msgToLoad , XMLCh* const toFill - , const unsigned int maxChars + , const unsigned int maxChars , const XMLCh* const repText1 , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool loadMsg ( const XMLMsgLoader::XMLMsgId msgToLoad , XMLCh* const toFill - , const unsigned int maxChars + , const unsigned int maxChars , const char* const repText1 , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager * const manager = 0 + , MemoryManager * const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp b/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp index 5b9e6e5d452e75d430908e88397f149ce763a6cc..32345c5e23f17cf17dabdc11f05b20d90af3530f 100644 --- a/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp +++ b/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.10 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.9 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -206,14 +209,15 @@ bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const XMLCh* const repText1 , const XMLCh* const repText2 , const XMLCh* const repText3 - , const XMLCh* const repText4) + , const XMLCh* const repText4 + , MemoryManager* const manager) { // Call the other version to load up the message if (!loadMsg(msgToLoad, toFill, maxChars)) return false; // And do the token replacement - XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4); + XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4, manager); return true; } @@ -225,7 +229,7 @@ bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const char* const repText2 , const char* const repText3 , const char* const repText4 - , MemoryManager * const manager) + , MemoryManager * const manager) { // // Transcode the provided parameters and call the other version, @@ -235,28 +239,27 @@ bool InMemMsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad XMLCh* tmp2 = 0; XMLCh* tmp3 = 0; XMLCh* tmp4 = 0; - MemoryManager *managerToUse = (manager)?manager:XMLPlatformUtils::fgMemoryManager; - + bool bRet = false; if (repText1) - tmp1 = XMLString::transcode(repText1, managerToUse); + tmp1 = XMLString::transcode(repText1, manager); if (repText2) - tmp2 = XMLString::transcode(repText2, managerToUse); + tmp2 = XMLString::transcode(repText2, manager); if (repText3) - tmp3 = XMLString::transcode(repText3, managerToUse); + tmp3 = XMLString::transcode(repText3, manager); if (repText4) - tmp4 = XMLString::transcode(repText4, managerToUse); + tmp4 = XMLString::transcode(repText4, manager); - bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4); + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); if (tmp1) - managerToUse->deallocate(tmp1);//delete [] tmp1; + manager->deallocate(tmp1);//delete [] tmp1; if (tmp2) - managerToUse->deallocate(tmp2);//delete [] tmp2; + manager->deallocate(tmp2);//delete [] tmp2; if (tmp3) - managerToUse->deallocate(tmp3);//delete [] tmp3; + manager->deallocate(tmp3);//delete [] tmp3; if (tmp4) - managerToUse->deallocate(tmp4);//delete [] tmp4; + manager->deallocate(tmp4);//delete [] tmp4; return bRet; } diff --git a/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp b/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp index 01496fd55b9ab057236c8490d6a6bb90f22714b5..081aa4fdf3a1ef7f55c924e10657ff43ae1d69e7 100644 --- a/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp +++ b/src/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.4 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -132,6 +135,7 @@ public : , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool loadMsg @@ -143,7 +147,7 @@ public : , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager * const manager = 0 + , MemoryManager * const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp b/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp index 22ac3a818ffe53a6ec6c15f770f1af2bb003820a..09f32ba1b8190d44952f11c4ffbdb9dac2209bbd 100644 --- a/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp +++ b/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.17 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.16 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -267,14 +270,15 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const XMLCh* const repText1 , const XMLCh* const repText2 , const XMLCh* const repText3 - , const XMLCh* const repText4) + , const XMLCh* const repText4 + , MemoryManager* const manager) { // Call the other version to load up the message if (!loadMsg(msgToLoad, toFill, maxChars)) return false; // And do the token replacement - XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4); + XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4, manager); return true; } @@ -286,7 +290,7 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const char* const repText2 , const char* const repText3 , const char* const repText4 - , MemoryManager * const manager) + , MemoryManager * const manager) { // // Transcode the provided parameters and call the other version, @@ -295,29 +299,28 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad XMLCh* tmp1 = 0; XMLCh* tmp2 = 0; XMLCh* tmp3 = 0; - XMLCh* tmp4 = 0; - MemoryManager *managerOoUse = (manager)?manager:XMLPlatformUtils::fgMemoryManager; + XMLCh* tmp4 = 0; bool bRet = false; if (repText1) - tmp1 = XMLString::transcode(repText1, managerToUse); + tmp1 = XMLString::transcode(repText1, manager); if (repText2) - tmp2 = XMLString::transcode(repText2, managerToUse); + tmp2 = XMLString::transcode(repText2, manager); if (repText3) - tmp3 = XMLString::transcode(repText3, managerToUse); + tmp3 = XMLString::transcode(repText3, manager); if (repText4) - tmp4 = XMLString::transcode(repText4, managerToUse); + tmp4 = XMLString::transcode(repText4, manager); - bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4); + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); if (tmp1) - managerToUse->deallocate(tmp1);//delete [] tmp1; + manager->deallocate(tmp1);//delete [] tmp1; if (tmp2) - managerToUse->deallocate(tmp2);//delete [] tmp2; + manager->deallocate(tmp2);//delete [] tmp2; if (tmp3) - managerToUse->deallocate(tmp3);//delete [] tmp3; + manager->deallocate(tmp3);//delete [] tmp3; if (tmp4) - managerToUse->deallocate(tmp4);//delete [] tmp4; + manager->deallocate(tmp4);//delete [] tmp4; return bRet; } diff --git a/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp b/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp index 65ad7f4e8dc3d7759054d7e6f50b4adcfd77b9fa..28ceb6a0b98d44e4cc9339a28e7a97cf4a0aa56e 100644 --- a/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp +++ b/src/xercesc/util/MsgLoaders/MsgCatalog/MsgCatalogLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.6 2003/12/17 03:56:15 neilg * add default memory manager parameter to loadMsg method that uses char * parameters * @@ -132,6 +135,7 @@ public : , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool loadMsg @@ -143,7 +147,7 @@ public : , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager * const manager = 0 + , MemoryManager * const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.cpp b/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.cpp index 6c0b4875401820773e796239f0b96cea6dbe17cc..305f3956d2a74ca590855b45c7a7b1355f5048a9 100644 --- a/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.cpp +++ b/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.cpp @@ -226,13 +226,13 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad - , XMLCh* const toFill - , const unsigned int maxChars - , const char* const repText1 - , const char* const repText2 - , const char* const repText3 - , const char* const repText4 - , MemoryManager * const manager) + , XMLCh* const toFill + , const unsigned int maxChars + , const char* const repText1 + , const char* const repText2 + , const char* const repText3 + , const char* const repText4 + , MemoryManager * const manager) { char * msgId; int size=0; @@ -256,18 +256,18 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad if (!localMsg(msgId, toFill, maxChars, repTexts, size)) return false; - return true; } bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad - , XMLCh* const toFill - , const unsigned int maxChars - , const XMLCh* const repText1 - , const XMLCh* const repText2 - , const XMLCh* const repText3 - , const XMLCh* const repText4) + , XMLCh* const toFill + , const unsigned int maxChars + , const XMLCh* const repText1 + , const XMLCh* const repText2 + , const XMLCh* const repText3 + , const XMLCh* const repText4 + , MemoryManager* const manager) { // // Transcode the provided parameters and call the other version, @@ -280,24 +280,24 @@ bool MsgCatalogLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad bool bRet = false; if (repText1) - tmp1 = XMLString::transcode(repText1, XMLPlatformUtils::fgMemoryManager); + tmp1 = XMLString::transcode(repText1, manager); if (repText2) - tmp2 = XMLString::transcode(repText2, XMLPlatformUtils::fgMemoryManager); + tmp2 = XMLString::transcode(repText2, manager); if (repText3) - tmp3 = XMLString::transcode(repText3, XMLPlatformUtils::fgMemoryManager); + tmp3 = XMLString::transcode(repText3, manager); if (repText4) - tmp4 = XMLString::transcode(repText4, XMLPlatformUtils::fgMemoryManager); + tmp4 = XMLString::transcode(repText4, manager); - bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4); + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); if (tmp1) - XMLPlatformUtils::fgMemoryManager->deallocate(tmp1);//delete [] tmp1; + manager->deallocate(tmp1);//delete [] tmp1; if (tmp2) - XMLPlatformUtils::fgMemoryManager->deallocate(tmp2);//delete [] tmp2; + manager->deallocate(tmp2);//delete [] tmp2; if (tmp3) - XMLPlatformUtils::fgMemoryManager->deallocate(tmp3);//delete [] tmp3; + manager->deallocate(tmp3);//delete [] tmp3; if (tmp4) - XMLPlatformUtils::fgMemoryManager->deallocate(tmp4);//delete [] tmp4; + manager->deallocate(tmp4);//delete [] tmp4; return bRet; } diff --git a/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.hpp b/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.hpp index c6d7964f64b9a2f816b0bdb249d8bdc595c93677..b84267ba36068be797aa019469ef11acd714025c 100644 --- a/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.hpp +++ b/src/xercesc/util/MsgLoaders/MsgFile/MsgLoader.hpp @@ -100,6 +100,7 @@ public : , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool loadMsg @@ -111,7 +112,7 @@ public : , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager * const manager = 0 + , MemoryManager * const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp b/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp index 232dab2d6b817fc87f35f74cd9ce61568c4967d3..b202d57a1ac88d5a79263ac316032a44ad25c6b4 100644 --- a/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp +++ b/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp @@ -225,14 +225,15 @@ bool Win32MsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const XMLCh* const repText1 , const XMLCh* const repText2 , const XMLCh* const repText3 - , const XMLCh* const repText4) + , const XMLCh* const repText4 + , MemoryManager* const manager) { // Call the other version to load up the message if (!loadMsg(msgToLoad, toFill, maxChars)) return false; // And do the token replacement - XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4); + XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3, repText4, manager); return true; } @@ -246,7 +247,6 @@ bool Win32MsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad , const char* const repText4 , MemoryManager* const manager) { - MemoryManager* toUse = manager ? manager : XMLPlatformUtils::fgMemoryManager; // // Transcode the provided parameters and call the other version, // which will do the replacement work. @@ -258,24 +258,24 @@ bool Win32MsgLoader::loadMsg(const XMLMsgLoader::XMLMsgId msgToLoad bool bRet = false; if (repText1) - tmp1 = XMLString::transcode(repText1, toUse); + tmp1 = XMLString::transcode(repText1, manager); if (repText2) - tmp2 = XMLString::transcode(repText2, toUse); + tmp2 = XMLString::transcode(repText2, manager); if (repText3) - tmp3 = XMLString::transcode(repText3, toUse); + tmp3 = XMLString::transcode(repText3, manager); if (repText4) - tmp4 = XMLString::transcode(repText4, toUse); + tmp4 = XMLString::transcode(repText4, manager); - bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4); + bRet = loadMsg(msgToLoad, toFill, maxChars, tmp1, tmp2, tmp3, tmp4, manager); if (tmp1) - toUse->deallocate(tmp1);//delete [] tmp1; + manager->deallocate(tmp1);//delete [] tmp1; if (tmp2) - toUse->deallocate(tmp2);//delete [] tmp2; + manager->deallocate(tmp2);//delete [] tmp2; if (tmp3) - toUse->deallocate(tmp3);//delete [] tmp3; + manager->deallocate(tmp3);//delete [] tmp3; if (tmp4) - toUse->deallocate(tmp4);//delete [] tmp4; + manager->deallocate(tmp4);//delete [] tmp4; return bRet; } diff --git a/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.hpp b/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.hpp index 5ed069912b16e9a41a2990cad50c67f1b2a58c76..6dca8010d6fd764a26949bd3599d3c3f993f7cbc 100644 --- a/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.hpp +++ b/src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.4 2003/12/17 00:18:37 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -129,6 +132,7 @@ public : , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manger = XMLPlatformUtils::fgMemoryManager ); virtual bool loadMsg @@ -140,7 +144,7 @@ public : , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager* const manager = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp b/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp index e9b487020f1e54e04c4b85a4b7ce8b7d9c13b085..1cd9e77e78c6efb3f4da43df20e55dde8ddc5e82 100644 --- a/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp +++ b/src/xercesc/util/NetAccessors/Socket/SocketNetAccessor.cpp @@ -106,7 +106,7 @@ BinInputStream* SocketNetAccessor::makeNew(const XMLURL& urlSource) // unsupported protocol exception for the others. // default : - ThrowXML(MalformedURLException, XMLExcepts::URL_UnsupportedProto); + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_UnsupportedProto, urlSource.getMemoryManager()); break; } return 0; diff --git a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp index ae0768e8c72ef746f7890654cd7017f91f539f64..c7681da9d3faffcb894ed57ee398a78590fe6df2 100644 --- a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp +++ b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.13 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.12 2003/05/17 05:54:18 knoaman * Update NetAccessors to use the memory manager. * @@ -217,15 +220,15 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) const XMLCh* path = urlSource.getPath(); const XMLCh* fragment = urlSource.getFragment(); const XMLCh* query = urlSource.getQuery(); - MemoryManager* manager = urlSource.getMemoryManager(); + fMemoryManager = urlSource.getMemoryManager(); // // Convert the hostName to the platform's code page for gethostbyname and // inet_addr functions. // - char* hostNameAsCharStar = XMLString::transcode(hostName, manager); - ArrayJanitor<char> janBuf1(hostNameAsCharStar, manager); + char* hostNameAsCharStar = XMLString::transcode(hostName, fMemoryManager); + ArrayJanitor<char> janBuf1(hostNameAsCharStar, fMemoryManager); // // Convert all the parts of the urlSource object to ASCII so they can be @@ -233,41 +236,41 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) // transSize = XMLString::stringLen(hostName)+1; - char* hostNameAsASCII = (char*) manager->allocate + char* hostNameAsASCII = (char*) fMemoryManager->allocate ( (transSize+1) * sizeof(char) );//new char[transSize+1]; - ArrayJanitor<char> janBuf2(hostNameAsASCII, manager); + ArrayJanitor<char> janBuf2(hostNameAsASCII, fMemoryManager); - XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor("ISO8859-1", failReason, blockSize, manager); + XMLTranscoder* trans = XMLPlatformUtils::fgTransService->makeNewTranscoderFor("ISO8859-1", failReason, blockSize, fMemoryManager); trans->transcodeTo(hostName, transSize, (unsigned char *) hostNameAsASCII, transSize, charsEaten, XMLTranscoder::UnRep_Throw); transSize = XMLString::stringLen(path)+1; - char* pathAsASCII = (char*) manager->allocate + char* pathAsASCII = (char*) fMemoryManager->allocate ( (transSize+1) * sizeof(char) );//new char[transSize+1]; - ArrayJanitor<char> janBuf3(pathAsASCII, manager); + ArrayJanitor<char> janBuf3(pathAsASCII, fMemoryManager); trans->transcodeTo(path, transSize, (unsigned char *) pathAsASCII, transSize, charsEaten, XMLTranscoder::UnRep_Throw); char* fragmentAsASCII = 0; if (fragment) { transSize = XMLString::stringLen(fragment)+1; - fragmentAsASCII = (char*) manager->allocate + fragmentAsASCII = (char*) fMemoryManager->allocate ( (transSize+1) * sizeof(char) );//new char[transSize+1]; - ArrayJanitor<char> janBuf4(fragmentAsASCII, manager); + ArrayJanitor<char> janBuf4(fragmentAsASCII, fMemoryManager); trans->transcodeTo(fragment, transSize, (unsigned char *) fragmentAsASCII, transSize, charsEaten, XMLTranscoder::UnRep_Throw); } char* queryAsASCII = 0; - ArrayJanitor<char> janBuf5(queryAsASCII, manager); + ArrayJanitor<char> janBuf5(queryAsASCII, fMemoryManager); if (query) { transSize = XMLString::stringLen(query)+1; - queryAsASCII = (char*) manager->allocate + queryAsASCII = (char*) fMemoryManager->allocate ( (transSize+1) * sizeof(char) );//new char[transSize+1]; @@ -282,7 +285,7 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) XMLString::binToText((unsigned int) portNumber, portBuffer, bufSize, 10); transSize = XMLString::stringLen(portBuffer)+1; - char* portAsASCII = (char*) manager->allocate + char* portAsASCII = (char*) fMemoryManager->allocate ( (transSize+1) * sizeof(char) );//new char[transSize+1]; @@ -302,15 +305,15 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) unsigned long numAddress = inet_addr(hostNameAsCharStar); if (numAddress < 0) { - ThrowXML1(NetAccessorException, - XMLExcepts::NetAcc_TargetResolution, hostName); + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_TargetResolution, hostName, fMemoryManager); } if ((hostEntPtr = gethostbyaddr((char *) &numAddress, sizeof(unsigned long), AF_INET)) == NULL) { - ThrowXML1(NetAccessorException, - XMLExcepts::NetAcc_TargetResolution, hostName); + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_TargetResolution, hostName, fMemoryManager); } } @@ -323,14 +326,14 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) int s = socket(hostEntPtr->h_addrtype, SOCK_STREAM, 0); if (s < 0) { - ThrowXML1(NetAccessorException, - XMLExcepts::NetAcc_CreateSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_CreateSocket, urlSource.getURLText(), fMemoryManager); } if (connect(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) { - ThrowXML1(NetAccessorException, - XMLExcepts::NetAcc_ConnSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_ConnSocket, urlSource.getURLText(), fMemoryManager); } // The port is open and ready to go. @@ -369,8 +372,8 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) if ((aLent = write(s, (void *) fBuffer, lent)) != lent) { - ThrowXML1(NetAccessorException, - XMLExcepts::NetAcc_WriteSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, + XMLExcepts::NetAcc_WriteSocket, urlSource.getURLText(), fMemoryManager); } // @@ -379,7 +382,7 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) aLent = read(s, (void *)fBuffer, sizeof(fBuffer)-1); if (aLent <= 0) { - ThrowXML1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText(), fMemoryManager); } fBufferEnd = fBuffer+aLent; @@ -412,13 +415,13 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) char *p = strstr(fBuffer, HTTP); if (p == 0) { - ThrowXML1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText(), fMemoryManager); } p = strchr(p, chSpace); if (p == 0) { - ThrowXML1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, urlSource.getURLText(), fMemoryManager); } if (memcmp(p, resp200, strlen(resp200))) @@ -426,7 +429,7 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource) // Most likely a 404 Not Found error. // Should recognize and handle the forwarding responses. // - ThrowXML1(NetAccessorException, XMLExcepts::File_CouldNotOpenFile, urlSource.getURLText()); + ThrowXMLwithMemMgr1(NetAccessorException, XMLExcepts::File_CouldNotOpenFile, urlSource.getURLText(), fMemoryManager); } fSocket = s; @@ -462,7 +465,7 @@ unsigned int UnixHTTPURLInputStream::readBytes(XMLByte* const toFill len = read(fSocket, (void *) toFill, maxToRead); if (len == -1) { - ThrowXML(NetAccessorException, XMLExcepts::NetAcc_ReadSocket); + ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_ReadSocket, fMemoryManager); } } diff --git a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp index 299535e19d8386de0d822480fae997d8d0043955..532b704b5d6cfc747f0365f701ecfc686b144ef6 100644 --- a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp +++ b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.4 2002/12/09 13:12:12 tng * Fix compilation error. * @@ -140,7 +143,7 @@ private : char fBuffer[4000]; char * fBufferEnd; char * fBufferPos; - + MemoryManager* fMemoryManager; }; // UnixHTTPURLInputStream diff --git a/src/xercesc/util/NetAccessors/libWWW/BinURLInputStream.cpp b/src/xercesc/util/NetAccessors/libWWW/BinURLInputStream.cpp index 7087dedf29cde4b3d0f78d5d3c998489599a8bf2..8228b23970347897205670d7080e4cfdb8d17e4e 100644 --- a/src/xercesc/util/NetAccessors/libWWW/BinURLInputStream.cpp +++ b/src/xercesc/util/NetAccessors/libWWW/BinURLInputStream.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.5 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.4 2003/05/17 05:54:18 knoaman * Update NetAccessors to use the memory manager. * @@ -151,10 +154,11 @@ XERCES_CPP_NAMESPACE_BEGIN // 'char *' string. // -static char* localTranscode(const XMLCh* latinStrInUnicode) +static char* localTranscode(const XMLCh* latinStrInUnicode + , MemoryManager* const manager) { unsigned int lent = XMLString::stringLen(latinStrInUnicode); - char* retval = (char*) XMLPlatformUtils::fgMemoryManager->allocate + char* retval = (char*) manager->allocate ( (lent + 1) * sizeof(char) );//new char[lent + 1]; @@ -181,7 +185,7 @@ BinURLInputStream::BinURLInputStream(const XMLURL& urlSource) URLISBUFMAXSIZE * sizeof(XMLByte) );//new XMLByte[URLISBUFMAXSIZE]; const XMLCh* uri = urlSource.getURLText(); - char* uriAsCharStar = localTranscode(uri); + char* uriAsCharStar = localTranscode(uri, fMemoryManager); // // First find the size of the remote resource being asked for. @@ -204,18 +208,18 @@ BinURLInputStream::BinURLInputStream(const XMLURL& urlSource) HTResponse * response = HTRequest_response (request); fRemoteFileSize = HTResponse_length(response); if (fRemoteFileSize < 0) { - ThrowXML(NetAccessorException, XMLExcepts::NetAcc_LengthError); + ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_LengthError, fMemoryManager); } } // Cleanup, before you throw any errors. - delete [] uriAsCharStar; + fMemoryManager->deallocate(uriAsCharStar); HTRequest_delete(request); // Don't know whether I am supposed to delete counterStrm. if (status == NO) { - ThrowXML(NetAccessorException, XMLExcepts::NetAcc_LengthError); + ThrowXMLwithMemMgr(NetAccessorException, XMLExcepts::NetAcc_LengthError, fMemoryManager); } } diff --git a/src/xercesc/util/NetAccessors/libWWW/LibWWWNetAccessor.cpp b/src/xercesc/util/NetAccessors/libWWW/LibWWWNetAccessor.cpp index f42991f8b66eaccfe91caac501ca3ff93cd50992..a98317286542322ec68d2680cf415f5b9143b4ba 100644 --- a/src/xercesc/util/NetAccessors/libWWW/LibWWWNetAccessor.cpp +++ b/src/xercesc/util/NetAccessors/libWWW/LibWWWNetAccessor.cpp @@ -121,7 +121,7 @@ BinInputStream* LibWWWNetAccessor::makeNew(const XMLURL& urlSource) // unsupported protocol exception for the others. // default : - ThrowXML(MalformedURLException, XMLExcepts::URL_UnsupportedProto); + ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_UnsupportedProto, urlSource.getMemoryManager()); } } diff --git a/src/xercesc/util/PanicHandler.hpp b/src/xercesc/util/PanicHandler.hpp index f61753ddf0a7cee4db1c0f9b56bf58a164629c21..710167816228ff53c2d48c214316d0db7d04ccad 100644 --- a/src/xercesc/util/PanicHandler.hpp +++ b/src/xercesc/util/PanicHandler.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.5 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.4 2003/05/22 18:15:16 neilg * The PanicHandler interface should not inherit from XMemory. * The reason for this is that the default implementation does not @@ -101,7 +104,7 @@ XERCES_CPP_NAMESPACE_BEGIN * */ -class XMLUTIL_EXPORT PanicHandler +class XMLUTIL_EXPORT PanicHandler: public XMemory { public: diff --git a/src/xercesc/util/PlatformUtils.hpp b/src/xercesc/util/PlatformUtils.hpp index e4b64567afbd6e01acd74a686cdde221a52a1732..4d5f771fa7d1aa0afb6ca1552495b67d63b00ae0 100644 --- a/src/xercesc/util/PlatformUtils.hpp +++ b/src/xercesc/util/PlatformUtils.hpp @@ -495,7 +495,9 @@ public : * * @return Returns true if the filename appears to be relative */ - static bool isRelative(const XMLCh* const toCheck); + static bool isRelative(const XMLCh* const toCheck + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); /** Utility to join two paths * diff --git a/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp b/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp index 3707c9491af063709bbc7239c2948c3986d9ca9e..bbb1d83354a5760fbf6b4b406186d06db8f1f3b7 100644 --- a/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp @@ -348,7 +348,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp b/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp index 389decbfd09b2508e78e9a00aeacb90803c04b07..936bdc44a2519ff0339fe19974d9cc6a585e487c 100644 --- a/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.11 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.10 2003/12/17 15:16:10 cargilld * Platform update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -420,7 +423,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp b/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp index 9c93bf9a7e1e1393d61bd39bbe6c73dd75632b78..c2bcfb63dfebdc8c82edf3c870d12396af25d619 100644 --- a/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.19 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.18 2003/12/19 23:02:25 cargilld * More memory management updates. * @@ -463,7 +466,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp b/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp index 117924b8280669e6c312f6fd55b9e3f6385f1e23..dd6b917ddb039d0b7e0b082f7e48408cc57cdc00 100644 --- a/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.17 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.16 2003/12/17 15:16:10 cargilld * Platform update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -501,7 +504,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp b/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp index 08b39499f1ae655f2a8e444f44ce240b0a655eea..4b735f8ea50215ff9228782ee1f17bdcd09708e5 100644 --- a/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.17 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.16 2003/12/19 23:02:25 cargilld * More memory management updates. * @@ -476,7 +479,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp b/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp index 6fd99faee4243e612114d79d36974bbedae83357..5c30189bf2770dfa7baef3a37083c94fb7c1dabc 100644 --- a/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.20 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.19 2003/12/17 15:16:10 cargilld * Platform update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -516,7 +519,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp b/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp index 24bc14157babb4ab85ac41eb2428691746485eac..ff66f3c18080bd7d93c2f87ad7e903cb39bbd23e 100644 --- a/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp @@ -341,7 +341,8 @@ XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, bool -XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { return (toCheck[0] != L'/'); } diff --git a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp index ed079b7e575e5a382db4508ccbb4d7e12d202de9..71c58d7ba9cd903e45acaf5e046300f7fc314c4c 100644 --- a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp @@ -459,7 +459,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp b/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp index d6a1a2bd7d9936e7155df46f8e5994d5c8f2ec3f..483b162b710384e96ea1d9ab45c1c7cee673f1b0 100644 --- a/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp +++ b/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp @@ -208,7 +208,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(tmpPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of an empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/OS390/FileHandleImpl.cpp b/src/xercesc/util/Platforms/OS390/FileHandleImpl.cpp index c292073acdc47d407085574370a3ab7ed6ce856d..4eae12cfbed445f200fb2d6b5b961525f5767c25 100644 --- a/src/xercesc/util/Platforms/OS390/FileHandleImpl.cpp +++ b/src/xercesc/util/Platforms/OS390/FileHandleImpl.cpp @@ -70,7 +70,8 @@ XERCES_CPP_NAMESPACE_BEGIN //Constructor: -FileHandleImpl::FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl): Handle(open_handle), openType(o_type), recordType(r_type), lrecl(fileLrecl) { +FileHandleImpl::FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl, MemoryManager* const manager): + Handle(open_handle), openType(o_type), recordType(r_type), lrecl(fileLrecl), fMemoryManager(manager) { stgBufferPtr = 0; nextByte = 0; @@ -79,7 +80,8 @@ FileHandleImpl::FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int f (recordType == _FHI_TYPE_RECORD) && (lrecl != 0)) { - stgBufferPtr = new XMLByte [lrecl]; + //stgBufferPtr = new XMLByte [lrecl]; + stgBufferPtr = (XMLByte*) manager->allocate(lrecl * sizeof(XMLByte)); } // printf("FileHandleImpl constructor called\n"); @@ -104,7 +106,8 @@ FileHandleImpl::~FileHandleImpl() { if (stgBufferPtr != 0) { // printf("stgBufferPtr is being freed at: x%8.8X\n", stgBufferPtr); - delete [] stgBufferPtr; + //delete [] stgBufferPtr; + fMemoryManager->deallocate(stgBufferPtr); } } diff --git a/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp b/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp index e89cff30f6f954f3328d1a1a59caab78abdaee27..f0b5848511ecc48bea68783f72fb604290f621cc 100644 --- a/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp +++ b/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp @@ -74,9 +74,10 @@ class FileHandleImpl : public XMemory int openType; // 0=write, 1=read int lrecl; // LRECL if openType is write bool recordType; // true if "type=record" + MemoryManager* const fMemoryManager; public: - FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl=0); + FileHandleImpl(FILE* open_handle, int o_type, bool r_type, int fileLrecl=0, MemoryManager* const manager=XMLPlatformUtils::fgMemoryManager); ~FileHandleImpl(); void setHandle(FILE* newHandlePtr) { Handle = newHandlePtr; } void* getHandle() { return Handle; } diff --git a/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp b/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp index 0aded50a13209aaa186f990c439f883de7677441..3bda5b40c412321729d863ad5dd1acfde1f6e0c9 100644 --- a/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp +++ b/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp @@ -336,7 +336,7 @@ static FileHandleImpl* openRead(char* tmpFileName // of the FileHandleImpl class. fileHandle = fopen(pathobj.getfopenPath(), optionBuffer); - retVal = new FileHandleImpl(fileHandle, _FHI_READ, pathobj.isRecordType()); + retVal = new (manager) FileHandleImpl(fileHandle, _FHI_READ, pathobj.isRecordType(), manager); // temp fix for HFS files with "type=record" specified // close the file and re-open it without the fopen options @@ -573,7 +573,7 @@ static FileHandleImpl* openWrite(char* tmpFileName if (fileHandle == NULL) retVal = 0; else - retVal = new FileHandleImpl(fileHandle, _FHI_WRITE, isTypeRecord,fileLrecl); + retVal = new (manager) FileHandleImpl(fileHandle, _FHI_WRITE, isTypeRecord,fileLrecl, manager); return retVal; } @@ -896,7 +896,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(newSrc, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) @@ -926,8 +927,8 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) return false; } - char* tmpFileName = XMLString::transcode(toCheck, fgMemoryManager); - ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager); + char* tmpFileName = XMLString::transcode(toCheck, manager); + ArrayJanitor<char> janText((char*)tmpFileName, manager); Path390 pathobj; pathobj.setPath(tmpFileName); @@ -1119,7 +1120,7 @@ FileHandle XMLPlatformUtils::openStdInHandle(MemoryManager* const manager) FILE* fileHandle = 0; fileHandle = fdopen(dup(0), "rb"); if (fileHandle) - retVal = new FileHandleImpl(fileHandle, _FHI_READ, _FHI_NOT_TYPE_RECORD); + retVal = new (manager) FileHandleImpl(fileHandle, _FHI_READ, _FHI_NOT_TYPE_RECORD, manager); else retVal = 0; diff --git a/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp b/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp index 99c82aea619922d719bb5d1d355becf750b12f43..c723fabd57a9ad36c49ecc0958812de727a90f73 100644 --- a/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp +++ b/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp @@ -431,7 +431,9 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) + +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp b/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp index 61948153c689b207076f696ef08ab2ef76434179..3bc883bb6e8a46f5b896ed53389a70f6bccaa1ed 100644 --- a/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.13 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.12 2003/12/17 19:58:05 cargilld * Platform update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -406,7 +409,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp b/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp index 605890f820c8d090556001124fbdb29575a5c8b9..ba47e786b6bdd10bbfcfb8ef009e8109cf747457 100644 --- a/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp @@ -250,7 +250,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { if (!toCheck[0] || toCheck[0] == XMLCh('/')) return false; diff --git a/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp b/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp index d1fe564c79e9a158322f14167ac816dbf400cd72..cbe0c65bf576c036c0f3e7665403407f4a5e40ac 100644 --- a/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp +++ b/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp @@ -374,7 +374,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp b/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp index 0d54b812937b57c34dc9e90db70136df41dfd871..8cfd0bc8c88246a2d2b091f046c7c0c879d0873e 100644 --- a/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp +++ b/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp @@ -371,7 +371,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp b/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp index 4e7566355a719c717c1d3a28e18739f03be1f16e..e0fc2e846a892a8fa5eb1805317ae0c90bb3f8c0 100644 --- a/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp +++ b/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.15 2003/12/24 15:24:14 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.14 2003/12/17 19:58:05 cargilld * Platform update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -454,7 +457,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, return XMLString::transcode(absPath, manager); } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp b/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp index f130f9bc1dc9145dd28d7a08a0612c7aefda10c9..b235a30694adbf3954f79a20eb0c6674707954c0 100644 --- a/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp +++ b/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp @@ -605,7 +605,8 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath, } } -bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck) +bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck + , MemoryManager* const manager) { // Check for pathological case of empty path if (!toCheck[0]) diff --git a/src/xercesc/util/TransENameMap.hpp b/src/xercesc/util/TransENameMap.hpp index eeb805c630e998bad3c1fe4481703ab52a71fdb1..1aec2b85fd44cafbcbfc978bb76e49e77db9f888 100644 --- a/src/xercesc/util/TransENameMap.hpp +++ b/src/xercesc/util/TransENameMap.hpp @@ -76,7 +76,8 @@ public : // ----------------------------------------------------------------------- virtual ~ENameMap() { - delete [] fEncodingName; + //delete [] fEncodingName; + XMLPlatformUtils::fgMemoryManager->deallocate(fEncodingName); } @@ -105,8 +106,7 @@ protected : // Hidden constructors // ----------------------------------------------------------------------- ENameMap(const XMLCh* const encodingName) : - - fEncodingName(XMLString::replicate(encodingName)) + fEncodingName(XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager)) { } diff --git a/src/xercesc/util/TransService.hpp b/src/xercesc/util/TransService.hpp index 669494a0da5dbe0e646e107ad7f431a3605f5614..64d30f8281836b365d30c6ff4fdc3b7858c4d2a1 100644 --- a/src/xercesc/util/TransService.hpp +++ b/src/xercesc/util/TransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.11 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.10 2003/11/24 19:52:06 neilg * allow classes derived from XMLTransService to tailor the intrinsic maps to their taste. * @@ -536,9 +539,11 @@ public : // its assumed that the buffer is physically one char or byte // larger. // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText) = 0; + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; - virtual unsigned int calcRequiredSize(const XMLCh* const srcText) = 0; + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0; virtual char* transcode(const XMLCh* const toTranscode) = 0; virtual char* transcode(const XMLCh* const toTranscode, @@ -553,6 +558,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ) = 0; virtual bool transcode @@ -560,6 +566,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ) = 0; diff --git a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp index 4bc725213fb22b466a0636968cc6766ffbf5a85c..28e8b314e48b67ca6f44e4962765afecd8050200 100644 --- a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp +++ b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.10 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.9 2003/11/08 23:37:00 neilg * fix for bug 24287 by Abe Backus. * @@ -830,17 +833,18 @@ CygwinTranscoder::transcodeFrom( const XMLByte* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)(*inPtr), tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_BadSrcCP , tmpBuf , getEncodingName() + , getMemoryManager() ); } else { - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } } @@ -911,12 +915,13 @@ CygwinTranscoder::transcodeTo(const XMLCh* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_Unrepresentable , tmpBuf , getEncodingName() + , getMemoryManager() ); } @@ -1001,7 +1006,8 @@ CygwinLCPTranscoder::~CygwinLCPTranscoder() // --------------------------------------------------------------------------- // CygwinLCPTranscoder: Implementation of the virtual transcoder interface // --------------------------------------------------------------------------- -unsigned int CygwinLCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int CygwinLCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -1013,7 +1019,8 @@ unsigned int CygwinLCPTranscoder::calcRequiredSize(const char* const srcText) } -unsigned int CygwinLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int CygwinLCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -1145,7 +1152,8 @@ XMLCh* CygwinLCPTranscoder::transcode(const char* const toTranscode, bool CygwinLCPTranscoder::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1169,7 +1177,8 @@ bool CygwinLCPTranscoder::transcode( const char* const toTranscode bool CygwinLCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) diff --git a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.hpp b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.hpp index cde02f657492101de0ee8413d962f4ac68bd2255..7484a40aa29317141fff0323315e64b730d03a89 100644 --- a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.hpp +++ b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.hpp @@ -256,9 +256,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -273,6 +275,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -280,6 +283,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp index f29b9d9a81a9d4f545d5eb0b00ecd93b49bed29d..37cd17cbe72aee7c14fb20f3a3ce0c115f281b73 100644 --- a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp +++ b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp @@ -365,7 +365,7 @@ makeNewXMLTranscoder(const XMLCh* const encodingName (XMLString::endsWith(encodingNameToUse, gS390Id)) ) { int workBufferSize = (XMLString::stringLen(encodingNameToUse) + XMLString::stringLen(gswaplfnlId) - XMLString::stringLen(gS390Id) + 1); - workBuffer = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate(workBufferSize * sizeof(XMLCh)); + workBuffer = (XMLCh*) manager->allocate(workBufferSize * sizeof(XMLCh)); int moveSize = XMLString::stringLen(encodingNameToUse) - XMLString::stringLen(gS390Id); XMLString::moveChars(workBuffer, encodingNameToUse, moveSize); XMLString::moveChars((workBuffer + moveSize), gswaplfnlId, XMLString::stringLen(gswaplfnlId)); @@ -384,12 +384,12 @@ makeNewXMLTranscoder(const XMLCh* const encodingName } else { - tmpName = convertToUChar(encodingNameToUse, 0, XMLPlatformUtils::fgMemoryManager); + tmpName = convertToUChar(encodingNameToUse, 0, manager); actualName = tmpName; } - ArrayJanitor<UChar> janTmp(tmpName, XMLPlatformUtils::fgMemoryManager); - ArrayJanitor<XMLCh> janTmp1(workBuffer, XMLPlatformUtils::fgMemoryManager); + ArrayJanitor<UChar> janTmp(tmpName, manager); + ArrayJanitor<XMLCh> janTmp1(workBuffer, manager); UErrorCode uerr = U_ZERO_ERROR; UConverter* converter = ucnv_openU(actualName, &uerr); @@ -504,17 +504,18 @@ ICUTranscoder::transcodeFrom(const XMLByte* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_BadSrcCP , tmpBuf , getEncodingName() + , getMemoryManager() ); } else { - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } } @@ -664,12 +665,13 @@ ICUTranscoder::transcodeTo( const XMLCh* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_Unrepresentable , tmpBuf , getEncodingName() + , getMemoryManager() ); } @@ -779,7 +781,8 @@ ICULCPTranscoder::~ICULCPTranscoder() // --------------------------------------------------------------------------- // ICULCPTranscoder: Constructors and Destructor // --------------------------------------------------------------------------- -unsigned int ICULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int ICULCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -810,8 +813,8 @@ unsigned int ICULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) else { // Copy the source to a local temp - UChar* tmpBuf = convertToUChar(srcText, 0, XMLPlatformUtils::fgMemoryManager); - ArrayJanitor<UChar> janTmp(tmpBuf, XMLPlatformUtils::fgMemoryManager); + UChar* tmpBuf = convertToUChar(srcText, 0, manager); + ArrayJanitor<UChar> janTmp(tmpBuf, manager); // Use a faux scope to synchronize while we do this { @@ -835,7 +838,8 @@ unsigned int ICULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) return (unsigned int)targetCap; } -unsigned int ICULCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int ICULCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -1252,7 +1256,8 @@ XMLCh* ICULCPTranscoder::transcode(const char* const toTranscode, bool ICULCPTranscoder::transcode(const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1278,7 +1283,7 @@ bool ICULCPTranscoder::transcode(const char* const toTranscode if (sizeof(XMLCh) == sizeof(UChar)) targetBuf = (UChar*)toFill; else - targetBuf = (UChar*) XMLPlatformUtils::fgMemoryManager->allocate + targetBuf = (UChar*) manager->allocate ( (maxChars + 1) * sizeof(UChar) );//new UChar[maxChars + 1]; @@ -1304,7 +1309,7 @@ bool ICULCPTranscoder::transcode(const char* const toTranscode if (U_FAILURE(err)) { if (targetBuf != (UChar*)toFill) - XMLPlatformUtils::fgMemoryManager->deallocate(targetBuf);//delete [] targetBuf; + manager->deallocate(targetBuf);//delete [] targetBuf; return false; } @@ -1318,7 +1323,7 @@ bool ICULCPTranscoder::transcode(const char* const toTranscode *outPtr = 0; // And delete the temp buffer - XMLPlatformUtils::fgMemoryManager->deallocate(targetBuf);//delete [] targetBuf; + manager->deallocate(targetBuf);//delete [] targetBuf; } return true; @@ -1327,7 +1332,8 @@ bool ICULCPTranscoder::transcode(const char* const toTranscode bool ICULCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Watch for a few psycho corner cases if (!toTranscode || !maxChars) @@ -1355,12 +1361,12 @@ bool ICULCPTranscoder::transcode( const XMLCh* const toTranscode else { // Allocate a non-const temp buf, but store it also in the actual - ncActual = convertToUChar(toTranscode, 0, XMLPlatformUtils::fgMemoryManager); + ncActual = convertToUChar(toTranscode, 0, manager); actualSrc = ncActual; } // Insure that the temp buffer, if any, gets cleaned up via the nc pointer - ArrayJanitor<UChar> janTmp(ncActual, XMLPlatformUtils::fgMemoryManager); + ArrayJanitor<UChar> janTmp(ncActual, manager); // // Use a faux block to enforce a lock on the converter while we do this. diff --git a/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp b/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp index e3c5684679b44d13bb6f15c6c276247b31f41f7c..35333782e6c48ccd2e40e2720dc0e54ef8299b8a 100644 --- a/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp +++ b/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.9 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.8 2003/05/17 16:32:17 knoaman * Memory manager implementation : transcoder update. * @@ -283,9 +286,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -300,6 +305,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -307,6 +313,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp b/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp index e1fec028ad32888d4b2fb6cb7f13f0769f10cd7e..6cc6e2628221ef6cc0bb5dc00a534861cbb7f70e 100644 --- a/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp +++ b/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp @@ -255,7 +255,8 @@ void IconvTransService::lowerCase(XMLCh* const toLowerCase) const // --------------------------------------------------------------------------- // IconvLCPTranscoder: The virtual transcoder API // --------------------------------------------------------------------------- -unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -272,7 +273,8 @@ unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const srcText) } -unsigned int IconvLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int IconvLCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -284,7 +286,7 @@ unsigned int IconvLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) if (wLent >= gTempBuffArraySize) wideCharBuf = allocatedArray = (wchar_t*) - XMLPlatformUtils::fgMemoryManager->allocate + manager->allocate ( (wLent + 1) * sizeof(wchar_t) );//new wchar_t[wLent + 1]; @@ -298,7 +300,7 @@ unsigned int IconvLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) wideCharBuf[wLent] = 0x00; const unsigned int retVal = ::wcstombs(NULL, wideCharBuf, 0); - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; if (retVal == ~0) return 0; @@ -409,7 +411,8 @@ char* IconvLCPTranscoder::transcode(const XMLCh* const toTranscode, bool IconvLCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) @@ -435,7 +438,7 @@ bool IconvLCPTranscoder::transcode( const XMLCh* const toTranscode if (maxBytes >= gTempBuffArraySize) { wideCharBuf = allocatedArray = (wchar_t*) - XMLPlatformUtils::fgMemoryManager->allocate + manager->allocate ( (maxBytes + 1) * sizeof(wchar_t) );//new wchar_t[maxBytes + 1]; @@ -453,13 +456,13 @@ bool IconvLCPTranscoder::transcode( const XMLCh* const toTranscode size_t mblen = ::wcstombs(toFill, wideCharBuf, maxBytes); if (mblen == -1) { - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return false; } // Cap it off just in case toFill[mblen] = 0; - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return true; } @@ -516,7 +519,7 @@ XMLCh* IconvLCPTranscoder::transcode(const char* const toTranscode, XMLCh* retVal = 0; if (*toTranscode) { - const unsigned int len = calcRequiredSize(toTranscode); + const unsigned int len = calcRequiredSize(toTranscode, manager); if (len == 0) { retVal = (XMLCh*) manager->allocate(sizeof(XMLCh)); //new XMLCh[1]; @@ -556,7 +559,8 @@ XMLCh* IconvLCPTranscoder::transcode(const char* const toTranscode, bool IconvLCPTranscoder::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -581,7 +585,7 @@ bool IconvLCPTranscoder::transcode( const char* const toTranscode } if (maxChars >= gTempBuffArraySize) - wideCharBuf = allocatedArray = (wchar_t*) XMLPlatformUtils::fgMemoryManager->allocate + wideCharBuf = allocatedArray = (wchar_t*) manager->allocate ( (maxChars + 1) * sizeof(wchar_t) );//new wchar_t[maxChars + 1]; @@ -590,7 +594,7 @@ bool IconvLCPTranscoder::transcode( const char* const toTranscode if (::mbstowcs(wideCharBuf, toTranscode, maxChars) == -1) { - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return false; } @@ -599,7 +603,7 @@ bool IconvLCPTranscoder::transcode( const char* const toTranscode toFill[i] = (XMLCh) wideCharBuf[i]; } toFill[len] = 0x00; - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return true; } diff --git a/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp b/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp index 728a4c3d01b980eddfc49ccfca9d660d97bd3333..d7e335eb380f2cbda7d9c5565acdcd15d48eaae1 100644 --- a/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp +++ b/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.6 2003/05/15 18:47:03 knoaman * Partial implementation of the configurable memory manager. * @@ -186,9 +189,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -199,6 +204,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual XMLCh* transcode(const char* const toTranscode); @@ -210,6 +216,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp b/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp index 3a02d0870b048b2f67bb59d9e0958f0bb67309a7..03cce43305f42a5265a8b50e6ff2e88aabbab0e8 100644 --- a/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp +++ b/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp @@ -350,7 +350,8 @@ void Iconv390TransService::lowerCase(XMLCh* const toLowerCase) const } // --------------------------------------------------------------------------- -unsigned int Iconv390LCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int Iconv390LCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -367,7 +368,8 @@ unsigned int Iconv390LCPTranscoder::calcRequiredSize(const char* const srcText) } -unsigned int Iconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int Iconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -378,7 +380,7 @@ unsigned int Iconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) wchar_t* wideCharBuf = 0; if (wLent >= gTempBuffArraySize) - wideCharBuf = allocatedArray = (wchar_t*) XMLPlatformUtils::fgMemoryManager->allocate + wideCharBuf = allocatedArray = (wchar_t*) manager->allocate ( (wLent + 1) * sizeof(wLent + 1) );//new wchar_t[wLent + 1]; @@ -392,7 +394,7 @@ unsigned int Iconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) wideCharBuf[wLent] = 0x00; const unsigned int retVal = ::wcstombs(NULL, wideCharBuf, 0); - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; if (retVal == -1) return 0; @@ -463,7 +465,8 @@ char* Iconv390LCPTranscoder::transcode(const XMLCh* const toTranscode, bool Iconv390LCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) @@ -547,7 +550,7 @@ XMLCh* Iconv390LCPTranscoder::transcode(const char* const toTranscode, XMLCh* retVal = 0; if (*toTranscode) { - const unsigned int len = calcRequiredSize(toTranscode); + const unsigned int len = calcRequiredSize(toTranscode, manager); if (len == 0) { retVal = (XMLCh*) manager->allocate(sizeof(XMLCh));//new XMLCh[1]; @@ -588,7 +591,8 @@ XMLCh* Iconv390LCPTranscoder::transcode(const char* const toTranscode, bool Iconv390LCPTranscoder::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) diff --git a/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp b/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp index c0221e34f508c586f6807a19632ae175862c1892..f23bc2f2b6671452dc2b3056723e04af86dcbc2b 100644 --- a/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp +++ b/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.6 2003/05/15 18:47:03 knoaman * Partial implementation of the configurable memory manager. * @@ -178,9 +181,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -191,6 +196,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual XMLCh* transcode(const char* const toTranscode); @@ -202,6 +208,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp index b574105082af47f3f387c22e4906c699cddb5f23..e5955b697603240e02150f2e0777e3d33b81281b 100644 --- a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp +++ b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp @@ -85,12 +85,13 @@ XERCES_CPP_NAMESPACE_BEGIN // conversion of all strings. These local helper methods make that easier. // static UChar* convertToUChar( const XMLCh* const toConvert - , const unsigned int srcLen = 0) + , const unsigned int srcLen = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) { const unsigned int actualLen = srcLen ? srcLen : XMLString::stringLen(toConvert); - UChar* tmpBuf = (UChar*) XMLPlatformUtils::fgMemoryManager->allocate + UChar* tmpBuf = (UChar*) manager->allocate ( (srcLen + 1) * sizeof(UChar) );//new UChar[srcLen + 1]; @@ -429,17 +430,18 @@ Iconv400Transcoder::transcodeFrom(const XMLByte* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_BadSrcCP , tmpBuf , getEncodingName() + , getMemoryManager() ); } else { - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } } @@ -530,10 +532,10 @@ Iconv400Transcoder::transcodeTo( const XMLCh* const srcData } else { - tmpBufPtr = convertToUChar(srcData, srcCount); + tmpBufPtr = convertToUChar(srcData, srcCount, getMemoryManager()); srcPtr = tmpBufPtr; } - ArrayJanitor<UChar> janTmpBuf(tmpBufPtr, XMLPlatformUtils::fgMemoryManager); + ArrayJanitor<UChar> janTmpBuf(tmpBufPtr, getMemoryManager()); // // Set the appropriate callback so that it will either fail or use @@ -566,12 +568,13 @@ Iconv400Transcoder::transcodeTo( const XMLCh* const srcData { XMLCh tmpBuf[16]; XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16); - ThrowXML2 + ThrowXMLwithMemMgr2 ( TranscodingException , XMLExcepts::Trans_Unrepresentable , tmpBuf , getEncodingName() + , getMemoryManager() ); } @@ -652,7 +655,8 @@ Iconv400LCPTranscoder::~Iconv400LCPTranscoder() // --------------------------------------------------------------------------- // Iconv400LCPTranscoder: Constructors and Destructor // --------------------------------------------------------------------------- -unsigned int Iconv400LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int Iconv400LCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -679,7 +683,8 @@ unsigned int Iconv400LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) return (unsigned int)targetCap; } -unsigned int Iconv400LCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int Iconv400LCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -993,7 +998,8 @@ XMLCh* Iconv400LCPTranscoder::transcode(const char* const toTranscode, bool Iconv400LCPTranscoder::transcode(const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1033,7 +1039,8 @@ bool Iconv400LCPTranscoder::transcode(const char* const toTranscode bool Iconv400LCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Watch for a few psycho corner cases if (!toTranscode || !maxChars) diff --git a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp index eb33d127db1d11ca3fed9b3d24e3b3f799ab2536..21a13658b8d02fb60003d19a88fd8faa1b096f3c 100644 --- a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp +++ b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp @@ -234,9 +234,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -251,6 +253,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -258,6 +261,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp b/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp index 2d55b1359e0c0cef46b88a32e873d17e380d786f..9de5752b11b91a4db6386f9f2155ec98bbb6594e 100644 --- a/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp +++ b/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.15 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.14 2003/05/17 16:32:17 knoaman * Memory manager implementation : transcoder update. * @@ -937,7 +940,8 @@ void IconvFBSDTransService::lowerCase(XMLCh* const toLowerCase) const // IconvFBSDLCPTranscoder: The virtual transcoder API // --------------------------------------------------------------------------- unsigned int -IconvFBSDLCPTranscoder::calcRequiredSize (const char* const srcText) +IconvFBSDLCPTranscoder::calcRequiredSize (const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -964,7 +968,7 @@ IconvFBSDLCPTranscoder::calcRequiredSize (const char* const srcText) const char *ptr = srcText + srcLen - len; size_t rc = iconvFrom(ptr, &len, &pTmpArr, gTempBuffArraySize); if (rc == (size_t) -1 && errno != E2BIG) { - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); /* return 0; */ } rc = pTmpArr - (char *) tmpWideArr; @@ -979,7 +983,8 @@ IconvFBSDLCPTranscoder::calcRequiredSize (const char* const srcText) unsigned int -IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -994,7 +999,7 @@ IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) wchar_t* wideCharBuf = 0; if (wLent >= gTempBuffArraySize) - wideCharBuf = allocatedArray = (wchar_t*) XMLPlatformUtils::fgMemoryManager->allocate + wideCharBuf = allocatedArray = (wchar_t*) manager->allocate ( (wLent + 1) * sizeof(wchar_t) );//new wchar_t[wLent + 1]; @@ -1008,7 +1013,7 @@ IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) const unsigned int retVal = fbsd_wcstombs(NULL, wideCharBuf, 0); if (allocatedArray) - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; if (retVal == ~0) return 0; return retVal; @@ -1021,7 +1026,7 @@ IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) size_t len = wLent * uChSize(); if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -1044,8 +1049,8 @@ IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) size_t rc = iconvTo(ptr, &len, &pTmpArr, gTempBuffArraySize); if (rc == (size_t) -1 && errno != E2BIG) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + manager->deallocate(wBufPtr);//delete [] wBufPtr; + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); /* return 0; */ } rc = pTmpArr - tmpBuff; @@ -1054,7 +1059,7 @@ IconvFBSDLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) break; } if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; return totalLen; #endif /* !XML_USE_LIBICONV */ @@ -1197,7 +1202,7 @@ char* IconvFBSDLCPTranscoder::transcode(const XMLCh* const toTranscode, #else /* XML_USE_LIBICONV */ // Calc needed size. - const size_t neededLen = calcRequiredSize (toTranscode); + const size_t neededLen = calcRequiredSize (toTranscode, manager); if (neededLen == 0) return 0; // allocate output buffer @@ -1252,7 +1257,8 @@ char* IconvFBSDLCPTranscoder::transcode(const XMLCh* const toTranscode, bool IconvFBSDLCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) { @@ -1277,7 +1283,7 @@ bool IconvFBSDLCPTranscoder::transcode( const XMLCh* const toTranscode wchar_t* wideCharBuf = 0; if (maxBytes >= gTempBuffArraySize) - wideCharBuf = allocatedArray = (wchar_t*) XMLPlatformUtils::fgMemoryManager->allocate + wideCharBuf = allocatedArray = (wchar_t*) manager->allocate ( (maxBytes + 1) * sizeof(wchar_t) );//new wchar_t[maxBytes + 1]; @@ -1292,11 +1298,11 @@ bool IconvFBSDLCPTranscoder::transcode( const XMLCh* const toTranscode mblen = fbsd_wcstombs(toFill, wideCharBuf, maxBytes); if (mblen == -1) { if (allocatedArray) - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return false; } if (allocatedArray) - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; #else /* XML_USE_LIBICONV */ @@ -1308,7 +1314,7 @@ bool IconvFBSDLCPTranscoder::transcode( const XMLCh* const toTranscode if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -1328,11 +1334,11 @@ bool IconvFBSDLCPTranscoder::transcode( const XMLCh* const toTranscode mblen = iconvTo(wideCharBuf, &len, &ptr, maxBytes); if (mblen == (size_t)-1) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; return false; } if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; #endif /* !XML_USE_LIBICONV */ @@ -1436,7 +1442,7 @@ XMLCh* IconvFBSDLCPTranscoder::transcode(const char* const toTranscode, XMLCh* retVal = 0; if (*toTranscode) { - const unsigned int wLent = calcRequiredSize(toTranscode); + const unsigned int wLent = calcRequiredSize(toTranscode, manager); if (wLent == 0) { retVal = (XMLCh*) manager->allocate(sizeof(XMLCh));//new XMLCh[1]; retVal[0] = 0; @@ -1520,7 +1526,8 @@ XMLCh* IconvFBSDLCPTranscoder::transcode(const char* const toTranscode, bool IconvFBSDLCPTranscoder::transcode(const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1546,7 +1553,7 @@ bool IconvFBSDLCPTranscoder::transcode(const char* const toTranscode wchar_t* wideCharBuf = 0; if (maxChars >= gTempBuffArraySize) - wideCharBuf = allocatedArray = (wchar_t*) XMLPlatformUtils::fgMemoryManager->allocate + wideCharBuf = allocatedArray = (wchar_t*) manager->allocate ( (wLent + 1) * sizeof(wchar_t) );//new wchar_t[wLent + 1]; @@ -1555,13 +1562,13 @@ bool IconvFBSDLCPTranscoder::transcode(const char* const toTranscode if (fbsd_mbstowcs(wideCharBuf, toTranscode, wLent) == -1) { if (allocatedArray) - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; return false; } for (unsigned int i = 0; i < wLent; i++) toFill[i] = (XMLCh) wideCharBuf[i]; if (allocatedArray) - XMLPlatformUtils::fgMemoryManager->deallocate(allocatedArray);//delete [] allocatedArray; + manager->deallocate(allocatedArray);//delete [] allocatedArray; #else /* XML_USE_LIBICONV */ @@ -1572,7 +1579,7 @@ bool IconvFBSDLCPTranscoder::transcode(const char* const toTranscode if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -1589,14 +1596,14 @@ bool IconvFBSDLCPTranscoder::transcode(const char* const toTranscode size_t rc = iconvFrom(toTranscode, &flen, &ptr, len); if (rc == (size_t)-1) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; return false; } if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) mbsToXML (wideCharBuf, wLent, toFill, wLent); if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; #endif /* !XML_USE_LIBICONV */ @@ -1713,7 +1720,7 @@ unsigned int IconvFBSDTranscoder::transcodeFrom if (errno != E2BIG || prevSrcLen == srcLen) { if (wBufPtr) getMemoryManager()->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } } charSizes[cnt] = prevSrcLen - srcLen; @@ -1765,7 +1772,7 @@ unsigned int IconvFBSDTranscoder::transcodeTo if (rc == (size_t)-1 && errno != E2BIG) { if (wBufPtr) getMemoryManager()->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } charsEaten = srcCount - srcLen / uChSize(); if (wBufPtr) diff --git a/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp b/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp index f33c4c7bfa9b78d9108806ea43d912798f8d4042..3e73c95f74a9ea271b6aca25923a8f1306bb3b5f 100644 --- a/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp +++ b/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.9 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.8 2003/05/17 16:32:18 knoaman * Memory manager implementation : transcoder update. * @@ -404,9 +407,11 @@ public: // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -417,6 +422,7 @@ public: const XMLCh* const toTranscode , char* const toFill , const unsigned int maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual XMLCh* transcode(const char* const toTranscode); @@ -428,6 +434,7 @@ public: const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp index 7cc40e416ff0187917cb331f8487334caa6e551b..938d8e5c30cb06cac5f0eb846c7452f8d849975f 100644 --- a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp +++ b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.11 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.10 2003/08/19 14:01:41 neilg * fix for bug 22537 * @@ -732,7 +735,8 @@ void IconvGNUTransService::lowerCase(XMLCh* const toLowerCase) const // IconvGNULCPTranscoder: The virtual transcoder API // --------------------------------------------------------------------------- unsigned int -IconvGNULCPTranscoder::calcRequiredSize (const char* const srcText) +IconvGNULCPTranscoder::calcRequiredSize (const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -750,7 +754,7 @@ IconvGNULCPTranscoder::calcRequiredSize (const char* const srcText) const char *ptr = srcText + srcLen - len; size_t rc = iconvFrom(ptr, &len, &pTmpArr, gTempBuffArraySize); if (rc == (size_t) -1 && errno != E2BIG) { - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); /* return 0; */ } rc = pTmpArr - (char *) tmpWideArr; @@ -763,7 +767,8 @@ IconvGNULCPTranscoder::calcRequiredSize (const char* const srcText) unsigned int -IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -777,7 +782,7 @@ IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) size_t len = wLent * uChSize(); if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -800,8 +805,8 @@ IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) size_t rc = iconvTo(ptr, &len, &pTmpArr, gTempBuffArraySize); if (rc == (size_t) -1 && errno != E2BIG) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + manager->deallocate(wBufPtr);//delete [] wBufPtr; + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, manager); /* return 0; */ } rc = pTmpArr - tmpBuff; @@ -810,7 +815,7 @@ IconvGNULCPTranscoder::calcRequiredSize(const XMLCh* const srcText) break; } if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; return totalLen; } @@ -883,7 +888,7 @@ char* IconvGNULCPTranscoder::transcode(const XMLCh* const toTranscode, unsigned int wLent = getWideCharLength(toTranscode); // Calc needed size. - const size_t neededLen = calcRequiredSize (toTranscode); + const size_t neededLen = calcRequiredSize (toTranscode, manager); if (neededLen == 0) return 0; // allocate output buffer @@ -933,7 +938,8 @@ char* IconvGNULCPTranscoder::transcode(const XMLCh* const toTranscode, bool IconvGNULCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) { @@ -957,7 +963,7 @@ bool IconvGNULCPTranscoder::transcode( const XMLCh* const toTranscode if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -975,11 +981,11 @@ bool IconvGNULCPTranscoder::transcode( const XMLCh* const toTranscode size_t rc = iconvTo(wideCharBuf, &len, &ptr, maxBytes); if (rc == (size_t)-1) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; return false; } if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; // Cap it off just in case toFill[rc] = 0; @@ -1052,7 +1058,7 @@ XMLCh* IconvGNULCPTranscoder::transcode(const char* const toTranscode, XMLCh* retVal = 0; if (*toTranscode) { - const unsigned int wLent = calcRequiredSize(toTranscode); + const unsigned int wLent = calcRequiredSize(toTranscode, manager); if (wLent == 0) { retVal = (XMLCh*) manager->allocate(sizeof(XMLCh));//new XMLCh[1]; retVal[0] = 0; @@ -1104,7 +1110,8 @@ XMLCh* IconvGNULCPTranscoder::transcode(const char* const toTranscode, bool IconvGNULCPTranscoder::transcode(const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1130,7 +1137,7 @@ bool IconvGNULCPTranscoder::transcode(const char* const toTranscode if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) { if (len > gTempBuffArraySize) { - wBufPtr = (char*) XMLPlatformUtils::fgMemoryManager->allocate + wBufPtr = (char*) manager->allocate ( len * sizeof(char) );//new char[len]; @@ -1147,14 +1154,14 @@ bool IconvGNULCPTranscoder::transcode(const char* const toTranscode size_t rc = iconvFrom(toTranscode, &flen, &ptr, len); if (rc == (size_t)-1) { if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + XMLPlatformUtils::manager->deallocate(wBufPtr);//delete [] wBufPtr; return false; } if (uChSize() != sizeof(XMLCh) || UBO() != BYTE_ORDER) mbsToXML (wideCharBuf, wLent, toFill, wLent); if (wBufPtr) - XMLPlatformUtils::fgMemoryManager->deallocate(wBufPtr);//delete [] wBufPtr; + manager->deallocate(wBufPtr);//delete [] wBufPtr; toFill[wLent] = 0x00; return true; @@ -1256,7 +1263,7 @@ unsigned int IconvGNUTranscoder::transcodeFrom if (errno != E2BIG || prevSrcLen == srcLen) { if (wBufPtr) getMemoryManager()->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } } charSizes[cnt] = prevSrcLen - srcLen; @@ -1308,7 +1315,7 @@ unsigned int IconvGNUTranscoder::transcodeTo if (rc == (size_t)-1 && errno != E2BIG) { if (wBufPtr) getMemoryManager()->deallocate(wBufPtr);//delete [] wBufPtr; - ThrowXML(TranscodingException, XMLExcepts::Trans_BadSrcSeq); + ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager()); } charsEaten = srcCount - srcLen / uChSize(); if (wBufPtr) diff --git a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp index 910c2b96155d9131809c1efac6031df1f6ef08bb..745ed79cd2c7c3ec21ad20e32a3f2a84a9f9a432 100644 --- a/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp +++ b/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.5 2003/05/17 16:32:18 knoaman * Memory manager implementation : transcoder update. * @@ -362,9 +365,11 @@ public: // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -375,6 +380,7 @@ public: const XMLCh* const toTranscode , char* const toFill , const unsigned int maxBytes + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual XMLCh* transcode(const char* const toTranscode); @@ -386,6 +392,7 @@ public: const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp index 3586ba4934a0f53ec0d10555bc2dbdbbd52c87b7..73a80cb41ad621095bc00f826f6c73998ffa3a84 100644 --- a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp +++ b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp @@ -860,7 +860,8 @@ MacOSLCPTranscoder::~MacOSLCPTranscoder() // extra buffering to avoid this result. // --------------------------------------------------------------------------- unsigned int -MacOSLCPTranscoder::calcRequiredSize(const char* const srcText) +MacOSLCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -927,7 +928,8 @@ MacOSLCPTranscoder::calcRequiredSize(const char* const srcText) // extra buffering to avoid this result. // --------------------------------------------------------------------------- unsigned int -MacOSLCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +MacOSLCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -1232,7 +1234,8 @@ MacOSLCPTranscoder::transcode(const char* const srcText, bool MacOSLCPTranscoder::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // toFill must contain space for maxChars XMLCh characters + 1 (for terminating NULL). @@ -1295,7 +1298,8 @@ MacOSLCPTranscoder::transcode( const char* const toTranscode bool MacOSLCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // toFill must contain space for maxChars bytes characters + 1 (for terminating NULL). const XMLCh* src = toTranscode; diff --git a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp index f8666bdd8a4fc9be1dfcce221142ad60c7747c87..b17b5998015f1bc18820746b04fee760a1a8d068 100644 --- a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp +++ b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp @@ -250,9 +250,11 @@ public : // its assumed that the buffer is physically one char or byte // larger. // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -267,6 +269,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -274,6 +277,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp index 425df85736193241a013be7d6a30c0acbdbc9f83..7969f99687a7935a4482c0c90cec0da68a253884 100644 --- a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp +++ b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp @@ -682,7 +682,8 @@ Uniconv390LCPTranscoder::~Uniconv390LCPTranscoder() // transcode the string and see how long it is. Fortunately, this is only done as a last // ditch effort so it should only be used very rarely (if at all). // --------------------------------------------------------------------------- -unsigned int Uniconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int Uniconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { DBGPRINTF1("Uniconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) \n"); //printf("!!!***Uniconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) \n"); @@ -692,15 +693,16 @@ DBGPRINTF1("Uniconv390LCPTranscoder::calcRequiredSize(const XMLCh* const srcText if (!*srcText) return 0; - char * result = transcode(srcText, XMLPlatformUtils::fgMemoryManager); + char * result = transcode(srcText, manager); if (result) { thesize = strlen(result); - XMLPlatformUtils::fgMemoryManager->deallocate(result);//delete [] result; + manager->deallocate(result);//delete [] result; } return thesize; } -unsigned int Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { DBGPRINTF1("Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText) \n"); //printf("!!!***Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText) \n"); @@ -710,10 +712,10 @@ DBGPRINTF1("Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText) if (!*srcText) return 0; - XMLCh * result = transcode(srcText, XMLPlatformUtils::fgMemoryManager); + XMLCh * result = transcode(srcText, manager); if (result) { thesize = getWideCharLength(result); - XMLPlatformUtils::fgMemoryManager->deallocate(result);//delete [] result; + manager->deallocate(result);//delete [] result; } DBGPRINTF2("Uniconv390LCPTranscoder::calcRequiredSize(const char* const srcText) %d \n",thesize); @@ -908,7 +910,8 @@ DBGPRINTF2("Uniconv390LCPTranscoder::transcode(const char* const toTranscode):%s bool Uniconv390LCPTranscoder::transcode(const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { DBGPRINTF1("Uniconv390LCPTranscoder::transcode(const char* const toTranscode, etc.... \n"); //printf("transcode handle=%x\n",fConverter->fIconv390DescriptorFrom); @@ -947,7 +950,8 @@ DBGPRINTF1("Uniconv390LCPTranscoder::transcode(const char* const toTranscod bool Uniconv390LCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { DBGPRINTF1("Uniconv390LCPTranscoder::transcode(const XMLCh* const toTranscode, etc.... \n"); //printf("transcode handle=%x\n",fConverter->fIconv390DescriptorTo); diff --git a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp index 282844d95b4ba517e06aca8e6bb051b4425b7162..6cce98684938b75d0f4a0c9e7d48f7f5df63e18e 100644 --- a/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp +++ b/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp @@ -224,9 +224,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -241,6 +243,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -248,6 +251,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp b/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp index d585d126e4ecbe08206820787c8d479eef148d75..b31f4cd938f7f330b48c84abb0685f5780f00382 100644 --- a/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp +++ b/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp @@ -843,7 +843,8 @@ Win32LCPTranscoder::~Win32LCPTranscoder() // --------------------------------------------------------------------------- // Win32LCPTranscoder: Implementation of the virtual transcoder interface // --------------------------------------------------------------------------- -unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const srcText) +unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -860,7 +861,8 @@ unsigned int Win32LCPTranscoder::calcRequiredSize(const char* const srcText) } -unsigned int Win32LCPTranscoder::calcRequiredSize(const XMLCh* const srcText) +unsigned int Win32LCPTranscoder::calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager) { if (!srcText) return 0; @@ -990,7 +992,7 @@ XMLCh* Win32LCPTranscoder::transcode(const char* const toTranscode, if (*toTranscode) { // Calculate the buffer size required - const unsigned int neededLen = calcRequiredSize(toTranscode); + const unsigned int neededLen = calcRequiredSize(toTranscode, manager); if (neededLen == 0) { retVal = (XMLCh*) manager->allocate(sizeof(XMLCh)); //new XMLCh[1]; @@ -1016,7 +1018,8 @@ XMLCh* Win32LCPTranscoder::transcode(const char* const toTranscode, bool Win32LCPTranscoder::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { // Check for a couple of psycho corner cases if (!toTranscode || !maxChars) @@ -1040,7 +1043,8 @@ bool Win32LCPTranscoder::transcode( const char* const toTranscode bool Win32LCPTranscoder::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxBytes) + , const unsigned int maxBytes + , MemoryManager* const manager) { // Watch for a couple of pyscho corner cases if (!toTranscode || !maxBytes) diff --git a/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp b/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp index 7de8d3a69cc483e528201a3a34ec83f40473ba0b..a32ff15ccdef078a1b615e437d025cbd5e935210 100644 --- a/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp +++ b/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.6 2003/05/17 16:32:18 knoaman * Memory manager implementation : transcoder update. * @@ -312,9 +315,11 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual unsigned int calcRequiredSize(const char* const srcText); + virtual unsigned int calcRequiredSize(const char* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - virtual unsigned int calcRequiredSize(const XMLCh* const srcText); + virtual unsigned int calcRequiredSize(const XMLCh* const srcText + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); virtual char* transcode(const XMLCh* const toTranscode); virtual char* transcode(const XMLCh* const toTranscode, @@ -329,6 +334,7 @@ public : const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); virtual bool transcode @@ -336,6 +342,7 @@ public : const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); diff --git a/src/xercesc/util/XMLException.cpp b/src/xercesc/util/XMLException.cpp index 2faa34a9118464271086e8fabeab95a7d3153b2c..6e036fb02f8fceef19b7f838a154ab7001468712 100644 --- a/src/xercesc/util/XMLException.cpp +++ b/src/xercesc/util/XMLException.cpp @@ -172,8 +172,8 @@ XMLException::~XMLException() void XMLException::setPosition(const char* const file, const unsigned int line) { fSrcLine = line; - XMLPlatformUtils::fgMemoryManager->deallocate(fSrcFile); - fSrcFile = XMLString::replicate(file, XMLPlatformUtils::fgMemoryManager); + fMemoryManager->deallocate(fSrcFile); + fSrcFile = XMLString::replicate(file, fMemoryManager); } @@ -303,7 +303,7 @@ XMLException::loadExceptText(const XMLExcepts::Codes toLoad XMLCh errText[msgSize + 1]; // load the text - if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4)) + if (!gGetMsgLoader().loadMsg(toLoad, errText, msgSize, text1, text2, text3, text4, fMemoryManager)) { fMsg = XMLString::replicate ( diff --git a/src/xercesc/util/XMLMsgLoader.cpp b/src/xercesc/util/XMLMsgLoader.cpp index 954b12ade4bb4ee08b516b89566794f187f31ed6..dcd66c167143dc30c698f521e8144fa21335662c 100644 --- a/src/xercesc/util/XMLMsgLoader.cpp +++ b/src/xercesc/util/XMLMsgLoader.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.4 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.3 2003/05/15 19:07:46 knoaman * Partial implementation of the configurable memory manager. * @@ -116,7 +119,7 @@ void XMLMsgLoader::setLocale(const char* const localeToAdopt) if (localeToAdopt) { fLocale = XMLString::replicate(localeToAdopt, XMLPlatformUtils::fgMemoryManager); - XMLString::transcode(fLocale, fLanguage, 2); + XMLString::transcode(fLocale, fLanguage, 2, XMLPlatformUtils::fgMemoryManager); fLanguage[2] = 0; } diff --git a/src/xercesc/util/XMLMsgLoader.hpp b/src/xercesc/util/XMLMsgLoader.hpp index c51032757c640f377c4e7a68c9c544a1995ebacc..cb418788f7a0aeb4e7627b26575efcff2ca0e0ea 100644 --- a/src/xercesc/util/XMLMsgLoader.hpp +++ b/src/xercesc/util/XMLMsgLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.7 2003/12/17 00:18:35 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -105,6 +108,7 @@ #define XMLMSGLOADER_HPP #include <xercesc/util/XMemory.hpp> +#include <xercesc/util/PlatformUtils.hpp> XERCES_CPP_NAMESPACE_BEGIN @@ -163,6 +167,7 @@ public : , const XMLCh* const repText2 = 0 , const XMLCh* const repText3 = 0 , const XMLCh* const repText4 = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ) = 0; virtual bool loadMsg @@ -174,7 +179,7 @@ public : , const char* const repText2 = 0 , const char* const repText3 = 0 , const char* const repText4 = 0 - , MemoryManager* const manager = 0 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ) = 0; /** @name Locale Handling */ diff --git a/src/xercesc/util/XMLString.cpp b/src/xercesc/util/XMLString.cpp index 29d6bb47f8cc65a3c5167ea4594826698a6ae94d..4134ec04042162a5e1ecda725e9b8553231b4cc1 100644 --- a/src/xercesc/util/XMLString.cpp +++ b/src/xercesc/util/XMLString.cpp @@ -418,7 +418,8 @@ unsigned int XMLString::replaceTokens( XMLCh* const errText , const XMLCh* const text1 , const XMLCh* const text2 , const XMLCh* const text3 - , const XMLCh* const text4) + , const XMLCh* const text4 + , MemoryManager* const manager) { // // We have to build the string back into the source string, so allocate @@ -426,8 +427,8 @@ unsigned int XMLString::replaceTokens( XMLCh* const errText // incoming buffer as a target buffer. Put a janitor on it to make sure // it gets cleaned up. // - XMLCh* orgText = replicate(errText); - ArrayJanitor<XMLCh> janText(orgText); + XMLCh* orgText = replicate(errText, manager); + ArrayJanitor<XMLCh> janText(orgText, manager); XMLCh* pszSrc = orgText; unsigned int curOutInd = 0; @@ -581,9 +582,10 @@ char* XMLString::transcode(const XMLCh* const toTranscode, bool XMLString::transcode( const XMLCh* const toTranscode , char* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { - if (!gTranscoder->transcode(toTranscode, toFill, maxChars)) + if (!gTranscoder->transcode(toTranscode, toFill, maxChars, manager)) return false; return true; } @@ -601,9 +603,10 @@ XMLCh* XMLString::transcode(const char* const toTranscode, bool XMLString::transcode( const char* const toTranscode , XMLCh* const toFill - , const unsigned int maxChars) + , const unsigned int maxChars + , MemoryManager* const manager) { - if (!gTranscoder->transcode(toTranscode, toFill, maxChars)) + if (!gTranscoder->transcode(toTranscode, toFill, maxChars, manager)) return false; return true; } @@ -1583,13 +1586,14 @@ bool XMLString::isWSReplaced(const XMLCh* const toCheck) // #xA Line Feed // #x9 TAB // -void XMLString::replaceWS(XMLCh* const toConvert) +void XMLString::replaceWS(XMLCh* const toConvert + , MemoryManager* const manager) { int strLen = XMLString::stringLen(toConvert); if (strLen == 0) return; - XMLCh* retBuf = (XMLCh*) fgMemoryManager->allocate + XMLCh* retBuf = (XMLCh*) manager->allocate ( (strLen+1) * sizeof(XMLCh) );//new XMLCh[strLen+1]; @@ -1612,7 +1616,7 @@ void XMLString::replaceWS(XMLCh* const toConvert) retBuf[strLen] = chNull; XMLString::moveChars(toConvert, retBuf, strLen); - fgMemoryManager->deallocate(retBuf);//delete[] retBuf; + manager->deallocate(retBuf);//delete[] retBuf; return; } @@ -1663,14 +1667,15 @@ bool XMLString::isWSCollapsed(const XMLCh* const toCheck) // no leading and/or trailing spaces // no continuous sequences of spaces // -void XMLString::collapseWS(XMLCh* const toConvert) +void XMLString::collapseWS(XMLCh* const toConvert + , MemoryManager* const manager) { // If no string, then its a failure if (( !toConvert ) || ( !*toConvert )) return; // replace whitespace first - replaceWS(toConvert); + replaceWS(toConvert, manager); // remove leading spaces const XMLCh* startPtr = toConvert; @@ -1688,7 +1693,7 @@ void XMLString::collapseWS(XMLCh* const toConvert) // // Work through what remains and chop continuous spaces // - XMLCh* retBuf = (XMLCh*) fgMemoryManager->allocate + XMLCh* retBuf = (XMLCh*) manager->allocate ( (endPtr - startPtr + 1) * sizeof(XMLCh) );//new XMLCh[endPtr - startPtr + 1]; @@ -1721,7 +1726,7 @@ void XMLString::collapseWS(XMLCh* const toConvert) *retPtr = chNull; XMLString::moveChars(toConvert, retBuf, stringLen(retBuf)+1); //copy the last chNull as well - fgMemoryManager->deallocate(retBuf);//delete[] retBuf; + manager->deallocate(retBuf);//delete[] retBuf; return; } diff --git a/src/xercesc/util/XMLString.hpp b/src/xercesc/util/XMLString.hpp index 22b69c1dc1b767b31100fb00e281d99c06b37500..c7639ce461eb8bd8d8f7d778a9c278d4b41ba810 100644 --- a/src/xercesc/util/XMLString.hpp +++ b/src/xercesc/util/XMLString.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.23 2003/12/24 15:24:13 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.22 2003/12/17 20:00:49 cargilld * Update for memory management so that the static memory manager (one * used to call Initialize) is only for static data. @@ -1335,6 +1338,7 @@ public: const XMLCh* const toTranscode , char* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Transcodes a string to native code-page @@ -1371,6 +1375,7 @@ public: const char* const toTranscode , XMLCh* const toFill , const unsigned int maxChars + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Trims off extra space characters from the start and end of the string, @@ -1437,6 +1442,7 @@ public: , const XMLCh* const text2 , const XMLCh* const text3 , const XMLCh* const text4 + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); /** Converts a string to uppercase @@ -1465,13 +1471,15 @@ public: * @param toConvert The string which needs to be whitespace replaced. * On return , this buffer also holds the converted string */ - static void replaceWS(XMLCh* const toConvert); + static void replaceWS(XMLCh* const toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** Collapse whitespace * @param toConvert The string which needs to be whitespace collapsed. * On return , this buffer also holds the converted string */ - static void collapseWS(XMLCh* const toConvert); + static void collapseWS(XMLCh* const toConvert + , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); /** Remove whitespace * @param toConvert The string which needs to be whitespace removed. diff --git a/src/xercesc/util/regx/Op.hpp b/src/xercesc/util/regx/Op.hpp index 503211dd66a54de632584b535233ee154d033783..9b81c933215bfa3139cc849ee7451199ec8c3156 100644 --- a/src/xercesc/util/regx/Op.hpp +++ b/src/xercesc/util/regx/Op.hpp @@ -272,7 +272,7 @@ public: // Public Constructors and Destructor // ----------------------------------------------------------------------- StringOp(const short type, const XMLCh* const literal, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); - ~StringOp() { delete[] fLiteral;} + ~StringOp() { fMemoryManager->deallocate(fLiteral);} // ----------------------------------------------------------------------- // Getter functions diff --git a/src/xercesc/util/regx/RegularExpression.cpp b/src/xercesc/util/regx/RegularExpression.cpp index 9b26a54daa177015f70df0d5704901bc183d5acd..8f1f112ff54f5e9afdfdfc6ff8123dfefb93b410 100644 --- a/src/xercesc/util/regx/RegularExpression.cpp +++ b/src/xercesc/util/regx/RegularExpression.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.19 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.18 2003/12/17 05:16:59 neilg * ensure all uses of ArrayJanitor use a memory manager * @@ -180,9 +183,8 @@ RangeToken* RegularExpression::fWordRange = 0; // --------------------------------------------------------------------------- // RegularExpression::Context: Constructors and Destructor // --------------------------------------------------------------------------- -RegularExpression::Context::Context(MemoryManager* const manager) : - fInUse(false) - , fAdoptMatch(false) +RegularExpression::Context::Context(MemoryManager* const manager) : + fAdoptMatch(false) , fStart(0) , fLimit(0) , fLength(0) @@ -230,8 +232,7 @@ void RegularExpression::Context::reset(const XMLCh* const string fStart = start; fLimit = limit; - fLength = fLimit - fStart; - fInUse = true; + fLength = fLimit - fStart; if (fAdoptMatch) delete fMatch; fMatch = 0; @@ -288,7 +289,6 @@ RegularExpression::RegularExpression(const char* const pattern, fMinLength(0), fNoClosures(0), fOptions(0), - fContext(0), fBMPattern(0), fPattern(0), fFixedString(0), @@ -325,7 +325,6 @@ RegularExpression::RegularExpression(const char* const pattern, fMinLength(0), fNoClosures(0), fOptions(0), - fContext(0), fBMPattern(0), fPattern(0), fFixedString(0), @@ -364,7 +363,6 @@ RegularExpression::RegularExpression(const XMLCh* const pattern, fMinLength(0), fNoClosures(0), fOptions(0), - fContext(0), fBMPattern(0), fPattern(0), fFixedString(0), @@ -399,7 +397,6 @@ RegularExpression::RegularExpression(const XMLCh* const pattern, fMinLength(0), fNoClosures(0), fOptions(0), - fContext(0), fBMPattern(0), fPattern(0), fFixedString(0), @@ -532,28 +529,10 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, if (fOperations == 0) prepare(); - Context* context = 0; - Context* tmpContext = 0; + Context context(manager); int strLength = XMLString::stringLen(expression); - { - XMLMutexLock lockInit(&fMutex); - - if (fContext == 0) - fContext = new (fMemoryManager) Context(fMemoryManager); - - if (fContext->fInUse) { - context = new (manager) Context(manager); - tmpContext = context; - } - else { - context = fContext; - } - - context->reset(expression, strLength, start, end, fNoClosures); - } - - Janitor<Context> janContext(tmpContext); + context.reset(expression, strLength, start, end, fNoClosures); bool adoptMatch = false; Match* lMatch = pMatch; @@ -568,24 +547,22 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, adoptMatch = true; } - if (context->fAdoptMatch) - delete context->fMatch; - context->fMatch = lMatch; - context->fAdoptMatch = adoptMatch; + if (context.fAdoptMatch) + delete context.fMatch; + context.fMatch = lMatch; + context.fAdoptMatch = adoptMatch; if (isSet(fOptions, XMLSCHEMA_MODE)) { - int matchEnd = match(context, fOperations, context->fStart, 1); - - if (matchEnd == context->fLimit) { + int matchEnd = match(&context, fOperations, context.fStart, 1); - if (context->fMatch != 0) { + if (matchEnd == context.fLimit) { - context->fMatch->setStartPos(0, context->fStart); - context->fMatch->setEndPos(0, matchEnd); - } + if (context.fMatch != 0) { - context->fInUse = false; + context.fMatch->setStartPos(0, context.fStart); + context.fMatch->setEndPos(0, matchEnd); + } return true; } @@ -597,19 +574,16 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, */ if (fFixedStringOnly) { - int ret = fBMPattern->matches(expression, context->fStart, - context->fLimit); + int ret = fBMPattern->matches(expression, context.fStart, + context.fLimit); if (ret >= 0) { - if (context->fMatch != 0) { - context->fMatch->setStartPos(0, ret); - context->fMatch->setEndPos(0, ret + strLength); - } - - context->fInUse = false; + if (context.fMatch != 0) { + context.fMatch->setStartPos(0, ret); + context.fMatch->setEndPos(0, ret + strLength); + } return true; - } - context->fInUse = false; + } return false; } @@ -620,17 +594,15 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, */ if (fFixedString != 0) { - int ret = fBMPattern->matches(expression, context->fStart, - context->fLimit); + int ret = fBMPattern->matches(expression, context.fStart, + context.fLimit); if (ret < 0) { // No match - - context->fInUse = false; return false; } } - int limit = context->fLimit - fMinLength; + int limit = context.fLimit - fMinLength; int matchStart; int matchEnd = -1; @@ -641,13 +613,13 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, && fOperations->getChild()->getOpType() == Op::O_DOT) { if (isSet(fOptions, SINGLE_LINE)) { - matchStart = context->fStart; - matchEnd = match(context, fOperations, matchStart, 1); + matchStart = context.fStart; + matchEnd = match(&context, fOperations, matchStart, 1); } else { bool previousIsEOL = true; - for (matchStart=context->fStart; matchStart<=limit; matchStart++) { + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { XMLCh ch = expression[matchStart]; if (RegxUtil::isEOLChar(ch)) { @@ -656,7 +628,7 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, else { if (previousIsEOL) { - if (0 <= (matchEnd = match(context, fOperations, + if (0 <= (matchEnd = match(&context, fOperations, matchStart, 1))) break; } @@ -677,11 +649,11 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, if (ignoreCase) range = fFirstChar->getCaseInsensitiveToken(fTokenFactory); - for (matchStart=context->fStart; matchStart<=limit; matchStart++) { + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { XMLInt32 ch; - if (!context->nextCh(ch, matchStart, 1)) + if (!context.nextCh(ch, matchStart, 1)) break; if (!range->match(ch)) { @@ -694,7 +666,7 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, continue; } - if (0 <= (matchEnd = match(context,fOperations,matchStart,1))) + if (0 <= (matchEnd = match(&context,fOperations,matchStart,1))) break; } } @@ -703,9 +675,9 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, /* * Straightforward matching */ - for (matchStart=context->fStart; matchStart<=limit; matchStart++) { + for (matchStart=context.fStart; matchStart<=limit; matchStart++) { - if (0 <= (matchEnd = match(context,fOperations,matchStart,1))) + if (0 <= (matchEnd = match(&context,fOperations,matchStart,1))) break; } } @@ -713,17 +685,13 @@ bool RegularExpression::matches(const XMLCh* const expression, const int start, if (matchEnd >= 0) { - if (context->fMatch != 0) { - - context->fMatch->setStartPos(0, matchStart); - context->fMatch->setEndPos(0, matchEnd); - } + if (context.fMatch != 0) { - context->fInUse = false; + context.fMatch->setStartPos(0, matchStart); + context.fMatch->setEndPos(0, matchEnd); + } return true; } - - context->fInUse = false; return false; } @@ -769,29 +737,12 @@ RefArrayVectorOf<XMLCh>* RegularExpression::tokenize(const XMLCh* const expressi RefArrayVectorOf<XMLCh>* tokenStack = new (fMemoryManager) RefArrayVectorOf<XMLCh>(16, true, fMemoryManager); - Context* context = 0; - Context* tmpContext = 0; + Context context(fMemoryManager); int strLength = XMLString::stringLen(expression); - { - XMLMutexLock lockInit(&fMutex); - - if (fContext == 0) - fContext = new (fMemoryManager) Context(fMemoryManager); - - if (fContext->fInUse) { - context = new (fMemoryManager) Context(fMemoryManager); - tmpContext = context; - } - else { - context = fContext; - } - - context->reset(expression, strLength, start, end, fNoClosures); - } - - Janitor<Context> janContext(tmpContext); + context.reset(expression, strLength, start, end, fNoClosures); + Match* lMatch = 0; bool adoptMatch = false; @@ -802,36 +753,34 @@ RefArrayVectorOf<XMLCh>* RegularExpression::tokenize(const XMLCh* const expressi lMatch->setNoGroups(fNoGroups); } - if (context->fAdoptMatch) - delete context->fMatch; + if (context.fAdoptMatch) + delete context.fMatch; - context->fMatch = lMatch; - context->fAdoptMatch = adoptMatch; + context.fMatch = lMatch; + context.fAdoptMatch = adoptMatch; int tokStart = start; int matchStart = start; for (; matchStart <= end; matchStart++) { - int matchEnd = match(context, fOperations, matchStart, 1); + int matchEnd = match(&context, fOperations, matchStart, 1); if (matchEnd != -1) { - if (context->fMatch != 0) { - context->fMatch->setStartPos(0, context->fStart); - context->fMatch->setEndPos(0, matchEnd); + if (context.fMatch != 0) { + context.fMatch->setStartPos(0, context.fStart); + context.fMatch->setEndPos(0, matchEnd); } if (subEx){ subEx->addElement(lMatch); - lMatch = new (fMemoryManager) Match(*(context->fMatch)); + lMatch = new (fMemoryManager) Match(*(context.fMatch)); adoptMatch = true; - context->fAdoptMatch = adoptMatch; - context->fMatch = lMatch; + context.fAdoptMatch = adoptMatch; + context.fMatch = lMatch; } - - context->fInUse = false; XMLCh* token; if (tokStart == matchStart){ @@ -1676,7 +1625,7 @@ void RegularExpression::prepare() { } fBMPattern = new (fMemoryManager) BMPattern(fFixedString, 256, - isSet(fOptions, IGNORE_CASE)); + isSet(fOptions, IGNORE_CASE), fMemoryManager); } else if (!isSet(fOptions, XMLSCHEMA_MODE) && !isSet(fOptions, PROHIBIT_FIXED_STRING_OPTIMIZATION)) { diff --git a/src/xercesc/util/regx/RegularExpression.hpp b/src/xercesc/util/regx/RegularExpression.hpp index 331d6bf13077990b8183bfd387624a09c3764bfe..ba071544217e17e56d2c2b8a8d7bf634693dae56 100644 --- a/src/xercesc/util/regx/RegularExpression.hpp +++ b/src/xercesc/util/regx/RegularExpression.hpp @@ -193,8 +193,7 @@ private: void reset(const XMLCh* const string, const int stringLen, const int start, const int limit, const int noClosures); bool nextCh(XMLInt32& ch, int& offset, const short direction); - - bool fInUse; + bool fAdoptMatch; int fStart; int fLimit; @@ -323,7 +322,6 @@ private: int fMinLength; int fNoClosures; unsigned int fOptions; - Context* fContext; BMPattern* fBMPattern; XMLCh* fPattern; XMLCh* fFixedString; @@ -344,8 +342,7 @@ private: inline void RegularExpression::cleanUp() { fMemoryManager->deallocate(fPattern);//delete [] fPattern; - fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; - delete fContext; + fMemoryManager->deallocate(fFixedString);//delete [] fFixedString; delete fBMPattern; delete fTokenFactory; } diff --git a/src/xercesc/util/regx/UnionToken.cpp b/src/xercesc/util/regx/UnionToken.cpp index a88ef0898fd5053719a2cdae8b54e3cff673dd9a..e45209242cdfb421016298843cfd0649453722e8 100644 --- a/src/xercesc/util/regx/UnionToken.cpp +++ b/src/xercesc/util/regx/UnionToken.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/12/24 15:24:15 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.7 2003/12/17 00:18:37 cargilld * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data. * @@ -191,9 +194,9 @@ void UnionToken::addChild(Token* const child, TokenFactory* const tokFactory) { if (ch >= 0x10000) { - XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, XMLPlatformUtils::fgMemoryManager); + XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); stringBuf.append(chSurrogate); - XMLPlatformUtils::fgMemoryManager->deallocate(chSurrogate);//delete [] chSurrogate; + tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; } else { stringBuf.append((XMLCh) ch); @@ -212,9 +215,9 @@ void UnionToken::addChild(Token* const child, TokenFactory* const tokFactory) { if (ch >= 0x10000) { - XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, XMLPlatformUtils::fgMemoryManager); + XMLCh* chSurrogate = RegxUtil::decomposeToSurrogates(ch, tokFactory->getMemoryManager()); stringBuf.append(chSurrogate); - XMLPlatformUtils::fgMemoryManager->deallocate(chSurrogate);//delete [] chSurrogate; + tokFactory->getMemoryManager()->deallocate(chSurrogate);//delete [] chSurrogate; } else { stringBuf.append((XMLCh) ch); diff --git a/src/xercesc/validators/schema/SchemaValidator.cpp b/src/xercesc/validators/schema/SchemaValidator.cpp index 19f42d5bf3c3b54399b7ebf0ce02914ccfbd8044..2558eb5f81d3804b83bd8c445f53c1286295d36f 100644 --- a/src/xercesc/validators/schema/SchemaValidator.cpp +++ b/src/xercesc/validators/schema/SchemaValidator.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.50 2003/12/24 15:24:16 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.49 2003/12/17 05:16:59 neilg * ensure all uses of ArrayJanitor use a memory manager * @@ -1178,7 +1181,7 @@ void SchemaValidator::preContentValidation(bool reuseGrammar, baseGroup->getContentSpec(), baseGroup->getScope()); } catch (const XMLException& excep) { - fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curGroup.getLocator(), excep.getMessage()); + fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curGroup.getLocator(), excep.getMessage(), 0, 0, 0, fMemoryManager); } } @@ -1310,7 +1313,7 @@ void SchemaValidator::checkRefElementConsistency(SchemaGrammar* const currentGra && (elemDecl->getComplexTypeInfo() != other->getComplexTypeInfo() || elemDecl->getDatatypeValidator() != other->getDatatypeValidator())) { fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, - XMLUni::fgXMLErrDomain, typeInfoLocator, elemName); + XMLUni::fgXMLErrDomain, typeInfoLocator, elemName, 0, 0, 0, fMemoryManager); continue; } @@ -1332,7 +1335,7 @@ void SchemaValidator::checkRefElementConsistency(SchemaGrammar* const currentGra && (subsElem->getComplexTypeInfo() != other->getComplexTypeInfo() || subsElem->getDatatypeValidator() != other->getDatatypeValidator())) { fSchemaErrorReporter.emitError(XMLErrs::DuplicateElementDeclaration, - XMLUni::fgXMLErrDomain, typeInfoLocator, elemName); + XMLUni::fgXMLErrDomain, typeInfoLocator, elemName, 0, 0, 0, fMemoryManager); } } } @@ -1360,7 +1363,7 @@ void SchemaValidator::checkParticleDerivation(SchemaGrammar* const currentGramma baseTypeInfo->getScopeDefined(), baseTypeInfo); } catch (const XMLException& excep) { - fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curTypeInfo->getLocator(), excep.getMessage()); + fSchemaErrorReporter.emitError(XMLErrs::DisplayErrorMessage, XMLUni::fgXMLErrDomain, curTypeInfo->getLocator(), excep.getMessage(), 0, 0, 0, fMemoryManager); } } } diff --git a/src/xercesc/validators/schema/TraverseSchema.cpp b/src/xercesc/validators/schema/TraverseSchema.cpp index 84ef5d643981822185620614d77d0cf93ca90d04..e7f3d13545e289f8c7789d63bba5b89ebee614a1 100644 --- a/src/xercesc/validators/schema/TraverseSchema.cpp +++ b/src/xercesc/validators/schema/TraverseSchema.cpp @@ -8181,7 +8181,7 @@ void TraverseSchema::reportSchemaError(const XSDLocator* const aLocator, const XMLCh* const text3, const XMLCh* const text4) { - fXSDErrorReporter.emitError(errorCode, msgDomain, aLocator, text1, text2, text3, text4); + fXSDErrorReporter.emitError(errorCode, msgDomain, aLocator, text1, text2, text3, text4, fMemoryManager); } void TraverseSchema::reportSchemaError(const DOMElement* const elem, @@ -8207,7 +8207,7 @@ void TraverseSchema::reportSchemaError(const DOMElement* const elem, ((XSDElementNSImpl*) elem)->getLineNo(), ((XSDElementNSImpl*) elem)->getColumnNo()); - fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator, text1, text2, text3, text4); + fXSDErrorReporter.emitError(errorCode, msgDomain, fLocator, text1, text2, text3, text4, fMemoryManager); } // --------------------------------------------------------------------------- diff --git a/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp b/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp index ddd31debf617acdcbbd6af1ccd7bbb03ba6db050..5a4e4d1206ec9177975f5f78518b839917c440fb 100644 --- a/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp +++ b/src/xercesc/validators/schema/XMLSchemaDescriptionImpl.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/12/24 15:24:16 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.5 2003/10/17 21:17:12 peiyongz * using XTemplateSerializer * @@ -184,7 +187,7 @@ void XMLSchemaDescriptionImpl::setTriggeringComponent(QName* const trigComponent if ( fTriggeringComponent) delete fTriggeringComponent; - fTriggeringComponent = new QName(*trigComponent); + fTriggeringComponent = new (trigComponent->getMemoryManager()) QName(*trigComponent); } @@ -193,7 +196,7 @@ void XMLSchemaDescriptionImpl::setEnclosingElementName(QName* const encElement) if (fEnclosingElementName) delete fEnclosingElementName; - fEnclosingElementName = new QName(*encElement); + fEnclosingElementName = new (encElement->getMemoryManager()) QName(*encElement); } diff --git a/src/xercesc/validators/schema/XSDErrorReporter.cpp b/src/xercesc/validators/schema/XSDErrorReporter.cpp index 6eccc3bc681cef7aa0c423c296a36b938b521fd9..7b905138312fb2c3a1d86cc6e9966d3c3ad85359 100644 --- a/src/xercesc/validators/schema/XSDErrorReporter.cpp +++ b/src/xercesc/validators/schema/XSDErrorReporter.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.11 2003/12/24 15:24:16 cargilld + * More updates to memory management so that the static memory manager. + * * Revision 1.10 2003/03/09 17:05:01 peiyongz * PanicHandler * @@ -233,7 +236,8 @@ void XSDErrorReporter::emitError(const unsigned int toEmit, const XMLCh* const text1, const XMLCh* const text2, const XMLCh* const text3, - const XMLCh* const text4) + const XMLCh* const text4, + MemoryManager* const manager) { // Bump the error count if it is not a warning // if (XMLErrs::errorType(toEmit) != XMLErrorReporter::ErrType_Warning) @@ -254,7 +258,7 @@ void XSDErrorReporter::emitError(const unsigned int toEmit, msgLoader = getValidMsgLoader(); } - if (!msgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4)) + if (!msgLoader->loadMsg(toEmit, errText, maxChars, text1, text2, text3, text4, manager)) { // <TBD> Should probably load a default message here } diff --git a/src/xercesc/validators/schema/XSDErrorReporter.hpp b/src/xercesc/validators/schema/XSDErrorReporter.hpp index 0554d9f87a46c827c0f6ec98afe48b9859128ecc..72eb28ad43648c0f631965e01f4198c00b685a9c 100644 --- a/src/xercesc/validators/schema/XSDErrorReporter.hpp +++ b/src/xercesc/validators/schema/XSDErrorReporter.hpp @@ -108,7 +108,9 @@ public: const XMLCh* const text1, const XMLCh* const text2 = 0, const XMLCh* const text3 = 0, - const XMLCh* const text4 = 0); + const XMLCh* const text4 = 0, + MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager + ); private: // -----------------------------------------------------------------------