Index: src/inspector/string-16.cc |
diff --git a/src/inspector/string-16.cc b/src/inspector/string-16.cc |
index 2847e7bd61097389da87f32b58a5e2b82fe4ce69..6544646d71580caf6b9fb8f5482102d81a102a4d 100644 |
--- a/src/inspector/string-16.cc |
+++ b/src/inspector/string-16.cc |
@@ -8,13 +8,11 @@ |
#include <cctype> |
#include <cstdlib> |
#include <cstring> |
-#include <iomanip> |
#include <limits> |
-#include <locale> |
-#include <sstream> |
#include <string> |
#include "src/base/platform/platform.h" |
+#include "src/conversions.h" |
namespace v8_inspector { |
@@ -366,10 +364,9 @@ static inline void putUTF8Triple(char*& buffer, UChar ch) { |
// static |
String16 String16::fromInteger(int number) { |
- const size_t kBufferSize = 50; |
- char buffer[kBufferSize]; |
- v8::base::OS::SNPrintF(buffer, kBufferSize, "%d", number); |
- return String16(buffer); |
+ char arr[50]; |
+ v8::internal::Vector<char> buffer(arr, arraysize(arr)); |
+ return String16(IntToCString(number, buffer)); |
} |
// static |
@@ -386,19 +383,16 @@ String16 String16::fromInteger(size_t number) { |
// static |
String16 String16::fromDouble(double number) { |
- std::ostringstream s; |
- s.imbue(std::locale("C")); |
- s << std::fixed << std::setprecision(std::numeric_limits<double>::digits10) |
- << number; |
- return String16(s.str().c_str()); |
+ char arr[50]; |
+ v8::internal::Vector<char> buffer(arr, arraysize(arr)); |
+ return String16(DoubleToCString(number, buffer)); |
} |
// static |
String16 String16::fromDouble(double number, int precision) { |
- std::ostringstream s; |
- s.imbue(std::locale("C")); |
- s << std::fixed << std::setprecision(precision) << number; |
- return String16(s.str().c_str()); |
+ std::unique_ptr<char[]> str( |
+ v8::internal::DoubleToPrecisionCString(number, precision)); |
+ return String16(str.get()); |
} |
int String16::toInteger(bool* ok) const { |