Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: runtime/vm/double_conversion.cc

Issue 13529014: Use locale insensitive method to parse double literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Srdjan's comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/double_conversion.cc
diff --git a/runtime/vm/double_conversion.cc b/runtime/vm/double_conversion.cc
index 7f5b07211680febedfc3dd1f91341c9bd8443345..44233febbd128005bce94138c08a9804e04e1aeb 100644
--- a/runtime/vm/double_conversion.cc
+++ b/runtime/vm/double_conversion.cc
@@ -166,4 +166,25 @@ RawString* DoubleToStringAsPrecision(double d, int precision) {
return String::New(builder.Finalize());
}
+
+bool CStringToDouble(const char* str, intptr_t length, double* result) {
+ if (length == 0) {
+ return false;
+ }
+
+ double_conversion::StringToDoubleConverter converter(
+ double_conversion::StringToDoubleConverter::NO_FLAGS,
+ 0.0,
+ 0.0,
+ kDoubleToStringCommonInfinitySymbol,
+ kDoubleToStringCommonNaNSymbol);
+
+ int parsed_count = 0;
+ *result = converter.StringToDouble(str,
+ static_cast<int>(length),
+ &parsed_count);
+ return (parsed_count == length);
+}
+
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698