aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/transfer.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-07-22 14:07:19 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-07-22 14:07:19 +0000
commit94e2b58a2886f36597e5dc16282f84d8ebefff72 (patch)
treefcec375eaaebffa27d8cb8491cb445907311a0ca /libgfortran/io/transfer.c
parent17c7e33e8c288eda8ec9316dad5daea43299f584 (diff)
downloadgcc-94e2b58a2886f36597e5dc16282f84d8ebefff72.zip
gcc-94e2b58a2886f36597e5dc16282f84d8ebefff72.tar.gz
gcc-94e2b58a2886f36597e5dc16282f84d8ebefff72.tar.bz2
[multiple changes]
2005-07-22 Jerry DeLisle <jvdelisle@verizon.net> PR libfortran/21875 (FM111.f) * io/read.c (next_char): Return a ' ' character when BLANK_ZERO or BLANK_NULL are active. (read_decimal): Interpret ' ' character correctly for BZ or BN. (read_radix): Interpret ' ' character correctly for BZ or BN. (read_f): Interpret ' ' character correctly for BZ or BN. 2005-07-22 Paul Thomas <pault@gcc.gnu.org> PR libfortran/22570 * read.c (read_x): Correct the condition for doing the x-editing during formatted input. * transfer.c (formatted_transfer): Cast offset difference as int, clean-up arithmetic with new variable, bytes_used, zero counters for FMT_SLASH, (data_transfer_init) Zero X- and T-editing counters unconditionally. (next_record_w) Zero X- and T-editing counters. unconditionally. From-SVN: r102284
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r--libgfortran/io/transfer.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 161e5cc..85d0dd9 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -444,7 +444,7 @@ require_type (bt expected, bt actual, fnode * f)
static void
formatted_transfer (bt type, void *p, int len)
{
- int pos;
+ int pos, bytes_used;
fnode *f;
format_token t;
int n;
@@ -489,10 +489,12 @@ formatted_transfer (bt type, void *p, int len)
|| t == FMT_STRING))
{
write_x (skips, pending_spaces);
- max_pos = current_unit->recl - current_unit->bytes_left;
+ max_pos = (int)(current_unit->recl - current_unit->bytes_left);
skips = pending_spaces = 0;
}
+ bytes_used = (int)(current_unit->recl - current_unit->bytes_left);
+
switch (t)
{
case FMT_I:
@@ -687,8 +689,8 @@ formatted_transfer (bt type, void *p, int len)
case FMT_TR:
consume_data_flag = 0 ;
- pos = current_unit->recl - current_unit->bytes_left + f->u.n;
- skips = f->u.n;
+ pos = bytes_used + f->u.n + skips;
+ skips = f->u.n + skips;
pending_spaces = pos - max_pos;
/* Writes occur just before the switch on f->format, above, so that
@@ -701,7 +703,7 @@ formatted_transfer (bt type, void *p, int len)
case FMT_TL:
case FMT_T:
if (f->format == FMT_TL)
- pos = current_unit->recl - current_unit->bytes_left - f->u.n;
+ pos = bytes_used - f->u.n;
else /* FMT_T */
{
consume_data_flag = 0;
@@ -714,7 +716,7 @@ formatted_transfer (bt type, void *p, int len)
bring us back again. */
pos = pos < 0 ? 0 : pos;
- skips = skips + pos - (current_unit->recl - current_unit->bytes_left);
+ skips = skips + pos - bytes_used;
pending_spaces = pending_spaces + pos - max_pos;
if (skips == 0)
@@ -776,6 +778,8 @@ formatted_transfer (bt type, void *p, int len)
case FMT_SLASH:
consume_data_flag = 0 ;
+ skips = pending_spaces = 0;
+ current_unit->bytes_left = 0;
next_record (0);
break;
@@ -1225,8 +1229,7 @@ data_transfer_init (int read_flag)
}
/* Reset counters for T and X-editing. */
- if (current_unit->flags.form == FORM_FORMATTED)
- max_pos = skips = pending_spaces = 0;
+ max_pos = skips = pending_spaces = 0;
/* Start the data transfer if we are doing a formatted transfer. */
if (current_unit->flags.form == FORM_FORMATTED && !ioparm.list_format
@@ -1339,6 +1342,9 @@ next_record_w (void)
int length;
char *p;
+ /* Zero counters for X- and T-editing. */
+ max_pos = skips = pending_spaces = 0;
+
switch (current_mode ())
{
case FORMATTED_DIRECT: