From 475ce9dd23de34dd5f76106f74df43cbca69583e Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Mon, 8 Aug 2016 17:14:48 -0700 Subject: [PATCH] Fix g++ compiler warnings --- geojson.cpp | 6 +++--- serial.cpp | 3 ++- serial.hpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/geojson.cpp b/geojson.cpp index b99d8cf..272873c 100644 --- a/geojson.cpp +++ b/geojson.cpp @@ -206,7 +206,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje } bool has_id = false; - unsigned long long id_value; + unsigned long long id_value = 0; if (id != NULL) { if (id->type == JSON_NUMBER) { if (id->number >= 0) { @@ -230,7 +230,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje long long bbox[] = {LLONG_MAX, LLONG_MAX, LLONG_MIN, LLONG_MIN}; - int nprop = 0; + size_t nprop = 0; if (properties != NULL && properties->type == JSON_HASH) { nprop = properties->length; } @@ -239,7 +239,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje std::vector metaval; metaval.resize(nprop); int metatype[nprop]; - int m = 0; + size_t m = 0; for (size_t i = 0; i < nprop; i++) { if (properties->keys[i]->type == JSON_STRING) { diff --git a/serial.cpp b/serial.cpp index ba7af1b..fd98343 100644 --- a/serial.cpp +++ b/serial.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include "protozero/varint.hpp" @@ -194,7 +195,7 @@ void serialize_feature(FILE *geomfile, serial_feature *sf, long long *geompos, c serialize_long_long(geomfile, sf->metapos, geompos, fname); if (sf->metapos < 0 && sf->m != sf->keys.size()) { - fprintf(stderr, "Internal error: %d doesn't match %lld\n", sf->m, (long long) sf->keys.size()); + fprintf(stderr, "Internal error: %lld doesn't match %lld\n", (long long) sf->m, (long long) sf->keys.size()); exit(EXIT_FAILURE); } diff --git a/serial.hpp b/serial.hpp index 474af6f..e8ca1e7 100644 --- a/serial.hpp +++ b/serial.hpp @@ -38,7 +38,7 @@ struct serial_feature { drawvec geometry; - int m; + size_t m; std::vector keys; std::vector values; long long metapos;