pspp-dump-sav: Be consistent about variable numbering.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Feb 2019 05:38:32 +0000 (21:38 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Feb 2019 05:38:32 +0000 (21:38 -0800)
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
utilities/pspp-dump-sav.c

index e75d3e06dd4d4f62d30632e3845584776aef883a..500d74f66556fcff16d9ef14cf547a2375b8ee2e 100644 (file)
@@ -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.
 
index b0001ac61fa471b95474c882a41b20f2a9ca587e..1d8d78c87739a9fbd999f952a8137b567698e19d 100644 (file)
@@ -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);