From: Ben Pfaff Date: Sat, 9 Jan 2021 06:16:11 +0000 (-0800) Subject: spv-legacy-decoder: Set data_index and presentation_index in leaves. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db9550227e0861cb1bfe139da6b0c6f389d7b368;p=pspp spv-legacy-decoder: Set data_index and presentation_index in leaves. This allows the new assertions in clone_category() to pass. --- diff --git a/src/output/pivot-table.c b/src/output/pivot-table.c index 5bcc6dc7cc..01a4a859f1 100644 --- a/src/output/pivot-table.c +++ b/src/output/pivot-table.c @@ -988,7 +988,10 @@ clone_category (struct pivot_category *old, if (pivot_category_is_leaf (old)) { + assert (new->data_index < new_dimension->n_leaves); new->dimension->data_leaves[new->data_index] = new; + + assert (new->presentation_index < new_dimension->n_leaves); new->dimension->presentation_leaves[new->presentation_index] = new; } diff --git a/src/output/spv/spv-legacy-decoder.c b/src/output/spv/spv-legacy-decoder.c index b8005de5be..78b1780b17 100644 --- a/src/output/spv/spv-legacy-decoder.c +++ b/src/output/spv/spv-legacy-decoder.c @@ -1272,6 +1272,11 @@ add_dimension (struct spv_series **series, size_t n, /* Now drop unnamed 1-category groups and add parent pointers. */ for (size_t j = 0; j < n_cats; j++) add_parents (cats[j], d->root, j); + for (size_t j = 0; j < d->n_leaves; j++) + { + d->data_leaves[j]->data_index = j; + d->presentation_leaves[j]->presentation_index = j; + } d->root->subs = cats; d->root->n_subs = n_cats;