Skip to content

Commit

Permalink
Avoid initializing drop state with known-bad values
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Jul 17, 2023
1 parent 81a4342 commit eb3b57d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions drop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ int calc_feature_minzoom(struct index *ix, struct drop_state ds[], int maxzoom,
}

void prep_drop_states(struct drop_state ds[], int maxzoom, int basezoom, double droprate) {
if (basezoom < 0) {
basezoom = maxzoom;
}

// Needs to be signed for interval calculation
for (ssize_t i = 0; i <= maxzoom; i++) {
ds[i].previndex = 0;
Expand Down
6 changes: 5 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,11 @@ void radix(std::vector<struct reader> &readers, int nreaders, FILE *geomfile, FI
}

struct drop_state ds[maxzoom + 1];
prep_drop_states(ds, maxzoom, basezoom, droprate);
if (maxzoom < 0 || droprate <= 0) { // not guessed with -zg yet
prep_drop_states(ds, 0, 0, 1);
} else {
prep_drop_states(ds, maxzoom, basezoom, droprate);
}

long long progress = 0, progress_max = geom_total, progress_reported = -1;
long long availfiles_before = availfiles;
Expand Down

0 comments on commit eb3b57d

Please sign in to comment.