Tell the compiler that string_format is a printf-style function
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
16e00bada0
commit
16954695dd
@ -16,4 +16,4 @@ usize pure_cstyle_format(const char* format, pure_callback_t callback, void* arg
|
||||
usize vstring_format(char* buf, usize max, const char* format, va_list ap);
|
||||
|
||||
// Convenience function which outputs into a fixed-size buffer (not unlike snprintf)
|
||||
usize string_format(char* buf, usize max, const char* format, ...);
|
||||
usize string_format(char* buf, usize max, const char* format, ...) _format(3, 4);
|
@ -6,7 +6,7 @@
|
||||
|
||||
usize to_dynamic_unit_cstr(usize value, char* buffer, usize max)
|
||||
{
|
||||
if (value < 1024) { return string_format(buffer, max, "%u bytes", value); }
|
||||
if (value < 1024) { return string_format(buffer, max, "%zu bytes", value); }
|
||||
|
||||
const char* unit_prefixes = "KMGTPE";
|
||||
while (value > (1024 * 1024))
|
||||
@ -15,7 +15,7 @@ usize to_dynamic_unit_cstr(usize value, char* buffer, usize max)
|
||||
unit_prefixes++;
|
||||
}
|
||||
|
||||
return string_format(buffer, max, "%u.%u %ciB", value / 1024, (value % 1024) / 103, *unit_prefixes);
|
||||
return string_format(buffer, max, "%zu.%zu %ciB", value / 1024, (value % 1024) / 103, *unit_prefixes);
|
||||
}
|
||||
|
||||
Result<OwnedStringView> to_dynamic_unit(usize value)
|
||||
|
Loading…
Reference in New Issue
Block a user