basic_file_stdio.cc (__gnu_internal::fopen_mode): New function.
2004-02-04 Benjamin Kosnik <bkoz@redhat.com> Zack Weinberg <zack@codesourcery.com> * config/io/basic_file_stdio.cc (__gnu_internal::fopen_mode): New function. (__basic_file<char>::sys_open, __basic_file<char>::open): Use it. (__basic_file<char>::_M_open_mode): Delete. * config/io/basic_file_stdio.cc: Delete declaration of _M_open_mode. * testsuite/27_io/basic_filebuf/close/char/9964.cc * testsuite/27_io/basic_filebuf/open/char/9507.cc: Correct flags to filebuf::open calls. * config/abi/alpha-freebsd5/baseline_symbols.txt * config/abi/alpha-linux-gnu/baseline_symbols.txt * config/abi/hppa-linux-gnu/baseline_symbols.txt * config/abi/i386-freebsd4/baseline_symbols.txt * config/abi/i386-freebsd5/baseline_symbols.txt * config/abi/i486-linux-gnu/baseline_symbols.txt * config/abi/ia64-linux-gnu/baseline_symbols.txt * config/abi/mips-linux-gnu/baseline_symbols.txt * config/abi/sparc-freebsd5/baseline_symbols.txt * config/abi/sparc-linux-gnu/baseline_symbols.txt * config/abi/x86_64-linux-gnu/baseline_symbols.txt: Remove entry for __basic_file<char>::_M_open_mode. From-SVN: r77298
This commit is contained in:
parent
f583e45212
commit
6a734d618f
|
@ -1,3 +1,29 @@
|
|||
2004-02-04 Benjamin Kosnik <bkoz@redhat.com>
|
||||
Zack Weinberg <zack@codesourcery.com>
|
||||
|
||||
* config/io/basic_file_stdio.cc (__gnu_internal::fopen_mode):
|
||||
New function.
|
||||
(__basic_file<char>::sys_open, __basic_file<char>::open): Use it.
|
||||
(__basic_file<char>::_M_open_mode): Delete.
|
||||
* config/io/basic_file_stdio.cc: Delete declaration of _M_open_mode.
|
||||
|
||||
* testsuite/27_io/basic_filebuf/close/char/9964.cc
|
||||
* testsuite/27_io/basic_filebuf/open/char/9507.cc:
|
||||
Correct flags to filebuf::open calls.
|
||||
|
||||
* config/abi/alpha-freebsd5/baseline_symbols.txt
|
||||
* config/abi/alpha-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/hppa-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/i386-freebsd4/baseline_symbols.txt
|
||||
* config/abi/i386-freebsd5/baseline_symbols.txt
|
||||
* config/abi/i486-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/ia64-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/mips-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/sparc-freebsd5/baseline_symbols.txt
|
||||
* config/abi/sparc-linux-gnu/baseline_symbols.txt
|
||||
* config/abi/x86_64-linux-gnu/baseline_symbols.txt:
|
||||
Remove entry for __basic_file<char>::_M_open_mode.
|
||||
|
||||
2004-02-04 Loren J. Rittle <ljrittle@acm.org>
|
||||
|
||||
* testsuite/performance/20_util/allocator/insert.cc (main): Tweak.
|
||||
|
@ -6,16 +32,16 @@
|
|||
|
||||
* testsuite/performance/20_util/producer_consumer.cc: New.
|
||||
* testsuite/performance/20_util/allocator/insert_insert.cc: Two loops.
|
||||
|
||||
|
||||
2004-02-04 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
|
||||
* testsuite/performance/20_util/allocator.cc: Move to..
|
||||
* testsuite/performance/20_util/allocator/insert.cc: ...here.
|
||||
* testsuite/performance/20_util/allocator/insert.cc: ...here.
|
||||
* testsuite/performance/20_util/allocator_thread.cc: Move to...
|
||||
* testsuite/performance/20_util/allocator/insert_insert.cc: ...here.
|
||||
* testsuite/performance/20_util/allocator_map_thread.cc: Move to...
|
||||
* testsuite/performance/20_util/allocator/map_thread.cc: ...here.
|
||||
|
||||
|
||||
2004-02-04 Jonathan Wakely <redi@gcc.gnu.org>
|
||||
|
||||
* docs/html/faq/index.html: Recommend using LD_LIBRARY_PATH.
|
||||
|
@ -32,11 +58,11 @@
|
|||
|
||||
2004-02-03 Felix Yen <fwy@alumni.brown.edu>
|
||||
Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
|
||||
* testsuite/performance/20_util/allocator.cc: Add map,
|
||||
deque, set tests.
|
||||
* testsuite/performance/20_util/allocator_thread.cc: Same.
|
||||
|
||||
|
||||
2004-02-03 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/bits/basic_string.h (insert(iterator)): Remove,
|
||||
|
@ -71,29 +97,29 @@
|
|||
|
||||
2004-02-02 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* docs/html/19_diagnostics/howto.html: Move verbose terminate
|
||||
documentation...
|
||||
* docs/html/18_support/howto.html: Here.
|
||||
* docs/html/documentation.html: Add reference here.
|
||||
|
||||
* docs/html/19_diagnostics/howto.html: Move verbose terminate
|
||||
documentation...
|
||||
* docs/html/18_support/howto.html: Here.
|
||||
* docs/html/documentation.html: Add reference here.
|
||||
|
||||
2004-02-02 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* config/locale/gnu/c++locale_internal.h: Remove prototypes
|
||||
of no longer used GLIBC thread locale functions.
|
||||
|
||||
2004-02-02 Eric Christopher <echristo@redhat.com>
|
||||
Zack Weinberg <zack@codesourcery.com>
|
||||
Zack Weinberg <zack@codesourcery.com>
|
||||
|
||||
* testsuite/22_locale/collate/compare/wchar_t/2.cc: Remove xfail. Use
|
||||
-finput-charset.
|
||||
* testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc: Ditto
|
||||
-finput-charset.
|
||||
* testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc: Ditto
|
||||
* testsuite/22_locale/collate/hash/wchar_t/2.cc: Ditto.
|
||||
* testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/2.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc:
|
||||
* testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/2.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc: Ditto.
|
||||
* testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc:
|
||||
Ditto.
|
||||
|
||||
2004-02-02 Paolo Carlini <pcarlini@suse.de>
|
||||
|
@ -380,10 +406,10 @@
|
|||
|
||||
PR libstdc++/11584
|
||||
* include/bits/ios_base.h (ios_base::_M_grow_words): Add
|
||||
iword/pword selector.
|
||||
iword/pword selector.
|
||||
(ios_base::iword, ios_base::pword): Use it.
|
||||
* src/ios.cc (ios_base::_M_grow_words): Clear _M_word_zero
|
||||
iword or pword member on alloc failure.
|
||||
iword or pword member on alloc failure.
|
||||
* testsuite/27_io/ios_base/storage/11584.cc: New test.
|
||||
|
||||
2004-01-27 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
@ -964,28 +990,28 @@
|
|||
* include/bits/stl_list.h:
|
||||
* include/bits/list.tc:
|
||||
* src/list.cc:
|
||||
Performance enhancements for destructor, push_front(),
|
||||
push_back(), pop_front(), pop_back(), sort()
|
||||
Eliminated static_casts where possible.
|
||||
Moved code out of header files into new src/list.cc
|
||||
implementation file for library where possible.
|
||||
Remove inheritance from iterator class and create separate
|
||||
classes for non-constant and constant iterators.
|
||||
Performance enhancements for destructor, push_front(),
|
||||
push_back(), pop_front(), pop_back(), sort()
|
||||
Eliminated static_casts where possible.
|
||||
Moved code out of header files into new src/list.cc
|
||||
implementation file for library where possible.
|
||||
Remove inheritance from iterator class and create separate
|
||||
classes for non-constant and constant iterators.
|
||||
* include/bits/stl_tree.h (_Rb_tree class):
|
||||
* src/tree.cc:
|
||||
Only erase contents in destructor.
|
||||
Eliminate unnecessary initialization in assignment operator.
|
||||
Optimize for the nominal case by not checking whether
|
||||
container is empty in clear().
|
||||
Re-order test in _M_insert() to improve performance.
|
||||
Move initialization of new node's left & right pointers to
|
||||
src/tree.cc to where new node's colour is initialized
|
||||
and to reduce the amount of inline code.
|
||||
Use _M_leftmost() and _M_end() to improve readability where
|
||||
appropriate.
|
||||
Create separate classes for non-constant and constant
|
||||
iterators to clarify code, avoid extra template parameters and
|
||||
casting away constness.
|
||||
Only erase contents in destructor.
|
||||
Eliminate unnecessary initialization in assignment operator.
|
||||
Optimize for the nominal case by not checking whether
|
||||
container is empty in clear().
|
||||
Re-order test in _M_insert() to improve performance.
|
||||
Move initialization of new node's left & right pointers to
|
||||
src/tree.cc to where new node's colour is initialized
|
||||
and to reduce the amount of inline code.
|
||||
Use _M_leftmost() and _M_end() to improve readability where
|
||||
appropriate.
|
||||
Create separate classes for non-constant and constant
|
||||
iterators to clarify code, avoid extra template parameters and
|
||||
casting away constness.
|
||||
|
||||
2004-01-07 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
|
@ -1040,7 +1066,7 @@
|
|||
redundant #include.
|
||||
|
||||
2004-01-06 Benjamin Kosnik <bkoz@redhat.com>
|
||||
Stefan Olsson <stefan@snon.net>
|
||||
Stefan Olsson <stefan@snon.net>
|
||||
|
||||
* scripts/check_performance: Use -pthread.
|
||||
* testsuite/performance/allocator.cc: Tweaks, add list.
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -982,7 +982,6 @@ FUNC:_ZNSt11__timepunctIwED0Ev@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11__timepunctIwED1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11__timepunctIwED2Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4syncEv@@GLIBCPP_3.2
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -553,7 +553,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -999,7 +999,6 @@ FUNC:_ZNSt11__timepunctIwED0Ev@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11__timepunctIwED1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11__timepunctIwED2Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -982,7 +982,6 @@ FUNC:_ZNSt11__timepunctIwED0Ev@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11__timepunctIwED1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11__timepunctIwED2Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4syncEv@@GLIBCPP_3.2
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -1005,7 +1005,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -946,7 +946,6 @@ FUNC:_ZNSt11range_errorC2ERKSs@@GLIBCPP_3.2
|
|||
FUNC:_ZNSt11range_errorD0Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt11range_errorD1Ev@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE10sys_ungetcEi@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE12_M_open_modeESt13_Ios_OpenmodeRiS2_Pc@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE16showmanyc_helperEv@@GLIBCPP_3.2.3
|
||||
FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCPP_3.2
|
||||
FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCPP_3.2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
@ -70,6 +70,43 @@
|
|||
|
||||
#include <limits> // For <off_t>::max() and min()
|
||||
|
||||
namespace __gnu_internal
|
||||
{
|
||||
// Map ios_base::openmode flags to a string for use in fopen().
|
||||
// Table of valid combinations as given in [lib.filebuf.members]/2.
|
||||
static const char*
|
||||
fopen_mode(std::ios_base::openmode mode)
|
||||
{
|
||||
enum
|
||||
{
|
||||
in = std::ios_base::in,
|
||||
out = std::ios_base::out,
|
||||
trunc = std::ios_base::trunc,
|
||||
app = std::ios_base::app,
|
||||
binary = std::ios_base::binary
|
||||
};
|
||||
|
||||
switch (mode & (in|out|trunc|app|binary))
|
||||
{
|
||||
case ( out ): return "w";
|
||||
case ( out |app ): return "a";
|
||||
case ( out|trunc ): return "w";
|
||||
case (in ): return "r";
|
||||
case (in|out ): return "r+";
|
||||
case (in|out|trunc ): return "w+";
|
||||
|
||||
case ( out |binary): return "wb";
|
||||
case ( out |app|binary): return "ab";
|
||||
case ( out|trunc |binary): return "wb";
|
||||
case (in |binary): return "rb";
|
||||
case (in|out |binary): return "r+b";
|
||||
case (in|out|trunc |binary): return "w+b";
|
||||
|
||||
default: return 0; // invalid
|
||||
}
|
||||
}
|
||||
} // namespace __gnu_internal
|
||||
|
||||
namespace std
|
||||
{
|
||||
// Definitions for __basic_file<char>.
|
||||
|
@ -79,53 +116,6 @@ namespace std
|
|||
__basic_file<char>::~__basic_file()
|
||||
{ this->close(); }
|
||||
|
||||
void
|
||||
__basic_file<char>::_M_open_mode(ios_base::openmode __mode, int& __p_mode,
|
||||
int&, char* __c_mode)
|
||||
{
|
||||
bool __testb = __mode & ios_base::binary;
|
||||
bool __testi = __mode & ios_base::in;
|
||||
bool __testo = __mode & ios_base::out;
|
||||
bool __testt = __mode & ios_base::trunc;
|
||||
bool __testa = __mode & ios_base::app;
|
||||
|
||||
// Set __c_mode for use in fopen.
|
||||
// Set __p_mode for use in open.
|
||||
if (!__testi && __testo && !__testt && !__testa)
|
||||
{
|
||||
strcpy(__c_mode, "w");
|
||||
__p_mode = O_WRONLY | O_CREAT;
|
||||
}
|
||||
if (!__testi && __testo && !__testt && __testa)
|
||||
{
|
||||
strcpy(__c_mode, "a");
|
||||
__p_mode = O_WRONLY | O_CREAT | O_APPEND;
|
||||
}
|
||||
if (!__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
strcpy(__c_mode, "w");
|
||||
__p_mode = O_WRONLY | O_CREAT | O_TRUNC;
|
||||
}
|
||||
|
||||
if (__testi && !__testo && !__testt && !__testa)
|
||||
{
|
||||
strcpy(__c_mode, "r");
|
||||
__p_mode = O_RDONLY;
|
||||
}
|
||||
if (__testi && __testo && !__testt && !__testa)
|
||||
{
|
||||
strcpy(__c_mode, "r+");
|
||||
__p_mode = O_RDWR | O_CREAT;
|
||||
}
|
||||
if (__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
strcpy(__c_mode, "w+");
|
||||
__p_mode = O_RDWR | O_CREAT | O_TRUNC;
|
||||
}
|
||||
if (__testb)
|
||||
strcat(__c_mode, "b");
|
||||
}
|
||||
|
||||
__basic_file<char>*
|
||||
__basic_file<char>::sys_open(__c_file* __file, ios_base::openmode)
|
||||
{
|
||||
|
@ -144,12 +134,9 @@ namespace std
|
|||
__basic_file<char>::sys_open(int __fd, ios_base::openmode __mode)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = 0;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
if (!this->is_open() && (_M_cfile = fdopen(__fd, __c_mode)))
|
||||
const char* __c_mode = __gnu_internal::fopen_mode(__mode);
|
||||
if (__c_mode && !this->is_open()
|
||||
&& (_M_cfile = fdopen(__fd, __c_mode)))
|
||||
{
|
||||
_M_cfile_created = true;
|
||||
if (__fd == 0)
|
||||
|
@ -164,13 +151,8 @@ namespace std
|
|||
int /*__prot*/)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = 0;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
|
||||
if (!this->is_open())
|
||||
const char* __c_mode = __gnu_internal::fopen_mode(__mode);
|
||||
if (__c_mode && !this->is_open())
|
||||
{
|
||||
#ifdef _GLIBCXX_USE_LFS
|
||||
if ((_M_cfile = fopen64(__name, __c_mode)))
|
||||
|
@ -309,5 +291,4 @@ namespace std
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
@ -62,11 +62,7 @@ namespace std
|
|||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0);
|
||||
|
||||
void
|
||||
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
|
||||
char* __c_mode);
|
||||
|
||||
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void test_07()
|
|||
|
||||
filebuf fb;
|
||||
sleep(1);
|
||||
filebuf* ret = fb.open(name, ios_base::out | ios_base::trunc);
|
||||
filebuf* ret = fb.open(name, ios_base::in | ios_base::out);
|
||||
VERIFY( ret != NULL );
|
||||
VERIFY( fb.is_open() );
|
||||
|
||||
|
@ -67,7 +67,7 @@ void test_07()
|
|||
fb.sputc('a');
|
||||
|
||||
ret = fb.close();
|
||||
VERIFY( ret == NULL );
|
||||
VERIFY( ret != NULL );
|
||||
VERIFY( !fb.is_open() );
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,10 @@ void test_06()
|
|||
}
|
||||
|
||||
std::filebuf fbuf;
|
||||
std::filebuf* r = fbuf.open(name, std::ios_base::out | std::ios_base::ate);
|
||||
std::filebuf* r = fbuf.open(name,
|
||||
std::ios_base::in
|
||||
| std::ios_base::out
|
||||
| std::ios_base::ate);
|
||||
VERIFY( !fbuf.is_open() );
|
||||
VERIFY( r == NULL );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue