geoip2_c 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/geoip2/libmaxminddb/.gitignore +35 -0
  3. data/ext/geoip2/libmaxminddb/.gitmodules +9 -0
  4. data/ext/geoip2/libmaxminddb/.perltidyrc +11 -0
  5. data/ext/geoip2/libmaxminddb/.travis.yml +48 -0
  6. data/ext/geoip2/libmaxminddb/.uncrustify.cfg +78 -0
  7. data/ext/geoip2/libmaxminddb/AUTHORS +0 -0
  8. data/ext/geoip2/libmaxminddb/Changes.md +238 -0
  9. data/ext/geoip2/libmaxminddb/LICENSE +202 -0
  10. data/ext/geoip2/libmaxminddb/Makefile.am +41 -0
  11. data/ext/geoip2/libmaxminddb/NOTICE +13 -0
  12. data/ext/geoip2/libmaxminddb/README.dev.md +58 -0
  13. data/ext/geoip2/libmaxminddb/README.md +122 -0
  14. data/ext/geoip2/libmaxminddb/appveyor.yml +33 -0
  15. data/ext/geoip2/libmaxminddb/bin/Makefile.am +5 -0
  16. data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +397 -0
  17. data/ext/geoip2/libmaxminddb/bootstrap +21 -0
  18. data/ext/geoip2/libmaxminddb/common.mk +7 -0
  19. data/ext/geoip2/libmaxminddb/configure.ac +132 -0
  20. data/ext/geoip2/libmaxminddb/dev-bin/make-man-pages.pl +76 -0
  21. data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +50 -0
  22. data/ext/geoip2/libmaxminddb/dev-bin/regen-prototypes.pl +136 -0
  23. data/ext/geoip2/libmaxminddb/dev-bin/regen-win32-test-projs.pl +54 -0
  24. data/ext/geoip2/libmaxminddb/dev-bin/release.sh +106 -0
  25. data/ext/geoip2/libmaxminddb/dev-bin/uncrustify-all.sh +21 -0
  26. data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +46 -0
  27. data/ext/geoip2/libmaxminddb/doc/libmaxminddb.md +889 -0
  28. data/ext/geoip2/libmaxminddb/doc/mmdblookup.md +103 -0
  29. data/ext/geoip2/libmaxminddb/include/maxminddb.h +232 -0
  30. data/ext/geoip2/libmaxminddb/include/maxminddb_config.h.in +14 -0
  31. data/ext/geoip2/libmaxminddb/projects/VS12/README.md +59 -0
  32. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-release.props +32 -0
  33. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-x64.props +14 -0
  34. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.props +32 -0
  35. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.sln +150 -0
  36. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +141 -0
  37. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +26 -0
  38. data/ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h +14 -0
  39. data/ext/geoip2/libmaxminddb/projects/VS12-tests/bad_pointers.vcxproj +105 -0
  40. data/ext/geoip2/libmaxminddb/projects/VS12-tests/basic_lookup.vcxproj +105 -0
  41. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_entry_list.vcxproj +105 -0
  42. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_types.vcxproj +105 -0
  43. data/ext/geoip2/libmaxminddb/projects/VS12-tests/dump.vcxproj +105 -0
  44. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value.vcxproj +105 -0
  45. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value_pointer_bug.vcxproj +105 -0
  46. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv4_start_cache.vcxproj +105 -0
  47. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv6_lookup_in_ipv4.vcxproj +105 -0
  48. data/ext/geoip2/libmaxminddb/projects/VS12-tests/libtap.vcxproj +85 -0
  49. data/ext/geoip2/libmaxminddb/projects/VS12-tests/maxminddb_test_helper.vcxproj +107 -0
  50. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata.vcxproj +105 -0
  51. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata_pointers.vcxproj +105 -0
  52. data/ext/geoip2/libmaxminddb/projects/VS12-tests/no_map_get_value.vcxproj +105 -0
  53. data/ext/geoip2/libmaxminddb/projects/VS12-tests/read_node.vcxproj +105 -0
  54. data/ext/geoip2/libmaxminddb/projects/VS12-tests/shared.vcxproj +104 -0
  55. data/ext/geoip2/libmaxminddb/projects/VS12-tests/threads.vcxproj +103 -0
  56. data/ext/geoip2/libmaxminddb/projects/VS12-tests/version.vcxproj +105 -0
  57. data/ext/geoip2/libmaxminddb/projects/test.vcxproj.template +105 -0
  58. data/ext/geoip2/libmaxminddb/src/Makefile.am +9 -0
  59. data/ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in +11 -0
  60. data/ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h +167 -0
  61. data/ext/geoip2/libmaxminddb/src/maxminddb.c +2171 -0
  62. data/ext/geoip2/libmaxminddb/t/Makefile.am +23 -0
  63. data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +66 -0
  64. data/ext/geoip2/libmaxminddb/t/bad_pointers_t.c +53 -0
  65. data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +172 -0
  66. data/ext/geoip2/libmaxminddb/t/compile_c++_t.pl +107 -0
  67. data/ext/geoip2/libmaxminddb/t/data_entry_list_t.c +353 -0
  68. data/ext/geoip2/libmaxminddb/t/data_types_t.c +439 -0
  69. data/ext/geoip2/libmaxminddb/t/dump_t.c +103 -0
  70. data/ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c +66 -0
  71. data/ext/geoip2/libmaxminddb/t/get_value_t.c +249 -0
  72. data/ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c +36 -0
  73. data/ext/geoip2/libmaxminddb/t/ipv6_lookup_in_ipv4_t.c +48 -0
  74. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.c +255 -0
  75. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.h +69 -0
  76. data/ext/geoip2/libmaxminddb/t/metadata_pointers_t.c +32 -0
  77. data/ext/geoip2/libmaxminddb/t/metadata_t.c +226 -0
  78. data/ext/geoip2/libmaxminddb/t/mmdblookup_t.pl +158 -0
  79. data/ext/geoip2/libmaxminddb/t/no_map_get_value_t.c +32 -0
  80. data/ext/geoip2/libmaxminddb/t/read_node_t.c +157 -0
  81. data/ext/geoip2/libmaxminddb/t/threads_t.c +196 -0
  82. data/ext/geoip2/libmaxminddb/t/version_t.c +10 -0
  83. data/geoip2_c.gemspec +1 -1
  84. data/lib/geoip2/version.rb +1 -1
  85. metadata +82 -1
@@ -0,0 +1,103 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{8E11E9FC-7B63-11E4-AE98-6B41E8A9DDB2}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>threads</RootNamespace>
17
+ <ProjectName>test_threads</ProjectName>
18
+ </PropertyGroup>
19
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
21
+ <ConfigurationType>Application</ConfigurationType>
22
+ <UseDebugLibraries>true</UseDebugLibraries>
23
+ <PlatformToolset>v120</PlatformToolset>
24
+ <CharacterSet>Unicode</CharacterSet>
25
+ </PropertyGroup>
26
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
27
+ <ConfigurationType>Application</ConfigurationType>
28
+ <UseDebugLibraries>false</UseDebugLibraries>
29
+ <PlatformToolset>v120</PlatformToolset>
30
+ <WholeProgramOptimization>true</WholeProgramOptimization>
31
+ <CharacterSet>Unicode</CharacterSet>
32
+ </PropertyGroup>
33
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
34
+ <ImportGroup Label="ExtensionSettings">
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
40
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41
+ </ImportGroup>
42
+ <PropertyGroup Label="UserMacros" />
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
44
+ <LinkIncremental>true</LinkIncremental>
45
+ </PropertyGroup>
46
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
47
+ <LinkIncremental>false</LinkIncremental>
48
+ </PropertyGroup>
49
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
50
+ <ClCompile>
51
+ <PrecompiledHeader>
52
+ </PrecompiledHeader>
53
+ <WarningLevel>Level3</WarningLevel>
54
+ <Optimization>Disabled</Optimization>
55
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
57
+ </ClCompile>
58
+ <Link>
59
+ <SubSystem>Console</SubSystem>
60
+ <GenerateDebugInformation>true</GenerateDebugInformation>
61
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
62
+ </Link>
63
+ </ItemDefinitionGroup>
64
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
65
+ <ClCompile>
66
+ <WarningLevel>Level3</WarningLevel>
67
+ <PrecompiledHeader>
68
+ </PrecompiledHeader>
69
+ <Optimization>MaxSpeed</Optimization>
70
+ <FunctionLevelLinking>true</FunctionLevelLinking>
71
+ <IntrinsicFunctions>true</IntrinsicFunctions>
72
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
73
+ </ClCompile>
74
+ <Link>
75
+ <SubSystem>Console</SubSystem>
76
+ <GenerateDebugInformation>true</GenerateDebugInformation>
77
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
78
+ <OptimizeReferences>true</OptimizeReferences>
79
+ </Link>
80
+ </ItemDefinitionGroup>
81
+ <ItemGroup>
82
+ <ClCompile Include="..\..\t\threads_t.c" />
83
+ </ItemGroup>
84
+ <ItemGroup>
85
+ <ProjectReference Include="libtap.vcxproj">
86
+ <Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
87
+ </ProjectReference>
88
+ <ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
89
+ <Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
90
+ </ProjectReference>
91
+ <ProjectReference Include="maxminddb_test_helper.vcxproj">
92
+ <Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
93
+ <Private>true</Private>
94
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
95
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
96
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
97
+ <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
98
+ </ProjectReference>
99
+ </ItemGroup>
100
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
101
+ <ImportGroup Label="ExtensionTargets">
102
+ </ImportGroup>
103
+ </Project>
@@ -0,0 +1,105 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{B19851FA-376C-11E7-A95B-48C58C130AD6}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>version</RootNamespace>
17
+ <ProjectName>test_version</ProjectName>
18
+ </PropertyGroup>
19
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
21
+ <ConfigurationType>Application</ConfigurationType>
22
+ <UseDebugLibraries>true</UseDebugLibraries>
23
+ <PlatformToolset>v120</PlatformToolset>
24
+ <CharacterSet>Unicode</CharacterSet>
25
+ </PropertyGroup>
26
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
27
+ <ConfigurationType>Application</ConfigurationType>
28
+ <UseDebugLibraries>false</UseDebugLibraries>
29
+ <PlatformToolset>v120</PlatformToolset>
30
+ <WholeProgramOptimization>true</WholeProgramOptimization>
31
+ <CharacterSet>Unicode</CharacterSet>
32
+ </PropertyGroup>
33
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
34
+ <ImportGroup Label="ExtensionSettings">
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
40
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41
+ </ImportGroup>
42
+ <PropertyGroup Label="UserMacros" />
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
44
+ <LinkIncremental>true</LinkIncremental>
45
+ <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
46
+ </PropertyGroup>
47
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
48
+ <LinkIncremental>false</LinkIncremental>
49
+ <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
50
+ </PropertyGroup>
51
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
52
+ <ClCompile>
53
+ <PrecompiledHeader>
54
+ </PrecompiledHeader>
55
+ <WarningLevel>Level3</WarningLevel>
56
+ <Optimization>Disabled</Optimization>
57
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
58
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
59
+ </ClCompile>
60
+ <Link>
61
+ <SubSystem>Console</SubSystem>
62
+ <GenerateDebugInformation>true</GenerateDebugInformation>
63
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
64
+ </Link>
65
+ </ItemDefinitionGroup>
66
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
67
+ <ClCompile>
68
+ <WarningLevel>Level3</WarningLevel>
69
+ <PrecompiledHeader>
70
+ </PrecompiledHeader>
71
+ <Optimization>MaxSpeed</Optimization>
72
+ <FunctionLevelLinking>true</FunctionLevelLinking>
73
+ <IntrinsicFunctions>true</IntrinsicFunctions>
74
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
75
+ </ClCompile>
76
+ <Link>
77
+ <SubSystem>Console</SubSystem>
78
+ <GenerateDebugInformation>true</GenerateDebugInformation>
79
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
80
+ <OptimizeReferences>true</OptimizeReferences>
81
+ </Link>
82
+ </ItemDefinitionGroup>
83
+ <ItemGroup>
84
+ <ClCompile Include="..\..\t\version_t.c" />
85
+ </ItemGroup>
86
+ <ItemGroup>
87
+ <ProjectReference Include="libtap.vcxproj">
88
+ <Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
89
+ </ProjectReference>
90
+ <ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
91
+ <Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
92
+ </ProjectReference>
93
+ <ProjectReference Include="maxminddb_test_helper.vcxproj">
94
+ <Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
95
+ <Private>true</Private>
96
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
97
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
98
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
99
+ <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
100
+ </ProjectReference>
101
+ </ItemGroup>
102
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
103
+ <ImportGroup Label="ExtensionTargets">
104
+ </ImportGroup>
105
+ </Project>
@@ -0,0 +1,105 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{%UUID%}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>%TESTNAME%</RootNamespace>
17
+ <ProjectName>test_%TESTNAME%</ProjectName>
18
+ </PropertyGroup>
19
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
21
+ <ConfigurationType>Application</ConfigurationType>
22
+ <UseDebugLibraries>true</UseDebugLibraries>
23
+ <PlatformToolset>v120</PlatformToolset>
24
+ <CharacterSet>Unicode</CharacterSet>
25
+ </PropertyGroup>
26
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
27
+ <ConfigurationType>Application</ConfigurationType>
28
+ <UseDebugLibraries>false</UseDebugLibraries>
29
+ <PlatformToolset>v120</PlatformToolset>
30
+ <WholeProgramOptimization>true</WholeProgramOptimization>
31
+ <CharacterSet>Unicode</CharacterSet>
32
+ </PropertyGroup>
33
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
34
+ <ImportGroup Label="ExtensionSettings">
35
+ </ImportGroup>
36
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
37
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
+ </ImportGroup>
39
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
40
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41
+ </ImportGroup>
42
+ <PropertyGroup Label="UserMacros" />
43
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
44
+ <LinkIncremental>true</LinkIncremental>
45
+ <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
46
+ </PropertyGroup>
47
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
48
+ <LinkIncremental>false</LinkIncremental>
49
+ <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
50
+ </PropertyGroup>
51
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
52
+ <ClCompile>
53
+ <PrecompiledHeader>
54
+ </PrecompiledHeader>
55
+ <WarningLevel>Level3</WarningLevel>
56
+ <Optimization>Disabled</Optimization>
57
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
58
+ <AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
59
+ </ClCompile>
60
+ <Link>
61
+ <SubSystem>Console</SubSystem>
62
+ <GenerateDebugInformation>true</GenerateDebugInformation>
63
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
64
+ </Link>
65
+ </ItemDefinitionGroup>
66
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
67
+ <ClCompile>
68
+ <WarningLevel>Level3</WarningLevel>
69
+ <PrecompiledHeader>
70
+ </PrecompiledHeader>
71
+ <Optimization>MaxSpeed</Optimization>
72
+ <FunctionLevelLinking>true</FunctionLevelLinking>
73
+ <IntrinsicFunctions>true</IntrinsicFunctions>
74
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
75
+ </ClCompile>
76
+ <Link>
77
+ <SubSystem>Console</SubSystem>
78
+ <GenerateDebugInformation>true</GenerateDebugInformation>
79
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
80
+ <OptimizeReferences>true</OptimizeReferences>
81
+ </Link>
82
+ </ItemDefinitionGroup>
83
+ <ItemGroup>
84
+ <ClCompile Include="..\..\t\%TESTNAME%_t.c" />
85
+ </ItemGroup>
86
+ <ItemGroup>
87
+ <ProjectReference Include="libtap.vcxproj">
88
+ <Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
89
+ </ProjectReference>
90
+ <ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
91
+ <Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
92
+ </ProjectReference>
93
+ <ProjectReference Include="maxminddb_test_helper.vcxproj">
94
+ <Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
95
+ <Private>true</Private>
96
+ <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
97
+ <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
98
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
99
+ <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
100
+ </ProjectReference>
101
+ </ItemGroup>
102
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
103
+ <ImportGroup Label="ExtensionTargets">
104
+ </ImportGroup>
105
+ </Project>
@@ -0,0 +1,9 @@
1
+ include $(top_srcdir)/common.mk
2
+
3
+ lib_LTLIBRARIES = libmaxminddb.la
4
+
5
+ libmaxminddb_la_SOURCES = maxminddb.c maxminddb-compat-util.h
6
+ libmaxminddb_la_LDFLAGS = -version-info 0:7:0
7
+ include_HEADERS = $(top_srcdir)/include/maxminddb.h
8
+
9
+ pkgconfig_DATA = libmaxminddb.pc
@@ -0,0 +1,11 @@
1
+ prefix=@prefix@
2
+ exec_prefix=@prefix@
3
+ libdir=@libdir@
4
+ includedir=@includedir@
5
+
6
+ Name: libmaxminddb
7
+ Description: C library for the MaxMind DB file format
8
+ URL: http://maxmind.github.io/libmaxminddb/
9
+ Version: @PACKAGE_VERSION@
10
+ Libs: -L${libdir} -lmaxminddb
11
+ Cflags: -I${includedir}
@@ -0,0 +1,167 @@
1
+ #include <stdlib.h>
2
+ #include <string.h>
3
+
4
+ /* *INDENT-OFF* */
5
+
6
+ /* The memmem, strdup, and strndup functions were all copied from the
7
+ * FreeBSD source, along with the relevant copyright notice.
8
+ *
9
+ * It'd be nicer to simply use the functions available on the system if they
10
+ * exist, but there doesn't seem to be a good way to detect them without also
11
+ * defining things like _GNU_SOURCE, which we want to avoid, because then we
12
+ * end up _accidentally_ using GNU features without noticing, which then
13
+ * breaks on systems like OSX.
14
+ *
15
+ * C is fun! */
16
+
17
+ /* Applies to memmem implementation */
18
+ /*-
19
+ * Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
20
+ *
21
+ * Redistribution and use in source and binary forms, with or without
22
+ * modification, are permitted provided that the following conditions
23
+ * are met:
24
+ * 1. Redistributions of source code must retain the above copyright
25
+ * notice, this list of conditions and the following disclaimer.
26
+ * 2. Redistributions in binary form must reproduce the above copyright
27
+ * notice, this list of conditions and the following disclaimer in the
28
+ * documentation and/or other materials provided with the distribution.
29
+ * 3. The name of the author may not be used to endorse or promote
30
+ * products derived from this software without specific prior written
31
+ * permission.
32
+ *
33
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
34
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
37
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43
+ * SUCH DAMAGE.
44
+ */
45
+ static void *
46
+ mmdb_memmem(const void *l, size_t l_len, const void *s, size_t s_len)
47
+ {
48
+ register char *cur, *last;
49
+ const char *cl = (const char *)l;
50
+ const char *cs = (const char *)s;
51
+
52
+ /* we need something to compare */
53
+ if (l_len == 0 || s_len == 0)
54
+ return NULL;
55
+
56
+ /* "s" must be smaller or equal to "l" */
57
+ if (l_len < s_len)
58
+ return NULL;
59
+
60
+ /* special case where s_len == 1 */
61
+ if (s_len == 1)
62
+ return memchr(l, (int)*cs, l_len);
63
+
64
+ /* the last position where its possible to find "s" in "l" */
65
+ last = (char *)cl + l_len - s_len;
66
+
67
+ for (cur = (char *)cl; cur <= last; cur++)
68
+ if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
69
+ return cur;
70
+
71
+ return NULL;
72
+ }
73
+
74
+ /* Applies to strnlen implementation */
75
+ /*-
76
+ * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
77
+ * All rights reserved.
78
+ *
79
+ * Redistribution and use in source and binary forms, with or without
80
+ * modification, are permitted provided that the following conditions
81
+ * are met:
82
+ * 1. Redistributions of source code must retain the above copyright
83
+ * notice, this list of conditions and the following disclaimer.
84
+ * 2. Redistributions in binary form must reproduce the above copyright
85
+ * notice, this list of conditions and the following disclaimer in the
86
+ * documentation and/or other materials provided with the distribution.
87
+ *
88
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
89
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
90
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
91
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
92
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
93
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
94
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
95
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
96
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
97
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
98
+ * SUCH DAMAGE.
99
+ */
100
+ static size_t
101
+ mmdb_strnlen(const char *s, size_t maxlen)
102
+ {
103
+ size_t len;
104
+
105
+ for (len = 0; len < maxlen; len++, s++) {
106
+ if (!*s)
107
+ break;
108
+ }
109
+ return (len);
110
+ }
111
+
112
+ /* Applies to strdup and strndup implementation */
113
+ /*
114
+ * Copyright (c) 1988, 1993
115
+ * The Regents of the University of California. All rights reserved.
116
+ *
117
+ * Redistribution and use in source and binary forms, with or without
118
+ * modification, are permitted provided that the following conditions
119
+ * are met:
120
+ * 1. Redistributions of source code must retain the above copyright
121
+ * notice, this list of conditions and the following disclaimer.
122
+ * 2. Redistributions in binary form must reproduce the above copyright
123
+ * notice, this list of conditions and the following disclaimer in the
124
+ * documentation and/or other materials provided with the distribution.
125
+ * 3. Neither the name of the University nor the names of its contributors
126
+ * may be used to endorse or promote products derived from this software
127
+ * without specific prior written permission.
128
+ *
129
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
130
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
131
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
132
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
133
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
134
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
135
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
136
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
137
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
138
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
139
+ * SUCH DAMAGE.
140
+ */
141
+ static char *
142
+ mmdb_strdup(const char *str)
143
+ {
144
+ size_t len;
145
+ char *copy;
146
+
147
+ len = strlen(str) + 1;
148
+ if ((copy = malloc(len)) == NULL)
149
+ return (NULL);
150
+ memcpy(copy, str, len);
151
+ return (copy);
152
+ }
153
+
154
+ static char *
155
+ mmdb_strndup(const char *str, size_t n)
156
+ {
157
+ size_t len;
158
+ char *copy;
159
+
160
+ len = mmdb_strnlen(str, n);
161
+ if ((copy = malloc(len + 1)) == NULL)
162
+ return (NULL);
163
+ memcpy(copy, str, len);
164
+ copy[len] = '\0';
165
+ return (copy);
166
+ }
167
+ /* *INDENT-ON* */