summaryrefslogtreecommitdiff
path: root/src/shared/stream.cpp
diff options
context:
space:
mode:
authorxolatile2025-08-10 00:19:46 +0200
committerxolatile2025-08-10 00:19:46 +0200
commit757096e7df15c14b9b10352fa91663483f9e34f8 (patch)
treedcad789d0abd8be76463277dc01bf32c4e6a527b /src/shared/stream.cpp
parentb2c89d7060e99a36c8c7ac897b7386686c74deac (diff)
downloadxolatile-badassbug-757096e7df15c14b9b10352fa91663483f9e34f8.tar.xz
xolatile-badassbug-757096e7df15c14b9b10352fa91663483f9e34f8.tar.zst
all
Diffstat (limited to 'src/shared/stream.cpp')
-rw-r--r--src/shared/stream.cpp18
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;
}