From 9d3364f4da3fe77113147d9350c0e8c8c7f7a637 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 16 May 2015 18:44:07 +0200 Subject: fixes to make MO compile with mingw (also fixes some warnings generated by mingw) --- src/shared/appconfig.cpp | 2 +- src/shared/shared.pro | 12 +++++++----- src/shared/stackdata.cpp | 2 ++ src/shared/util.cpp | 8 +++----- 4 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/shared') diff --git a/src/shared/appconfig.cpp b/src/shared/appconfig.cpp index f1bad828..49edcbcc 100644 --- a/src/shared/appconfig.cpp +++ b/src/shared/appconfig.cpp @@ -22,7 +22,7 @@ along with Mod Organizer. If not, see . namespace AppConfig { #define PARWSTRING wstring -#define APPPARAM(partype, parid, value) partype parid ## () { return value; } +#define APPPARAM(partype, parid, value) partype parid () { return value; } #include "appconfig.inc" namespace MOShared { diff --git a/src/shared/shared.pro b/src/shared/shared.pro index 646c2c3e..a64e781d 100644 --- a/src/shared/shared.pro +++ b/src/shared/shared.pro @@ -9,7 +9,7 @@ QT -= gui core TARGET = mo_shared TEMPLATE = lib -CONFIG += staticlib +CONFIG += staticlib c++11 !include(../LocalPaths.pri) { @@ -52,18 +52,20 @@ HEADERS += \ #DEFINES += TRACE_LEAKS #LIBS += -lDbgHelp +msvc:QMAKE_CXXFLAGS_DEBUG -= -Zi +msvc:QMAKE_CXXFLAGS_DEBUG += -Z7 CONFIG(debug, debug|release) { LIBS += -L$$OUT_PWD/../bsatk/debug LIBS += -lDbgHelp - QMAKE_CXXFLAGS_DEBUG -= -Zi - QMAKE_CXXFLAGS += -Z7 - PRE_TARGETDEPS += $$OUT_PWD/../bsatk/debug/bsatk.lib + msvc:PRE_TARGETDEPS += $$OUT_PWD/../bsatk/debug/bsatk.lib } else { LIBS += -L$$OUT_PWD/../bsatk/release - PRE_TARGETDEPS += $$OUT_PWD/../bsatk/release/bsatk.lib + msvc:PRE_TARGETDEPS += $$OUT_PWD/../bsatk/release/bsatk.lib } +gcc:QMAKE_CXXFLAGS += -Wno-unknown-pragmas -march=i686 -fno-tree-vectorize + LIBS += -lbsatk DEFINES += UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS diff --git a/src/shared/stackdata.cpp b/src/shared/stackdata.cpp index 43acd90a..4450756d 100644 --- a/src/shared/stackdata.cpp +++ b/src/shared/stackdata.cpp @@ -11,6 +11,7 @@ using namespace MOShared; +#ifdef _MSC_VER static void initDbgIfNecess() { @@ -162,3 +163,4 @@ bool MOShared::operator<(const StackData &LHS, const StackData &RHS) { } return false; } +#endif diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 75d80d83..e5bcd436 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -135,24 +135,22 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName) throw windows_error("failed to determine file version info size"); } - void *buffer = new char[size]; + boost::scoped_array buffer(new char[size]); try { handle = 0UL; - if (!::GetFileVersionInfoW(fileName.c_str(), handle, size, buffer)) { + if (!::GetFileVersionInfoW(fileName.c_str(), handle, size, buffer.get())) { throw windows_error("failed to determine file version info"); } void *versionInfoPtr = nullptr; UINT versionInfoLength = 0; - if (!::VerQueryValue(buffer, L"\\", &versionInfoPtr, &versionInfoLength)) { + if (!::VerQueryValue(buffer.get(), L"\\", &versionInfoPtr, &versionInfoLength)) { throw windows_error("failed to determine file version"); } VS_FIXEDFILEINFO result = *(VS_FIXEDFILEINFO*)versionInfoPtr; - delete [] buffer; return result; } catch (...) { - delete [] buffer; throw; } } -- cgit v1.3.1