head 1.2; access; symbols perseant-exfatfs-base-20250801:1.2 perseant-exfatfs-base-20240630:1.2 perseant-exfatfs:1.2.0.6 perseant-exfatfs-base:1.2 netbsd-8-3-RELEASE:1.1.1.1 cjep_sun2x:1.2.0.4 cjep_sun2x-base:1.2 cjep_staticlib_x-base1:1.2 cjep_staticlib_x:1.2.0.2 cjep_staticlib_x-base:1.2 phil-wifi-20200421:1.2 phil-wifi-20200411:1.2 phil-wifi-20200406:1.2 netbsd-8-2-RELEASE:1.1.1.1 netbsd-8-1-RELEASE:1.1.1.1 netbsd-8-1-RC1:1.1.1.1 pgoyette-compat-merge-20190127:1.1.1.1 pgoyette-compat-20190127:1.1.1.1 pgoyette-compat-20190118:1.1.1.1 pgoyette-compat-1226:1.1.1.1 pgoyette-compat-1126:1.1.1.1 pgoyette-compat-1020:1.1.1.1 pgoyette-compat-0930:1.1.1.1 pgoyette-compat-0906:1.1.1.1 netbsd-7-2-RELEASE:1.1.1.1 pgoyette-compat-0728:1.1.1.1 netbsd-8-0-RELEASE:1.1.1.1 phil-wifi:1.1.1.1.0.30 phil-wifi-base:1.1.1.1 pgoyette-compat-0625:1.1.1.1 netbsd-8-0-RC2:1.1.1.1 pgoyette-compat-0521:1.1.1.1 pgoyette-compat-0502:1.1.1.1 pgoyette-compat-0422:1.1.1.1 netbsd-8-0-RC1:1.1.1.1 pgoyette-compat-0415:1.1.1.1 bind-9-10-7:1.1.1.1 pgoyette-compat-0407:1.1.1.1 pgoyette-compat-0330:1.1.1.1 pgoyette-compat-0322:1.1.1.1 pgoyette-compat-0315:1.1.1.1 netbsd-7-1-2-RELEASE:1.1.1.1 pgoyette-compat:1.1.1.1.0.28 pgoyette-compat-base:1.1.1.1 netbsd-7-1-1-RELEASE:1.1.1.1 matt-nb8-mediatek:1.1.1.1.0.26 matt-nb8-mediatek-base:1.1.1.1 perseant-stdc-iso10646:1.1.1.1.0.24 perseant-stdc-iso10646-base:1.1.1.1 bind-9-10-5-P2:1.1.1.1 bind-9-10-5-P1:1.1.1.1 netbsd-8:1.1.1.1.0.22 netbsd-8-base:1.1.1.1 prg-localcount2-base3:1.1.1.1 prg-localcount2-base2:1.1.1.1 prg-localcount2-base1:1.1.1.1 prg-localcount2:1.1.1.1.0.20 prg-localcount2-base:1.1.1.1 pgoyette-localcount-20170426:1.1.1.1 bouyer-socketcan-base1:1.1.1.1 bind-9-10-4-P8:1.1.1.1 pgoyette-localcount-20170320:1.1.1.1 netbsd-7-1:1.1.1.1.0.18 netbsd-7-1-RELEASE:1.1.1.1 netbsd-7-1-RC2:1.1.1.1 bind-9-10-4-P6:1.1.1.1 netbsd-7-nhusb-base-20170116:1.1.1.1 bouyer-socketcan:1.1.1.1.0.16 bouyer-socketcan-base:1.1.1.1 bind-9-10-4-P5:1.1.1.1 pgoyette-localcount-20170107:1.1.1.1 netbsd-7-1-RC1:1.1.1.1 pgoyette-localcount-20161104:1.1.1.1 bind-9-10-4-P4:1.1.1.1 netbsd-7-0-2-RELEASE:1.1.1.1 bind-9-10-4-P3:1.1.1.1 localcount-20160914:1.1.1.1 netbsd-7-nhusb:1.1.1.1.0.14 netbsd-7-nhusb-base:1.1.1.1 pgoyette-localcount-20160806:1.1.1.1 pgoyette-localcount-20160726:1.1.1.1 pgoyette-localcount:1.1.1.1.0.12 pgoyette-localcount-base:1.1.1.1 bind-9-10-4-P1:1.1.1.1 netbsd-7-0-1-RELEASE:1.1.1.1 bind-9-10-3-P4:1.1.1.1 bind-9-10-3-P3:1.1.1.1 bind-9-10-3-P2:1.1.1.1 netbsd-7-0:1.1.1.1.0.10 netbsd-7-0-RELEASE:1.1.1.1 bind-9-10-2-P4:1.1.1.1 netbsd-7-0-RC3:1.1.1.1 bind-9-10-2-P3:1.1.1.1 netbsd-7-0-RC2:1.1.1.1 bind-9-10-2-P2:1.1.1.1 netbsd-7-0-RC1:1.1.1.1 bind-9-10-1-P1:1.1.1.1 tls-maxphys-base:1.1.1.1 tls-maxphys:1.1.1.1.0.8 netbsd-7:1.1.1.1.0.6 netbsd-7-base:1.1.1.1 bind-9-10-0-P2:1.1.1.1 yamt-pagecache:1.1.1.1.0.4 yamt-pagecache-base9:1.1.1.1 tls-earlyentropy:1.1.1.1.0.2 tls-earlyentropy-base:1.1.1.1 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.1 riastradh-drm2-base3:1.1.1.1 bind-9-10-0b1:1.1.1.1 bind-9-9-5b1:1.1.1.1 ISC:1.1.1; locks; strict; comment @# @; 1.2 date 2019.05.10.09.15.05; author wiz; state dead; branches; next 1.1; commitid SEgY3sFTlDvvDDmB; 1.1 date 2013.12.31.20.11.57; author christos; state Exp; branches 1.1.1.1; next ; commitid SZa7JvkZZNe59kjx; 1.1.1.1 date 2013.12.31.20.11.57; author christos; state Exp; branches 1.1.1.1.4.1 1.1.1.1.8.1 1.1.1.1.30.1; next ; commitid SZa7JvkZZNe59kjx; 1.1.1.1.4.1 date 2013.12.31.20.11.57; author yamt; state dead; branches; next 1.1.1.1.4.2; commitid qlg4WCl9yarq6yBx; 1.1.1.1.4.2 date 2014.05.22.15.43.26; author yamt; state Exp; branches; next ; commitid qlg4WCl9yarq6yBx; 1.1.1.1.8.1 date 2013.12.31.20.11.57; author tls; state dead; branches; next 1.1.1.1.8.2; commitid jTnpym9Qu0o4R1Nx; 1.1.1.1.8.2 date 2014.08.19.23.46.38; author tls; state Exp; branches; next ; commitid jTnpym9Qu0o4R1Nx; 1.1.1.1.30.1 date 2019.06.10.21.44.38; author christos; state dead; branches; next ; commitid jtc8rnCzWiEEHGqB; desc @@ 1.2 log @Remove src/external/bsd/bind - latest version is in src/external/mpl/bind This directory was already unhooked from the build (in August 2018). ok christos@@ @ text @diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.c dev/GeoIP-1.5.1/libGeoIP/GeoIP.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-07-19 16:56:58.000000000 +0200 @@@@ -19,6 +19,7 @@@@ */ #include "GeoIP.h" +#include "GeoIP_internal.h" static geoipv6_t IPV6_NULL; @@@@ -44,6 +45,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifdef _UNUSED #elif defined(__GNUC__) #define _UNUSED __attribute__ ((unused)) diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.h dev/GeoIP-1.5.1/libGeoIP/GeoIP.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-07-19 16:53:33.000000000 +0200 @@@@ -154,31 +154,33 @@@@ GEOIP_CORPORATE_SPEED = 3, } GeoIPNetspeedValues; +#ifdef GEOIP_EXPORTS +#define GEOIP_API __declspec(dllexport) +#define GEOIP_DATA __declspec(dllexport) +#else +#define GEOIP_DATA __declspec(dllimport) +#define GEOIP_API +#endif /* GEOIP_EXPORTS */ + extern char **GeoIPDBFileName; -extern const char * GeoIPDBDescription[NUM_DB_TYPES]; -extern const char *GeoIPCountryDBFileName; -extern const char *GeoIPRegionDBFileName; -extern const char *GeoIPCityDBFileName; -extern const char *GeoIPOrgDBFileName; -extern const char *GeoIPISPDBFileName; -extern const char *GeoIPLocationADBFileName; -extern const char *GeoIPAccuracyRadiusFileName; -extern const char *GeoIPCityConfidenceFileName; +extern GEOIP_DATA const char * GeoIPDBDescription[NUM_DB_TYPES]; +extern GEOIP_DATA const char *GeoIPCountryDBFileName; +extern GEOIP_DATA const char *GeoIPRegionDBFileName; +extern GEOIP_DATA const char *GeoIPCityDBFileName; +extern GEOIP_DATA const char *GeoIPOrgDBFileName; +extern GEOIP_DATA const char *GeoIPISPDBFileName; +extern GEOIP_DATA const char *GeoIPLocationADBFileName; +extern GEOIP_DATA const char *GeoIPAccuracyRadiusFileName; +extern GEOIP_DATA const char *GeoIPCityConfidenceFileName; extern char * GeoIP_custom_directory; /* Warning: do not use those arrays as doing so may break your * program with newer GeoIP versions */ -extern const char GeoIP_country_code[255][3]; -extern const char GeoIP_country_code3[255][4]; -extern const char * GeoIP_country_name[255]; -extern const char * GeoIP_utf8_country_name[255]; -extern const char GeoIP_country_continent[255][3]; - -#ifdef DLL -#define GEOIP_API __declspec(dllexport) -#else -#define GEOIP_API -#endif /* DLL */ +extern GEOIP_DATA const char GeoIP_country_code[255][3]; +extern GEOIP_DATA const char GeoIP_country_code3[255][4]; +extern GEOIP_DATA const char * GeoIP_country_name[255]; +extern GEOIP_DATA const char * GeoIP_utf8_country_name[255]; +extern GEOIP_DATA const char GeoIP_country_continent[255][3]; GEOIP_API void GeoIP_setup_custom_directory(char *dir); GEOIP_API GeoIP* GeoIP_open_type (int type, int flags); diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-07-19 15:41:05.000000000 +0200 @@@@ -35,6 +35,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifndef HAVE_PREAD #define pread(fd, buf, count, offset) \ ( \ diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-07-19 16:23:58.000000000 +0200 @@@@ -48,22 +48,22 @@@@ int netmask; } GeoIPRecord; -GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); -GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); - -GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); + +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); -int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); -int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); -int GeoIP_init_record_iter (GeoIP* gi); +GEOIP_API int GeoIP_init_record_iter (GeoIP* gi); /* returns 0 on success, 1 on failure */ -int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); +GEOIP_API int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); -void GeoIPRecord_delete (GeoIPRecord *gir); +GEOIP_API void GeoIPRecord_delete (GeoIPRecord *gir); /* NULL on failure otherwise a malloced string in utf8 */ /* char * GeoIP_iso_8859_1__utf8(const char *); */ diff -ruN dists/GeoIP-1.5.1/libGeoIP/Makefile.vc dev/GeoIP-1.5.1/libGeoIP/Makefile.vc --- dists/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-07-19 16:47:45.000000000 +0200 @@@@ -1,29 +1,42 @@@@ #NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). +##Produces a static library (GeoIP.lib). +#Produces a DLL (GeoIP.dll) and library (GeoIP.lib). COMPILER=cl -CFLAGS=-DWIN32 -MD -nologo +CFLAGS=-DWIN32 -DGEOIP_EXPORTS -MD -nologo GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" -DPACKAGE_VERSION=\"1.5.1\" -OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj +LINKER=link + +LDFLAGS=/DLL /nologo /subsystem:console + +LD1 = $(LINKER) $(LDFLAGS) + +OBJS=GeoIP.obj GeoIPCity.obj GeoIP_depreciated.obj regionName.obj md5.obj timeZone.obj pread.obj -EXTRA_LIBS= advapi32.lib wsock32.lib +EXTRA_LIBS= ws2_32.lib AR=lib -GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj - $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +#GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj pread.obj +# $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +GeoIP.dll GeoIP.lib: $(OBJS) + $(LD1) $(OBJS) $(EXTRA_LIBS) /out:GeoIP.dll /implib:GeoIP.lib + GeoIP.obj: GeoIP.c $(CC1) -c GeoIP.c $(GEOIPINC) GeoIPCity.obj: GeoIPCity.c $(CC1) -c GeoIPCity.c $(GEOIPINC) +GeoIP_depreciated.obj: GeoIP_depreciated.c + $(CC1) -c GeoIP_depreciated.c $(GEOIPINC) + regionName.obj: regionName.c $(CC1) -c regionName.c $(GEOIPINC) @@@@ -32,3 +45,6 @@@@ timeZone.obj: timeZone.c $(CC1) -c timeZone.c $(GEOIPINC) + +pread.obj: pread.c + $(CC1) -c pread.c $(GEOIPINC) diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.c dev/GeoIP-1.5.1/libGeoIP/pread.c --- dists/GeoIP-1.5.1/libGeoIP/pread.c 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.c 2013-07-19 15:37:44.000000000 +0200 @@@@ -0,0 +1,73 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#include "pread.h" + +CRITICAL_SECTION preadsc; + +#ifdef _WIN64 +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset) +{ + int cc = -1; + __int64 prev = (__int64)-1L; + + EnterCriticalSection(&preadsc); + prev = _lseeki64(fd, 0L, SEEK_CUR); + if (prev == (__int64)-1L) + goto done; + if (_lseeki64(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != (__int64)-1L) + (void)_lseeki64(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#else +int pread(int fd, void *buf, unsigned int nbyte, long offset) +{ + int cc = -1; + long prev = -1L; + + EnterCriticalSection(&preadsc); + prev = _lseek(fd, 0L, SEEK_CUR); + if (prev == -1L) + goto done; + if (_lseek(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != -1L) + (void)_lseek(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#endif + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved ) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + InitializeCriticalSection(&preadsc); + return TRUE; +} diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.h dev/GeoIP-1.5.1/libGeoIP/pread.h --- dists/GeoIP-1.5.1/libGeoIP/pread.h 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.h 2013-07-19 15:39:01.000000000 +0200 @@@@ -0,0 +1,29 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef _WIN64 +typedef __int64 ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset); +#else +typedef int ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, long offset); +#endif + +#define HAVE_PREAD + +extern CRITICAL_SECTION preadsc; diff -ruN dists/GeoIP-1.5.1/libGeoIP/regionName.c dev/GeoIP-1.5.1/libGeoIP/regionName.c --- dists/GeoIP-1.5.1/libGeoIP/regionName.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/regionName.c 2013-07-19 16:37:56.000000000 +0200 @@@@ -1,3 +1,5 @@@@ +#include "GeoIP.h" + #include #include diff -ruN dists/GeoIP-1.5.1/libGeoIP/timeZone.c dev/GeoIP-1.5.1/libGeoIP/timeZone.c --- dists/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-07-19 17:22:44.000000000 +0200 @@@@ -1,4 +1,7 @@@@ +#include "GeoIP.h" + #include + const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) { const char* timezone = NULL; if (country == NULL) { diff -ruN dists/GeoIP-1.5.1/test/Makefile.vc dev/GeoIP-1.5.1/test/Makefile.vc --- dists/GeoIP-1.5.1/test/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/Makefile.vc 2013-07-19 16:48:55.000000000 +0200 @@@@ -9,7 +9,7 @@@@ GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DSRCDIR=\"../\" GEOIPLIB = ..\libGeoIP\GeoIP.lib diff -ruN dists/GeoIP-1.5.1/test/benchmark.c dev/GeoIP-1.5.1/test/benchmark.c --- dists/GeoIP-1.5.1/test/benchmark.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/benchmark.c 2013-07-19 16:26:23.000000000 +0200 @@@@ -81,7 +81,7 @@@@ void testgeoiporg(int flags, const char *msg, int numlookups) { GeoIP *i = NULL; - GeoIPRegion *i3 = NULL; + char *i3 = NULL; int i4 = 0; int i2 = 0; double t = 0; @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Import bind 9.9.5b1 @ text @@ 1.1.1.1.30.1 log @Sync with HEAD @ text @@ 1.1.1.1.8.1 log @file GeoIP.diff was added on branch tls-maxphys on 2014-08-19 23:46:38 +0000 @ text @d1 345 @ 1.1.1.1.8.2 log @Rebase to HEAD as of a few days ago. @ text @a0 345 diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.c dev/GeoIP-1.5.1/libGeoIP/GeoIP.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-07-19 16:56:58.000000000 +0200 @@@@ -19,6 +19,7 @@@@ */ #include "GeoIP.h" +#include "GeoIP_internal.h" static geoipv6_t IPV6_NULL; @@@@ -44,6 +45,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifdef _UNUSED #elif defined(__GNUC__) #define _UNUSED __attribute__ ((unused)) diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.h dev/GeoIP-1.5.1/libGeoIP/GeoIP.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-07-19 16:53:33.000000000 +0200 @@@@ -154,31 +154,33 @@@@ GEOIP_CORPORATE_SPEED = 3, } GeoIPNetspeedValues; +#ifdef GEOIP_EXPORTS +#define GEOIP_API __declspec(dllexport) +#define GEOIP_DATA __declspec(dllexport) +#else +#define GEOIP_DATA __declspec(dllimport) +#define GEOIP_API +#endif /* GEOIP_EXPORTS */ + extern char **GeoIPDBFileName; -extern const char * GeoIPDBDescription[NUM_DB_TYPES]; -extern const char *GeoIPCountryDBFileName; -extern const char *GeoIPRegionDBFileName; -extern const char *GeoIPCityDBFileName; -extern const char *GeoIPOrgDBFileName; -extern const char *GeoIPISPDBFileName; -extern const char *GeoIPLocationADBFileName; -extern const char *GeoIPAccuracyRadiusFileName; -extern const char *GeoIPCityConfidenceFileName; +extern GEOIP_DATA const char * GeoIPDBDescription[NUM_DB_TYPES]; +extern GEOIP_DATA const char *GeoIPCountryDBFileName; +extern GEOIP_DATA const char *GeoIPRegionDBFileName; +extern GEOIP_DATA const char *GeoIPCityDBFileName; +extern GEOIP_DATA const char *GeoIPOrgDBFileName; +extern GEOIP_DATA const char *GeoIPISPDBFileName; +extern GEOIP_DATA const char *GeoIPLocationADBFileName; +extern GEOIP_DATA const char *GeoIPAccuracyRadiusFileName; +extern GEOIP_DATA const char *GeoIPCityConfidenceFileName; extern char * GeoIP_custom_directory; /* Warning: do not use those arrays as doing so may break your * program with newer GeoIP versions */ -extern const char GeoIP_country_code[255][3]; -extern const char GeoIP_country_code3[255][4]; -extern const char * GeoIP_country_name[255]; -extern const char * GeoIP_utf8_country_name[255]; -extern const char GeoIP_country_continent[255][3]; - -#ifdef DLL -#define GEOIP_API __declspec(dllexport) -#else -#define GEOIP_API -#endif /* DLL */ +extern GEOIP_DATA const char GeoIP_country_code[255][3]; +extern GEOIP_DATA const char GeoIP_country_code3[255][4]; +extern GEOIP_DATA const char * GeoIP_country_name[255]; +extern GEOIP_DATA const char * GeoIP_utf8_country_name[255]; +extern GEOIP_DATA const char GeoIP_country_continent[255][3]; GEOIP_API void GeoIP_setup_custom_directory(char *dir); GEOIP_API GeoIP* GeoIP_open_type (int type, int flags); diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-07-19 15:41:05.000000000 +0200 @@@@ -35,6 +35,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifndef HAVE_PREAD #define pread(fd, buf, count, offset) \ ( \ diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-07-19 16:23:58.000000000 +0200 @@@@ -48,22 +48,22 @@@@ int netmask; } GeoIPRecord; -GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); -GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); - -GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); + +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); -int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); -int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); -int GeoIP_init_record_iter (GeoIP* gi); +GEOIP_API int GeoIP_init_record_iter (GeoIP* gi); /* returns 0 on success, 1 on failure */ -int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); +GEOIP_API int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); -void GeoIPRecord_delete (GeoIPRecord *gir); +GEOIP_API void GeoIPRecord_delete (GeoIPRecord *gir); /* NULL on failure otherwise a malloced string in utf8 */ /* char * GeoIP_iso_8859_1__utf8(const char *); */ diff -ruN dists/GeoIP-1.5.1/libGeoIP/Makefile.vc dev/GeoIP-1.5.1/libGeoIP/Makefile.vc --- dists/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-07-19 16:47:45.000000000 +0200 @@@@ -1,29 +1,42 @@@@ #NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). +##Produces a static library (GeoIP.lib). +#Produces a DLL (GeoIP.dll) and library (GeoIP.lib). COMPILER=cl -CFLAGS=-DWIN32 -MD -nologo +CFLAGS=-DWIN32 -DGEOIP_EXPORTS -MD -nologo GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" -DPACKAGE_VERSION=\"1.5.1\" -OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj +LINKER=link + +LDFLAGS=/DLL /nologo /subsystem:console + +LD1 = $(LINKER) $(LDFLAGS) + +OBJS=GeoIP.obj GeoIPCity.obj GeoIP_depreciated.obj regionName.obj md5.obj timeZone.obj pread.obj -EXTRA_LIBS= advapi32.lib wsock32.lib +EXTRA_LIBS= ws2_32.lib AR=lib -GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj - $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +#GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj pread.obj +# $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +GeoIP.dll GeoIP.lib: $(OBJS) + $(LD1) $(OBJS) $(EXTRA_LIBS) /out:GeoIP.dll /implib:GeoIP.lib + GeoIP.obj: GeoIP.c $(CC1) -c GeoIP.c $(GEOIPINC) GeoIPCity.obj: GeoIPCity.c $(CC1) -c GeoIPCity.c $(GEOIPINC) +GeoIP_depreciated.obj: GeoIP_depreciated.c + $(CC1) -c GeoIP_depreciated.c $(GEOIPINC) + regionName.obj: regionName.c $(CC1) -c regionName.c $(GEOIPINC) @@@@ -32,3 +45,6 @@@@ timeZone.obj: timeZone.c $(CC1) -c timeZone.c $(GEOIPINC) + +pread.obj: pread.c + $(CC1) -c pread.c $(GEOIPINC) diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.c dev/GeoIP-1.5.1/libGeoIP/pread.c --- dists/GeoIP-1.5.1/libGeoIP/pread.c 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.c 2013-07-19 15:37:44.000000000 +0200 @@@@ -0,0 +1,73 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#include "pread.h" + +CRITICAL_SECTION preadsc; + +#ifdef _WIN64 +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset) +{ + int cc = -1; + __int64 prev = (__int64)-1L; + + EnterCriticalSection(&preadsc); + prev = _lseeki64(fd, 0L, SEEK_CUR); + if (prev == (__int64)-1L) + goto done; + if (_lseeki64(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != (__int64)-1L) + (void)_lseeki64(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#else +int pread(int fd, void *buf, unsigned int nbyte, long offset) +{ + int cc = -1; + long prev = -1L; + + EnterCriticalSection(&preadsc); + prev = _lseek(fd, 0L, SEEK_CUR); + if (prev == -1L) + goto done; + if (_lseek(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != -1L) + (void)_lseek(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#endif + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved ) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + InitializeCriticalSection(&preadsc); + return TRUE; +} diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.h dev/GeoIP-1.5.1/libGeoIP/pread.h --- dists/GeoIP-1.5.1/libGeoIP/pread.h 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.h 2013-07-19 15:39:01.000000000 +0200 @@@@ -0,0 +1,29 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef _WIN64 +typedef __int64 ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset); +#else +typedef int ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, long offset); +#endif + +#define HAVE_PREAD + +extern CRITICAL_SECTION preadsc; diff -ruN dists/GeoIP-1.5.1/libGeoIP/regionName.c dev/GeoIP-1.5.1/libGeoIP/regionName.c --- dists/GeoIP-1.5.1/libGeoIP/regionName.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/regionName.c 2013-07-19 16:37:56.000000000 +0200 @@@@ -1,3 +1,5 @@@@ +#include "GeoIP.h" + #include #include diff -ruN dists/GeoIP-1.5.1/libGeoIP/timeZone.c dev/GeoIP-1.5.1/libGeoIP/timeZone.c --- dists/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-07-19 17:22:44.000000000 +0200 @@@@ -1,4 +1,7 @@@@ +#include "GeoIP.h" + #include + const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) { const char* timezone = NULL; if (country == NULL) { diff -ruN dists/GeoIP-1.5.1/test/Makefile.vc dev/GeoIP-1.5.1/test/Makefile.vc --- dists/GeoIP-1.5.1/test/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/Makefile.vc 2013-07-19 16:48:55.000000000 +0200 @@@@ -9,7 +9,7 @@@@ GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DSRCDIR=\"../\" GEOIPLIB = ..\libGeoIP\GeoIP.lib diff -ruN dists/GeoIP-1.5.1/test/benchmark.c dev/GeoIP-1.5.1/test/benchmark.c --- dists/GeoIP-1.5.1/test/benchmark.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/benchmark.c 2013-07-19 16:26:23.000000000 +0200 @@@@ -81,7 +81,7 @@@@ void testgeoiporg(int flags, const char *msg, int numlookups) { GeoIP *i = NULL; - GeoIPRegion *i3 = NULL; + char *i3 = NULL; int i4 = 0; int i2 = 0; double t = 0; @ 1.1.1.1.4.1 log @file GeoIP.diff was added on branch yamt-pagecache on 2014-05-22 15:43:26 +0000 @ text @d1 345 @ 1.1.1.1.4.2 log @sync with head. for a reference, the tree before this commit was tagged as yamt-pagecache-tag8. this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments") @ text @a0 345 diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.c dev/GeoIP-1.5.1/libGeoIP/GeoIP.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-07-19 16:56:58.000000000 +0200 @@@@ -19,6 +19,7 @@@@ */ #include "GeoIP.h" +#include "GeoIP_internal.h" static geoipv6_t IPV6_NULL; @@@@ -44,6 +45,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifdef _UNUSED #elif defined(__GNUC__) #define _UNUSED __attribute__ ((unused)) diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.h dev/GeoIP-1.5.1/libGeoIP/GeoIP.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-07-19 16:53:33.000000000 +0200 @@@@ -154,31 +154,33 @@@@ GEOIP_CORPORATE_SPEED = 3, } GeoIPNetspeedValues; +#ifdef GEOIP_EXPORTS +#define GEOIP_API __declspec(dllexport) +#define GEOIP_DATA __declspec(dllexport) +#else +#define GEOIP_DATA __declspec(dllimport) +#define GEOIP_API +#endif /* GEOIP_EXPORTS */ + extern char **GeoIPDBFileName; -extern const char * GeoIPDBDescription[NUM_DB_TYPES]; -extern const char *GeoIPCountryDBFileName; -extern const char *GeoIPRegionDBFileName; -extern const char *GeoIPCityDBFileName; -extern const char *GeoIPOrgDBFileName; -extern const char *GeoIPISPDBFileName; -extern const char *GeoIPLocationADBFileName; -extern const char *GeoIPAccuracyRadiusFileName; -extern const char *GeoIPCityConfidenceFileName; +extern GEOIP_DATA const char * GeoIPDBDescription[NUM_DB_TYPES]; +extern GEOIP_DATA const char *GeoIPCountryDBFileName; +extern GEOIP_DATA const char *GeoIPRegionDBFileName; +extern GEOIP_DATA const char *GeoIPCityDBFileName; +extern GEOIP_DATA const char *GeoIPOrgDBFileName; +extern GEOIP_DATA const char *GeoIPISPDBFileName; +extern GEOIP_DATA const char *GeoIPLocationADBFileName; +extern GEOIP_DATA const char *GeoIPAccuracyRadiusFileName; +extern GEOIP_DATA const char *GeoIPCityConfidenceFileName; extern char * GeoIP_custom_directory; /* Warning: do not use those arrays as doing so may break your * program with newer GeoIP versions */ -extern const char GeoIP_country_code[255][3]; -extern const char GeoIP_country_code3[255][4]; -extern const char * GeoIP_country_name[255]; -extern const char * GeoIP_utf8_country_name[255]; -extern const char GeoIP_country_continent[255][3]; - -#ifdef DLL -#define GEOIP_API __declspec(dllexport) -#else -#define GEOIP_API -#endif /* DLL */ +extern GEOIP_DATA const char GeoIP_country_code[255][3]; +extern GEOIP_DATA const char GeoIP_country_code3[255][4]; +extern GEOIP_DATA const char * GeoIP_country_name[255]; +extern GEOIP_DATA const char * GeoIP_utf8_country_name[255]; +extern GEOIP_DATA const char GeoIP_country_continent[255][3]; GEOIP_API void GeoIP_setup_custom_directory(char *dir); GEOIP_API GeoIP* GeoIP_open_type (int type, int flags); diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-07-19 15:41:05.000000000 +0200 @@@@ -35,6 +35,10 @@@@ #include /* For uint32_t */ #endif +#if defined(_WIN32) +#include "pread.h" +#endif + #ifndef HAVE_PREAD #define pread(fd, buf, count, offset) \ ( \ diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h --- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-07-19 16:23:58.000000000 +0200 @@@@ -48,22 +48,22 @@@@ int netmask; } GeoIPRecord; -GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); -GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); - -GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); + +GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); +GEOIP_API GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); -int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); -int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); +GEOIP_API int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); -int GeoIP_init_record_iter (GeoIP* gi); +GEOIP_API int GeoIP_init_record_iter (GeoIP* gi); /* returns 0 on success, 1 on failure */ -int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); +GEOIP_API int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); -void GeoIPRecord_delete (GeoIPRecord *gir); +GEOIP_API void GeoIPRecord_delete (GeoIPRecord *gir); /* NULL on failure otherwise a malloced string in utf8 */ /* char * GeoIP_iso_8859_1__utf8(const char *); */ diff -ruN dists/GeoIP-1.5.1/libGeoIP/Makefile.vc dev/GeoIP-1.5.1/libGeoIP/Makefile.vc --- dists/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-07-19 16:47:45.000000000 +0200 @@@@ -1,29 +1,42 @@@@ #NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). +##Produces a static library (GeoIP.lib). +#Produces a DLL (GeoIP.dll) and library (GeoIP.lib). COMPILER=cl -CFLAGS=-DWIN32 -MD -nologo +CFLAGS=-DWIN32 -DGEOIP_EXPORTS -MD -nologo GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" -DPACKAGE_VERSION=\"1.5.1\" -OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj +LINKER=link + +LDFLAGS=/DLL /nologo /subsystem:console + +LD1 = $(LINKER) $(LDFLAGS) + +OBJS=GeoIP.obj GeoIPCity.obj GeoIP_depreciated.obj regionName.obj md5.obj timeZone.obj pread.obj -EXTRA_LIBS= advapi32.lib wsock32.lib +EXTRA_LIBS= ws2_32.lib AR=lib -GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj - $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +#GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj pread.obj +# $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib +GeoIP.dll GeoIP.lib: $(OBJS) + $(LD1) $(OBJS) $(EXTRA_LIBS) /out:GeoIP.dll /implib:GeoIP.lib + GeoIP.obj: GeoIP.c $(CC1) -c GeoIP.c $(GEOIPINC) GeoIPCity.obj: GeoIPCity.c $(CC1) -c GeoIPCity.c $(GEOIPINC) +GeoIP_depreciated.obj: GeoIP_depreciated.c + $(CC1) -c GeoIP_depreciated.c $(GEOIPINC) + regionName.obj: regionName.c $(CC1) -c regionName.c $(GEOIPINC) @@@@ -32,3 +45,6 @@@@ timeZone.obj: timeZone.c $(CC1) -c timeZone.c $(GEOIPINC) + +pread.obj: pread.c + $(CC1) -c pread.c $(GEOIPINC) diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.c dev/GeoIP-1.5.1/libGeoIP/pread.c --- dists/GeoIP-1.5.1/libGeoIP/pread.c 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.c 2013-07-19 15:37:44.000000000 +0200 @@@@ -0,0 +1,73 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#include "pread.h" + +CRITICAL_SECTION preadsc; + +#ifdef _WIN64 +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset) +{ + int cc = -1; + __int64 prev = (__int64)-1L; + + EnterCriticalSection(&preadsc); + prev = _lseeki64(fd, 0L, SEEK_CUR); + if (prev == (__int64)-1L) + goto done; + if (_lseeki64(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != (__int64)-1L) + (void)_lseeki64(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#else +int pread(int fd, void *buf, unsigned int nbyte, long offset) +{ + int cc = -1; + long prev = -1L; + + EnterCriticalSection(&preadsc); + prev = _lseek(fd, 0L, SEEK_CUR); + if (prev == -1L) + goto done; + if (_lseek(fd, offset, SEEK_SET) != offset) + goto done; + cc = _read(fd, buf, nbyte); + +done: + if (prev != -1L) + (void)_lseek(fd, prev, SEEK_SET); + LeaveCriticalSection(&preadsc); + + return cc; +} +#endif + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved ) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + InitializeCriticalSection(&preadsc); + return TRUE; +} diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.h dev/GeoIP-1.5.1/libGeoIP/pread.h --- dists/GeoIP-1.5.1/libGeoIP/pread.h 1970-01-01 01:00:00.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/pread.h 2013-07-19 15:39:01.000000000 +0200 @@@@ -0,0 +1,29 @@@@ +/* + * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef _WIN64 +typedef __int64 ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, __int64 offset); +#else +typedef int ssize_t; + +int pread(int fd, void *buf, unsigned int nbyte, long offset); +#endif + +#define HAVE_PREAD + +extern CRITICAL_SECTION preadsc; diff -ruN dists/GeoIP-1.5.1/libGeoIP/regionName.c dev/GeoIP-1.5.1/libGeoIP/regionName.c --- dists/GeoIP-1.5.1/libGeoIP/regionName.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/regionName.c 2013-07-19 16:37:56.000000000 +0200 @@@@ -1,3 +1,5 @@@@ +#include "GeoIP.h" + #include #include diff -ruN dists/GeoIP-1.5.1/libGeoIP/timeZone.c dev/GeoIP-1.5.1/libGeoIP/timeZone.c --- dists/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-07-19 17:22:44.000000000 +0200 @@@@ -1,4 +1,7 @@@@ +#include "GeoIP.h" + #include + const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) { const char* timezone = NULL; if (country == NULL) { diff -ruN dists/GeoIP-1.5.1/test/Makefile.vc dev/GeoIP-1.5.1/test/Makefile.vc --- dists/GeoIP-1.5.1/test/Makefile.vc 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/Makefile.vc 2013-07-19 16:48:55.000000000 +0200 @@@@ -9,7 +9,7 @@@@ GEOIPINC = -I..\libGeoIP -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) +CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DSRCDIR=\"../\" GEOIPLIB = ..\libGeoIP\GeoIP.lib diff -ruN dists/GeoIP-1.5.1/test/benchmark.c dev/GeoIP-1.5.1/test/benchmark.c --- dists/GeoIP-1.5.1/test/benchmark.c 2013-03-23 03:26:09.000000000 +0100 +++ dev/GeoIP-1.5.1/test/benchmark.c 2013-07-19 16:26:23.000000000 +0200 @@@@ -81,7 +81,7 @@@@ void testgeoiporg(int flags, const char *msg, int numlookups) { GeoIP *i = NULL; - GeoIPRegion *i3 = NULL; + char *i3 = NULL; int i4 = 0; int i2 = 0; double t = 0; @