This commit is contained in:
2023-02-09 01:42:13 +06:00
8 changed files with 86 additions and 56 deletions

View File

@@ -67,7 +67,7 @@ typedef uint8 bool;
#endif
#ifndef sprintf_s
#define sprintf_s(BUF, BUFSIZE, FORMAT, ...) sprintf(BUF, FORMAT, ## __VA_ARGS__)
//#define sprintf_s(BUF, BUFSIZE, FORMAT, ...) sprintf(BUF, FORMAT, ## __VA_ARGS__)
#endif

View File

@@ -67,7 +67,10 @@ char* toString_uint(uint64 n, bool withPostfix, bool uppercase){
throw("too big precision");\
if(precision==0)\
precision=toString_float_default_precision;\
int cn=sprintf(str, "%.*f", precision, n);\
int cn=IFMSC(\
sprintf_s(str, bufsize, "%.*f", precision, n),\
sprintf(str, "%.*f", precision, n)\
);\
/* remove trailing zeroes except .0*/\
while(str[cn-1]=='0' && str[cn-2]!='.')\
cn--;\