Commit Graph

13 Commits

Author SHA1 Message Date
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Janne Blomqvist ea99ec5bd6 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
2018-01-07 12:17:52 +02:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Jerry DeLisle f29876bba0 close.c: Fix white space in pointer declarations and comment formats where applicable.
2017-04-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* close.c: Fix white space in pointer declarations and comment
	formats where applicable.
	* fbuf.c: Likewise.
	* fbuf.h: Likewise.
	* format.c: Likewise.
	* inquire.c: Likewise.
	* intrinsics.c: Likewise.
	* list_read.c: Likewise.
	* lock.c: Likewise.
	* open.c: Likewise.
	* read.c: Likewise.
	* transfer.c: Likewise.
	* unit.c: Likewise.
	* unix.c: Likewise.
	* unix.h: Likewise.
	* write.c: Likewise.

From-SVN: r246842
2017-04-11 14:51:25 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Jerry DeLisle 1060d9404d re PR fortran/60956 (error reading (and writing) large text files in gfortran)
2015-02-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/60956
	* io/fbuf.c (fbuf_flush_list): New function that only flushes
	if current fbuf position exceeds a limit.
	* io/fbuf.h: Declare the new function.
	* io/io.h (enum unit_mode): Add two new modes.
	* io/list_read.c (list_formatted_read_scalar): Call new function.
	* io/write.c: Include fbuf.h. (list_formatted_write_scalar):
	Call new function.

From-SVN: r220505
2015-02-07 15:13:15 +00:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Richard Sandiford f0bcf62899 Update copyright years in libgfortran/
From-SVN: r206296
2014-01-02 22:25:45 +00:00
Richard Sandiford e3c063ceda Update copyright years in libgfortran.
From-SVN: r195167
2013-01-14 18:20:58 +00:00
Janne Blomqvist a2c037bdec PR 47694 Read from named pipe fails
Co-Authored-By: Jerry DeLisle <jvdelisle@gcc.gnu.org>

From-SVN: r170432
2011-02-23 08:59:51 +02:00
Janne Blomqvist 872d209423 Move includes after include guards
From-SVN: r154343
2009-11-19 22:23:03 +02:00
Janne Blomqvist a2f560d05c Forgot files from r153825
From-SVN: r153827
2009-11-03 00:14:20 +02:00