From 4f0a903ce93904000540d2788de00ae9a8024206 Mon Sep 17 00:00:00 2001 From: "Brigham Keys, Esq" Date: Wed, 24 Aug 2016 02:42:10 -0400 Subject: [PATCH] Fixed compiler errors involving MingGW, someone should test it out on VS but MinGW is free software so we should prioritize it over VS --- .gitignore | 1 + cAudio/include/cAudioString.h | 8 ++++++++ cAudio/src/cThread.cpp | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index af7d0ca..c358fa4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ +build/ # / /cAudio.ncb /cAudio.suo diff --git a/cAudio/include/cAudioString.h b/cAudio/include/cAudioString.h index f70d2f0..3a85976 100644 --- a/cAudio/include/cAudioString.h +++ b/cAudio/include/cAudioString.h @@ -50,7 +50,11 @@ namespace cAudio static char buffer[8][1024]; id = ++id & 0x7; +#ifdef CAUDIO_PLATFORM_WIN + int buff_size = WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast(str.c_str()), (int)(str.size() < 1023 ? str.size() : 1023), buffer[id], 1023, 0, reinterpret_cast(false)); +#else int buff_size = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)(str.size() < 1023 ? str.size() : 1023), buffer[id], 1023, 0, false); +#endif buffer[id][buff_size] = 0; buffer[id][1023] = 0; return buffer[id]; @@ -61,7 +65,11 @@ namespace cAudio int str_len = (int)strlen(str); int buf_size = MultiByteToWideChar(CP_UTF8, 0, str, str_len, 0, 0); cAudioString s(buf_size, L'\0'); +#ifdef CAUDIO_PLATFORM_WIN + MultiByteToWideChar(CP_UTF8, 0, str, str_len, reinterpret_cast(s[0]), buf_size); +#else MultiByteToWideChar(CP_UTF8, 0, str, str_len, &s[0], buf_size); +#endif return s; } diff --git a/cAudio/src/cThread.cpp b/cAudio/src/cThread.cpp index ca27639..e91140b 100644 --- a/cAudio/src/cThread.cpp +++ b/cAudio/src/cThread.cpp @@ -4,6 +4,9 @@ #include "cThread.h" #include "cAudioSleep.h" +#ifdef CAUDIO_PLATFORM_WIN +#include +#endif namespace cAudio { @@ -99,11 +102,21 @@ namespace cAudio info.dwThreadID = dwThreadID; info.dwFlags = 0; - __try +#ifdef CAUDIO_PLATFORM_WIN + try +#else + __try +#endif + { RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); } +#ifdef CAUDIO_PLATFORM_WIN + catch (bool b) +#else __except (EXCEPTION_EXECUTE_HANDLER) +#endif + { } }