por-file-reader: Tolerate short lines when detecting portable files.
authorBen Pfaff <blp@gnu.org>
Thu, 18 Jun 2009 04:11:10 +0000 (21:11 -0700)
committerBen Pfaff <blp@gnu.org>
Thu, 18 Jun 2009 04:11:10 +0000 (21:11 -0700)
When the portable file reader reads a file, it assumes that a line
shorter than 80 bytes should actually be padded out on the right with
spaces, because this is a fairly common problem in practice, perhaps
due to text editors or other software that drops spaces at the end of
a line.

However, pfm_detect, the function that is supposed to detect whether
a given file is an SPSS portable file, did not apply this heuristic to
the data that it read at the beginning of the file, and thus files in
which the first few lines were truncated this way were not detected
properly as portable files.

This commit fixes the problem by making pfm_detect a little bit
smarter.  It would probably be better to actually unify the
file-reading logic, instead of implementing it in two separate places,
but this appears to work adequately too.

Thanks to Tony Reardon <tony@sir.com.au> for reporting the problem
and supplying a file that demonstrated it.


No differences found