Fix crash when encoding boolean properties.

This commit is contained in:
Eric Fischer 2015-04-10 13:03:11 -07:00
parent ed2f968b4e
commit d64328ac35
3 changed files with 5 additions and 1 deletions

View File

@ -544,7 +544,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
m++;
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_TRUE || properties->values[i]->type == JSON_FALSE)) {
metatype[m] = VT_BOOLEAN;
metaval[m] = properties->values[i]->string;
metaval[m] = properties->values[i]->type == JSON_TRUE ? "true" : "false";
m++;
} else if (properties->values[i] != NULL && (properties->values[i]->type == JSON_NULL)) {
;

View File

@ -193,6 +193,8 @@ void mbtiles_write_metadata(sqlite3 *outdb, const char *fname, char **layername,
if (pv->type == VT_NUMBER) {
aprintf(&buf, "\": \"Number\"");
} else if (pv->type == VT_BOOLEAN) {
aprintf(&buf, "\": \"Boolean\"");
} else {
aprintf(&buf, "\": \"String\"");
}

View File

@ -261,6 +261,8 @@ mapnik::vector::tile create_tile(char **layernames, int line_detail, std::vector
if (pv->type == VT_NUMBER) {
tv->set_double_value(atof(pv->s));
} else if (pv->type == VT_BOOLEAN) {
tv->set_bool_value(pv->s[0] == 't');
} else {
tv->set_string_value(pv->s);
}