diff options
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index a1c774e..067a065 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -949,7 +949,10 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, } bytes_used = (int)(dtp->u.p.current_unit->recl - - dtp->u.p.current_unit->bytes_left); + - dtp->u.p.current_unit->bytes_left); + + if (is_stream_io(dtp)) + bytes_used = 0; switch (t) { @@ -1156,9 +1159,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, case FMT_TR: consume_data_flag = 0; - pos = bytes_used + f->u.n + dtp->u.p.skips; - dtp->u.p.skips = f->u.n + dtp->u.p.skips; - dtp->u.p.pending_spaces = pos - dtp->u.p.max_pos; + dtp->u.p.skips += f->u.n; + pos = bytes_used + dtp->u.p.skips - 1; + dtp->u.p.pending_spaces = pos - dtp->u.p.max_pos + 1; /* Writes occur just before the switch on f->format, above, so that trailing blanks are suppressed, unless we are doing a @@ -1188,8 +1191,6 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len, if (bytes_used == 0) { dtp->u.p.pending_spaces -= f->u.n; - dtp->u.p.pending_spaces = dtp->u.p.pending_spaces < 0 ? 0 - : dtp->u.p.pending_spaces; dtp->u.p.skips -= f->u.n; dtp->u.p.skips = dtp->u.p.skips < 0 ? 0 : dtp->u.p.skips; } |