diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-02 16:21:30 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-02 16:21:30 +0000 |
| commit | 41de110f271fa5d70592edb432c6f09e72182211 (patch) | |
| tree | e52eaced466cf7de7cf45af492ba4bcb23c5d65c /libstdc++-v3/include/tr1/random | |
| parent | 7fefc6e7a0f36666c94f24e90aa84d2c1051059a (diff) | |
| download | ppe42-gcc-41de110f271fa5d70592edb432c6f09e72182211.tar.gz ppe42-gcc-41de110f271fa5d70592edb432c6f09e72182211.zip | |
2007-03-02 Paolo Carlini <pcarlini@suse.de>
* testsuite/thread/pthread1.cc: Include <pthread.h>.
* testsuite/thread/pthread2.cc: Likewise.
* testsuite/thread/pthread3.cc: Likewise.
* testsuite/thread/pthread4.cc: Likewise.
* testsuite/thread/pthread5.cc: Likewise.
* testsuite/thread/pthread6.cc: Likewise.
* testsuite/thread/pthread7-rope.cc: Likewise.
2007-03-02 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/tr1/random (class random_device): Rework to use simple
<cstdio> input, do not include <fstream>.
* include/tr1/random.tcc (all inserters and extractors): Refer
to ios_base as base class of basic_istream or basic_ostream.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/tr1/random')
| -rw-r--r-- | libstdc++-v3/include/tr1/random | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random index 02a7ae7bc85..e8483c7efb9 100644 --- a/libstdc++-v3/include/tr1/random +++ b/libstdc++-v3/include/tr1/random @@ -35,17 +35,16 @@ #ifndef _TR1_RANDOM #define _TR1_RANDOM 1 -#include <bits/stl_algobase.h> -#include <bits/concept_check.h> #include <cmath> -#include <debug/debug.h> -#include <iterator> +#include <cstdio> +#include <string> #include <iosfwd> #include <limits> #include <tr1/type_traits> #include <tr1/cmath> -#include <fstream> #include <ext/type_traits.h> +#include <bits/concept_check.h> +#include <debug/debug.h> namespace std { @@ -1421,14 +1420,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) random_device(const std::string& __token = "/dev/urandom") { if ((__token != "/dev/urandom" && __token != "/dev/random") - || !_M_filebuf.open(__token.c_str(), - std::ios_base::in | std::ios_base::binary)) + || !(_M_file = std::fopen(__token.c_str(), "rb"))) std::__throw_runtime_error(__N("random_device::" "random_device(const std::string&)")); } ~random_device() - { _M_filebuf.close(); } + { std::fclose(_M_file); } #else @@ -1474,7 +1472,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) { #ifdef _GLIBCXX_USE_RANDOM_TR1 result_type __ret; - _M_filebuf.sgetn(reinterpret_cast<char*>(&__ret), sizeof(result_type)); + std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type), + 1, _M_file); return __ret; #else return _M_mt(); @@ -1486,7 +1485,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) void operator=(const random_device&); #ifdef _GLIBCXX_USE_RANDOM_TR1 - std::filebuf _M_filebuf; + FILE* _M_file; #else mt19937 _M_mt; #endif |

