[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PSPP on windows: backtraces.
From: |
John Darrington |
Subject: |
Re: PSPP on windows: backtraces. |
Date: |
Thu, 22 Feb 2007 21:56:24 +0900 |
User-agent: |
Mutt/1.5.9i |
On Wed, Feb 21, 2007 at 07:38:27AM -0800, Ben Pfaff wrote:
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.
You're right.
Looking at the code again, I think the line
fwrite (rec, len, 1, w->file);
is not strictly correct. It ought to read
fwrite (rec, sizeof (*rec), len, w->file);
I'm also wondering if, on mingw32, putc ('\n', w->file) ought not to
be followed by putc ('\r', w->file).
I rather doubt that these changes will fix these crashes, but who
knows ....?
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature