From 78ecb35e3cdb4b54ea2327aca8e9aa96acfd86e7 Mon Sep 17 00:00:00 2001 From: Vincent Herbet Date: Sun, 20 Oct 2019 23:21:57 +0200 Subject: [PATCH] Fix behavior change about endianness check in maxmind/libmaxminddb#123 (#770) --- modules/geoip/AMBuilder | 3 ++- modules/geoip/msvc12/geoip.vcxproj | 4 ++-- third_party/libmaxminddb/maxminddb_config.h | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/geoip/AMBuilder b/modules/geoip/AMBuilder index 2e79c52e..ab1991f3 100644 --- a/modules/geoip/AMBuilder +++ b/modules/geoip/AMBuilder @@ -3,7 +3,8 @@ import os.path binary = AMXX.MetaModule(builder, 'geoip') -binary.compiler.cxxincludes += [ +binary.compiler.includes += [ + os.path.join(builder.currentSourcePath, '..', '..', 'amxmodx'), os.path.join(builder.currentSourcePath, '..', '..', 'third_party', 'libmaxminddb') ] diff --git a/modules/geoip/msvc12/geoip.vcxproj b/modules/geoip/msvc12/geoip.vcxproj index b86a84f5..67b3f824 100644 --- a/modules/geoip/msvc12/geoip.vcxproj +++ b/modules/geoip/msvc12/geoip.vcxproj @@ -54,7 +54,7 @@ Disabled - ..\;..\sdk;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\sdk;..\..\..\amxmodx;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -80,7 +80,7 @@ - ..\;..\sdk;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) + ..\;..\sdk;..\..\..\amxmodx;..\..\..\public;..\..\..\public\amtl;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false diff --git a/third_party/libmaxminddb/maxminddb_config.h b/third_party/libmaxminddb/maxminddb_config.h index 1a5c62dc..af911862 100644 --- a/third_party/libmaxminddb/maxminddb_config.h +++ b/third_party/libmaxminddb/maxminddb_config.h @@ -1,6 +1,13 @@ #ifndef MAXMINDDB_CONFIG_H #define MAXMINDDB_CONFIG_H +#include // BYTE_ORDER, LITTLE_ENDIAN + +/* This fixes a behavior change in after https://github.com/maxmind/libmaxminddb/pull/123. */ +#if defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN + #define MMDB_LITTLE_ENDIAN 1 +#endif + #ifndef MMDB_UINT128_USING_MODE /* Define as 1 if we we use unsigned int __atribute__ ((__mode__(TI))) for uint128 values */ #define MMDB_UINT128_USING_MODE 0