2000-08-29  Ulrich Drepper  <drepper@redhat.com>

	* libio/iogetline.c: Set mode before the loop in case n==0.
	* libio/iogetwline.c: Likewise.

2000-08-29  H.J. Lu  <hjl@gnu.org>

	* libio/fileops.c (new_do_write): Check fp->_mode <= 0 instead
	of fp->_mode < 0.
	(_IO_new_file_overflow): Likewise.
	* libio/genops.c (_IO_flush_all): Likewise.
	* libio/ioftell.c (_IO_ftell): Likewise.
This commit is contained in:
Ulrich Drepper 2000-08-29 22:41:42 +00:00
parent c7c3b0e907
commit 076bfcf612
6 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,16 @@
2000-08-29 Ulrich Drepper <drepper@redhat.com>
* libio/iogetline.c: Set mode before the loop in case n==0.
* libio/iogetwline.c: Likewise.
2000-08-29 H.J. Lu <hjl@gnu.org>
* libio/fileops.c (new_do_write): Check fp->_mode <= 0 instead
of fp->_mode < 0.
(_IO_new_file_overflow): Likewise.
* libio/genops.c (_IO_flush_all): Likewise.
* libio/ioftell.c (_IO_ftell): Likewise.
2000-08-29 Akira Higuchi <a@kondara.org>
* iconv/gconv_db.c (increment_counter): Reset __init_fct, __fct,

View File

@ -411,7 +411,7 @@ new_do_write (fp, data, to_do)
fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
fp->_IO_write_end = (fp->_mode < 0
fp->_IO_write_end = (fp->_mode <= 0
&& (fp->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
? fp->_IO_buf_base : fp->_IO_buf_end);
return count;
@ -516,7 +516,7 @@ _IO_new_file_overflow (f, ch)
f->_IO_read_base = f->_IO_read_ptr = f->_IO_read_end;
f->_flags |= _IO_CURRENTLY_PUTTING;
if (f->_mode < 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
if (f->_mode <= 0 && f->_flags & (_IO_LINE_BUF+_IO_UNBUFFERED))
f->_IO_write_end = f->_IO_write_ptr;
}
if (ch == EOF)

View File

@ -754,7 +754,7 @@ _IO_flush_all ()
int result = 0;
struct _IO_FILE *fp;
for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|| (fp->_vtable_offset == 0
&& fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
/* Copyright (C) 1993, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
@ -39,7 +39,7 @@ _IO_ftell (fp)
pos = _IO_seekoff (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_vtable_offset != 0 || fp->_mode < 0)
if (fp->_vtable_offset != 0 || fp->_mode <= 0)
pos -= fp->_IO_save_end - fp->_IO_save_base;
else
/* XXX For now. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
@ -59,6 +59,8 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
char *ptr = buf;
if (eof != NULL)
*eof = 0;
if (__builtin_expect (fp->_mode, -1) == 0)
_IO_fwide (fp, -1);
while (n != 0)
{
_IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;

View File

@ -64,6 +64,8 @@ _IO_getwline_info (fp, buf, n, delim, extract_delim, eof)
wchar_t *ptr = buf;
if (eof != NULL)
*eof = 0;
if (__builtin_expect (fp->_mode, 1) == 0)
_IO_fwide (fp, 1);
while (n != 0)
{
_IO_ssize_t len = (fp->_wide_data->_IO_read_end