mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
This commit is contained in:
parent
c70f45ff44
commit
e5f09ea170
51 changed files with 282 additions and 261 deletions
|
@ -41,7 +41,7 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_numeric_notation(StringVi
|
|||
{
|
||||
mode_t mode = AK::StringUtils::convert_to_uint_from_octal<u16>(string).value_or(01000);
|
||||
if (mode > 0777)
|
||||
return Error::from_string_literal("invalid octal representation"sv);
|
||||
return Error::from_string_literal("invalid octal representation");
|
||||
return FilePermissionsMask().assign_permissions(mode);
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_symbolic_notation(StringV
|
|||
else if (ch == '=')
|
||||
operation = Operation::Assign;
|
||||
else if (classes == 0)
|
||||
return Error::from_string_literal("invalid class: expected 'u', 'g', 'o' or 'a'"sv);
|
||||
return Error::from_string_literal("invalid class: expected 'u', 'g', 'o' or 'a'");
|
||||
else
|
||||
return Error::from_string_literal("invalid operation: expected '+', '-' or '='"sv);
|
||||
return Error::from_string_literal("invalid operation: expected '+', '-' or '='");
|
||||
|
||||
// if an operation was specified without a class, assume all
|
||||
if (classes == 0)
|
||||
|
@ -106,7 +106,7 @@ ErrorOr<FilePermissionsMask> FilePermissionsMask::from_symbolic_notation(StringV
|
|||
else if (ch == 'x')
|
||||
write_bits = 1;
|
||||
else
|
||||
return Error::from_string_literal("invalid symbolic permission: expected 'r', 'w' or 'x'"sv);
|
||||
return Error::from_string_literal("invalid symbolic permission: expected 'r', 'w' or 'x'");
|
||||
|
||||
mode_t clear_bits = operation == Operation::Assign ? 7 : write_bits;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue