From 4363c7a151e39e56d7c4821f7e323c819a471743 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Thu, 23 Sep 2010 00:53:15 +0000 Subject: [PATCH] re PR fortran/45710 (Adjust format and padding for WRITE of NAMELIST group to internal file) 2010-09-22 Jerry DeLisle PR libfortran/45710 * io/write.c (namelist_write_newline): Pad character array internal unit records with spaces. From-SVN: r164543 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/write.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8411513a819a..c462a2a5421c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2010-09-22 Jerry DeLisle + + PR libfortran/45710 + * io/write.c (namelist_write_newline): Pad character array internal + unit records with spaces. + 2010-09-21 Jerry DeLisle PR libfortran/45723 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index e811c47baefb..fabbaffc9e94 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1630,6 +1630,20 @@ namelist_write_newline (st_parameter_dt *dtp) { gfc_offset record; int finished; + char *p; + int length = dtp->u.p.current_unit->bytes_left; + + p = write_block (dtp, length); + if (p == NULL) + return; + + if (unlikely (is_char4_unit (dtp))) + { + gfc_char4_t *p4 = (gfc_char4_t *) p; + memset4 (p4, ' ', length); + } + else + memset (p, ' ', length); /* Now that the current record has been padded out, determine where the next record in the array is. */ -- 2.39.5