From 2c9b57853937c7ba7f32b0a48abb18366fd87003 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Wed, 4 Dec 2002 04:43:30 +0000 Subject: [PATCH] Go back to PR_strtod since strtod does different things in different locales. b=183211 sr=bzbarsky r=caillon git-svn-id: svn://10.0.0.236/trunk@134774 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsString.cpp | 3 ++- mozilla/string/obsolete/nsString2.cpp | 3 ++- mozilla/xpcom/string/obsolete/nsString.cpp | 3 ++- mozilla/xpcom/string/obsolete/nsString2.cpp | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 6c018e19337..f0dccbcf085 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -468,7 +468,8 @@ float nsCString::ToFloat(PRInt32* aErrorCode) const { if (mLength > 0) { char *conv_stopped; const char *str = get(); - res = (float)strtod(str, &conv_stopped); + // Use PR_strtod, not strtod, since we don't want locale involved. + res = (float)PR_strtod(str, &conv_stopped); if (conv_stopped == str+mLength) { *aErrorCode = (PRInt32) NS_OK; } diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index a696fe432f2..7a34069e063 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -541,7 +541,8 @@ float nsString::ToFloat(PRInt32* aErrorCode) const { if (mLength > 0 && mLength < sizeof(buf)) { char *conv_stopped; const char *str = ToCString(buf, sizeof(buf)); - res = (float)strtod(str, &conv_stopped); + // Use PR_strtod, not strtod, since we don't want locale involved. + res = (float)PR_strtod(str, &conv_stopped); if (*conv_stopped == '\0') { *aErrorCode = (PRInt32) NS_OK; } diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 6c018e19337..f0dccbcf085 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -468,7 +468,8 @@ float nsCString::ToFloat(PRInt32* aErrorCode) const { if (mLength > 0) { char *conv_stopped; const char *str = get(); - res = (float)strtod(str, &conv_stopped); + // Use PR_strtod, not strtod, since we don't want locale involved. + res = (float)PR_strtod(str, &conv_stopped); if (conv_stopped == str+mLength) { *aErrorCode = (PRInt32) NS_OK; } diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp index a696fe432f2..7a34069e063 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.cpp +++ b/mozilla/xpcom/string/obsolete/nsString2.cpp @@ -541,7 +541,8 @@ float nsString::ToFloat(PRInt32* aErrorCode) const { if (mLength > 0 && mLength < sizeof(buf)) { char *conv_stopped; const char *str = ToCString(buf, sizeof(buf)); - res = (float)strtod(str, &conv_stopped); + // Use PR_strtod, not strtod, since we don't want locale involved. + res = (float)PR_strtod(str, &conv_stopped); if (*conv_stopped == '\0') { *aErrorCode = (PRInt32) NS_OK; }