summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c3
-rw-r--r--apps/playlist.c2
-rw-r--r--apps/tree.c12
3 files changed, 9 insertions, 8 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index aaf99dce92..a321a3fc81 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -36,6 +36,7 @@
36#include "screens.h" 36#include "screens.h"
37#include "plugin.h" 37#include "plugin.h"
38#include "rolo.h" 38#include "rolo.h"
39#include "sprintf.h"
39 40
40static int boot_size = 0; 41static int boot_size = 0;
41static int boot_cluster; 42static int boot_cluster;
@@ -187,11 +188,11 @@ int ft_load(struct tree_context* c, bool *buffer_full)
187{ 188{
188 extern char lastdir[]; /* from tree.c */ 189 extern char lastdir[]; /* from tree.c */
189 int i; 190 int i;
191 int name_buffer_used = 0;
190 DIR *dir = opendir(c->currdir); 192 DIR *dir = opendir(c->currdir);
191 if(!dir) 193 if(!dir)
192 return -1; /* not a directory */ 194 return -1; /* not a directory */
193 195
194 int name_buffer_used = 0;
195 c->dirsindir = 0; 196 c->dirsindir = 0;
196 if (buffer_full) 197 if (buffer_full)
197 *buffer_full = false; 198 *buffer_full = false;
diff --git a/apps/playlist.c b/apps/playlist.c
index 1a68a052ba..aa8415a86f 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -540,10 +540,10 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
540 int i; 540 int i;
541 int dirfilter = global_settings.dirfilter; 541 int dirfilter = global_settings.dirfilter;
542 struct entry *files; 542 struct entry *files;
543 struct tree_context* tc = tree_get_context();
543 544
544 /* use the tree browser dircache to load files */ 545 /* use the tree browser dircache to load files */
545 global_settings.dirfilter = SHOW_ALL; 546 global_settings.dirfilter = SHOW_ALL;
546 struct tree_context* tc = tree_get_context();
547 strncpy(tc->currdir, dirname, sizeof(tc->currdir)); 547 strncpy(tc->currdir, dirname, sizeof(tc->currdir));
548 num_files = ft_load(tc, NULL); 548 num_files = ft_load(tc, NULL);
549 files = (struct entry*) tc->dircache; 549 files = (struct entry*) tc->dircache;
diff --git a/apps/tree.c b/apps/tree.c
index eb1f7c3b74..b844060322 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -246,6 +246,8 @@ static int showdir(void)
246 int i; 246 int i;
247 int tree_max_on_screen; 247 int tree_max_on_screen;
248 bool dir_buffer_full = false; 248 bool dir_buffer_full = false;
249 int start = tc.dirstart;
250 bool id3db = global_settings.dirfilter == SHOW_ID3DB;
249 251
250#ifdef HAVE_LCD_BITMAP 252#ifdef HAVE_LCD_BITMAP
251 const char* icon; 253 const char* icon;
@@ -259,8 +261,6 @@ static int showdir(void)
259 int icon; 261 int icon;
260 tree_max_on_screen = TREE_MAX_ON_SCREEN; 262 tree_max_on_screen = TREE_MAX_ON_SCREEN;
261#endif 263#endif
262 int start = tc.dirstart;
263 bool id3db = global_settings.dirfilter == SHOW_ID3DB;
264 264
265 /* new file dir? load it */ 265 /* new file dir? load it */
266 if (id3db) { 266 if (id3db) {
@@ -1332,16 +1332,16 @@ bool rockbox_browse(const char *root, int dirfilter)
1332 1332
1333void tree_init(void) 1333void tree_init(void)
1334{ 1334{
1335 /* We copy the settings value in case it is changed by the user. We can't
1336 use it until the next reboot. */
1337 int max_files = global_settings.max_files_in_dir;
1338
1335 /* initialize tree context struct */ 1339 /* initialize tree context struct */
1336 memset(&tc, 0, sizeof(tc)); 1340 memset(&tc, 0, sizeof(tc));
1337 tc.dirfilter = &global_settings.dirfilter; 1341 tc.dirfilter = &global_settings.dirfilter;
1338 1342
1339 db_init(); 1343 db_init();
1340 1344
1341 /* We copy the settings value in case it is changed by the user. We can't
1342 use it until the next reboot. */
1343 int max_files = global_settings.max_files_in_dir;
1344
1345 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; 1345 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files;
1346 tc.name_buffer = buffer_alloc(tc.name_buffer_size); 1346 tc.name_buffer = buffer_alloc(tc.name_buffer_size);
1347 1347