1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:47:34 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -68,27 +68,27 @@ public:
{
StringBuilder cert_name;
if (!subject.country.is_empty()) {
cert_name.append("/C=");
cert_name.append("/C="sv);
cert_name.append(subject.country);
}
if (!subject.state.is_empty()) {
cert_name.append("/ST=");
cert_name.append("/ST="sv);
cert_name.append(subject.state);
}
if (!subject.location.is_empty()) {
cert_name.append("/L=");
cert_name.append("/L="sv);
cert_name.append(subject.location);
}
if (!subject.entity.is_empty()) {
cert_name.append("/O=");
cert_name.append("/O="sv);
cert_name.append(subject.entity);
}
if (!subject.unit.is_empty()) {
cert_name.append("/OU=");
cert_name.append("/OU="sv);
cert_name.append(subject.unit);
}
if (!subject.subject.is_empty()) {
cert_name.append("/CN=");
cert_name.append("/CN="sv);
cert_name.append(subject.subject);
}
return cert_name.build();
@ -98,27 +98,27 @@ public:
{
StringBuilder cert_name;
if (!issuer.country.is_empty()) {
cert_name.append("/C=");
cert_name.append("/C="sv);
cert_name.append(issuer.country);
}
if (!issuer.state.is_empty()) {
cert_name.append("/ST=");
cert_name.append("/ST="sv);
cert_name.append(issuer.state);
}
if (!issuer.location.is_empty()) {
cert_name.append("/L=");
cert_name.append("/L="sv);
cert_name.append(issuer.location);
}
if (!issuer.entity.is_empty()) {
cert_name.append("/O=");
cert_name.append("/O="sv);
cert_name.append(issuer.entity);
}
if (!issuer.unit.is_empty()) {
cert_name.append("/OU=");
cert_name.append("/OU="sv);
cert_name.append(issuer.unit);
}
if (!issuer.subject.is_empty()) {
cert_name.append("/CN=");
cert_name.append("/CN="sv);
cert_name.append(issuer.subject);
}
return cert_name.build();

View file

@ -140,7 +140,7 @@ bool TLSv12::compute_master_secret_from_pre_master_secret(size_t length)
}
if constexpr (TLS_SSL_KEYLOG_DEBUG) {
auto file = MUST(Core::Stream::File::open("/home/anon/ssl_keylog", Core::Stream::OpenMode::Append | Core::Stream::OpenMode::Write));
auto file = MUST(Core::Stream::File::open("/home/anon/ssl_keylog"sv, Core::Stream::OpenMode::Append | Core::Stream::OpenMode::Write));
VERIFY(file->write_or_error("CLIENT_RANDOM "sv.bytes()));
VERIFY(file->write_or_error(encode_hex({ m_context.local_random, 32 }).bytes()));
VERIFY(file->write_or_error(" "sv.bytes()));

View file

@ -197,7 +197,7 @@ static bool wildcard_matches(StringView host, StringView subject)
if (host == subject)
return true;
if (subject.starts_with("*.")) {
if (subject.starts_with("*."sv)) {
auto maybe_first_dot_index = host.find('.');
if (maybe_first_dot_index.has_value()) {
auto first_dot_index = maybe_first_dot_index.release_value();