From 1dc4957fdf91d9bc895592c64c54c8aff78d0718 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Thu, 6 Jan 2011 21:33:14 +0000 Subject: [PATCH] Fix builds without GeoIP --- .svn-revision | 2 +- src/IP2Country.cpp | 36 +++++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.svn-revision b/.svn-revision index a37a802a..2af2a5d6 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10424 +10425 diff --git a/src/IP2Country.cpp b/src/IP2Country.cpp index 25d0bdaa..f054c570 100644 --- a/src/IP2Country.cpp +++ b/src/IP2Country.cpp @@ -44,6 +44,16 @@ # include "config.h" // Needed for ENABLE_IP2COUNTRY #endif +#ifdef _MSC_VER +// For MSVC we need to check here if geoip is available at all. MinGW needs the include below however. + +// Block unnecessary includes from GeoIP.h +#define _WINDOWS_ +#define _WINSOCK2API_ +#define _WS2TCPIP_H_ +#include +#endif + #ifdef ENABLE_IP2COUNTRY #include "Preferences.h" // For thePrefs @@ -58,13 +68,6 @@ #include #include -#ifdef _MSC_VER -// Block unnecessary includes from GeoIP.h -#define _WINDOWS_ -#define _WINSOCK2API_ -#define _WS2TCPIP_H_ -#endif - #include #include "IP2Country.h" @@ -206,4 +209,23 @@ const CountryData& CIP2Country::GetCountryData(const wxString &ip) return it->second; } +#else + +#include "IP2Country.h" + +CIP2Country::CIP2Country(const wxString&) +{ + m_geoip = NULL; +} + +CIP2Country::~CIP2Country() {} +void CIP2Country::Enable() {} +void CIP2Country::DownloadFinished(uint32) {} + +const CountryData& CIP2Country::GetCountryData(const wxString &) +{ + static CountryData dummy; + return dummy; +} + #endif // ENABLE_IP2COUNTRY -- 2.11.4.GIT