StringView: Rename characters() to characters_without_null_termination().

This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
This commit is contained in:
Andreas Kling 2019-07-08 15:38:44 +02:00
commit 0e75aba7c3
Notes: sideshowbarker 2024-07-19 13:22:04 +09:00
21 changed files with 57 additions and 46 deletions

View file

@ -44,7 +44,7 @@ void GClipboard::set_data(const StringView& data)
return;
}
if (!data.is_empty())
memcpy(shared_buffer->data(), data.characters(), data.length() + 1);
memcpy(shared_buffer->data(), data.characters_without_null_termination(), data.length() + 1);
else
((u8*)shared_buffer->data())[0] = '\0';
shared_buffer->seal();