Index: runtime/lib/double.cc |
diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc |
index 3fc2261b843032288b3fd21b80eb455fe6692767..abe5df2ea2b2f754641ea90a9351202ec96d5ca3 100644 |
--- a/runtime/lib/double.cc |
+++ b/runtime/lib/double.cc |
@@ -221,9 +221,8 @@ DEFINE_NATIVE_ENTRY(Double_parse, 1) { |
} |
} |
if (dot_ok) { |
- char* p_end = NULL; |
- const double double_value = strtod(cstr, &p_end); |
- if (p_end == (cstr + len)) { |
+ double double_value; |
+ if (CStringToDouble(cstr, len, &double_value)) { |
return Double::New(double_value); |
} |
} |
@@ -238,10 +237,14 @@ DEFINE_NATIVE_ENTRY(Double_parse, 1) { |
Token::kDOUBLE, |
&is_positive, |
&number_string)) { |
+ ASSERT(number_string->IsOneByteString()); |
Ivan Posva
2013/04/05 21:56:42
Please explain here why you are allowed to make th
Vyacheslav Egorov (Google)
2013/04/08 14:25:04
Done.
|
const char* cstr = number_string->ToCString(); |
- char* p_end = NULL; |
- double double_value = strtod(cstr, &p_end); |
- ASSERT(p_end != cstr); |
+ |
+ double double_value; |
+ bool ok = CStringToDouble(cstr, number_string->Length(), &double_value); |
+ USE(ok); |
Ivan Posva
2013/04/05 21:56:42
I would have thought USE is not necessary here.
Vyacheslav Egorov (Google)
2013/04/08 14:25:04
Done.
|
+ ASSERT(ok); |
+ |
if (!is_positive) { |
double_value = -double_value; |
} |