You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2008/02/27 12:57:42 UTC
svn commit: r631566 - in /xerces/c/trunk/src/xercesc:
util/RefHash3KeysIdPool.c validators/schema/TraverseSchema.cpp
Author: cargilld
Date: Wed Feb 27 03:57:24 2008
New Revision: 631566
URL: http://svn.apache.org/viewvc?rev=631566&view=rev
Log:
Fix problem with collision in RefHash3KeysIdPool
Modified:
xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
Modified: xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c?rev=631566&r1=631565&r2=631566&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c Wed Feb 27 03:57:24 2008
@@ -281,6 +281,7 @@
{
// First see if the key exists already
unsigned int hashVal;
+ unsigned int retId;
RefHash3KeysTableBucketElem<TVal>* newBucket = findBucketElem(key1, key2, key3, hashVal);
//
@@ -289,6 +290,7 @@
//
if (newBucket)
{
+ retId = newBucket->fData->getId();
if (fAdoptedElems)
delete newBucket->fData;
newBucket->fData = valueToAdopt;
@@ -296,7 +298,7 @@
newBucket->fKey2 = key2;
newBucket->fKey3 = key3;
}
- else
+ else
{
// Revisit: the gcc compiler 2.95.x is generating an
// internal compiler error message. So we use the default
@@ -308,31 +310,32 @@
new (fMemoryManager->allocate(sizeof(RefHash3KeysTableBucketElem<TVal>)))
RefHash3KeysTableBucketElem<TVal>(key1, key2, key3, valueToAdopt, fBucketList[hashVal]);
#endif
- fBucketList[hashVal] = newBucket;
- }
+ fBucketList[hashVal] = newBucket;
- //
- // Give this new one the next available id and add to the pointer list.
- // Expand the list if that is now required.
- //
- 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);
- TVal** newArray = (TVal**) fMemoryManager->allocate
- (
- newCount * sizeof(TVal*)
- ); //new TVal*[newCount];
+ //
+ // Give this new one the next available id and add to the pointer list.
+ // Expand the list if that is now required.
+ //
+ 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);
+ TVal** newArray = (TVal**) fMemoryManager->allocate
+ (
+ newCount * sizeof(TVal*)
+ ); //new TVal*[newCount];
- // Copy over the old contents to the new array
- memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*));
+ // Copy over the old contents to the new array
+ memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*));
- // Ok, toss the old array and store the new data
- fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
- fIdPtrs = newArray;
- fIdPtrsCount = newCount;
+ // Ok, toss the old array and store the new data
+ fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
+ fIdPtrs = newArray;
+ fIdPtrsCount = newCount;
+ }
+ retId = ++fIdCounter;
}
- const unsigned int retId = ++fIdCounter;
+
fIdPtrs[retId] = valueToAdopt;
// Set the id on the passed element
Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=631566&r1=631565&r2=631566&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Wed Feb 27 03:57:24 2008
@@ -7491,7 +7491,7 @@
int elemURI = elemDecl->getURI();
const XMLCh* localPart = elemDecl->getBaseName();
const SchemaElementDecl* other = (SchemaElementDecl*)
- fSchemaGrammar->getElemDecl(elemURI, localPart, 0, fCurrentScope);
+ fSchemaGrammar->getElemDecl(elemURI, localPart, 0, newScope);
if (other) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org