summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/bookmark.c16
-rw-r--r--apps/cuesheet.c8
-rw-r--r--apps/debug_menu.c15
-rw-r--r--apps/filetypes.c6
-rw-r--r--apps/gui/bitmap/list.c2
-rw-r--r--apps/gui/charcell/list.c2
-rw-r--r--apps/gui/list.c10
-rw-r--r--apps/gui/list.h4
-rw-r--r--apps/gui/option_select.c22
-rw-r--r--apps/gui/option_select.h2
-rw-r--r--apps/gui/quickscreen.c4
-rw-r--r--apps/menu.c10
-rw-r--r--apps/menus/eq_menu.c9
-rw-r--r--apps/menus/eq_menu.h6
-rw-r--r--apps/menus/main_menu.c28
-rw-r--r--apps/menus/recording_menu.c2
-rw-r--r--apps/playlist_catalog.c4
-rw-r--r--apps/playlist_viewer.c14
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/calendar.c2
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.c8
-rw-r--r--apps/plugins/disktidy.c4
-rw-r--r--apps/plugins/doom/rockdoom.c8
-rw-r--r--apps/plugins/goban/goban.c20
-rw-r--r--apps/plugins/goban/types.h2
-rw-r--r--apps/plugins/goban/util.c2
-rw-r--r--apps/plugins/keybox.c4
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c13
-rw-r--r--apps/plugins/properties.c6
-rw-r--r--apps/plugins/random_folder_advance_config.c4
-rw-r--r--apps/plugins/rockboy/menu.c6
-rw-r--r--apps/plugins/rockpaint.c10
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c8
-rw-r--r--apps/plugins/superdom.c4
-rw-r--r--apps/plugins/text_editor.c4
-rw-r--r--apps/recorder/radio.c4
-rw-r--r--apps/recorder/recording.c4
-rw-r--r--apps/screens.c16
-rw-r--r--apps/settings.c13
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c37
-rw-r--r--apps/settings_list.h4
-rw-r--r--apps/tree.c4
43 files changed, 191 insertions, 170 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 5b92767796..cee9abdfa8 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -86,10 +86,10 @@ static bool parse_bookmark(const char *bookmark,
86 bool *shuffle, 86 bool *shuffle,
87 char* file_name); 87 char* file_name);
88static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line); 88static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line);
89static char* get_bookmark_info(int list_index, 89static const char* get_bookmark_info(int list_index,
90 void* data, 90 void* data,
91 char *buffer, 91 char *buffer,
92 size_t buffer_len); 92 size_t buffer_len);
93static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); 93static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume);
94static bool system_check(void); 94static bool system_check(void);
95static bool write_bookmark(bool create_bookmark_file, const char *bookmark); 95static bool write_bookmark(bool create_bookmark_file, const char *bookmark);
@@ -515,10 +515,10 @@ static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line)
515 return bookmarks->start + bookmarks->count; 515 return bookmarks->start + bookmarks->count;
516} 516}
517 517
518static char* get_bookmark_info(int list_index, 518static const char* get_bookmark_info(int list_index,
519 void* data, 519 void* data,
520 char *buffer, 520 char *buffer,
521 size_t buffer_len) 521 size_t buffer_len)
522{ 522{
523 struct bookmark_list* bookmarks = (struct bookmark_list*) data; 523 struct bookmark_list* bookmarks = (struct bookmark_list*) data;
524 int index = list_index / 2; 524 int index = list_index / 2;
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index deb0769320..6f29d68716 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -234,10 +234,10 @@ int cue_find_current_track(struct cuesheet *cue, unsigned long curpos)
234} 234}
235 235
236/* callback that gives list item titles for the cuesheet browser */ 236/* callback that gives list item titles for the cuesheet browser */
237static char *list_get_name_cb(int selected_item, 237static const char* list_get_name_cb(int selected_item,
238 void *data, 238 void *data,
239 char *buffer, 239 char *buffer,
240 size_t buffer_len) 240 size_t buffer_len)
241{ 241{
242 struct cuesheet *cue = (struct cuesheet *)data; 242 struct cuesheet *cue = (struct cuesheet *)data;
243 243
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index ea53d445fd..4ca8b3fa4f 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -141,8 +141,8 @@ static char thread_status_char(unsigned status)
141 return thread_status_chars[status]; 141 return thread_status_chars[status];
142} 142}
143 143
144static char* threads_getname(int selected_item, void *data, 144static const char* threads_getname(int selected_item, void *data,
145 char *buffer, size_t buffer_len) 145 char *buffer, size_t buffer_len)
146{ 146{
147 (void)data; 147 (void)data;
148 struct thread_entry *thread; 148 struct thread_entry *thread;
@@ -183,6 +183,7 @@ static char* threads_getname(int selected_item, void *data,
183 183
184 return buffer; 184 return buffer;
185} 185}
186
186static int dbg_threads_action_callback(int action, struct gui_synclist *lists) 187static int dbg_threads_action_callback(int action, struct gui_synclist *lists)
187{ 188{
188 (void)lists; 189 (void)lists;
@@ -783,8 +784,8 @@ static bool dbg_hw_info(void)
783#endif /* !SIMULATOR */ 784#endif /* !SIMULATOR */
784 785
785#ifndef SIMULATOR 786#ifndef SIMULATOR
786static char* dbg_partitions_getname(int selected_item, void *data, 787static const char* dbg_partitions_getname(int selected_item, void *data,
787 char *buffer, size_t buffer_len) 788 char *buffer, size_t buffer_len)
788{ 789{
789 (void)data; 790 (void)data;
790 int partition = selected_item/2; 791 int partition = selected_item/2;
@@ -2796,12 +2797,14 @@ static int menu_action_callback(int btn, struct gui_synclist *lists)
2796 } 2797 }
2797 return btn; 2798 return btn;
2798} 2799}
2799static char* dbg_menu_getname(int item, void * data, 2800
2800 char *buffer, size_t buffer_len) 2801static const char* dbg_menu_getname(int item, void * data,
2802 char *buffer, size_t buffer_len)
2801{ 2803{
2802 (void)data; (void)buffer; (void)buffer_len; 2804 (void)data; (void)buffer; (void)buffer_len;
2803 return menuitems[item].desc; 2805 return menuitems[item].desc;
2804} 2806}
2807
2805bool debug_menu(void) 2808bool debug_menu(void)
2806{ 2809{
2807 struct simplelist_info info; 2810 struct simplelist_info info;
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 210b949578..ffa7161693 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -435,13 +435,13 @@ static enum themable_icons openwith_get_icon(int selected_item, void * data)
435 return filetypes[items[selected_item]].icon; 435 return filetypes[items[selected_item]].icon;
436} 436}
437 437
438static char * openwith_get_name(int selected_item, void * data, 438static const char* openwith_get_name(int selected_item, void * data,
439 char * buffer, size_t buffer_len) 439 char * buffer, size_t buffer_len)
440{ 440{
441 (void)buffer; (void)buffer_len; 441 (void)buffer; (void)buffer_len;
442 struct cb_data *info = (struct cb_data *)data; 442 struct cb_data *info = (struct cb_data *)data;
443 int *items = info->items; 443 int *items = info->items;
444 char *s = strrchr(filetypes[items[selected_item]].plugin, '/'); 444 const char *s = strrchr(filetypes[items[selected_item]].plugin, '/');
445 if (s) 445 if (s)
446 return s+1; 446 return s+1;
447 else return filetypes[items[selected_item]].plugin; 447 else return filetypes[items[selected_item]].plugin;
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 8e4cd44d21..71c74dbd09 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -173,7 +173,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
173 for (i=start; i<end && i<list->nb_items; i++) 173 for (i=start; i<end && i<list->nb_items; i++)
174 { 174 {
175 /* do the text */ 175 /* do the text */
176 unsigned char *s; 176 unsigned const char *s;
177 char entry_buffer[MAX_PATH]; 177 char entry_buffer[MAX_PATH];
178 unsigned char *entry_name; 178 unsigned char *entry_name;
179 int text_pos = 0; 179 int text_pos = 0;
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c
index 8d91c2f6b8..2374156f0b 100644
--- a/apps/gui/charcell/list.c
+++ b/apps/gui/charcell/list.c
@@ -69,7 +69,7 @@ void list_draw(struct screen *display, struct gui_synclist *gui_list)
69 69
70 for (i = start; i < end; i++) 70 for (i = start; i < end; i++)
71 { 71 {
72 unsigned char *s; 72 unsigned const char *s;
73 char entry_buffer[MAX_PATH]; 73 char entry_buffer[MAX_PATH];
74 unsigned char *entry_name; 74 unsigned char *entry_name;
75 int current_item = gui_list->start_item[display->screen_type] + i; 75 int current_item = gui_list->start_item[display->screen_type] + i;
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 332459c57f..9b139dd47c 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -827,10 +827,10 @@ void simplelist_addline(int line_number, const char *fmt, ...)
827 va_end(ap); 827 va_end(ap);
828} 828}
829 829
830static char* simplelist_static_getname(int item, 830static const char* simplelist_static_getname(int item,
831 void * data, 831 void * data,
832 char *buffer, 832 char *buffer,
833 size_t buffer_len) 833 size_t buffer_len)
834{ 834{
835 (void)data; (void)buffer; (void)buffer_len; 835 (void)data; (void)buffer; (void)buffer_len;
836 return simplelist_text[item]; 836 return simplelist_text[item];
@@ -841,7 +841,7 @@ bool simplelist_show_list(struct simplelist_info *info)
841 struct gui_synclist lists; 841 struct gui_synclist lists;
842 int action, old_line_count = simplelist_line_count; 842 int action, old_line_count = simplelist_line_count;
843 int oldbars = viewportmanager_set_statusbar(VP_SB_ALLSCREENS); 843 int oldbars = viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
844 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len); 844 const char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
845 int wrap = LIST_WRAP_UNLESS_HELD; 845 int wrap = LIST_WRAP_UNLESS_HELD;
846 if (info->get_name) 846 if (info->get_name)
847 getname = info->get_name; 847 getname = info->get_name;
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 7148e340cc..8a36acb005 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -64,8 +64,8 @@ typedef enum themable_icons list_get_icon(int selected_item, void * data);
64 * - buffer_len : length of the buffer 64 * - buffer_len : length of the buffer
65 * Returns a pointer to a string that contains the text to display 65 * Returns a pointer to a string that contains the text to display
66 */ 66 */
67typedef char * list_get_name(int selected_item, void * data, 67typedef const char * list_get_name(int selected_item, void * data,
68 char * buffer, size_t buffer_len); 68 char * buffer, size_t buffer_len);
69/* 69/*
70 * Voice callback 70 * Voice callback
71 * - selected_item : an integer that tells the number of the item to speak 71 * - selected_item : an integer that tells the number of the item to speak
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 01259c4136..d806a0aa08 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -69,10 +69,11 @@ static const char *unit_strings[] =
69/* these two vars are needed so arbitrary values can be added to the 69/* these two vars are needed so arbitrary values can be added to the
70 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ 70 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */
71static int table_setting_oldval = 0, table_setting_array_position = 0; 71static int table_setting_oldval = 0, table_setting_array_position = 0;
72char *option_get_valuestring(const struct settings_list *setting, 72const char *option_get_valuestring(const struct settings_list *setting,
73 char *buffer, int buf_len, 73 char *buffer, int buf_len,
74 intptr_t temp_var) 74 intptr_t temp_var)
75{ 75{
76 const char* str = buffer;
76 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) 77 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
77 { 78 {
78 bool val = (bool)temp_var; 79 bool val = (bool)temp_var;
@@ -93,7 +94,7 @@ char *option_get_valuestring(const struct settings_list *setting,
93 const struct int_setting *int_info = setting->int_setting; 94 const struct int_setting *int_info = setting->int_setting;
94 const struct table_setting *tbl_info = setting->table_setting; 95 const struct table_setting *tbl_info = setting->table_setting;
95 const char *unit; 96 const char *unit;
96 void (*formatter)(char*, size_t, int, const char*); 97 const char* (*formatter)(char*, size_t, int, const char*);
97 if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) 98 if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
98 { 99 {
99 formatter = int_info->formatter; 100 formatter = int_info->formatter;
@@ -105,7 +106,7 @@ char *option_get_valuestring(const struct settings_list *setting,
105 unit = unit_strings[tbl_info->unit]; 106 unit = unit_strings[tbl_info->unit];
106 } 107 }
107 if (formatter) 108 if (formatter)
108 formatter(buffer, buf_len, (int)temp_var, unit); 109 str = formatter(buffer, buf_len, (int)temp_var, unit);
109 else 110 else
110 snprintf(buffer, buf_len, "%d %s", (int)temp_var, unit?unit:""); 111 snprintf(buffer, buf_len, "%d %s", (int)temp_var, unit?unit:"");
111 } 112 }
@@ -152,7 +153,7 @@ char *option_get_valuestring(const struct settings_list *setting,
152 strlcpy(buffer, val, buf_len); 153 strlcpy(buffer, val, buf_len);
153 } 154 }
154 } 155 }
155 return buffer; 156 return str;
156} 157}
157void option_talk_value(const struct settings_list *setting, int value, bool enqueue) 158void option_talk_value(const struct settings_list *setting, int value, bool enqueue)
158{ 159{
@@ -363,10 +364,11 @@ static int selection_to_val(const struct settings_list *setting, int selection)
363 } 364 }
364 return max- (selection * step); 365 return max- (selection * step);
365} 366}
366static char * value_setting_get_name_cb(int selected_item, 367
367 void * data, 368static const char * value_setting_get_name_cb(int selected_item,
368 char *buffer, 369 void * data,
369 size_t buffer_len) 370 char *buffer,
371 size_t buffer_len)
370{ 372{
371 selected_item = selection_to_val(data, selected_item); 373 selected_item = selection_to_val(data, selected_item);
372 return option_get_valuestring(data, buffer, buffer_len, selected_item); 374 return option_get_valuestring(data, buffer, buffer_len, selected_item);
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index b1a4a86e65..a8661fb8ad 100644
--- a/apps/gui/option_select.h
+++ b/apps/gui/option_select.h
@@ -33,7 +33,7 @@ bool option_screen(const struct settings_list *setting,
33void option_select_next_val(const struct settings_list *setting, 33void option_select_next_val(const struct settings_list *setting,
34 bool previous, bool apply); 34 bool previous, bool apply);
35#endif 35#endif
36char *option_get_valuestring(const struct settings_list *setting, 36const char *option_get_valuestring(const struct settings_list *setting,
37 char *buffer, int buf_len, 37 char *buffer, int buf_len,
38 intptr_t temp_var); 38 intptr_t temp_var);
39void option_talk_value(const struct settings_list *setting, int value, bool enqueue); 39void option_talk_value(const struct settings_list *setting, int value, bool enqueue);
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 20d27380d2..d6d662b1f1 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -147,7 +147,7 @@ static void quickscreen_fix_viewports(struct gui_quickscreen *qs,
147 vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y; 147 vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y;
148} 148}
149 149
150static void quickscreen_draw_text(char *s, int item, bool title, 150static void quickscreen_draw_text(const char *s, int item, bool title,
151 struct screen *display, struct viewport *vp) 151 struct screen *display, struct viewport *vp)
152{ 152{
153 int nb_lines = viewport_get_nb_lines(vp); 153 int nb_lines = viewport_get_nb_lines(vp);
@@ -186,7 +186,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen *qs,
186 186
187 int i; 187 int i;
188 char buf[MAX_PATH]; 188 char buf[MAX_PATH];
189 unsigned char *title, *value; 189 unsigned const char *title, *value;
190 void *setting; 190 void *setting;
191 int temp; 191 int temp;
192 display->set_viewport(parent); 192 display->set_viewport(parent);
diff --git a/apps/menu.c b/apps/menu.c
index 348095cd31..b442d4423d 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -93,10 +93,10 @@ static int find_menu_selection(int selected)
93 return i; 93 return i;
94 return 0; 94 return 0;
95} 95}
96static char * get_menu_item_name(int selected_item, 96static const char* get_menu_item_name(int selected_item,
97 void * data, 97 void * data,
98 char *buffer, 98 char *buffer,
99 size_t buffer_len) 99 size_t buffer_len)
100{ 100{
101 const struct menu_item_ex *menu = (const struct menu_item_ex *)data; 101 const struct menu_item_ex *menu = (const struct menu_item_ex *)data;
102 int type = (menu->flags&MENU_TYPE_MASK); 102 int type = (menu->flags&MENU_TYPE_MASK);
@@ -109,7 +109,7 @@ static char * get_menu_item_name(int selected_item,
109 if (menu->flags&MENU_DYNAMIC_DESC) 109 if (menu->flags&MENU_DYNAMIC_DESC)
110 return menu->menu_get_name_and_icon->list_get_name(selected_item, 110 return menu->menu_get_name_and_icon->list_get_name(selected_item,
111 menu->menu_get_name_and_icon->list_get_name_data, buffer); 111 menu->menu_get_name_and_icon->list_get_name_data, buffer);
112 return (char*)menu->strings[selected_item]; 112 return menu->strings[selected_item];
113 } 113 }
114 114
115 menu = menu->submenus[selected_item]; 115 menu = menu->submenus[selected_item];
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 6087ebfd5b..0e04dddc18 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -51,15 +51,18 @@
51 * Utility functions 51 * Utility functions
52 */ 52 */
53 53
54void eq_q_format(char* buffer, size_t buffer_size, int value, const char* unit) 54const char* eq_q_format(char* buffer, size_t buffer_size, int value, const char* unit)
55{ 55{
56 snprintf(buffer, buffer_size, "%d.%d %s", value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit); 56 snprintf(buffer, buffer_size, "%d.%d %s", value / EQ_USER_DIVISOR,
57 value % EQ_USER_DIVISOR, unit);
58 return buffer;
57} 59}
58 60
59void eq_precut_format(char* buffer, size_t buffer_size, int value, const char* unit) 61const char* eq_precut_format(char* buffer, size_t buffer_size, int value, const char* unit)
60{ 62{
61 snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-", 63 snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-",
62 value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit); 64 value / EQ_USER_DIVISOR, value % EQ_USER_DIVISOR, unit);
65 return buffer;
63} 66}
64 67
65/* 68/*
diff --git a/apps/menus/eq_menu.h b/apps/menus/eq_menu.h
index 6be099113a..6c8301c572 100644
--- a/apps/menus/eq_menu.h
+++ b/apps/menus/eq_menu.h
@@ -43,7 +43,9 @@ bool eq_browse_presets(void);
43bool eq_menu_graphical(void); 43bool eq_menu_graphical(void);
44 44
45/* utility functions for settings_list.c */ 45/* utility functions for settings_list.c */
46void eq_q_format(char* buffer, size_t buffer_size, int value, const char* unit); 46const char* eq_q_format(char* buffer, size_t buffer_size, int value,
47void eq_precut_format(char* buffer, size_t buffer_size, int value, const char* unit); 47 const char* unit);
48const char* eq_precut_format(char* buffer, size_t buffer_size, int value,
49 const char* unit);
48 50
49#endif 51#endif
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 1e7465559e..99c73f2cdb 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -164,8 +164,8 @@ static const unsigned char *byte_units[] =
164 ID2P(LANG_MEGABYTE) 164 ID2P(LANG_MEGABYTE)
165}; 165};
166 166
167static char* info_getname(int selected_item, void *data, 167static const char* info_getname(int selected_item, void *data,
168 char *buffer, size_t buffer_len) 168 char *buffer, size_t buffer_len)
169{ 169{
170 struct info_data *info = (struct info_data*)data; 170 struct info_data *info = (struct info_data*)data;
171 char s1[32]; 171 char s1[32];
@@ -199,27 +199,27 @@ static char* info_getname(int selected_item, void *data,
199#if CONFIG_CHARGING == CHARGING_SIMPLE 199#if CONFIG_CHARGING == CHARGING_SIMPLE
200 /* Only know if plugged */ 200 /* Only know if plugged */
201 if (charger_inserted()) 201 if (charger_inserted())
202 return (char *)str(LANG_BATTERY_CHARGE); 202 return str(LANG_BATTERY_CHARGE);
203 else 203 else
204#elif CONFIG_CHARGING >= CHARGING_MONITOR 204#elif CONFIG_CHARGING >= CHARGING_MONITOR
205#ifdef ARCHOS_RECORDER 205#ifdef ARCHOS_RECORDER
206 /* Report the particular algorithm state */ 206 /* Report the particular algorithm state */
207 if (charge_state == CHARGING) 207 if (charge_state == CHARGING)
208 return (char *)str(LANG_BATTERY_CHARGE); 208 return str(LANG_BATTERY_CHARGE);
209 else if (charge_state == TOPOFF) 209 else if (charge_state == TOPOFF)
210 return (char *)str(LANG_BATTERY_TOPOFF_CHARGE); 210 return str(LANG_BATTERY_TOPOFF_CHARGE);
211 else if (charge_state == TRICKLE) 211 else if (charge_state == TRICKLE)
212 return (char *)str(LANG_BATTERY_TRICKLE_CHARGE); 212 return str(LANG_BATTERY_TRICKLE_CHARGE);
213 else 213 else
214#else /* !ARCHOS_RECORDER */ 214#else /* !ARCHOS_RECORDER */
215 /* Go by what power management reports */ 215 /* Go by what power management reports */
216 if (charging_state()) 216 if (charging_state())
217 return (char *)str(LANG_BATTERY_CHARGE); 217 return str(LANG_BATTERY_CHARGE);
218 else 218 else
219#endif /* ARCHOS_RECORDER */ 219#endif /* ARCHOS_RECORDER */
220#endif /* CONFIG_CHARGING = */ 220#endif /* CONFIG_CHARGING = */
221 if (battery_level() >= 0) 221 if (battery_level() >= 0)
222 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_TIME), 222 snprintf(buffer, buffer_len, str(LANG_BATTERY_TIME),
223 battery_level(), battery_time() / 60, battery_time() % 60); 223 battery_level(), battery_time() / 60, battery_time() % 60);
224 else 224 else
225 return "(n/a)"; 225 return "(n/a)";
@@ -399,19 +399,19 @@ MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_ROCKBOX_INFO),
399 399
400 400
401/* sleep Menu */ 401/* sleep Menu */
402static void sleep_timer_formatter(char* buffer, size_t buffer_size, int value, 402static const char* sleep_timer_formatter(char* buffer, size_t buffer_size,
403 const char* unit) 403 int value, const char* unit)
404{ 404{
405 int minutes, hours;
406
407 (void) unit; 405 (void) unit;
406 int minutes, hours;
408 407
409 if (value) { 408 if (value) {
410 hours = value / 60; 409 hours = value / 60;
411 minutes = value - (hours * 60); 410 minutes = value - (hours * 60);
412 snprintf(buffer, buffer_size, "%d:%02d", hours, minutes); 411 snprintf(buffer, buffer_size, "%d:%02d", hours, minutes);
413 } else { 412 return buffer;
414 strlcpy(buffer, str(LANG_OFF), buffer_size); 413 } else {
414 return str(LANG_OFF);
415 } 415 }
416} 416}
417 417
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index c15a18291c..7b99b48a2d 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -415,7 +415,7 @@ static enum themable_icons trigger_get_icon(int selected_item, void * data)
415 return Icon_NOICON; 415 return Icon_NOICON;
416} 416}
417 417
418static char * trigger_get_name(int selected_item, void * data, 418static const char * trigger_get_name(int selected_item, void * data,
419 char * buffer, size_t buffer_len) 419 char * buffer, size_t buffer_len)
420{ 420{
421 const struct settings_list **settings = 421 const struct settings_list **settings =
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index a4950e22e8..5e8cf02c96 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -184,8 +184,8 @@ exit:
184} 184}
185 185
186/* Callback for gui_synclist */ 186/* Callback for gui_synclist */
187static char* playlist_callback_name(int selected_item, void* data, 187static const char* playlist_callback_name(int selected_item, void* data,
188 char* buffer, size_t buffer_len) 188 char* buffer, size_t buffer_len)
189{ 189{
190 char** playlists = (char**) data; 190 char** playlists = (char**) data;
191 191
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 7d3ff4ef9e..a829fc96f6 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -559,10 +559,10 @@ static int get_track_num( struct playlist_viewer * local_viewer,
559 return selected_item; 559 return selected_item;
560} 560}
561 561
562static char *playlist_callback_name(int selected_item, 562static const char* playlist_callback_name(int selected_item,
563 void *data, 563 void *data,
564 char *buffer, 564 char *buffer,
565 size_t buffer_len) 565 size_t buffer_len)
566{ 566{
567 struct playlist_viewer * local_viewer = (struct playlist_viewer *)data; 567 struct playlist_viewer * local_viewer = (struct playlist_viewer *)data;
568 568
@@ -778,15 +778,15 @@ exit:
778 return ret; 778 return ret;
779} 779}
780 780
781static char *playlist_search_callback_name(int selected_item, void * data, 781static const char* playlist_search_callback_name(int selected_item, void * data,
782 char *buffer, size_t buffer_len) 782 char *buffer, size_t buffer_len)
783{ 783{
784 (void)buffer_len; /* this should probably be used */ 784 (void)buffer_len; /* this should probably be used */
785 int *found_indicies = (int*)data; 785 int *found_indicies = (int*)data;
786 static struct playlist_track_info track; 786 static struct playlist_track_info track;
787 playlist_get_track_info(viewer.playlist, found_indicies[selected_item], &track); 787 playlist_get_track_info(viewer.playlist, found_indicies[selected_item], &track);
788 format_name(buffer, track.filename); 788 format_name(buffer, track.filename);
789 return(buffer); 789 return buffer;
790} 790}
791 791
792bool search_playlist(void) 792bool search_playlist(void)
diff --git a/apps/plugin.h b/apps/plugin.h
index 4cf319210c..4981230df3 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -133,12 +133,12 @@ void* plugin_get_buffer(size_t *buffer_size);
133#define PLUGIN_MAGIC 0x526F634B /* RocK */ 133#define PLUGIN_MAGIC 0x526F634B /* RocK */
134 134
135/* increase this every time the api struct changes */ 135/* increase this every time the api struct changes */
136#define PLUGIN_API_VERSION 170 136#define PLUGIN_API_VERSION 171
137 137
138/* update this to latest version if a change to the api struct breaks 138/* update this to latest version if a change to the api struct breaks
139 backwards compatibility (and please take the opportunity to sort in any 139 backwards compatibility (and please take the opportunity to sort in any
140 new function which are "waiting" at the end of the function table) */ 140 new function which are "waiting" at the end of the function table) */
141#define PLUGIN_MIN_API_VERSION 170 141#define PLUGIN_MIN_API_VERSION 171
142 142
143/* plugin return codes */ 143/* plugin return codes */
144enum plugin_status { 144enum plugin_status {
@@ -672,7 +672,7 @@ struct plugin_api {
672 bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, 672 bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
673 const int* variable, void (*function)(int), int step, 673 const int* variable, void (*function)(int), int step,
674 int min, int max, 674 int min, int max,
675 void (*formatter)(char*, size_t, int, const char*) ); 675 const char* (*formatter)(char*, size_t, int, const char*) );
676 bool (*set_bool)(const char* string, const bool* variable ); 676 bool (*set_bool)(const char* string, const bool* variable );
677 677
678#ifdef HAVE_LCD_COLOR 678#ifdef HAVE_LCD_COLOR
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index cfb92909bf..20b7fa9226 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -669,7 +669,7 @@ static bool edit_memo(int change, struct shown *shown)
669 return false; 669 return false;
670} 670}
671 671
672static char * get_event_text(int selected, void *data, 672static const char* get_event_text(int selected, void *data,
673 char *buffer, size_t buffer_len) 673 char *buffer, size_t buffer_len)
674{ 674{
675 struct shown *shown = (struct shown *) data; 675 struct shown *shown = (struct shown *) data;
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c
index cd163a5e1c..512fb0ca15 100644
--- a/apps/plugins/chessbox/chessbox_pgn.c
+++ b/apps/plugins/chessbox/chessbox_pgn.c
@@ -528,11 +528,10 @@ void coords_to_pgn(struct pgn_ply_node* ply){
528 } 528 }
529} 529}
530 530
531char * get_game_text(int selected_item, void *data, 531static const char* get_game_text(int selected_item, void *data,
532 char *buffer, size_t buffer_len){ 532 char *buffer, size_t buffer_len){
533 int i; 533 int i;
534 struct pgn_game_node *temp_node = (struct pgn_game_node *)data; 534 struct pgn_game_node *temp_node = (struct pgn_game_node *)data;
535 char text_buffer[50];
536 535
537 for (i=0;i<selected_item && temp_node != NULL;i++){ 536 for (i=0;i<selected_item && temp_node != NULL;i++){
538 temp_node = temp_node->next_node; 537 temp_node = temp_node->next_node;
@@ -540,10 +539,9 @@ char * get_game_text(int selected_item, void *data,
540 if (temp_node == NULL){ 539 if (temp_node == NULL){
541 return NULL; 540 return NULL;
542 } 541 }
543 rb->snprintf(text_buffer, 50,"%s vs. %s (%s)", temp_node->white_player, 542 rb->snprintf(buffer, buffer_len,"%s vs. %s (%s)", temp_node->white_player,
544 temp_node->black_player, temp_node->game_date); 543 temp_node->black_player, temp_node->game_date);
545 544
546 rb->strlcpy(buffer, text_buffer, buffer_len);
547 return buffer; 545 return buffer;
548} 546}
549 547
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c
index b7b9aa1770..84cc220891 100644
--- a/apps/plugins/disktidy.c
+++ b/apps/plugins/disktidy.c
@@ -380,8 +380,8 @@ enum themable_icons get_icon(int item, void * data)
380 return Icon_NOICON; 380 return Icon_NOICON;
381} 381}
382 382
383char * get_name(int selected_item, void * data, 383static const char* get_name(int selected_item, void * data,
384 char * buffer, size_t buffer_len) 384 char * buffer, size_t buffer_len)
385{ 385{
386 (void)data; 386 (void)data;
387 if (tidy_types[selected_item].directory) 387 if (tidy_types[selected_item].directory)
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index ca08ec1665..1d065cc981 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -550,14 +550,15 @@ static bool Doptions()
550 return (1); 550 return (1);
551} 551}
552 552
553char* choice_get_name(int selected_item, void * data, 553static const char* choice_get_name(int selected_item, void * data,
554 char * buffer, size_t buffer_len) 554 char * buffer, size_t buffer_len)
555{ 555{
556 char **names = (char **) data; 556 const char **names = (const char **) data;
557 (void) buffer; 557 (void) buffer;
558 (void) buffer_len; 558 (void) buffer_len;
559 return names[selected_item]; 559 return names[selected_item];
560} 560}
561
561int list_action_callback(int action, struct gui_synclist *lists) 562int list_action_callback(int action, struct gui_synclist *lists)
562{ 563{
563 (void) lists; 564 (void) lists;
@@ -565,6 +566,7 @@ int list_action_callback(int action, struct gui_synclist *lists)
565 return ACTION_STD_CANCEL; 566 return ACTION_STD_CANCEL;
566 return action; 567 return action;
567} 568}
569
568bool menuchoice(char **names, int count, int *selected) 570bool menuchoice(char **names, int count, int *selected)
569{ 571{
570 struct simplelist_info info; 572 struct simplelist_info info;
diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c
index 65a03f6953..4e20e71a37 100644
--- a/apps/plugins/goban/goban.c
+++ b/apps/plugins/goban/goban.c
@@ -114,37 +114,39 @@ set_defaults (void)
114 autosave_time = 7; 114 autosave_time = 7;
115} 115}
116 116
117static void 117static const char*
118komi_formatter (char *dest, size_t size, int menu_item, const char *unknown) 118komi_formatter (char *dest, size_t size, int menu_item, const char *unknown)
119{ 119{
120 (void) unknown; 120 (void) unknown;
121 snprint_fixed (dest, size, menu_item); 121 snprint_fixed (dest, size, menu_item);
122 return dest;
122} 123}
123 124
124static void 125static const char*
125ruleset_formatter (char *dest, size_t size, int menu_item, const char *unknown) 126ruleset_formatter (char *dest, size_t size, int menu_item, const char *unknown)
126{ 127{
127 (void) unknown; 128 (void)dest, (void)size, (void)unknown;
128 rb->snprintf (dest, size, "%s", ruleset_names[menu_item]); 129 return ruleset_names[menu_item];
129} 130}
130 131
131static void 132static const char*
132autosave_formatter (char *dest, size_t size, int menu_item, const char * 133autosave_formatter (char *dest, size_t size, int menu_item, const char *
133unknown) 134unknown)
134{ 135{
135 (void) unknown; 136 (void) unknown;
136 if (menu_item == 0) 137 if (menu_item == 0)
137 { 138 {
138 rb->snprintf (dest, size, "Off"); 139 return "Off";
139 } 140 }
140 else 141 else
141 { 142 {
142 rb->snprintf (dest, size, "%d minute%s", menu_item, 143 rb->snprintf (dest, size, "%d minute%s", menu_item,
143 menu_item == 1 ? "" : "s"); 144 menu_item == 1 ? "" : "s");
145 return dest;
144 } 146 }
145} 147}
146 148
147static void 149static const char*
148time_formatter (char *dest, size_t size, int menu_item, const char *unknown) 150time_formatter (char *dest, size_t size, int menu_item, const char *unknown)
149{ 151{
150 int time_values[4]; /* days hours minutes seconds */ 152 int time_values[4]; /* days hours minutes seconds */
@@ -183,8 +185,7 @@ time_formatter (char *dest, size_t size, int menu_item, const char *unknown)
183 185
184 if (max_set == -1) 186 if (max_set == -1)
185 { 187 {
186 rb->snprintf (dest, size, "0"); 188 return "0";
187 return;
188 } 189 }
189 190
190 for (i = min_set; i <= 3; ++i) 191 for (i = min_set; i <= 3; ++i)
@@ -236,6 +237,7 @@ time_formatter (char *dest, size_t size, int menu_item, const char *unknown)
236 dest += temp; 237 dest += temp;
237 size -= temp; 238 size -= temp;
238 } 239 }
240 return dest;
239} 241}
240 242
241enum plugin_status 243enum plugin_status
diff --git a/apps/plugins/goban/types.h b/apps/plugins/goban/types.h
index 216d41bc21..a7c2b9b0ae 100644
--- a/apps/plugins/goban/types.h
+++ b/apps/plugins/goban/types.h
@@ -218,7 +218,7 @@ struct prop_t
218 218
219 219
220/* The names of the rulesets, ex. "AGA", "Japanese", etc. */ 220/* The names of the rulesets, ex. "AGA", "Japanese", etc. */
221extern char *ruleset_names[]; 221extern const char *ruleset_names[];
222 222
223/* IMPORTANT! keep in sync with ruleset_names!!! */ 223/* IMPORTANT! keep in sync with ruleset_names!!! */
224enum ruleset_t 224enum ruleset_t
diff --git a/apps/plugins/goban/util.c b/apps/plugins/goban/util.c
index e9966311ef..0e83173f40 100644
--- a/apps/plugins/goban/util.c
+++ b/apps/plugins/goban/util.c
@@ -210,7 +210,7 @@ char *prop_names[] = {
210 210
211/* These seems to be specified by the SGF specification. You can do free 211/* These seems to be specified by the SGF specification. You can do free
212 form ones as well, but I haven't implemented that (and don't plan to) */ 212 form ones as well, but I haven't implemented that (and don't plan to) */
213char *ruleset_names[] = { "AGA", "Japanese", "Chinese", "NZ", "GOE" }; 213const char *ruleset_names[] = { "AGA", "Japanese", "Chinese", "NZ", "GOE" };
214 214
215 215
216 216
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 733c6e95cd..d926105962 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -122,8 +122,8 @@ MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
122 "Delete entry", 122 "Delete entry",
123 "Playback Control"); 123 "Playback Control");
124 124
125static char * kb_list_cb(int selected_item, void *data, 125static const char* kb_list_cb(int selected_item, void *data,
126 char *buffer, size_t buffer_len) 126 char *buffer, size_t buffer_len)
127{ 127{
128 (void)data; 128 (void)data;
129 int i; 129 int i;
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 62293d101f..3868d759f6 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -317,7 +317,7 @@ static bool mpeg_set_int(const char *string, const char *unit,
317 void (*function)(int), int step, 317 void (*function)(int), int step,
318 int min, 318 int min,
319 int max, 319 int max,
320 void (*formatter)(char*, size_t, int, const char*)) 320 const char* (*formatter)(char*, size_t, int, const char*))
321{ 321{
322 mpeg_menu_sysevent_clear(); 322 mpeg_menu_sysevent_clear();
323 323
@@ -350,15 +350,16 @@ static void backlight_brightness_function(int value)
350 mpeg_backlight_update_brightness(value); 350 mpeg_backlight_update_brightness(value);
351} 351}
352 352
353static void backlight_brightness_formatter(char *buf, size_t length, 353static const char* backlight_brightness_formatter(char *buf, size_t length,
354 int value, const char *input) 354 int value, const char *input)
355{ 355{
356 (void)input;
357
356 if (value < 0) 358 if (value < 0)
357 rb->strlcpy(buf, BACKLIGHT_OPTION_DEFAULT, length); 359 return BACKLIGHT_OPTION_DEFAULT;
358 else 360 else
359 rb->snprintf(buf, length, "%d", value + MIN_BRIGHTNESS_SETTING); 361 rb->snprintf(buf, length, "%d", value + MIN_BRIGHTNESS_SETTING);
360 362 return buf;
361 (void)input;
362} 363}
363#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 364#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
364 365
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index c76a25b06a..7cd29c126f 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -228,7 +228,8 @@ static bool dir_properties(char* selected_file)
228 return true; 228 return true;
229} 229}
230 230
231char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len) 231static const char * get_props(int selected_item, void* data,
232 char *buffer, size_t buffer_len)
232{ 233{
233 (void)data; 234 (void)data;
234 235
@@ -263,8 +264,7 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
263 rb->strlcpy(buffer, its_a_dir ? "" : str_duration, buffer_len); 264 rb->strlcpy(buffer, its_a_dir ? "" : str_duration, buffer_len);
264 break; 265 break;
265 default: 266 default:
266 rb->strlcpy(buffer, "ERROR", buffer_len); 267 return "ERROR";
267 break;
268 } 268 }
269 return buffer; 269 return buffer;
270} 270}
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index c9ffaed319..ba3f0d3f7e 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -234,7 +234,9 @@ void generate(void)
234 rb->close(fd); 234 rb->close(fd);
235 rb->splash(HZ, "Done"); 235 rb->splash(HZ, "Done");
236} 236}
237char *list_get_name_cb(int selected_item, void* data, char* buf, size_t buf_len) 237
238static const char* list_get_name_cb(int selected_item, void* data,
239 char* buf, size_t buf_len)
238{ 240{
239 (void)data; 241 (void)data;
240 rb->strlcpy(buf, list->folder[selected_item], buf_len); 242 rb->strlcpy(buf, list->folder[selected_item], buf_len);
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index 455c91b5b6..bd4088300c 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -270,10 +270,10 @@ static void slot_info(char *info_buf, size_t info_bufsiz, size_t slot_id) {
270/* 270/*
271 * slot_get_name 271 * slot_get_name
272 */ 272 */
273static char *slot_get_name(int selected_item, void * data, 273static const char* slot_get_name(int selected_item, void * data,
274 char * buffer, size_t buffer_len) 274 char * buffer, size_t buffer_len)
275{ 275{
276 char (*items)[20] = data; 276 const char (*items)[20] = data;
277 (void) buffer; 277 (void) buffer;
278 (void) buffer_len; 278 (void) buffer_len;
279 return items[selected_item]; 279 return items[selected_item];
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index a4084a2ca7..219f013ed8 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -600,8 +600,8 @@ char bbuf[MAX_PATH+1]; /* used by file and font browsers */
600char bbuf_s[MAX_PATH+1]; /* used by file and font browsers */ 600char bbuf_s[MAX_PATH+1]; /* used by file and font browsers */
601struct tree_context *tree = NULL; 601struct tree_context *tree = NULL;
602 602
603static char * browse_get_name_cb( int selected_item, void *data, 603static const char* browse_get_name_cb(int selected_item, void *data,
604 char *buffer, size_t buffer_len ) 604 char *buffer, size_t buffer_len)
605{ 605{
606 int *indexes = (int *) data; 606 int *indexes = (int *) data;
607 struct entry* dc = tree->dircache; 607 struct entry* dc = tree->dircache;
@@ -609,7 +609,7 @@ static char * browse_get_name_cb( int selected_item, void *data,
609 (void) buffer; 609 (void) buffer;
610 (void) buffer_len; 610 (void) buffer_len;
611 611
612 return (e->name); 612 return e->name;
613} 613}
614 614
615static bool browse( char *dst, int dst_size, const char *start ) 615static bool browse( char *dst, int dst_size, const char *start )
@@ -633,8 +633,8 @@ static bool browse( char *dst, int dst_size, const char *start )
633 } 633 }
634 bbuf_s[0] = '\0'; 634 bbuf_s[0] = '\0';
635 635
636 rb->gui_synclist_init( &browse_list, browse_get_name_cb, 636 rb->gui_synclist_init(&browse_list, browse_get_name_cb,
637 (void*) indexes, false, 1, NULL ); 637 (void*) indexes, false, 1, NULL);
638 638
639 tree = rb->tree_get_context(); 639 tree = rb->tree_get_context();
640 backup = *tree; 640 backup = *tree;
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c
index f6a26a519d..b964968737 100644
--- a/apps/plugins/shortcuts/shortcuts_view.c
+++ b/apps/plugins/shortcuts/shortcuts_view.c
@@ -40,8 +40,8 @@ static bool usb_connected = false;
40enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc); 40enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc);
41 41
42/* Will be passed sc_file* as data */ 42/* Will be passed sc_file* as data */
43char* build_sc_list(int selected_item, void *data, 43static const char* build_sc_list(int selected_item, void *data,
44 char *buffer, size_t buffer_len); 44 char *buffer, size_t buffer_len);
45 45
46/* Returns true iff we should leave the main loop */ 46/* Returns true iff we should leave the main loop */
47bool list_sc(void); 47bool list_sc(void);
@@ -89,8 +89,8 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist *gui_sc)
89} 89}
90 90
91 91
92char* build_sc_list(int selected_item, void *data, 92static const char* build_sc_list(int selected_item, void *data,
93 char *buffer, size_t buffer_len) 93 char *buffer, size_t buffer_len)
94{ 94{
95 sc_file_t *file = (sc_file_t*)data; 95 sc_file_t *file = (sc_file_t*)data;
96 96
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c
index d6b9621343..dc078170e9 100644
--- a/apps/plugins/superdom.c
+++ b/apps/plugins/superdom.c
@@ -1251,8 +1251,8 @@ int movement_menu(void) {
1251 return RET_VAL_OK; 1251 return RET_VAL_OK;
1252} 1252}
1253 1253
1254static char * inventory_data(int selected_item, void * data, 1254static const char* inventory_data(int selected_item, void * data,
1255 char * buffer, size_t buffer_len) { 1255 char * buffer, size_t buffer_len) {
1256 (void)data; 1256 (void)data;
1257 switch(selected_item) { 1257 switch(selected_item) {
1258 case 0: 1258 case 0:
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 473bb68ead..dc792046fa 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -121,8 +121,8 @@ int _do_action(int action, char* str, int line)
121 last_char_index = c; 121 last_char_index = c;
122 return 1; 122 return 1;
123} 123}
124char *list_get_name_cb(int selected_item, void* data, 124static const char* list_get_name_cb(int selected_item, void* data,
125 char* buf, size_t buf_len) 125 char* buf, size_t buf_len)
126{ 126{
127 (void)data; 127 (void)data;
128 char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; 128 char *b = &buffer[do_action(ACTION_GET,0,selected_item)];
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index c5729ba8b2..31610a363e 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -1347,8 +1347,8 @@ MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET),
1347 radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, 1347 radio_preset_callback, Icon_NOICON, &radio_edit_preset_item,
1348 &radio_delete_preset_item); 1348 &radio_delete_preset_item);
1349/* present a list of preset stations */ 1349/* present a list of preset stations */
1350static char * presets_get_name(int selected_item, void *data, 1350static const char* presets_get_name(int selected_item, void *data,
1351 char *buffer, size_t buffer_len) 1351 char *buffer, size_t buffer_len)
1352{ 1352{
1353 (void)data; 1353 (void)data;
1354 struct fmstation *p = &presets[selected_item]; 1354 struct fmstation *p = &presets[selected_item];
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 2716d932b5..d461df555d 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -848,8 +848,8 @@ enum rec_list_items_spdif {
848 848
849static int listid_to_enum[ITEM_COUNT]; 849static int listid_to_enum[ITEM_COUNT];
850 850
851static char * reclist_get_name(int selected_item, void * data, 851static const char* reclist_get_name(int selected_item, void * data,
852 char * buffer, size_t buffer_len) 852 char * buffer, size_t buffer_len)
853{ 853{
854 char buf2[32]; 854 char buf2[32];
855#ifdef HAVE_AGC 855#ifdef HAVE_AGC
diff --git a/apps/screens.c b/apps/screens.c
index 2bdd2dd061..ead6735a95 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -789,20 +789,22 @@ static const int id3_headers[]=
789#endif 789#endif
790 LANG_ID3_PATH, 790 LANG_ID3_PATH,
791}; 791};
792
792struct id3view_info { 793struct id3view_info {
793 struct mp3entry* id3; 794 struct mp3entry* id3;
794 int count; 795 int count;
795 int info_id[sizeof(id3_headers)/sizeof(id3_headers[0])]; 796 int info_id[ARRAYLEN(id3_headers)];
796}; 797};
797static char * id3_get_info(int selected_item, void* data, 798
798 char *buffer, size_t buffer_len) 799static const char* id3_get_info(int selected_item, void* data,
800 char *buffer, size_t buffer_len)
799{ 801{
800 struct id3view_info *info = (struct id3view_info*)data; 802 struct id3view_info *info = (struct id3view_info*)data;
801 struct mp3entry* id3 =info->id3; 803 struct mp3entry* id3 =info->id3;
802 int info_no=selected_item/2; 804 int info_no=selected_item/2;
803 if(!(selected_item%2)) 805 if(!(selected_item%2))
804 {/* header */ 806 {/* header */
805 return( str(id3_headers[info->info_id[info_no]])); 807 return(str(id3_headers[info->info_id[info_no]]));
806 } 808 }
807 else 809 else
808 {/* data */ 810 {/* data */
@@ -903,7 +905,7 @@ bool browse_id3(void)
903 struct id3view_info info; 905 struct id3view_info info;
904 info.count = 0; 906 info.count = 0;
905 info.id3 = id3; 907 info.id3 = id3;
906 for (i=0; i<sizeof(id3_headers)/sizeof(id3_headers[0]); i++) 908 for (i = 0; i < ARRAYLEN(id3_headers); i++)
907 { 909 {
908 char temp[8]; 910 char temp[8];
909 info.info_id[i] = i; 911 info.info_id[i] = i;
@@ -924,8 +926,8 @@ bool browse_id3(void)
924 } 926 }
925} 927}
926 928
927static char* runtime_get_data(int selected_item, void* data, 929static const char* runtime_get_data(int selected_item, void* data,
928 char* buffer, size_t buffer_len) 930 char* buffer, size_t buffer_len)
929{ 931{
930 (void)data; 932 (void)data;
931 int t; 933 int t;
diff --git a/apps/settings.c b/apps/settings.c
index b76468280e..98cd6ebc95 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1083,7 +1083,7 @@ bool set_int(const unsigned char* string,
1083 int step, 1083 int step,
1084 int min, 1084 int min,
1085 int max, 1085 int max,
1086 void (*formatter)(char*, size_t, int, const char*) ) 1086 const char* (*formatter)(char*, size_t, int, const char*) )
1087{ 1087{
1088 return set_int_ex(string, unit, voice_unit, variable, function, 1088 return set_int_ex(string, unit, voice_unit, variable, function,
1089 step, min, max, formatter, NULL); 1089 step, min, max, formatter, NULL);
@@ -1097,7 +1097,7 @@ bool set_int_ex(const unsigned char* string,
1097 int step, 1097 int step,
1098 int min, 1098 int min,
1099 int max, 1099 int max,
1100 void (*formatter)(char*, size_t, int, const char*), 1100 const char* (*formatter)(char*, size_t, int, const char*),
1101 int32_t (*get_talk_id)(int, int)) 1101 int32_t (*get_talk_id)(int, int))
1102{ 1102{
1103 (void)unit; 1103 (void)unit;
@@ -1117,17 +1117,18 @@ bool set_int_ex(const unsigned char* string,
1117 1117
1118 1118
1119static const struct opt_items *set_option_options; 1119static const struct opt_items *set_option_options;
1120static void set_option_formatter(char* buf, size_t size, int item, const char* unit) 1120static const char* set_option_formatter(char* buf, size_t size, int item, const char* unit)
1121{ 1121{
1122 (void)unit; 1122 (void)buf, (void)unit, (void)size;
1123 const unsigned char *text = set_option_options[item].string; 1123 return P2STR(set_option_options[item].string);
1124 strlcpy(buf, P2STR(text), size);
1125} 1124}
1125
1126static int32_t set_option_get_talk_id(int value, int unit) 1126static int32_t set_option_get_talk_id(int value, int unit)
1127{ 1127{
1128 (void)unit; 1128 (void)unit;
1129 return set_option_options[value].voice_id; 1129 return set_option_options[value].voice_id;
1130} 1130}
1131
1131bool set_option(const char* string, const void* variable, enum optiontype type, 1132bool set_option(const char* string, const void* variable, enum optiontype type,
1132 const struct opt_items* options, 1133 const struct opt_items* options,
1133 int numoptions, void (*function)(int)) 1134 int numoptions, void (*function)(int))
diff --git a/apps/settings.h b/apps/settings.h
index c45e3b3110..cbd7b6d3b3 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -271,13 +271,13 @@ bool set_bool(const char* string, const bool* variable);
271bool set_int(const unsigned char* string, const char* unit, int voice_unit, 271bool set_int(const unsigned char* string, const char* unit, int voice_unit,
272 const int* variable, 272 const int* variable,
273 void (*function)(int), int step, int min, int max, 273 void (*function)(int), int step, int min, int max,
274 void (*formatter)(char*, size_t, int, const char*) ); 274 const char* (*formatter)(char*, size_t, int, const char*) );
275 275
276/* use this one if you need to create a lang from the value (i.e with TALK_ID()) */ 276/* use this one if you need to create a lang from the value (i.e with TALK_ID()) */
277bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit, 277bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
278 const int* variable, 278 const int* variable,
279 void (*function)(int), int step, int min, int max, 279 void (*function)(int), int step, int min, int max,
280 void (*formatter)(char*, size_t, int, const char*), 280 const char* (*formatter)(char*, size_t, int, const char*),
281 int32_t (*get_talk_id)(int, int)); 281 int32_t (*get_talk_id)(int, int));
282 282
283void set_file(const char* filename, char* setting, int maxlen); 283void set_file(const char* filename, char* setting, int maxlen);
diff --git a/apps/settings_list.c b/apps/settings_list.c
index a9cfd79952..450d0eada4 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -269,13 +269,14 @@ static const char graphic_numeric[] = "graphic,numeric";
269 269
270#endif /* HAVE_RECORDING */ 270#endif /* HAVE_RECORDING */
271 271
272static void formatter_unit_0_is_off(char *buffer, size_t buffer_size, 272static const char* formatter_unit_0_is_off(char *buffer, size_t buffer_size,
273 int val, const char *unit) 273 int val, const char *unit)
274{ 274{
275 if (val == 0) 275 if (val == 0)
276 strcpy(buffer, str(LANG_OFF)); 276 return str(LANG_OFF);
277 else 277 else
278 snprintf(buffer, buffer_size, "%d %s", val, unit); 278 snprintf(buffer, buffer_size, "%d %s", val, unit);
279 return buffer;
279} 280}
280 281
281static int32_t getlang_unit_0_is_off(int value, int unit) 282static int32_t getlang_unit_0_is_off(int value, int unit)
@@ -286,16 +287,17 @@ static int32_t getlang_unit_0_is_off(int value, int unit)
286 return TALK_ID(value,unit); 287 return TALK_ID(value,unit);
287} 288}
288 289
289static void formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size, 290static const char* formatter_unit_0_is_skip_track(char *buffer, size_t buffer_size,
290 int val, const char *unit) 291 int val, const char *unit)
291{ 292{
292 (void)unit; 293 (void)unit;
293 if (val == 0) 294 if (val == 0)
294 strcpy(buffer, str(LANG_SKIP_TRACK)); 295 return str(LANG_SKIP_TRACK);
295 else if (val % 60 == 0) 296 else if (val % 60 == 0)
296 snprintf(buffer, buffer_size, "%d min", val/60); 297 snprintf(buffer, buffer_size, "%d min", val/60);
297 else 298 else
298 snprintf(buffer, buffer_size, "%d s", val); 299 snprintf(buffer, buffer_size, "%d s", val);
300 return buffer;
299} 301}
300 302
301static int32_t getlang_unit_0_is_skip_track(int value, int unit) 303static int32_t getlang_unit_0_is_skip_track(int value, int unit)
@@ -310,15 +312,16 @@ static int32_t getlang_unit_0_is_skip_track(int value, int unit)
310} 312}
311 313
312#ifdef HAVE_BACKLIGHT 314#ifdef HAVE_BACKLIGHT
313static void backlight_formatter(char *buffer, size_t buffer_size, 315static const char* backlight_formatter(char *buffer, size_t buffer_size,
314 int val, const char *unit) 316 int val, const char *unit)
315{ 317{
316 if (val == -1) 318 if (val == -1)
317 strcpy(buffer, str(LANG_OFF)); 319 return str(LANG_OFF);
318 else if (val == 0) 320 else if (val == 0)
319 strcpy(buffer, str(LANG_ON)); 321 return str(LANG_ON);
320 else 322 else
321 snprintf(buffer, buffer_size, "%d %s", val, unit); 323 snprintf(buffer, buffer_size, "%d %s", val, unit);
324 return buffer;
322} 325}
323static int32_t backlight_getlang(int value, int unit) 326static int32_t backlight_getlang(int value, int unit)
324{ 327{
@@ -332,14 +335,15 @@ static int32_t backlight_getlang(int value, int unit)
332#endif 335#endif
333 336
334#ifndef HAVE_WHEEL_ACCELERATION 337#ifndef HAVE_WHEEL_ACCELERATION
335static void scanaccel_formatter(char *buffer, size_t buffer_size, 338static const char* scanaccel_formatter(char *buffer, size_t buffer_size,
336 int val, const char *unit) 339 int val, const char *unit)
337{ 340{
338 (void)unit; 341 (void)unit;
339 if (val == 0) 342 if (val == 0)
340 strcpy(buffer, str(LANG_OFF)); 343 return str(LANG_OFF);
341 else 344 else
342 snprintf(buffer, buffer_size, "2x/%ds", val); 345 snprintf(buffer, buffer_size, "2x/%ds", val);
346 return buffer;
343} 347}
344#endif 348#endif
345 349
@@ -352,13 +356,14 @@ static void crossfeed_cross_set(int val)
352 global_settings.crossfeed_hf_cutoff); 356 global_settings.crossfeed_hf_cutoff);
353} 357}
354 358
355static void db_format(char* buffer, size_t buffer_size, int value, 359static const char* db_format(char* buffer, size_t buffer_size, int value,
356 const char* unit) 360 const char* unit)
357{ 361{
358 int v = abs(value); 362 int v = abs(value);
359 363
360 snprintf(buffer, buffer_size, "%s%d.%d %s", value < 0 ? "-" : "", 364 snprintf(buffer, buffer_size, "%s%d.%d %s", value < 0 ? "-" : "",
361 v / 10, v % 10, unit); 365 v / 10, v % 10, unit);
366 return buffer;
362} 367}
363 368
364static int32_t get_dec_talkid(int value, int unit) 369static int32_t get_dec_talkid(int value, int unit)
@@ -384,27 +389,25 @@ static void set_superbass(bool value)
384#endif 389#endif
385 390
386#ifdef HAVE_LCD_CHARCELLS 391#ifdef HAVE_LCD_CHARCELLS
387static void jumpscroll_format(char* buffer, size_t buffer_size, int value, 392static const char* jumpscroll_format(char* buffer, size_t buffer_size, int value,
388 const char* unit) 393 const char* unit)
389{ 394{
390 (void)unit; 395 (void)unit;
391 switch (value) 396 switch (value)
392 { 397 {
393 case 0: 398 case 0:
394 strcpy(buffer, str(LANG_OFF)); 399 return str(LANG_OFF);
395 break;
396 case 1: 400 case 1:
397 strcpy(buffer, str(LANG_ONE_TIME)); 401 return str(LANG_ONE_TIME);
398 break;
399 case 2: 402 case 2:
400 case 3: 403 case 3:
401 case 4: 404 case 4:
402 snprintf(buffer, buffer_size, "%d", value); 405 snprintf(buffer, buffer_size, "%d", value);
403 break; 406 break;
404 case 5: 407 case 5:
405 strcpy(buffer, str(LANG_ALWAYS)); 408 return str(LANG_ALWAYS);
406 break;
407 } 409 }
410 return buffer;
408} 411}
409static int32_t jumpscroll_getlang(int value, int unit) 412static int32_t jumpscroll_getlang(int value, int unit)
410{ 413{
diff --git a/apps/settings_list.h b/apps/settings_list.h
index 1bc529c7d9..9f1805f169 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -73,7 +73,7 @@ struct int_setting {
73 int min; 73 int min;
74 int max; 74 int max;
75 int step; 75 int step;
76 void (*formatter)(char*, size_t, int, const char*); 76 const char* (*formatter)(char*, size_t, int, const char*);
77 int32_t (*get_talk_id)(int, int); 77 int32_t (*get_talk_id)(int, int);
78}; 78};
79#define F_INT_SETTING 0x80 79#define F_INT_SETTING 0x80
@@ -92,7 +92,7 @@ struct choice_setting {
92 92
93struct table_setting { 93struct table_setting {
94 void (*option_callback)(int); 94 void (*option_callback)(int);
95 void (*formatter)(char*, size_t, int, const char*); 95 const char* (*formatter)(char*, size_t, int, const char*);
96 int32_t (*get_talk_id)(int, int); 96 int32_t (*get_talk_id)(int, int);
97 int unit; 97 int unit;
98 int count; 98 int count;
diff --git a/apps/tree.c b/apps/tree.c
index 667aea0572..228f491c15 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -106,8 +106,8 @@ static int ft_play_dirname(char* name);
106static void ft_play_filename(char *dir, char *file); 106static void ft_play_filename(char *dir, char *file);
107static void say_filetype(int attr); 107static void say_filetype(int attr);
108 108
109static char * tree_get_filename(int selected_item, void *data, 109static const char* tree_get_filename(int selected_item, void *data,
110 char *buffer, size_t buffer_len) 110 char *buffer, size_t buffer_len)
111{ 111{
112 struct tree_context * local_tc=(struct tree_context *)data; 112 struct tree_context * local_tc=(struct tree_context *)data;
113 char *name; 113 char *name;