diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-08-29 22:41:42 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-08-29 22:41:42 +0000 |
commit | 076bfcf612a1f774b214e335184d010b60bfad40 (patch) | |
tree | 1b165613e8f1bae3cc7ccd96407a88378283fbec /libio | |
parent | Update. (diff) | |
download | glibc-076bfcf612a1f774b214e335184d010b60bfad40.tar.gz glibc-076bfcf612a1f774b214e335184d010b60bfad40.tar.bz2 glibc-076bfcf612a1f774b214e335184d010b60bfad40.zip |
Update.
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.
Diffstat (limited to 'libio')
-rw-r--r-- | libio/fileops.c | 4 | ||||
-rw-r--r-- | libio/genops.c | 2 | ||||
-rw-r--r-- | libio/ioftell.c | 4 | ||||
-rw-r--r-- | libio/iogetline.c | 4 | ||||
-rw-r--r-- | libio/iogetwline.c | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index a830b5cd43..9f550dd70d 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -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) diff --git a/libio/genops.c b/libio/genops.c index b1ae5afc50..768996f8b4 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -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 diff --git a/libio/ioftell.c b/libio/ioftell.c index e8b6c7a444..fa43b489ec 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -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. */ diff --git a/libio/iogetline.c b/libio/iogetline.c index 9a5f691031..dbea76ffcb 100644 --- a/libio/iogetline.c +++ b/libio/iogetline.c @@ -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; diff --git a/libio/iogetwline.c b/libio/iogetwline.c index 2d9eca0edc..2559cd8eb6 100644 --- a/libio/iogetwline.c +++ b/libio/iogetwline.c @@ -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 |