Fixed two problems found by Chris Jefferson: Made operator>> for char consistent...
authorHoward Hinnant <hhinnant@apple.com>
Sun, 27 Feb 2011 18:02:02 +0000 (18:02 +0000)
committerHoward Hinnant <hhinnant@apple.com>
Sun, 27 Feb 2011 18:02:02 +0000 (18:02 +0000)
llvm-svn: 126576

libcxx/include/__hash_table
libcxx/include/istream
libcxx/include/map

index 4be27f6..41dbaa0 100644 (file)
@@ -29,9 +29,9 @@ template <class _NodePtr>
 struct __hash_node_base
 {
     typedef __hash_node_base __first_node;
-    typedef _NodePtr pointer;
//   typedef _NodePtr pointer;
 
-    pointer    __next_;
+    _NodePtr    __next_;
 
     _LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
 };
index 90bf4b6..b427605 100644 (file)
@@ -801,6 +801,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
         typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
         if (__sen)
         {
+#if 1
+            typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
+            if (_Traits::eq_int_type(__i, _Traits::eof()))
+                __is.setstate(ios_base::eofbit | ios_base::failbit);
+            else
+                __c = _Traits::to_char_type(__i);
+#else
             typedef istreambuf_iterator<_CharT, _Traits> _I;
             _I __i(__is);
             _I __eof;
@@ -812,6 +819,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
             }
             else
                 __is.setstate(ios_base::eofbit | ios_base::failbit);
+#endif
         }
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
index 85e10f6..fdd1338 100644 (file)
@@ -493,11 +493,11 @@ class _LIBCPP_VISIBLE __map_iterator
     _TreeIterator __i_;
 
     typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
-    typedef const typename _TreeIterator::value_type::first_type key_type;
-    typedef typename _TreeIterator::value_type::second_type      mapped_type;
+    typedef const typename _TreeIterator::value_type::first_type __key_type;
+    typedef typename _TreeIterator::value_type::second_type      __mapped_type;
 public:
     typedef bidirectional_iterator_tag                           iterator_category;
-    typedef pair<key_type, mapped_type>                          value_type;
+    typedef pair<__key_type, __mapped_type>                      value_type;
     typedef typename _TreeIterator::difference_type              difference_type;
     typedef value_type&                                          reference;
     typedef typename __pointer_traits::template
@@ -558,11 +558,11 @@ class _LIBCPP_VISIBLE __map_const_iterator
     _TreeIterator __i_;
 
     typedef typename _TreeIterator::__pointer_traits             __pointer_traits;
-    typedef const typename _TreeIterator::value_type::first_type key_type;
-    typedef typename _TreeIterator::value_type::second_type      mapped_type;
+    typedef const typename _TreeIterator::value_type::first_type __key_type;
+    typedef typename _TreeIterator::value_type::second_type      __mapped_type;
 public:
     typedef bidirectional_iterator_tag                           iterator_category;
-    typedef pair<key_type, mapped_type>                          value_type;
+    typedef pair<__key_type, __mapped_type>                      value_type;
     typedef typename _TreeIterator::difference_type              difference_type;
     typedef const value_type&                                    reference;
     typedef typename __pointer_traits::template