- use FileReader for all operations on external lumps.

This commit is contained in:
Christoph Oelckers 2017-12-02 12:38:38 +01:00
parent 8d26760671
commit 14af7818b8

View file

@ -669,12 +669,11 @@ FExternalLump::FExternalLump(const char *_filename, int filesize)
if (filesize == -1) if (filesize == -1)
{ {
FILE *f = fopen(_filename,"rb"); FileReader f;
if (f != NULL)
if (f.Open(_filename))
{ {
fseek(f, 0, SEEK_END); LumpSize = f.GetLength();
LumpSize = ftell(f);
fclose(f);
} }
else else
{ {
@ -703,11 +702,11 @@ FExternalLump::~FExternalLump()
int FExternalLump::FillCache() int FExternalLump::FillCache()
{ {
Cache = new char[LumpSize]; Cache = new char[LumpSize];
FILE *f = fopen(filename, "rb"); FileReader f;
if (f != NULL)
if (f.Open(filename))
{ {
fread(Cache, 1, LumpSize, f); f.Read(Cache, LumpSize);
fclose(f);
} }
else else
{ {