Skip to content

Commit

Permalink
fix possible UNICODE related build failure due to OCCT cmake flags
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 6, 2018
1 parent 5e63d3d commit 2e4d2df
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/src/SMESH/SMESH_Gen.cpp
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/App/Application.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/GuiConsole.cpp
Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions src/Main/MainGui.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Sandbox/Gui/Command.cpp
Expand Up @@ -1047,7 +1047,7 @@ class GDIWidget : public QWidget
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);
Expand Down

0 comments on commit 2e4d2df

Please sign in to comment.