Fix off-by-one error in attributes, and canonicalize number formats

This commit is contained in:
Eric Fischer 2017-09-20 18:40:54 -07:00
parent fa3e7cadd9
commit 98f025fa35

View File

@ -204,7 +204,7 @@ void parse_shapefile(struct serialization_state *sst, std::string fname, int lay
std::vector<std::string> full_keys; std::vector<std::string> full_keys;
std::vector<serial_val> full_values; std::vector<serial_val> full_values;
unsigned char *dbp = db; unsigned char *dbp = db + 1;
for (size_t i = 0; i < columns.size(); i++) { for (size_t i = 0; i < columns.size(); i++) {
std::string s = std::string((char *) dbp, column_widths[i]); std::string s = std::string((char *) dbp, column_widths[i]);
dbp += column_widths[i]; dbp += column_widths[i];
@ -219,6 +219,7 @@ void parse_shapefile(struct serialization_state *sst, std::string fname, int lay
if (column_types[i] == 'F' || column_types[i] == 'N') { if (column_types[i] == 'F' || column_types[i] == 'N') {
sv.type = mvt_double; sv.type = mvt_double;
sv.s = milo::dtoa_milo(atof(sv.s.c_str()));
} else if (column_types[i] == 'L') { } else if (column_types[i] == 'L') {
sv.type = mvt_bool; sv.type = mvt_bool;
if (s == "Y" || s == "y" || s == "T" || s == "t") { if (s == "Y" || s == "y" || s == "T" || s == "t") {