Browse Source

Even more MSVC compat

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 2 years ago
parent
commit
62838c8b85
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 10 additions and 14 deletions
  1. +5
    -5
      source/modules/water/files/File.cpp
  2. +5
    -9
      source/modules/water/misc/Time.cpp

+ 5
- 5
source/modules/water/files/File.cpp View File

@@ -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);


+ 5
- 9
source/modules/water/misc/Time.cpp View File

@@ -35,12 +35,8 @@
#endif
#ifdef _MSC_VER
# ifndef NOMINMAX
# define NOMINMAX
# endif
# define WIN32_LEAN_AND_MEAN 1
# include <winsock2.h>
# include <windows.h>
# include <sys/timeb.h>
# include <sys/types.h>
#else
# include <sys/time.h>
#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);


Loading…
Cancel
Save