diff options
Diffstat (limited to 'src/shared/stream.cpp')
| -rw-r--r-- | src/shared/stream.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/shared/stream.cpp b/src/shared/stream.cpp index 3a5c6e2..1bb98ff 100644 --- a/src/shared/stream.cpp +++ b/src/shared/stream.cpp @@ -298,9 +298,13 @@ char *path(char *s) { char *path(const char *s, bool copy) { static string tmp; - copystring(tmp, s); - path(tmp); - return tmp; + if (copy) { + copystring(tmp, s); + path(tmp); + return tmp; + } else { + return (char *) s; + } } const char *parentdir(const char *directory) { @@ -406,6 +410,7 @@ static size_t rwopswrite(SDL_RWops *rw, const void *buf, size_t size, size_t nme } static int rwopsclose(SDL_RWops *rw) { + (void) rw; return 0; } @@ -465,7 +470,7 @@ struct filestream : stream { file = fopen(name, mode); return file!=NULL; } - bool opentemp(const char *name, const char *mode) { + bool opentemp() { if(file) return false; file = tmpfile(); return file!=NULL; @@ -854,10 +859,9 @@ stream *openfile(const char *filename, const char *mode) { return openrawfile(filename, mode); } -stream *opentempfile(const char *name, const char *mode) { - const char *found = findfile(name, mode); +stream *opentempfile() { filestream *file = new filestream; - if(!file->opentemp(found ? found : name, mode)) { delete file; return NULL; } + if(!file->opentemp()) { delete file; return NULL; } return file; } |
