summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index f029ae4200..25930db201 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -1337,7 +1337,17 @@ String String::num_scientific(double p_num) {
char buf[256];
#if defined(__GNUC__) || defined(_MSC_VER)
+
+#if (defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT)
+ // MinGW and old MSC require _set_output_format() to conform to C99 output for printf
+ unsigned int old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
+#endif
snprintf(buf, 256, "%lg", p_num);
+
+#if (defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)) && defined(_TWO_DIGIT_EXPONENT) && !defined(_UCRT)
+ _set_output_format(old_exponent_format);
+#endif
+
#else
sprintf(buf, "%.16lg", p_num);
#endif
@@ -1406,7 +1416,7 @@ bool String::parse_utf8(const char *p_utf8, int p_len) {
if (skip == 0) {
- uint8_t c = *ptrtmp;
+ uint8_t c = *ptrtmp >= 0 ? *ptrtmp : uint8_t(256 + *ptrtmp);
/* Determine the number of characters in sequence */
if ((c & 0x80) == 0)
@@ -4058,6 +4068,11 @@ String itos(int64_t p_val) {
return String::num_int64(p_val);
}
+String uitos(uint64_t p_val) {
+
+ return String::num_uint64(p_val);
+}
+
String rtos(double p_val) {
return String::num(p_val);