From b19496da73e848b99117ee048ad7cc41d4a5bccc Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sun, 16 Aug 2015 12:49:51 +0200 Subject: [PATCH] correctly handle all revgeocoding errors --- geo.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/geo.c b/geo.c index 67590dc..0db69c4 100644 --- a/geo.c +++ b/geo.c @@ -3,11 +3,10 @@ #include #include #include "utstring.h" +#include "config.h" #include "geo.h" #include "json.h" -#define GURL "http://maps.googleapis.com/maps/api/geocode/json?latlng=%lf,%lf&sensor=false&language=EN" - static CURL *curl; static size_t writemem(void *contents, size_t size, size_t nmemb, void *userp) @@ -57,8 +56,8 @@ static int goog_decode(UT_string *geodata, UT_string *addr, UT_string *cc) // printf("%s\n", utstring_body(geodata)); if ((j = json_find_member(json, "status")) != NULL) { // printf("}}}}}} %s\n", j->string_); - if (strcmp(j->string_, "OVER_QUERY_LIMIT") == 0) { - fprintf(stderr, "revgeo: %s\n", j->string_); + if (strcmp(j->string_, "OK") != 0) { + fprintf(stderr, "revgeo: %s (%s)\n", j->string_, utstring_body(geodata)); return (0); } }