mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Merge f28e45f2f67504204d6eb24e4f5343dae8e9edd3 into 9074461ffbb44ad77244a493c1090eeaa6f20322
This commit is contained in:
commit
5f22aec97a
@ -193,7 +193,8 @@ ini_t* ini_load(const char *filename) {
|
||||
|
||||
/* Get file size */
|
||||
fseek(fp, 0, SEEK_END);
|
||||
sz = ftell(fp);
|
||||
const long file_size = ftell(fp);
|
||||
sz = file_size > 0 ? file_size : 0;
|
||||
rewind(fp);
|
||||
|
||||
/* Load file content into memory, null terminate, init end var */
|
||||
|
||||
@ -85,7 +85,8 @@ static inline char* PrintFloat( char* begin, char* end, T value, int precision )
|
||||
#ifndef NO_CHARCONV
|
||||
return std::to_chars( begin, end, value, std::chars_format::fixed, precision ).ptr;
|
||||
#else
|
||||
return begin + sprintf( begin, "%.*f", precision, value );
|
||||
auto length = sprintf( begin, "%.*f", precision, value );
|
||||
return length < 0 ? "" : begin + length; // TODO: Proper error handling for negative length
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -95,7 +96,8 @@ static inline char* PrintFloat( char* begin, char* end, T value )
|
||||
#ifndef NO_CHARCONV
|
||||
return std::to_chars( begin, end, value, std::chars_format::fixed ).ptr;
|
||||
#else
|
||||
return begin + sprintf( begin, "%f", value );
|
||||
auto length = sprintf( begin, "%f", value );
|
||||
return length < 0 ? "" : begin + length; // TODO: Proper error handling for negative length
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user