From: Ben Pfaff Date: Thu, 18 Jun 2009 04:24:38 +0000 (-0700) Subject: sys-file-reader: Don't warn if compression bias field is 0. X-Git-Tag: v0.6.2-pre1~3 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0faad29b5c735cce9672331681392c2b1f0b5690;p=pspp-builds.git sys-file-reader: Don't warn if compression bias field is 0. Some software writes a value of 0 to the compression bias field. We expect that this field has a value of 100 and warn if we see any other value, but there is no real need to do so (because it is very likely that we can read the file correctly in any case). So suppress the warning if we see a value of 0 here, because it bothers users. Thanks to Tony Reardon for reporting this unnecessary warning. --- diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index e8349abf..fe7b5334 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -425,9 +425,21 @@ read_header (struct sfm_reader *r, struct dictionary *dict, read_bytes (r, raw_bias, sizeof raw_bias); if (float_identify (100.0, raw_bias, sizeof raw_bias, &r->float_format) == 0) { - sys_warn (r, _("Compression bias is not the usual " - "value of 100, or system file uses unrecognized " - "floating-point format.")); + uint8_t zero_bias[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + if (memcmp (raw_bias, zero_bias, 8)) + sys_warn (r, _("Compression bias is not the usual " + "value of 100, or system file uses unrecognized " + "floating-point format.")); + else + { + /* Some software is known to write all-zeros to this + field. Such software also writes floating-point + numbers in the format that we expect by default + (it seems that all software most likely does, in + reality), so don't warn in this case. */ + } + if (r->integer_format == INTEGER_MSB_FIRST) r->float_format = FLOAT_IEEE_DOUBLE_BE; else