From e22611b1e7c677c1fb8859e2b7fe4f03026f6f58 Mon Sep 17 00:00:00 2001 From: sezero Date: Wed, 3 Aug 2011 19:22:29 +0000 Subject: [PATCH] removed the LoadBufFile method git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@475 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/common.c | 26 +------------------------- Quake/common.h | 6 ------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/Quake/common.c b/Quake/common.c index 5c4b5bd0..67904323 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -1642,8 +1642,7 @@ Allways appends a 0 byte. #define LOADFILE_TEMPHUNK 2 #define LOADFILE_CACHE 3 #define LOADFILE_STACK 4 -#define LOADFILE_BUF 5 -#define LOADFILE_MALLOC 6 +#define LOADFILE_MALLOC 5 static byte *loadbuf; static cache_user_t *loadcache; @@ -1686,12 +1685,6 @@ byte *COM_LoadFile (const char *path, int usehunk, unsigned int *path_id) else buf = (byte *) Hunk_TempAlloc (len+1); break; - case LOADFILE_BUF: - if (len < loadsize && loadbuf != NULL) - buf = loadbuf; - else - buf = (byte *) Hunk_AllocName(len + 1, base); - break; case LOADFILE_MALLOC: buf = (byte *) malloc (len+1); break; @@ -1743,23 +1736,6 @@ byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize, unsigned i return buf; } -// loads into a previously allocated buffer. if space is insufficient -// or the buffer is NULL, loads onto the hunk. bufsize is the actual -// size (without the +1). -byte *COM_LoadBufFile (const char *path, void *buffer, int *bufsize, unsigned int *path_id) -{ - byte *buf; - - loadbuf = (byte *)buffer; - loadsize = (*bufsize) + 1; - buf = COM_LoadFile (path, LOADFILE_BUF, path_id); - *bufsize = (buf == NULL) ? 0 : com_filesize; - if (loadbuf && buf && buf != loadbuf) - Sys_Printf("LoadBufFile: insufficient buffer for %s not used.\n", path); - - return buf; -} - // returns malloc'd memory byte *COM_LoadMallocFile (const char *path, unsigned int *path_id) { diff --git a/Quake/common.h b/Quake/common.h index 1e5db27d..c47848af 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -219,12 +219,6 @@ void COM_LoadCacheFile (const char *path, struct cache_user_s *cu, // uses cache mem for allocating the buffer. byte *COM_LoadMallocFile (const char *path, unsigned int *path_id); // allocates the buffer on the system mem (malloc). -byte *COM_LoadBufFile (const char *path, void *buffer, int *bufsize, - unsigned int *path_id); - // uses the specified pre-allocated buffer with bufsize + 1 size. - // bufsize is the actual expected size (without the + 1). if the - // space is too short or the buffer is NULL, loads onto the hunk. - // sets bufsize to com_filesize for success, or to 0 for failure. /* The following FS_*() stdio replacements are necessary if one is * to perform non-sequential reads on files reopened on pak files