From bcac9faa921fc6902abf6fbf4743f661fc8a5375 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 9 Feb 2019 21:38:32 -0800 Subject: [PATCH] pspp-dump-sav: Be consistent about variable numbering. Dictionary indexes are 1-based but this printed them starting from zero, so that the value labels (and weight) variable didn't match up properly. Bug #55673. --- doc/dev/system-file-format.texi | 8 ++++---- utilities/pspp-dump-sav.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/dev/system-file-format.texi b/doc/dev/system-file-format.texi index e75d3e06dd..500d74f665 100644 --- a/doc/dev/system-file-format.texi +++ b/doc/dev/system-file-format.texi @@ -316,10 +316,10 @@ so readers should take care to parse dummy variable records in the same way as other variable records. @anchor{Dictionary Index} -The @dfn{dictionary index} of a variable is its offset in the set of +The @dfn{dictionary index} of a variable is a 1-based offset in the set of variable records, including dummy variable records for long string -variables. The first variable record has a dictionary index of 0, the -second has a dictionary index of 1, and so on. +variables. The first variable record has a dictionary index of 1, the +second has a dictionary index of 2, and so on. The system file format does not directly support string variables wider than 255 bytes. Such very long string variables are represented @@ -600,7 +600,7 @@ Number of variables that the associated value labels from the value label record are to be applied. @item int32 vars[]; -A list of dictionary indexes of variables to which to apply the value +A list of 1-based dictionary indexes of variables to which to apply the value labels (@pxref{Dictionary Index}). There are @code{var_count} elements. diff --git a/utilities/pspp-dump-sav.c b/utilities/pspp-dump-sav.c index b0001ac61f..1d8d78c877 100644 --- a/utilities/pspp-dump-sav.c +++ b/utilities/pspp-dump-sav.c @@ -401,7 +401,7 @@ read_variable_record (struct sfm_reader *r) char name[9]; printf ("%08llx: variable record #%d\n", - (long long int) ftello (r->file), r->n_variable_records++); + (long long int) ftello (r->file), ++r->n_variable_records); width = read_int (r); has_variable_label = read_int (r); -- 2.30.2