From acc951eca0c1edc1a96cc1c503407c301051061c Mon Sep 17 00:00:00 2001 From: "K.Ohta" Date: Tue, 22 Dec 2015 13:18:38 +0900 Subject: [PATCH] [BUILD][CMAKE][Qt][MINGW] Fix FTBFSs with MinGW32's GCC, Windows. --- source/src/common.cpp | 4 ++-- source/src/common.h | 2 +- source/src/debugger.cpp | 8 ++++---- source/src/vm/datarec.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/src/common.cpp b/source/src/common.cpp index 1dba9701d..bf68e124b 100644 --- a/source/src/common.cpp +++ b/source/src/common.cpp @@ -435,7 +435,7 @@ const _TCHAR *application_path() static bool initialized = false; if(!initialized) { -#ifdef _WIN32 +#ifdef _MSC_VER _TCHAR tmp_path[_MAX_PATH], *ptr = NULL; if(GetModuleFileName(NULL, tmp_path, _MAX_PATH) != 0 && GetFullPathName(tmp_path, _MAX_PATH, app_path, &ptr) != 0 && ptr != NULL) { *ptr = _T('\0'); @@ -520,7 +520,7 @@ _TCHAR *get_file_path_without_extensiton(const _TCHAR* file_path) static _TCHAR path[_MAX_PATH]; my_tcscpy_s(path, _MAX_PATH, file_path); -#ifdef _WIN32 +#ifdef _MSC_VER PathRemoveExtension(path); #else _TCHAR *p = _tcsrchr(path, _T('.')); diff --git a/source/src/common.h b/source/src/common.h index da4ad2d5e..be96e2764 100644 --- a/source/src/common.h +++ b/source/src/common.h @@ -143,7 +143,7 @@ // type definition -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(CSP_OS_GCC_WINDOWS) && !defined(CSP_OS_GCC_CYGWIN) #ifndef boolean typedef bool boolean; #endif diff --git a/source/src/debugger.cpp b/source/src/debugger.cpp index d833b12a4..2ff8c1e83 100644 --- a/source/src/debugger.cpp +++ b/source/src/debugger.cpp @@ -791,7 +791,7 @@ int debugger_command(debugger_thread_t *p, _TCHAR *command, _TCHAR *prev_command return 0; } -#ifdef _WIN32 +#ifdef _MSC_VER unsigned __stdcall debugger_thread(void *lpx) #else int debugger_thread(void *lpx) @@ -909,7 +909,7 @@ int debugger_thread(void *lpx) p->osd->close_console(); p->running = false; -#ifdef _WIN32 +#ifdef _MSC_VER _endthreadex(0); return 0; #else @@ -937,7 +937,7 @@ void EMU::open_debugger(int cpu_index) debugger_thread_param.vm = vm; debugger_thread_param.cpu_index = cpu_index; debugger_thread_param.request_terminate = false; -#ifdef _WIN32 +#ifdef _MSC_VER if((hDebuggerThread = (HANDLE)_beginthreadex(NULL, 0, debugger_thread, &debugger_thread_param, 0, NULL)) != (HANDLE)0) { #elif !defined(_USE_QT) if((debugger_thread_id = SDL_CreateThread(debugger_thread, "DebuggerThread", (void *)&debugger_thread_param)) != 0) { @@ -1000,7 +1000,7 @@ void EMU::close_debugger() if(debugger_thread_param.running) { debugger_thread_param.request_terminate = true; } -#ifdef _WIN32 +#ifdef _MSC_VER WaitForSingleObject(hDebuggerThread, INFINITE); CloseHandle(hDebuggerThread); #elif !defined(_USE_QT) diff --git a/source/src/vm/datarec.cpp b/source/src/vm/datarec.cpp index 288d06602..4fbe4cbda 100644 --- a/source/src/vm/datarec.cpp +++ b/source/src/vm/datarec.cpp @@ -1454,7 +1454,7 @@ void DATAREC::save_state(FILEIO* state_fio) state_fio->FputInt32(length_tmp); while(length_tmp != 0) { uint8 buffer_tmp[1024]; - int length_rw = min(length_tmp, sizeof(buffer_tmp)); + int length_rw = min(length_tmp, (int)sizeof(buffer_tmp)); rec_fio->Fread(buffer_tmp, length_rw, 1); state_fio->Fwrite(buffer_tmp, length_rw, 1); length_tmp -= length_rw; @@ -1532,7 +1532,7 @@ bool DATAREC::load_state(FILEIO* state_fio) rec_fio->Fopen(rec_file_path, FILEIO_READ_WRITE_NEW_BINARY); while(length_tmp != 0) { uint8 buffer_tmp[1024]; - int length_rw = min(length_tmp, sizeof(buffer_tmp)); + int length_rw = min(length_tmp, (int)sizeof(buffer_tmp)); state_fio->Fread(buffer_tmp, length_rw, 1); if(rec_fio->IsOpened()) { rec_fio->Fwrite(buffer_tmp, length_rw, 1); -- 2.11.0