John Darrington <[EMAIL PROTECTED]> writes:
> So it looks as if there may be a problem with dfm_put_record.
> Examining that function, I'm suspicious, because:
>
> switch (fh_get_mode (w->fh))
> {
> case FH_MODE_TEXT:
> fwrite (rec, len, 1, w->file);
> putc ('\n', w->file);
> break;
>
> case FH_MODE_BINARY:
> {
> size_t record_width = fh_get_record_width (w->fh);
> size_t write_bytes = MIN (len, record_width);
> size_t pad_bytes = record_width - write_bytes;
> fwrite (rec, write_bytes, 1, w->file);
>
> ... the tests for record_width are not performed in the first case.
> And this case I suspect never arises except under windows. I suggest
> that we start by putting some assertions in the first case of this
> switch and see what happens.
This is probably a red herring. The record width here is the
desired width of the *output* record. Most of the time, the file
handle is set for "text" mode, in which the output takes the form
of lines of text terminating by new-line characters. (This has
little to do with whether the FILE * is opened in text or binary
mode.) In this mode, there's no fixed record width, so the
record width isn't checked.
There could very well be a bug along this path but, if so, it's
more likely to be in one of the callers than right here.
--
Ben Pfaff
[EMAIL PROTECTED]
http://benpfaff.org
_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev