dbertoni 00/10/04 11:00:04
Modified: c/src/XSLT ElemNumber.cpp
Log:
Fixed bugs with trying to access an empty vector.
Revision Changes Path
1.26 +26 -12 xml-xalan/c/src/XSLT/ElemNumber.cpp
Index: ElemNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemNumber.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ElemNumber.cpp 2000/10/03 22:04:56 1.25
+++ ElemNumber.cpp 2000/10/04 18:00:02 1.26
@@ -694,17 +694,27 @@
XalanDOMString leaderStr;
XalanDOMString trailerStr;
StringVectorTypeIterator it;
- it = tokenVector.begin();
- if(! isLetterOrDigit(charAt((*it), 0)))
- {
- leaderStr = *it;
- tokenVector.erase(it);
- }
- it = tokenVector.end()-1;
- if(! isLetterOrDigit(charAt((*it), 0)))
+
+ if (tokenVector.size() > 0)
{
- trailerStr = *it;
- tokenVector.erase(it);
+ it = tokenVector.begin();
+
+ if(!isLetterOrDigit(charAt(*it, 0)))
+ {
+ leaderStr = *it;
+ tokenVector.erase(it);
+ }
+
+ if (tokenVector.size() > 0)
+ {
+ it = tokenVector.end() - 1;
+
+ if(!isLetterOrDigit(charAt(*it, 0)))
+ {
+ trailerStr = *it;
+ tokenVector.erase(it);
+ }
+ }
}
// Now we're left with a sequence of alpha,non-alpha tokens, format them
@@ -716,14 +726,18 @@
{
if (it != tokenVector.end())
{
- assert(isLetterOrDigit(charAt((*it), 0)));
+ // $$$ ToDo: This assert is commented out until we get
+ // out character classification problems fixed.
+ // assert(isLetterOrDigit(charAt((*it), 0)));
formatToken = *it++;
numberWidth = length(formatToken);
numberType = charAt(formatToken, numberWidth - 1);
}
if (it != tokenVector.end())
{
- assert(!isLetterOrDigit(charAt((*it), 0)));
+ // $$$ ToDo: This assert is commented out until we get
+ // out character classification problems fixed.
+ //assert(!isLetterOrDigit(charAt((*it), 0)));
sepString = *it++;
}
formattedNumber += getFormattedNumber(executionContext,
contextNode,