mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
Everywhere: Prefer _string
when constructing strings from literals
This commit is contained in:
parent
bb9da0ed8d
commit
4a7236cabf
4 changed files with 13 additions and 13 deletions
|
@ -1331,7 +1331,7 @@ URL URLParser::basic_parse(StringView raw_input, Optional<URL> const& base_url,
|
||||||
// -> file state, https://url.spec.whatwg.org/#file-state
|
// -> file state, https://url.spec.whatwg.org/#file-state
|
||||||
case State::File:
|
case State::File:
|
||||||
// 1. Set url’s scheme to "file".
|
// 1. Set url’s scheme to "file".
|
||||||
url->m_scheme = String::from_utf8("file"sv).release_value_but_fixme_should_propagate_errors();
|
url->m_scheme = "file"_string;
|
||||||
|
|
||||||
// 2. Set url’s host to the empty string.
|
// 2. Set url’s host to the empty string.
|
||||||
url->m_host = String {};
|
url->m_host = String {};
|
||||||
|
|
|
@ -299,7 +299,7 @@ static ErrorOr<void> generate_loader_for_object(GUI::GML::Object const& gml_obje
|
||||||
// Layout
|
// Layout
|
||||||
if (gml_object.layout_object() != nullptr) {
|
if (gml_object.layout_object() != nullptr) {
|
||||||
TRY(append(generator, "RefPtr<GUI::Layout> layout;"));
|
TRY(append(generator, "RefPtr<GUI::Layout> layout;"));
|
||||||
TRY(generate_loader_for_object(*gml_object.layout_object(), generator.fork(), TRY(String::from_utf8("layout"sv)), indentation + 1, UseObjectConstructor::Yes));
|
TRY(generate_loader_for_object(*gml_object.layout_object(), generator.fork(), "layout"_string, indentation + 1, UseObjectConstructor::Yes));
|
||||||
TRY(append(generator, "@object_name@->set_layout(layout.release_nonnull());"));
|
TRY(append(generator, "@object_name@->set_layout(layout.release_nonnull());"));
|
||||||
generator.appendln("");
|
generator.appendln("");
|
||||||
}
|
}
|
||||||
|
@ -352,16 +352,16 @@ static ErrorOr<String> generate_cpp(NonnullRefPtr<GUI::GML::GMLFile> gml, Lexica
|
||||||
auto& main_class = gml->main_class();
|
auto& main_class = gml->main_class();
|
||||||
auto necessary_includes = TRY(extract_necessary_includes(main_class, gml_file_name));
|
auto necessary_includes = TRY(extract_necessary_includes(main_class, gml_file_name));
|
||||||
static String const always_necessary_includes[] = {
|
static String const always_necessary_includes[] = {
|
||||||
TRY(String::from_utf8("<AK/Error.h>"sv)),
|
"<AK/Error.h>"_string,
|
||||||
TRY(String::from_utf8("<AK/JsonValue.h>"sv)),
|
"<AK/JsonValue.h>"_string,
|
||||||
TRY(String::from_utf8("<AK/NonnullRefPtr.h>"sv)),
|
"<AK/NonnullRefPtr.h>"_string,
|
||||||
TRY(String::from_utf8("<AK/RefPtr.h>"sv)),
|
"<AK/RefPtr.h>"_string,
|
||||||
TRY(String::from_utf8("<LibGfx/Font/FontWeight.h>"sv)),
|
"<LibGfx/Font/FontWeight.h>"_string,
|
||||||
// For Gfx::ColorRole
|
// For Gfx::ColorRole
|
||||||
TRY(String::from_utf8("<LibGfx/SystemTheme.h>"sv)),
|
"<LibGfx/SystemTheme.h>"_string,
|
||||||
TRY(String::from_utf8("<LibGUI/Widget.h>"sv)),
|
"<LibGUI/Widget.h>"_string,
|
||||||
// For Gfx::FontWeight
|
// For Gfx::FontWeight
|
||||||
TRY(String::from_utf8("<LibGfx/Font/FontDatabase.h>"sv)),
|
"<LibGfx/Font/FontDatabase.h>"_string,
|
||||||
};
|
};
|
||||||
TRY(necessary_includes.try_set_from(always_necessary_includes));
|
TRY(necessary_includes.try_set_from(always_necessary_includes));
|
||||||
for (auto const& include : necessary_includes)
|
for (auto const& include : necessary_includes)
|
||||||
|
|
|
@ -92,7 +92,7 @@ TEST_CASE(test_keygen_vector_4)
|
||||||
// https://datatracker.ietf.org/doc/html/rfc8439#section-2.8.2
|
// https://datatracker.ietf.org/doc/html/rfc8439#section-2.8.2
|
||||||
TEST_CASE(test_aead_encrypt_1)
|
TEST_CASE(test_aead_encrypt_1)
|
||||||
{
|
{
|
||||||
auto plaintext = MUST(String::from_utf8("Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."sv));
|
auto plaintext = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."_string;
|
||||||
u8 aad[12] = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
u8 aad[12] = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
||||||
u8 key[32] = {
|
u8 key[32] = {
|
||||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||||
|
@ -192,7 +192,7 @@ TEST_CASE(test_aead_decrypt_1)
|
||||||
|
|
||||||
TEST_CASE(test_aead_encrypt_and_decrypt)
|
TEST_CASE(test_aead_encrypt_and_decrypt)
|
||||||
{
|
{
|
||||||
auto plaintext = MUST(String::from_utf8("Well, hello friends :)"sv));
|
auto plaintext = "Well, hello friends :)"_string;
|
||||||
u8 aad[12] = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
u8 aad[12] = { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
||||||
u8 key[32] = {
|
u8 key[32] = {
|
||||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<String> read_long_version_string()
|
||||||
|
|
||||||
return String::formatted("Version {} revision {}", version, git_hash);
|
return String::formatted("Version {} revision {}", version, git_hash);
|
||||||
#else
|
#else
|
||||||
return String::from_utf8("Version 1.0"sv);
|
return "Version 1.0"_string;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue