fixed ToInteger (again) and eliminate bug 8140

git-svn-id: svn://10.0.0.236/trunk@35810 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
1999-06-17 19:15:57 +00:00
parent daf6861e60
commit 9972377ad2
3 changed files with 15 additions and 12 deletions

View File

@@ -796,14 +796,15 @@ PRInt32 nsString2::ToInteger(PRInt32* anErrorCode,PRUint32 aRadix) const {
//copy chars to local buffer -- step down from 2 bytes to 1 if necessary...
nsAutoString2 theString(*this,eOneByte);
PRUint32 theRadix=aRadix;
PRInt32 result=GetNumericSubstring(theString,theRadix); //we actually don't use this radix; use given radix instead
if(NS_OK==result){
PRInt32 result=0;
*anErrorCode=GetNumericSubstring(theString,theRadix); //we actually don't use this radix; use given radix instead
if(NS_OK==*anErrorCode){
if(kAutoDetect==aRadix)
aRadix=theRadix;
if((kRadix10==aRadix) || (kRadix16==aRadix))
result=_ToInteger(theString,anErrorCode,aRadix); //note we use the given radix, not the computed one.
else result=NS_ERROR_ILLEGAL_VALUE;
else *anErrorCode=NS_ERROR_ILLEGAL_VALUE;
}
return result;