diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-10-11 08:45:47 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-10-11 08:45:47 +0000 |
commit | 46943ad40c835999c24b345e4b19e37161f078b6 (patch) | |
tree | b8293fa22f546a5b0f3dffafa8d98060be854d47 /apps | |
parent | d6227edbb51aa5df03bd8951a582ece994611c2e (diff) | |
download | rockbox-46943ad40c835999c24b345e4b19e37161f078b6.tar.gz rockbox-46943ad40c835999c24b345e4b19e37161f078b6.zip |
Avoid more useless string copys and make some random cleanups
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23092 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/menus/time_menu.c | 14 | ||||
-rw-r--r-- | apps/recorder/radio.c | 8 | ||||
-rw-r--r-- | apps/recorder/recording.c | 9 |
3 files changed, 16 insertions, 15 deletions
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index e6cbb230da..cb0e4aac5b 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c | |||
@@ -160,8 +160,8 @@ static void talk_timedate(void) | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | static void vp_puts_center(struct viewport *vp, struct screen *display, int line, | 163 | static void vp_puts_center(struct viewport *vp, struct screen *display, |
164 | char *str) | 164 | int line, const char *str) |
165 | { | 165 | { |
166 | int w, offset; | 166 | int w, offset; |
167 | 167 | ||
@@ -180,6 +180,7 @@ static void draw_timedate(struct viewport *vp, struct screen *display) | |||
180 | struct tm *tm = get_time(); | 180 | struct tm *tm = get_time(); |
181 | int line; | 181 | int line; |
182 | char time[16], date[16]; | 182 | char time[16], date[16]; |
183 | const char *t = time, *d = date; | ||
183 | if (vp->height == 0) | 184 | if (vp->height == 0) |
184 | return; | 185 | return; |
185 | display->set_viewport(vp); | 186 | display->set_viewport(vp); |
@@ -205,13 +206,13 @@ static void draw_timedate(struct viewport *vp, struct screen *display) | |||
205 | } | 206 | } |
206 | else | 207 | else |
207 | { | 208 | { |
208 | snprintf(time, 16, "%s", "--:--:--"); | 209 | t = "--:--:--"; |
209 | snprintf(date, 16, "%s", str(LANG_UNKNOWN)); | 210 | d = str(LANG_UNKNOWN); |
210 | } | 211 | } |
211 | 212 | ||
212 | vp_puts_center(vp, display, line, time); | 213 | vp_puts_center(vp, display, line, t); |
213 | line++; | 214 | line++; |
214 | vp_puts_center(vp, display, line, date); | 215 | vp_puts_center(vp, display, line, d); |
215 | 216 | ||
216 | display->update_viewport(); | 217 | display->update_viewport(); |
217 | } | 218 | } |
@@ -307,3 +308,4 @@ int time_screen(void* ignored) | |||
307 | return 0; | 308 | return 0; |
308 | return ret; | 309 | return ret; |
309 | } | 310 | } |
311 | |||
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index c98f0f621d..9929fba82f 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -951,11 +951,11 @@ int radio_screen(void) | |||
951 | freq / 100, freq % 100); | 951 | freq / 100, freq % 100); |
952 | FOR_NB_SCREENS(i) | 952 | FOR_NB_SCREENS(i) |
953 | screens[i].puts_scroll(0, top_of_screen + 1, buf); | 953 | screens[i].puts_scroll(0, top_of_screen + 1, buf); |
954 | 954 | ||
955 | snprintf(buf, 128, "%s", stereo?str(LANG_CHANNEL_STEREO): | ||
956 | str(LANG_CHANNEL_MONO)); | ||
957 | FOR_NB_SCREENS(i) | 955 | FOR_NB_SCREENS(i) |
958 | screens[i].puts_scroll(0, top_of_screen + 2, buf); | 956 | screens[i].puts_scroll(0, top_of_screen + 2, |
957 | stereo ? str(LANG_CHANNEL_STEREO) : | ||
958 | str(LANG_CHANNEL_MONO)); | ||
959 | 959 | ||
960 | snprintf(buf, 128, "%s %s", str(LANG_MODE), | 960 | snprintf(buf, 128, "%s %s", str(LANG_MODE), |
961 | radio_mode ? str(LANG_PRESET) : | 961 | radio_mode ? str(LANG_PRESET) : |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index b86c884c7a..ffa4b2df7e 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -965,7 +965,7 @@ static const char* reclist_get_name(int selected_item, void * data, | |||
965 | } | 965 | } |
966 | else | 966 | else |
967 | { | 967 | { |
968 | strlcpy(buffer, str(LANG_RECORDING_FILENAME), buffer_len); | 968 | return str(LANG_RECORDING_FILENAME); |
969 | } | 969 | } |
970 | break; | 970 | break; |
971 | } | 971 | } |
@@ -1970,7 +1970,7 @@ static bool f2_rec_screen(void) | |||
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | while (!exit) { | 1972 | while (!exit) { |
1973 | const char* ptr=NULL; | 1973 | const char* ptr; |
1974 | 1974 | ||
1975 | FOR_NB_SCREENS(i) | 1975 | FOR_NB_SCREENS(i) |
1976 | { | 1976 | { |
@@ -2090,7 +2090,7 @@ static bool f3_rec_screen(void) | |||
2090 | bool used = false; | 2090 | bool used = false; |
2091 | int w, h, i; | 2091 | int w, h, i; |
2092 | int button; | 2092 | int button; |
2093 | char *src_str[] = | 2093 | const char *src_str[] = |
2094 | { | 2094 | { |
2095 | str(LANG_SYSFONT_RECORDING_SRC_MIC), | 2095 | str(LANG_SYSFONT_RECORDING_SRC_MIC), |
2096 | str(LANG_SYSFONT_LINE_IN), | 2096 | str(LANG_SYSFONT_LINE_IN), |
@@ -2105,8 +2105,7 @@ static bool f3_rec_screen(void) | |||
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | while (!exit) { | 2107 | while (!exit) { |
2108 | char* ptr=NULL; | 2108 | const char* ptr = src_str[global_settings.rec_source]; |
2109 | ptr = src_str[global_settings.rec_source]; | ||
2110 | FOR_NB_SCREENS(i) | 2109 | FOR_NB_SCREENS(i) |
2111 | { | 2110 | { |
2112 | screens[i].clear_display(); | 2111 | screens[i].clear_display(); |