Skip to content

Commit 3798695

Browse files
committed
Fix invalid-pointer-pair error in detail::move_chars
1 parent 66bdccf commit 3798695

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/detail/move_chars.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,27 @@ is_overlapping(
4747
inline
4848
void
4949
move_chars_impl(
50-
std::ptrdiff_t,
50+
char*,
51+
char const*,
5152
core::string_view const&) noexcept
5253
{
5354
}
5455

5556
template<class... Sn>
5657
void
5758
move_chars_impl(
58-
std::ptrdiff_t d,
59+
char* dest,
60+
char const* src,
5961
core::string_view const& buf,
6062
core::string_view* s,
6163
Sn&&... sn) noexcept
6264
{
6365
if( s != nullptr &&
6466
is_overlapping(buf, *s))
6567
{
66-
*s = { s->data() + d, s->size() };
68+
*s = { s->data() + (dest - src), s->size() };
6769
}
68-
move_chars_impl(d, buf, sn...);
70+
move_chars_impl(dest, src, buf, sn...);
6971
}
7072

7173
template<class... Args>
@@ -77,7 +79,8 @@ move_chars(
7779
Args&&... args) noexcept
7880
{
7981
move_chars_impl(
80-
dest - src,
82+
dest,
83+
src,
8184
core::string_view(src, n),
8285
args...);
8386
std::memmove(

0 commit comments

Comments
 (0)