mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
74701a16a5
commit
62a5ed49cc
8 changed files with 106 additions and 54 deletions
10
apps/misc.h
10
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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue