Fix a bunch of 64-bit Windows warnings

develop
Ben Lubar 2017-07-21 13:30:05 -05:00
parent 9ba459f21e
commit 17a7885ef2
No known key found for this signature in database
GPG Key ID: 018BAB45DB2D2B24
2 changed files with 7 additions and 5 deletions

@ -58,6 +58,8 @@ distribution.
#pragma warning( disable: 4482) #pragma warning( disable: 4482)
// nonstandard extension used: 'extern' before template explicit instantiation // nonstandard extension used: 'extern' before template explicit instantiation
#pragma warning( disable: 4231) #pragma warning( disable: 4231)
// ignore warnings about putting a vector index into an int
#pragma warning( disable: 4267)
#endif #endif
#endif #endif

@ -53,7 +53,7 @@ using namespace DFHack;
bool Filesystem::chdir (std::string path) bool Filesystem::chdir (std::string path)
{ {
return !(bool)::chdir(path.c_str()); return ::chdir(path.c_str()) == 0;
} }
std::string Filesystem::getcwd () std::string Filesystem::getcwd ()
@ -79,7 +79,7 @@ bool Filesystem::mkdir (std::string path)
fail = ::mkdir(path.c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | fail = ::mkdir(path.c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH);
#endif #endif
return !(bool)fail; return fail == 0;
} }
bool Filesystem::rmdir (std::string path) bool Filesystem::rmdir (std::string path)
@ -90,7 +90,7 @@ bool Filesystem::rmdir (std::string path)
#else #else
fail = ::rmdir(path.c_str()); fail = ::rmdir(path.c_str());
#endif #endif
return !(bool)fail; return fail == 0;
} }
#ifdef _WIN32 #ifdef _WIN32
@ -116,13 +116,13 @@ _filetype mode2type (mode_t mode) {
bool Filesystem::stat (std::string path, STAT_STRUCT &info) bool Filesystem::stat (std::string path, STAT_STRUCT &info)
{ {
return !(bool)(STAT_FUNC(path.c_str(), &info)); return (STAT_FUNC(path.c_str(), &info)) == 0;
} }
bool Filesystem::exists (std::string path) bool Filesystem::exists (std::string path)
{ {
STAT_STRUCT info; STAT_STRUCT info;
return (bool)Filesystem::stat(path, info); return Filesystem::stat(path, info);
} }
_filetype Filesystem::filetype (std::string path) _filetype Filesystem::filetype (std::string path)