Fix call to _snprintf on GCC
Was a regression from ddbf2ff
.
This commit also introduce a "#define snprintf _snprintf", so the rest of the file was simplified to make use of this
instead of distinguishing between snprintf and _snprintf in the various functions.
This commit is contained in:
parent
2769da7744
commit
f7e4c4e359
1 changed files with 7 additions and 15 deletions
|
@ -897,17 +897,8 @@ String String::num(double p_num,int p_decimals) {
|
||||||
}
|
}
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__) || defined(_MSC_VER)
|
||||||
#ifdef MINGW_ENABLED
|
|
||||||
//snprintf is inexplicably broken in mingw
|
|
||||||
//sprintf(buf,fmt,p_num);
|
|
||||||
_snprintf(buf,256,fmt,p_num);
|
|
||||||
#else
|
|
||||||
snprintf(buf,256,fmt,p_num);
|
snprintf(buf,256,fmt,p_num);
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
_snprintf(buf,256,fmt,p_num);
|
|
||||||
#else
|
#else
|
||||||
sprintf(buf,fmt,p_num);
|
sprintf(buf,fmt,p_num);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1178,10 +1169,7 @@ String String::num_scientific(double p_num) {
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(MINGW_ENABLED)
|
#if defined(__GNUC__) || defined(_MSC_VER)
|
||||||
|
|
||||||
_snprintf(buf,256,"%lg",p_num);
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
snprintf(buf,256,"%lg",p_num);
|
snprintf(buf,256,"%lg",p_num);
|
||||||
#else
|
#else
|
||||||
sprintf(buf,"%.16lg",p_num);
|
sprintf(buf,"%.16lg",p_num);
|
||||||
|
@ -3096,7 +3084,11 @@ String String::http_escape() const {
|
||||||
res += ord;
|
res += ord;
|
||||||
} else {
|
} else {
|
||||||
char h_Val[3];
|
char h_Val[3];
|
||||||
snprintf(h_Val, 3, "%.2X", ord);
|
#if defined(__GNUC__) || defined(_MSC_VER)
|
||||||
|
snprintf(h_Val, 3, "%.2X", ord);
|
||||||
|
#else
|
||||||
|
sprintf(h_Val, "%.2X", ord);
|
||||||
|
#endif
|
||||||
res += "%";
|
res += "%";
|
||||||
res += h_Val;
|
res += h_Val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue