| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 858f66e commit 902bb85
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,14 +71,14 @@ String StringViewToUtf8(v8_inspector::StringView view) { | |||
| 71 | 71 | ||
| 72 | 72 | String fromDouble(double d) { | |
| 73 | 73 | std::ostringstream stream; | |
| 74 | - stream.imbue(std::locale("C")); // Ignore locale | ||
| 74 | + stream.imbue(std::locale::classic()); // Ignore current locale | ||
| 75 | 75 | stream << d; | |
| 76 | 76 | return stream.str(); | |
| 77 | 77 | } | |
| 78 | 78 | ||
| 79 | 79 | double toDouble(const char* buffer, size_t length, bool* ok) { | |
| 80 | 80 | std::istringstream stream(std::string(buffer, length)); | |
| 81 | - stream.imbue(std::locale("C")); // Ignore locale | ||
| 81 | + stream.imbue(std::locale::classic()); // Ignore current locale | ||
| 82 | 82 | double d; | |
| 83 | 83 | stream >> d; | |
| 84 | 84 | *ok = !stream.fail(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,7 +94,7 @@ std::string DoubleToCString(double v) { | |||
| 94 | 94 | default: | |
| 95 | 95 | // This is a far less sophisticated version than the one used inside v8. | |
| 96 | 96 | std::ostringstream stream; | |
| 97 | - stream.imbue(std::locale("C")); // Ignore locale | ||
| 97 | + stream.imbue(std::locale::classic()); // Ignore current locale | ||
| 98 | 98 | stream << v; | |
| 99 | 99 | return stream.str(); | |
| 100 | 100 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | 27 | #include <cmath> | |
| 28 | 28 | #include <cstring> | |
| 29 | + #include <locale> | ||
| 29 | 30 | #include "util.h" | |
| 30 | 31 | ||
| 31 | 32 | // These are defined by <sys/byteorder.h> or <netinet/in.h> on some systems. | |
@@ -274,7 +275,7 @@ void SwapBytes64(char* data, size_t nbytes) { | |||
| 274 | 275 | } | |
| 275 | 276 | ||
| 276 | 277 | char ToLower(char c) { | |
| 277 | - return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c; | ||
| 278 | + return std::tolower(c, std::locale::classic()); | ||
| 278 | 279 | } | |
| 279 | 280 | ||
| 280 | 281 | std::string ToLower(const std::string& in) { | |
@@ -285,7 +286,7 @@ std::string ToLower(const std::string& in) { | |||
| 285 | 286 | } | |
| 286 | 287 | ||
| 287 | 288 | char ToUpper(char c) { | |
| 288 | - return c >= 'a' && c <= 'z' ? (c - 'a') + 'A' : c; | ||
| 289 | + return std::toupper(c, std::locale::classic()); | ||
| 289 | 290 | } | |
| 290 | 291 | ||
| 291 | 292 | std::string ToUpper(const std::string& in) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments