mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
Use File::size() instead of stat() to find the size of a file.
svn-id: r17900
This commit is contained in:
parent
f17c35682a
commit
5f7b3d8cf2
@ -320,17 +320,20 @@ void data_seekData(int16 handle, int32 pos, int16 from) {
|
||||
int32 data_getDataSize(const char *name) {
|
||||
char buf[128];
|
||||
int32 chunkSz;
|
||||
struct stat statBuf;
|
||||
File file;
|
||||
|
||||
strcpy(buf, name);
|
||||
chunkSz = data_getChunkSize(buf);
|
||||
if (chunkSz >= 0)
|
||||
return chunkSz;
|
||||
|
||||
if (stat(buf, &statBuf) == -1)
|
||||
error("data_getDataSize: Can't find data (%s)", name);
|
||||
if (!file.open(buf))
|
||||
error("data_getDataSize: Can't find data(%s)", name);
|
||||
|
||||
return statBuf.st_size;
|
||||
chunkSz = file.size();
|
||||
file.close();
|
||||
|
||||
return chunkSz;
|
||||
}
|
||||
|
||||
char *data_getData(const char *path) {
|
||||
@ -359,7 +362,6 @@ char *data_getData(const char *path) {
|
||||
data_readData(handle, ptr, size);
|
||||
data_closeData(handle);
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
char *data_getSmallData(const char *path) {
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define GOB_DATAIO_H
|
||||
|
||||
#include "common/file.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace Gob {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user