summaryrefslogtreecommitdiff
path: root/libgfortran/io/transfer.c
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-09 21:51:39 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-09 21:51:39 +0000
commitfd4e76d2eaf12c314869a4ed5813b67ea4e1026a (patch)
treef373d27e1481d619ffecd03c0e976bc2f878ccbe /libgfortran/io/transfer.c
parent50819eed9737858b7c703e039bfea742ba8869e5 (diff)
downloadgcc-fd4e76d2eaf12c314869a4ed5813b67ea4e1026a.tar.gz
2007-03-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/31099 * io/open.c (new_unit): Initialize bytes_left and recl_subrecord. * io/transfer.c (next_record_w): Set bytes left to record length for sequential unformatted I/O. (next_record_r): Ditto. (read_block_direct): Fix test for exceeding bytes_left. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122763 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r--libgfortran/io/transfer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index a7632da55ae..42f82493942 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -434,11 +434,10 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t *nbytes)
/* Check whether we exceed the total record length. */
- if (dtp->u.p.current_unit->flags.has_recl)
+ if (dtp->u.p.current_unit->flags.has_recl
+ && (*nbytes > (size_t) dtp->u.p.current_unit->bytes_left))
{
- to_read_record =
- *nbytes > (size_t) dtp->u.p.current_unit->bytes_left ?
- *nbytes : (size_t) dtp->u.p.current_unit->bytes_left;
+ to_read_record = (size_t) dtp->u.p.current_unit->bytes_left;
short_record = 1;
}
else
@@ -2152,6 +2151,7 @@ next_record_r (st_parameter_dt *dtp)
case UNFORMATTED_SEQUENTIAL:
next_record_r_unf (dtp, 1);
+ dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
break;
case FORMATTED_DIRECT:
@@ -2377,6 +2377,7 @@ next_record_w (st_parameter_dt *dtp, int done)
case UNFORMATTED_SEQUENTIAL:
next_record_w_unf (dtp, 0);
+ dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
break;
case FORMATTED_STREAM: