summaryrefslogtreecommitdiffstats
path: root/uisimulator/common
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-12-15 23:42:19 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-12-15 23:42:19 +0000
commitee46a3d88e8378e58f01ff0d521477ba0b7201fb (patch)
treead63d929d4ebb1f762faf838ee9da965cfc0ab0b /uisimulator/common
parent9f37f04619feb93a6a5adb36e7db6d7ace3c227c (diff)
downloadrockbox-ee46a3d88e8378e58f01ff0d521477ba0b7201fb.tar.gz
rockbox-ee46a3d88e8378e58f01ff0d521477ba0b7201fb.tar.bz2
rockbox-ee46a3d88e8378e58f01ff0d521477ba0b7201fb.zip
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
Diffstat (limited to 'uisimulator/common')
-rw-r--r--uisimulator/common/io.c18
1 files changed, 10 insertions, 8 deletions
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
}