diff options
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r-- | libstdc++-v3/src/compatibility.cc | 15 | ||||
-rw-r--r-- | libstdc++-v3/src/istream.cc | 22 |
2 files changed, 22 insertions, 15 deletions
diff --git a/libstdc++-v3/src/compatibility.cc b/libstdc++-v3/src/compatibility.cc index f88fbc740d8..83b20b96706 100644 --- a/libstdc++-v3/src/compatibility.cc +++ b/libstdc++-v3/src/compatibility.cc @@ -51,6 +51,7 @@ #include <fstream> #include <sstream> #include <cmath> +#include <ext/numeric_traits.h> _GLIBCXX_BEGIN_NAMESPACE(std) @@ -96,10 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __c = __sb->snextc(); } } - if (__n == numeric_limits<streamsize>::max() + if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof)) { - _M_gcount = numeric_limits<streamsize>::min(); + _M_gcount = + __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else @@ -107,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } if (__large_ignore) - _M_gcount = numeric_limits<streamsize>::max(); + _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; @@ -161,10 +163,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __c = __sb->snextc(); } } - if (__n == numeric_limits<streamsize>::max() + if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof)) { - _M_gcount = numeric_limits<streamsize>::min(); + _M_gcount = + __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else @@ -172,7 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } if (__large_ignore) - _M_gcount = numeric_limits<streamsize>::max(); + _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc index 688ad165835..0f24340e031 100644 --- a/libstdc++-v3/src/istream.cc +++ b/libstdc++-v3/src/istream.cc @@ -152,11 +152,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __c = __sb->snextc(); } } - if (__n == numeric_limits<streamsize>::max() + if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { - _M_gcount = numeric_limits<streamsize>::min(); + _M_gcount = + __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else @@ -164,13 +165,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } if (__large_ignore) - _M_gcount = numeric_limits<streamsize>::max(); + _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else if (traits_type::eq_int_type(__c, __delim)) { - if (_M_gcount < numeric_limits<streamsize>::max()) + if (_M_gcount + < __gnu_cxx::__numeric_traits<streamsize>::__max) ++_M_gcount; __sb->sbumpc(); } @@ -204,7 +206,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Figure out how many characters to extract. streamsize __num = __in.width(); if (__num <= 0) - __num = numeric_limits<streamsize>::max(); + __num = __gnu_cxx::__numeric_traits<streamsize>::__max; const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); @@ -532,11 +534,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __c = __sb->snextc(); } } - if (__n == numeric_limits<streamsize>::max() + if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max && !traits_type::eq_int_type(__c, __eof) && !traits_type::eq_int_type(__c, __delim)) { - _M_gcount = numeric_limits<streamsize>::min(); + _M_gcount = + __gnu_cxx::__numeric_traits<streamsize>::__min; __large_ignore = true; } else @@ -544,13 +547,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } if (__large_ignore) - _M_gcount = numeric_limits<streamsize>::max(); + _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max; if (traits_type::eq_int_type(__c, __eof)) __err |= ios_base::eofbit; else if (traits_type::eq_int_type(__c, __delim)) { - if (_M_gcount < numeric_limits<streamsize>::max()) + if (_M_gcount + < __gnu_cxx::__numeric_traits<streamsize>::__max) ++_M_gcount; __sb->sbumpc(); } |