Skip to content

Commit 2e4d2df

Browse files
committed
fix possible UNICODE related build failure due to OCCT cmake flags
1 parent 5e63d3d commit 2e4d2df

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ bool SMESH_File::open()
7979
if ( !_map && length > 0 )
8080
{
8181
#ifdef WIN32
82-
_file = CreateFile(_name.data(), GENERIC_READ, FILE_SHARE_READ,
83-
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
82+
_file = CreateFileA(_name.data(), GENERIC_READ, FILE_SHARE_READ,
83+
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8484
bool ok = ( _file != INVALID_HANDLE_VALUE );
8585
#else
8686
_file = ::open(_name.data(), O_RDONLY );
@@ -292,7 +292,7 @@ bool SMESH_File::openForWriting()
292292
{
293293
#ifdef WIN32
294294

295-
_file = CreateFile( _name.c_str(), // name of the write
295+
_file = CreateFileA(_name.c_str(), // name of the write
296296
GENERIC_WRITE, // open for writing
297297
0, // do not share
298298
NULL, // default security

src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
10371037
xmlPath += sep + plugin + ".xml";
10381038
bool fileOK;
10391039
#ifdef WIN32
1040-
fileOK = (GetFileAttributes(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
1040+
fileOK = (GetFileAttributesA(xmlPath.c_str()) != INVALID_FILE_ATTRIBUTES);
10411041
#else
10421042
fileOK = (access(xmlPath.c_str(), F_OK) == 0);
10431043
#endif

src/App/Application.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ void Application::ExtractUserPath()
22702270

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

src/Gui/GuiConsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ GUIConsole::GUIConsole (void)
6262
::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE),&csbi);
6363
csbi.dwSize.Y = s_nMaxLines;
6464
::SetConsoleScreenBufferSize(::GetStdHandle(STD_OUTPUT_HANDLE),csbi.dwSize);
65-
::SetConsoleTitle( "FreeCAD Console");
65+
::SetConsoleTitleA( "FreeCAD Console");
6666

6767
*stdout = *::_fdopen(::_open_osfhandle(reinterpret_cast<LONG>(::GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT), "w");
6868
::setvbuf(stdout, 0, _IONBF, 0);

src/Main/MainGui.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ typedef BOOL (__stdcall *tMDWD)(
336336
static tMDWD s_pMDWD;
337337
static HMODULE s_hDbgHelpMod;
338338
static MINIDUMP_TYPE s_dumpTyp = MiniDumpNormal;
339-
static std::string s_szMiniDumpFileName; // initialize with whatever appropriate...
339+
static std::wstring s_szMiniDumpFileName; // initialize with whatever appropriate...
340340

341341
#include <Base/StackWalker.h>
342342
class MyStackWalker : public StackWalker
@@ -380,7 +380,7 @@ static LONG __stdcall MyCrashHandlerExceptionFilter(EXCEPTION_POINTERS* pEx)
380380

381381
bool bFailed = true;
382382
HANDLE hFile;
383-
hFile = CreateFile(s_szMiniDumpFileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
383+
hFile = CreateFileW(s_szMiniDumpFileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
384384
if (hFile != INVALID_HANDLE_VALUE)
385385
{
386386
MINIDUMP_EXCEPTION_INFORMATION stMDEI;
@@ -423,11 +423,12 @@ void InitMiniDumpWriter(const std::string& filename)
423423
{
424424
if (s_hDbgHelpMod != NULL)
425425
return;
426-
s_szMiniDumpFileName = filename;
426+
Base::FileInfo fi(filename);
427+
s_szMiniDumpFileName = fi.toStdWString();
427428

428429
// Initialize the member, so we do not load the dll after the exception has occurred
429430
// which might be not possible anymore...
430-
s_hDbgHelpMod = LoadLibrary(("dbghelp.dll"));
431+
s_hDbgHelpMod = LoadLibraryA(("dbghelp.dll"));
431432
if (s_hDbgHelpMod != NULL)
432433
s_pMDWD = (tMDWD) GetProcAddress(s_hDbgHelpMod, "MiniDumpWriteDump");
433434

src/Mod/Sandbox/Gui/Command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ class GDIWidget : public QWidget
10471047
SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW));
10481048
Rectangle(hdc, 0, 0, width(), height());
10491049
RECT rect = {0, 0, width(), height() };
1050-
DrawText(hdc, "Hello World!", 12, &rect,
1050+
DrawTextA(hdc, "Hello World!", 12, &rect,
10511051
DT_SINGLELINE | DT_VCENTER | DT_CENTER);
10521052
#if QT_VERSION < 0x050000
10531053
releaseDC(hdc);

0 commit comments

Comments
 (0)