From 1e824d81bce599e7185b3249b75210c02e3a0e63 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Tue, 15 Jun 1999 02:03:33 +0000 Subject: [PATCH] more error reporting in ToInteger() git-svn-id: svn://10.0.0.236/trunk@35316 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsString2.cpp | 21 +++++++++++++++------ mozilla/xpcom/ds/nsString2.cpp | 21 +++++++++++++++------ mozilla/xpcom/string/obsolete/nsString2.cpp | 21 +++++++++++++++------ 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index 72e0364b518..12fbce19122 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -756,7 +756,7 @@ PRInt32 GetNumericSubstring(nsString2& aString,PRUint32& aRadix) { else if((*cp>='A') && (*cp<='F')) { continue; } - else if((*cp>='-') || (*cp>='+')){ + else if((*cp=='-') || (*cp=='+')){ break; } else { @@ -794,13 +794,17 @@ PRInt32 nsString2::ToInteger(PRInt32* anErrorCode) const { ********************************************************************************/ //copy chars to local buffer -- step down from 2 bytes to 1 if necessary... - nsAutoString2 theString(*this,eOneByte); - PRUint32 theRadix=10; - PRInt32 result=GetNumericSubstring(theString,theRadix); + PRInt32 result=0; + if(0='A') && (*cp<='F')) { continue; } - else if((*cp>='-') || (*cp>='+')){ + else if((*cp=='-') || (*cp=='+')){ break; } else { @@ -794,13 +794,17 @@ PRInt32 nsString2::ToInteger(PRInt32* anErrorCode) const { ********************************************************************************/ //copy chars to local buffer -- step down from 2 bytes to 1 if necessary... - nsAutoString2 theString(*this,eOneByte); - PRUint32 theRadix=10; - PRInt32 result=GetNumericSubstring(theString,theRadix); + PRInt32 result=0; + if(0='A') && (*cp<='F')) { continue; } - else if((*cp>='-') || (*cp>='+')){ + else if((*cp=='-') || (*cp=='+')){ break; } else { @@ -794,13 +794,17 @@ PRInt32 nsString2::ToInteger(PRInt32* anErrorCode) const { ********************************************************************************/ //copy chars to local buffer -- step down from 2 bytes to 1 if necessary... - nsAutoString2 theString(*this,eOneByte); - PRUint32 theRadix=10; - PRInt32 result=GetNumericSubstring(theString,theRadix); + PRInt32 result=0; + if(0