summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c2
-rw-r--r--apps/tagtree.c2
-rw-r--r--apps/tree.c15
-rw-r--r--apps/tree.h2
4 files changed, 9 insertions, 12 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 96fcc8a1e7..eaaee9644d 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -285,7 +285,7 @@ int ft_load(struct tree_context* c, const char* tempdir)
285 c->dirsindir = 0; 285 c->dirsindir = 0;
286 c->dirfull = false; 286 c->dirfull = false;
287 287
288 for ( i=0; i < global_settings.max_files_in_dir; i++ ) { 288 for ( i=0; i < c->dircache_count; i++ ) {
289 int len; 289 int len;
290 struct dirent *entry = readdir(dir); 290 struct dirent *entry = readdir(dir);
291 struct dirinfo info; 291 struct dirinfo info;
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 575ab221ac..2a2e2b805b 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1288,7 +1288,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init)
1288 dptr++; 1288 dptr++;
1289 current_entry_count++; 1289 current_entry_count++;
1290 1290
1291 if (current_entry_count >= global_settings.max_files_in_dir) 1291 if (current_entry_count >= c->dircache_count)
1292 { 1292 {
1293 logf("chunk mode #3: %d", current_entry_count); 1293 logf("chunk mode #3: %d", current_entry_count);
1294 c->dirfull = true; 1294 c->dirfull = true;
diff --git a/apps/tree.c b/apps/tree.c
index d87a93e2a0..44c4b92883 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -95,7 +95,6 @@ static char lastdir[MAX_PATH];
95#ifdef HAVE_TAGCACHE 95#ifdef HAVE_TAGCACHE
96static int lasttable, lastextra, lastfirstpos; 96static int lasttable, lastextra, lastfirstpos;
97#endif 97#endif
98static int max_files = 0;
99 98
100static bool reload_dir = false; 99static bool reload_dir = false;
101 100
@@ -391,7 +390,7 @@ static int update_dir(void)
391#ifdef HAVE_TAGCACHE 390#ifdef HAVE_TAGCACHE
392 !id3db && 391 !id3db &&
393#endif 392#endif
394 (tc.dirfull || tc.filesindir == global_settings.max_files_in_dir) ) 393 (tc.dirfull || tc.filesindir == tc.dircache_count) )
395 { 394 {
396 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); 395 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
397 } 396 }
@@ -1005,20 +1004,18 @@ int rockbox_browse(struct browse_context *browse)
1005 1004
1006void tree_mem_init(void) 1005void tree_mem_init(void)
1007{ 1006{
1008 /* We copy the settings value in case it is changed by the user. We can't
1009 use it until the next reboot. */
1010 max_files = global_settings.max_files_in_dir;
1011
1012 /* initialize tree context struct */ 1007 /* initialize tree context struct */
1013 memset(&tc, 0, sizeof(tc)); 1008 memset(&tc, 0, sizeof(tc));
1014 tc.dirfilter = &global_settings.dirfilter; 1009 tc.dirfilter = &global_settings.dirfilter;
1015 tc.sort_dir = global_settings.sort_dir; 1010 tc.sort_dir = global_settings.sort_dir;
1016 1011
1017 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; 1012 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH *
1013 global_settings.max_files_in_dir;
1018 tc.name_buffer = buffer_alloc(tc.name_buffer_size); 1014 tc.name_buffer = buffer_alloc(tc.name_buffer_size);
1019 1015
1020 tc.dircache_size = max_files * sizeof(struct entry); 1016 tc.dircache_count = global_settings.max_files_in_dir;
1021 tc.dircache = buffer_alloc(tc.dircache_size); 1017 tc.dircache = buffer_alloc(global_settings.max_files_in_dir *
1018 sizeof(struct entry));
1022 tree_get_filetypes(&filetypes, &filetypes_count); 1019 tree_get_filetypes(&filetypes, &filetypes_count);
1023} 1020}
1024 1021
diff --git a/apps/tree.h b/apps/tree.h
index 7275c9ae94..104d6c480a 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -84,7 +84,7 @@ struct tree_context {
84 * contains all files and dirs in the current 84 * contains all files and dirs in the current
85 * dir (with filters applied) */ 85 * dir (with filters applied) */
86 void* dircache; 86 void* dircache;
87 int dircache_size; 87 int dircache_count; /* Number of entries in dircache */
88 char* name_buffer; 88 char* name_buffer;
89 int name_buffer_size; 89 int name_buffer_size;
90 int dentry_size; 90 int dentry_size;