diff options
author | William Wilgus <me.theuser@yahoo.com> | 2018-12-09 12:09:40 -0600 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2018-12-09 22:54:55 -0600 |
commit | 62a5ed49cc187120793ea50e0eec4e18c8bc0441 (patch) | |
tree | a6714de084a80ea4a61f3da6042a743801b19d12 /apps/misc.h | |
parent | 74701a16a547ab4a68fc9c5a32d939e7a9c91531 (diff) | |
download | rockbox-62a5ed49cc187120793ea50e0eec4e18c8bc0441.tar.gz rockbox-62a5ed49cc187120793ea50e0eec4e18c8bc0441.tar.bz2 rockbox-62a5ed49cc187120793ea50e0eec4e18c8bc0441.zip |
Fix possible truncation misc.c->output_dyn_value + use Kibytes
output_dyn_value now requires the count for number of units
Binary scale now shows Kibibytes instead of kilobytes (g#1742)
Fixes output for negative values as well
Change-Id: I8aa896860e97d2453fa35069e2dfe1caac60109f
Diffstat (limited to 'apps/misc.h')
-rw-r--r-- | apps/misc.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/misc.h b/apps/misc.h index b13c0b15c6..6821c6debf 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -27,15 +27,19 @@ #include "screen_access.h" extern const unsigned char * const byte_units[]; -extern const unsigned char * const * const kbyte_units; +extern const unsigned char * const * const kibyte_units; /* Format a large-range value for output, using the appropriate unit so that * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" * units) if possible, and 3 significant digits are shown. If a buffer is * given, the result is snprintf()'d into that buffer, otherwise the result is * voiced.*/ -char *output_dyn_value(char *buf, int buf_size, int value, - const unsigned char * const *units, bool bin_scale); +char *output_dyn_value(char *buf, + int buf_size, + int value, + const unsigned char * const *units, + unsigned int unit_count, + bool binary_scale); /* Format time into buf. * |