Merge pull request #201 from Arkshine/cleanup-geoip-code

Cleanup some code from previous commits
This commit is contained in:
Vincent Herbet 2015-02-08 11:24:37 +01:00
commit 0b80c4367d
2 changed files with 3 additions and 7 deletions

View File

@ -124,13 +124,7 @@ static cell AMX_NATIVE_CALL amx_geoip_country_ex(AMX *amx, cell *params)
int length; int length;
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length)); char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
int id = -1; const char *path[] = { "country", "names", getLang(params[4]), NULL };
if (*params / sizeof(cell) >= 4)
{
id = params[4];
}
const char *path[] = { "country", "names", getLang(id), NULL };
const char *country = lookupString(ip, path, &length); const char *country = lookupString(ip, path, &length);
return MF_SetAmxStringUTF8Char(amx, params[2], country ? country : "", length, params[3] + 1); return MF_SetAmxStringUTF8Char(amx, params[2], country ? country : "", length, params[3] + 1);

View File

@ -167,7 +167,9 @@ const char *lookupString(const char *ip, const char **path, int *length)
if (!lookupByIp(ip, path, &result)) if (!lookupByIp(ip, path, &result))
{ {
if (length) if (length)
{
*length = 0; *length = 0;
}
return NULL; return NULL;
} }