summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-01 21:29:34 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-01 21:29:34 +0000
commit6eaab4d00446c070c655f0e6c9a872532a776b6f (patch)
tree69610996dd0a6092459b14e164d4e48e03b1e5bb /apps
parent8e0a0babc57db3e9edc06f3e269fb47c27292ed5 (diff)
downloadrockbox-6eaab4d00446c070c655f0e6c9a872532a776b6f.tar.gz
rockbox-6eaab4d00446c070c655f0e6c9a872532a776b6f.zip
Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants. Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know). For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one, the values can be retrieved via the new dir_get_info(). Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c18
-rw-r--r--apps/codecs.h2
-rw-r--r--apps/codecs/sid.c6
-rw-r--r--apps/filetree.c18
-rw-r--r--apps/misc.c10
-rw-r--r--apps/onplay.c9
-rw-r--r--apps/plugin.c11
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/disktidy.c11
-rw-r--r--apps/plugins/lua/luadir.c3
-rw-r--r--apps/plugins/md5sum.c4
-rw-r--r--apps/plugins/properties.c23
-rw-r--r--apps/plugins/random_folder_advance_config.c3
-rw-r--r--apps/plugins/stats.c3
-rw-r--r--apps/plugins/theme_remove.c3
-rw-r--r--apps/tagcache.c6
-rw-r--r--apps/tagtree.c2
17 files changed, 76 insertions, 59 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index b072c65f40..25cc659e42 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -55,20 +55,16 @@
55#define LOGF_ENABLE 55#define LOGF_ENABLE
56#include "logf.h" 56#include "logf.h"
57 57
58#if (CONFIG_PLATFORM & PLATFORM_HOSTED) 58#if (CONFIG_PLATFORM & PLATFORM_SDL)
59
60#define PREFIX(_x_) sim_ ## _x_ 59#define PREFIX(_x_) sim_ ## _x_
60#else
61#define PREFIX(_x_) _x_
62#endif
63
64#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
61#if CONFIG_CODEC == SWCODEC 65#if CONFIG_CODEC == SWCODEC
62unsigned char codecbuf[CODEC_SIZE]; 66unsigned char codecbuf[CODEC_SIZE];
63#endif 67#endif
64void *sim_codec_load_ram(char* codecptr, int size, void **pd);
65void sim_codec_close(void *pd);
66
67#else /* !PLATFORM_HOSTED */
68
69#define PREFIX
70#define sim_codec_close(x)
71
72#endif 68#endif
73 69
74size_t codec_size; 70size_t codec_size;
@@ -110,7 +106,7 @@ struct codec_api ci = {
110#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE 106#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
111 __div0, 107 __div0,
112#endif 108#endif
113 PREFIX(sleep), 109 sleep,
114 yield, 110 yield,
115 111
116#if NUM_CORES > 1 112#if NUM_CORES > 1
diff --git a/apps/codecs.h b/apps/codecs.h
index 97b33ec9ad..520aaeebc7 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -159,7 +159,7 @@ struct codec_api {
159#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE 159#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
160 void (*__div0)(void); 160 void (*__div0)(void);
161#endif 161#endif
162 void (*sleep)(int ticks); 162 unsigned (*sleep)(unsigned ticks);
163 void (*yield)(void); 163 void (*yield)(void);
164 164
165#if NUM_CORES > 1 165#if NUM_CORES > 1
diff --git a/apps/codecs/sid.c b/apps/codecs/sid.c
index 318cd1b4c8..455bdbc28a 100644
--- a/apps/codecs/sid.c
+++ b/apps/codecs/sid.c
@@ -101,7 +101,7 @@ void sidPoke(int reg, unsigned char val) ICODE_ATTR;
101#define rel 13 101#define rel 13
102 102
103enum { 103enum {
104 adc, _and, asl, bcc, bcs, beq, bit, bmi, bne, bpl, brk, bvc, bvs, clc, 104 adc, _and, asl, bcc, bcs, beq, bit, bmi, bne, bpl, _brk, bvc, bvs, clc,
105 cld, cli, clv, cmp, cpx, cpy, dec, dex, dey, eor, inc, inx, iny, jmp, 105 cld, cli, clv, cmp, cpx, cpy, dec, dex, dey, eor, inc, inx, iny, jmp,
106 jsr, lda, ldx, ldy, lsr, _nop, ora, pha, php, pla, plp, rol, ror, rti, 106 jsr, lda, ldx, ldy, lsr, _nop, ora, pha, php, pla, plp, rol, ror, rti,
107 rts, sbc, sec, sed, sei, sta, stx, sty, tax, tay, tsx, txa, txs, tya, 107 rts, sbc, sec, sed, sei, sta, stx, sty, tax, tay, tsx, txa, txs, tya,
@@ -204,7 +204,7 @@ static const float decayReleaseTimes[16] ICONST_ATTR =
204}; 204};
205 205
206static const int opcodes[256] ICONST_ATTR = { 206static const int opcodes[256] ICONST_ATTR = {
207 brk,ora,xxx,xxx,xxx,ora,asl,xxx,php,ora,asl,xxx,xxx,ora,asl,xxx, 207 _brk,ora,xxx,xxx,xxx,ora,asl,xxx,php,ora,asl,xxx,xxx,ora,asl,xxx,
208 bpl,ora,xxx,xxx,xxx,ora,asl,xxx,clc,ora,xxx,xxx,xxx,ora,asl,xxx, 208 bpl,ora,xxx,xxx,xxx,ora,asl,xxx,clc,ora,xxx,xxx,xxx,ora,asl,xxx,
209 jsr,_and,xxx,xxx,bit,_and,rol,xxx,plp,_and,rol,xxx,bit,_and,rol,xxx, 209 jsr,_and,xxx,xxx,bit,_and,rol,xxx,plp,_and,rol,xxx,bit,_and,rol,xxx,
210 bmi,_and,xxx,xxx,xxx,_and,rol,xxx,sec,_and,xxx,xxx,xxx,_and,rol,xxx, 210 bmi,_and,xxx,xxx,xxx,_and,rol,xxx,sec,_and,xxx,xxx,xxx,_and,rol,xxx,
@@ -908,7 +908,7 @@ static inline void cpuParse(void)
908 setflags(FLAG_N,bval&0x80); 908 setflags(FLAG_N,bval&0x80);
909 setflags(FLAG_V,bval&0x40); 909 setflags(FLAG_V,bval&0x40);
910 break; 910 break;
911 case brk: 911 case _brk:
912 pc=0; /* Just quit the emulation */ 912 pc=0; /* Just quit the emulation */
913 break; 913 break;
914 case clc: 914 case clc:
diff --git a/apps/filetree.c b/apps/filetree.c
index 0a1b49d1fe..1dc510f8c7 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -153,10 +153,10 @@ static void check_file_thumbnails(struct tree_context* c)
153 while((entry = readdir(dir)) != 0) /* walk directory */ 153 while((entry = readdir(dir)) != 0) /* walk directory */
154 { 154 {
155 int ext_pos; 155 int ext_pos;
156 156 struct dirinfo info = dir_get_info(dir, entry);
157 ext_pos = strlen((char *)entry->d_name) - strlen(file_thumbnail_ext); 157 ext_pos = strlen((char *)entry->d_name) - strlen(file_thumbnail_ext);
158 if (ext_pos <= 0 /* too short to carry ".talk" */ 158 if (ext_pos <= 0 /* too short to carry ".talk" */
159 || (entry->attribute & ATTR_DIRECTORY) /* no file */ 159 || (info.attribute & ATTR_DIRECTORY) /* no file */
160 || strcasecmp((char *)&entry->d_name[ext_pos], file_thumbnail_ext)) 160 || strcasecmp((char *)&entry->d_name[ext_pos], file_thumbnail_ext))
161 { /* or doesn't end with ".talk", no candidate */ 161 { /* or doesn't end with ".talk", no candidate */
162 continue; 162 continue;
@@ -284,15 +284,17 @@ int ft_load(struct tree_context* c, const char* tempdir)
284 for ( i=0; i < global_settings.max_files_in_dir; i++ ) { 284 for ( i=0; i < global_settings.max_files_in_dir; i++ ) {
285 int len; 285 int len;
286 struct dirent *entry = readdir(dir); 286 struct dirent *entry = readdir(dir);
287 struct dirinfo info;
287 struct entry* dptr = 288 struct entry* dptr =
288 (struct entry*)(c->dircache + i * sizeof(struct entry)); 289 (struct entry*)(c->dircache + i * sizeof(struct entry));
289 if (!entry) 290 if (!entry)
290 break; 291 break;
291 292
293 info = dir_get_info(dir, entry);
292 len = strlen((char *)entry->d_name); 294 len = strlen((char *)entry->d_name);
293 295
294 /* skip directories . and .. */ 296 /* skip directories . and .. */
295 if ((entry->attribute & ATTR_DIRECTORY) && 297 if ((info.attribute & ATTR_DIRECTORY) &&
296 (((len == 1) && (!strncmp((char *)entry->d_name, ".", 1))) || 298 (((len == 1) && (!strncmp((char *)entry->d_name, ".", 1))) ||
297 ((len == 2) && (!strncmp((char *)entry->d_name, "..", 2))))) { 299 ((len == 2) && (!strncmp((char *)entry->d_name, "..", 2))))) {
298 i--; 300 i--;
@@ -300,7 +302,7 @@ int ft_load(struct tree_context* c, const char* tempdir)
300 } 302 }
301 303
302 /* Skip FAT volume ID */ 304 /* Skip FAT volume ID */
303 if (entry->attribute & ATTR_VOLUME_ID) { 305 if (info.attribute & ATTR_VOLUME_ID) {
304 i--; 306 i--;
305 continue; 307 continue;
306 } 308 }
@@ -308,12 +310,12 @@ int ft_load(struct tree_context* c, const char* tempdir)
308 /* filter out dotfiles and hidden files */ 310 /* filter out dotfiles and hidden files */
309 if (*c->dirfilter != SHOW_ALL && 311 if (*c->dirfilter != SHOW_ALL &&
310 ((entry->d_name[0]=='.') || 312 ((entry->d_name[0]=='.') ||
311 (entry->attribute & ATTR_HIDDEN))) { 313 (info.attribute & ATTR_HIDDEN))) {
312 i--; 314 i--;
313 continue; 315 continue;
314 } 316 }
315 317
316 dptr->attr = entry->attribute; 318 dptr->attr = info.attribute;
317 319
318 /* check for known file types */ 320 /* check for known file types */
319 if ( !(dptr->attr & ATTR_DIRECTORY) ) 321 if ( !(dptr->attr & ATTR_DIRECTORY) )
@@ -362,8 +364,8 @@ int ft_load(struct tree_context* c, const char* tempdir)
362 } 364 }
363 dptr->name = &c->name_buffer[name_buffer_used]; 365 dptr->name = &c->name_buffer[name_buffer_used];
364 dptr->time_write = 366 dptr->time_write =
365 (long)entry->wrtdate<<16 | 367 (long)info.wrtdate<<16 |
366 (long)entry->wrttime; /* in one # */ 368 (long)info.wrttime; /* in one # */
367 strcpy(dptr->name, (char *)entry->d_name); 369 strcpy(dptr->name, (char *)entry->d_name);
368 name_buffer_used += len + 1; 370 name_buffer_used += len + 1;
369 371
diff --git a/apps/misc.c b/apps/misc.c
index c35e2c5001..4b89a5d4a3 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -28,6 +28,7 @@
28#include "misc.h" 28#include "misc.h"
29#include "lcd.h" 29#include "lcd.h"
30#include "file.h" 30#include "file.h"
31#include "filefuncs.h"
31#ifndef __PCTOOL__ 32#ifndef __PCTOOL__
32#include "lang.h" 33#include "lang.h"
33#include "dir.h" 34#include "dir.h"
@@ -708,11 +709,12 @@ void check_bootfile(bool do_rolo)
708 { 709 {
709 if(!strcasecmp(entry->d_name, BOOTFILE)) 710 if(!strcasecmp(entry->d_name, BOOTFILE))
710 { 711 {
712 struct dirinfo info = dir_get_info(dir, entry);
711 /* found the bootfile */ 713 /* found the bootfile */
712 if(wrtdate && do_rolo) 714 if(wrtdate && do_rolo)
713 { 715 {
714 if((entry->wrtdate != wrtdate) || 716 if((info.wrtdate != wrtdate) ||
715 (entry->wrttime != wrttime)) 717 (info.wrttime != wrttime))
716 { 718 {
717 static const char *lines[] = { ID2P(LANG_BOOT_CHANGED), 719 static const char *lines[] = { ID2P(LANG_BOOT_CHANGED),
718 ID2P(LANG_REBOOT_NOW) }; 720 ID2P(LANG_REBOOT_NOW) };
@@ -722,8 +724,8 @@ void check_bootfile(bool do_rolo)
722 rolo_load(BOOTDIR "/" BOOTFILE); 724 rolo_load(BOOTDIR "/" BOOTFILE);
723 } 725 }
724 } 726 }
725 wrtdate = entry->wrtdate; 727 wrtdate = info.wrtdate;
726 wrttime = entry->wrttime; 728 wrttime = info.wrttime;
727 } 729 }
728 } 730 }
729 closedir(dir); 731 closedir(dir);
diff --git a/apps/onplay.c b/apps/onplay.c
index 72912579f9..f5b8476492 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -26,7 +26,6 @@
26 26
27#include "debug.h" 27#include "debug.h"
28#include "lcd.h" 28#include "lcd.h"
29#include "dir.h"
30#include "file.h" 29#include "file.h"
31#include "audio.h" 30#include "audio.h"
32#include "menu.h" 31#include "menu.h"
@@ -63,6 +62,7 @@
63#include "statusbar-skinned.h" 62#include "statusbar-skinned.h"
64#include "pitchscreen.h" 63#include "pitchscreen.h"
65#include "viewport.h" 64#include "viewport.h"
65#include "filefuncs.h"
66 66
67static int context; 67static int context;
68static char* selected_file = NULL; 68static char* selected_file = NULL;
@@ -484,14 +484,14 @@ static int remove_dir(char* dirname, int len)
484 entry = readdir(dir); 484 entry = readdir(dir);
485 if (!entry) 485 if (!entry)
486 break; 486 break;
487 487 struct dirinfo info = dir_get_info(dir, entry);
488 dirname[dirlen] ='\0'; 488 dirname[dirlen] ='\0';
489 /* inform the user which dir we're deleting */ 489 /* inform the user which dir we're deleting */
490 splash(0, dirname); 490 splash(0, dirname);
491 491
492 /* append name to current directory */ 492 /* append name to current directory */
493 snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name); 493 snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name);
494 if (entry->attribute & ATTR_DIRECTORY) 494 if (info.attribute & ATTR_DIRECTORY)
495 { /* remove a subdirectory */ 495 { /* remove a subdirectory */
496 if (!strcmp((char *)entry->d_name, ".") || 496 if (!strcmp((char *)entry->d_name, ".") ||
497 !strcmp((char *)entry->d_name, "..")) 497 !strcmp((char *)entry->d_name, ".."))
@@ -783,6 +783,7 @@ static bool clipboard_pastedirectory(char *src, int srclen, char *target,
783 if (!entry) 783 if (!entry)
784 break; 784 break;
785 785
786 struct dirinfo info = dir_get_info(srcdir, entry);
786 /* append name to current directory */ 787 /* append name to current directory */
787 snprintf(src+srcdirlen, srclen-srcdirlen, "/%s", entry->d_name); 788 snprintf(src+srcdirlen, srclen-srcdirlen, "/%s", entry->d_name);
788 snprintf(target+targetdirlen, targetlen-targetdirlen, "/%s", 789 snprintf(target+targetdirlen, targetlen-targetdirlen, "/%s",
@@ -790,7 +791,7 @@ static bool clipboard_pastedirectory(char *src, int srclen, char *target,
790 791
791 DEBUGF("Copy %s to %s\n", src, target); 792 DEBUGF("Copy %s to %s\n", src, target);
792 793
793 if (entry->attribute & ATTR_DIRECTORY) 794 if (info.attribute & ATTR_DIRECTORY)
794 { /* copy/move a subdirectory */ 795 { /* copy/move a subdirectory */
795 if (!strcmp((char *)entry->d_name, ".") || 796 if (!strcmp((char *)entry->d_name, ".") ||
796 !strcmp((char *)entry->d_name, "..")) 797 !strcmp((char *)entry->d_name, ".."))
diff --git a/apps/plugin.c b/apps/plugin.c
index e0455c51a2..9e08951828 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -59,7 +59,7 @@
59#include "usbstack/usb_hid.h" 59#include "usbstack/usb_hid.h"
60#endif 60#endif
61 61
62#if (CONFIG_PLATFORM & PLATFORM_HOSTED) 62#if (CONFIG_PLATFORM & PLATFORM_SDL)
63#define PREFIX(_x_) sim_ ## _x_ 63#define PREFIX(_x_) sim_ ## _x_
64#else 64#else
65#define PREFIX 65#define PREFIX
@@ -349,7 +349,7 @@ static const struct plugin_api rockbox_api = {
349#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE 349#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
350 __div0, 350 __div0,
351#endif 351#endif
352 PREFIX(sleep), 352 sleep,
353 yield, 353 yield,
354 &current_tick, 354 &current_tick,
355 default_event_handler, 355 default_event_handler,
@@ -529,7 +529,7 @@ static const struct plugin_api rockbox_api = {
529 playlist_insert_track, 529 playlist_insert_track,
530 playlist_insert_directory, 530 playlist_insert_directory,
531 playlist_shuffle, 531 playlist_shuffle,
532 PREFIX(audio_play), 532 audio_play,
533 audio_stop, 533 audio_stop,
534 audio_pause, 534 audio_pause,
535 audio_resume, 535 audio_resume,
@@ -722,6 +722,7 @@ static const struct plugin_api rockbox_api = {
722 722
723 /* new stuff at the end, sort into place next time 723 /* new stuff at the end, sort into place next time
724 the API gets incompatible */ 724 the API gets incompatible */
725 dir_get_info,
725}; 726};
726 727
727int plugin_load(const char* plugin, const void* parameter) 728int plugin_load(const char* plugin, const void* parameter)
@@ -940,11 +941,11 @@ static int open_wrapper(const char* pathname, int flags, ...)
940 { 941 {
941 va_list ap; 942 va_list ap;
942 va_start(ap, flags); 943 va_start(ap, flags);
943 fd = sim_open(pathname, flags, va_arg(ap, unsigned int)); 944 fd = open(pathname, flags, va_arg(ap, unsigned int));
944 va_end(ap); 945 va_end(ap);
945 } 946 }
946 else 947 else
947 fd = sim_open(pathname, flags); 948 fd = open(pathname, flags);
948#else 949#else
949 fd = file_open(pathname,flags); 950 fd = file_open(pathname,flags);
950#endif 951#endif
diff --git a/apps/plugin.h b/apps/plugin.h
index 422f58fc8a..ddd913088f 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -459,7 +459,7 @@ struct plugin_api {
459#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE 459#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
460 void (*__div0)(void); 460 void (*__div0)(void);
461#endif 461#endif
462 void (*sleep)(int ticks); 462 unsigned (*sleep)(unsigned ticks);
463 void (*yield)(void); 463 void (*yield)(void);
464 volatile long* current_tick; 464 volatile long* current_tick;
465 long (*default_event_handler)(long event); 465 long (*default_event_handler)(long event);
@@ -894,6 +894,7 @@ struct plugin_api {
894 894
895 /* new stuff at the end, sort into place next time 895 /* new stuff at the end, sort into place next time
896 the API gets incompatible */ 896 the API gets incompatible */
897 struct dirinfo (*dir_get_info)(struct DIR* parent, struct dirent *entry);
897}; 898};
898 899
899/* plugin header */ 900/* plugin header */
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c
index c5f0f4a7bd..1e6c1536e2 100644
--- a/apps/plugins/disktidy.c
+++ b/apps/plugins/disktidy.c
@@ -244,7 +244,9 @@ enum tidy_return tidy_removedir(char *path, int *path_length)
244 /* silent error */ 244 /* silent error */
245 continue; 245 continue;
246 246
247 if (entry->attribute & ATTR_DIRECTORY) 247
248 struct dirinfo info = rb->dir_get_info(dir, entry);
249 if (info.attribute & ATTR_DIRECTORY)
248 { 250 {
249 /* dir ignore "." and ".." */ 251 /* dir ignore "." and ".." */
250 if ((rb->strcmp(entry->d_name, ".") != 0) && \ 252 if ((rb->strcmp(entry->d_name, ".") != 0) && \
@@ -297,6 +299,7 @@ enum tidy_return tidy_clean(char *path, int *path_length)
297 while((status == TIDY_RETURN_OK) && ((entry = rb->readdir(dir)) != 0)) 299 while((status == TIDY_RETURN_OK) && ((entry = rb->readdir(dir)) != 0))
298 /* walk directory */ 300 /* walk directory */
299 { 301 {
302 struct dirinfo info = rb->dir_get_info(dir, entry);
300 /* check for user input and usb connect */ 303 /* check for user input and usb connect */
301 button = rb->get_action(CONTEXT_STD, TIMEOUT_NOBLOCK); 304 button = rb->get_action(CONTEXT_STD, TIMEOUT_NOBLOCK);
302 if (button == ACTION_STD_CANCEL) 305 if (button == ACTION_STD_CANCEL)
@@ -312,7 +315,7 @@ enum tidy_return tidy_clean(char *path, int *path_length)
312 315
313 rb->yield(); 316 rb->yield();
314 317
315 if (entry->attribute & ATTR_DIRECTORY) 318 if (info.attribute & ATTR_DIRECTORY)
316 { 319 {
317 /* directory ignore "." and ".." */ 320 /* directory ignore "." and ".." */
318 if ((rb->strcmp(entry->d_name, ".") != 0) && \ 321 if ((rb->strcmp(entry->d_name, ".") != 0) && \
@@ -326,7 +329,7 @@ enum tidy_return tidy_clean(char *path, int *path_length)
326 /* silent error */ 329 /* silent error */
327 continue; 330 continue;
328 331
329 if (tidy_remove_item(entry->d_name, entry->attribute)) 332 if (tidy_remove_item(entry->d_name, info.attribute))
330 { 333 {
331 /* delete dir */ 334 /* delete dir */
332 tidy_removedir(path, path_length); 335 tidy_removedir(path, path_length);
@@ -347,7 +350,7 @@ enum tidy_return tidy_clean(char *path, int *path_length)
347 { 350 {
348 /* file */ 351 /* file */
349 del = 0; 352 del = 0;
350 if (tidy_remove_item(entry->d_name, entry->attribute)) 353 if (tidy_remove_item(entry->d_name, info.attribute))
351 { 354 {
352 /* get absolute path */ 355 /* get absolute path */
353 /* returns an error if path is too long */ 356 /* returns an error if path is too long */
diff --git a/apps/plugins/lua/luadir.c b/apps/plugins/lua/luadir.c
index 730c40ce22..c8c21d2c65 100644
--- a/apps/plugins/lua/luadir.c
+++ b/apps/plugins/lua/luadir.c
@@ -56,8 +56,9 @@ static int dir_iter (lua_State *L) {
56 luaL_argcheck (L, !d->closed, 1, "closed directory"); 56 luaL_argcheck (L, !d->closed, 1, "closed directory");
57 57
58 if ((entry = rb->readdir (d->dir)) != NULL) { 58 if ((entry = rb->readdir (d->dir)) != NULL) {
59 struct dirinfo info = rb->dir_get_info(d->dir, entry);
59 lua_pushstring (L, entry->d_name); 60 lua_pushstring (L, entry->d_name);
60 lua_pushboolean (L, entry->attribute & ATTR_DIRECTORY); 61 lua_pushboolean (L, info.attribute & ATTR_DIRECTORY);
61 return 2; 62 return 2;
62 } else { 63 } else {
63 /* no more entries => close directory */ 64 /* no more entries => close directory */
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c
index fe1c65efb0..c993018852 100644
--- a/apps/plugins/md5sum.c
+++ b/apps/plugins/md5sum.c
@@ -95,7 +95,9 @@ static void hash_dir( int out, const char *path )
95 char childpath[MAX_PATH]; 95 char childpath[MAX_PATH];
96 rb->snprintf( childpath, MAX_PATH, "%s/%s", 96 rb->snprintf( childpath, MAX_PATH, "%s/%s",
97 rb->strcmp( path, "/" ) ? path : "", entry->d_name ); 97 rb->strcmp( path, "/" ) ? path : "", entry->d_name );
98 if( entry->attribute & ATTR_DIRECTORY ) 98
99 struct dirinfo info = rb->dir_get_info(dir, entry);
100 if (info.attribute & ATTR_DIRECTORY)
99 { 101 {
100 if( rb->strcmp( entry->d_name, "." ) 102 if( rb->strcmp( entry->d_name, "." )
101 && rb->strcmp( entry->d_name, ".." ) ) 103 && rb->strcmp( entry->d_name, ".." ) )
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index d6692bc893..e127a2908e 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -69,22 +69,23 @@ static bool file_properties(char* selected_file)
69 { 69 {
70 while(0 != (entry = rb->readdir(dir))) 70 while(0 != (entry = rb->readdir(dir)))
71 { 71 {
72 struct dirinfo info = rb->dir_get_info(dir, entry);
72 if(!rb->strcmp(entry->d_name, selected_file+dirlen)) 73 if(!rb->strcmp(entry->d_name, selected_file+dirlen))
73 { 74 {
74 unsigned log; 75 unsigned log;
75 rb->snprintf(str_dirname, sizeof str_dirname, "Path: %s", tstr); 76 rb->snprintf(str_dirname, sizeof str_dirname, "Path: %s", tstr);
76 rb->snprintf(str_filename, sizeof str_filename, "Name: %s", 77 rb->snprintf(str_filename, sizeof str_filename, "Name: %s",
77 selected_file+dirlen); 78 selected_file+dirlen);
78 log = human_size_log(entry->size); 79 log = human_size_log(info.size);
79 rb->snprintf(str_size, sizeof str_size, "Size: %ld %cB", 80 rb->snprintf(str_size, sizeof str_size, "Size: %ld %cB",
80 entry->size >> (log*10), human_size_prefix[log]); 81 info.size >> (log*10), human_size_prefix[log]);
81 rb->snprintf(str_date, sizeof str_date, "Date: %04d/%02d/%02d", 82 rb->snprintf(str_date, sizeof str_date, "Date: %04d/%02d/%02d",
82 ((entry->wrtdate >> 9 ) & 0x7F) + 1980, /* year */ 83 ((info.wrtdate >> 9 ) & 0x7F) + 1980, /* year */
83 ((entry->wrtdate >> 5 ) & 0x0F), /* month */ 84 ((info.wrtdate >> 5 ) & 0x0F), /* month */
84 ((entry->wrtdate ) & 0x1F)); /* day */ 85 ((info.wrtdate ) & 0x1F)); /* day */
85 rb->snprintf(str_time, sizeof str_time, "Time: %02d:%02d", 86 rb->snprintf(str_time, sizeof str_time, "Time: %02d:%02d",
86 ((entry->wrttime >> 11) & 0x1F), /* hour */ 87 ((info.wrttime >> 11) & 0x1F), /* hour */
87 ((entry->wrttime >> 5 ) & 0x3F)); /* minutes */ 88 ((info.wrttime >> 5 ) & 0x3F)); /* minutes */
88 89
89 num_properties = 5; 90 num_properties = 5;
90 91
@@ -158,11 +159,12 @@ static bool _dir_properties(DPS* dps)
158 /* walk through the directory content */ 159 /* walk through the directory content */
159 while(result && (0 != (entry = rb->readdir(dir)))) 160 while(result && (0 != (entry = rb->readdir(dir))))
160 { 161 {
162 struct dirinfo info = rb->dir_get_info(dir, entry);
161 /* append name to current directory */ 163 /* append name to current directory */
162 rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s", 164 rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s",
163 entry->d_name); 165 entry->d_name);
164 166
165 if (entry->attribute & ATTR_DIRECTORY) 167 if (info.attribute & ATTR_DIRECTORY)
166 { 168 {
167 unsigned log; 169 unsigned log;
168 170
@@ -188,7 +190,7 @@ static bool _dir_properties(DPS* dps)
188 else 190 else
189 { 191 {
190 dps->fc++; /* new file */ 192 dps->fc++; /* new file */
191 dps->bc += entry->size; 193 dps->bc += info.size;
192 } 194 }
193 if(ACTION_STD_CANCEL == rb->get_action(CONTEXT_STD,TIMEOUT_NOBLOCK)) 195 if(ACTION_STD_CANCEL == rb->get_action(CONTEXT_STD,TIMEOUT_NOBLOCK))
194 result = false; 196 result = false;
@@ -290,7 +292,8 @@ enum plugin_status plugin_start(const void* parameter)
290 { 292 {
291 if(!rb->strcmp(entry->d_name, file+dirlen)) 293 if(!rb->strcmp(entry->d_name, file+dirlen))
292 { 294 {
293 its_a_dir = entry->attribute & ATTR_DIRECTORY ? true : false; 295 struct dirinfo info = rb->dir_get_info(dir, entry);
296 its_a_dir = info.attribute & ATTR_DIRECTORY ? true : false;
294 found = true; 297 found = true;
295 break; 298 break;
296 } 299 }
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index 55d9bf99ab..eca33dc08a 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -98,7 +98,8 @@ void traversedir(char* location, char* name)
98 98
99 if (check) 99 if (check)
100 { 100 {
101 if (entry->attribute & ATTR_DIRECTORY) { 101 struct dirinfo info = rb->dir_get_info(dir, entry);
102 if (info.attribute & ATTR_DIRECTORY) {
102 char *start; 103 char *start;
103 dirs_count++; 104 dirs_count++;
104 rb->snprintf(path,MAX_PATH,"%s/%s",fullpath,entry->d_name); 105 rb->snprintf(path,MAX_PATH,"%s/%s",fullpath,entry->d_name);
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c
index ecf335d3f0..6a70a47ec4 100644
--- a/apps/plugins/stats.c
+++ b/apps/plugins/stats.c
@@ -178,7 +178,8 @@ void traversedir(char* location, char* name)
178 /* Skip .. and . */ 178 /* Skip .. and . */
179 if (rb->strcmp(entry->d_name, ".") && rb->strcmp(entry->d_name, "..")) 179 if (rb->strcmp(entry->d_name, ".") && rb->strcmp(entry->d_name, ".."))
180 { 180 {
181 if (entry->attribute & ATTR_DIRECTORY) { 181 struct dirinfo info = rb->dir_get_info(dir, entry);
182 if (info.attribute & ATTR_DIRECTORY) {
182 traversedir(fullpath, entry->d_name); 183 traversedir(fullpath, entry->d_name);
183 dirs++; 184 dirs++;
184 } 185 }
diff --git a/apps/plugins/theme_remove.c b/apps/plugins/theme_remove.c
index d679338ff8..674342a920 100644
--- a/apps/plugins/theme_remove.c
+++ b/apps/plugins/theme_remove.c
@@ -236,7 +236,8 @@ static int remove_dir(char* dirname, int len)
236 236
237 /* append name to current directory */ 237 /* append name to current directory */
238 rb->snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name); 238 rb->snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name);
239 if (entry->attribute & ATTR_DIRECTORY) 239 struct dirinfo info = rb->dir_get_info(dir, entry);
240 if (info.attribute & ATTR_DIRECTORY)
240 { 241 {
241 /* remove a subdirectory */ 242 /* remove a subdirectory */
242 if (!rb->strcmp((char *)entry->d_name, ".") || 243 if (!rb->strcmp((char *)entry->d_name, ".") ||
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 6e416dd7f8..a6cfb4c590 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -4222,6 +4222,8 @@ static bool check_dir(const char *dirname, int add_files)
4222 success = true; 4222 success = true;
4223 break ; 4223 break ;
4224 } 4224 }
4225
4226 struct dirinfo info = dir_get_info(dir, entry);
4225 4227
4226 if (!strcmp((char *)entry->d_name, ".") || 4228 if (!strcmp((char *)entry->d_name, ".") ||
4227 !strcmp((char *)entry->d_name, "..")) 4229 !strcmp((char *)entry->d_name, ".."))
@@ -4234,14 +4236,14 @@ static bool check_dir(const char *dirname, int add_files)
4234 entry->d_name); 4236 entry->d_name);
4235 4237
4236 processed_dir_count++; 4238 processed_dir_count++;
4237 if (entry->attribute & ATTR_DIRECTORY) 4239 if (info.attribute & ATTR_DIRECTORY)
4238 check_dir(curpath, add_files); 4240 check_dir(curpath, add_files);
4239 else if (add_files) 4241 else if (add_files)
4240 { 4242 {
4241 tc_stat.curentry = curpath; 4243 tc_stat.curentry = curpath;
4242 4244
4243 /* Add a new entry to the temporary db file. */ 4245 /* Add a new entry to the temporary db file. */
4244 add_tagcache(curpath, (entry->wrtdate << 16) | entry->wrttime 4246 add_tagcache(curpath, (info.wrtdate << 16) | info.wrttime
4245#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) 4247#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
4246 , dir->internal_entry 4248 , dir->internal_entry
4247#endif 4249#endif
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 8c7f7a2e5d..78c48b4d13 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -51,7 +51,7 @@
51#include "audio.h" 51#include "audio.h"
52#include "appevents.h" 52#include "appevents.h"
53#include "storage.h" 53#include "storage.h"
54#include "dir_uncached.h" 54#include "dir.h"
55 55
56#define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" 56#define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config"
57 57