correctly handle all revgeocoding errors

This commit is contained in:
Jan-Piet Mens
2015-08-16 12:49:51 +02:00
parent 87d36f0da7
commit b19496da73
+3 -4
View File
@@ -3,11 +3,10 @@
#include <time.h>
#include <curl/curl.h>
#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);
}
}