I noticed a few warnings from MinGW from my attempts at compiling on Linux.
FileSystemHelper.cpp: In function ‘std::__cxx11::string GetPrivateProfileStdString(std::__cxx11::string, std::__cxx11::string, std::__cxx11::string)’:
FileSystemHelper.cpp:37:7: warning: unused variable ‘returnSize’ [-Wunused-variable]
int returnSize = GetPrivateProfileString(sectionName.c_str(), key.c_str(), "", buffer, currentBufferSize, filename.c_str());
^~~~~~~~~~
ConsoleModuleLoader.cpp: In member function ‘void ConsoleModuleLoader::LoadModule()’:
ConsoleModuleLoader.cpp:65:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (GetFileAttributesA(moduleDirectory.c_str()) == -1) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
ConsoleModuleLoader.cpp: In member function ‘std::__cxx11::string ConsoleModuleLoader::ParseLoadModCommand(std::vector<std::__cxx11::basic_string<char> >)’:
ConsoleModuleLoader.cpp:143:48: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (GetFileAttributesA(modDirectory.c_str()) == -1) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
op2ext.cpp:18:27: warning: ‘StubExt’ initialized and declared ‘extern’
extern "C" OP2EXT_API int StubExt = 0;
^~~~~~~
I came across a rather strong opinion about the last one, suggesting that warning should be considered a compiler bug. The other ones look quite legitimate though.
The return type of GetFileAttributes is DWORD, which is an alias for unsigned int. The INVALID_FILE_ATTRIBUTES value corresponds to -1, but I assume is casted to a DWORD. We should probably use INVALID_FILE_ATTRIBUTES instead of a numeric literal, both for readability, and to eliminate the warning.
I noticed a few warnings from MinGW from my attempts at compiling on Linux.
I came across a rather strong opinion about the last one, suggesting that warning should be considered a compiler bug. The other ones look quite legitimate though.
For reference: GetPrivateProfileString GetFileAttributesA
The return type of
GetFileAttributes
isDWORD
, which is an alias forunsigned int
. TheINVALID_FILE_ATTRIBUTES
value corresponds to-1
, but I assume is casted to aDWORD
. We should probably useINVALID_FILE_ATTRIBUTES
instead of a numeric literal, both for readability, and to eliminate the warning.