pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSPP on windows: backtraces.


From: Ben Pfaff
Subject: Re: PSPP on windows: backtraces.
Date: Wed, 21 Feb 2007 07:38:27 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> 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 
address@hidden
http://benpfaff.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]