summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2008-04-09 15:25:17 +0000
committerNils Wallménius <nils@rockbox.org>2008-04-09 15:25:17 +0000
commit6848961aa5f93a290917071ff3496e1d5026621b (patch)
tree70d377348ab0694c356fffd9fe25f095ccbe88fe
parentae64d2602befd5589c8c0141a6d812841fdfb232 (diff)
downloadrockbox-6848961aa5f93a290917071ff3496e1d5026621b.tar.gz
rockbox-6848961aa5f93a290917071ff3496e1d5026621b.zip
Pass the buffer length to the list_get_name callback functions instead of using hardcoded MAX_PATH
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17049 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/bookmark.c14
-rw-r--r--apps/cuesheet.c9
-rw-r--r--apps/debug_menu.c28
-rw-r--r--apps/filetypes.c13
-rw-r--r--apps/gui/bitmap/list.c3
-rw-r--r--apps/gui/charcell/list.c3
-rw-r--r--apps/gui/list.c10
-rw-r--r--apps/gui/list.h4
-rw-r--r--apps/gui/option_select.c6
-rw-r--r--apps/menu.c7
-rw-r--r--apps/menus/main_menu.c33
-rw-r--r--apps/playlist_catalog.c4
-rw-r--r--apps/playlist_viewer.c15
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.c5
-rw-r--r--apps/plugins/lib/oldmenuapi.c5
-rw-r--r--apps/plugins/properties.c21
-rw-r--r--apps/plugins/random_folder_advance_config.c4
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c10
-rw-r--r--apps/plugins/text_editor.c15
-rw-r--r--apps/recorder/radio.c5
-rw-r--r--apps/screens.c29
-rw-r--r--apps/tree.c5
22 files changed, 146 insertions, 102 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 39a9aa07d2..363660306c 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -96,7 +96,10 @@ static bool parse_bookmark(const char *bookmark,
96 bool *shuffle, 96 bool *shuffle,
97 char* file_name); 97 char* file_name);
98static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line); 98static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line);
99static char* get_bookmark_info(int list_index, void* data, char *buffer); 99static char* get_bookmark_info(int list_index,
100 void* data,
101 char *buffer,
102 size_t buffer_len);
100static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); 103static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume);
101static bool system_check(void); 104static bool system_check(void);
102static bool write_bookmark(bool create_bookmark_file); 105static bool write_bookmark(bool create_bookmark_file);
@@ -523,7 +526,10 @@ static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line)
523 return bookmarks->start + bookmarks->count; 526 return bookmarks->start + bookmarks->count;
524} 527}
525 528
526static char* get_bookmark_info(int list_index, void* data, char *buffer) 529static char* get_bookmark_info(int list_index,
530 void* data,
531 char *buffer,
532 size_t buffer_len)
527{ 533{
528 struct bookmark_list* bookmarks = (struct bookmark_list*) data; 534 struct bookmark_list* bookmarks = (struct bookmark_list*) data;
529 int index = list_index / 2; 535 int index = list_index / 2;
@@ -625,7 +631,7 @@ static char* get_bookmark_info(int list_index, void* data, char *buffer)
625 } 631 }
626 632
627 strrsplt(global_filename, '.'); 633 strrsplt(global_filename, '.');
628 snprintf(buffer, MAX_PATH, format, name, global_filename); 634 snprintf(buffer, buffer_len, format, name, global_filename);
629 return buffer; 635 return buffer;
630 } 636 }
631 else 637 else
@@ -633,7 +639,7 @@ static char* get_bookmark_info(int list_index, void* data, char *buffer)
633 char time_buf[32]; 639 char time_buf[32];
634 640
635 format_time(time_buf, sizeof(time_buf), resume_time); 641 format_time(time_buf, sizeof(time_buf), resume_time);
636 snprintf(buffer, MAX_PATH, "%s, %d%s", time_buf, resume_index + 1, 642 snprintf(buffer, buffer_len, "%s, %d%s", time_buf, resume_index + 1,
637 shuffle ? (char*) str(LANG_BOOKMARK_SHUFFLE) : ""); 643 shuffle ? (char*) str(LANG_BOOKMARK_SHUFFLE) : "");
638 return buffer; 644 return buffer;
639 } 645 }
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index de5a258ca8..ba6bc9659d 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -266,16 +266,17 @@ int cue_find_current_track(struct cuesheet *cue, unsigned long curpos)
266 266
267/* callback that gives list item titles for the cuesheet browser */ 267/* callback that gives list item titles for the cuesheet browser */
268static char *list_get_name_cb(int selected_item, 268static char *list_get_name_cb(int selected_item,
269 void *data, 269 void *data,
270 char *buffer) 270 char *buffer,
271 size_t buffer_len)
271{ 272{
272 struct cuesheet *cue = (struct cuesheet *)data; 273 struct cuesheet *cue = (struct cuesheet *)data;
273 274
274 if (selected_item & 1) 275 if (selected_item & 1)
275 snprintf(buffer, MAX_PATH, "%s", 276 snprintf(buffer, buffer_len, "%s",
276 cue->tracks[selected_item/2].title); 277 cue->tracks[selected_item/2].title);
277 else 278 else
278 snprintf(buffer, MAX_PATH, "%02d. %s", selected_item/2+1, 279 snprintf(buffer, buffer_len, "%02d. %s", selected_item/2+1,
279 cue->tracks[selected_item/2].performer); 280 cue->tracks[selected_item/2].performer);
280 281
281 return buffer; 282 return buffer;
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5c8a7f965f..d2d30ab675 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -134,7 +134,8 @@ static char thread_status_char(unsigned status)
134 return thread_status_chars[status]; 134 return thread_status_chars[status];
135} 135}
136 136
137static char* threads_getname(int selected_item, void * data, char *buffer) 137static char* threads_getname(int selected_item, void *data,
138 char *buffer, size_t buffer_len)
138{ 139{
139 (void)data; 140 (void)data;
140 struct thread_entry *thread; 141 struct thread_entry *thread;
@@ -143,7 +144,7 @@ static char* threads_getname(int selected_item, void * data, char *buffer)
143#if NUM_CORES > 1 144#if NUM_CORES > 1
144 if (selected_item < (int)NUM_CORES) 145 if (selected_item < (int)NUM_CORES)
145 { 146 {
146 snprintf(buffer, MAX_PATH, "Idle (%d): %2d%%", selected_item, 147 snprintf(buffer, buffer_len, "Idle (%d): %2d%%", selected_item,
147 idle_stack_usage(selected_item)); 148 idle_stack_usage(selected_item));
148 return buffer; 149 return buffer;
149 } 150 }
@@ -155,13 +156,13 @@ static char* threads_getname(int selected_item, void * data, char *buffer)
155 156
156 if (thread->state == STATE_KILLED) 157 if (thread->state == STATE_KILLED)
157 { 158 {
158 snprintf(buffer, MAX_PATH, "%2d: ---", selected_item); 159 snprintf(buffer, buffer_len, "%2d: ---", selected_item);
159 return buffer; 160 return buffer;
160 } 161 }
161 162
162 thread_get_name(name, 32, thread); 163 thread_get_name(name, 32, thread);
163 164
164 snprintf(buffer, MAX_PATH, 165 snprintf(buffer, buffer_len,
165 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s", 166 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
166 selected_item, 167 selected_item,
167 IF_COP(thread->core,) 168 IF_COP(thread->core,)
@@ -771,18 +772,19 @@ static bool dbg_hw_info(void)
771#endif /* !SIMULATOR */ 772#endif /* !SIMULATOR */
772 773
773#ifndef SIMULATOR 774#ifndef SIMULATOR
774static char* dbg_partitions_getname(int selected_item, void * data, char *buffer) 775static char* dbg_partitions_getname(int selected_item, void *data,
776 char *buffer, size_t buffer_len)
775{ 777{
776 (void)data; 778 (void)data;
777 int partition = selected_item/2; 779 int partition = selected_item/2;
778 struct partinfo* p = disk_partinfo(partition); 780 struct partinfo* p = disk_partinfo(partition);
779 if (selected_item%2) 781 if (selected_item%2)
780 { 782 {
781 snprintf(buffer, MAX_PATH, " T:%x %ld MB", p->type, p->size / 2048); 783 snprintf(buffer, buffer_len, " T:%x %ld MB", p->type, p->size / 2048);
782 } 784 }
783 else 785 else
784 { 786 {
785 snprintf(buffer, MAX_PATH, "P%d: S:%lx", partition, p->start); 787 snprintf(buffer, buffer_len, "P%d: S:%lx", partition, p->start);
786 } 788 }
787 return buffer; 789 return buffer;
788} 790}
@@ -1468,7 +1470,8 @@ char *itob(int n, int len)
1468 binary[j] = '\0'; 1470 binary[j] = '\0';
1469 return binary; 1471 return binary;
1470} 1472}
1471static char* tsc2100_debug_getname(int selected_item, void * data, char *buffer) 1473static char* tsc2100_debug_getname(int selected_item, void * data,
1474 char *buffer, size_t buffer_len)
1472{ 1475{
1473 int *page = (int*)data; 1476 int *page = (int*)data;
1474 bool reserved = false; 1477 bool reserved = false;
@@ -1491,9 +1494,9 @@ static char* tsc2100_debug_getname(int selected_item, void * data, char *buffer)
1491 break; 1494 break;
1492 } 1495 }
1493 if (reserved) 1496 if (reserved)
1494 snprintf(buffer, MAX_PATH, "%02x: RESERVED", selected_item); 1497 snprintf(buffer, buffer_len, "%02x: RESERVED", selected_item);
1495 else 1498 else
1496 snprintf(buffer, MAX_PATH, "%02x: %s", selected_item, 1499 snprintf(buffer, buffer_len, "%02x: %s", selected_item,
1497 itob(tsc2100_readreg(*page, selected_item)&0xffff,16)); 1500 itob(tsc2100_readreg(*page, selected_item)&0xffff,16));
1498 return buffer; 1501 return buffer;
1499} 1502}
@@ -2491,9 +2494,10 @@ static int menu_action_callback(int btn, struct gui_synclist *lists)
2491 } 2494 }
2492 return btn; 2495 return btn;
2493} 2496}
2494static char* dbg_menu_getname(int item, void * data, char *buffer) 2497static char* dbg_menu_getname(int item, void * data,
2498 char *buffer, size_t buffer_len)
2495{ 2499{
2496 (void)data; (void)buffer; 2500 (void)data; (void)buffer; (void)buffer_len;
2497 return menuitems[item].desc; 2501 return menuitems[item].desc;
2498} 2502}
2499bool debug_menu(void) 2503bool debug_menu(void)
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 1ef136d5ce..c63f37ea27 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -421,15 +421,18 @@ struct cb_data {
421 int *items; 421 int *items;
422 char *current_file; 422 char *current_file;
423}; 423};
424enum themable_icons openwith_get_icon(int selected_item, void * data) 424
425static enum themable_icons openwith_get_icon(int selected_item, void * data)
425{ 426{
426 struct cb_data *info = (struct cb_data *)data; 427 struct cb_data *info = (struct cb_data *)data;
427 int *items = info->items; 428 int *items = info->items;
428 return filetypes[items[selected_item]].icon; 429 return filetypes[items[selected_item]].icon;
429} 430}
430char * openwith_get_name(int selected_item, void * data, char * buffer) 431
432static char * openwith_get_name(int selected_item, void * data,
433 char * buffer, size_t buffer_len)
431{ 434{
432 (void)buffer; 435 (void)buffer; (void)buffer_len;
433 struct cb_data *info = (struct cb_data *)data; 436 struct cb_data *info = (struct cb_data *)data;
434 int *items = info->items; 437 int *items = info->items;
435 char *s = strrchr(filetypes[items[selected_item]].plugin, '/'); 438 char *s = strrchr(filetypes[items[selected_item]].plugin, '/');
@@ -437,7 +440,8 @@ char * openwith_get_name(int selected_item, void * data, char * buffer)
437 return s+1; 440 return s+1;
438 else return filetypes[items[selected_item]].plugin; 441 else return filetypes[items[selected_item]].plugin;
439} 442}
440int openwith_action_callback(int action, struct gui_synclist *lists) 443
444static int openwith_action_callback(int action, struct gui_synclist *lists)
441{ 445{
442 struct cb_data *info = (struct cb_data *)lists->data; 446 struct cb_data *info = (struct cb_data *)lists->data;
443 int *items = info->items; 447 int *items = info->items;
@@ -453,6 +457,7 @@ int openwith_action_callback(int action, struct gui_synclist *lists)
453 } 457 }
454 return action; 458 return action;
455} 459}
460
456int filetype_list_viewers(const char* current_file) 461int filetype_list_viewers(const char* current_file)
457{ 462{
458 int i, count = 0; 463 int i, count = 0;
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 13329e22f9..869acc539c 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -178,7 +178,8 @@ void list_draw(struct screen *display, struct viewport *parent,
178 char entry_buffer[MAX_PATH]; 178 char entry_buffer[MAX_PATH];
179 unsigned char *entry_name; 179 unsigned char *entry_name;
180 int text_pos = 0; 180 int text_pos = 0;
181 s = list->callback_get_item_name(i, list->data, entry_buffer); 181 s = list->callback_get_item_name(i, list->data, entry_buffer,
182 sizeof(entry_buffer));
182 entry_name = P2STR(s); 183 entry_name = P2STR(s);
183 display->set_viewport(&list_text[display->screen_type]); 184 display->set_viewport(&list_text[display->screen_type]);
184 list_text[display->screen_type].drawmode = STYLE_DEFAULT; 185 list_text[display->screen_type].drawmode = STYLE_DEFAULT;
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c
index 3d699e84dd..64f2fecbbd 100644
--- a/apps/gui/charcell/list.c
+++ b/apps/gui/charcell/list.c
@@ -82,7 +82,8 @@ void list_draw(struct screen *display, struct viewport *parent,
82 break; 82 break;
83 s = gui_list->callback_get_item_name(current_item, 83 s = gui_list->callback_get_item_name(current_item,
84 gui_list->data, 84 gui_list->data,
85 entry_buffer); 85 entry_buffer,
86 sizeof(entry_buffer));
86 entry_name = P2STR(s); 87 entry_name = P2STR(s);
87 88
88 89
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 07ef578d29..2ba4d4e762 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -815,17 +815,21 @@ void simplelist_addline(int line_number, const char *fmt, ...)
815 va_end(ap); 815 va_end(ap);
816} 816}
817 817
818static char* simplelist_static_getname(int item, void * data, char *buffer) 818static char* simplelist_static_getname(int item,
819 void * data,
820 char *buffer,
821 size_t buffer_len)
819{ 822{
820 (void)data; (void)buffer; 823 (void)data; (void)buffer; (void)buffer_len;
821 return simplelist_text[item]; 824 return simplelist_text[item];
822} 825}
826
823bool simplelist_show_list(struct simplelist_info *info) 827bool simplelist_show_list(struct simplelist_info *info)
824{ 828{
825 struct gui_synclist lists; 829 struct gui_synclist lists;
826 struct viewport vp[NB_SCREENS]; 830 struct viewport vp[NB_SCREENS];
827 int action, old_line_count = simplelist_line_count,i; 831 int action, old_line_count = simplelist_line_count,i;
828 char* (*getname)(int item, void * data, char *buffer); 832 char* (*getname)(int item, void * data, char *buffer, size_t buffer_len);
829 if (info->get_name) 833 if (info->get_name)
830 getname = info->get_name; 834 getname = info->get_name;
831 else 835 else
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 30de784687..8006847806 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -59,9 +59,11 @@ typedef enum themable_icons list_get_icon(int selected_item, void * data);
59 * (The content of the buffer may not be used by the list, we use 59 * (The content of the buffer may not be used by the list, we use
60 * the return value of the function in all cases to avoid filling 60 * the return value of the function in all cases to avoid filling
61 * a buffer when it's not necessary) 61 * a buffer when it's not necessary)
62 * - buffer_len : length of the buffer
62 * Returns a pointer to a string that contains the text to display 63 * Returns a pointer to a string that contains the text to display
63 */ 64 */
64typedef char * list_get_name(int selected_item, void * data, char * buffer); 65typedef char * list_get_name(int selected_item, void * data,
66 char * buffer, size_t buffer_len);
65/* 67/*
66 * Voice callback 68 * Voice callback
67 * - selected_item : an integer that tells the number of the item to speak 69 * - 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 412a82d688..cee445d8c3 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -331,10 +331,12 @@ static int selection_to_val(struct settings_list *setting, int selection)
331 return max- (selection * step); 331 return max- (selection * step);
332} 332}
333static char * value_setting_get_name_cb(int selected_item, 333static char * value_setting_get_name_cb(int selected_item,
334 void * data, char *buffer) 334 void * data,
335 char *buffer,
336 size_t buffer_len)
335{ 337{
336 selected_item = selection_to_val(data, selected_item); 338 selected_item = selection_to_val(data, selected_item);
337 return option_get_valuestring(data, buffer, MAX_PATH, selected_item); 339 return option_get_valuestring(data, buffer, buffer_len, selected_item);
338} 340}
339 341
340/* wrapper to convert from int param to bool param in option_screen */ 342/* wrapper to convert from int param to bool param in option_screen */
diff --git a/apps/menu.c b/apps/menu.c
index de17f2a809..c215d6812d 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -93,13 +93,16 @@ 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,void * data, char *buffer) 96static char * get_menu_item_name(int selected_item,
97 void * data,
98 char *buffer,
99 size_t buffer_len)
97{ 100{
98 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;
99 int type = (menu->flags&MENU_TYPE_MASK); 102 int type = (menu->flags&MENU_TYPE_MASK);
100 selected_item = get_menu_selection(selected_item, menu); 103 selected_item = get_menu_selection(selected_item, menu);
101 104
102 (void)buffer; 105 (void)buffer_len;
103 /* only MT_MENU or MT_RETURN_ID is allowed in here */ 106 /* only MT_MENU or MT_RETURN_ID is allowed in here */
104 if (type == MT_RETURN_ID) 107 if (type == MT_RETURN_ID)
105 { 108 {
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 0278af3668..4ca76e3c80 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -146,7 +146,8 @@ enum infoscreenorder
146}; 146};
147 147
148 148
149static char* info_getname(int selected_item, void *data, char *buffer) 149static char* info_getname(int selected_item, void *data,
150 char *buffer, size_t buffer_len)
150{ 151{
151 struct info_data *info = (struct info_data*)data; 152 struct info_data *info = (struct info_data*)data;
152#if CONFIG_RTC 153#if CONFIG_RTC
@@ -176,13 +177,13 @@ static char* info_getname(int selected_item, void *data, char *buffer)
176 switch (selected_item) 177 switch (selected_item)
177 { 178 {
178 case INFO_VERSION: 179 case INFO_VERSION:
179 snprintf(buffer, MAX_PATH, "%s: %s", 180 snprintf(buffer, buffer_len, "%s: %s",
180 str(LANG_VERSION), appsversion); 181 str(LANG_VERSION), appsversion);
181 break; 182 break;
182#if CONFIG_RTC 183#if CONFIG_RTC
183 case INFO_TIME: 184 case INFO_TIME:
184 tm = get_time(); 185 tm = get_time();
185 snprintf(buffer, MAX_PATH, "%02d:%02d:%02d %s", 186 snprintf(buffer, buffer_len, "%02d:%02d:%02d %s",
186 global_settings.timeformat == 0 ? tm->tm_hour : 187 global_settings.timeformat == 0 ? tm->tm_hour :
187 ((tm->tm_hour + 11) % 12) + 1, 188 ((tm->tm_hour + 11) % 12) + 1,
188 tm->tm_min, 189 tm->tm_min,
@@ -192,7 +193,7 @@ static char* info_getname(int selected_item, void *data, char *buffer)
192 break; 193 break;
193 case INFO_DATE: 194 case INFO_DATE:
194 tm = get_time(); 195 tm = get_time();
195 snprintf(buffer, MAX_PATH, "%s %d %d", 196 snprintf(buffer, buffer_len, "%s %d %d",
196 str(LANG_MONTH_JANUARY + tm->tm_mon), 197 str(LANG_MONTH_JANUARY + tm->tm_mon),
197 tm->tm_mday, 198 tm->tm_mday,
198 tm->tm_year+1900); 199 tm->tm_year+1900);
@@ -203,31 +204,31 @@ static char* info_getname(int selected_item, void *data, char *buffer)
203 long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */ 204 long buflen = ((audiobufend - audiobuf) * 2) / 2097; /* avoid overflow */
204 int integer = buflen / 1000; 205 int integer = buflen / 1000;
205 int decimal = buflen % 1000; 206 int decimal = buflen % 1000;
206 snprintf(buffer, MAX_PATH, (char *)str(LANG_BUFFER_STAT), 207 snprintf(buffer, buffer_len, (char *)str(LANG_BUFFER_STAT),
207 integer, decimal); 208 integer, decimal);
208 } 209 }
209 break; 210 break;
210 case INFO_BATTERY: /* battery */ 211 case INFO_BATTERY: /* battery */
211#if CONFIG_CHARGING == CHARGING_SIMPLE 212#if CONFIG_CHARGING == CHARGING_SIMPLE
212 if (charger_input_state == CHARGER) 213 if (charger_input_state == CHARGER)
213 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); 214 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_CHARGE));
214 else 215 else
215#elif CONFIG_CHARGING >= CHARGING_MONITOR 216#elif CONFIG_CHARGING >= CHARGING_MONITOR
216 if (charge_state == CHARGING) 217 if (charge_state == CHARGING)
217 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_CHARGE)); 218 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_CHARGE));
218 else 219 else
219#if CONFIG_CHARGING == CHARGING_CONTROL 220#if CONFIG_CHARGING == CHARGING_CONTROL
220 if (charge_state == TOPOFF) 221 if (charge_state == TOPOFF)
221 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_TOPOFF_CHARGE)); 222 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_TOPOFF_CHARGE));
222 else 223 else
223#endif 224#endif
224 if (charge_state == TRICKLE) 225 if (charge_state == TRICKLE)
225 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_TRICKLE_CHARGE)); 226 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_TRICKLE_CHARGE));
226 else 227 else
227#endif 228#endif
228 if (battery_level() >= 0) 229 if (battery_level() >= 0)
229 snprintf(buffer, MAX_PATH, (char *)str(LANG_BATTERY_TIME), battery_level(), 230 snprintf(buffer, buffer_len, (char *)str(LANG_BATTERY_TIME),
230 battery_time() / 60, battery_time() % 60); 231 battery_level(), battery_time() / 60, battery_time() % 60);
231 else 232 else
232 strcpy(buffer, "(n/a)"); 233 strcpy(buffer, "(n/a)");
233 break; 234 break;
@@ -235,11 +236,11 @@ static char* info_getname(int selected_item, void *data, char *buffer)
235#ifdef HAVE_MULTIVOLUME 236#ifdef HAVE_MULTIVOLUME
236 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true); 237 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
237 output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true); 238 output_dyn_value(s2, sizeof s2, info->size, kbyte_units, true);
238 snprintf(buffer, MAX_PATH, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL), 239 snprintf(buffer, buffer_len, "%s %s/%s", str(LANG_DISK_NAME_INTERNAL),
239 s1, s2); 240 s1, s2);
240#else 241#else
241 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true); 242 output_dyn_value(s1, sizeof s1, info->free, kbyte_units, true);
242 snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1); 243 snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_FREE_INFO), s1);
243#endif 244#endif
244 break; 245 break;
245 case INFO_DISK2: /* disk usage 2 */ 246 case INFO_DISK2: /* disk usage 2 */
@@ -248,17 +249,17 @@ static char* info_getname(int selected_item, void *data, char *buffer)
248 { 249 {
249 output_dyn_value(s1, sizeof s1, info->free2, kbyte_units, true); 250 output_dyn_value(s1, sizeof s1, info->free2, kbyte_units, true);
250 output_dyn_value(s2, sizeof s2, info->size2, kbyte_units, true); 251 output_dyn_value(s2, sizeof s2, info->size2, kbyte_units, true);
251 snprintf(buffer, MAX_PATH, "%s %s/%s", str(LANG_DISK_NAME_MMC), 252 snprintf(buffer, buffer_len, "%s %s/%s", str(LANG_DISK_NAME_MMC),
252 s1, s2); 253 s1, s2);
253 } 254 }
254 else 255 else
255 { 256 {
256 snprintf(buffer, MAX_PATH, "%s %s", str(LANG_DISK_NAME_MMC), 257 snprintf(buffer, buffer_len, "%s %s", str(LANG_DISK_NAME_MMC),
257 str(LANG_NOT_PRESENT)); 258 str(LANG_NOT_PRESENT));
258 } 259 }
259#else 260#else
260 output_dyn_value(s1, sizeof s1, info->size, kbyte_units, true); 261 output_dyn_value(s1, sizeof s1, info->size, kbyte_units, true);
261 snprintf(buffer, MAX_PATH, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1); 262 snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
262#endif 263#endif
263 break; 264 break;
264 } 265 }
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index af65353b67..3eb884483c 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -188,11 +188,11 @@ exit:
188 188
189/* Callback for gui_synclist */ 189/* Callback for gui_synclist */
190static char* playlist_callback_name(int selected_item, void* data, 190static char* playlist_callback_name(int selected_item, void* data,
191 char* buffer) 191 char* buffer, size_t buffer_len)
192{ 192{
193 char** playlists = (char**) data; 193 char** playlists = (char**) data;
194 194
195 strncpy(buffer, playlists[selected_item], MAX_PATH); 195 strncpy(buffer, playlists[selected_item], buffer_len);
196 196
197 if (buffer[0] != '.' && !(global_settings.show_filename_ext == 1 197 if (buffer[0] != '.' && !(global_settings.show_filename_ext == 1
198 || (global_settings.show_filename_ext == 3 198 || (global_settings.show_filename_ext == 3
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index c34957b332..9483dadfab 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -544,11 +544,14 @@ static int get_track_num( struct playlist_viewer * local_viewer,
544 return selected_item; 544 return selected_item;
545} 545}
546 546
547static char *playlist_callback_name(int selected_item, void *data, char *buffer) 547static char *playlist_callback_name(int selected_item,
548 void *data,
549 char *buffer,
550 size_t buffer_len)
548{ 551{
549 struct playlist_viewer * local_viewer = (struct playlist_viewer *)data; 552 struct playlist_viewer * local_viewer = (struct playlist_viewer *)data;
550 struct playlist_entry *track = playlist_buffer_get_track(&(local_viewer->buffer), get_track_num(local_viewer,selected_item)); 553 struct playlist_entry *track = playlist_buffer_get_track(&(local_viewer->buffer), get_track_num(local_viewer,selected_item));
551 format_line(track, buffer, MAX_PATH); 554 format_line(track, buffer, buffer_len);
552 return(buffer); 555 return(buffer);
553} 556}
554 557
@@ -752,12 +755,14 @@ exit:
752 return ret; 755 return ret;
753} 756}
754 757
755static char *playlist_search_callback_name(int selected_item, void * data, char *buffer) 758static char *playlist_search_callback_name(int selected_item, void * data,
759 char *buffer, size_t buffer_len)
756{ 760{
761 (void)buffer_len; /* this should probably be used */
757 int *found_indicies = (int*)data; 762 int *found_indicies = (int*)data;
758 static struct playlist_track_info track; 763 static struct playlist_track_info track;
759 playlist_get_track_info(viewer.playlist,found_indicies[selected_item],&track); 764 playlist_get_track_info(viewer.playlist, found_indicies[selected_item], &track);
760 format_name(buffer,track.filename); 765 format_name(buffer, track.filename);
761 return(buffer); 766 return(buffer);
762} 767}
763 768
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c
index 6d18986f95..94bda2eaaa 100644
--- a/apps/plugins/chessbox/chessbox_pgn.c
+++ b/apps/plugins/chessbox/chessbox_pgn.c
@@ -527,7 +527,8 @@ void coords_to_pgn(struct pgn_ply_node* ply){
527 } 527 }
528} 528}
529 529
530char * get_game_text(int selected_item, void *data, char *buffer){ 530char * get_game_text(int selected_item, void *data,
531 char *buffer, size_t buffer_len){
531 int i; 532 int i;
532 struct pgn_game_node *temp_node = (struct pgn_game_node *)data; 533 struct pgn_game_node *temp_node = (struct pgn_game_node *)data;
533 char text_buffer[50]; 534 char text_buffer[50];
@@ -541,7 +542,7 @@ char * get_game_text(int selected_item, void *data, char *buffer){
541 rb->snprintf(text_buffer, 50,"%s vs. %s (%s)", temp_node->white_player, 542 rb->snprintf(text_buffer, 50,"%s vs. %s (%s)", temp_node->white_player,
542 temp_node->black_player, temp_node->game_date); 543 temp_node->black_player, temp_node->game_date);
543 544
544 rb->strcpy(buffer, text_buffer); 545 rb->strncpy(buffer, text_buffer, buffer_len);
545 return buffer; 546 return buffer;
546} 547}
547 548
diff --git a/apps/plugins/lib/oldmenuapi.c b/apps/plugins/lib/oldmenuapi.c
index c21e55f5fc..27e4fdd49e 100644
--- a/apps/plugins/lib/oldmenuapi.c
+++ b/apps/plugins/lib/oldmenuapi.c
@@ -40,10 +40,11 @@ struct menu {
40static struct menu menus[MAX_MENUS]; 40static struct menu menus[MAX_MENUS];
41static bool inuse[MAX_MENUS] = { false }; 41static bool inuse[MAX_MENUS] = { false };
42 42
43static char * menu_get_itemname(int selected_item, void * data, char *buffer) 43static char * menu_get_itemname(int selected_item, void * data,
44 char *buffer, size_t buffer_len)
44{ 45{
46 (void)buffer; (void)buffer_len;
45 struct menu *local_menus=(struct menu *)data; 47 struct menu *local_menus=(struct menu *)data;
46 (void)buffer;
47 return(local_menus->items[selected_item].desc); 48 return(local_menus->items[selected_item].desc);
48} 49}
49 50
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 8b1f6ee636..27805154b3 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -214,38 +214,39 @@ static bool dir_properties(char* selected_file)
214 return true; 214 return true;
215} 215}
216 216
217char * get_props(int selected_item, void* data, char *buffer) 217char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
218{ 218{
219 (void)data; 219 (void)data;
220 220
221 switch(selected_item) 221 switch(selected_item)
222 { 222 {
223 case 0: 223 case 0:
224 rb->strcpy(buffer, str_dirname); 224 rb->strncpy(buffer, str_dirname, buffer_len);
225 break; 225 break;
226 case 1: 226 case 1:
227 rb->strcpy(buffer, its_a_dir ? str_dircount : str_filename); 227 rb->strncpy(buffer, its_a_dir ? str_dircount : str_filename,
228 buffer_len);
228 break; 229 break;
229 case 2: 230 case 2:
230 rb->strcpy(buffer, its_a_dir ? str_filecount : str_size); 231 rb->strncpy(buffer, its_a_dir ? str_filecount : str_size, buffer_len);
231 break; 232 break;
232 case 3: 233 case 3:
233 rb->strcpy(buffer, its_a_dir ? str_size : str_date); 234 rb->strncpy(buffer, its_a_dir ? str_size : str_date, buffer_len);
234 break; 235 break;
235 case 4: 236 case 4:
236 rb->strcpy(buffer, its_a_dir ? "" : str_time); 237 rb->strncpy(buffer, its_a_dir ? "" : str_time, buffer_len);
237 break; 238 break;
238 case 5: 239 case 5:
239 rb->strcpy(buffer, its_a_dir ? "" : str_artist); 240 rb->strncpy(buffer, its_a_dir ? "" : str_artist, buffer_len);
240 break; 241 break;
241 case 6: 242 case 6:
242 rb->strcpy(buffer, its_a_dir ? "" : str_title); 243 rb->strncpy(buffer, its_a_dir ? "" : str_title, buffer_len);
243 break; 244 break;
244 case 7: 245 case 7:
245 rb->strcpy(buffer, its_a_dir ? "" : str_album); 246 rb->strncpy(buffer, its_a_dir ? "" : str_album, buffer_len);
246 break; 247 break;
247 default: 248 default:
248 rb->strcpy(buffer, "ERROR"); 249 rb->strncpy(buffer, "ERROR", buffer_len);
249 break; 250 break;
250 } 251 }
251 return buffer; 252 return buffer;
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index af415073b3..2b5e16603b 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -254,10 +254,10 @@ void generate(void)
254 rb->write(fd,&dirs_count,sizeof(int)); 254 rb->write(fd,&dirs_count,sizeof(int));
255 rb->close(fd); 255 rb->close(fd);
256} 256}
257char *list_get_name_cb(int selected_item,void* data,char* buf) 257char *list_get_name_cb(int selected_item, void* data, char* buf, size_t buf_len)
258{ 258{
259 (void)data; 259 (void)data;
260 rb->strcpy(buf,list->folder[selected_item]); 260 rb->strncpy(buf, list->folder[selected_item], buf_len);
261 return buf; 261 return buf;
262} 262}
263 263
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c
index 503db56d30..5e7d9c2b00 100644
--- a/apps/plugins/shortcuts/shortcuts_view.c
+++ b/apps/plugins/shortcuts/shortcuts_view.c
@@ -39,7 +39,8 @@ static bool usb_connected = false;
39enum sc_list_action_type draw_sc_list(struct gui_synclist gui_sc); 39enum sc_list_action_type draw_sc_list(struct gui_synclist gui_sc);
40 40
41/* Will be passed sc_file* as data */ 41/* Will be passed sc_file* as data */
42char* build_sc_list(int selected_item, void *data, char *buffer); 42char* build_sc_list(int selected_item, void *data,
43 char *buffer, size_t buffer_len);
43 44
44/* Returns true iff we should leave the main loop */ 45/* Returns true iff we should leave the main loop */
45bool list_sc(bool is_editable); 46bool list_sc(bool is_editable);
@@ -91,17 +92,16 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist gui_sc)
91} 92}
92 93
93 94
94char* build_sc_list(int selected_item, void *data, char *buffer) 95char* build_sc_list(int selected_item, void *data,
96 char *buffer, size_t buffer_len)
95{ 97{
96 char text_buffer[MAX_PATH];
97 sc_file_t *file = (sc_file_t*)data; 98 sc_file_t *file = (sc_file_t*)data;
98 99
99 if (!is_valid_index(file, selected_item)) { 100 if (!is_valid_index(file, selected_item)) {
100 return NULL; 101 return NULL;
101 } 102 }
102 sc_entry_t *entry = file->entries + selected_item; 103 sc_entry_t *entry = file->entries + selected_item;
103 rb->snprintf(text_buffer, sizeof(text_buffer), "%s", entry->disp); 104 rb->snprintf(buffer, buffer_len, "%s", entry->disp);
104 rb->strcpy(buffer, text_buffer);
105 return buffer; 105 return buffer;
106} 106}
107 107
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 75bbccf820..5397260c0d 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -115,18 +115,19 @@ int _do_action(int action, char* str, int line)
115 last_char_index = c; 115 last_char_index = c;
116 return 1; 116 return 1;
117} 117}
118char *list_get_name_cb(int selected_item,void* data,char* buf) 118char *list_get_name_cb(int selected_item, void* data,
119 char* buf, size_t buf_len)
119{ 120{
120 char *b = &buffer[do_action(ACTION_GET,0,selected_item)]; 121 char *b = &buffer[do_action(ACTION_GET,0,selected_item)];
121 (void)data; 122 (void)data;
122 if (rb->strlen(b) >= MAX_PATH) 123 if (rb->strlen(b) >= buf_len)
123 { 124 {
124 char t = b[MAX_PATH-10]; 125 char t = b[buf_len-10];
125 b[MAX_PATH-10] = '\0'; 126 b[buf_len-10] = '\0';
126 rb->snprintf(buf,MAX_PATH,"%s ...",b); 127 rb->snprintf(buf , buf_len, "%s ...", b);
127 b[MAX_PATH-10] = t; 128 b[buf_len-10] = t;
128 } 129 }
129 else rb->strcpy(buf,b); 130 else rb->strncpy(buf, b, buf_len);
130 return buf; 131 return buf;
131} 132}
132char filename[MAX_PATH]; 133char filename[MAX_PATH];
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 593cab3cc8..8d9b77cdc7 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -1290,7 +1290,8 @@ MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET),
1290 radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, 1290 radio_preset_callback, Icon_NOICON, &radio_edit_preset_item,
1291 &radio_delete_preset_item); 1291 &radio_delete_preset_item);
1292/* present a list of preset stations */ 1292/* present a list of preset stations */
1293char * presets_get_name(int selected_item, void * data, char *buffer) 1293static char * presets_get_name(int selected_item, void *data,
1294 char *buffer, size_t buffer_len)
1294{ 1295{
1295 (void)data; 1296 (void)data;
1296 struct fmstation *p = &presets[selected_item]; 1297 struct fmstation *p = &presets[selected_item];
@@ -1299,7 +1300,7 @@ char * presets_get_name(int selected_item, void * data, char *buffer)
1299 int freq = p->frequency / 10000; 1300 int freq = p->frequency / 10000;
1300 int frac = freq % 100; 1301 int frac = freq % 100;
1301 freq /= 100; 1302 freq /= 100;
1302 snprintf(buffer, MAX_PATH, 1303 snprintf(buffer, buffer_len,
1303 str(LANG_FM_DEFAULT_PRESET_NAME), freq, frac); 1304 str(LANG_FM_DEFAULT_PRESET_NAME), freq, frac);
1304 return buffer; 1305 return buffer;
1305} 1306}
diff --git a/apps/screens.c b/apps/screens.c
index 81dae1f413..569ece4faa 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -1116,7 +1116,8 @@ static const int id3_headers[]=
1116 LANG_ID3_PATH, 1116 LANG_ID3_PATH,
1117}; 1117};
1118 1118
1119static char * id3_get_info(int selected_item, void* data, char *buffer) 1119static char * id3_get_info(int selected_item, void* data,
1120 char *buffer, size_t buffer_len)
1120{ 1121{
1121 struct mp3entry* id3 =(struct mp3entry*)data; 1122 struct mp3entry* id3 =(struct mp3entry*)data;
1122 int info_no=selected_item/2; 1123 int info_no=selected_item/2;
@@ -1150,7 +1151,7 @@ static char * id3_get_info(int selected_item, void* data, char *buffer)
1150 info = id3->disc_string; 1151 info = id3->disc_string;
1151 else if (id3->discnum) 1152 else if (id3->discnum)
1152 { 1153 {
1153 snprintf(buffer, MAX_PATH, "%d", id3->discnum); 1154 snprintf(buffer, buffer_len, "%d", id3->discnum);
1154 info = buffer; 1155 info = buffer;
1155 } 1156 }
1156 break; 1157 break;
@@ -1159,7 +1160,7 @@ static char * id3_get_info(int selected_item, void* data, char *buffer)
1159 info = id3->track_string; 1160 info = id3->track_string;
1160 else if (id3->tracknum) 1161 else if (id3->tracknum)
1161 { 1162 {
1162 snprintf(buffer, MAX_PATH, "%d", id3->tracknum); 1163 snprintf(buffer, buffer_len, "%d", id3->tracknum);
1163 info = buffer; 1164 info = buffer;
1164 } 1165 }
1165 break; 1166 break;
@@ -1174,26 +1175,26 @@ static char * id3_get_info(int selected_item, void* data, char *buffer)
1174 info = id3->year_string; 1175 info = id3->year_string;
1175 else if (id3->year) 1176 else if (id3->year)
1176 { 1177 {
1177 snprintf(buffer, MAX_PATH, "%d", id3->year); 1178 snprintf(buffer, buffer_len, "%d", id3->year);
1178 info = buffer; 1179 info = buffer;
1179 } 1180 }
1180 break; 1181 break;
1181 case 10:/*LANG_ID3_LENGTH*/ 1182 case 10:/*LANG_ID3_LENGTH*/
1182 format_time(buffer, MAX_PATH, id3->length); 1183 format_time(buffer, buffer_len, id3->length);
1183 info=buffer; 1184 info=buffer;
1184 break; 1185 break;
1185 case 11:/*LANG_ID3_PLAYLIST*/ 1186 case 11:/*LANG_ID3_PLAYLIST*/
1186 snprintf(buffer, MAX_PATH, "%d/%d", playlist_get_display_index(), 1187 snprintf(buffer, buffer_len, "%d/%d", playlist_get_display_index(),
1187 playlist_amount()); 1188 playlist_amount());
1188 info=buffer; 1189 info=buffer;
1189 break; 1190 break;
1190 case 12:/*LANG_ID3_BITRATE*/ 1191 case 12:/*LANG_ID3_BITRATE*/
1191 snprintf(buffer, MAX_PATH, "%d kbps%s", id3->bitrate, 1192 snprintf(buffer, buffer_len, "%d kbps%s", id3->bitrate,
1192 id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) ""); 1193 id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
1193 info=buffer; 1194 info=buffer;
1194 break; 1195 break;
1195 case 13:/*LANG_ID3_FREQUENCY*/ 1196 case 13:/*LANG_ID3_FREQUENCY*/
1196 snprintf(buffer, MAX_PATH, "%ld Hz", id3->frequency); 1197 snprintf(buffer, buffer_len, "%ld Hz", id3->frequency);
1197 info=buffer; 1198 info=buffer;
1198 break; 1199 break;
1199#if CONFIG_CODEC == SWCODEC 1200#if CONFIG_CODEC == SWCODEC
@@ -1236,21 +1237,23 @@ bool browse_id3(void)
1236 } 1237 }
1237} 1238}
1238 1239
1239static char* runtime_get_data(int selected_item, void* data, char* buffer) 1240static char* runtime_get_data(int selected_item, void* data,
1241 char* buffer, size_t buffer_len)
1240{ 1242{
1241 (void) data; 1243 (void)data;
1242 unsigned char *headers[] = {str(LANG_RUNNING_TIME), str(LANG_TOP_TIME) }; 1244 unsigned char *headers[] = {str(LANG_RUNNING_TIME), str(LANG_TOP_TIME) };
1243 int t; 1245 int t;
1244 if(!(selected_item%2)) 1246 if(!(selected_item%2))
1245 return headers[selected_item/2]; 1247 return headers[selected_item/2];
1246 1248
1247 if(selected_item/2) t = global_status.topruntime; 1249 if(selected_item/2)
1250 t = global_status.topruntime;
1251
1248 else t = global_status.runtime; 1252 else t = global_status.runtime;
1249 1253
1250 snprintf(buffer, 16, "%dh %dm %ds", 1254 snprintf(buffer, buffer_len, "%dh %dm %ds",
1251 t / 3600, (t % 3600) / 60, t % 60); 1255 t / 3600, (t % 3600) / 60, t % 60);
1252 return buffer; 1256 return buffer;
1253
1254} 1257}
1255 1258
1256static int runtime_speak_data(int selected_item, void* data) 1259static int runtime_speak_data(int selected_item, void* data)
diff --git a/apps/tree.c b/apps/tree.c
index 26d224ca59..c6e0c48d1c 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -112,7 +112,8 @@ static int ft_play_dirname(char* name);
112static void ft_play_filename(char *dir, char *file); 112static void ft_play_filename(char *dir, char *file);
113static void say_filetype(int attr); 113static void say_filetype(int attr);
114 114
115static char * tree_get_filename(int selected_item, void * data, char *buffer) 115static char * tree_get_filename(int selected_item, void *data,
116 char *buffer, size_t buffer_len)
116{ 117{
117 struct tree_context * local_tc=(struct tree_context *)data; 118 struct tree_context * local_tc=(struct tree_context *)data;
118 char *name; 119 char *name;
@@ -160,7 +161,7 @@ static char * tree_get_filename(int selected_item, void * data, char *buffer)
160 161
161 if(stripit) 162 if(stripit)
162 { 163 {
163 return(strip_extension(buffer, MAX_PATH, name)); 164 return(strip_extension(buffer, buffer_len, name));
164 } 165 }
165 return(name); 166 return(name);
166} 167}