mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 09:55:41 +02:00
Fix number parsing bug and hash initialization bug
This commit is contained in:
@@ -52,6 +52,7 @@ static json_object *add_object(json_type type, json_object *parent) {
|
|||||||
json_hash *h = malloc(sizeof(json_hash));
|
json_hash *h = malloc(sizeof(json_hash));
|
||||||
h->next = parent->hash;
|
h->next = parent->hash;
|
||||||
h->key = o;
|
h->key = o;
|
||||||
|
h->value = NULL;
|
||||||
parent->hash = h;
|
parent->hash = h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,9 +184,15 @@ json_object *json_parse(FILE *f, json_object *current) {
|
|||||||
struct string val;
|
struct string val;
|
||||||
string_init(&val);
|
string_init(&val);
|
||||||
|
|
||||||
string_append(&val, c);
|
if (c == '-') {
|
||||||
|
string_append(&val, c);
|
||||||
|
c = getc(f);
|
||||||
|
}
|
||||||
|
|
||||||
if (c >= '1' && c <= '9') {
|
if (c == '0') {
|
||||||
|
string_append(&val, c);
|
||||||
|
} else if (c >= '1' && c <= '9') {
|
||||||
|
string_append(&val, c);
|
||||||
c = peek(f);
|
c = peek(f);
|
||||||
|
|
||||||
while (c >= '0' && c <= '9') {
|
while (c >= '0' && c <= '9') {
|
||||||
|
|||||||
Reference in New Issue
Block a user