summaryrefslogtreecommitdiffstats
path: root/uisimulator/common
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-02-01 23:08:15 +0000
committerJens Arnold <amiconn@rockbox.org>2007-02-01 23:08:15 +0000
commit67eb154146ea90cd25a383bcdd4a028704ef2218 (patch)
tree06b528a996b0ab59b4b3f2b950069c56046a7a10 /uisimulator/common
parent98dc093317b615b2aa8ffe8d140945d75764a813 (diff)
downloadrockbox-67eb154146ea90cd25a383bcdd4a028704ef2218.tar.gz
rockbox-67eb154146ea90cd25a383bcdd4a028704ef2218.tar.bz2
rockbox-67eb154146ea90cd25a383bcdd4a028704ef2218.zip
Removed 'mode' parameter from creat(). It wasn't pure posix anyway, it was ignored on target and mixed into 'oflags' in the simulator. * Simplified io.c a bit by defining a dummy O_BINARY for OSes which don't have that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12179 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common')
-rw-r--r--uisimulator/common/io.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index ca64affa8c..ca597e0805 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -50,6 +50,12 @@
#include "debug.h"
#include "config.h"
+/* Windows (and potentially other OSes) distinguish binary and text files.
+ * Define a dummy for the others. */
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#ifdef HAVE_DIRCACHE
void dircache_remove(const char *name);
void dircache_rename(const char *oldpath, const char *newpath);
@@ -81,11 +87,8 @@ typedef struct mydir MYDIR;
#if 1 /* maybe this needs disabling for MSVC... */
static unsigned int rockbox2sim(int opt)
{
-#ifdef WIN32
int newopt = O_BINARY;
-#else
- int newopt = 0;
-#endif
+
if(opt & 1)
newopt |= O_WRONLY;
if(opt & 2)
@@ -189,24 +192,22 @@ int sim_open(const char *name, int o)
}
-int sim_creat(const char *name, mode_t mode)
+int sim_creat(const char *name)
{
- int opts = rockbox2sim(mode);
-
#ifndef __PCTOOL__
char buffer[256]; /* sufficiently big */
- if(name[0] == '/')
+ if(name[0] == '/')
{
sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
debugf("We create the real file '%s'\n", buffer);
- return open(buffer, opts | O_CREAT | O_TRUNC, 0666);
+ return open(buffer, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0666);
}
fprintf(stderr, "WARNING, bad file name lacks slash: %s\n",
name);
return -1;
#else
- return open(name, opts | O_CREAT | O_TRUNC, 0666);
+ return open(name, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, 0666);
#endif
}
@@ -390,15 +391,11 @@ void *sim_codec_load_ram(char* codecptr, int size,
{
sprintf(path, TEMP_CODEC_FILE, codec_count);
- #ifdef WIN32
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU);
- #else
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
- #endif
if (fd >= 0)
break; /* Created a file ok */
}
- if (fd < 0)
+ if (fd < 0)
{
DEBUGF("failed to open for write: %s\n", path);
return NULL;