From cf40f5073dad981e2d4926a43494046f218bc56a Mon Sep 17 00:00:00 2001 From: Bill Currie <bill@taniwha.org> Date: Tue, 24 Aug 2010 16:50:33 +0900 Subject: [PATCH] Nuke QFS_WriteBuffers. This function is too dangerous for my liking, and it's now unnecessary since qfs has been locked down. --- include/QF/quakefs.h | 1 - libs/image/tga.c | 11 +++++++++-- libs/util/quakefs.c | 29 ----------------------------- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/include/QF/quakefs.h b/include/QF/quakefs.h index b5281b37f..e1d04daf2 100644 --- a/include/QF/quakefs.h +++ b/include/QF/quakefs.h @@ -83,7 +83,6 @@ void QFS_Gamedir (const char *dir); QFile *QFS_Open (const char *path, const char *mode); QFile *QFS_WOpen (const char *path, int zip); void QFS_WriteFile (const char *filename, const void *data, int len); -void QFS_WriteBuffers (const char *filename, int count, ...); int _QFS_FOpenFile (const char *filename, QFile **gzfile, struct dstring_s *foundname, int zip); diff --git a/libs/image/tga.c b/libs/image/tga.c index 7e2c89324..6538e2688 100644 --- a/libs/image/tga.c +++ b/libs/image/tga.c @@ -665,6 +665,7 @@ LoadTGA (QFile *fin) VISIBLE void WriteTGAfile (const char *tganame, byte *data, int width, int height) { + QFile *qfile; TargaHeader header; memset (&header, 0, sizeof (header)); @@ -673,6 +674,12 @@ WriteTGAfile (const char *tganame, byte *data, int width, int height) header.height = LittleShort (height); header.pixel_size = 24; - QFS_WriteBuffers (tganame, 2, &header, sizeof (header), data, - width * height * 3); + qfile = QFS_WOpen (tganame, 0); + if (!qfile) { + Sys_Printf ("Error opening %s", tganame); + return; + } + Qwrite (qfile, &header, sizeof (header)); + Qwrite (qfile, data, width * height * 3); + Qclose (qfile); } diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index ef49eae25..221c16582 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -669,35 +669,6 @@ QFS_WriteFile (const char *filename, const void *data, int len) Qclose (f); } -/* - QFS_WriteBuffers - - The filename will be prefixed by the current game directory -*/ -VISIBLE void -QFS_WriteBuffers (const char *filename, int count, ...) -{ - va_list args; - QFile *f; - - va_start (args, count); - - f = QFS_WOpen (filename, 0); - if (!f) { - Sys_Error ("Error opening %s", filename); - } - - Sys_DPrintf ("QFS_WriteBuffers: %s\n", filename); - while (count--) { - void *data = va_arg (args, void *); - int len = va_arg (args, int); - - Qwrite (f, data, len); - } - Qclose (f); - va_end (args); -} - VISIBLE int QFS_CreatePath (const char *path) {