From 196b770a96920e93dff514b9173d290bf73d0a81 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sat, 27 May 2006 11:21:08 +0000 Subject: Init dircache after applying settings and use a splash. Possible prevent some type of buffer overflow with tagcache. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9997 a1c6a512-1295-4272-9138-f99709370657 --- apps/main.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'apps/main.c') diff --git a/apps/main.c b/apps/main.c index 84c77ab1c9..3878e3a9c4 100644 --- a/apps/main.c +++ b/apps/main.c @@ -106,33 +106,25 @@ void init_dircache(void) int font_w, font_h; int result; char buf[32]; + bool clear = false; dircache_init(); if (global_settings.dircache) { - /* Print "Scanning disk..." to the display. */ - lcd_getstringsize("A", &font_w, &font_h); - lcd_putsxy((LCD_WIDTH/2) - ((strlen(str(LANG_DIRCACHE_BUILDING))*font_w)/2), - LCD_HEIGHT-font_h*3, str(LANG_DIRCACHE_BUILDING)); - lcd_update(); - - result = dircache_build(global_settings.dircache_size); - if (result < 0) + if (global_settings.dircache_size == 0) { - snprintf(buf, sizeof(buf), - "Failed! Result: %d", - result); - lcd_getstringsize("A", &font_w, &font_h); - lcd_putsxy((LCD_WIDTH/2) - ((strlen(buf)*font_w)/2), - LCD_HEIGHT-font_h*2, buf); + gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING)); + clear = true; } - else + + result = dircache_build(global_settings.dircache_size); + if (result < 0) + gui_syncsplash(0, true, "Failed! Result: %d", result); + + if (clear) { - /* Clean the text when we are done. */ - lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); - lcd_fillrect(0, LCD_HEIGHT-font_h*3, LCD_WIDTH, font_h); - lcd_set_drawmode(DRMODE_SOLID); - lcd_update(); + backlight_on(); + show_logo(); } } } @@ -170,7 +162,10 @@ void init_tagcache(void) tagtree_init(); if (clear) + { + backlight_on(); show_logo(); + } } #ifdef SIMULATOR @@ -389,9 +384,9 @@ void init(void) settings_load(SETTINGS_ALL); - init_dircache(); gui_sync_wps_init(); settings_apply(); + init_dircache(); init_tagcache(); status_init(); -- cgit v1.2.3