mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-01 16:58:05 +00:00
Merge pull request #458 from mapbox/nan-infinity
Add better diagnostics for NaN or Infinity in input JSON
This commit is contained in:
commit
e7f264fa51
@ -1,3 +1,7 @@
|
|||||||
|
## 1.22.2
|
||||||
|
|
||||||
|
* Add better diagnostics for NaN or Infinity in input JSON
|
||||||
|
|
||||||
## 1.22.1
|
## 1.22.1
|
||||||
|
|
||||||
* Fix tilestats generation when long string attribute values are elided
|
* Fix tilestats generation when long string attribute values are elided
|
||||||
|
@ -400,6 +400,32 @@ again:
|
|||||||
return add_object(j, JSON_NULL);
|
return add_object(j, JSON_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////// NaN
|
||||||
|
|
||||||
|
if (c == 'N') {
|
||||||
|
if (read_wrap(j) != 'a' || read_wrap(j) != 'N') {
|
||||||
|
j->error = "Found misspelling of NaN";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
j->error = "JSON does not allow NaN";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////// Infinity
|
||||||
|
|
||||||
|
if (c == 'I') {
|
||||||
|
if (read_wrap(j) != 'n' || read_wrap(j) != 'f' || read_wrap(j) != 'i' ||
|
||||||
|
read_wrap(j) != 'n' || read_wrap(j) != 'i' || read_wrap(j) != 't' ||
|
||||||
|
read_wrap(j) != 'y') {
|
||||||
|
j->error = "Found misspelling of Infinity";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
j->error = "JSON does not allow Infinity";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////// True
|
/////////////////////////// True
|
||||||
|
|
||||||
if (c == 't') {
|
if (c == 't') {
|
||||||
@ -740,7 +766,7 @@ void json_disconnect(json_object *o) {
|
|||||||
|
|
||||||
static void json_print_one(struct string *val, json_object *o) {
|
static void json_print_one(struct string *val, json_object *o) {
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
string_append_string(val, "NULL");
|
string_append_string(val, "...");
|
||||||
} else if (o->type == JSON_STRING) {
|
} else if (o->type == JSON_STRING) {
|
||||||
string_append(val, '\"');
|
string_append(val, '\"');
|
||||||
|
|
||||||
@ -779,7 +805,7 @@ static void json_print_one(struct string *val, json_object *o) {
|
|||||||
static void json_print(struct string *val, json_object *o) {
|
static void json_print(struct string *val, json_object *o) {
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
// Hash value in incompletely read hash
|
// Hash value in incompletely read hash
|
||||||
string_append_string(val, "NULL");
|
string_append_string(val, "...");
|
||||||
} else if (o->type == JSON_HASH) {
|
} else if (o->type == JSON_HASH) {
|
||||||
string_append(val, '{');
|
string_append(val, '{');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef VERSION_HPP
|
#ifndef VERSION_HPP
|
||||||
#define VERSION_HPP
|
#define VERSION_HPP
|
||||||
|
|
||||||
#define VERSION "tippecanoe v1.22.1\n"
|
#define VERSION "tippecanoe v1.22.2\n"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user