mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the StringView users. This is an important step towards the goal of removing StringView(char const*), as it moves the responsibility of calculating the size of the string to the user of the StringView (which will prevent naive uses causing OOB access).
This commit is contained in:
@@ -20,7 +20,7 @@ TEST_CASE(construct_empty)
|
||||
TEST_CASE(view_literal)
|
||||
{
|
||||
char const* truth = "cats rule dogs drool";
|
||||
StringView view(truth);
|
||||
StringView view { truth, strlen(truth) };
|
||||
EXPECT_EQ(view.is_null(), false);
|
||||
EXPECT_EQ(view.characters_without_null_termination(), truth);
|
||||
EXPECT_EQ(view, view);
|
||||
|
||||
Reference in New Issue
Block a user