git: 4fad62c16a0d - main - net/ip2location: Update to 8.4.1

From: Ryan Steinmetz <zi_at_FreeBSD.org>
Date: Fri, 08 Apr 2022 15:59:29 UTC
The branch main has been updated by zi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4fad62c16a0db5aa962b115de9dd1ec0900fa12d

commit 4fad62c16a0db5aa962b115de9dd1ec0900fa12d
Author:     Ryan Steinmetz <zi@FreeBSD.org>
AuthorDate: 2022-04-08 15:38:15 +0000
Commit:     Ryan Steinmetz <zi@FreeBSD.org>
CommitDate: 2022-04-08 15:59:09 +0000

    net/ip2location: Update to 8.4.1
---
 net/ip2location/Makefile            |   3 +-
 net/ip2location/distinfo            |   6 +-
 net/ip2location/files/patch-memleak | 369 ------------------------------------
 net/ip2location/pkg-plist           |  11 +-
 4 files changed, 10 insertions(+), 379 deletions(-)

diff --git a/net/ip2location/Makefile b/net/ip2location/Makefile
index ea3c25a5b5c7..a02be5889cc3 100644
--- a/net/ip2location/Makefile
+++ b/net/ip2location/Makefile
@@ -1,8 +1,7 @@
 # Created by: Gasol Wu <gasol.wu@gmail.com>
 
 PORTNAME=	ip2location
-PORTVERSION=	8.0.9
-PORTREVISION=	1
+PORTVERSION=	8.4.1
 CATEGORIES=	net
 
 MAINTAINER=	zi@FreeBSD.org
diff --git a/net/ip2location/distinfo b/net/ip2location/distinfo
index 0668ad8d8c51..5cb481de7764 100644
--- a/net/ip2location/distinfo
+++ b/net/ip2location/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1576975294
-SHA256 (chrislim2888-IP2Location-C-Library-8.0.9_GH0.tar.gz) = c557dffa854697484b972504c553ad296a0782bb2844646afc9528caeffe07c1
-SIZE (chrislim2888-IP2Location-C-Library-8.0.9_GH0.tar.gz) = 3775117
+TIMESTAMP = 1649431620
+SHA256 (chrislim2888-IP2Location-C-Library-8.4.1_GH0.tar.gz) = 6e02c6a0e66be47d4cb904356530ad67a5813fb4eafcdb244cd58a4bf7b2c42f
+SIZE (chrislim2888-IP2Location-C-Library-8.4.1_GH0.tar.gz) = 3563274
diff --git a/net/ip2location/files/patch-memleak b/net/ip2location/files/patch-memleak
deleted file mode 100644
index 7ccf982d46af..000000000000
--- a/net/ip2location/files/patch-memleak
+++ /dev/null
@@ -1,369 +0,0 @@
-diff --git a/libIP2Location/IP2Location.c b/libIP2Location/IP2Location.c
-index fbe7fe0..a57ba2f 100644
---- libIP2Location/IP2Location.c
-+++ libIP2Location/IP2Location.c
-@@ -151,8 +151,8 @@ static int IP2Location_initialize(IP2Location *loc)
-     loc->ipv6databasecount  = IP2Location_read32(loc->filehandle, 14);
-     loc->ipv6databaseaddr   = IP2Location_read32(loc->filehandle, 18);
- 
--    loc->ipv4indexbaseaddr 	= IP2Location_read32(loc->filehandle, 22);
--    loc->ipv6indexbaseaddr	= IP2Location_read32(loc->filehandle, 26);
-+    loc->ipv4indexbaseaddr     = IP2Location_read32(loc->filehandle, 22);
-+    loc->ipv6indexbaseaddr    = IP2Location_read32(loc->filehandle, 26);
- 
-     return 0;
- }
-@@ -381,47 +381,77 @@ static IP2LocationRecord *IP2Location_read_record(IP2Location *loc, uint32_t row
- 
-     if ((mode & COUNTRYSHORT) && (COUNTRY_POSITION[dbtype] != 0))
-     {
--        record->country_short = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (COUNTRY_POSITION[dbtype]-1)));
-+        if (!record->country_short)
-+        {
-+            record->country_short = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (COUNTRY_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->country_short = strdup(NOT_SUPPORTED);
-+        if (!record->country_short)
-+        {
-+            record->country_short = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & COUNTRYLONG) && (COUNTRY_POSITION[dbtype] != 0))
-     {
--        record->country_long = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (COUNTRY_POSITION[dbtype]-1))+3);
-+        if (!record->country_long)
-+        {
-+            record->country_long = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (COUNTRY_POSITION[dbtype]-1))+3);
-+        }
-     }
-     else
-     {
--        record->country_long = strdup(NOT_SUPPORTED);
-+        if (!record->country_long)
-+        {
-+            record->country_long = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & REGION) && (REGION_POSITION[dbtype] != 0))
-     {
--        record->region = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (REGION_POSITION[dbtype]-1)));
-+        if (!record->region)
-+        {
-+            record->region = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (REGION_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->region = strdup(NOT_SUPPORTED);
-+        if (!record->region)
-+        {
-+            record->region = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & CITY) && (CITY_POSITION[dbtype] != 0))
-     {
--        record->city = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (CITY_POSITION[dbtype]-1)));
-+        if (!record->city)
-+        {
-+            record->city = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (CITY_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->city = strdup(NOT_SUPPORTED);
-+        if (!record->city)
-+        {
-+            record->city = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & ISP) && (ISP_POSITION[dbtype] != 0))
-     {
--        record->isp = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (ISP_POSITION[dbtype]-1)));
-+        if (!record->isp)
-+        {
-+            record->isp = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (ISP_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->isp = strdup(NOT_SUPPORTED);
-+        if (!record->isp)
-+        {
-+            record->isp = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & LATITUDE) && (LATITUDE_POSITION[dbtype] != 0))
-@@ -444,108 +474,174 @@ static IP2LocationRecord *IP2Location_read_record(IP2Location *loc, uint32_t row
- 
-     if ((mode & DOMAIN_) && (DOMAIN_POSITION[dbtype] != 0))
-     {
--        record->domain = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (DOMAIN_POSITION[dbtype]-1)));
-+        if (!record->domain)
-+        {
-+            record->domain = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (DOMAIN_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->domain = strdup(NOT_SUPPORTED);
-+        if (!record->domain)
-+        {
-+            record->domain = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & ZIPCODE) && (ZIPCODE_POSITION[dbtype] != 0))
-     {
--        record->zipcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (ZIPCODE_POSITION[dbtype]-1)));
-+        if (!record->zipcode)
-+        {
-+            record->zipcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (ZIPCODE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->zipcode = strdup(NOT_SUPPORTED);
-+        if (!record->zipcode)
-+        {
-+            record->zipcode = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & TIMEZONE) && (TIMEZONE_POSITION[dbtype] != 0))
-     {
--        record->timezone = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (TIMEZONE_POSITION[dbtype]-1)));
-+        if (!record->timezone)
-+        {
-+            record->timezone = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (TIMEZONE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->timezone = strdup(NOT_SUPPORTED);
-+        if (!record->timezone)
-+        {
-+            record->timezone = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & NETSPEED) && (NETSPEED_POSITION[dbtype] != 0))
-     {
--        record->netspeed = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (NETSPEED_POSITION[dbtype]-1)));
-+        if (!record->netspeed)
-+        {
-+            record->netspeed = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (NETSPEED_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->netspeed = strdup(NOT_SUPPORTED);
-+        if (!record->netspeed)
-+        {
-+            record->netspeed = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & IDDCODE) && (IDDCODE_POSITION[dbtype] != 0))
-     {
--        record->iddcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (IDDCODE_POSITION[dbtype]-1)));
-+        if (!record->iddcode)
-+        {
-+            record->iddcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (IDDCODE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->iddcode = strdup(NOT_SUPPORTED);
-+        if (!record->iddcode)
-+        {
-+            record->iddcode = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & AREACODE) && (AREACODE_POSITION[dbtype] != 0))
-     {
--        record->areacode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (AREACODE_POSITION[dbtype]-1)));
-+        if (!record->areacode)
-+        {
-+            record->areacode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (AREACODE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->areacode = strdup(NOT_SUPPORTED);
-+        if (!record->areacode)
-+        {
-+            record->areacode = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & WEATHERSTATIONCODE) && (WEATHERSTATIONCODE_POSITION[dbtype] != 0))
-     {
--        record->weatherstationcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (WEATHERSTATIONCODE_POSITION[dbtype]-1)));
-+        if (!record->weatherstationcode)
-+        {
-+            record->weatherstationcode = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (WEATHERSTATIONCODE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->weatherstationcode = strdup(NOT_SUPPORTED);
-+        if (!record->weatherstationcode)
-+        {
-+            record->weatherstationcode = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & WEATHERSTATIONNAME) && (WEATHERSTATIONNAME_POSITION[dbtype] != 0))
-     {
--        record->weatherstationname = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (WEATHERSTATIONNAME_POSITION[dbtype]-1)));
-+        if (!record->weatherstationname)
-+        {
-+            record->weatherstationname = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (WEATHERSTATIONNAME_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->weatherstationname = strdup(NOT_SUPPORTED);
-+        if (!record->weatherstationname)
-+        {
-+            record->weatherstationname = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & MCC) && (MCC_POSITION[dbtype] != 0))
-     {
--        record->mcc = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MCC_POSITION[dbtype]-1)));
-+        if (!record->mcc)
-+        {
-+            record->mcc = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MCC_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->mcc = strdup(NOT_SUPPORTED);
-+        if (!record->mcc)
-+        {
-+            record->mcc = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & MNC) && (MNC_POSITION[dbtype] != 0))
-     {
--        record->mnc = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MNC_POSITION[dbtype]-1)));
-+        if (!record->mnc)
-+        {
-+            record->mnc = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MNC_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->mnc = strdup(NOT_SUPPORTED);
-+        if (!record->mnc)
-+        {
-+            record->mnc = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & MOBILEBRAND) && (MOBILEBRAND_POSITION[dbtype] != 0))
-     {
--        record->mobilebrand = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MOBILEBRAND_POSITION[dbtype]-1)));
-+        if (!record->mobilebrand)
-+        {
-+            record->mobilebrand = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (MOBILEBRAND_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->mobilebrand = strdup(NOT_SUPPORTED);
-+        if (!record->mobilebrand)
-+        {
-+            record->mobilebrand = strdup(NOT_SUPPORTED);
-+        }
-     }
- 
-     if ((mode & ELEVATION) && (ELEVATION_POSITION[dbtype] != 0))
-     {
-         char *mem = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (ELEVATION_POSITION[dbtype]-1)));
--	record->elevation = atof(mem);
--	free(mem);
-+        record->elevation = atof(mem);
-+        free(mem);
-     }
-     else
-     {
-@@ -554,11 +650,17 @@ static IP2LocationRecord *IP2Location_read_record(IP2Location *loc, uint32_t row
- 
-     if ((mode & USAGETYPE) && (USAGETYPE_POSITION[dbtype] != 0))
-     {
--        record->usagetype = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (USAGETYPE_POSITION[dbtype]-1)));
-+        if (!record->usagetype)
-+        {
-+            record->usagetype = IP2Location_readStr(handle, IP2Location_read32(handle, rowaddr + 4 * (USAGETYPE_POSITION[dbtype]-1)));
-+        }
-     }
-     else
-     {
--        record->usagetype = strdup(NOT_SUPPORTED);
-+        if (!record->usagetype)
-+        {
-+            record->usagetype = strdup(NOT_SUPPORTED);
-+        }
-     }
-     return record;
- }
-@@ -658,7 +760,7 @@ static IP2LocationRecord *IP2Location_get_ipv4_record(IP2Location *loc, char *ip
-     {
-         mid = (uint32_t)((low + high) >> 1);
-         ipfrom = IP2Location_read32(handle, baseaddr + mid * dbcolumn * 4);
--        ipto 	= IP2Location_read32(handle, baseaddr + (mid + 1) * dbcolumn * 4);
-+        ipto     = IP2Location_read32(handle, baseaddr + (mid + 1) * dbcolumn * 4);
- 
-         if ((ipno >= ipfrom) && (ipno < ipto))
-         {
-@@ -683,17 +785,17 @@ static IP2LocationRecord *IP2Location_get_ipv4_record(IP2Location *loc, char *ip
- static IP2LocationRecord *IP2Location_get_record(IP2Location *loc, char *ipstring, uint32_t mode)
- {
-     ipv_t parsed_ipv = IP2Location_parse_addr(ipstring);
--	if (parsed_ipv.ipversion == 4)
--	{
--		//process IPv4
--		return IP2Location_get_ipv4_record(loc, ipstring, mode, parsed_ipv);
--	}
-+    if (parsed_ipv.ipversion == 4)
-+    {
-+        //process IPv4
-+        return IP2Location_get_ipv4_record(loc, ipstring, mode, parsed_ipv);
-+    }
-     if (parsed_ipv.ipversion == 6)
-     {
--		//process IPv6
-+        //process IPv6
-         return IP2Location_get_ipv6_record(loc, ipstring, mode, parsed_ipv);
-     }
--	else
-+    else
-     {
-         return IP2Location_bad_record(INVALID_IPV4_ADDRESS);
-     }
-diff --git a/libIP2Location/IP2Location.h b/libIP2Location/IP2Location.h
-index b425362..34e9ada 100644
---- libIP2Location/IP2Location.h
-+++ libIP2Location/IP2Location.h
-@@ -56,7 +56,7 @@ extern "C" {
- #include "IP2Loc_DBInterface.h"
- 
- /* API version changes only if functions are added (release) or changed (minor/major) */
--#define API_VERSION   8.0.8
-+#define API_VERSION   8.0.9
- 
- 
- #define API_VERSION_MAJOR   8
diff --git a/net/ip2location/pkg-plist b/net/ip2location/pkg-plist
index 116b91bf3d5f..5a338598e1c1 100644
--- a/net/ip2location/pkg-plist
+++ b/net/ip2location/pkg-plist
@@ -1,8 +1,9 @@
-include/IP2Loc_DBInterface.h
+bin/ip2location
 include/IP2Location.h
 lib/libIP2Location.a
 lib/libIP2Location.so
-lib/libIP2Location.so.1
-lib/libIP2Location.so.1.0.0
-share/IP2Loc/IP-COUNTRY.BIN
-share/IP2Loc/IPV6-COUNTRY.BIN
+lib/libIP2Location.so.3
+lib/libIP2Location.so.3.0.0
+share/ip2loc/IP-COUNTRY.BIN
+share/ip2loc/IPV6-COUNTRY.BIN
+share/man/man1/ip2location.1.gz