From ee46a3d88e8378e58f01ff0d521477ba0b7201fb Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Mon, 15 Dec 2008 23:42:19 +0000 Subject: Moved database builder into a separate directory, and gave it its' own Makefile. Now it compiles cleanly and builds a database if ran in root of music tree. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19448 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/io.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'uisimulator/common/io.c') diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 52df94901b..185e46260c 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -252,19 +252,22 @@ static ssize_t io_trigger_and_wait(int cmd) return result; } +#ifndef __PCTOOL__ static const char *get_sim_rootdir() { if (sim_root_dir != NULL) return sim_root_dir; return SIMULATOR_DEFAULT_ROOT; } +#endif MYDIR *sim_opendir(const char *name) { - char buffer[MAX_PATH]; /* sufficiently big */ DIR_T *dir; #ifndef __PCTOOL__ + char buffer[MAX_PATH]; /* sufficiently big */ + if(name[0] == '/') { snprintf(buffer, sizeof(buffer), "%s%s", get_sim_rootdir(), name); @@ -277,7 +280,8 @@ MYDIR *sim_opendir(const char *name) if(dir) { MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR)); my->dir = dir; - my->name = (char *)strdup(name); + my->name = (char *)malloc(strlen(name)+1); + strcpy(my->name, name); return my; } @@ -357,12 +361,10 @@ int sim_open(const char *name, int o) name); return -1; #else - if (num_openfiles < MAX_OPEN_FILES) - { - ret = OPEN(buffer, opts, 0666); - if (ret >= 0) num_openfiles++; - return ret; - } + ret = OPEN(name, opts, 0666); + if (ret >= 0) + num_openfiles++; + return ret; #endif } -- cgit v1.2.3