From e48800870d032c3a33138fd02d9bb930c8ad391f Mon Sep 17 00:00:00 2001 From: Alberto Massari <amassari@apache.org> Date: Mon, 23 Nov 2009 15:28:19 +0000 Subject: [PATCH] Rearrange data member to suit Borland compiler; a few conversions unsigned int -> XMLSize_t git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@883368 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/dom/impl/DOMDeepNodeListPool.c | 10 +++++----- src/xercesc/dom/impl/DOMDeepNodeListPool.hpp | 10 +++++----- src/xercesc/dom/impl/DOMDocumentImpl.cpp | 4 ++-- src/xercesc/internal/XTemplateSerializer.cpp | 6 +++--- src/xercesc/util/Hash2KeysSetOf.c | 2 +- src/xercesc/util/Hash2KeysSetOf.hpp | 2 +- src/xercesc/util/NameIdPool.c | 18 +++++++++--------- src/xercesc/util/NameIdPool.hpp | 20 ++++++++++---------- src/xercesc/util/RefHash2KeysTableOf.hpp | 2 +- src/xercesc/util/RefHash3KeysIdPool.c | 4 ++-- src/xercesc/util/RefHash3KeysIdPool.hpp | 2 +- src/xercesc/validators/DTD/DTDGrammar.hpp | 4 ++-- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/xercesc/dom/impl/DOMDeepNodeListPool.c b/src/xercesc/dom/impl/DOMDeepNodeListPool.c index 6038ff2b0..7b3521d53 100644 --- a/src/xercesc/dom/impl/DOMDeepNodeListPool.c +++ b/src/xercesc/dom/impl/DOMDeepNodeListPool.c @@ -71,11 +71,11 @@ DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus fAdoptedElems(adoptElems) , fBucketList(0) , fHashModulus(modulus) - , fHasher(hasher) , fIdPtrs(0) , fIdPtrsCount(initSize) , fIdCounter(0) , fMemoryManager(XMLPlatformUtils::fgMemoryManager) + , fHasher(hasher) { initialize(modulus); @@ -246,7 +246,7 @@ DOMDeepNodeListPool<TVal, THasher>::getByKey(const void* const key1, const XMLCh template <class TVal, class THasher> TVal* -DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId) +DOMDeepNodeListPool<TVal, THasher>::getById(const XMLSize_t elemId) { // If its either zero or beyond our current id, its an error if (!elemId || (elemId > fIdCounter)) @@ -257,7 +257,7 @@ DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId) template <class TVal, class THasher> const TVal* -DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId) const +DOMDeepNodeListPool<TVal, THasher>::getById(const XMLSize_t elemId) const { // If its either zero or beyond our current id, its an error if (!elemId || (elemId > fIdCounter)) @@ -270,7 +270,7 @@ DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId) const // DOMDeepNodeListPool: Putters // --------------------------------------------------------------------------- template <class TVal, class THasher> -unsigned int +XMLSize_t DOMDeepNodeListPool<TVal, THasher>::put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt) { // First see if the key exists already @@ -344,7 +344,7 @@ DOMDeepNodeListPool<TVal, THasher>::put(void* key1, XMLCh* key2, XMLCh* key3, TV fIdPtrs = newArray; fIdPtrsCount = newCount; } - const unsigned int retId = ++fIdCounter; + const XMLSize_t retId = ++fIdCounter; fIdPtrs[retId] = valueToAdopt; // Return the id that we gave to this element diff --git a/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp b/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp index 760d58b50..5eecc36e1 100644 --- a/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp +++ b/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp @@ -125,13 +125,13 @@ public: TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3); const TVal* getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const; - TVal* getById(const unsigned int elemId); - const TVal* getById(const unsigned int elemId) const; + TVal* getById(const XMLSize_t elemId); + const TVal* getById(const XMLSize_t elemId) const; // ----------------------------------------------------------------------- // Putters // ----------------------------------------------------------------------- - unsigned int put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt); + XMLSize_t put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt); private: @@ -184,11 +184,11 @@ private: bool fAdoptedElems; DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList; XMLSize_t fHashModulus; - THasher fHasher; TVal** fIdPtrs; XMLSize_t fIdPtrsCount; - unsigned int fIdCounter; + XMLSize_t fIdCounter; MemoryManager* fMemoryManager; + THasher fHasher; }; XERCES_CPP_NAMESPACE_END diff --git a/src/xercesc/dom/impl/DOMDocumentImpl.cpp b/src/xercesc/dom/impl/DOMDocumentImpl.cpp index 2a3f8c997..4a084e327 100644 --- a/src/xercesc/dom/impl/DOMDocumentImpl.cpp +++ b/src/xercesc/dom/impl/DOMDocumentImpl.cpp @@ -909,7 +909,7 @@ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, const XML DOMDeepNodeListImpl* retList = fNodeListPool->getByKey(rootNode, tagName, 0); if (!retList) { - int id = fNodeListPool->put((void*) rootNode, (XMLCh*) tagName, 0, new (this) DOMDeepNodeListImpl(rootNode, tagName)); + XMLSize_t id = fNodeListPool->put((void*) rootNode, (XMLCh*) tagName, 0, new (this) DOMDeepNodeListImpl(rootNode, tagName)); retList = fNodeListPool->getById(id); } @@ -928,7 +928,7 @@ DOMNodeList *DOMDocumentImpl::getDeepNodeList(const DOMNode *rootNode, //DOM DOMDeepNodeListImpl* retList = fNodeListPool->getByKey(rootNode, localName, namespaceURI); if (!retList) { // the pool will adopt the DOMDeepNodeListImpl - int id = fNodeListPool->put((void*) rootNode, (XMLCh*) localName, (XMLCh*) namespaceURI, new (this) DOMDeepNodeListImpl(rootNode, namespaceURI, localName)); + XMLSize_t id = fNodeListPool->put((void*) rootNode, (XMLCh*) localName, (XMLCh*) namespaceURI, new (this) DOMDeepNodeListImpl(rootNode, namespaceURI, localName)); retList = fNodeListPool->getById(id); } diff --git a/src/xercesc/internal/XTemplateSerializer.cpp b/src/xercesc/internal/XTemplateSerializer.cpp index 6efa277ed..b07454cd8 100644 --- a/src/xercesc/internal/XTemplateSerializer.cpp +++ b/src/xercesc/internal/XTemplateSerializer.cpp @@ -2168,7 +2168,7 @@ void XTemplateSerializer::storeObject(NameIdPool<DTDElementDecl>* const objToSto { NameIdPoolEnumerator<DTDElementDecl> e(objToStore, objToStore->getMemoryManager()); - serEng<<e.size(); + serEng<<(unsigned int)e.size(); while (e.hasMoreElements()) { @@ -2221,7 +2221,7 @@ void XTemplateSerializer::storeObject(NameIdPool<DTDEntityDecl>* const objToStor { NameIdPoolEnumerator<DTDEntityDecl> e(objToStore, objToStore->getMemoryManager()); - serEng<<e.size(); + serEng<<(unsigned int)e.size(); while (e.hasMoreElements()) { @@ -2273,7 +2273,7 @@ void XTemplateSerializer::storeObject(NameIdPool<XMLNotationDecl>* const objToSt { NameIdPoolEnumerator<XMLNotationDecl> e(objToStore, objToStore->getMemoryManager()); - serEng<<e.size(); + serEng<<(unsigned int)e.size(); while (e.hasMoreElements()) { diff --git a/src/xercesc/util/Hash2KeysSetOf.c b/src/xercesc/util/Hash2KeysSetOf.c index c929100a1..607a8b7a8 100644 --- a/src/xercesc/util/Hash2KeysSetOf.c +++ b/src/xercesc/util/Hash2KeysSetOf.c @@ -62,8 +62,8 @@ Hash2KeysSetOf<THasher>::Hash2KeysSetOf( , fBucketList(0) , fHashModulus(modulus) , fCount(0) - , fHasher (hasher) , fAvailable(0) + , fHasher (hasher) { initialize(modulus); } diff --git a/src/xercesc/util/Hash2KeysSetOf.hpp b/src/xercesc/util/Hash2KeysSetOf.hpp index 29aa102e9..5fb86f430 100644 --- a/src/xercesc/util/Hash2KeysSetOf.hpp +++ b/src/xercesc/util/Hash2KeysSetOf.hpp @@ -135,8 +135,8 @@ private: Hash2KeysSetBucketElem** fBucketList; XMLSize_t fHashModulus; XMLSize_t fCount; - THasher fHasher; Hash2KeysSetBucketElem* fAvailable; + THasher fHasher; }; diff --git a/src/xercesc/util/NameIdPool.c b/src/xercesc/util/NameIdPool.c index 0cd454ac3..022d15452 100644 --- a/src/xercesc/util/NameIdPool.c +++ b/src/xercesc/util/NameIdPool.c @@ -39,14 +39,14 @@ XERCES_CPP_NAMESPACE_BEGIN // NameIdPool: Constructors and Destructor // --------------------------------------------------------------------------- template <class TElem> -NameIdPool<TElem>::NameIdPool( const unsigned int hashModulus - , const unsigned int initSize +NameIdPool<TElem>::NameIdPool( const XMLSize_t hashModulus + , const XMLSize_t initSize , MemoryManager* const manager) : fMemoryManager(manager) - , fBucketList(hashModulus, manager) , fIdPtrs(0) , fIdPtrsCount(initSize) , fIdCounter(0) + , fBucketList(hashModulus, manager) { if (!hashModulus) ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Pool_ZeroModulus, fMemoryManager); @@ -119,7 +119,7 @@ getByKey(const XMLCh* const key) const template <class TElem> inline TElem* NameIdPool<TElem>:: -getById(const unsigned int elemId) +getById(const XMLSize_t elemId) { // If its either zero or beyond our current id, its an error if (!elemId || (elemId > fIdCounter)) @@ -130,7 +130,7 @@ getById(const unsigned int elemId) template <class TElem> inline const TElem* NameIdPool<TElem>:: -getById(const unsigned int elemId) const +getById(const XMLSize_t elemId) const { // If its either zero or beyond our current id, its an error if (!elemId || (elemId > fIdCounter)) @@ -149,7 +149,7 @@ inline MemoryManager* NameIdPool<TElem>::getMemoryManager() const // NameIdPool: Setters // --------------------------------------------------------------------------- template <class TElem> -unsigned int NameIdPool<TElem>::put(TElem* const elemToAdopt) +XMLSize_t NameIdPool<TElem>::put(TElem* const elemToAdopt) { // First see if the key exists already. If so, its an error if(containsKey(elemToAdopt->getKey())) @@ -172,7 +172,7 @@ unsigned int NameIdPool<TElem>::put(TElem* const elemToAdopt) if (fIdCounter + 1 == fIdPtrsCount) { // Create a new count 1.5 times larger and allocate a new array - unsigned int newCount = (unsigned int)(fIdPtrsCount * 1.5); + XMLSize_t newCount = (XMLSize_t)(fIdPtrsCount * 1.5); TElem** newArray = (TElem**) fMemoryManager->allocate ( newCount * sizeof(TElem*) @@ -186,7 +186,7 @@ unsigned int NameIdPool<TElem>::put(TElem* const elemToAdopt) fIdPtrs = newArray; fIdPtrsCount = newCount; } - const unsigned int retId = ++fIdCounter; + const XMLSize_t retId = ++fIdCounter; fIdPtrs[retId] = elemToAdopt; // Set the id on the passed element @@ -276,7 +276,7 @@ template <class TElem> void NameIdPoolEnumerator<TElem>::Reset() fCurIndex = fToEnum->fIdCounter ? 1:0; } -template <class TElem> unsigned int NameIdPoolEnumerator<TElem>::size() const +template <class TElem> XMLSize_t NameIdPoolEnumerator<TElem>::size() const { return fToEnum->fIdCounter; } diff --git a/src/xercesc/util/NameIdPool.hpp b/src/xercesc/util/NameIdPool.hpp index e818487f8..bb62e8c82 100644 --- a/src/xercesc/util/NameIdPool.hpp +++ b/src/xercesc/util/NameIdPool.hpp @@ -67,8 +67,8 @@ public : // ----------------------------------------------------------------------- NameIdPool ( - const unsigned int hashModulus - , const unsigned int initSize = 128 + const XMLSize_t hashModulus + , const XMLSize_t initSize = 128 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); @@ -87,8 +87,8 @@ public : // ----------------------------------------------------------------------- TElem* getByKey(const XMLCh* const key); const TElem* getByKey(const XMLCh* const key) const; - TElem* getById(const unsigned int elemId); - const TElem* getById(const unsigned int elemId) const; + TElem* getById(const XMLSize_t elemId); + const TElem* getById(const XMLSize_t elemId) const; MemoryManager* getMemoryManager() const; // ----------------------------------------------------------------------- @@ -97,7 +97,7 @@ public : // Dups are not allowed and cause an IllegalArgumentException. The id // of the new element is returned. // ----------------------------------------------------------------------- - unsigned int put(TElem* const valueToAdopt); + XMLSize_t put(TElem* const valueToAdopt); protected : @@ -136,10 +136,10 @@ private : // // ----------------------------------------------------------------------- MemoryManager* fMemoryManager; - RefHashTableOf<TElem> fBucketList; TElem** fIdPtrs; - unsigned int fIdPtrsCount; - unsigned int fIdCounter; + XMLSize_t fIdPtrsCount; + XMLSize_t fIdCounter; + RefHashTableOf<TElem> fBucketList; }; @@ -180,7 +180,7 @@ public : bool hasMoreElements() const; TElem& nextElement(); void Reset(); - unsigned int size() const; + XMLSize_t size() const; private : // ----------------------------------------------------------------------- @@ -193,7 +193,7 @@ private : // fToEnum // The name id pool that is being enumerated. // ----------------------------------------------------------------------- - unsigned int fCurIndex; + XMLSize_t fCurIndex; NameIdPool<TElem>* fToEnum; MemoryManager* fMemoryManager; }; diff --git a/src/xercesc/util/RefHash2KeysTableOf.hpp b/src/xercesc/util/RefHash2KeysTableOf.hpp index d808abb8b..d2639e8cc 100644 --- a/src/xercesc/util/RefHash2KeysTableOf.hpp +++ b/src/xercesc/util/RefHash2KeysTableOf.hpp @@ -170,7 +170,7 @@ private: RefHash2KeysTableBucketElem<TVal>** fBucketList; XMLSize_t fHashModulus; XMLSize_t fCount; - THasher fHasher; + THasher fHasher; }; diff --git a/src/xercesc/util/RefHash3KeysIdPool.c b/src/xercesc/util/RefHash3KeysIdPool.c index ddcba863a..4fdd59524 100644 --- a/src/xercesc/util/RefHash3KeysIdPool.c +++ b/src/xercesc/util/RefHash3KeysIdPool.c @@ -73,10 +73,10 @@ RefHash3KeysIdPool<TVal, THasher>::RefHash3KeysIdPool( , fAdoptedElems(true) , fBucketList(0) , fHashModulus(modulus) - , fHasher(hasher) , fIdPtrs(0) , fIdPtrsCount(initSize) , fIdCounter(0) + , fHasher(hasher) { initialize(modulus); @@ -130,10 +130,10 @@ RefHash3KeysIdPool<TVal, THasher>::RefHash3KeysIdPool( , fAdoptedElems(adoptElems) , fBucketList(0) , fHashModulus(modulus) - , fHasher(hasher) , fIdPtrs(0) , fIdPtrsCount(initSize) , fIdCounter(0) + , fHasher(hasher) { initialize(modulus); diff --git a/src/xercesc/util/RefHash3KeysIdPool.hpp b/src/xercesc/util/RefHash3KeysIdPool.hpp index e1dd5b82c..666abebfc 100644 --- a/src/xercesc/util/RefHash3KeysIdPool.hpp +++ b/src/xercesc/util/RefHash3KeysIdPool.hpp @@ -196,10 +196,10 @@ private: bool fAdoptedElems; RefHash3KeysTableBucketElem<TVal>** fBucketList; XMLSize_t fHashModulus; - THasher fHasher; TVal** fIdPtrs; XMLSize_t fIdPtrsCount; XMLSize_t fIdCounter; + THasher fHasher; }; diff --git a/src/xercesc/validators/DTD/DTDGrammar.hpp b/src/xercesc/validators/DTD/DTDGrammar.hpp index f87c49a4a..391613e01 100644 --- a/src/xercesc/validators/DTD/DTDGrammar.hpp +++ b/src/xercesc/validators/DTD/DTDGrammar.hpp @@ -163,7 +163,7 @@ public: // ----------------------------------------------------------------------- // Content management methods // ----------------------------------------------------------------------- - unsigned int putEntityDecl(DTDEntityDecl* const entityDecl) const; + XMLSize_t putEntityDecl(DTDEntityDecl* const entityDecl) const; /*** * Support for Serialization/De-serialization @@ -275,7 +275,7 @@ inline const NameIdPool<DTDEntityDecl>* DTDGrammar::getEntityDeclPool() const // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- -inline unsigned int DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl) const +inline XMLSize_t DTDGrammar::putEntityDecl(DTDEntityDecl* const entityDecl) const { return fEntityDeclPool->put(entityDecl); } -- GitLab