First pass at removing Windows compiler warnings.

pull/475/head
Mooneer Salem 2023-07-12 23:07:51 -07:00
parent 072754cf45
commit ea76a217ec
5 changed files with 25 additions and 5 deletions

View File

@ -13,7 +13,7 @@ set(CMAKE_RC_COMPILER ${triple}-windres)
set(CMAKE_C_FLAGS -gcodeview)
set(CMAKE_CXX_FLAGS -gcodeview)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--pdb=)
set(CMAKE_EXE_LINKER_FLAGS -Wno-unused-command-line-argument -Wl,--pdb=)
# For make package use.
set(CMAKE_OBJDUMP ${triple}-objdump)

View File

@ -14,7 +14,7 @@ set(CMAKE_RC_COMPILER ${triple}-windres)
set(CMAKE_C_FLAGS -gcodeview)
set(CMAKE_CXX_FLAGS -gcodeview)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--pdb=)
set(CMAKE_EXE_LINKER_FLAGS -Wno-unused-command-line-argument -Wl,--pdb=)
# For make package use.
set(CMAKE_OBJDUMP ${triple}-objdump)

View File

@ -14,7 +14,7 @@ set(CMAKE_RC_COMPILER ${triple}-windres)
set(CMAKE_C_FLAGS -gcodeview)
set(CMAKE_CXX_FLAGS -gcodeview)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--pdb=)
set(CMAKE_EXE_LINKER_FLAGS -Wno-unused-command-line-argument -Wl,--pdb=)
# For make package use.
set(CMAKE_OBJDUMP ${triple}-objdump)

View File

@ -14,7 +14,7 @@ set(CMAKE_RC_COMPILER ${triple}-windres)
set(CMAKE_C_FLAGS -gcodeview)
set(CMAKE_CXX_FLAGS -gcodeview)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--pdb=)
set(CMAKE_EXE_LINKER_FLAGS -Wno-unused-command-line-argument -Wl,--pdb=)
# For make package use.
set(CMAKE_OBJDUMP ${triple}-objdump)

View File

@ -127,7 +127,27 @@ bool Serialport::openport(const char name[], bool useRTS, bool RTSPos, bool useD
return true;
error:
if (g_verbose) fprintf(stderr, "%s failed\n", lpszFunction);
if (g_verbose)
{
#ifdef UNICODE
std::vector<char> buffer;
std::string errFn = "[Unknown Function]"
int size = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL);
if (size > 0)
{
buffer.resize(size);
WideCharToMultiByte(CP_UTF8, 0, text, -1, static_cast<BYTE*>(&buffer[0]), buffer.size(), NULL, NULL);
errFn = std::string(&buffer[0]);
}
else
{
// Error handling, probably shouldn't reach here
}
fprintf(stderr, "%s failed\n", errFn.c_str());
#else
fprintf(stderr, "%s failed\n", lpszFunction);
#endif // UNICODE
}
// Retrieve the system error message for the last-error code