mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
Merge branch 'master' into fr_javascript_ipv6
This commit is contained in:
commit
3693eb47a8
@ -392,10 +392,12 @@ XDB_PUBLIC(int) xdb_le_get_uint16(const char *buffer, int offset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XDB_PUBLIC(xdb_version_t *) xdb_parse_ip(const string_ip_t *ip_string, bytes_ip_t *buffer, size_t length) {
|
XDB_PUBLIC(xdb_version_t *) xdb_parse_ip(const string_ip_t *ip_string, bytes_ip_t *buffer, size_t length) {
|
||||||
|
char *d_ptr = strchr(ip_string, '.');
|
||||||
|
char *c_ptr = strchr(ip_string, ':');
|
||||||
// version check
|
// version check
|
||||||
if (strchr(ip_string, '.') != NULL && strchr(ip_string, ':') == NULL) {
|
if (d_ptr != NULL && c_ptr == NULL) {
|
||||||
return xdb_parse_v4_ip(ip_string, buffer, length);
|
return xdb_parse_v4_ip(ip_string, buffer, length);
|
||||||
} else if (strchr(ip_string, ':') != NULL) {
|
} else if (c_ptr != NULL) {
|
||||||
return xdb_parse_v6_ip(ip_string, buffer, length);
|
return xdb_parse_v6_ip(ip_string, buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user