summaryrefslogtreecommitdiffstats
path: root/apps/menus
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-12-09 12:09:40 -0600
committerWilliam Wilgus <me.theuser@yahoo.com>2018-12-09 22:54:55 -0600
commit62a5ed49cc187120793ea50e0eec4e18c8bc0441 (patch)
treea6714de084a80ea4a61f3da6042a743801b19d12 /apps/menus
parent74701a16a547ab4a68fc9c5a32d939e7a9c91531 (diff)
downloadrockbox-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/menus')
-rw-r--r--apps/menus/main_menu.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 139667cef4..a5196020a0 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -181,8 +181,8 @@ static const char* info_getname(int selected_item, void *data,
case INFO_BUFFER: /* buffer */
{
- long kib = audio_buffer_size() / 1024; /* to KiB */
- output_dyn_value(s1, sizeof(s1), kib, kbyte_units, true);
+ long kib = audio_buffer_size() >> 10; /* to KiB */
+ output_dyn_value(s1, sizeof(s1), kib, kibyte_units, 3, true);
snprintf(buffer, buffer_len, "%s %s", str(LANG_BUFFER_STAT), s1);
}
break;
@@ -217,12 +217,12 @@ static const char* info_getname(int selected_item, void *data,
break;
case INFO_DISK1: /* disk usage 1 */
#ifdef HAVE_MULTIVOLUME
- output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
- output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true);
+ output_dyn_value(s1, sizeof s1, info->free, kibyte_units, 3, true);
+ output_dyn_value(s2, sizeof s2, info->size, kibyte_units, 3, true);
snprintf(buffer, buffer_len, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL),
s1, s2);
#else
- output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
+ output_dyn_value(s1, sizeof s1, info->free, kibyte_units, 3, true);
snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1);
#endif
break;
@@ -230,8 +230,8 @@ static const char* info_getname(int selected_item, void *data,
#ifdef HAVE_MULTIVOLUME
if (info->size2)
{
- output_dyn_value(s1, sizeof s1, info->free2, kbyte_units, true);
- output_dyn_value(s2, sizeof s2, info->size2, kbyte_units, true);
+ output_dyn_value(s1, sizeof s1, info->free2, kibyte_units, 3, true);
+ output_dyn_value(s2, sizeof s2, info->size2, kibyte_units, 3, true);
snprintf(buffer, buffer_len, "%s %s/%s", str(LANG_DISK_NAME_MMC),
s1, s2);
}
@@ -241,7 +241,7 @@ static const char* info_getname(int selected_item, void *data,
str(LANG_NOT_PRESENT));
}
#else
- output_dyn_value(s1, sizeof s1, info->size, kbyte_units, true);
+ output_dyn_value(s1, sizeof s1, info->size, kibyte_units, 3, true);
snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
#endif
break;
@@ -263,8 +263,8 @@ static int info_speak_item(int selected_item, void * data)
case INFO_BUFFER: /* buffer */
{
talk_id(LANG_BUFFER_STAT, false);
- long kib = audio_buffer_size() / 1024; /* to KiB */
- output_dyn_value(NULL, 0, kib, kbyte_units, true);
+ long kib = audio_buffer_size() >> 10; /* to KiB */
+ output_dyn_value(NULL, 0, kib, kibyte_units, 3, true);
break;
}
case INFO_BATTERY: /* battery */
@@ -303,12 +303,12 @@ static int info_speak_item(int selected_item, void * data)
case INFO_DISK1: /* disk 1 */
#ifdef HAVE_MULTIVOLUME
talk_ids(false, LANG_DISK_NAME_INTERNAL, LANG_DISK_FREE_INFO);
- output_dyn_value(NULL, 0, info->free, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->free, kibyte_units, 3, true);
talk_id(LANG_DISK_SIZE_INFO, true);
- output_dyn_value(NULL, 0, info->size, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->size, kibyte_units, 3, true);
#else
talk_id(LANG_DISK_FREE_INFO, false);
- output_dyn_value(NULL, 0, info->free, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->free, kibyte_units, 3, true);
#endif
break;
case INFO_DISK2: /* disk 2 */
@@ -317,14 +317,14 @@ static int info_speak_item(int selected_item, void * data)
if (info->size2)
{
talk_id(LANG_DISK_FREE_INFO, true);
- output_dyn_value(NULL, 0, info->free2, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->free2, kibyte_units, 3, true);
talk_id(LANG_DISK_SIZE_INFO, true);
- output_dyn_value(NULL, 0, info->size2, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->size2, kibyte_units, 3, true);
}
else talk_id(LANG_NOT_PRESENT, true);
#else
talk_id(LANG_DISK_SIZE_INFO, false);
- output_dyn_value(NULL, 0, info->size, kbyte_units, true);
+ output_dyn_value(NULL, 0, info->size, kibyte_units, 3, true);
#endif
break;