From 7eaa819fb722838b0b981f2bc505726c5ee05348 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Mon, 23 Apr 2018 17:53:02 +0200 Subject: [PATCH] D3D9: fix compilation with MinGW --- OgreMain/include/WIN32/OgreMinGWSupport.h | 3 +-- OgreMain/src/WIN32/OgreMinGWSupport.cpp | 4 +--- RenderSystems/Direct3D9/src/OgreD3D9Plugin.cpp | 1 - RenderSystems/Direct3D9/src/OgreDxErr.cpp | 9 ++++++++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/OgreMain/include/WIN32/OgreMinGWSupport.h b/OgreMain/include/WIN32/OgreMinGWSupport.h index 94809412cd9..0d703ca7cb7 100644 --- a/OgreMain/include/WIN32/OgreMinGWSupport.h +++ b/OgreMain/include/WIN32/OgreMinGWSupport.h @@ -43,8 +43,7 @@ THE SOFTWARE. # define __in #endif #define UINT8 uint8_t -#define WINAPI_INLINE inline -#ifndef __uuidof(Object) +#ifndef __uuidof # define __uuidof(Object) IID_##Object #endif diff --git a/OgreMain/src/WIN32/OgreMinGWSupport.cpp b/OgreMain/src/WIN32/OgreMinGWSupport.cpp index e15bb6a1453..e4b181e2f37 100644 --- a/OgreMain/src/WIN32/OgreMinGWSupport.cpp +++ b/OgreMain/src/WIN32/OgreMinGWSupport.cpp @@ -43,9 +43,7 @@ extern "C" { // MSVC uses security cookies to prevent some buffer overflow attacks. // provide dummy implementations. - intptr_t __security_cookie; - - void _fastcall __security_check_cookie(intptr_t i) + void __security_check_cookie(intptr_t i) { } } diff --git a/RenderSystems/Direct3D9/src/OgreD3D9Plugin.cpp b/RenderSystems/Direct3D9/src/OgreD3D9Plugin.cpp index ca7e873dc67..a51f438edbe 100644 --- a/RenderSystems/Direct3D9/src/OgreD3D9Plugin.cpp +++ b/RenderSystems/Direct3D9/src/OgreD3D9Plugin.cpp @@ -33,7 +33,6 @@ THE SOFTWARE. extern "C" { #include "WIN32/OgreMinGWSupport.h" void _chkstk(); -void _fastcall __security_check_cookie(intptr_t i); } #endif diff --git a/RenderSystems/Direct3D9/src/OgreDxErr.cpp b/RenderSystems/Direct3D9/src/OgreDxErr.cpp index b4e641c7faf..6d61e0ca121 100644 --- a/RenderSystems/Direct3D9/src/OgreDxErr.cpp +++ b/RenderSystems/Direct3D9/src/OgreDxErr.cpp @@ -65,11 +65,14 @@ A "contributor" is any person that distributes its contribution under this licen // This version only supports UNICODE. +#include "OgrePrerequisites.h" + #if !defined(NOMINMAX) #define NOMINMAX #endif #include +#ifndef __MINGW32__ #pragma warning( disable : 4005 ) // warning C4005: 'xxx': macro redefinition #include @@ -4025,11 +4028,12 @@ HRESULT WINAPI DXTraceW( _In_z_ const WCHAR* strFile, _In_ DWORD dwLine, _In_ HR return hr; } - +#endif namespace Ogre { String DXGetErrorDescription(HRESULT hr) { +#ifndef __MINGW32__ WCHAR wideBuf[1024]; wideBuf[0] = 0; DXGetErrorDescriptionW(hr, wideBuf, ARRAYSIZE(wideBuf)); @@ -4040,5 +4044,8 @@ namespace Ogre narrowBuf[0] = 0; return String(narrowBuf); +#else + return ""; +#endif } }