From bca5650578fd693f25bca7bc683a0c0c7484ab38 Mon Sep 17 00:00:00 2001 From: Gargaj Date: Sat, 18 Jun 2022 23:11:24 +0200 Subject: [PATCH] fix windows 32 bit builds --- code/Common/DefaultIOStream.cpp | 7 +++++++ code/PostProcessing/EmbedTexturesProcess.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code/Common/DefaultIOStream.cpp b/code/Common/DefaultIOStream.cpp index 17fc44f9a..201d68fdf 100644 --- a/code/Common/DefaultIOStream.cpp +++ b/code/Common/DefaultIOStream.cpp @@ -156,6 +156,13 @@ size_t DefaultIOStream::FileSize() const { if (0 != err) return 0; mCachedSize = (size_t)(fileStat.st_size); +#elif defined _WIN32 + struct _stat32 fileStat; + //using fileno + fstat avoids having to handle the filename + int err = _fstat32(_fileno(mFile), &fileStat); + if (0 != err) + return 0; + mCachedSize = (size_t)(fileStat.st_size); #elif defined __GNUC__ || defined __APPLE__ || defined __MACH__ || defined __FreeBSD__ struct stat fileStat; int err = stat(mFilename.c_str(), &fileStat); diff --git a/code/PostProcessing/EmbedTexturesProcess.cpp b/code/PostProcessing/EmbedTexturesProcess.cpp index 2f80c908e..7ac4ddd4e 100644 --- a/code/PostProcessing/EmbedTexturesProcess.cpp +++ b/code/PostProcessing/EmbedTexturesProcess.cpp @@ -128,7 +128,7 @@ bool EmbedTexturesProcess::addTexture(aiScene *pScene, const std::string &path) aiTexel* imageContent = new aiTexel[ 1ul + static_cast( imageSize ) / sizeof(aiTexel)]; pFile->Seek(0, aiOrigin_SET); - pFile->Read(reinterpret_cast(imageContent), imageSize, 1); + pFile->Read(reinterpret_cast(imageContent), static_cast(imageSize), 1); mIOHandler->Close(pFile); // Enlarging the textures table