- removed the unused File* functions which were the last remaining places to use stdio FILE for reading.

For writing FILE is mostly fine, but reading should exclusively use FileReader to ensure interoperability with the virtual file system.
This commit is contained in:
Christoph Oelckers 2019-11-13 18:34:05 +01:00
parent c6a38faf39
commit 7f3d00446d
2 changed files with 0 additions and 38 deletions

View file

@ -68,40 +68,6 @@ void *ResReadLine(char *buffer, unsigned int nBytes, void **pRes)
return *pRes;
}
bool FileRead(FILE *handle, void *buffer, unsigned int size)
{
return fread(buffer, 1, size, handle) == size;
}
bool FileWrite(FILE *handle, void *buffer, unsigned int size)
{
return fwrite(buffer, 1, size, handle) == size;
}
bool FileLoad(const char *name, void *buffer, unsigned int size)
{
dassert(buffer != NULL);
FILE *handle = fopen(name, "rb");
if (!handle)
return false;
unsigned int nread = fread(buffer, 1, size, handle);
fclose(handle);
return nread == size;
}
int FileLength(FILE *handle)
{
if (!handle)
return 0;
int nPos = ftell(handle);
fseek(handle, 0, SEEK_END);
int nLength = ftell(handle);
fseek(handle, nPos, SEEK_SET);
return nLength;
}
unsigned int randSeed = 1;
unsigned int qrand(void)

View file

@ -25,10 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
void *ResReadLine(char *buffer, unsigned int nBytes, void **pRes);
bool FileRead(FILE *, void *, unsigned int);
bool FileWrite(FILE *, void *, unsigned int);
bool FileLoad(const char *, void *, unsigned int);
int FileLength(FILE *);
unsigned int qrand(void);
int wrand(void);
void wsrand(int);