You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by bo...@apache.org on 2008/07/15 12:19:59 UTC
svn commit: r676858 -
/xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
Author: borisk
Date: Tue Jul 15 03:19:58 2008
New Revision: 676858
URL: http://svn.apache.org/viewvc?rev=676858&view=rev
Log:
Use sufficiently large element type for conflictTable in order to contain
all possible values (gInvalidTrans is unsigned int). Use gInvalidTrans
instead of -1.
Modified:
xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
Modified: xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp?rev=676858&r1=676857&r2=676858&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp Tue Jul 15 03:19:58 2008
@@ -151,7 +151,7 @@
//
if (!childCount)
{
- // success
+ // success
if(fEmptyOk)
return true;
*indexFailingChild=0;
@@ -253,7 +253,7 @@
if (++loopCount > (unsigned int)o->maxOccurs && o->maxOccurs != -1) {
*indexFailingChild=childIndex;
return false;
- }
+ }
}
else if (loopCount < (unsigned int)o->minOccurs) {
// not enough loops on the current state.
@@ -274,7 +274,7 @@
if (o != 0) {
// Entering a new counting state. Reset the counter.
// If we've already seen one instance of the looping
- // particle set the counter to 1, otherwise set it
+ // particle set the counter to 1, otherwise set it
// to 0.
loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
}
@@ -415,7 +415,7 @@
if (++loopCount > (unsigned int)o->maxOccurs && o->maxOccurs != -1) {
*indexFailingChild=childIndex;
return false;
- }
+ }
}
else if (loopCount < (unsigned int)o->minOccurs) {
// not enough loops on the current state.
@@ -436,7 +436,7 @@
if (o != 0) {
// Entering a new counting state. Reset the counter.
// If we've already seen one instance of the looping
- // particle set the counter to 1, otherwise set it
+ // particle set the counter to 1, otherwise set it
// to 0.
loopCount = (elemIndex == o->elemIndex) ? 1 : 0;
}
@@ -964,7 +964,7 @@
fTransTableSize = curState;
//
- // Fill in the occurence information for each looping state
+ // Fill in the occurence information for each looping state
// if we're using counters.
//
if (elemOccurenceMap != 0) {
@@ -1341,18 +1341,18 @@
// Unique Particle Attribution
// store the conflict results between any two elements in fElemMap
// XMLContentModel::gInvalidTrans: not compared; 0: no conflict; 1: conflict
- XMLByte** conflictTable = (XMLByte**) fMemoryManager->allocate
+ unsigned int** conflictTable = (unsigned int**) fMemoryManager->allocate
(
- fElemMapSize * sizeof(XMLByte*)
- ); //new unsigned int*[fElemMapSize];
+ fElemMapSize * sizeof(unsigned int*)
+ );
// initialize the conflict table
for (j = 0; j < fElemMapSize; j++) {
- conflictTable[j] = (XMLByte*) fMemoryManager->allocate
+ conflictTable[j] = (unsigned int*) fMemoryManager->allocate
(
- fElemMapSize * sizeof(XMLByte)
- ); //new unsigned int[fElemMapSize];
- memset(conflictTable[j], 0, fElemMapSize*sizeof(XMLByte));
+ fElemMapSize * sizeof(unsigned int)
+ );
+ memset(conflictTable[j], 0, fElemMapSize*sizeof(unsigned int));
}
// for each state, check whether it has overlap transitions
@@ -1380,10 +1380,10 @@
// If "i" is a counting state and exactly one of the transitions
// loops back to "i" then the two particles do not overlap if
// minOccurs == maxOccurs.
- if (o != 0 &&
- ((fTransTable[i][j] == i) ^ (fTransTable[i][k] == i)) &&
+ if (o != 0 &&
+ ((fTransTable[i][j] == i) ^ (fTransTable[i][k] == i)) &&
o->minOccurs == o->maxOccurs) {
- conflictTable[j][k] = -1;
+ conflictTable[j][k] = XMLContentModel::gInvalidTrans;
continue;
}
}
@@ -1413,15 +1413,15 @@
buf2.getRawBuffer());
}
else
- conflictTable[j][k] = -1;
+ conflictTable[j][k] = XMLContentModel::gInvalidTrans;
}
}
}
}
for (i = 0; i < fElemMapSize; i++)
- fMemoryManager->deallocate(conflictTable[i]); //delete [] conflictTable[i];
- fMemoryManager->deallocate(conflictTable); //delete [] conflictTable;
+ fMemoryManager->deallocate(conflictTable[i]);
+ fMemoryManager->deallocate(conflictTable);
}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org