Do more of line simplification with integer coordinates (#113)

* Turn off unit, which has bit-rotted

* Instrument line simplification

* Do more work in integer space

* Update tests with simplification done with more integers

* Clean up

* Update changelog

* Eradicate calls to deprecated sprintf()

* Revert "Turn off unit, which has bit-rotted"

This reverts commit 998779313f.

* Fix catch by switching to an unsigned type
This commit is contained in:
Erica Fischer
2023-07-10 15:54:21 -07:00
committed by GitHub
parent b09a880822
commit c1051232ad
59 changed files with 282 additions and 280 deletions
+4 -4
View File
@@ -2331,11 +2331,11 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
p.full_keys.push_back("point_count_abbreviated");
sv4.type = mvt_string;
if (point_count >= 10000) {
sprintf(abbrev, "%.0fk", point_count / 1000.0);
snprintf(abbrev, sizeof(abbrev), "%.0fk", point_count / 1000.0);
} else if (point_count >= 1000) {
sprintf(abbrev, "%.1fk", point_count / 1000.0);
snprintf(abbrev, sizeof(abbrev), "%.1fk", point_count / 1000.0);
} else {
sprintf(abbrev, "%lld", point_count);
snprintf(abbrev, sizeof(abbrev), "%lld", point_count);
}
sv4.s = abbrev;
p.full_values.push_back(sv4);
@@ -3021,7 +3021,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *stringpool, std::atomic<
int subfd[TEMP_FILES];
for (size_t j = 0; j < TEMP_FILES; j++) {
char geomname[strlen(tmpdir) + strlen("/geom.XXXXXXXX" XSTRINGIFY(INT_MAX)) + 1];
sprintf(geomname, "%s/geom%zu.XXXXXXXX", tmpdir, j);
snprintf(geomname, sizeof(geomname), "%s/geom%zu.XXXXXXXX", tmpdir, j);
subfd[j] = mkstemp_cloexec(geomname);
// printf("%s\n", geomname);
if (subfd[j] < 0) {