Fix g++ compiler warnings

This commit is contained in:
Eric Fischer 2016-08-08 17:14:48 -07:00
parent 8b339abd40
commit 475ce9dd23
3 changed files with 6 additions and 5 deletions

View File

@ -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<std::string> 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) {

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <string>
#include <vector>
#include <sqlite3.h>
#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);
}

View File

@ -38,7 +38,7 @@ struct serial_feature {
drawvec geometry;
int m;
size_t m;
std::vector<long long> keys;
std::vector<long long> values;
long long metapos;