From 62838c8b850290ded166c8c71ba12f49b3a6b159 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 7 May 2023 18:19:50 +0200 Subject: [PATCH] Even more MSVC compat Signed-off-by: falkTX --- source/modules/water/files/File.cpp | 10 +++++----- source/modules/water/misc/Time.cpp | 14 +++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/source/modules/water/files/File.cpp b/source/modules/water/files/File.cpp index eba9c51da..16a1446cb 100644 --- a/source/modules/water/files/File.cpp +++ b/source/modules/water/files/File.cpp @@ -987,7 +987,7 @@ namespace WindowsFileHelpers { CHAR apath [MAX_PATH + 256]; - if (WideCharToMultiByte (CP_UTF8, 0, wpath, -1, apath, (int) numElementsInArray (apath), nullptr, nullptr)) + if (WideCharToMultiByte (CP_UTF8, 0, wpath, -1, apath, numElementsInArray (apath), nullptr, nullptr)) return File (String (apath)); } @@ -1001,7 +1001,7 @@ namespace WindowsFileHelpers wdest[0] = 0; GetModuleFileNameW (moduleHandle, wdest, (DWORD) numElementsInArray (wdest)); - if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, (int) numElementsInArray (adest), nullptr, nullptr)) + if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, numElementsInArray (adest), nullptr, nullptr)) return File (String (adest)); return File(); @@ -1101,7 +1101,7 @@ File File::getCurrentWorkingDirectory() wdest[0] = 0; GetCurrentDirectoryW ((DWORD) numElementsInArray (wdest), wdest); - if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, (int) numElementsInArray (adest), nullptr, nullptr)) + if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, numElementsInArray (adest), nullptr, nullptr)) return File (String (adest)); return File(); @@ -1134,7 +1134,7 @@ File File::getSpecialLocation (const SpecialLocationType type) wdest[0] = 0; GetTempPathW ((DWORD) numElementsInArray (wdest), wdest); - if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, (int) numElementsInArray (adest), nullptr, nullptr)) + if (WideCharToMultiByte (CP_UTF8, 0, wdest, -1, adest, numElementsInArray (adest), nullptr, nullptr)) return File (String (adest)); return File(); @@ -1200,7 +1200,7 @@ public: CHAR apath [MAX_PATH + 256]; - if (WideCharToMultiByte (CP_UTF8, 0, findData.cFileName, -1, apath, (int) numElementsInArray (apath), nullptr, nullptr)) + if (WideCharToMultiByte (CP_UTF8, 0, findData.cFileName, -1, apath, numElementsInArray (apath), nullptr, nullptr)) filenameFound = apath; if (isDir != nullptr) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); diff --git a/source/modules/water/misc/Time.cpp b/source/modules/water/misc/Time.cpp index 837741868..07092a0d6 100644 --- a/source/modules/water/misc/Time.cpp +++ b/source/modules/water/misc/Time.cpp @@ -35,12 +35,8 @@ #endif #ifdef _MSC_VER -# ifndef NOMINMAX -# define NOMINMAX -# endif -# define WIN32_LEAN_AND_MEAN 1 -# include -# include +# include +# include #else # include #endif @@ -134,9 +130,9 @@ Time Time::getCurrentTime() noexcept int64 Time::currentTimeMillis() noexcept { #ifdef _MSC_VER - struct _timeb t; - _ftime_s (&t); - return ((int64) t.time) * 1000 + t.millitm; + struct _timeb tb; + _ftime_s (&tb); + return ((int64) tb.time) * 1000 + tb.millitm; #else struct timeval tv; gettimeofday (&tv, nullptr);