aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/open.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2007-05-27 00:15:22 +0300
committerJanne Blomqvist <jb@gcc.gnu.org>2007-05-27 00:15:22 +0300
commit88fdfd5a86d9873cb5e25851a68963253d707761 (patch)
tree284b051453fcf4ab80253b550ab8f310e5e3a4ec /libgfortran/io/open.c
parentc132497f1bf72635ce53a12dac9e432f0cdb8984 (diff)
downloadgcc-88fdfd5a86d9873cb5e25851a68963253d707761.zip
gcc-88fdfd5a86d9873cb5e25851a68963253d707761.tar.gz
gcc-88fdfd5a86d9873cb5e25851a68963253d707761.tar.bz2
string.c (compare0): Use gfc_charlen_type instead of int.
2007-05-27 Janne Blomqvist <jb@gcc.gnu.org> * runtime/string.c (compare0): Use gfc_charlen_type instead of int. (fstrlen): Likewise. (find_option): Likewise. (fstrcpy): Use gfc_charlen_type instead of int, return length. (cf_strcpy): Likewise. * libgfortran.h: Change string prototypes to use gfc_charlen_type. * io/open.c (new_unit): Use snprintf if available. * io/list_read.c (nml_touch_nodes): Use memcpy instead of strcpy/strcat. (nml_read_obj): Likewise. * io/transfer.c (st_set_nml_var): Likewise. * io/write.c (output_float): Use snprintf if available. (nml_write_obj) Use memcpy instead of strcpy/strcat. From-SVN: r125100
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r--libgfortran/io/open.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 55c3769..68be74b 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -345,7 +345,12 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
break;
opp->file = tmpname;
+#ifdef HAVE_SNPRINTF
+ opp->file_len = snprintf(opp->file, sizeof (tmpname), "fort.%d",
+ (int) opp->common.unit);
+#else
opp->file_len = sprintf(opp->file, "fort.%d", (int) opp->common.unit);
+#endif
break;
default: