Fixed compilation errors with MSVC++

This commit is contained in:
Bertrand Coconnier 2016-07-03 11:53:23 +02:00
parent efa1292b2d
commit d3c5c45262
2 changed files with 3 additions and 2 deletions

View File

@ -32,6 +32,7 @@
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include <direct.h>
# include <Shlwapi.h>
#else
# include <sys/types.h>
# include <dirent.h>

View File

@ -988,7 +988,7 @@ std::wstring SGPath::wstr() const
{
#ifdef SG_WINDOWS
size_t buflen = mbstowcs(NULL, path.c_str(), 0)+1;
wchar_t wideBuf = malloc(buflen * sizeof(int));
wchar_t* wideBuf = malloc(buflen * sizeof(int));
if (wideBuf) {
size_t count = mbstowcs(wideBuf, path.c_str(), buflen);
if (count == (size_t)-1) {
@ -1002,5 +1002,5 @@ std::wstring SGPath::wstr() const
SG_LOG( SG_GENERAL, SG_ALERT, "SGPath::wstr: unable to allocate enough memory for " << *this );
}
#endif
return std::wstring();
}