mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Fix the pointer bug that was causing the crash
This commit is contained in:
+4
-3
@@ -277,7 +277,7 @@ void serialize_feature(FILE *geomfile, serial_feature *sf, std::atomic<long long
|
|||||||
write_geometry(sf->geometry, geom, wx, wy);
|
write_geometry(sf->geometry, geom, wx, wy);
|
||||||
serialize_ulong_long(geomfile, geom.size(), geompos, fname);
|
serialize_ulong_long(geomfile, geom.size(), geompos, fname);
|
||||||
fwrite_check(geom.c_str(), sizeof(char), geom.size(), geomfile, fname);
|
fwrite_check(geom.c_str(), sizeof(char), geom.size(), geomfile, fname);
|
||||||
geompos += geom.size();
|
*geompos += geom.size();
|
||||||
|
|
||||||
if (sf->index != 0) {
|
if (sf->index != 0) {
|
||||||
serialize_ulong_long(geomfile, sf->index, geompos, fname);
|
serialize_ulong_long(geomfile, sf->index, geompos, fname);
|
||||||
@@ -342,8 +342,9 @@ serial_feature deserialize_feature(FILE *geoms, std::atomic<long long> *geompos_
|
|||||||
|
|
||||||
std::string geom;
|
std::string geom;
|
||||||
geom.resize(geom_len);
|
geom.resize(geom_len);
|
||||||
if (fread((void *) geom.c_str(), sizeof(char), geom_len, geoms) != geom_len) {
|
size_t n = fread((void *) geom.c_str(), sizeof(char), geom_len, geoms);
|
||||||
fprintf(stderr, "Short read (%llu) from geometry\n", geom_len);
|
if (n != geom_len) {
|
||||||
|
fprintf(stderr, "Short read (%zu for %zu) from geometry\n", n, geom.size());
|
||||||
exit(EXIT_READ);
|
exit(EXIT_READ);
|
||||||
}
|
}
|
||||||
*geompos_in += geom_len;
|
*geompos_in += geom_len;
|
||||||
|
|||||||
Reference in New Issue
Block a user