Bug 304968 - nodes of type xsd:decimal in ]-1;1[ interval are always invalid. r/sr=peterv

This commit is contained in:
doronr%us.ibm.com 2005-10-14 16:47:34 +00:00
Родитель 3f210c19ee
Коммит 74f7120fc2
1 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -1324,12 +1324,13 @@ nsSchemaValidatorUtils::RemoveLeadingZeros(nsAString & aString)
aString.EndReading(end);
PRBool done = PR_FALSE;
PRUint32 count = 0, indexstart=0;
PRUint32 count = 0, indexstart = 0;
if(*start == '+' || *start == '-'){
if (*start == '+' || *start == '-') {
start++;
indexstart = 1;
}
while ((start != end) && !done)
{
if (*start++ == '0') {
@ -1339,8 +1340,15 @@ nsSchemaValidatorUtils::RemoveLeadingZeros(nsAString & aString)
}
}
// finally, remove the leading zeros
aString.Cut(indexstart, count);
PRUint32 length = aString.Length();
// if the entire string is composed of zeros, set it to one zero
if (length == count) {
aString.AssignLiteral("0");
} else {
// finally, remove the leading zeros
aString.Cut(indexstart, count);
}
}
void
@ -1366,7 +1374,7 @@ nsSchemaValidatorUtils::RemoveTrailingZeros(nsAString & aString)
}
}
// finally, remove the leading zeros
// finally, remove the trailing zeros
aString.Cut(length - count, count);
}