From 6ba0b64de64b9599f218acb2877a81980590b51b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 11 Mar 2019 06:06:47 +0000 Subject: [PATCH] Add buildvfs_fopen_write_text Long-term we will need to replace all uses of "\n" in string literals printed to disk. git-svn-id: https://svn.eduke32.com/eduke32@7394 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/vfs.h | 2 ++ source/build/src/osd.cpp | 2 +- source/mact/src/scriplib.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/build/include/vfs.h b/source/build/include/vfs.h index da4266f43..89ad0233f 100644 --- a/source/build/include/vfs.h +++ b/source/build/include/vfs.h @@ -16,6 +16,7 @@ using buildvfs_FILE = PHYSFS_File *; #define buildvfs_fwrite(p, s, n, fp) PHYSFS_writeBytes((fp), (p), (s)*(n)) #define buildvfs_fopen_read(fn) PHYSFS_openRead(fn) #define buildvfs_fopen_write(fn) PHYSFS_openWrite(fn) +#define buildvfs_fopen_write_text(fn) PHYSFS_openWrite(fn) #define buildvfs_fopen_append(fn) PHYSFS_openAppend(fn) static inline int buildvfs_fgetc(buildvfs_FILE fp) { @@ -86,6 +87,7 @@ using buildvfs_FILE = FILE *; #define buildvfs_fwrite(p, s, n, fp) fwrite((p), (s), (n), (fp)) #define buildvfs_fopen_read(fn) fopen((fn), "rb") #define buildvfs_fopen_write(fn) fopen((fn), "wb") +#define buildvfs_fopen_write_text(fn) fopen((fn), "w") #define buildvfs_fopen_append(fn) fopen((fn), "ab") #define buildvfs_fgetc(fp) fgetc(fp) #define buildvfs_fputc(c, fp) fputc((c), (fp)) diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index d30863de7..4d4f0d223 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -764,7 +764,7 @@ void OSD_SetLogFile(const char *fn) if (!fn) return; - osdlog = buildvfs_fopen_write(fn); + osdlog = buildvfs_fopen_write_text(fn); if (osdlog) { diff --git a/source/mact/src/scriplib.cpp b/source/mact/src/scriplib.cpp index e93f699d1..8d0d49b4c 100644 --- a/source/mact/src/scriplib.cpp +++ b/source/mact/src/scriplib.cpp @@ -481,7 +481,7 @@ void SCRIPT_Save(int32_t scripthandle, char const * filename) if (!filename) return; if (!SC(scripthandle)) return; - fp = buildvfs_fopen_write(filename); + fp = buildvfs_fopen_write_text(filename); if (!fp) return; numsect = SCRIPT_NumberSections(scripthandle);