@@ -99,12 +99,12 @@ public:
9999 _LIBCPP_HIDE_FROM_ABI basic_spanbuf () : basic_spanbuf(ios_base::in | ios_base::out) {}
100100
101101 _LIBCPP_HIDE_FROM_ABI explicit basic_spanbuf (ios_base::openmode __which)
102- : basic_streambuf <_CharT, _Traits>{}, __mode_{ __which} {}
102+ : basic_spanbuf(std::span <_CharT>(), __which) {}
103103
104104 _LIBCPP_HIDE_FROM_ABI explicit basic_spanbuf (std::span<_CharT> __s,
105105 ios_base::openmode __which = ios_base::in | ios_base::out)
106- : basic_streambuf<_CharT, _Traits>{}, __mode_{ __which} {
107- this -> span (__s);
106+ : basic_streambuf<_CharT, _Traits>{}, __mode_( __which) {
107+ span (__s);
108108 }
109109
110110 basic_spanbuf (const basic_spanbuf&) = delete ;
@@ -113,14 +113,15 @@ public:
113113 : basic_streambuf<_CharT, _Traits>{std::move (__rhs)},
114114 __mode_{std::move (__rhs.__mode_ )},
115115 __buf_{std::move (__rhs.__buf_ )} {}
116+ // __buf_{std::exchange(__rhs.__buf_, {})} {}
116117
117118 // [spanbuf.assign], assignment and swap
118119
119120 basic_spanbuf& operator =(const basic_spanbuf&) = delete ;
120121
121122 _LIBCPP_HIDE_FROM_ABI basic_spanbuf& operator =(basic_spanbuf&& __rhs) {
122123 basic_spanbuf __tmp{std::move (__rhs)};
123- this -> swap (__tmp);
124+ swap (__tmp);
124125 return *this ;
125126 }
126127
@@ -134,7 +135,7 @@ public:
134135
135136 _LIBCPP_HIDE_FROM_ABI std::span<_CharT> span () const noexcept {
136137 if (__mode_ & ios_base::out) {
137- return std::span<_CharT>( this ->pbase (), this ->pptr ()) ;
138+ return std::span<_CharT>{ this ->pbase (), this ->pptr ()} ;
138139 }
139140 return __buf_;
140141 }
@@ -158,38 +159,38 @@ protected:
158159 // [spanbuf.virtuals], overridden virtual functions
159160
160161 _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* setbuf (_CharT* __s, streamsize __n) override {
161- this -> span (std::span<_CharT>(__s, __n));
162+ span (std::span<_CharT>(__s, __n));
162163 return this ;
163164 }
164165
165166 _LIBCPP_HIDE_FROM_ABI pos_type
166167 seekoff (off_type __off, ios_base::seekdir __way, ios_base::openmode __which = ios_base::in | ios_base::out) override {
167- const pos_type __error (off_type (- 1 ) );
168+ const auto __error = static_cast <pos_type> (off_type{- 1 } );
168169
169170 if ((__which & ios_base::in) && (__which & ios_base::out) && (ios_base::cur == __way))
170171 return __error;
171172
172173 // Calculate __baseoff
173174
174- off_type __baseoff;
175+ std:: size_t __baseoff;
175176
176177 switch (__way) {
177178 case ios_base::beg:
178- __baseoff = off_type ( 0 ) ;
179+ __baseoff = 0Z ;
179180 break ;
180181
181182 case ios_base::cur:
182183 if (__which & ios_base::out)
183- __baseoff = off_type ( this ->pptr () - this ->pbase () );
184+ __baseoff = this ->pptr () - this ->pbase ();
184185 else
185- __baseoff = off_type ( this ->gptr () - this ->eback () );
186+ __baseoff = this ->gptr () - this ->eback ();
186187 break ;
187188
188189 case ios_base::end:
189190 if ((__which & ios_base::out) && !(__which & ios_base::in))
190- __baseoff = off_type ( this ->pptr () - this ->pbase () );
191+ __baseoff = this ->pptr () - this ->pbase ();
191192 else
192- __baseoff = off_type ( __buf_.size () );
193+ __baseoff = __buf_.size ();
193194 break ;
194195
195196 default :
@@ -200,29 +201,29 @@ protected:
200201
201202 off_type __newoff;
202203
203- if (__builtin_add_overflow (__baseoff, __off, &__newoff) || (__newoff < off_type ( 0 ) ) ||
204- ( std::cmp_greater (__newoff, __buf_.size () )))
204+ if (__builtin_add_overflow (__baseoff, __off, &__newoff) || (__newoff < off_type{ 0 } ) ||
205+ std::cmp_greater (__newoff, __buf_.size ()))
205206 return __error;
206207
207208 if (__which & ios_base::in) {
208- if ((this ->gptr () == nullptr ) && (__newoff != off_type ( 0 ) ))
209+ if ((this ->gptr () == nullptr ) && (__newoff != off_type{ 0 } ))
209210 return __error;
210211 this ->setg (this ->eback (), this ->eback () + __newoff, this ->egptr ());
211212 }
212213
213214 if (__which & ios_base::out) {
214- if ((this ->pptr () == nullptr ) && (__newoff != off_type ( 0 ) ))
215+ if ((this ->pptr () == nullptr ) && (__newoff != off_type{ 0 } ))
215216 return __error;
216217 this ->setp (this ->pbase (), this ->epptr ());
217218 this ->pbump (__newoff);
218219 }
219220
220- return pos_type (__newoff);
221+ return static_cast < pos_type> (__newoff);
221222 }
222223
223224 _LIBCPP_HIDE_FROM_ABI pos_type seekpos (pos_type __sp,
224225 ios_base::openmode __which = ios_base::in | ios_base::out) override {
225- return seekoff (off_type (__sp), ios_base::beg, __which);
226+ return seekoff (static_cast < off_type> (__sp), ios_base::beg, __which);
226227 }
227228
228229private:
0 commit comments