diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2018-01-07 12:17:52 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2018-01-07 12:17:52 +0200 |
commit | ea99ec5bd62c0d14023aac0316f4286193db9434 (patch) | |
tree | 36694f3e28c6ca161e719f0dc4e69779533ff1fa /libgfortran/io/unix.h | |
parent | c7c9468a6c1e21bb140f62d97d427352d90556bc (diff) | |
download | gcc-ea99ec5bd62c0d14023aac0316f4286193db9434.zip gcc-ea99ec5bd62c0d14023aac0316f4286193db9434.tar.gz gcc-ea99ec5bd62c0d14023aac0316f4286193db9434.tar.bz2 |
PR 78534, 83704 Handle large formatted I/O
In order to handle large characters when doing formatted I/O, use
size_t and ptrdiff_t for lengths. Compared to the previous patch,
based on discussions on IRC use size_t for sizes that don't need to be
negative rather than ptrdiff_t everywhere.
Regtested on x86_64-pc-linux-gnu, approved as part of the PR 78534
approval, committed to trunk.
libgfortran/ChangeLog:
2018-01-07 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/78534
PR fortran/83704
* io/fbuf.c (fbuf_init): Use size_t instead of int for length.
(fbuf_debug): Convert debug output to unsigned long.
(fbuf_reset): Use ptrdiff_t for return value.
(fbuf_alloc): Use size_t for length argument.
(fbuf_flush): Handle large buffers.
(fbuf_flush_list): Likewise.
(fbuf_seek): Use ptrdiff_t for offset and return value.
(fbuf_read): Use size_t for length argument.
(fbuf_getc_refill): Use size_t to match fbuf_read.
* io/fbuf.h (struct fbuf): Use size_t for lengths.
(fbuf_init): Use size_t instead of int for length.
(fbuf_reset): Use ptrdiff_t for return value.
(fbuf_alloc): Use size_t for length argument.
(fbuf_seek): Use ptrdiff_t for offset and return value.
(fbuf_read): Use size_t for length argument.
* io/io.h (read_block_form): Likewise.
(read_block_form4): Likewise.
(write_block): Likewise.
(read_a): Likewise.
(read_a_char4): Likewise.
(read_x): Likewise.
(write_a): Likewise.
(write_a_char4): Likewise.
* io/list_read.c (list_formatted_read_scalar): Use size_t to
handle large buffers.
* io/read.c (read_l): Likewise.
(read_utf8): Likewise.
(read_utf8_char1): Likewise.
(read_default_char1): Likewise.
(read_utf8_char4): Likewise.
(read_default_char4): Likewise.
(read_a): Likewise.
(read_a_char4): Likewise.
(eat_leading_spaces): Likewise.
(next_char): Likewise.
(read_decimal): Likewise.
(read_radix): Likewise.
(read_f): Likewise.
(read_x): Likewise.
* io/transfer.c (read_sf_internal): Likewise.
(read_sf): Likewise.
(read_block_form): Likewise.
(read_block_form4): Likewise.
(write_block): Likewise.
(formatted_transfer_scalar_write): Likewise.
(next_record_w): Likewise.
* io/unix.c (mem_alloc_r): Likewise.
(mem_alloc_r4): Likewise.
(mem_alloc_w): Likewise.
(mem_alloc_w4): Likewise.
(mem_read): Likewise.
(mem_read4): Likewise.
(mem_write): Likewise.
(mem_write4): Likewise.
(open_internal): Likewise.
(open_internal4): Likewise.
* io/unix.h (open_internal): Likewise.
(open_internal4): Likewise.
(mem_alloc_w): Likewise.
(mem_alloc_r): Likewise.
(mem_alloc_w4): Likewise.
(mem_alloc_r4): Likewise.
* io/write.c (write_check_cc): Likewise.
(write_cc): Likewise.
(write_a): Likewise.
(write_a_char4): Likewise.
From-SVN: r256322
Diffstat (limited to 'libgfortran/io/unix.h')
-rw-r--r-- | libgfortran/io/unix.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h index 8d12631..9ad6dfa 100644 --- a/libgfortran/io/unix.h +++ b/libgfortran/io/unix.h @@ -108,22 +108,22 @@ internal_proto(compare_files); extern stream *open_external (st_parameter_open *, unit_flags *); internal_proto(open_external); -extern stream *open_internal (char *, int, gfc_offset); +extern stream *open_internal (char *, size_t, gfc_offset); internal_proto(open_internal); -extern stream *open_internal4 (char *, int, gfc_offset); +extern stream *open_internal4 (char *, size_t, gfc_offset); internal_proto(open_internal4); -extern char *mem_alloc_w (stream *, int *); +extern char *mem_alloc_w (stream *, size_t *); internal_proto(mem_alloc_w); -extern char *mem_alloc_r (stream *, int *); +extern char *mem_alloc_r (stream *, size_t *); internal_proto(mem_alloc_r); -extern gfc_char4_t *mem_alloc_w4 (stream *, int *); +extern gfc_char4_t *mem_alloc_w4 (stream *, size_t *); internal_proto(mem_alloc_w4); -extern char *mem_alloc_r4 (stream *, int *); +extern char *mem_alloc_r4 (stream *, size_t *); internal_proto(mem_alloc_r4); extern stream *input_stream (void); |