removed the LoadBufFile method

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@475 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2011-08-03 19:22:29 +00:00
parent 8e5e380771
commit e22611b1e7
2 changed files with 1 additions and 31 deletions

View File

@ -1642,8 +1642,7 @@ Allways appends a 0 byte.
#define LOADFILE_TEMPHUNK 2 #define LOADFILE_TEMPHUNK 2
#define LOADFILE_CACHE 3 #define LOADFILE_CACHE 3
#define LOADFILE_STACK 4 #define LOADFILE_STACK 4
#define LOADFILE_BUF 5 #define LOADFILE_MALLOC 5
#define LOADFILE_MALLOC 6
static byte *loadbuf; static byte *loadbuf;
static cache_user_t *loadcache; static cache_user_t *loadcache;
@ -1686,12 +1685,6 @@ byte *COM_LoadFile (const char *path, int usehunk, unsigned int *path_id)
else else
buf = (byte *) Hunk_TempAlloc (len+1); buf = (byte *) Hunk_TempAlloc (len+1);
break; break;
case LOADFILE_BUF:
if (len < loadsize && loadbuf != NULL)
buf = loadbuf;
else
buf = (byte *) Hunk_AllocName(len + 1, base);
break;
case LOADFILE_MALLOC: case LOADFILE_MALLOC:
buf = (byte *) malloc (len+1); buf = (byte *) malloc (len+1);
break; break;
@ -1743,23 +1736,6 @@ byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize, unsigned i
return buf; 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 // returns malloc'd memory
byte *COM_LoadMallocFile (const char *path, unsigned int *path_id) byte *COM_LoadMallocFile (const char *path, unsigned int *path_id)
{ {

View File

@ -219,12 +219,6 @@ void COM_LoadCacheFile (const char *path, struct cache_user_s *cu,
// uses cache mem for allocating the buffer. // uses cache mem for allocating the buffer.
byte *COM_LoadMallocFile (const char *path, unsigned int *path_id); byte *COM_LoadMallocFile (const char *path, unsigned int *path_id);
// allocates the buffer on the system mem (malloc). // 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 /* The following FS_*() stdio replacements are necessary if one is
* to perform non-sequential reads on files reopened on pak files * to perform non-sequential reads on files reopened on pak files