Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ private:
_Traits::assign(_My_data._Bx._Buf[_Count], _Elem());
} else { // _Strat == _Construct_strategy::_From_string
#ifdef _INSERT_STRING_ANNOTATION
_Traits::copy(_My_data._Bx._Buf, _Arg, _Count + 1);
_Traits::copy(_My_data._Bx._Buf, _Arg, static_cast<size_t>(_Count + 1));
#else // ^^^ _INSERT_STRING_ANNOTATION / !_INSERT_STRING_ANNOTATION vvv
_Traits::copy(_My_data._Bx._Buf, _Arg, _BUF_SIZE);
#endif // ^^^ !_INSERT_STRING_ANNOTATION ^^^
Expand Down Expand Up @@ -1570,8 +1570,9 @@ public:
// append _Count * _Ch
const size_type _Old_size = _Mypair._Myval2._Mysize;
if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
const auto _New_size = static_cast<size_type>(_Old_size + _Count);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
_Traits::assign(_Old_ptr + _Old_size, static_cast<size_t>(_Count), _Ch);
_Traits::assign(_Old_ptr[_Old_size + _Count], _Elem());
Expand Down Expand Up @@ -1759,8 +1760,9 @@ public:
_Mypair._Myval2._Check_offset(_Off);
const size_type _Old_size = _Mypair._Myval2._Mysize;
if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
const auto _New_size = static_cast<size_type>(_Old_size + _Count);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
_Elem* const _Insert_at = _Old_ptr + _Off;
_Traits::move(
Expand Down Expand Up @@ -2202,8 +2204,9 @@ public:
_CONSTEXPR20 void push_back(const _Elem _Ch) { // insert element at end
const size_type _Old_size = _Mypair._Myval2._Mysize;
if (_Old_size < _Mypair._Myval2._Myres) {
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + 1);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + 1);
const auto _New_size = static_cast<size_type>(_Old_size + 1);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Ptr = _Mypair._Myval2._Myptr();
_Traits::assign(_Ptr[_Old_size], _Ch);
_Traits::assign(_Ptr[_Old_size + 1], _Elem());
Expand Down Expand Up @@ -3026,8 +3029,9 @@ private:

const size_type _Old_size = _Mypair._Myval2._Mysize;
if (_Count <= _Mypair._Myval2._Myres - _Old_size) {
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
const auto _New_size = static_cast<size_type>(_Old_size + _Count);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
_STD _Traits_move_batch<_Traits>(_Old_ptr + _Old_size, _Ptr, static_cast<size_t>(_Count));
_Traits::assign(_Old_ptr[_Old_size + _Count], _Elem());
Expand Down Expand Up @@ -3088,8 +3092,9 @@ private:
#endif // ^^^ !_HAS_CXX20 ^^^

if (_Check_overlap) {
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Count);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Count);
const auto _New_size = static_cast<size_type>(_Old_size + _Count);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
_Elem* const _Insert_at = _Old_ptr + _Off;
// the range [_Ptr, _Ptr + _Ptr_shifted_after) is left alone by moving the suffix out,
Expand Down Expand Up @@ -3159,8 +3164,9 @@ private:
#endif // _HAS_CXX20
{
if (_Growth <= _Mypair._Myval2._Myres - _Old_size) { // growth fits
_ASAN_STRING_MODIFY(*this, _Old_size, _Old_size + _Growth);
_Mypair._Myval2._Mysize = static_cast<size_type>(_Old_size + _Growth);
const auto _New_size = static_cast<size_type>(_Old_size + _Growth);
_ASAN_STRING_MODIFY(*this, _Old_size, _New_size);
_Mypair._Myval2._Mysize = _New_size;
_Elem* const _Old_ptr = _Mypair._Myval2._Myptr();
_Elem* const _Insert_at = _Old_ptr + _Off;
_Elem* const _Suffix_at = _Insert_at + _Nx;
Expand Down