diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2011-04-30 11:00:26 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2011-04-30 11:00:26 +0000 |
commit | ed2cfb8c1d2215fc6ac287dbf03bbd2847ec3ef3 (patch) | |
tree | 6e6239b3151cf14a6432941a5957e1452e1fc3a0 /apps/tree.c | |
parent | 16e793f5d1d626e6506f2b172efa03f46fb0ed39 (diff) | |
download | rockbox-ed2cfb8c1d2215fc6ac287dbf03bbd2847ec3ef3.tar.gz rockbox-ed2cfb8c1d2215fc6ac287dbf03bbd2847ec3ef3.zip |
Don't (partially) apply changes to max entries in the file browser immediately. The setting affects a buffer that is allocated during boot, so code using that buffer should use the value that was in effect during boot. Add a note to the manual that a reboot is needed for the changes to be applied.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29798 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 15 |
1 files changed, 6 insertions, 9 deletions
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]; #ifdef HAVE_TAGCACHE static int lasttable, lastextra, lastfirstpos; #endif -static int max_files = 0; static bool reload_dir = false; @@ -391,7 +390,7 @@ static int update_dir(void) #ifdef HAVE_TAGCACHE !id3db && #endif - (tc.dirfull || tc.filesindir == global_settings.max_files_in_dir) ) + (tc.dirfull || tc.filesindir == tc.dircache_count) ) { splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); } @@ -1005,20 +1004,18 @@ int rockbox_browse(struct browse_context *browse) void tree_mem_init(void) { - /* We copy the settings value in case it is changed by the user. We can't - use it until the next reboot. */ - max_files = global_settings.max_files_in_dir; - /* initialize tree context struct */ memset(&tc, 0, sizeof(tc)); tc.dirfilter = &global_settings.dirfilter; tc.sort_dir = global_settings.sort_dir; - tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; + tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * + global_settings.max_files_in_dir; tc.name_buffer = buffer_alloc(tc.name_buffer_size); - tc.dircache_size = max_files * sizeof(struct entry); - tc.dircache = buffer_alloc(tc.dircache_size); + tc.dircache_count = global_settings.max_files_in_dir; + tc.dircache = buffer_alloc(global_settings.max_files_in_dir * + sizeof(struct entry)); tree_get_filetypes(&filetypes, &filetypes_count); } |