summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/io/json.cpp2
-rw-r--r--core/ustring.cpp16
-rw-r--r--core/ustring.h2
3 files changed, 13 insertions, 7 deletions
diff --git a/core/io/json.cpp b/core/io/json.cpp
index a83d7e4d6e..88a23eb4cd 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -250,7 +250,7 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke
if (p_str[idx]=='-' || (p_str[idx]>='0' && p_str[idx]<='9')) {
//a number
const CharType *rptr;
- double number = String::to_double(&p_str[idx],-1,&rptr);
+ double number = String::to_double(&p_str[idx],&rptr);
idx+=(rptr - &p_str[idx]);
r_token.type=TK_NUMBER;
r_token.value=number;
diff --git a/core/ustring.cpp b/core/ustring.cpp
index d75c21d16e..50e5dc95c7 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -626,7 +626,7 @@ Vector<float> String::split_floats(const String &p_splitter,bool p_allow_empty)
if (end<0)
end=len;
if (p_allow_empty || (end>from))
- ret.push_back(String::to_double(&c_str()[from],end-from));
+ ret.push_back(String::to_double(&c_str()[from]));
if (end==len)
break;
@@ -654,8 +654,11 @@ Vector<float> String::split_floats_mk(const Vector<String> &p_splitters,bool p_a
spl_len=p_splitters[idx].length();
}
- if (p_allow_empty || (end>from))
- ret.push_back(String::to_double(&c_str()[from],end-from));
+ if (p_allow_empty || (end>from)) {
+ double d = String::to_double(&c_str()[from]);
+ print_line("get db: "+rtos(d));
+ ret.push_back(String::to_double(&c_str()[from]));
+ }
if (end==len)
break;
@@ -1959,8 +1962,10 @@ float String::to_float() const {
return to_double();
}
-double String::to_double(const CharType* p_str, int p_len, const CharType **r_end) {
+double String::to_double(const CharType* p_str, const CharType **r_end) {
+ return built_in_strtod<CharType>(p_str,(CharType**)r_end);
+#if 0
#if 0
//ndef NO_USE_STDLIB
return wcstod(p_str,p_len<0?NULL:p_str+p_len);
@@ -2053,6 +2058,7 @@ double String::to_double(const CharType* p_str, int p_len, const CharType **r_en
return sign*(integer+decimal)*Math::pow(10,exp_sign*exp);
#endif
+#endif
}
int64_t String::to_int(const CharType* p_str,int p_len) {
@@ -3437,7 +3443,7 @@ String String::percent_encode() const {
uint8_t c = cs[i];
if ( (c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || c=='-' || c=='_' || c=='~' || c=='.') {
- char p[2]={c,0};
+ char p[2]={(char)c,0};
encoded+=p;
} else {
char p[4]={'%',0,0,0};
diff --git a/core/ustring.h b/core/ustring.h
index 8fe3a95463..e1d6761742 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -142,7 +142,7 @@ public:
int64_t to_int64() const;
static int to_int(const char* p_str);
static double to_double(const char* p_str);
- static double to_double(const CharType* p_str, int p_len=-1, const CharType **r_end=NULL);
+ static double to_double(const CharType* p_str, const CharType **r_end=NULL);
static int64_t to_int(const CharType* p_str,int p_len=-1);
String capitalize() const;