Geoip: Fix missing continent id and fix indentation.

This commit is contained in:
Arkshine
2014-08-05 22:57:48 +02:00
parent adde73123f
commit 023c1e3baf
3 changed files with 13 additions and 10 deletions

View File

@ -611,7 +611,7 @@ MMDB_lookup_result_s MMDB_lookup_string(MMDB_s *const mmdb,
LOCAL int resolve_any_address(const char *ipstr, struct addrinfo **addresses)
{
struct addrinfo hints;
memset(&hints, 0, sizeof(addrinfo)); // getaddrinfo doesn't like garbage.
memset(&hints, 0, sizeof(addrinfo)); // getaddrinfo doesn't like garbage.
hints.ai_socktype = SOCK_STREAM;
int gai_status;

View File

@ -139,12 +139,13 @@ double lookupDouble(const char *ip, const char **path)
int getContinentId(const char *code)
{
#define CONTINENT_UNKNOWN 0
#define CONTINENT_AFRICA 1
#define CONTINENT_ASIA 2
#define CONTINENT_EUROPE 3
#define CONTINENT_NORTH_AMERICA 4
#define CONTINENT_OCEANIA 5
#define CONTINENT_SOUTH_AMERICA 6
#define CONTINENT_AFRICA 1
#define CONTINENT_ANTARCTICA 2
#define CONTINENT_ASIA 3
#define CONTINENT_EUROPE 4
#define CONTINENT_NORTH_AMERICA 5
#define CONTINENT_OCEANIA 6
#define CONTINENT_SOUTH_AMERICA 7
int index = CONTINENT_UNKNOWN;
@ -157,6 +158,7 @@ int getContinentId(const char *code)
switch (code[1])
{
case 'F': index = CONTINENT_AFRICA; break;
case 'N': index = CONTINENT_ANTARCTICA; break;
case 'S': index = CONTINENT_ASIA; break;
}
}