mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 17:22:06 +08:00
Merge pull request #285 from azadkuh/issue280
update os.h to fix filesize() on older win32
This commit is contained in:
commit
9e37f5cef9
@ -31,6 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
|
|
||||||
@ -204,9 +205,9 @@ inline size_t filesize(FILE *f)
|
|||||||
return st.st_size;
|
return st.st_size;
|
||||||
|
|
||||||
#else //windows 32 bits
|
#else //windows 32 bits
|
||||||
struct _stat st;
|
long ret = _filelength(fd);
|
||||||
if (_fstat(fd, &st) == 0)
|
if (ret >= 0)
|
||||||
return st.st_size;
|
return static_cast<size_t>(ret);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else // unix
|
#else // unix
|
||||||
|
Loading…
Reference in New Issue
Block a user