From 9fe876c3a626e343ac586ba1c025fdfef9a085b6 Mon Sep 17 00:00:00 2001 From: zagor Date: Mon, 17 Jan 2005 12:56:00 +0000 Subject: [PATCH] Minor tweaks to compile on win32. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5578 a1c6a512-1295-4272-9138-f99709370657 --- apps/filetree.c | 3 ++- apps/playlist.c | 2 +- apps/tree.c | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/filetree.c b/apps/filetree.c index aaf99dce9..a321a3fc8 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -36,6 +36,7 @@ #include "screens.h" #include "plugin.h" #include "rolo.h" +#include "sprintf.h" static int boot_size = 0; static int boot_cluster; @@ -187,11 +188,11 @@ int ft_load(struct tree_context* c, bool *buffer_full) { extern char lastdir[]; /* from tree.c */ int i; + int name_buffer_used = 0; DIR *dir = opendir(c->currdir); if(!dir) return -1; /* not a directory */ - int name_buffer_used = 0; c->dirsindir = 0; if (buffer_full) *buffer_full = false; diff --git a/apps/playlist.c b/apps/playlist.c index 1a68a052b..aa8415a86 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -540,10 +540,10 @@ static int add_directory_to_playlist(struct playlist_info* playlist, int i; int dirfilter = global_settings.dirfilter; struct entry *files; + struct tree_context* tc = tree_get_context(); /* use the tree browser dircache to load files */ global_settings.dirfilter = SHOW_ALL; - struct tree_context* tc = tree_get_context(); strncpy(tc->currdir, dirname, sizeof(tc->currdir)); num_files = ft_load(tc, NULL); files = (struct entry*) tc->dircache; diff --git a/apps/tree.c b/apps/tree.c index eb1f7c3b7..b84406032 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -246,6 +246,8 @@ static int showdir(void) int i; int tree_max_on_screen; bool dir_buffer_full = false; + int start = tc.dirstart; + bool id3db = global_settings.dirfilter == SHOW_ID3DB; #ifdef HAVE_LCD_BITMAP const char* icon; @@ -259,8 +261,6 @@ static int showdir(void) int icon; tree_max_on_screen = TREE_MAX_ON_SCREEN; #endif - int start = tc.dirstart; - bool id3db = global_settings.dirfilter == SHOW_ID3DB; /* new file dir? load it */ if (id3db) { @@ -1332,16 +1332,16 @@ bool rockbox_browse(const char *root, int dirfilter) void tree_init(void) { + /* We copy the settings value in case it is changed by the user. We can't + use it until the next reboot. */ + int max_files = global_settings.max_files_in_dir; + /* initialize tree context struct */ memset(&tc, 0, sizeof(tc)); tc.dirfilter = &global_settings.dirfilter; db_init(); - /* We copy the settings value in case it is changed by the user. We can't - use it until the next reboot. */ - int max_files = global_settings.max_files_in_dir; - tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; tc.name_buffer = buffer_alloc(tc.name_buffer_size); -- 2.11.4.GIT