DefaultIOStream::FileSize(): Replaced windows-based version to use mFile directly instead of fileStat
Unfortunately, it is not 100% clear anymore what's the background of this change. Maybe it was faster or it avoided issues in case that file loaders used exclusive open. All I know is that this change is not the accidental result of a merge, because according to SVN blame, this code section had never been touched since revision 1. So it must have been done for InfraWorks for some reason. So I preserved this change to avoid regression due to the AssImp update.pull/195/head
parent
cc3f8b82f9
commit
8ee54741e1
|
@ -112,11 +112,11 @@ size_t DefaultIOStream::FileSize() const
|
||||||
|
|
||||||
// TODO: Is that really faster if we're already owning a handle to the file?
|
// TODO: Is that really faster if we're already owning a handle to the file?
|
||||||
#if defined _WIN32 && !defined __GNUC__
|
#if defined _WIN32 && !defined __GNUC__
|
||||||
struct __stat64 fileStat;
|
|
||||||
int err = _stat64( mFilename.c_str(), &fileStat );
|
int current = ::ftell(mFile);
|
||||||
if (0 != err)
|
::fseek(mFile, 0, SEEK_END);
|
||||||
return 0;
|
cachedSize = (size_t)::ftell(mFile);
|
||||||
cachedSize = (size_t) (fileStat.st_size);
|
::fseek(mFile, current, SEEK_SET);
|
||||||
#else
|
#else
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
int err = stat(mFilename.c_str(), &fileStat );
|
int err = stat(mFilename.c_str(), &fileStat );
|
||||||
|
|
Loading…
Reference in New Issue