From e92b27b8ca219d57a9ba689a8a2b4cb32fdb8896 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Sun, 22 Jan 2017 14:08:31 +0100 Subject: plugins: Fix visibility for plugins compiled with MinGW --- plugins/mumble_plugin.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mumble_plugin.h b/plugins/mumble_plugin.h index e7175d780..eb51695cd 100644 --- a/plugins/mumble_plugin.h +++ b/plugins/mumble_plugin.h @@ -11,14 +11,18 @@ #if defined(_MSC_VER) # define MUMBLE_PLUGIN_CALLING_CONVENTION __cdecl +#elif defined(__MINGW32__) +# define MUMBLE_PLUGIN_CALLING_CONVENTION __attribute__((cdecl)) #else # define MUMBLE_PLUGIN_CALLING_CONVENTION #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(__MINGW32__) // GCC on Unix-like systems # define MUMBLE_PLUGIN_EXPORT __attribute__((visibility("default"))) #elif defined(_MSC_VER) # define MUMBLE_PLUGIN_EXPORT __declspec(dllexport) +#elif defined(__MINGW32__) +# define MUMBLE_PLUGIN_EXPORT __attribute__((dllexport)) #else # error No MUMBLE_PLUGIN_EXPORT definition available #endif -- cgit v1.2.3 From 6096b74a1c42cfeaca9cde5df76a21fc3174f167 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Sun, 22 Jan 2017 16:00:49 +0100 Subject: plugins: Fix MinGW compilation warnings and errors warning: converting to non-pointer type 'procptr32_t {aka long unsigned int}' from NULL [-Wconversion-null] ql\ql.cpp:87: warning: comparison is always true due to limited range of data type [-Wtype-limits] sto\sto.cpp:11: error: 'numeric_limits' is not a member of 'std' Not fixed: sto\sto.cpp:55: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] --- plugins/aoc/aoc.cpp | 2 +- plugins/arma2/arma2.cpp | 2 +- plugins/bf1942/bf1942.cpp | 2 +- plugins/bf2/bf2.cpp | 2 +- plugins/bf2142/bf2142.cpp | 2 +- plugins/bf3/bf3.cpp | 2 +- plugins/bfheroes/bfheroes.cpp | 2 +- plugins/blacklight/blacklight.cpp | 2 +- plugins/borderlands/borderlands.cpp | 2 +- plugins/breach/breach.cpp | 2 +- plugins/dys/dys.cpp | 2 +- plugins/etqw/etqw.cpp | 2 +- plugins/gmod/gmod.cpp | 2 +- plugins/gw/gw.cpp | 2 +- plugins/insurgency/insurgency.cpp | 2 +- plugins/lol/lol.cpp | 2 +- plugins/mumble_plugin_win32_ptr_type.h | 8 ++++---- plugins/ql/ql.cpp | 2 +- plugins/sto/sto.cpp | 5 +++-- plugins/ut2004/ut2004.cpp | 2 +- plugins/ut3/ut3.cpp | 2 +- 21 files changed, 26 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/plugins/aoc/aoc.cpp b/plugins/aoc/aoc.cpp index 2d254c748..a0d8539f6 100644 --- a/plugins/aoc/aoc.cpp +++ b/plugins/aoc/aoc.cpp @@ -92,7 +92,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = rotptr = NULL; + posptr = rotptr = 0; if (! initialize(pids, L"hl2.exe", L"client.dll")) return false; diff --git a/plugins/arma2/arma2.cpp b/plugins/arma2/arma2.cpp index 0f34f0daf..e18566d30 100644 --- a/plugins/arma2/arma2.cpp +++ b/plugins/arma2/arma2.cpp @@ -74,7 +74,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = NULL; + posptr = 0; if (! initialize(pids, L"arma2.exe")) return false; diff --git a/plugins/bf1942/bf1942.cpp b/plugins/bf1942/bf1942.cpp index 664da64b2..298f9fd7e 100644 --- a/plugins/bf1942/bf1942.cpp +++ b/plugins/bf1942/bf1942.cpp @@ -51,7 +51,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - faceptr = topptr = NULL; + faceptr = topptr = 0; if (! initialize(pids, L"BF1942.exe")) return false; diff --git a/plugins/bf2/bf2.cpp b/plugins/bf2/bf2.cpp index 411f37900..d31c43291 100644 --- a/plugins/bf2/bf2.cpp +++ b/plugins/bf2/bf2.cpp @@ -26,7 +26,7 @@ procptr32_t const ipport_ptr = 0x009A80B8; procptr32_t commander_ptr, squad_leader_ptr, squad_state_ptr, team_state_ptr; inline bool resolve_ptrs() { - pos_ptr = face_ptr = top_ptr = commander_ptr = squad_leader_ptr = squad_state_ptr = team_state_ptr = NULL; + pos_ptr = face_ptr = top_ptr = commander_ptr = squad_leader_ptr = squad_state_ptr = team_state_ptr = 0; // // Resolve all pointer chains to the values we want to fetch // diff --git a/plugins/bf2142/bf2142.cpp b/plugins/bf2142/bf2142.cpp index ad5515e51..b8ef34acf 100644 --- a/plugins/bf2142/bf2142.cpp +++ b/plugins/bf2142/bf2142.cpp @@ -61,7 +61,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = faceptr = topptr = NULL; + posptr = faceptr = topptr = 0; if (! initialize(pids, L"BF2142.exe", L"BF2142Audio.dll")) return false; diff --git a/plugins/bf3/bf3.cpp b/plugins/bf3/bf3.cpp index 015ad3213..6904628fc 100644 --- a/plugins/bf3/bf3.cpp +++ b/plugins/bf3/bf3.cpp @@ -71,7 +71,7 @@ enum state_values { }; inline bool resolve_ptrs() { - team_state_ptr = squad_state_ptr = squad_lead_state_ptr = NULL; + team_state_ptr = squad_state_ptr = squad_lead_state_ptr = 0; /* Analysis for future patches: diff --git a/plugins/bfheroes/bfheroes.cpp b/plugins/bfheroes/bfheroes.cpp index ed10fc426..4c888037b 100644 --- a/plugins/bfheroes/bfheroes.cpp +++ b/plugins/bfheroes/bfheroes.cpp @@ -46,7 +46,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = faceptr = topptr = NULL; + posptr = faceptr = topptr = 0; if (! initialize(pids, L"BFHeroes.exe", L"BFAudio.dll")) return false; diff --git a/plugins/blacklight/blacklight.cpp b/plugins/blacklight/blacklight.cpp index d5cfedfef..9db80002a 100644 --- a/plugins/blacklight/blacklight.cpp +++ b/plugins/blacklight/blacklight.cpp @@ -75,7 +75,7 @@ static bool calcout(float *cam, float *camfront, float *camtop, float *ocam, flo } static bool refreshPointers(void) { - hostipportptr = NULL; + hostipportptr = 0; hostipportptr = pModule + 0xB8C57; diff --git a/plugins/borderlands/borderlands.cpp b/plugins/borderlands/borderlands.cpp index 99ae40b50..06aa7b317 100644 --- a/plugins/borderlands/borderlands.cpp +++ b/plugins/borderlands/borderlands.cpp @@ -127,7 +127,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = frontptr = topptr = contextptraddress = stateaddress = loginaddress = NULL; + posptr = frontptr = topptr = contextptraddress = stateaddress = loginaddress = 0; if (!initialize(pids, L"Borderlands.exe")) return false; diff --git a/plugins/breach/breach.cpp b/plugins/breach/breach.cpp index 5386579f8..7fc8e1de5 100644 --- a/plugins/breach/breach.cpp +++ b/plugins/breach/breach.cpp @@ -75,7 +75,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = frontptr = topptr = NULL; + posptr = frontptr = topptr = 0; if (! initialize(pids, L"Breach.exe", L"fmodex.dll")) return false; diff --git a/plugins/dys/dys.cpp b/plugins/dys/dys.cpp index bab7e2b9f..2a2202064 100644 --- a/plugins/dys/dys.cpp +++ b/plugins/dys/dys.cpp @@ -92,7 +92,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = rotptr = NULL; + posptr = rotptr = 0; if (! initialize(pids, L"hl2.exe", L"client.dll")) return false; diff --git a/plugins/etqw/etqw.cpp b/plugins/etqw/etqw.cpp index 970a1e7ec..f80549c72 100644 --- a/plugins/etqw/etqw.cpp +++ b/plugins/etqw/etqw.cpp @@ -95,7 +95,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - pos1ptr = pos2ptr = pos3ptr = rot1ptr = rot2ptr = NULL; + pos1ptr = pos2ptr = pos3ptr = rot1ptr = rot2ptr = 0; if (! initialize(pids, L"etqw.exe", L"gamex86.dll")) return false; diff --git a/plugins/gmod/gmod.cpp b/plugins/gmod/gmod.cpp index c5cd8ce32..0b47f450d 100644 --- a/plugins/gmod/gmod.cpp +++ b/plugins/gmod/gmod.cpp @@ -86,7 +86,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = rotptr = NULL; + posptr = rotptr = 0; if (! initialize(pids, L"hl2.exe", L"client.dll")) return false; diff --git a/plugins/gw/gw.cpp b/plugins/gw/gw.cpp index e5d1c70ee..315c74cab 100644 --- a/plugins/gw/gw.cpp +++ b/plugins/gw/gw.cpp @@ -112,7 +112,7 @@ static bool calcout(float *pos, float *front, float *cam, float *camfront, float static bool refreshPointers(void) { - frontptr = NULL; + frontptr = 0; frontptr = peekProc(frontptr_); if (!frontptr) diff --git a/plugins/insurgency/insurgency.cpp b/plugins/insurgency/insurgency.cpp index 2bf72c44e..37a041f6f 100644 --- a/plugins/insurgency/insurgency.cpp +++ b/plugins/insurgency/insurgency.cpp @@ -92,7 +92,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - posptr = rotptr = NULL; + posptr = rotptr = 0; if (! initialize(pids, L"hl2.exe", L"client.dll")) return false; diff --git a/plugins/lol/lol.cpp b/plugins/lol/lol.cpp index 9a7443bca..fde38c8d5 100644 --- a/plugins/lol/lol.cpp +++ b/plugins/lol/lol.cpp @@ -81,7 +81,7 @@ static bool calcout(float *pos, float *cam, float *opos, float *ocam) { } static bool refreshPointers(void) { - posptr = afrontptr = tmpptr = NULL; + posptr = afrontptr = tmpptr = 0; // Avatar front vector pointer tmpptr = peekProc(gameptr); diff --git a/plugins/mumble_plugin_win32_ptr_type.h b/plugins/mumble_plugin_win32_ptr_type.h index d9f042156..555b1314f 100644 --- a/plugins/mumble_plugin_win32_ptr_type.h +++ b/plugins/mumble_plugin_win32_ptr_type.h @@ -50,7 +50,7 @@ static inline DWORD getProcess(const wchar_t *exename) { static inline PTR_TYPE_CONCRETE getModuleAddr(DWORD pid, const wchar_t *modname) { MODULEENTRY32 me; - PTR_TYPE_CONCRETE ret = NULL; + PTR_TYPE_CONCRETE ret = 0; me.dwSize = sizeof(me); HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE|TH32CS_SNAPMODULE32, pid); if (hSnap != INVALID_HANDLE_VALUE) { @@ -97,7 +97,7 @@ T peekProc(PTR_TYPE base) { static bool inline initialize(const std::multimap &pids, const wchar_t *procname, const wchar_t *modname = NULL) { hProcess = NULL; - pModule = NULL; + pModule = 0; if (! pids.empty()) { std::multimap::const_iterator iter = pids.find(std::wstring(procname)); @@ -122,7 +122,7 @@ static bool inline initialize(const std::multimap= 0 && team <= 3) { + if (team <= 3) { if (team == 0) oidentity << std::endl << "\"Team\": \"FFA\""; // If team value is 0, set "FFA" as team in identity. if (team == 1) diff --git a/plugins/sto/sto.cpp b/plugins/sto/sto.cpp index 1da2069f0..e8c929d90 100644 --- a/plugins/sto/sto.cpp +++ b/plugins/sto/sto.cpp @@ -3,7 +3,8 @@ // that can be found in the LICENSE file at the root of the // Mumble source tree or at . -#include "../mumble_plugin_win32_32bit.h" +#include "../mumble_plugin_win32_32bit.h" // Include standard plugin header. +#include // Include limits header for the "u8" function. static procptr32_t identptr, contextptr, posptr; @@ -70,7 +71,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - identptr = contextptr = posptr = NULL; + identptr = contextptr = posptr = 0; if (! initialize(pids, L"GameClient.exe")) return false; diff --git a/plugins/ut2004/ut2004.cpp b/plugins/ut2004/ut2004.cpp index 092c81fc9..9bc88bd7f 100644 --- a/plugins/ut2004/ut2004.cpp +++ b/plugins/ut2004/ut2004.cpp @@ -62,7 +62,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - pos0ptr = pos1ptr = pos2ptr = faceptr = topptr = NULL; + pos0ptr = pos1ptr = pos2ptr = faceptr = topptr = 0; if (! initialize(pids, L"UT2004.exe", L"Engine.dll")) return false; diff --git a/plugins/ut3/ut3.cpp b/plugins/ut3/ut3.cpp index e25dd64cc..a0e28c8db 100644 --- a/plugins/ut3/ut3.cpp +++ b/plugins/ut3/ut3.cpp @@ -85,7 +85,7 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa } static int trylock(const std::multimap &pids) { - pos0ptr = pos1ptr = pos2ptr = faceptr = NULL; + pos0ptr = pos1ptr = pos2ptr = faceptr = 0; if (! initialize(pids, L"UT3.exe", L"wrap_oal.dll")) return false; -- cgit v1.2.3