sys-file-reader: Tolerate nominal case size of 0 without warning.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 29 Jul 2017 23:16:30 +0000 (16:16 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 29 Jul 2017 23:59:02 +0000 (16:59 -0700)
The software at https://github.com/WizardMac/ReadStat seems to always write
0, so there's not much value in warning.

doc/dev/system-file-format.texi
src/data/sys-file-reader.c

index fb131f5274f0d61e90f9eefdf0c994c413b7e468..e52b9571166a25b477a8f6263f34d0960b9f0423 100644 (file)
@@ -232,8 +232,8 @@ file's integer endianness (@pxref{System File Format}).
 Number of data elements per case.  This is the number of variables,
 except that long string variables add extra data elements (one for every
 8 characters after the first 8).  However, string variables do not
 Number of data elements per case.  This is the number of variables,
 except that long string variables add extra data elements (one for every
 8 characters after the first 8).  However, string variables do not
-contribute to this value beyond the first 255 bytes.   Further, system
-files written by some systems set this value to -1.  In general, it is
+contribute to this value beyond the first 255 bytes.   Further, some
+software always writes -1 or 0 in this field.  In general, it is
 unsafe for systems reading system files to rely upon this value.
 
 @item int32 compression;
 unsafe for systems reading system files to rely upon this value.
 
 @item int32 compression;
index 54788deb6e217bb918d8873077e2cb305ffbea77..5e5dc8b144f33c81d2b275be66504e62d833b762 100644 (file)
@@ -861,7 +861,7 @@ sfm_decode (struct any_reader *r_, const char *encoding,
      amount that the header claims.  SPSS version 13 gets this
      wrong when very long strings are involved, so don't warn in
      that case. */
      amount that the header claims.  SPSS version 13 gets this
      wrong when very long strings are involved, so don't warn in
      that case. */
-  if (r->header.nominal_case_size != -1
+  if (r->header.nominal_case_size > 0
       && r->header.nominal_case_size != r->n_vars
       && r->info.version_major != 13)
     sys_warn (r, -1, _("File header claims %d variable positions but "
       && r->header.nominal_case_size != r->n_vars
       && r->info.version_major != 13)
     sys_warn (r, -1, _("File header claims %d variable positions but "