Added handling of error return type
This commit is contained in:
parent
05d97aad28
commit
6df325f651
@ -413,15 +413,21 @@ bool trpgr_Archive::ReadExternalTile(uint32 x,uint32 y,uint32 lod,trpgMemReadBuf
|
||||
// Find the file end
|
||||
if (fseek(filep,0,SEEK_END))
|
||||
throw 1;
|
||||
|
||||
// Note: This means tile is capped at 2 gigs
|
||||
long pos = ftell(filep);
|
||||
if (pos<0)
|
||||
throw 1;
|
||||
|
||||
if (fseek(filep,0,SEEK_SET))
|
||||
throw 1;
|
||||
|
||||
// Now we know the size. Read the whole file
|
||||
buf.SetLength(pos);
|
||||
char *data = buf.GetDataPtr();
|
||||
if (fread(data,pos,1,filep) != 1)
|
||||
throw 1;
|
||||
|
||||
fclose(filep);
|
||||
filep = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user