fix possible UNICODE related build failure due to OCCT cmake flags

This commit is contained in:
wmayer
2018-08-06 12:29:43 +02:00
parent d1a051721d
commit 228b63e1f9
6 changed files with 13 additions and 12 deletions

View File

@@ -79,8 +79,8 @@ bool SMESH_File::open()
if ( !_map && length > 0 )
{
#ifdef WIN32
_file = CreateFile(_name.data(), GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
_file = CreateFileA(_name.data(), GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
bool ok = ( _file != INVALID_HANDLE_VALUE );
#else
_file = ::open(_name.data(), O_RDONLY );
@@ -292,7 +292,7 @@ bool SMESH_File::openForWriting()
{
#ifdef WIN32
_file = CreateFile( _name.c_str(), // name of the write
_file = CreateFileA(_name.c_str(), // name of the write
GENERIC_WRITE, // open for writing
0, // do not share
NULL, // default security

View File

@@ -1037,7 +1037,7 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
xmlPath += sep + plugin + ".xml";
bool fileOK;
#ifdef WIN32
fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
fileOK = (GetFileAttributesA(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
#else
fileOK = (access(xmlPath.c_str(), F_OK) == 0);
#endif

View File

@@ -2270,7 +2270,7 @@ void Application::ExtractUserPath()
#elif defined(FC_OS_WIN32)
WCHAR szPath[MAX_PATH];
TCHAR dest[MAX_PATH*3];
char dest[MAX_PATH*3];
// Get the default path where we can save our documents. It seems that
// 'CSIDL_MYDOCUMENTS' doesn't work on all machines, so we use 'CSIDL_PERSONAL'
// which does the same.
@@ -2454,7 +2454,7 @@ std::string Application::FindHomePath(const char* sCall)
// Python interpreter is already initialized.
wchar_t szFileName [MAX_PATH];
if (Py_IsInitialized()) {
GetModuleFileNameW(GetModuleHandle(sCall),szFileName, MAX_PATH-1);
GetModuleFileNameW(GetModuleHandleA(sCall),szFileName, MAX_PATH-1);
}
else {
GetModuleFileNameW(0, szFileName, MAX_PATH-1);

View File

@@ -62,7 +62,7 @@ GUIConsole::GUIConsole (void)
::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE),&csbi);
csbi.dwSize.Y = s_nMaxLines;
::SetConsoleScreenBufferSize(::GetStdHandle(STD_OUTPUT_HANDLE),csbi.dwSize);
::SetConsoleTitle( "FreeCAD Console");
::SetConsoleTitleA( "FreeCAD Console");
*stdout = *::_fdopen(::_open_osfhandle(reinterpret_cast<LONG>(::GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT), "w");
::setvbuf(stdout, 0, _IONBF, 0);

View File

@@ -336,7 +336,7 @@ typedef BOOL (__stdcall *tMDWD)(
static tMDWD s_pMDWD;
static HMODULE s_hDbgHelpMod;
static MINIDUMP_TYPE s_dumpTyp = MiniDumpNormal;
static std::string s_szMiniDumpFileName; // initialize with whatever appropriate...
static std::wstring s_szMiniDumpFileName; // initialize with whatever appropriate...
#include <Base/StackWalker.h>
class MyStackWalker : public StackWalker
@@ -380,7 +380,7 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
bool bFailed = true;
HANDLE hFile;
hFile = CreateFile(s_szMiniDumpFileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFileW(s_szMiniDumpFileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
MINIDUMP_EXCEPTION_INFORMATION stMDEI;
@@ -423,11 +423,12 @@ void InitMiniDumpWriter(const std::string& filename)
{
if (s_hDbgHelpMod != NULL)
return;
s_szMiniDumpFileName = filename;
Base::FileInfo fi(filename);
s_szMiniDumpFileName = fi.toStdWString();
// Initialize the member, so we do not load the dll after the exception has occurred
// which might be not possible anymore...
s_hDbgHelpMod = LoadLibrary(("dbghelp.dll"));
s_hDbgHelpMod = LoadLibraryA(("dbghelp.dll"));
if (s_hDbgHelpMod != NULL)
s_pMDWD = (tMDWD) GetProcAddress(s_hDbgHelpMod, "MiniDumpWriteDump");

View File

@@ -1047,7 +1047,7 @@ protected:
SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW));
Rectangle(hdc, 0, 0, width(), height());
RECT rect = {0, 0, width(), height() };
DrawText(hdc, "Hello World!", 12, &rect,
DrawTextA(hdc, "Hello World!", 12, &rect,
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
#if QT_VERSION < 0x050000
releaseDC(hdc);