diff --git a/main.cpp b/main.cpp index 4b69b05f..71463cb3 100644 --- a/main.cpp +++ b/main.cpp @@ -2219,6 +2219,8 @@ std::pair read_input(std::vector &sources, char *fname, i std::atomic geompos(0); /* initial tile is normally 0/0/0 but can be iz/ix/iy if limited to one tile */ + long long vertex_count = 0; + fwrite_check(&vertex_count, sizeof(vertex_count), 1, geomfile, &geompos, fname); serialize_int(geomfile, iz, &geompos, fname); serialize_uint(geomfile, ix, &geompos, fname); serialize_uint(geomfile, iy, &geompos, fname); diff --git a/tile.cpp b/tile.cpp index 2bef7867..f41f8fe1 100644 --- a/tile.cpp +++ b/tile.cpp @@ -531,6 +531,9 @@ static void rewrite(serial_feature const &osf, int z, int nextzoom, int maxzoom, if (!within[j]) { within[j] = true; start_geompos[j] = geompos[j]; // no competition between threads + + long long vertex_count = 0; + fwrite_check(&vertex_count, sizeof(vertex_count), 1, geomfile[j]->fp, &geompos[j], fname); serialize_int(geomfile[j]->fp, nextzoom, &geompos[j], fname); serialize_uint(geomfile[j]->fp, tx * span + xo, &geompos[j], fname); serialize_uint(geomfile[j]->fp, ty * span + yo, &geompos[j], fname); @@ -2669,6 +2672,10 @@ void *run_thread(void *vargs) { // These z/x/y are uncompressed so we can seek to the start of the // compressed feature data that immediately follows. + long long vertex_count; + if (dc.fread(&vertex_count, sizeof(vertex_count), 1, &geompos) != 1) { + break; + } if (!dc.deserialize_int(&z, &geompos)) { break; }