diff --git a/luna/include/luna/Format.h b/luna/include/luna/Format.h index 28ffd1cd..6607e4d5 100644 --- a/luna/include/luna/Format.h +++ b/luna/include/luna/Format.h @@ -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, ...); \ No newline at end of file +usize string_format(char* buf, usize max, const char* format, ...) _format(3, 4); \ No newline at end of file diff --git a/luna/src/Units.cpp b/luna/src/Units.cpp index 85a73900..05afd720 100644 --- a/luna/src/Units.cpp +++ b/luna/src/Units.cpp @@ -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 to_dynamic_unit(usize value)