diff --git a/src/ip_to_geo.c b/src/ip_to_geo.c index 506697f..a009e1b 100644 --- a/src/ip_to_geo.c +++ b/src/ip_to_geo.c @@ -12,12 +12,13 @@ static const uint8_t* ip_to_geo_rec(uint8_t* ip, unsigned level, const ip_level* root) { - unsigned cur_average; + uint8_t cur_average; const ip_level* cur_ip; - unsigned cur_addr; + uint8_t cur_addr; while (1) { + start_loop: cur_ip = root; cur_addr = ip[level]; @@ -38,7 +39,7 @@ static const uint8_t* ip_to_geo_rec(uint8_t* ip, unsigned level, const ip_level* { \ level++; \ root = cur_ip->childs; \ - continue; \ + goto start_loop; \ } \ else \ return &cur_ip->code; \ @@ -105,7 +106,7 @@ int interactive(struct gengetopt_args_info* params) } } - cc = ip_to_geo((uint8_t*)&ret, ip_size); + cc = ip_to_geo(ip, ip_size); if (params->quiet_flag) printf("%s\n", (cc)?(char*)get_country_code(cc):"");