From 5c489c31e73d49ef72f0d229c6a7457d7a5511b3 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 24 Dec 2017 01:16:28 +0000 Subject: [PATCH] Merge libc++ trunk r321414 to contrib/libc++. --- contrib/libc++/include/sstream | 5 +++-- contrib/libc++/include/string_view | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/libc++/include/sstream b/contrib/libc++/include/sstream index 34b0014c14ad..b01f47b6872c 100644 --- a/contrib/libc++/include/sstream +++ b/contrib/libc++/include/sstream @@ -577,6 +577,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) && __way == ios_base::cur) return pos_type(-1); + const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data(); off_type __noff; switch (__way) { @@ -590,13 +591,13 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off, __noff = this->pptr() - this->pbase(); break; case ios_base::end: - __noff = __hm_ - __str_.data(); + __noff = __hm; break; default: return pos_type(-1); } __noff += __off; - if (__noff < 0 || __hm_ - __str_.data() < __noff) + if (__noff < 0 || __hm < __noff) return pos_type(-1); if (__noff != 0) { diff --git a/contrib/libc++/include/string_view b/contrib/libc++/include/string_view index 4d8358288f0c..72cf816e8d52 100644 --- a/contrib/libc++/include/string_view +++ b/contrib/libc++/include/string_view @@ -196,9 +196,9 @@ public: // types typedef _Traits traits_type; typedef _CharT value_type; - typedef const _CharT* pointer; + typedef _CharT* pointer; typedef const _CharT* const_pointer; - typedef const _CharT& reference; + typedef _CharT& reference; typedef const _CharT& const_reference; typedef const_pointer const_iterator; // See [string.view.iterators] typedef const_iterator iterator;