diff --git a/library/include/Pragma.h b/library/include/Pragma.h index 8f82b8d3c..00472e732 100644 --- a/library/include/Pragma.h +++ b/library/include/Pragma.h @@ -58,6 +58,8 @@ distribution. #pragma warning( disable: 4482) // nonstandard extension used: 'extern' before template explicit instantiation #pragma warning( disable: 4231) + // ignore warnings about putting a vector index into an int + #pragma warning( disable: 4267) #endif #endif diff --git a/library/modules/Filesystem.cpp b/library/modules/Filesystem.cpp index 05d4e4fda..430e6351e 100644 --- a/library/modules/Filesystem.cpp +++ b/library/modules/Filesystem.cpp @@ -53,7 +53,7 @@ using namespace DFHack; bool Filesystem::chdir (std::string path) { - return !(bool)::chdir(path.c_str()); + return ::chdir(path.c_str()) == 0; } 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 | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH); #endif - return !(bool)fail; + return fail == 0; } bool Filesystem::rmdir (std::string path) @@ -90,7 +90,7 @@ bool Filesystem::rmdir (std::string path) #else fail = ::rmdir(path.c_str()); #endif - return !(bool)fail; + return fail == 0; } #ifdef _WIN32 @@ -116,13 +116,13 @@ _filetype mode2type (mode_t mode) { 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) { STAT_STRUCT info; - return (bool)Filesystem::stat(path, info); + return Filesystem::stat(path, info); } _filetype Filesystem::filetype (std::string path)