mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +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:
parent
e3da0adfe6
commit
c70f45ff44
75 changed files with 264 additions and 203 deletions
|
@ -416,7 +416,7 @@ static int do_file_system_object_long(char const* path)
|
|||
continue;
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(path);
|
||||
builder.append({ path, strlen(path) });
|
||||
builder.append('/');
|
||||
builder.append(metadata.name);
|
||||
metadata.path = builder.to_string();
|
||||
|
@ -460,7 +460,7 @@ static bool print_names(char const* path, size_t longest_name, Vector<FileMetada
|
|||
for (size_t i = 0; i < files.size(); ++i) {
|
||||
auto& name = files[i].name;
|
||||
StringBuilder builder;
|
||||
builder.append(path);
|
||||
builder.append({ path, strlen(path) });
|
||||
builder.append('/');
|
||||
builder.append(name);
|
||||
if (!print_filesystem_object_short(builder.to_string().characters(), name.characters(), &nprinted))
|
||||
|
@ -528,7 +528,7 @@ int do_file_system_object_short(char const* path)
|
|||
continue;
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(path);
|
||||
builder.append({ path, strlen(path) });
|
||||
builder.append('/');
|
||||
builder.append(metadata.name);
|
||||
metadata.path = builder.to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue