diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-10-17 13:40:42 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-10-17 13:40:42 +0000 |
commit | 79f19b939f63a1a965bcc9f90cf9b6c8822620cc (patch) | |
tree | f2b6cd378e30daa15ce03653ae1dd3ded0a6431f /apps | |
parent | 0659890804d8443a75b4cc5b91c6aec45821effc (diff) | |
download | rockbox-79f19b939f63a1a965bcc9f90cf9b6c8822620cc.tar.gz rockbox-79f19b939f63a1a965bcc9f90cf9b6c8822620cc.zip |
Const correctness for output_dyn_value and unify some identical constants
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23227 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 4 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 17 | ||||
-rw-r--r-- | apps/misc.c | 17 | ||||
-rw-r--r-- | apps/misc.h | 5 | ||||
-rw-r--r-- | apps/recorder/recording.c | 7 |
5 files changed, 21 insertions, 29 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index e863911602..9886843723 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1728,8 +1728,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) | |||
1728 | char *title = lists->title; | 1728 | char *title = lists->title; |
1729 | static const unsigned char i_vmin[] = { 0, 1, 5, 10, 25, 35, 60, 100 }; | 1729 | static const unsigned char i_vmin[] = { 0, 1, 5, 10, 25, 35, 60, 100 }; |
1730 | static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 }; | 1730 | static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 }; |
1731 | static const unsigned char *kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" }; | 1731 | static const unsigned char * const kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" }; |
1732 | static const unsigned char *nsec_units[] = { "ns", "µs", "ms" }; | 1732 | static const unsigned char * const nsec_units[] = { "ns", "µs", "ms" }; |
1733 | #if (CONFIG_STORAGE & STORAGE_MMC) | 1733 | #if (CONFIG_STORAGE & STORAGE_MMC) |
1734 | static const char * const mmc_spec_vers[] = { "1.0-1.2", "1.4", "2.0-2.2", | 1734 | static const char * const mmc_spec_vers[] = { "1.0-1.2", "1.4", "2.0-2.2", |
1735 | "3.1-3.31", "4.0" }; | 1735 | "3.1-3.31", "4.0" }; |
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 4208df413b..505801d3cc 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -150,20 +150,6 @@ enum infoscreenorder | |||
150 | INFO_COUNT | 150 | INFO_COUNT |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static const unsigned char *kbyte_units[] = | ||
154 | { | ||
155 | ID2P(LANG_KILOBYTE), | ||
156 | ID2P(LANG_MEGABYTE), | ||
157 | ID2P(LANG_GIGABYTE) | ||
158 | }; | ||
159 | |||
160 | static const unsigned char *byte_units[] = | ||
161 | { | ||
162 | ID2P(LANG_BYTE), | ||
163 | ID2P(LANG_KILOBYTE), | ||
164 | ID2P(LANG_MEGABYTE) | ||
165 | }; | ||
166 | |||
167 | static const char* info_getname(int selected_item, void *data, | 153 | static const char* info_getname(int selected_item, void *data, |
168 | char *buffer, size_t buffer_len) | 154 | char *buffer, size_t buffer_len) |
169 | { | 155 | { |
@@ -315,8 +301,7 @@ static int info_speak_item(int selected_item, void * data) | |||
315 | break; | 301 | break; |
316 | case INFO_DISK1: /* disk 1 */ | 302 | case INFO_DISK1: /* disk 1 */ |
317 | #ifdef HAVE_MULTIVOLUME | 303 | #ifdef HAVE_MULTIVOLUME |
318 | talk_id(LANG_DISK_NAME_INTERNAL, false); | 304 | talk_ids(false, LANG_DISK_NAME_INTERNAL, LANG_DISK_FREE_INFO); |
319 | talk_id(LANG_DISK_FREE_INFO, true); | ||
320 | output_dyn_value(NULL, 0, info->free, kbyte_units, true); | 305 | output_dyn_value(NULL, 0, info->free, kbyte_units, true); |
321 | talk_id(LANG_DISK_SIZE_INFO, true); | 306 | talk_id(LANG_DISK_SIZE_INFO, true); |
322 | output_dyn_value(NULL, 0, info->size, kbyte_units, true); | 307 | output_dyn_value(NULL, 0, info->size, kbyte_units, true); |
diff --git a/apps/misc.c b/apps/misc.c index 3134e02555..4400de1b92 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -84,13 +84,24 @@ | |||
84 | #endif | 84 | #endif |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | /* units used with output_dyn_value */ | ||
88 | const unsigned char * const byte_units[] = | ||
89 | { | ||
90 | ID2P(LANG_BYTE), | ||
91 | ID2P(LANG_KILOBYTE), | ||
92 | ID2P(LANG_MEGABYTE), | ||
93 | ID2P(LANG_GIGABYTE) | ||
94 | }; | ||
95 | |||
96 | const unsigned char * const * const kbyte_units = &byte_units[1]; | ||
97 | |||
87 | /* Format a large-range value for output, using the appropriate unit so that | 98 | /* Format a large-range value for output, using the appropriate unit so that |
88 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 99 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
89 | * units) if possible, and 3 significant digits are shown. If a buffer is | 100 | * units) if possible, and 3 significant digits are shown. If a buffer is |
90 | * given, the result is snprintf()'d into that buffer, otherwise the result is | 101 | * given, the result is snprintf()'d into that buffer, otherwise the result is |
91 | * voiced.*/ | 102 | * voiced.*/ |
92 | char *output_dyn_value(char *buf, int buf_size, int value, | 103 | char *output_dyn_value(char *buf, int buf_size, int value, |
93 | const unsigned char **units, bool bin_scale) | 104 | const unsigned char * const *units, bool bin_scale) |
94 | { | 105 | { |
95 | int scale = bin_scale ? 1024 : 1000; | 106 | int scale = bin_scale ? 1024 : 1000; |
96 | int fraction = 0; | 107 | int fraction = 0; |
@@ -827,9 +838,9 @@ char* skip_whitespace(char* const str) | |||
827 | { | 838 | { |
828 | char *s = str; | 839 | char *s = str; |
829 | 840 | ||
830 | while (isspace(*s)) | 841 | while (isspace(*s)) |
831 | s++; | 842 | s++; |
832 | 843 | ||
833 | return s; | 844 | return s; |
834 | } | 845 | } |
835 | 846 | ||
diff --git a/apps/misc.h b/apps/misc.h index 7e71101ba1..35972301cc 100644 --- a/apps/misc.h +++ b/apps/misc.h | |||
@@ -26,13 +26,16 @@ | |||
26 | #include "config.h" | 26 | #include "config.h" |
27 | #include "system.h" | 27 | #include "system.h" |
28 | 28 | ||
29 | extern const unsigned char * const byte_units[]; | ||
30 | extern const unsigned char * const * const kbyte_units; | ||
31 | |||
29 | /* Format a large-range value for output, using the appropriate unit so that | 32 | /* Format a large-range value for output, using the appropriate unit so that |
30 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" | 33 | * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" |
31 | * units) if possible, and 3 significant digits are shown. If a buffer is | 34 | * units) if possible, and 3 significant digits are shown. If a buffer is |
32 | * given, the result is snprintf()'d into that buffer, otherwise the result is | 35 | * given, the result is snprintf()'d into that buffer, otherwise the result is |
33 | * voiced.*/ | 36 | * voiced.*/ |
34 | char *output_dyn_value(char *buf, int buf_size, int value, | 37 | char *output_dyn_value(char *buf, int buf_size, int value, |
35 | const unsigned char **units, bool bin_scale); | 38 | const unsigned char * const *units, bool bin_scale); |
36 | 39 | ||
37 | /* Format time into buf. | 40 | /* Format time into buf. |
38 | * | 41 | * |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index ffa4b2df7e..da97306cfe 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -1035,13 +1035,6 @@ bool recording_screen(bool no_source) | |||
1035 | int prev_rec_source = global_settings.rec_source; /* detect source change */ | 1035 | int prev_rec_source = global_settings.rec_source; /* detect source change */ |
1036 | #endif | 1036 | #endif |
1037 | 1037 | ||
1038 | static const unsigned char *byte_units[] = { | ||
1039 | ID2P(LANG_BYTE), | ||
1040 | ID2P(LANG_KILOBYTE), | ||
1041 | ID2P(LANG_MEGABYTE), | ||
1042 | ID2P(LANG_GIGABYTE) | ||
1043 | }; | ||
1044 | |||
1045 | struct audio_recording_options rec_options; | 1038 | struct audio_recording_options rec_options; |
1046 | rec_status = RCSTAT_IN_RECSCREEN; | 1039 | rec_status = RCSTAT_IN_RECSCREEN; |
1047 | 1040 | ||