Skip to content

Commit

Permalink
2008-03-28 Jerry DeLisle <[email protected]>
Browse files Browse the repository at this point in the history
	PR libfortran/35699
	* io/transfer.c (write_buf):  Don't pad the record, just return if the
	data is NULL.  (next_record_w): If there are bytes left in the record
	for unformatted direct I/O, pad out the record with zero bytes.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133699 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jvdelisle committed Mar 28, 2008
1 parent 18861bd commit 65cccc9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 7 additions & 0 deletions libgfortran/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2008-03-28 Jerry DeLisle <[email protected]>

PR libfortran/35699
* io/transfer.c (write_buf): Don't pad the record, just return if the
data is NULL. (next_record_w): If there are bytes left in the record
for unformatted direct I/O, pad out the record with zero bytes.

2008-03-28 Tobias Burnus <[email protected]>

PR fortran/35721
Expand Down
14 changes: 8 additions & 6 deletions libgfortran/io/transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,7 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
}

if (buf == NULL && nbytes == 0)
{
char *p;
p = write_block (dtp, dtp->u.p.current_unit->recl);
memset (p, 0, dtp->u.p.current_unit->recl);
return SUCCESS;
}
return SUCCESS;

if (swrite (dtp->u.p.current_unit->s, buf, &nbytes) != 0)
{
Expand Down Expand Up @@ -2493,6 +2488,13 @@ next_record_w (st_parameter_dt *dtp, int done)
break;

case UNFORMATTED_DIRECT:
if (dtp->u.p.current_unit->bytes_left > 0)
{
length = (int) dtp->u.p.current_unit->bytes_left;
p = salloc_w (dtp->u.p.current_unit->s, &length);
memset (p, 0, length);
}

if (sfree (dtp->u.p.current_unit->s) == FAILURE)
goto io_error;
break;
Expand Down

0 comments on commit 65cccc9

Please sign in to comment.