diff options
392 files changed, 979 insertions, 979 deletions
diff --git a/AK/Base64.cpp b/AK/Base64.cpp index 4d0a419f4a..f9d321ee38 100644 --- a/AK/Base64.cpp +++ b/AK/Base64.cpp @@ -38,7 +38,7 @@ static constexpr auto make_lookup_table() return table; } -size_t calculate_base64_decoded_length(const StringView& input) +size_t calculate_base64_decoded_length(StringView input) { return input.length() * 3 / 4; } @@ -48,7 +48,7 @@ size_t calculate_base64_encoded_length(ReadonlyBytes input) return ((4 * input.size() / 3) + 3) & ~3; } -Optional<ByteBuffer> decode_base64(const StringView& input) +Optional<ByteBuffer> decode_base64(StringView input) { auto get = [&](const size_t offset, bool* is_padding) -> Optional<u8> { constexpr auto table = make_lookup_table(); diff --git a/AK/Base64.h b/AK/Base64.h index c1c5388629..d4c6de40f8 100644 --- a/AK/Base64.h +++ b/AK/Base64.h @@ -13,11 +13,11 @@ namespace AK { -size_t calculate_base64_decoded_length(const StringView&); +size_t calculate_base64_decoded_length(StringView); size_t calculate_base64_encoded_length(ReadonlyBytes); -Optional<ByteBuffer> decode_base64(const StringView&); +Optional<ByteBuffer> decode_base64(StringView); String encode_base64(ReadonlyBytes); diff --git a/AK/DateTimeLexer.h b/AK/DateTimeLexer.h index 51de0c4266..98c81b78f6 100644 --- a/AK/DateTimeLexer.h +++ b/AK/DateTimeLexer.h @@ -14,7 +14,7 @@ namespace AK { class DateTimeLexer : public GenericLexer { public: - constexpr explicit DateTimeLexer(const StringView& input) + constexpr explicit DateTimeLexer(StringView input) : GenericLexer(input) { } diff --git a/AK/Demangle.h b/AK/Demangle.h index 9e41dc949c..c04df9e674 100644 --- a/AK/Demangle.h +++ b/AK/Demangle.h @@ -12,7 +12,7 @@ namespace AK { -inline String demangle(const StringView& name) +inline String demangle(StringView name) { int status = 0; auto* demangled_name = abi::__cxa_demangle(name.to_string().characters(), nullptr, nullptr, &status); diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index ecf3a31df8..20b8e2ab04 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -55,7 +55,7 @@ FlyString::FlyString(const String& string) } } -FlyString::FlyString(StringView const& string) +FlyString::FlyString(StringView string) { if (string.is_null()) return; @@ -95,17 +95,17 @@ template Optional<u16> FlyString::to_uint(TrimWhitespace) const; template Optional<u32> FlyString::to_uint(TrimWhitespace) const; template Optional<u64> FlyString::to_uint(TrimWhitespace) const; -bool FlyString::equals_ignoring_case(const StringView& other) const +bool FlyString::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(view(), other); } -bool FlyString::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool FlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(view(), str, case_sensitivity); } -bool FlyString::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool FlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(view(), str, case_sensitivity); } @@ -132,7 +132,7 @@ bool FlyString::operator==(const String& other) const return !__builtin_memcmp(characters(), other.characters(), length()); } -bool FlyString::operator==(const StringView& string) const +bool FlyString::operator==(StringView string) const { return *this == String(string); } diff --git a/AK/FlyString.h b/AK/FlyString.h index d91e94c68b..8c8d55dad0 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -23,7 +23,7 @@ public: { } FlyString(const String&); - FlyString(const StringView&); + FlyString(StringView); FlyString(const char* string) : FlyString(static_cast<String>(string)) { @@ -58,8 +58,8 @@ public: bool operator==(const String&) const; bool operator!=(const String& string) const { return !(*this == string); } - bool operator==(const StringView&) const; - bool operator!=(const StringView& string) const { return !(*this == string); } + bool operator==(StringView) const; + bool operator!=(StringView string) const { return !(*this == string); } bool operator==(const char*) const; bool operator!=(const char* string) const { return !(*this == string); } @@ -78,9 +78,9 @@ public: template<typename T = unsigned> Optional<T> to_uint(TrimWhitespace = TrimWhitespace::Yes) const; - bool equals_ignoring_case(const StringView&) const; - bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + bool equals_ignoring_case(StringView) const; + bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; static void did_destroy_impl(Badge<StringImpl>, StringImpl&); diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h index 7a01060068..0a44bffc65 100644 --- a/AK/GenericLexer.h +++ b/AK/GenericLexer.h @@ -13,7 +13,7 @@ namespace AK { class GenericLexer { public: - constexpr explicit GenericLexer(const StringView& input) + constexpr explicit GenericLexer(StringView input) : m_input(input) { } @@ -93,7 +93,7 @@ public: return consume_specific(StringView { next }); } - constexpr char consume_escaped_character(char escape_char = '\\', const StringView& escape_map = "n\nr\rt\tb\bf\f") + constexpr char consume_escaped_character(char escape_char = '\\', StringView escape_map = "n\nr\rt\tb\bf\f") { if (!consume_specific(escape_char)) return consume(); @@ -215,7 +215,7 @@ private: Result<u32, UnicodeEscapeError> decode_single_or_paired_surrogate(bool combine_surrogate_pairs); }; -constexpr auto is_any_of(const StringView& values) +constexpr auto is_any_of(StringView values) { return [values](auto c) { return values.contains(c); }; } diff --git a/AK/Hex.cpp b/AK/Hex.cpp index 099b96eb5f..7e8cd99d86 100644 --- a/AK/Hex.cpp +++ b/AK/Hex.cpp @@ -15,7 +15,7 @@ namespace AK { -Optional<ByteBuffer> decode_hex(const StringView& input) +Optional<ByteBuffer> decode_hex(StringView input) { if ((input.length() % 2) != 0) return {}; @@ -24,7 +24,7 @@ constexpr u8 decode_hex_digit(char digit) return 255; } -Optional<ByteBuffer> decode_hex(const StringView&); +Optional<ByteBuffer> decode_hex(StringView); String encode_hex(ReadonlyBytes); diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index 09ea8e8200..3c0f76f6b9 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -66,7 +66,7 @@ public: octet(SubnetClass::A)); } - static Optional<IPv4Address> from_string(const StringView& string) + static Optional<IPv4Address> from_string(StringView string) { if (string.is_null()) return {}; diff --git a/AK/JsonArraySerializer.h b/AK/JsonArraySerializer.h index 38cb744f85..fa0f3086af 100644 --- a/AK/JsonArraySerializer.h +++ b/AK/JsonArraySerializer.h @@ -39,7 +39,7 @@ public: } #endif - void add(const StringView& value) + void add(StringView value) { begin_item(); (void)m_builder.append('"'); diff --git a/AK/JsonObjectSerializer.h b/AK/JsonObjectSerializer.h index 52831ed268..804ae09732 100644 --- a/AK/JsonObjectSerializer.h +++ b/AK/JsonObjectSerializer.h @@ -33,14 +33,14 @@ public: } #ifndef KERNEL - void add(const StringView& key, const JsonValue& value) + void add(StringView key, const JsonValue& value) { begin_item(key); value.serialize(m_builder); } #endif - void add(const StringView& key, const StringView& value) + void add(StringView key, StringView value) { begin_item(key); (void)m_builder.append('"'); @@ -48,7 +48,7 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, const String& value) + void add(StringView key, const String& value) { begin_item(key); (void)m_builder.append('"'); @@ -56,7 +56,7 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, const char* value) + void add(StringView key, const char* value) { begin_item(key); (void)m_builder.append('"'); @@ -64,63 +64,63 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, bool value) + void add(StringView key, bool value) { begin_item(key); (void)m_builder.append(value ? "true" : "false"); } - void add(const StringView& key, int value) + void add(StringView key, int value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, unsigned value) + void add(StringView key, unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long value) + void add(StringView key, long value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long unsigned value) + void add(StringView key, long unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long long value) + void add(StringView key, long long value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long long unsigned value) + void add(StringView key, long long unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } #ifndef KERNEL - void add(const StringView& key, double value) + void add(StringView key, double value) { begin_item(key); (void)m_builder.appendff("{}", value); } #endif - JsonArraySerializer<Builder> add_array(const StringView& key) + JsonArraySerializer<Builder> add_array(StringView key) { begin_item(key); return JsonArraySerializer(m_builder); } - JsonObjectSerializer<Builder> add_object(const StringView& key) + JsonObjectSerializer<Builder> add_object(StringView key) { begin_item(key); return JsonObjectSerializer(m_builder); @@ -134,7 +134,7 @@ public: } private: - void begin_item(const StringView& key) + void begin_item(StringView key) { if (!m_empty) (void)m_builder.append(','); diff --git a/AK/JsonParser.h b/AK/JsonParser.h index 4d4ed19694..475903f76b 100644 --- a/AK/JsonParser.h +++ b/AK/JsonParser.h @@ -13,7 +13,7 @@ namespace AK { class JsonParser : private GenericLexer { public: - explicit JsonParser(const StringView& input) + explicit JsonParser(StringView input) : GenericLexer(input) { } diff --git a/AK/JsonPath.h b/AK/JsonPath.h index 0ae3f0f3ed..ab93c2d8ca 100644 --- a/AK/JsonPath.h +++ b/AK/JsonPath.h @@ -27,7 +27,7 @@ public: { } - JsonPathElement(const StringView& key) + JsonPathElement(StringView key) : m_kind(Kind::Key) , m_key(key) { diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index 439b8f1859..184649b308 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -228,7 +228,7 @@ void JsonValue::clear() } #ifndef KERNEL -Optional<JsonValue> JsonValue::from_string(const StringView& input) +Optional<JsonValue> JsonValue::from_string(StringView input) { return JsonParser(input).parse(); } diff --git a/AK/JsonValue.h b/AK/JsonValue.h index 9783b78ac3..b8b1b0b6d3 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -30,7 +30,7 @@ public: Object, }; - static Optional<JsonValue> from_string(const StringView&); + static Optional<JsonValue> from_string(StringView); explicit JsonValue(Type = Type::Null); ~JsonValue() { clear(); } diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index 7a4afdf2ec..7864c13983 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -67,7 +67,7 @@ Vector<String> LexicalPath::parts() const return vector; } -bool LexicalPath::has_extension(StringView const& extension) const +bool LexicalPath::has_extension(StringView extension) const { return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive); } @@ -129,7 +129,7 @@ String LexicalPath::absolute_path(String dir_path, String target) return LexicalPath::canonicalized_path(join(dir_path, target).string()); } -String LexicalPath::relative_path(StringView const& a_path, StringView const& a_prefix) +String LexicalPath::relative_path(StringView a_path, StringView a_prefix) { if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) { // FIXME: This should probably VERIFY or return an Optional<String>. @@ -159,7 +159,7 @@ String LexicalPath::relative_path(StringView const& a_path, StringView const& a_ return path; } -LexicalPath LexicalPath::append(StringView const& value) const +LexicalPath LexicalPath::append(StringView value) const { return LexicalPath::join(m_string, value); } diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index 562adbe83b..98e11a97c0 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -19,22 +19,22 @@ public: bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; } String const& string() const { return m_string; } - StringView const& dirname() const { return m_dirname; } - StringView const& basename() const { return m_basename; } - StringView const& title() const { return m_title; } - StringView const& extension() const { return m_extension; } + StringView dirname() const { return m_dirname; } + StringView basename() const { return m_basename; } + StringView title() const { return m_title; } + StringView extension() const { return m_extension; } Vector<StringView> const& parts_view() const { return m_parts; } [[nodiscard]] Vector<String> parts() const; - bool has_extension(StringView const&) const; + bool has_extension(StringView) const; - [[nodiscard]] LexicalPath append(StringView const&) const; + [[nodiscard]] LexicalPath append(StringView) const; [[nodiscard]] LexicalPath parent() const; [[nodiscard]] static String canonicalized_path(String); [[nodiscard]] static String absolute_path(String dir_path, String target); - [[nodiscard]] static String relative_path(StringView const& absolute_path, StringView const& prefix); + [[nodiscard]] static String relative_path(StringView absolute_path, StringView prefix); template<typename... S> [[nodiscard]] static LexicalPath join(StringView first, S&&... rest) diff --git a/AK/MACAddress.h b/AK/MACAddress.h index bcac9c8eec..32e32c1bf9 100644 --- a/AK/MACAddress.h +++ b/AK/MACAddress.h @@ -58,7 +58,7 @@ public: return String::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]); } - static Optional<MACAddress> from_string(const StringView& string) + static Optional<MACAddress> from_string(StringView string) { if (string.is_null()) return {}; diff --git a/AK/String.cpp b/AK/String.cpp index a37ab8095a..a3bb45c5b4 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -31,7 +31,7 @@ bool String::operator==(const String& other) const return *m_impl == *other.m_impl; } -bool String::operator==(const StringView& other) const +bool String::operator==(StringView other) const { if (!m_impl) return !other.m_characters; @@ -202,7 +202,7 @@ template Optional<u16> String::to_uint(TrimWhitespace) const; template Optional<u32> String::to_uint(TrimWhitespace) const; template Optional<u64> String::to_uint(TrimWhitespace) const; -bool String::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool String::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); } @@ -214,7 +214,7 @@ bool String::starts_with(char ch) const return characters()[0] == ch; } -bool String::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool String::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(*this, str, case_sensitivity); } @@ -236,7 +236,7 @@ String String::repeated(char ch, size_t count) return *impl; } -String String::repeated(const StringView& string, size_t count) +String String::repeated(StringView string, size_t count) { if (!count || string.is_empty()) return empty(); @@ -327,17 +327,17 @@ String String::roman_number_from(size_t value) return builder.to_string(); } -bool String::matches(const StringView& mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const +bool String::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans); } -bool String::matches(const StringView& mask, CaseSensitivity case_sensitivity) const +bool String::matches(StringView mask, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity); } -bool String::contains(const StringView& needle, CaseSensitivity case_sensitivity) const +bool String::contains(StringView needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, needle, case_sensitivity); } @@ -347,7 +347,7 @@ bool String::contains(char needle, CaseSensitivity case_sensitivity) const return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity); } -bool String::equals_ignoring_case(const StringView& other) const +bool String::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(view(), other); } @@ -361,7 +361,7 @@ String String::reverse() const return reversed_string.to_string(); } -String escape_html_entities(const StringView& html) +String escape_html_entities(StringView html) { StringBuilder builder; for (size_t i = 0; i < html.length(); ++i) { diff --git a/AK/String.h b/AK/String.h index 97d8dab0cc..065c1e85f3 100644 --- a/AK/String.h +++ b/AK/String.h @@ -43,7 +43,7 @@ public: String() = default; - String(const StringView& view) + String(StringView view) { m_impl = StringImpl::create(view.characters_without_null_termination(), view.length()); } @@ -96,7 +96,7 @@ public: String(const FlyString&); [[nodiscard]] static String repeated(char, size_t count); - [[nodiscard]] static String repeated(const StringView&, size_t count); + [[nodiscard]] static String repeated(StringView, size_t count); [[nodiscard]] static String bijective_base_from(size_t value, unsigned base = 26, StringView map = {}); [[nodiscard]] static String roman_number_from(size_t value); @@ -109,8 +109,8 @@ public: return builder.build(); } - [[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - [[nodiscard]] bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; template<typename T = int> [[nodiscard]] Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const; @@ -125,7 +125,7 @@ public: [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } #ifndef KERNEL - [[nodiscard]] String trim(const StringView& characters, TrimMode mode = TrimMode::Both) const + [[nodiscard]] String trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(view(), characters, mode); } @@ -136,9 +136,9 @@ public: } #endif - [[nodiscard]] bool equals_ignoring_case(const StringView&) const; + [[nodiscard]] bool equals_ignoring_case(StringView) const; - [[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] Vector<String> split_limit(char separator, size_t limit, bool keep_empty = false) const; @@ -146,12 +146,12 @@ public: [[nodiscard]] Vector<StringView> split_view(char separator, bool keep_empty = false) const; [[nodiscard]] Optional<size_t> find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } - [[nodiscard]] Optional<size_t> find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } + [[nodiscard]] Optional<size_t> find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } [[nodiscard]] Optional<size_t> find_last(char needle) const { return StringUtils::find_last(*this, needle); } - // FIXME: Implement find_last(StringView const&) for API symmetry. + // FIXME: Implement find_last(StringView) for API symmetry. Vector<size_t> find_all(StringView needle) const; using SearchDirection = StringUtils::SearchDirection; - [[nodiscard]] Optional<size_t> find_any_of(StringView const& needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); } + [[nodiscard]] Optional<size_t> find_any_of(StringView needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); } [[nodiscard]] String substring(size_t start, size_t length) const; [[nodiscard]] String substring(size_t start) const; @@ -185,16 +185,16 @@ public: [[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } [[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); } - [[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool starts_with(char) const; [[nodiscard]] bool ends_with(char) const; bool operator==(const String&) const; bool operator!=(const String& other) const { return !(*this == other); } - bool operator==(const StringView&) const; - bool operator!=(const StringView& other) const { return !(*this == other); } + bool operator==(StringView) const; + bool operator!=(StringView other) const { return !(*this == other); } bool operator==(const FlyString&) const; bool operator!=(const FlyString& other) const { return !(*this == other); } @@ -285,8 +285,8 @@ public: return { characters(), length() }; } - [[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } - [[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); } + [[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } + [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); } [[nodiscard]] String reverse() const; template<typename... Ts> @@ -314,7 +314,7 @@ bool operator>=(const char*, const String&); bool operator>(const char*, const String&); bool operator<=(const char*, const String&); -String escape_html_entities(const StringView& html); +String escape_html_entities(StringView html); InputStream& operator>>(InputStream& stream, String& string); diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index f382be467c..22bcf56389 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -38,7 +38,7 @@ StringBuilder::StringBuilder(size_t initial_capacity) m_buffer.ensure_capacity(initial_capacity); } -void StringBuilder::append(StringView const& str) +void StringBuilder::append(StringView str) { if (str.is_empty()) return; @@ -129,7 +129,7 @@ void StringBuilder::append_as_lowercase(char ch) append(ch); } -void StringBuilder::append_escaped_for_json(StringView const& string) +void StringBuilder::append_escaped_for_json(StringView string) { for (auto ch : string) { switch (ch) { diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index fc7f830dc4..36019dffa7 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -21,7 +21,7 @@ public: explicit StringBuilder(size_t initial_capacity = inline_capacity); ~StringBuilder() = default; - void append(StringView const&); + void append(StringView); void append(Utf16View const&); void append(Utf32View const&); void append(char); @@ -30,7 +30,7 @@ public: void appendvf(char const*, va_list); void append_as_lowercase(char); - void append_escaped_for_json(StringView const&); + void append_escaped_for_json(StringView); template<typename... Parameters> void appendff(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters) diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index 78d49a48e2..d62499f45e 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -19,7 +19,7 @@ namespace AK { namespace StringUtils { -bool matches(const StringView& str, const StringView& mask, CaseSensitivity case_sensitivity, Vector<MaskSpan>* match_spans) +bool matches(StringView str, StringView mask, CaseSensitivity case_sensitivity, Vector<MaskSpan>* match_spans) { auto record_span = [&match_spans](size_t start, size_t length) { if (match_spans) @@ -79,7 +79,7 @@ bool matches(const StringView& str, const StringView& mask, CaseSensitivity case } template<typename T> -Optional<T> convert_to_int(const StringView& str, TrimWhitespace trim_whitespace) +Optional<T> convert_to_int(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -113,14 +113,14 @@ Optional<T> convert_to_int(const StringView& str, TrimWhitespace trim_whitespace return value; } -template Optional<i8> convert_to_int(const StringView& str, TrimWhitespace); -template Optional<i16> convert_to_int(const StringView& str, TrimWhitespace); -template Optional<i32> convert_to_int(const StringView& str, TrimWhitespace); -template Optional<long> convert_to_int(const StringView& str, TrimWhitespace); -template Optional<long long> convert_to_int(const StringView& str, TrimWhitespace); +template Optional<i8> convert_to_int(StringView str, TrimWhitespace); +template Optional<i16> convert_to_int(StringView str, TrimWhitespace); +template Optional<i32> convert_to_int(StringView str, TrimWhitespace); +template Optional<long> convert_to_int(StringView str, TrimWhitespace); +template Optional<long long> convert_to_int(StringView str, TrimWhitespace); template<typename T> -Optional<T> convert_to_uint(const StringView& str, TrimWhitespace trim_whitespace) +Optional<T> convert_to_uint(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -144,16 +144,16 @@ Optional<T> convert_to_uint(const StringView& str, TrimWhitespace trim_whitespac return value; } -template Optional<u8> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<u16> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<u32> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<unsigned long> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<unsigned long long> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<long> convert_to_uint(const StringView& str, TrimWhitespace); -template Optional<long long> convert_to_uint(const StringView& str, TrimWhitespace); +template Optional<u8> convert_to_uint(StringView str, TrimWhitespace); +template Optional<u16> convert_to_uint(StringView str, TrimWhitespace); +template Optional<u32> convert_to_uint(StringView str, TrimWhitespace); +template Optional<unsigned long> convert_to_uint(StringView str, TrimWhitespace); +template Optional<unsigned long long> convert_to_uint(StringView str, TrimWhitespace); +template Optional<long> convert_to_uint(StringView str, TrimWhitespace); +template Optional<long long> convert_to_uint(StringView str, TrimWhitespace); template<typename T> -Optional<T> convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_whitespace) +Optional<T> convert_to_uint_from_hex(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -186,12 +186,12 @@ Optional<T> convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_ return value; } -template Optional<u8> convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional<u16> convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional<u32> convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional<u64> convert_to_uint_from_hex(const StringView& str, TrimWhitespace); +template Optional<u8> convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional<u16> convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional<u32> convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional<u64> convert_to_uint_from_hex(StringView str, TrimWhitespace); -bool equals_ignoring_case(const StringView& a, const StringView& b) +bool equals_ignoring_case(StringView a, StringView b) { if (a.length() != b.length()) return false; @@ -202,7 +202,7 @@ bool equals_ignoring_case(const StringView& a, const StringView& b) return true; } -bool ends_with(const StringView& str, const StringView& end, CaseSensitivity case_sensitivity) +bool ends_with(StringView str, StringView end, CaseSensitivity case_sensitivity) { if (end.is_empty()) return true; @@ -225,7 +225,7 @@ bool ends_with(const StringView& str, const StringView& end, CaseSensitivity cas return true; } -bool starts_with(const StringView& str, const StringView& start, CaseSensitivity case_sensitivity) +bool starts_with(StringView str, StringView start, CaseSensitivity case_sensitivity) { if (start.is_empty()) return true; @@ -250,7 +250,7 @@ bool starts_with(const StringView& str, const StringView& start, CaseSensitivity return true; } -bool contains(const StringView& str, const StringView& needle, CaseSensitivity case_sensitivity) +bool contains(StringView str, StringView needle, CaseSensitivity case_sensitivity) { if (str.is_null() || needle.is_null() || str.is_empty() || needle.length() > str.length()) return false; @@ -277,12 +277,12 @@ bool contains(const StringView& str, const StringView& needle, CaseSensitivity c return false; } -bool is_whitespace(const StringView& str) +bool is_whitespace(StringView str) { return all_of(str, is_ascii_space); } -StringView trim(const StringView& str, const StringView& characters, TrimMode mode) +StringView trim(StringView str, StringView characters, TrimMode mode) { size_t substring_start = 0; size_t substring_length = str.length(); @@ -311,12 +311,12 @@ StringView trim(const StringView& str, const StringView& characters, TrimMode mo return str.substring_view(substring_start, substring_length); } -StringView trim_whitespace(const StringView& str, TrimMode mode) +StringView trim_whitespace(StringView str, TrimMode mode) { return trim(str, " \n\t\v\f\r", mode); } -Optional<size_t> find(StringView const& haystack, char needle, size_t start) +Optional<size_t> find(StringView haystack, char needle, size_t start) { if (start >= haystack.length()) return {}; @@ -327,7 +327,7 @@ Optional<size_t> find(StringView const& haystack, char needle, size_t start) return {}; } -Optional<size_t> find(StringView const& haystack, StringView const& needle, size_t start) +Optional<size_t> find(StringView haystack, StringView needle, size_t start) { if (start > haystack.length()) return {}; @@ -337,7 +337,7 @@ Optional<size_t> find(StringView const& haystack, StringView const& needle, size return index.has_value() ? (*index + start) : index; } -Optional<size_t> find_last(StringView const& haystack, char needle) +Optional<size_t> find_last(StringView haystack, char needle) { for (size_t i = haystack.length(); i > 0; --i) { if (haystack[i - 1] == needle) @@ -346,7 +346,7 @@ Optional<size_t> find_last(StringView const& haystack, char needle) return {}; } -Vector<size_t> find_all(StringView const& haystack, StringView const& needle) +Vector<size_t> find_all(StringView haystack, StringView needle) { Vector<size_t> positions; size_t current_position = 0; @@ -362,7 +362,7 @@ Vector<size_t> find_all(StringView const& haystack, StringView const& needle) return positions; } -Optional<size_t> find_any_of(StringView const& haystack, StringView const& needles, SearchDirection direction) +Optional<size_t> find_any_of(StringView haystack, StringView needles, SearchDirection direction) { if (haystack.is_empty() || needles.is_empty()) return {}; @@ -380,7 +380,7 @@ Optional<size_t> find_any_of(StringView const& haystack, StringView const& needl return {}; } -String to_snakecase(const StringView& str) +String to_snakecase(StringView str) { auto should_insert_underscore = [&](auto i, auto current_char) { if (i == 0) @@ -406,7 +406,7 @@ String to_snakecase(const StringView& str) return builder.to_string(); } -String to_titlecase(StringView const& str) +String to_titlecase(StringView str) { StringBuilder builder; bool next_is_upper = true; @@ -422,7 +422,7 @@ String to_titlecase(StringView const& str) return builder.to_string(); } -String replace(StringView const& str, StringView const& needle, StringView const& replacement, bool all_occurrences) +String replace(StringView str, StringView needle, StringView replacement, bool all_occurrences) { if (str.is_empty()) return str; @@ -451,7 +451,7 @@ String replace(StringView const& str, StringView const& needle, StringView const } // TODO: Benchmark against KMP (AK/MemMem.h) and switch over if it's faster for short strings too -size_t count(StringView const& str, StringView const& needle) +size_t count(StringView str, StringView needle) { if (needle.is_empty()) return str.length(); diff --git a/AK/StringUtils.h b/AK/StringUtils.h index dabf4a1fef..13794c4d0c 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -43,36 +43,36 @@ struct MaskSpan { namespace StringUtils { -bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector<MaskSpan>* match_spans = nullptr); +bool matches(StringView str, StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector<MaskSpan>* match_spans = nullptr); template<typename T = int> -Optional<T> convert_to_int(const StringView&, TrimWhitespace = TrimWhitespace::Yes); +Optional<T> convert_to_int(StringView, TrimWhitespace = TrimWhitespace::Yes); template<typename T = unsigned> -Optional<T> convert_to_uint(const StringView&, TrimWhitespace = TrimWhitespace::Yes); +Optional<T> convert_to_uint(StringView, TrimWhitespace = TrimWhitespace::Yes); template<typename T = unsigned> -Optional<T> convert_to_uint_from_hex(const StringView&, TrimWhitespace = TrimWhitespace::Yes); -bool equals_ignoring_case(const StringView&, const StringView&); -bool ends_with(const StringView& a, const StringView& b, CaseSensitivity); -bool starts_with(const StringView&, const StringView&, CaseSensitivity); -bool contains(const StringView&, const StringView&, CaseSensitivity); -bool is_whitespace(const StringView&); -StringView trim(const StringView& string, const StringView& characters, TrimMode mode); -StringView trim_whitespace(const StringView& string, TrimMode mode); - -Optional<size_t> find(StringView const& haystack, char needle, size_t start = 0); -Optional<size_t> find(StringView const& haystack, StringView const& needle, size_t start = 0); -Optional<size_t> find_last(StringView const& haystack, char needle); -Vector<size_t> find_all(StringView const& haystack, StringView const& needle); +Optional<T> convert_to_uint_from_hex(StringView, TrimWhitespace = TrimWhitespace::Yes); +bool equals_ignoring_case(StringView, StringView); +bool ends_with(StringView a, StringView b, CaseSensitivity); +bool starts_with(StringView, StringView, CaseSensitivity); +bool contains(StringView, StringView, CaseSensitivity); +bool is_whitespace(StringView); +StringView trim(StringView string, StringView characters, TrimMode mode); +StringView trim_whitespace(StringView string, TrimMode mode); + +Optional<size_t> find(StringView haystack, char needle, size_t start = 0); +Optional<size_t> find(StringView haystack, StringView needle, size_t start = 0); +Optional<size_t> find_last(StringView haystack, char needle); +Vector<size_t> find_all(StringView haystack, StringView needle); enum class SearchDirection { Forward, Backward }; -Optional<size_t> find_any_of(StringView const& haystack, StringView const& needles, SearchDirection); +Optional<size_t> find_any_of(StringView haystack, StringView needles, SearchDirection); -String to_snakecase(const StringView&); -String to_titlecase(StringView const&); +String to_snakecase(StringView); +String to_titlecase(StringView); -String replace(StringView const&, StringView const& needle, StringView const& replacement, bool all_occurrences = false); -size_t count(StringView const&, StringView const& needle); +String replace(StringView, StringView needle, StringView replacement, bool all_occurrences = false); +size_t count(StringView, StringView needle); } diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 3bd40ac06b..79273bc5c7 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -56,7 +56,7 @@ Vector<StringView> StringView::split_view(const char separator, bool keep_empty) return v; } -Vector<StringView> StringView::split_view(const StringView& separator, bool keep_empty) const +Vector<StringView> StringView::split_view(StringView separator, bool keep_empty) const { VERIFY(!separator.is_empty()); @@ -129,7 +129,7 @@ bool StringView::starts_with(char ch) const return ch == characters_without_null_termination()[0]; } -bool StringView::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool StringView::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); } @@ -141,17 +141,17 @@ bool StringView::ends_with(char ch) const return ch == characters_without_null_termination()[length() - 1]; } -bool StringView::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool StringView::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(*this, str, case_sensitivity); } -bool StringView::matches(const StringView& mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const +bool StringView::matches(StringView mask, Vector<MaskSpan>& mask_spans, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans); } -bool StringView::matches(const StringView& mask, CaseSensitivity case_sensitivity) const +bool StringView::matches(StringView mask, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity); } @@ -165,12 +165,12 @@ bool StringView::contains(char needle) const return false; } -bool StringView::contains(const StringView& needle, CaseSensitivity case_sensitivity) const +bool StringView::contains(StringView needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, needle, case_sensitivity); } -bool StringView::equals_ignoring_case(const StringView& other) const +bool StringView::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(*this, other); } @@ -190,7 +190,7 @@ String StringView::to_titlecase_string() const return StringUtils::to_titlecase(*this); } -StringView StringView::substring_view_starting_from_substring(const StringView& substring) const +StringView StringView::substring_view_starting_from_substring(StringView substring) const { const char* remaining_characters = substring.characters_without_null_termination(); VERIFY(remaining_characters >= m_characters); @@ -199,7 +199,7 @@ StringView StringView::substring_view_starting_from_substring(const StringView& return { remaining_characters, remaining_length }; } -StringView StringView::substring_view_starting_after_substring(const StringView& substring) const +StringView StringView::substring_view_starting_after_substring(StringView substring) const { const char* remaining_characters = substring.characters_without_null_termination() + substring.length(); VERIFY(remaining_characters >= m_characters); @@ -249,7 +249,7 @@ bool StringView::operator==(const String& string) const String StringView::to_string() const { return String { *this }; } -String StringView::replace(const StringView& needle, const StringView& replacement, bool all_occurrences) const +String StringView::replace(StringView needle, StringView replacement, bool all_occurrences) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } diff --git a/AK/StringView.h b/AK/StringView.h index 0ba49a5d54..7a8fdd6ede 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -74,17 +74,17 @@ public: return string_hash(characters_without_null_termination(), length()); } - [[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool starts_with(char) const; [[nodiscard]] bool ends_with(char) const; - [[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - [[nodiscard]] bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; [[nodiscard]] bool contains(char) const; - [[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool equals_ignoring_case(const StringView& other) const; + [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool equals_ignoring_case(StringView other) const; - [[nodiscard]] StringView trim(const StringView& characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); } + [[nodiscard]] StringView trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); } [[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); } [[nodiscard]] String to_lowercase_string() const; @@ -92,14 +92,14 @@ public: [[nodiscard]] String to_titlecase_string() const; [[nodiscard]] Optional<size_t> find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } - [[nodiscard]] Optional<size_t> find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } + [[nodiscard]] Optional<size_t> find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } [[nodiscard]] Optional<size_t> find_last(char needle) const { return StringUtils::find_last(*this, needle); } - // FIXME: Implement find_last(StringView const&) for API symmetry. + // FIXME: Implement find_last(StringView) for API symmetry. [[nodiscard]] Vector<size_t> find_all(StringView needle) const; using SearchDirection = StringUtils::SearchDirection; - [[nodiscard]] Optional<size_t> find_any_of(StringView const& needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); } + [[nodiscard]] Optional<size_t> find_any_of(StringView needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); } [[nodiscard]] constexpr StringView substring_view(size_t start, size_t length) const { @@ -114,7 +114,7 @@ public: } [[nodiscard]] Vector<StringView> split_view(char, bool keep_empty = false) const; - [[nodiscard]] Vector<StringView> split_view(const StringView&, bool keep_empty = false) const; + [[nodiscard]] Vector<StringView> split_view(StringView, bool keep_empty = false) const; [[nodiscard]] Vector<StringView> split_view_if(Function<bool(char)> const& predicate, bool keep_empty = false) const; @@ -145,8 +145,8 @@ public: // StringView substr { "oo" }; // // would not work. - [[nodiscard]] StringView substring_view_starting_from_substring(const StringView& substring) const; - [[nodiscard]] StringView substring_view_starting_after_substring(const StringView& substring) const; + [[nodiscard]] StringView substring_view_starting_from_substring(StringView substring) const; + [[nodiscard]] StringView substring_view_starting_after_substring(StringView substring) const; constexpr bool operator==(const char* cstring) const { @@ -172,7 +172,7 @@ public: bool operator==(const String&) const; - constexpr bool operator==(const StringView& other) const + constexpr bool operator==(StringView other) const { if (is_null()) return other.is_null(); @@ -183,12 +183,12 @@ public: return !__builtin_memcmp(m_characters, other.m_characters, m_length); } - constexpr bool operator!=(const StringView& other) const + constexpr bool operator!=(StringView other) const { return !(*this == other); } - bool operator<(const StringView& other) const + bool operator<(StringView other) const { if (int c = __builtin_memcmp(m_characters, other.m_characters, min(m_length, other.m_length))) return c < 0; @@ -199,8 +199,8 @@ public: [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } - [[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const; - [[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); } + [[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const; + [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); } template<typename... Ts> [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const @@ -216,7 +216,7 @@ private: template<> struct Traits<StringView> : public GenericTraits<StringView> { - static unsigned hash(const StringView& s) { return s.hash(); } + static unsigned hash(StringView s) { return s.hash(); } }; } diff --git a/AK/URL.cpp b/AK/URL.cpp index 494ea18beb..dfc68bbd7e 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -16,7 +16,7 @@ namespace AK { // FIXME: It could make sense to force users of URL to use URLParser::parse() explicitly instead of using a constructor. -URL::URL(StringView const& string) +URL::URL(StringView string) : URL(URLParser::parse(string)) { if constexpr (URL_PARSER_DEBUG) { @@ -135,12 +135,12 @@ bool URL::compute_validity() const return true; } -bool URL::scheme_requires_port(StringView const& scheme) +bool URL::scheme_requires_port(StringView scheme) { return (default_port_for_scheme(scheme) != 0); } -u16 URL::default_port_for_scheme(StringView const& scheme) +u16 URL::default_port_for_scheme(StringView scheme) { if (scheme == "http") return 80; @@ -189,7 +189,7 @@ URL URL::create_with_url_or_path(String const& url_or_path) } // https://url.spec.whatwg.org/#special-scheme -bool URL::is_special_scheme(StringView const& scheme) +bool URL::is_special_scheme(StringView scheme) { return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss"); } @@ -403,7 +403,7 @@ void URL::append_percent_encoded_if_necessary(StringBuilder& builder, u32 code_p builder.append_code_point(code_point); } -String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set) +String URL::percent_encode(StringView input, URL::PercentEncodeSet set) { StringBuilder builder; for (auto code_point : Utf8View(input)) { @@ -412,7 +412,7 @@ String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set) return builder.to_string(); } -String URL::percent_decode(StringView const& input) +String URL::percent_decode(StringView input) { if (!input.contains('%')) return input; @@ -37,7 +37,7 @@ public: }; URL() = default; - URL(StringView const&); + URL(StringView); URL(char const* string) : URL(StringView(string)) { @@ -100,12 +100,12 @@ public: static URL create_with_file_protocol(String const& path, String const& fragment = {}) { return create_with_file_scheme(path, fragment); } static URL create_with_data(String mime_type, String payload, bool is_base64 = false) { return URL(move(mime_type), move(payload), is_base64); }; - static bool scheme_requires_port(StringView const&); - static u16 default_port_for_scheme(StringView const&); - static bool is_special_scheme(StringView const&); + static bool scheme_requires_port(StringView); + static u16 default_port_for_scheme(StringView); + static bool is_special_scheme(StringView); - static String percent_encode(StringView const& input, PercentEncodeSet set = PercentEncodeSet::Userinfo); - static String percent_decode(StringView const& input); + static String percent_encode(StringView input, PercentEncodeSet set = PercentEncodeSet::Userinfo); + static String percent_decode(StringView input); bool operator==(URL const& other) const { return equals(other, ExcludeFragment::No); } diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index 63cf3c449e..d508aa96dc 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -30,7 +30,7 @@ static void report_validation_error(SourceLocation const& location = SourceLocat dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Validation error! {}", location); } -static Optional<String> parse_opaque_host(StringView const& input) +static Optional<String> parse_opaque_host(StringView input) { auto forbidden_host_code_points_excluding_percent = "\0\t\n\r #/:<>?@[\\]^|"sv; for (auto code_point : forbidden_host_code_points_excluding_percent) { @@ -44,7 +44,7 @@ static Optional<String> parse_opaque_host(StringView const& input) return URL::percent_encode(input, URL::PercentEncodeSet::C0Control); } -static Optional<String> parse_ipv4_address(StringView const& input) +static Optional<String> parse_ipv4_address(StringView input) { // FIXME: Implement the correct IPv4 parser as specified by https://url.spec.whatwg.org/#concept-ipv4-parser. return input; @@ -52,7 +52,7 @@ static Optional<String> parse_ipv4_address(StringView const& input) // https://url.spec.whatwg.org/#concept-host-parser // NOTE: This is a very bare-bones implementation. -static Optional<String> parse_host(StringView const& input, bool is_not_special = false) +static Optional<String> parse_host(StringView input, bool is_not_special = false) { if (input.starts_with('[')) { if (!input.ends_with(']')) { @@ -84,7 +84,7 @@ static Optional<String> parse_host(StringView const& input, bool is_not_special return ipv4_host; } -constexpr bool starts_with_windows_drive_letter(StringView const& input) +constexpr bool starts_with_windows_drive_letter(StringView input) { if (input.length() < 2) return false; @@ -95,29 +95,29 @@ constexpr bool starts_with_windows_drive_letter(StringView const& input) return "/\\?#"sv.contains(input[2]); } -constexpr bool is_windows_drive_letter(StringView const& input) +constexpr bool is_windows_drive_letter(StringView input) { return input.length() == 2 && is_ascii_alpha(input[0]) && (input[1] == ':' || input[1] == '|'); } -constexpr bool is_normalized_windows_drive_letter(StringView const& input) +constexpr bool is_normalized_windows_drive_letter(StringView input) { return input.length() == 2 && is_ascii_alpha(input[0]) && input[1] == ':'; } -constexpr bool is_single_dot_path_segment(StringView const& input) +constexpr bool is_single_dot_path_segment(StringView input) { return input == "."sv || input.equals_ignoring_case("%2e"sv); } -constexpr bool is_double_dot_path_segment(StringView const& input) +constexpr bool is_double_dot_path_segment(StringView input) { return input == ".."sv || input.equals_ignoring_case(".%2e"sv) || input.equals_ignoring_case("%2e."sv) || input.equals_ignoring_case("%2e%2e"sv); } // https://fetch.spec.whatwg.org/#data-urls // FIXME: This only loosely follows the spec, as we use the same class for "regular" and data URLs, unlike the spec. -Optional<URL> URLParser::parse_data_url(StringView const& raw_input) +Optional<URL> URLParser::parse_data_url(StringView raw_input) { dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsing '{}'.", raw_input); VERIFY(raw_input.starts_with("data:")); @@ -161,7 +161,7 @@ Optional<URL> URLParser::parse_data_url(StringView const& raw_input) // NOTE: Since the URL class's member variables contain percent decoded data, we have to deviate from the URL parser specification when setting // some of those values. Because the specification leaves all values percent encoded in their URL data structure, we have to percent decode // everything before setting the member variables. -URL URLParser::parse(StringView const& raw_input, URL const* base_url, Optional<URL> url, Optional<State> state_override) +URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> url, Optional<State> state_override) { dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Parsing '{}'", raw_input); if (raw_input.is_empty()) diff --git a/AK/URLParser.h b/AK/URLParser.h index ea296c07c1..99e9dc0805 100644 --- a/AK/URLParser.h +++ b/AK/URLParser.h @@ -55,10 +55,10 @@ public: VERIFY_NOT_REACHED(); } - static URL parse(StringView const& input, URL const* base_url = nullptr, Optional<URL> url = {}, Optional<State> state_override = {}); + static URL parse(StringView input, URL const* base_url = nullptr, Optional<URL> url = {}, Optional<State> state_override = {}); private: - static Optional<URL> parse_data_url(StringView const& raw_input); + static Optional<URL> parse_data_url(StringView raw_input); }; #undef ENUMERATE_STATES diff --git a/AK/UUID.cpp b/AK/UUID.cpp index cc87d7adca..835da053b4 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -16,7 +16,7 @@ UUID::UUID(Array<u8, 16> uuid_buffer) uuid_buffer.span().copy_to(m_uuid_buffer); } -void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view) +void UUID::convert_string_view_to_uuid(StringView uuid_string_view) { VERIFY(uuid_string_view.length() == 36); auto first_unit = decode_hex(uuid_string_view.substring_view(0, 8)); @@ -36,7 +36,7 @@ void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view) m_uuid_buffer.span().overwrite(10, fifth_unit.value().data(), fifth_unit.value().size()); } -UUID::UUID(const StringView& uuid_string_view) +UUID::UUID(StringView uuid_string_view) { convert_string_view_to_uuid(uuid_string_view); } @@ -17,7 +17,7 @@ class UUID { public: UUID() = default; UUID(Array<u8, 16> uuid_buffer); - UUID(const StringView&); + UUID(StringView); ~UUID() = default; bool operator==(const UUID&) const; @@ -31,7 +31,7 @@ public: bool is_zero() const; private: - void convert_string_view_to_uuid(const StringView&); + void convert_string_view_to_uuid(StringView); Array<u8, 16> m_uuid_buffer {}; }; diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp index 09cd06cf16..3e29368a01 100644 --- a/AK/Utf16View.cpp +++ b/AK/Utf16View.cpp @@ -32,7 +32,7 @@ static Vector<u16, 1> to_utf16_impl(UtfViewType const& view) requires(IsSame<Utf return utf16_data; } -Vector<u16, 1> utf8_to_utf16(StringView const& utf8_view) +Vector<u16, 1> utf8_to_utf16(StringView utf8_view) { return to_utf16_impl(Utf8View { utf8_view }); } diff --git a/AK/Utf16View.h b/AK/Utf16View.h index 348ef085e8..5b6fc24e06 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -16,7 +16,7 @@ namespace AK { -Vector<u16, 1> utf8_to_utf16(StringView const&); +Vector<u16, 1> utf8_to_utf16(StringView); Vector<u16, 1> utf8_to_utf16(Utf8View const&); Vector<u16, 1> utf32_to_utf16(Utf32View const&); void code_point_to_utf16(Vector<u16, 1>&, u32); diff --git a/AK/Utf8View.h b/AK/Utf8View.h index 18b5a3df4b..60496deb9a 100644 --- a/AK/Utf8View.h +++ b/AK/Utf8View.h @@ -74,7 +74,7 @@ public: explicit Utf8View(String&&) = delete; - const StringView& as_string() const { return m_string; } + StringView as_string() const { return m_string; } Utf8CodePointIterator begin() const { return { begin_ptr(), m_string.length() }; } Utf8CodePointIterator end() const { return { end_ptr(), 0 }; } diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index a586a06657..6f8b88e74b 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -86,12 +86,12 @@ UNMAP_AFTER_INIT CommandLine::CommandLine(const String& cmdline_from_bootloader) add_arguments(args); } -Optional<StringView> CommandLine::lookup(const StringView& key) const +Optional<StringView> CommandLine::lookup(StringView key) const { return m_params.get(key); } -bool CommandLine::contains(const StringView& key) const +bool CommandLine::contains(StringView key) const { return m_params.contains(key); } diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 9b3f358760..6006958fee 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -54,8 +54,8 @@ public: }; [[nodiscard]] const String& string() const { return m_string; } - Optional<StringView> lookup(const StringView& key) const; - [[nodiscard]] bool contains(const StringView& key) const; + Optional<StringView> lookup(StringView key) const; + [[nodiscard]] bool contains(StringView key) const; [[nodiscard]] bool is_boot_profiling_enabled() const; [[nodiscard]] bool is_ide_enabled() const; diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index 422430d126..ae23695d31 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -149,7 +149,7 @@ ErrorOr<void> DevPtsFSInode::flush_metadata() return {}; } -ErrorOr<void> DevPtsFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr<void> DevPtsFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } @@ -159,7 +159,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, de return EROFS; } -ErrorOr<void> DevPtsFSInode::remove_child(const StringView&) +ErrorOr<void> DevPtsFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h index 65a6e92c1f..94b94e1b4f 100644 --- a/Kernel/FileSystem/DevPtsFS.h +++ b/Kernel/FileSystem/DevPtsFS.h @@ -54,8 +54,8 @@ private: virtual ErrorOr<void> flush_metadata() override; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; diff --git a/Kernel/FileSystem/DevTmpFS.cpp b/Kernel/FileSystem/DevTmpFS.cpp index 2ce31042fb..26cb558b2d 100644 --- a/Kernel/FileSystem/DevTmpFS.cpp +++ b/Kernel/FileSystem/DevTmpFS.cpp @@ -85,7 +85,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevTmpFSInode::create_child(StringView, mode_t, de VERIFY_NOT_REACHED(); } -ErrorOr<void> DevTmpFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr<void> DevTmpFSInode::add_child(Inode&, StringView, mode_t) { VERIFY_NOT_REACHED(); } @@ -134,7 +134,7 @@ InodeMetadata DevTmpFSInode::metadata() const return metadata; } -ErrorOr<void> DevTmpFSInode::remove_child(const StringView&) +ErrorOr<void> DevTmpFSInode::remove_child(StringView) { VERIFY_NOT_REACHED(); } @@ -233,7 +233,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevTmpFSDirectoryInode::lookup(StringView name) return Error::from_errno(ENOENT); } -ErrorOr<void> DevTmpFSDirectoryInode::remove_child(const StringView& name) +ErrorOr<void> DevTmpFSDirectoryInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); for (auto& node : m_nodes) { diff --git a/Kernel/FileSystem/DevTmpFS.h b/Kernel/FileSystem/DevTmpFS.h index 837ecb25df..92e4cfa3a6 100644 --- a/Kernel/FileSystem/DevTmpFS.h +++ b/Kernel/FileSystem/DevTmpFS.h @@ -55,8 +55,8 @@ protected: virtual InodeMetadata metadata() const override final; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; virtual ErrorOr<void> truncate(u64) override; @@ -137,7 +137,7 @@ protected: virtual Type node_type() const override { return Type::Directory; } virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override; virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override; DevTmpFSDirectoryInode(DevTmpFS&, NonnullOwnPtr<KString> name); diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index ae3be58d91..29505ac154 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1159,7 +1159,7 @@ ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t return fs().create_inode(*this, name, mode, dev, uid, gid); } -ErrorOr<void> Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode) +ErrorOr<void> Ext2FSInode::add_child(Inode& child, StringView name, mode_t mode) { MutexLocker locker(m_inode_lock); VERIFY(is_directory()); @@ -1189,7 +1189,7 @@ ErrorOr<void> Ext2FSInode::add_child(Inode& child, const StringView& name, mode_ return {}; } -ErrorOr<void> Ext2FSInode::remove_child(const StringView& name) +ErrorOr<void> Ext2FSInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::remove_child(): Removing '{}'", identifier(), name); diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h index be28f5aaa8..59c8fdbd0c 100644 --- a/Kernel/FileSystem/Ext2FileSystem.h +++ b/Kernel/FileSystem/Ext2FileSystem.h @@ -45,8 +45,8 @@ private: virtual ErrorOr<void> flush_metadata() override; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode& child, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode& child, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> set_atime(time_t) override; virtual ErrorOr<void> set_ctime(time_t) override; virtual ErrorOr<void> set_mtime(time_t) override; diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp index b98840fd0a..10eb4f50f4 100644 --- a/Kernel/FileSystem/FileSystem.cpp +++ b/Kernel/FileSystem/FileSystem.cpp @@ -42,7 +42,7 @@ FileSystem* FileSystem::from_fsid(u32 id) return nullptr; } -FileSystem::DirectoryEntryView::DirectoryEntryView(const StringView& n, InodeIdentifier i, u8 ft) +FileSystem::DirectoryEntryView::DirectoryEntryView(StringView n, InodeIdentifier i, u8 ft) : name(n) , inode(i) , file_type(ft) diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h index 9222d8e6aa..6cc2b50330 100644 --- a/Kernel/FileSystem/FileSystem.h +++ b/Kernel/FileSystem/FileSystem.h @@ -46,7 +46,7 @@ public: virtual ErrorOr<void> prepare_to_unmount() { return {}; } struct DirectoryEntryView { - DirectoryEntryView(const StringView& name, InodeIdentifier, u8 file_type); + DirectoryEntryView(StringView name, InodeIdentifier, u8 file_type); StringView name; InodeIdentifier inode; diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp index aec85af922..2dbfe034cd 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.cpp +++ b/Kernel/FileSystem/ISO9660FileSystem.cpp @@ -512,12 +512,12 @@ ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev return EROFS; } -ErrorOr<void> ISO9660Inode::add_child(Inode&, const StringView&, mode_t) +ErrorOr<void> ISO9660Inode::add_child(Inode&, StringView, mode_t) { return EROFS; } -ErrorOr<void> ISO9660Inode::remove_child(const StringView&) +ErrorOr<void> ISO9660Inode::remove_child(StringView) { return EROFS; } @@ -556,7 +556,7 @@ void ISO9660Inode::one_ref_left() { } -ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name) +ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) : Inode(fs, get_inode_index(record, name)) , m_record(record) { @@ -568,7 +568,7 @@ ISO9660Inode::~ISO9660Inode() { } -ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name) +ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) { return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name)); } @@ -651,7 +651,7 @@ StringView ISO9660Inode::get_normalized_filename(ISO::DirectoryRecordHeader cons return { buffer.data(), filename.length() }; } -InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name) +InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name) { if (name.is_null()) { // NOTE: This is the index of the root inode. diff --git a/Kernel/FileSystem/ISO9660FileSystem.h b/Kernel/FileSystem/ISO9660FileSystem.h index 70b17b0e2d..68d8f291d1 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.h +++ b/Kernel/FileSystem/ISO9660FileSystem.h @@ -354,8 +354,8 @@ public: virtual ErrorOr<void> flush_metadata() override; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; virtual ErrorOr<void> truncate(u64) override; @@ -370,10 +370,10 @@ private: // without any problems, so let's allow it anyway. static constexpr size_t max_file_identifier_length = 256 - sizeof(ISO::DirectoryRecordHeader); - ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name); - static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name); + ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); + static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); - static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name); + static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name); static StringView get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer); void create_metadata(); diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 68ca3ce824..6ae9f03b11 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -57,8 +57,8 @@ public: virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) = 0; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) = 0; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) = 0; - virtual ErrorOr<void> remove_child(const StringView& name) = 0; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) = 0; + virtual ErrorOr<void> remove_child(StringView name) = 0; virtual ErrorOr<void> chmod(mode_t) = 0; virtual ErrorOr<void> chown(UserID, GroupID) = 0; virtual ErrorOr<void> truncate(u64) { return {}; } diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index c543ada187..3834498616 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -112,7 +112,7 @@ public: class Decoder { public: - explicit Decoder(const StringView& data) + explicit Decoder(StringView data) : m_data(data) { } @@ -144,8 +144,8 @@ public: Message& operator<<(u16); Message& operator<<(u32); Message& operator<<(u64); - Message& operator<<(const StringView&); - void append_data(const StringView&); + Message& operator<<(StringView); + void append_data(StringView); template<typename T> Message& operator>>(T& t) @@ -228,7 +228,7 @@ ErrorOr<void> Plan9FS::initialize() return {}; } -Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(const StringView& s) const +Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(StringView s) const { if (s == "9P2000.L") return ProtocolVersion::v9P2000L; @@ -262,7 +262,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(u64 number) return append_number(number); } -Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string) +Plan9FS::Message& Plan9FS::Message::operator<<(StringView string) { *this << static_cast<u16>(string.length()); // FIXME: Handle append failure. @@ -270,7 +270,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string) return *this; } -void Plan9FS::Message::append_data(const StringView& data) +void Plan9FS::Message::append_data(StringView data) { *this << static_cast<u32>(data.length()); // FIXME: Handle append failure. @@ -908,13 +908,13 @@ ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev return ENOTIMPL; } -ErrorOr<void> Plan9FSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr<void> Plan9FSInode::add_child(Inode&, StringView, mode_t) { // TODO return ENOTIMPL; } -ErrorOr<void> Plan9FSInode::remove_child(const StringView&) +ErrorOr<void> Plan9FSInode::remove_child(StringView) { // TODO return ENOTIMPL; diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h index 13c7b4fd3b..df0cf3d9ca 100644 --- a/Kernel/FileSystem/Plan9FileSystem.h +++ b/Kernel/FileSystem/Plan9FileSystem.h @@ -122,7 +122,7 @@ private: ErrorOr<void> post_message_and_wait_for_a_reply(Message&); ErrorOr<void> post_message_and_explicitly_ignore_reply(Message&); - ProtocolVersion parse_protocol_version(const StringView&) const; + ProtocolVersion parse_protocol_version(StringView) const; size_t adjust_buffer_size(size_t size) const; void thread_main(); @@ -161,8 +161,8 @@ public: virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override; virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; virtual ErrorOr<void> truncate(u64) override; diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index bcd5e50371..05ae501b72 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -75,7 +75,7 @@ ErrorOr<void> ProcFSInode::flush_metadata() return {}; } -ErrorOr<void> ProcFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr<void> ProcFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } @@ -85,7 +85,7 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::create_child(StringView, mode_t, dev_ return EROFS; } -ErrorOr<void> ProcFSInode::remove_child(const StringView&) +ErrorOr<void> ProcFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h index 6ed723cf8a..de4ca65c7a 100644 --- a/Kernel/FileSystem/ProcFS.h +++ b/Kernel/FileSystem/ProcFS.h @@ -58,8 +58,8 @@ protected: virtual void did_seek(OpenFileDescription&, off_t) = 0; virtual ErrorOr<void> flush_metadata() override final; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override final; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override final; - virtual ErrorOr<void> remove_child(const StringView& name) override final; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override final; + virtual ErrorOr<void> remove_child(StringView name) override final; virtual ErrorOr<void> chmod(mode_t) override final; virtual ErrorOr<void> chown(UserID, GroupID) override final; }; diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp index 3ae80d3a31..66457930cb 100644 --- a/Kernel/FileSystem/SysFS.cpp +++ b/Kernel/FileSystem/SysFS.cpp @@ -163,12 +163,12 @@ ErrorOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t return EROFS; } -ErrorOr<void> SysFSInode::add_child(Inode&, StringView const&, mode_t) +ErrorOr<void> SysFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } -ErrorOr<void> SysFSInode::remove_child(StringView const&) +ErrorOr<void> SysFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h index 2a021a4890..818c035267 100644 --- a/Kernel/FileSystem/SysFS.h +++ b/Kernel/FileSystem/SysFS.h @@ -141,8 +141,8 @@ protected: virtual InodeMetadata metadata() const override; virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, StringView const& name, mode_t) override; - virtual ErrorOr<void> remove_child(StringView const& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; virtual ErrorOr<void> truncate(u64) override; diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index cdff254276..587e9505e2 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -269,7 +269,7 @@ ErrorOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(StringView name, mode_t m return child; } -ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView const& name, mode_t) +ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView name, mode_t) { VERIFY(is_directory()); VERIFY(child.fsid() == fsid()); @@ -289,7 +289,7 @@ ErrorOr<void> TmpFSInode::add_child(Inode& child, StringView const& name, mode_t return {}; } -ErrorOr<void> TmpFSInode::remove_child(StringView const& name) +ErrorOr<void> TmpFSInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); VERIFY(is_directory()); diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index 43f83ef3a5..eca20a43e3 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -59,8 +59,8 @@ public: virtual ErrorOr<void> flush_metadata() override; virtual ErrorOr<size_t> write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr<void> add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr<void> remove_child(const StringView& name) override; + virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr<void> remove_child(StringView name) override; virtual ErrorOr<void> chmod(mode_t) override; virtual ErrorOr<void> chown(UserID, GroupID) override; virtual ErrorOr<void> truncate(u64) override; diff --git a/Kernel/Firmware/ACPI/Definitions.h b/Kernel/Firmware/ACPI/Definitions.h index ee46562144..1531644e32 100644 --- a/Kernel/Firmware/ACPI/Definitions.h +++ b/Kernel/Firmware/ACPI/Definitions.h @@ -328,7 +328,7 @@ class Parser; namespace StaticParsing { Optional<PhysicalAddress> find_rsdp(); -Optional<PhysicalAddress> find_table(PhysicalAddress rsdp, const StringView& signature); +Optional<PhysicalAddress> find_table(PhysicalAddress rsdp, StringView signature); } } diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp index ef19a8661c..745af138e8 100644 --- a/Kernel/Firmware/ACPI/Parser.cpp +++ b/Kernel/Firmware/ACPI/Parser.cpp @@ -75,7 +75,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& { NonnullRefPtrVector<SysFSComponent> components; size_t ssdt_count = 0; - ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) { + ACPI::Parser::the()->enumerate_static_tables([&](StringView signature, PhysicalAddress p_table, size_t length) { if (signature == "SSDT") { components.append(ACPISysFSComponent::create(String::formatted("{:4s}{}", signature.characters_without_null_termination(), ssdt_count), p_table, length)); ssdt_count++; @@ -96,7 +96,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& } } -void Parser::enumerate_static_tables(Function<void(const StringView&, PhysicalAddress, size_t)> callback) +void Parser::enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)> callback) { for (auto& p_table : m_sdt_pointers) { auto table = Memory::map_typed<Structures::SDTHeader>(p_table); @@ -104,9 +104,9 @@ void Parser::enumerate_static_tables(Function<void(const StringView&, PhysicalAd } } -static bool match_table_signature(PhysicalAddress table_header, const StringView& signature); -static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt, const StringView& signature); -static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt, const StringView& signature); +static bool match_table_signature(PhysicalAddress table_header, StringView signature); +static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt, StringView signature); +static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt, StringView signature); static bool validate_table(const Structures::SDTHeader&, size_t length); UNMAP_AFTER_INIT void Parser::locate_static_data() @@ -116,7 +116,7 @@ UNMAP_AFTER_INIT void Parser::locate_static_data() process_fadt_data(); } -UNMAP_AFTER_INIT Optional<PhysicalAddress> Parser::find_table(const StringView& signature) +UNMAP_AFTER_INIT Optional<PhysicalAddress> Parser::find_table(StringView signature) { dbgln_if(ACPI_DEBUG, "ACPI: Calling Find Table method!"); for (auto p_sdt : m_sdt_pointers) { @@ -383,7 +383,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_rsdp() return map_bios().find_chunk_starting_with(signature, 16); } -UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature) +UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAddress rsdp_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -401,7 +401,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_table(PhysicalAdd VERIFY_NOT_REACHED(); } -UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature) +UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalAddress xsdt_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -415,7 +415,7 @@ UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_xsdt(PhysicalA return {}; } -static bool match_table_signature(PhysicalAddress table_header, const StringView& signature) +static bool match_table_signature(PhysicalAddress table_header, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -424,7 +424,7 @@ static bool match_table_signature(PhysicalAddress table_header, const StringView return !strncmp(table->h.sig, signature.characters_without_null_termination(), 4); } -UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature) +UNMAP_AFTER_INIT static Optional<PhysicalAddress> search_table_in_rsdt(PhysicalAddress rsdt_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); diff --git a/Kernel/Firmware/ACPI/Parser.h b/Kernel/Firmware/ACPI/Parser.h index 903d6d5b49..6bb350f798 100644 --- a/Kernel/Firmware/ACPI/Parser.h +++ b/Kernel/Firmware/ACPI/Parser.h @@ -51,7 +51,7 @@ public: virtual StringView purpose() const override { return "ACPI Parser"sv; } virtual bool handle_irq(const RegisterState&) override; - Optional<PhysicalAddress> find_table(const StringView& signature); + Optional<PhysicalAddress> find_table(StringView signature); void try_acpi_reboot(); bool can_reboot(); @@ -64,7 +64,7 @@ public: PhysicalAddress main_system_description_table() const { return m_main_system_description_table; } bool is_xsdt_supported() const { return m_xsdt_supported; } - void enumerate_static_tables(Function<void(const StringView&, PhysicalAddress, size_t)>); + void enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)>); virtual bool have_8042() const { diff --git a/Kernel/KBufferBuilder.cpp b/Kernel/KBufferBuilder.cpp index cc944e9303..6e1654f3dd 100644 --- a/Kernel/KBufferBuilder.cpp +++ b/Kernel/KBufferBuilder.cpp @@ -66,7 +66,7 @@ ErrorOr<void> KBufferBuilder::append_bytes(ReadonlyBytes bytes) return {}; } -ErrorOr<void> KBufferBuilder::append(const StringView& str) +ErrorOr<void> KBufferBuilder::append(StringView str) { if (str.is_empty()) return {}; @@ -97,7 +97,7 @@ ErrorOr<void> KBufferBuilder::append(char ch) return {}; } -ErrorOr<void> KBufferBuilder::append_escaped_for_json(const StringView& string) +ErrorOr<void> KBufferBuilder::append_escaped_for_json(StringView string) { for (auto ch : string) { switch (ch) { diff --git a/Kernel/KBufferBuilder.h b/Kernel/KBufferBuilder.h index e46f4bc462..e6cded298e 100644 --- a/Kernel/KBufferBuilder.h +++ b/Kernel/KBufferBuilder.h @@ -24,11 +24,11 @@ public: KBufferBuilder& operator=(KBufferBuilder&&) = default; ~KBufferBuilder() = default; - ErrorOr<void> append(const StringView&); + ErrorOr<void> append(StringView); ErrorOr<void> append(char); ErrorOr<void> append(const char*, int); - ErrorOr<void> append_escaped_for_json(const StringView&); + ErrorOr<void> append_escaped_for_json(StringView); ErrorOr<void> append_bytes(ReadonlyBytes); template<typename... Parameters> diff --git a/Kernel/KLexicalPath.cpp b/Kernel/KLexicalPath.cpp index 8167cdb3f3..ee5cd22771 100644 --- a/Kernel/KLexicalPath.cpp +++ b/Kernel/KLexicalPath.cpp @@ -11,12 +11,12 @@ namespace Kernel::KLexicalPath { static StringView const s_single_dot = "."sv; -bool is_absolute(StringView const& path) +bool is_absolute(StringView path) { return !path.is_empty() && path[0] == '/'; } -bool is_canonical(StringView const& path) +bool is_canonical(StringView path) { // FIXME: This can probably be done more efficiently. if (path.is_empty()) @@ -32,7 +32,7 @@ bool is_canonical(StringView const& path) return true; } -StringView basename(StringView const& a_path) +StringView basename(StringView a_path) { if (a_path == "/"sv) return a_path; @@ -49,7 +49,7 @@ StringView basename(StringView const& a_path) return basename; } -StringView dirname(StringView const& path) +StringView dirname(StringView path) { VERIFY(is_canonical(path)); auto slash_index = path.find_last('/'); @@ -57,13 +57,13 @@ StringView dirname(StringView const& path) return path.substring_view(0, *slash_index); } -Vector<StringView> parts(StringView const& path) +Vector<StringView> parts(StringView path) { VERIFY(is_canonical(path)); return path.split_view('/'); } -ErrorOr<NonnullOwnPtr<KString>> try_join(StringView const& first, StringView const& second) +ErrorOr<NonnullOwnPtr<KString>> try_join(StringView first, StringView second) { VERIFY(is_canonical(first)); VERIFY(is_canonical(second)); diff --git a/Kernel/KLexicalPath.h b/Kernel/KLexicalPath.h index e2cdc06df8..73c29b2d10 100644 --- a/Kernel/KLexicalPath.h +++ b/Kernel/KLexicalPath.h @@ -11,12 +11,12 @@ namespace Kernel::KLexicalPath { -bool is_absolute(StringView const&); -bool is_canonical(StringView const&); -StringView basename(StringView const&); -StringView dirname(StringView const&); -Vector<StringView> parts(StringView const&); +bool is_absolute(StringView); +bool is_canonical(StringView); +StringView basename(StringView); +StringView dirname(StringView); +Vector<StringView> parts(StringView); -ErrorOr<NonnullOwnPtr<KString>> try_join(StringView const&, StringView const&); +ErrorOr<NonnullOwnPtr<KString>> try_join(StringView, StringView); } diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index d199e78b03..702c3177ed 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -33,7 +33,7 @@ static u8 parse_hex_digit(char nibble) return 10 + (nibble - 'a'); } -FlatPtr address_for_kernel_symbol(const StringView& name) +FlatPtr address_for_kernel_symbol(StringView name) { for (size_t i = 0; i < s_symbol_count; ++i) { const auto& symbol = s_symbols[i]; diff --git a/Kernel/KSyms.h b/Kernel/KSyms.h index 17712f0270..2bc6699695 100644 --- a/Kernel/KSyms.h +++ b/Kernel/KSyms.h @@ -20,7 +20,7 @@ enum class PrintToScreen { Yes, }; -FlatPtr address_for_kernel_symbol(const StringView& name); +FlatPtr address_for_kernel_symbol(StringView name); const KernelSymbol* symbolicate_kernel_address(FlatPtr); void load_kernel_symbol_table(); diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp index 64ed1ef2a6..994de75306 100644 --- a/Kernel/Net/NetworkingManagement.cpp +++ b/Kernel/Net/NetworkingManagement.cpp @@ -63,7 +63,7 @@ RefPtr<NetworkAdapter> NetworkingManagement::from_ipv4_address(const IPv4Address return m_loopback_adapter; return {}; } -RefPtr<NetworkAdapter> NetworkingManagement::lookup_by_name(const StringView& name) const +RefPtr<NetworkAdapter> NetworkingManagement::lookup_by_name(StringView name) const { MutexLocker locker(m_lock); RefPtr<NetworkAdapter> found_adapter; diff --git a/Kernel/Net/NetworkingManagement.h b/Kernel/Net/NetworkingManagement.h index cec11713cf..f2feb641fd 100644 --- a/Kernel/Net/NetworkingManagement.h +++ b/Kernel/Net/NetworkingManagement.h @@ -34,7 +34,7 @@ public: void for_each(Function<void(NetworkAdapter&)>); RefPtr<NetworkAdapter> from_ipv4_address(const IPv4Address&) const; - RefPtr<NetworkAdapter> lookup_by_name(const StringView&) const; + RefPtr<NetworkAdapter> lookup_by_name(StringView) const; NonnullRefPtr<NetworkAdapter> loopback_adapter() const; diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index 7bf55726fb..c6561d9ad4 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -21,7 +21,7 @@ PerformanceEventBuffer::PerformanceEventBuffer(NonnullOwnPtr<KBuffer> buffer) { } -NEVER_INLINE ErrorOr<void> PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread) +NEVER_INLINE ErrorOr<void> PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread) { FlatPtr ebp; asm volatile("movl %%ebp, %%eax" @@ -56,13 +56,13 @@ static Vector<FlatPtr, PerformanceEvent::max_stack_frame_count> raw_backtrace(Fl } ErrorOr<void> PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3) + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3) { return append_with_ip_and_bp(pid, tid, regs.ip(), regs.bp(), type, lost_samples, arg1, arg2, arg3); } ErrorOr<void> PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid, - FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3) + FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3) { if (count() >= capacity()) return ENOBUFS; diff --git a/Kernel/PerformanceEventBuffer.h b/Kernel/PerformanceEventBuffer.h index c8b8430139..aa5a21bcb0 100644 --- a/Kernel/PerformanceEventBuffer.h +++ b/Kernel/PerformanceEventBuffer.h @@ -101,11 +101,11 @@ class PerformanceEventBuffer { public: static OwnPtr<PerformanceEventBuffer> try_create_with_size(size_t buffer_size); - ErrorOr<void> append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread = Thread::current()); + ErrorOr<void> append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread = Thread::current()); ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, FlatPtr eip, FlatPtr ebp, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3); + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3); ErrorOr<void> append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3); + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3); void clear() { diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 453ba36da2..26ec25b7fa 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -328,7 +328,7 @@ void VirtualConsole::beep() dbgln("Beep!1"); } -void VirtualConsole::set_window_title(const StringView&) +void VirtualConsole::set_window_title(StringView) { // Do nothing. } diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h index dd7ce2a99b..458fa96235 100644 --- a/Kernel/TTY/VirtualConsole.h +++ b/Kernel/TTY/VirtualConsole.h @@ -97,7 +97,7 @@ private: // ^TerminalClient virtual void beep() override; - virtual void set_window_title(const StringView&) override; + virtual void set_window_title(StringView) override; virtual void set_window_progress(int, int) override; virtual void terminal_did_resize(u16 columns, u16 rows) override; virtual void terminal_history_changed(int) override; @@ -123,7 +123,7 @@ private: void clear(); - void inject_string(const StringView&); + void inject_string(StringView); Cell& cell_at(size_t column, size_t row); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp index 01e4d8f261..2dd422347a 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp @@ -126,7 +126,7 @@ struct UnicodeData { NormalizationProps normalization_props; }; -static Vector<u32> parse_code_point_list(StringView const& list) +static Vector<u32> parse_code_point_list(StringView list) { Vector<u32> code_points; @@ -137,7 +137,7 @@ static Vector<u32> parse_code_point_list(StringView const& list) return code_points; } -static CodePointRange parse_code_point_range(StringView const& list) +static CodePointRange parse_code_point_range(StringView list) { CodePointRange code_point_range {}; @@ -532,14 +532,14 @@ u32 simple_lowercase_mapping(u32 code_point); Span<SpecialCasing const* const> special_case_mapping(u32 code_point); bool code_point_has_general_category(u32 code_point, GeneralCategory general_category); -Optional<GeneralCategory> general_category_from_string(StringView const& general_category); +Optional<GeneralCategory> general_category_from_string(StringView general_category); bool code_point_has_property(u32 code_point, Property property); -Optional<Property> property_from_string(StringView const& property); +Optional<Property> property_from_string(StringView property); bool code_point_has_script(u32 code_point, Script script); bool code_point_has_script_extension(u32 code_point, Script script); -Optional<Script> script_from_string(StringView const& script); +Optional<Script> script_from_string(StringView script); } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp index 7ea7c2e3f1..bb8df81141 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp @@ -660,32 +660,32 @@ namespace Unicode { generator.append(R"~~~( namespace Detail { -Optional<Locale> locale_from_string(StringView const& locale); +Optional<Locale> locale_from_string(StringView locale); Optional<StringView> get_locale_language_mapping(StringView locale, StringView language); -Optional<Language> language_from_string(StringView const& language); -Optional<StringView> resolve_language_alias(StringView const& language); +Optional<Language> language_from_string(StringView language); +Optional<StringView> resolve_language_alias(StringView language); Optional<StringView> get_locale_territory_mapping(StringView locale, StringView territory); -Optional<Territory> territory_from_string(StringView const& territory); -Optional<StringView> resolve_territory_alias(StringView const& territory); +Optional<Territory> territory_from_string(StringView territory); +Optional<StringView> resolve_territory_alias(StringView territory); Optional<StringView> get_locale_script_tag_mapping(StringView locale, StringView script_tag); -Optional<ScriptTag> script_tag_from_string(StringView const& script_tag); -Optional<StringView> resolve_script_tag_alias(StringView const& script_tag); +Optional<ScriptTag> script_tag_from_string(StringView script_tag); +Optional<StringView> resolve_script_tag_alias(StringView script_tag); Optional<StringView> get_locale_currency_mapping(StringView locale, StringView currency); -Optional<Currency> currency_from_string(StringView const& currency); +Optional<Currency> currency_from_string(StringView currency); Optional<StringView> get_locale_key_mapping(StringView locale, StringView key); -Optional<Key> key_from_string(StringView const& key); +Optional<Key> key_from_string(StringView key); Optional<ListPatterns> get_locale_list_pattern_mapping(StringView locale, StringView list_pattern_type, StringView list_pattern_style); -Optional<ListPatternType> list_pattern_type_from_string(StringView const& list_pattern_type); -Optional<ListPatternStyle> list_pattern_style_from_string(StringView const& list_pattern_style); +Optional<ListPatternType> list_pattern_type_from_string(StringView list_pattern_type); +Optional<ListPatternStyle> list_pattern_style_from_string(StringView list_pattern_style); -Optional<StringView> resolve_variant_alias(StringView const& variant); -Optional<StringView> resolve_subdivision_alias(StringView const& subdivision); +Optional<StringView> resolve_variant_alias(StringView variant); +Optional<StringView> resolve_subdivision_alias(StringView subdivision); void resolve_complex_language_aliases(Unicode::LanguageID& language_id); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h index 5b6b126f2f..59f3103361 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h @@ -59,7 +59,7 @@ void generate_value_from_string(SourceGenerator& generator, StringView method_na generator.set("size", String::number(hashes.size())); generator.append(R"~~~( -Optional<@return_type@> @method_name@(StringView const& key) +Optional<@return_type@> @method_name@(StringView key) { constexpr Array<HashValuePair<@value_type@>, @size@> hash_pairs { { )~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp index 7c4e524dab..45ac2630ec 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp @@ -96,7 +96,7 @@ PropertyID property_id_from_camel_case_string(StringView string) return PropertyID::Invalid; } -PropertyID property_id_from_string(const StringView& string) +PropertyID property_id_from_string(StringView string) { )~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp index 6ded891fe5..fca167cbee 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp @@ -102,7 +102,7 @@ enum class PropertyID { }; PropertyID property_id_from_camel_case_string(StringView); -PropertyID property_id_from_string(const StringView&); +PropertyID property_id_from_string(StringView); const char* string_from_property_id(PropertyID); bool is_inherited_property(PropertyID); NonnullRefPtr<StyleValue> property_initial_value(PropertyID); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_cpp.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_cpp.cpp index 15c81224df..2719994063 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_cpp.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) namespace Web::CSS { -ValueID value_id_from_string(const StringView& string) +ValueID value_id_from_string(StringView string) { )~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_h.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_h.cpp index 3c2488728e..64c391deb1 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_h.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_ValueID_h.cpp @@ -66,7 +66,7 @@ enum class ValueID { generator.append(R"~~~( }; -ValueID value_id_from_string(const StringView&); +ValueID value_id_from_string(StringView); const char* string_from_value_id(ValueID); } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp index 7b7c7a619e..1af9659b30 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp @@ -235,7 +235,7 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView } }; - auto assert_string = [&](StringView const& expected) { + auto assert_string = [&](StringView expected) { if (!lexer.consume_specific(expected)) report_parsing_error(String::formatted("expected '{}'", expected), filename, input, lexer.tell()); }; @@ -1267,7 +1267,7 @@ enum class WrappingReference { Yes, }; -static void generate_wrap_statement(SourceGenerator& generator, String const& value, IDL::Type const& type, StringView const& result_expression, WrappingReference wrapping_reference = WrappingReference::No, size_t recursion_depth = 0) +static void generate_wrap_statement(SourceGenerator& generator, String const& value, IDL::Type const& type, StringView result_expression, WrappingReference wrapping_reference = WrappingReference::No, size_t recursion_depth = 0) { auto scoped_generator = generator.fork(); scoped_generator.set("value", value); diff --git a/Meta/Lagom/Tools/ConfigureComponents/main.cpp b/Meta/Lagom/Tools/ConfigureComponents/main.cpp index ac80d7cc09..058493666e 100644 --- a/Meta/Lagom/Tools/ConfigureComponents/main.cpp +++ b/Meta/Lagom/Tools/ConfigureComponents/main.cpp @@ -77,7 +77,7 @@ static Vector<ComponentData> read_component_data(Core::ConfigFile const& config_ return components; } -static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<WhiptailOption> const& options, StringView const& title, StringView const& description) +static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<WhiptailOption> const& options, StringView title, StringView description) { struct winsize w; if (ioctl(0, TIOCGWINSZ, &w) < 0) { @@ -198,7 +198,7 @@ static Result<Vector<String>, int> run_whiptail(WhiptailMode mode, Vector<Whipta return data.split('\n', false); } -static bool run_system_command(String const& command, StringView const& command_name) +static bool run_system_command(String const& command, StringView command_name) { if (command.starts_with("cmake")) warnln("\e[34mRunning CMake...\e[0m"); diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp index 5f94af77f4..0efee80690 100644 --- a/Tests/LibJS/test-js.cpp +++ b/Tests/LibJS/test-js.cpp @@ -84,7 +84,7 @@ TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter) auto start_time = Test::get_time_in_ms(); LexicalPath path(test_file); - auto& dirname = path.dirname(); + auto dirname = path.dirname(); enum { Early, Fail, diff --git a/Tests/LibWeb/TestHTMLTokenizer.cpp b/Tests/LibWeb/TestHTMLTokenizer.cpp index 689ca5f2b8..7cd13f976f 100644 --- a/Tests/LibWeb/TestHTMLTokenizer.cpp +++ b/Tests/LibWeb/TestHTMLTokenizer.cpp @@ -63,7 +63,7 @@ using Token = Web::HTML::HTMLToken; VERIFY(last_token); \ EXPECT_EQ(last_token->attribute_count(), (size_t)(count)); -static Vector<Token> run_tokenizer(StringView const& input) +static Vector<Token> run_tokenizer(StringView input) { Vector<Token> tokens; Tokenizer tokenizer { input, "UTF-8"sv }; diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index cb26df6293..58563bf44a 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -28,7 +28,7 @@ class BookmarkEditor final : public GUI::Dialog { public: static Vector<JsonValue> - edit_bookmark(Window* parent_window, const StringView& title, const StringView& url) + edit_bookmark(Window* parent_window, StringView title, StringView url) { auto editor = BookmarkEditor::construct(parent_window, title, url); editor->set_title("Edit Bookmark"); @@ -41,7 +41,7 @@ public: } private: - BookmarkEditor(Window* parent_window, const StringView& title, const StringView& url) + BookmarkEditor(Window* parent_window, StringView title, StringView url) : Dialog(parent_window) { auto& widget = set_main_widget<GUI::Widget>(); diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 171c0750a7..347c216b0e 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -123,7 +123,7 @@ void ConsoleWidget::handle_console_messages(i32 start_index, const Vector<String request_console_messages(); } -void ConsoleWidget::print_source_line(const StringView& source) +void ConsoleWidget::print_source_line(StringView source) { StringBuilder html; html.append("<span class=\"repl-indicator\">"); @@ -135,7 +135,7 @@ void ConsoleWidget::print_source_line(const StringView& source) print_html(html.string_view()); } -void ConsoleWidget::print_html(StringView const& line) +void ConsoleWidget::print_html(StringView line) { StringBuilder builder; builder.append(R"~~~( diff --git a/Userland/Applications/Browser/ConsoleWidget.h b/Userland/Applications/Browser/ConsoleWidget.h index 23276bea94..6f2bedffc4 100644 --- a/Userland/Applications/Browser/ConsoleWidget.h +++ b/Userland/Applications/Browser/ConsoleWidget.h @@ -21,8 +21,8 @@ public: void notify_about_new_console_message(i32 message_index); void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages); - void print_source_line(const StringView&); - void print_html(const StringView&); + void print_source_line(StringView); + void print_html(StringView); void reset(); Function<void(const String&)> on_js_input; diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index b076fb7393..a55230930b 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -405,7 +405,7 @@ bool DirectoryView::open(String const& path) return true; } -void DirectoryView::set_status_message(StringView const& message) +void DirectoryView::set_status_message(StringView message) { if (on_status_message) on_status_message(message); diff --git a/Userland/Applications/FileManager/DirectoryView.h b/Userland/Applications/FileManager/DirectoryView.h index 1983479595..00dbf2b304 100644 --- a/Userland/Applications/FileManager/DirectoryView.h +++ b/Userland/Applications/FileManager/DirectoryView.h @@ -66,10 +66,10 @@ public: void launch(URL const&, LauncherHandler const&) const; - Function<void(StringView const& path, bool can_read_in_path, bool can_write_in_path)> on_path_change; + Function<void(StringView path, bool can_read_in_path, bool can_write_in_path)> on_path_change; Function<void(GUI::AbstractView&)> on_selection_change; Function<void(GUI::ModelIndex const&, GUI::ContextMenuEvent const&)> on_context_menu_request; - Function<void(StringView const&)> on_status_message; + Function<void(StringView)> on_status_message; Function<void(int done, int total)> on_thumbnail_progress; Function<void()> on_accepted_drop; @@ -156,7 +156,7 @@ private: void handle_activation(GUI::ModelIndex const&); - void set_status_message(StringView const&); + void set_status_message(StringView); void update_statusbar(); Mode m_mode { Mode::Normal }; diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 84f5a2c861..34af76b3d5 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -115,7 +115,7 @@ void FileOperationProgressWidget::did_finish() window()->close(); } -void FileOperationProgressWidget::did_error(StringView const& message) +void FileOperationProgressWidget::did_error(StringView message) { // FIXME: Communicate more with the user about errors. close_pipe(); @@ -157,7 +157,7 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_ return String::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining); } -void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView const& current_filename) +void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView current_filename) { auto& files_copied_label = *find_descendant_of_type_named<GUI::Label>("files_copied_label"); auto& current_file_label = *find_descendant_of_type_named<GUI::Label>("current_file_label"); diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.h b/Userland/Applications/FileManager/FileOperationProgressWidget.h index b6b651945d..9b10da898b 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.h +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.h @@ -22,8 +22,8 @@ private: FileOperationProgressWidget(FileOperation, NonnullRefPtr<Core::File> helper_pipe); void did_finish(); - void did_error(StringView const& message); - void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView const& current_filename); + void did_error(StringView message); + void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView current_filename); void close_pipe(); diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 1e7f1e98b7..7929d13857 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -1020,7 +1020,7 @@ int run_in_windowed_mode(String initial_location, String entry_focused_on_init) refresh_tree_view(); }; - directory_view.on_status_message = [&](StringView const& message) { + directory_view.on_status_message = [&](StringView message) { statusbar.set_text(message); }; diff --git a/Userland/Applications/Help/History.cpp b/Userland/Applications/Help/History.cpp index d3354255d2..fea165421c 100644 --- a/Userland/Applications/Help/History.cpp +++ b/Userland/Applications/Help/History.cpp @@ -6,7 +6,7 @@ #include "History.h" -void History::push(const StringView& history_item) +void History::push(StringView history_item) { if (!m_items.is_empty() && m_items[m_current_history_item] == history_item) return; diff --git a/Userland/Applications/Help/History.h b/Userland/Applications/Help/History.h index 0125d9c6bf..3ec3d7da1b 100644 --- a/Userland/Applications/Help/History.h +++ b/Userland/Applications/Help/History.h @@ -11,7 +11,7 @@ class History final { public: - void push(const StringView& history_item); + void push(StringView history_item); String current(); void go_back(); diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 8461788b56..2fd7324df6 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -31,7 +31,7 @@ ManualModel::ManualModel() m_page_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png").release_value_but_fixme_should_propagate_errors()); } -Optional<GUI::ModelIndex> ManualModel::index_from_path(const StringView& path) const +Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const { for (int section = 0; section < row_count(); ++section) { auto parent_index = index(section, 0); diff --git a/Userland/Applications/Help/ManualModel.h b/Userland/Applications/Help/ManualModel.h index 1345fb0548..f9a28110dc 100644 --- a/Userland/Applications/Help/ManualModel.h +++ b/Userland/Applications/Help/ManualModel.h @@ -21,7 +21,7 @@ public: virtual ~ManualModel() override {}; - Optional<GUI::ModelIndex> index_from_path(const StringView&) const; + Optional<GUI::ModelIndex> index_from_path(StringView) const; String page_path(const GUI::ModelIndex&) const; String page_and_section(const GUI::ModelIndex&) const; diff --git a/Userland/Applications/Help/ManualPageNode.h b/Userland/Applications/Help/ManualPageNode.h index c73ee917ae..8e366eae42 100644 --- a/Userland/Applications/Help/ManualPageNode.h +++ b/Userland/Applications/Help/ManualPageNode.h @@ -14,7 +14,7 @@ class ManualPageNode : public ManualNode { public: virtual ~ManualPageNode() override { } - ManualPageNode(const ManualSectionNode& section, const StringView& page) + ManualPageNode(const ManualSectionNode& section, StringView page) : m_section(section) , m_page(page) { diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 60f521fd34..5a37d385b3 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -324,7 +324,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) help_menu.add_action(GUI::CommonActions::make_about_action("Hex Editor", GUI::Icon::default_icon("app-hex-editor"), &window)); } -void HexEditorWidget::set_path(StringView const& path) +void HexEditorWidget::set_path(StringView path) { if (path.is_empty()) { m_path = {}; diff --git a/Userland/Applications/HexEditor/HexEditorWidget.h b/Userland/Applications/HexEditor/HexEditorWidget.h index 578c49217e..85df85b356 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.h +++ b/Userland/Applications/HexEditor/HexEditorWidget.h @@ -28,7 +28,7 @@ public: private: HexEditorWidget(); - void set_path(StringView const&); + void set_path(StringView); void update_title(); void set_search_results_visible(bool visible); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 71e6cfa053..1258ee2edf 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -164,7 +164,7 @@ void KeyboardMapperWidget::save() save_to_file(m_filename); } -void KeyboardMapperWidget::save_to_file(const StringView& filename) +void KeyboardMapperWidget::save_to_file(StringView filename) { JsonObject map_json; diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h index 84534be567..f085955828 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h @@ -20,7 +20,7 @@ public: void load_from_file(const String); void load_from_system(); void save(); - void save_to_file(const StringView&); + void save_to_file(StringView); protected: virtual void keydown_event(GUI::KeyEvent&) override; diff --git a/Userland/Applications/Piano/Track.cpp b/Userland/Applications/Piano/Track.cpp index 4fcba80f5a..0743db4e6e 100644 --- a/Userland/Applications/Piano/Track.cpp +++ b/Userland/Applications/Piano/Track.cpp @@ -123,7 +123,7 @@ void Track::reset() m_roll_iterators[note] = m_roll_notes[note].begin(); } -String Track::set_recorded_sample(const StringView& path) +String Track::set_recorded_sample(StringView path) { NonnullRefPtr<Audio::Loader> loader = Audio::Loader::create(path); if (loader->has_error()) diff --git a/Userland/Applications/Piano/Track.h b/Userland/Applications/Piano/Track.h index 2397cd776f..f21fd2a460 100644 --- a/Userland/Applications/Piano/Track.h +++ b/Userland/Applications/Piano/Track.h @@ -36,7 +36,7 @@ public: void fill_sample(Sample& sample); void reset(); - String set_recorded_sample(const StringView& path); + String set_recorded_sample(StringView path); void set_note(int note, Switch); void set_roll_note(int note, u32 on_sample, u32 off_sample); void set_wave(int wave); diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index 25f1e060ae..48afba3f66 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -51,7 +51,7 @@ ToolboxWidget::~ToolboxWidget() void ToolboxWidget::setup_tools() { - auto add_tool = [&](String name, StringView const& icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool) { + auto add_tool = [&](String name, StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool) { auto action = GUI::Action::create_checkable(move(name), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(), [this, tool = tool.ptr()](auto& action) { if (action.is_checked()) { diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index 0bdf19f127..e3bd310b42 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -46,7 +46,7 @@ void Cell::set_type(const CellType* type) m_type = type; } -void Cell::set_type(const StringView& name) +void Cell::set_type(StringView name) { auto* cell_type = CellType::get_by_name(name); if (cell_type) { diff --git a/Userland/Applications/Spreadsheet/Cell.h b/Userland/Applications/Spreadsheet/Cell.h index d3d4559336..d2d3541c1a 100644 --- a/Userland/Applications/Spreadsheet/Cell.h +++ b/Userland/Applications/Spreadsheet/Cell.h @@ -57,7 +57,7 @@ struct Cell : public Weakable<Cell> { Kind kind() const { return m_kind; } const Vector<WeakPtr<Cell>>& referencing_cells() const { return m_referencing_cells; } - void set_type(const StringView& name); + void set_type(StringView name); void set_type(const CellType*); void set_type_metadata(CellTypeMetadata&&); diff --git a/Userland/Applications/Spreadsheet/CellType/Type.cpp b/Userland/Applications/Spreadsheet/CellType/Type.cpp index b2a9af330d..5690d8b64b 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Type.cpp @@ -20,7 +20,7 @@ static Spreadsheet::DateCell s_date_cell; namespace Spreadsheet { -const CellType* CellType::get_by_name(const StringView& name) +const CellType* CellType::get_by_name(StringView name) { return s_cell_types.get(name).value_or(nullptr); } @@ -33,7 +33,7 @@ Vector<StringView> CellType::names() return names; } -CellType::CellType(const StringView& name) +CellType::CellType(StringView name) : m_name(name) { VERIFY(!s_cell_types.contains(name)); diff --git a/Userland/Applications/Spreadsheet/CellType/Type.h b/Userland/Applications/Spreadsheet/CellType/Type.h index 343e0e45ff..025b14650d 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.h +++ b/Userland/Applications/Spreadsheet/CellType/Type.h @@ -25,7 +25,7 @@ struct CellTypeMetadata { class CellType { public: - static const CellType* get_by_name(const StringView&); + static const CellType* get_by_name(StringView); static Vector<StringView> names(); virtual String display(Cell&, const CellTypeMetadata&) const = 0; @@ -35,7 +35,7 @@ public: const String& name() const { return m_name; } protected: - CellType(const StringView& name); + CellType(StringView name); private: String m_name; diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 86772bd462..0263bc1d77 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -136,7 +136,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) }; } -String HelpWindow::render(const StringView& key) +String HelpWindow::render(StringView key) { VERIFY(m_docs.has_object(key)); auto& doc = m_docs.get(key).as_object(); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.h b/Userland/Applications/Spreadsheet/HelpWindow.h index d5756c81c0..a7eb245574 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.h +++ b/Userland/Applications/Spreadsheet/HelpWindow.h @@ -32,7 +32,7 @@ public: private: static RefPtr<HelpWindow> s_the; - String render(const StringView& key); + String render(StringView key); HelpWindow(GUI::Window* parent = nullptr); JsonObject m_docs; diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 539c953d6e..88f054652b 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -24,7 +24,7 @@ namespace Spreadsheet { -Sheet::Sheet(const StringView& name, Workbook& workbook) +Sheet::Sheet(StringView name, Workbook& workbook) : Sheet(workbook) { m_name = name; @@ -156,7 +156,7 @@ void Sheet::update(Cell& cell) } } -Sheet::ValueAndException Sheet::evaluate(const StringView& source, Cell* on_behalf_of) +Sheet::ValueAndException Sheet::evaluate(StringView source, Cell* on_behalf_of) { TemporaryChange cell_change { m_current_cell_being_evaluated, on_behalf_of }; ScopeGuard clear_exception { [&] { interpreter().vm().clear_exception(); } }; @@ -181,7 +181,7 @@ Sheet::ValueAndException Sheet::evaluate(const StringView& source, Cell* on_beha return { value, {} }; } -Cell* Sheet::at(const StringView& name) +Cell* Sheet::at(StringView name) { auto pos = parse_cell_name(name); if (pos.has_value()) @@ -200,7 +200,7 @@ Cell* Sheet::at(const Position& position) return it->value; } -Optional<Position> Sheet::parse_cell_name(const StringView& name) const +Optional<Position> Sheet::parse_cell_name(StringView name) const { GenericLexer lexer(name); auto col = lexer.consume_while(isalpha); @@ -216,7 +216,7 @@ Optional<Position> Sheet::parse_cell_name(const StringView& name) const return Position { it.index(), row.to_uint().value() }; } -Optional<size_t> Sheet::column_index(const StringView& column_name) const +Optional<size_t> Sheet::column_index(StringView column_name) const { auto maybe_index = convert_from_string(column_name); if (!maybe_index.has_value()) @@ -233,7 +233,7 @@ Optional<size_t> Sheet::column_index(const StringView& column_name) const return index; } -Optional<String> Sheet::column_arithmetic(const StringView& column_name, int offset) +Optional<String> Sheet::column_arithmetic(StringView column_name, int offset) { auto maybe_index = column_index(column_name); if (!maybe_index.has_value()) diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.h b/Userland/Applications/Spreadsheet/Spreadsheet.h index 9637e08bb0..e3f0f24e95 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.h +++ b/Userland/Applications/Spreadsheet/Spreadsheet.h @@ -31,9 +31,9 @@ public: ~Sheet(); - Optional<Position> parse_cell_name(const StringView&) const; - Optional<size_t> column_index(const StringView& column_name) const; - Optional<String> column_arithmetic(const StringView& column_name, int offset); + Optional<Position> parse_cell_name(StringView) const; + Optional<size_t> column_index(StringView column_name) const; + Optional<String> column_arithmetic(StringView column_name, int offset); Cell* from_url(const URL&); const Cell* from_url(const URL& url) const { return const_cast<Sheet*>(this)->from_url(url); } @@ -50,7 +50,7 @@ public: static RefPtr<Sheet> from_xsv(const Reader::XSV&, Workbook&); const String& name() const { return m_name; } - void set_name(const StringView& name) { m_name = name; } + void set_name(StringView name) { m_name = name; } JsonObject gather_documentation() const; @@ -62,8 +62,8 @@ public: Cell* at(const Position& position); const Cell* at(const Position& position) const { return const_cast<Sheet*>(this)->at(position); } - const Cell* at(const StringView& name) const { return const_cast<Sheet*>(this)->at(name); } - Cell* at(const StringView&); + const Cell* at(StringView name) const { return const_cast<Sheet*>(this)->at(name); } + Cell* at(StringView); const Cell& ensure(const Position& position) const { return const_cast<Sheet*>(this)->ensure(position); } Cell& ensure(const Position& position) @@ -111,7 +111,7 @@ public: JS::Value value; JS::Exception* exception { nullptr }; }; - ValueAndException evaluate(const StringView&, Cell* = nullptr); + ValueAndException evaluate(StringView, Cell* = nullptr); JS::Interpreter& interpreter() const; SheetGlobalObject& global_object() const { return *m_global_object; } @@ -136,7 +136,7 @@ public: private: explicit Sheet(Workbook&); - explicit Sheet(const StringView& name, Workbook&); + explicit Sheet(StringView name, Workbook&); String m_name; Vector<String> m_columns; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index e35cff4e25..93dd864494 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -369,14 +369,14 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source, } } -void SpreadsheetWidget::save(const StringView& filename) +void SpreadsheetWidget::save(StringView filename) { auto result = m_workbook->save(filename); if (result.is_error()) GUI::MessageBox::show_error(window(), result.error()); } -void SpreadsheetWidget::load(const StringView& filename) +void SpreadsheetWidget::load(StringView filename) { auto result = m_workbook->load(filename); if (result.is_error()) { diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h index 9748476f10..3ec08531bb 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h @@ -19,8 +19,8 @@ class SpreadsheetWidget final : public GUI::Widget { public: ~SpreadsheetWidget(); - void save(const StringView& filename); - void load(const StringView& filename); + void save(StringView filename); + void load(StringView filename); bool request_close(); void add_sheet(); void add_sheet(NonnullRefPtr<Sheet>&&); diff --git a/Userland/Applications/Spreadsheet/Workbook.cpp b/Userland/Applications/Spreadsheet/Workbook.cpp index df9b331d4e..65f269a209 100644 --- a/Userland/Applications/Spreadsheet/Workbook.cpp +++ b/Userland/Applications/Spreadsheet/Workbook.cpp @@ -43,7 +43,7 @@ bool Workbook::set_filename(const String& filename) return true; } -Result<bool, String> Workbook::load(const StringView& filename) +Result<bool, String> Workbook::load(StringView filename) { auto file_or_error = Core::File::open(filename, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) { @@ -70,7 +70,7 @@ Result<bool, String> Workbook::load(const StringView& filename) return true; } -Result<bool, String> Workbook::save(const StringView& filename) +Result<bool, String> Workbook::save(StringView filename) { auto mime = Core::guess_mime_type_based_on_filename(filename); auto file = Core::File::construct(filename); diff --git a/Userland/Applications/Spreadsheet/Workbook.h b/Userland/Applications/Spreadsheet/Workbook.h index 1ed0828ef6..a2831ace4e 100644 --- a/Userland/Applications/Spreadsheet/Workbook.h +++ b/Userland/Applications/Spreadsheet/Workbook.h @@ -17,8 +17,8 @@ class Workbook { public: Workbook(NonnullRefPtrVector<Sheet>&& sheets); - Result<bool, String> save(const StringView& filename); - Result<bool, String> load(const StringView& filename); + Result<bool, String> save(StringView filename); + Result<bool, String> load(StringView filename); const String& current_filename() const { return m_current_filename; } bool set_filename(const String& filename); @@ -30,7 +30,7 @@ public: const NonnullRefPtrVector<Sheet>& sheets() const { return m_sheets; } NonnullRefPtrVector<Sheet> sheets() { return m_sheets; } - Sheet& add_sheet(const StringView& name) + Sheet& add_sheet(StringView name) { auto sheet = Sheet::construct(name, *this); m_sheets.append(sheet); diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index bf07911b57..b3cefcd450 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -310,7 +310,7 @@ GUI::Variant ProcessModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol return {}; } -Vector<GUI::ModelIndex> ProcessModel::matches(StringView const& searching, unsigned flags, GUI::ModelIndex const&) +Vector<GUI::ModelIndex> ProcessModel::matches(StringView searching, unsigned flags, GUI::ModelIndex const&) { Vector<GUI::ModelIndex> found_indices; diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h index 560ac55725..1d8092e80a 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.h +++ b/Userland/Applications/SystemMonitor/ProcessModel.h @@ -61,7 +61,7 @@ public: virtual String column_name(int column) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_searchable() const override { return true; } - virtual Vector<GUI::ModelIndex> matches(StringView const&, unsigned = MatchesFlag::AllMatching, GUI::ModelIndex const& = GUI::ModelIndex()) override; + virtual Vector<GUI::ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, GUI::ModelIndex const& = GUI::ModelIndex()) override; virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; } void update(); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index c9975d3868..cf439f9bae 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -317,7 +317,7 @@ int main(int argc, char** argv) terminal.on_command_exit = [&] { app->quit(0); }; - terminal.on_title_change = [&](auto& title) { + terminal.on_title_change = [&](auto title) { window->set_title(title); }; terminal.on_terminal_size_change = [&](auto& size) { diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 53209f915e..25637d4d39 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -619,7 +619,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) help_menu.add_action(GUI::CommonActions::make_about_action("Text Editor", GUI::Icon::default_icon("app-text-editor"), &window)); } -void MainWidget::set_path(StringView const& path) +void MainWidget::set_path(StringView path) { if (path.is_empty()) { m_path = {}; diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h index 9292ca3ebd..5c81fec443 100644 --- a/Userland/Applications/TextEditor/MainWidget.h +++ b/Userland/Applications/TextEditor/MainWidget.h @@ -44,7 +44,7 @@ public: private: MainWidget(); - void set_path(StringView const&); + void set_path(StringView); void update_preview(); void update_markdown_preview(); void update_html_preview(); diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.h b/Userland/DevTools/HackStudio/ClassViewWidget.h index 1b96ef1427..86618254c4 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.h +++ b/Userland/DevTools/HackStudio/ClassViewWidget.h @@ -36,7 +36,7 @@ struct ClassViewNode { NonnullOwnPtrVector<ClassViewNode> children; ClassViewNode* parent { nullptr }; - explicit ClassViewNode(const StringView& name) + explicit ClassViewNode(StringView name) : name(name) {}; }; diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp index 23a923880a..fc229ef238 100644 --- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp +++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.cpp @@ -138,7 +138,7 @@ void EvaluateExpressionDialog::handle_evaluation(const String& expression) set_output(JS::MarkupGenerator::html_from_value(m_interpreter->vm().last_value())); } -void EvaluateExpressionDialog::set_output(const StringView& html) +void EvaluateExpressionDialog::set_output(StringView html) { auto paragraph = m_output_container->document().create_element("p"); paragraph->set_inner_html(html); diff --git a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h index d140185f94..d33873c3bb 100644 --- a/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h +++ b/Userland/DevTools/HackStudio/Debugger/EvaluateExpressionDialog.h @@ -19,7 +19,7 @@ private: void build(Window* parent_window); void handle_evaluation(const String& expression); - void set_output(const StringView& html); + void set_output(StringView html); NonnullOwnPtr<JS::Interpreter> m_interpreter; RefPtr<GUI::TextBox> m_text_editor; diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index 1bcae424fe..06f00c1034 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -89,7 +89,7 @@ static String variable_value_as_string(const Debug::DebugInfo::VariableInfo& var return String::formatted("type: {} @ {:p}, ", variable.type_name, variable_address); } -static Optional<u32> string_to_variable_value(const StringView& string_value, const Debug::DebugInfo::VariableInfo& variable) +static Optional<u32> string_to_variable_value(StringView string_value, const Debug::DebugInfo::VariableInfo& variable) { if (variable.is_enum_type()) { auto prefix_string = String::formatted("{}::", variable.type_name); @@ -124,7 +124,7 @@ static Optional<u32> string_to_variable_value(const StringView& string_value, co return {}; } -void VariablesModel::set_variable_value(const GUI::ModelIndex& index, const StringView& string_value, GUI::Window* parent_window) +void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView string_value, GUI::Window* parent_window) { auto variable = static_cast<const Debug::DebugInfo::VariableInfo*>(index.internal_data()); diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h index 664c775eb0..b088dfee3c 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h @@ -18,7 +18,7 @@ class VariablesModel final : public GUI::Model { public: static RefPtr<VariablesModel> create(const PtraceRegisters& regs); - void set_variable_value(const GUI::ModelIndex&, const StringView&, GUI::Window*); + void set_variable_value(const GUI::ModelIndex&, StringView, GUI::Window*); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index f38474ed55..632307a68c 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -89,7 +89,7 @@ private: Vector<Match> m_matches; }; -static RefPtr<SearchResultsModel> find_in_files(const StringView& text) +static RefPtr<SearchResultsModel> find_in_files(StringView text) { Vector<Match> matches; project().for_each_text_file([&](auto& file) { diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h index b99c16d64e..aaa4b6f3c6 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.h +++ b/Userland/DevTools/HackStudio/LanguageClient.h @@ -31,7 +31,7 @@ class ServerConnection friend class ServerConnectionWrapper; public: - ServerConnection(const StringView& socket, const String& project_path) + ServerConnection(StringView socket, const String& project_path) : IPC::ServerConnection<LanguageClientEndpoint, LanguageServerEndpoint>(*this, socket) { m_project_path = project_path; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp index 576ef14cac..d5eefe2914 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp @@ -355,12 +355,12 @@ Vector<CppComprehensionEngine::Symbol> CppComprehensionEngine::get_child_symbols return symbols; } -String CppComprehensionEngine::document_path_from_include_path(const StringView& include_path) const +String CppComprehensionEngine::document_path_from_include_path(StringView include_path) const { static Regex<PosixExtended> library_include("<(.+)>"); static Regex<PosixExtended> user_defined_include("\"(.+)\""); - auto document_path_for_library_include = [&](const StringView& include_path) -> String { + auto document_path_for_library_include = [&](StringView include_path) -> String { RegexResult result; if (!library_include.search(include_path, result)) return {}; @@ -369,7 +369,7 @@ String CppComprehensionEngine::document_path_from_include_path(const StringView& return String::formatted("/usr/include/{}", path); }; - auto document_path_for_user_defined_include = [&](const StringView& include_path) -> String { + auto document_path_for_user_defined_include = [&](StringView include_path) -> String { RegexResult result; if (!user_defined_include.search(include_path, result)) return {}; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h index ecf84ecaf8..1b3fea9733 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.h @@ -117,7 +117,7 @@ private: void set_document_data(const String& file, OwnPtr<DocumentData>&& data); OwnPtr<DocumentData> create_document_data_for(const String& file); - String document_path_from_include_path(const StringView& include_path) const; + String document_path_from_include_path(StringView include_path) const; void update_declared_symbols(DocumentData&); void update_todo_entries(DocumentData&); GUI::AutocompleteProvider::DeclarationType type_of_declaration(const Declaration&); diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.h b/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.h index cc25b812cc..eaf4c64bd9 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.h @@ -39,7 +39,7 @@ private: void set_document_data(const String& file, OwnPtr<DocumentData>&& data); OwnPtr<DocumentData> create_document_data_for(const String& file); - String document_path_from_include_path(const StringView& include_path) const; + String document_path_from_include_path(StringView include_path) const; void update_declared_symbols(const DocumentData&); static size_t resolve(const ShellComprehensionEngine::DocumentData& document, const GUI::TextPosition& position); diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp index 9d744189af..ae2b6b2a55 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.cpp +++ b/Userland/DevTools/Inspector/RemoteProcess.cpp @@ -82,7 +82,7 @@ void RemoteProcess::set_inspected_object(FlatPtr address) m_client->async_set_inspected_object(m_pid, address); } -void RemoteProcess::set_property(FlatPtr object, const StringView& name, const JsonValue& value) +void RemoteProcess::set_property(FlatPtr object, StringView name, const JsonValue& value) { m_client->async_set_object_property(m_pid, object, name, value.to_string()); } diff --git a/Userland/DevTools/Inspector/RemoteProcess.h b/Userland/DevTools/Inspector/RemoteProcess.h index 83baad53fc..b153be3198 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.h +++ b/Userland/DevTools/Inspector/RemoteProcess.h @@ -30,7 +30,7 @@ public: void set_inspected_object(FlatPtr); - void set_property(FlatPtr object, const StringView& name, const JsonValue& value); + void set_property(FlatPtr object, StringView name, const JsonValue& value); bool is_inspectable(); diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index bf4505a904..194a9a9d4a 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -215,7 +215,7 @@ void Profile::rebuild_tree() Optional<MappedObject> g_kernel_debuginfo_object; OwnPtr<Debug::DebugInfo> g_kernel_debug_info; -ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(const StringView& path) +ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path) { auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 1dc895882c..377a3a65af 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -141,7 +141,7 @@ struct ProcessFilter { class Profile { public: - static ErrorOr<NonnullOwnPtr<Profile>> load_from_perfcore_file(const StringView& path); + static ErrorOr<NonnullOwnPtr<Profile>> load_from_perfcore_file(StringView path); GUI::Model& model(); GUI::Model& samples_model(); diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index 38b08fdbef..d57fea9da4 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -145,7 +145,7 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol return {}; } -Vector<GUI::ModelIndex> ProfileModel::matches(StringView const& searching, unsigned flags, GUI::ModelIndex const& parent) +Vector<GUI::ModelIndex> ProfileModel::matches(StringView searching, unsigned flags, GUI::ModelIndex const& parent) { RemoveReference<decltype(m_profile.roots())>* nodes { nullptr }; diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 53cdabbe4a..d046414790 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -39,7 +39,7 @@ public: virtual int tree_column() const override { return Column::StackFrame; } virtual bool is_column_sortable(int) const override { return false; } virtual bool is_searchable() const override { return true; } - virtual Vector<GUI::ModelIndex> matches(StringView const&, unsigned flags, GUI::ModelIndex const&) override; + virtual Vector<GUI::ModelIndex> matches(StringView, unsigned flags, GUI::ModelIndex const&) override; private: explicit ProfileModel(Profile&); diff --git a/Userland/DevTools/UserspaceEmulator/Report.h b/Userland/DevTools/UserspaceEmulator/Report.h index 7f1aa8ac9a..a14e58d537 100644 --- a/Userland/DevTools/UserspaceEmulator/Report.h +++ b/Userland/DevTools/UserspaceEmulator/Report.h @@ -11,7 +11,7 @@ extern bool g_report_to_debug; template<typename... Ts> -void reportln(const StringView& format, Ts... args) +void reportln(StringView format, Ts... args) { if (g_report_to_debug) { AK::VariadicFormatParams variadic_format_params { args... }; diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp index 6b790c8048..614bd13ff8 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -196,7 +196,7 @@ void SoftCPU::write_memory256(X86::LogicalAddress address, ValueWithShadow<u256> m_emulator.mmu().write256(address, value); } -void SoftCPU::push_string(const StringView& string) +void SoftCPU::push_string(StringView string) { size_t space_to_allocate = round_up_to_power_of_two(string.length() + 1, 16); set_esp({ esp().value() - space_to_allocate, esp().shadow() }); diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.h b/Userland/DevTools/UserspaceEmulator/SoftCPU.h index 086b9779bf..02766df357 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftCPU.h +++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.h @@ -78,7 +78,7 @@ public: void push16(ValueWithShadow<u16>); ValueWithShadow<u16> pop16(); - void push_string(const StringView&); + void push_string(StringView); void push_buffer(const u8* data, size_t); u16 segment(X86::SegmentRegister seg) const { return m_segment[(int)seg]; } diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index e2373fc5e8..61b79b911d 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -366,7 +366,7 @@ void ChessWidget::keydown_event(GUI::KeyEvent& event) static String set_path = String("/res/icons/chess/sets/"); -static RefPtr<Gfx::Bitmap> get_piece(const StringView& set, const StringView& image) +static RefPtr<Gfx::Bitmap> get_piece(StringView set, StringView image) { StringBuilder builder; builder.append(set_path); @@ -376,7 +376,7 @@ static RefPtr<Gfx::Bitmap> get_piece(const StringView& set, const StringView& im return Gfx::Bitmap::try_load_from_file(builder.build()).release_value_but_fixme_should_propagate_errors(); } -void ChessWidget::set_piece_set(const StringView& set) +void ChessWidget::set_piece_set(StringView set) { m_piece_set = set; m_pieces.set({ Chess::Color::White, Chess::Type::Pawn }, get_piece(set, "white-pawn.png")); @@ -427,7 +427,7 @@ void ChessWidget::reset() update(); } -void ChessWidget::set_board_theme(const StringView& name) +void ChessWidget::set_board_theme(StringView name) { // FIXME: Add some kind of themes.json // The following Colors have been taken from lichess.org, but i'm pretty sure they took them from chess.com. @@ -520,7 +520,7 @@ String ChessWidget::get_fen() const return m_playback ? m_board_playback.to_fen() : m_board.to_fen(); } -bool ChessWidget::import_pgn(const StringView& import_path) +bool ChessWidget::import_pgn(StringView import_path) { auto file_or_error = Core::File::open(import_path, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) { @@ -625,7 +625,7 @@ bool ChessWidget::import_pgn(const StringView& import_path) return true; } -bool ChessWidget::export_pgn(const StringView& export_path) const +bool ChessWidget::export_pgn(StringView export_path) const { auto file_or_error = Core::File::open(export_path, Core::OpenMode::WriteOnly); if (file_or_error.is_error()) { diff --git a/Userland/Games/Chess/ChessWidget.h b/Userland/Games/Chess/ChessWidget.h index 4705dc4ed6..256e201f9b 100644 --- a/Userland/Games/Chess/ChessWidget.h +++ b/Userland/Games/Chess/ChessWidget.h @@ -35,7 +35,7 @@ public: Chess::Color side() const { return m_side; }; void set_side(Chess::Color side) { m_side = side; }; - void set_piece_set(const StringView& set); + void set_piece_set(StringView set); const String& piece_set() const { return m_piece_set; }; Chess::Square mouse_to_square(GUI::MouseEvent& event) const; @@ -48,8 +48,8 @@ public: void set_show_available_moves(bool e) { m_show_available_moves = e; } String get_fen() const; - bool import_pgn(const StringView& import_path); - bool export_pgn(const StringView& export_path) const; + bool import_pgn(StringView import_path); + bool export_pgn(StringView export_path) const; int resign(); void flip_board(); @@ -63,7 +63,7 @@ public: const BoardTheme& board_theme() const { return m_board_theme; } void set_board_theme(const BoardTheme& theme) { m_board_theme = theme; } - void set_board_theme(const StringView& name); + void set_board_theme(StringView name); enum class PlaybackDirection { First, diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp index 122c57d422..90cb414113 100644 --- a/Userland/Games/Chess/Engine.cpp +++ b/Userland/Games/Chess/Engine.cpp @@ -17,7 +17,7 @@ Engine::~Engine() kill(m_pid, SIGINT); } -Engine::Engine(const StringView& command) +Engine::Engine(StringView command) { int wpipefds[2]; int rpipefds[2]; diff --git a/Userland/Games/Chess/Engine.h b/Userland/Games/Chess/Engine.h index 2e728d647d..c41eaec0e9 100644 --- a/Userland/Games/Chess/Engine.h +++ b/Userland/Games/Chess/Engine.h @@ -15,7 +15,7 @@ class Engine : public Chess::UCI::Endpoint { public: virtual ~Engine() override; - Engine(const StringView& command); + Engine(StringView command); Engine(const Engine&) = delete; Engine& operator=(const Engine&) = delete; diff --git a/Userland/Libraries/LibAudio/FlacLoader.cpp b/Userland/Libraries/LibAudio/FlacLoader.cpp index 02aa809b24..e64c1fd028 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.cpp +++ b/Userland/Libraries/LibAudio/FlacLoader.cpp @@ -20,7 +20,7 @@ namespace Audio { -FlacLoaderPlugin::FlacLoaderPlugin(const StringView& path) +FlacLoaderPlugin::FlacLoaderPlugin(StringView path) : m_file(Core::File::construct(path)) { if (!m_file->open(Core::OpenMode::ReadOnly)) { diff --git a/Userland/Libraries/LibAudio/FlacLoader.h b/Userland/Libraries/LibAudio/FlacLoader.h index f80fc57f65..9464204d8a 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.h +++ b/Userland/Libraries/LibAudio/FlacLoader.h @@ -69,7 +69,7 @@ ALWAYS_INLINE i32 decode_unsigned_exp_golomb(u8 order, InputBitStream& bit_input class FlacLoaderPlugin : public LoaderPlugin { public: - FlacLoaderPlugin(const StringView& path); + FlacLoaderPlugin(StringView path); FlacLoaderPlugin(const ByteBuffer& buffer); ~FlacLoaderPlugin() { diff --git a/Userland/Libraries/LibAudio/Loader.cpp b/Userland/Libraries/LibAudio/Loader.cpp index f3b54f8ffa..aee5e25962 100644 --- a/Userland/Libraries/LibAudio/Loader.cpp +++ b/Userland/Libraries/LibAudio/Loader.cpp @@ -9,7 +9,7 @@ namespace Audio { -Loader::Loader(const StringView& path) +Loader::Loader(StringView path) { m_plugin = make<WavLoaderPlugin>(path); if (m_plugin->sniff()) diff --git a/Userland/Libraries/LibAudio/Loader.h b/Userland/Libraries/LibAudio/Loader.h index a4bad829c1..11d284e1df 100644 --- a/Userland/Libraries/LibAudio/Loader.h +++ b/Userland/Libraries/LibAudio/Loader.h @@ -51,7 +51,7 @@ public: class Loader : public RefCounted<Loader> { public: - static NonnullRefPtr<Loader> create(const StringView& path) { return adopt_ref(*new Loader(path)); } + static NonnullRefPtr<Loader> create(StringView path) { return adopt_ref(*new Loader(path)); } static NonnullRefPtr<Loader> create(const ByteBuffer& buffer) { return adopt_ref(*new Loader(buffer)); } bool has_error() const { return m_plugin ? m_plugin->has_error() : true; } @@ -78,7 +78,7 @@ public: RefPtr<Core::File> file() const { return m_plugin ? m_plugin->file() : nullptr; } private: - Loader(const StringView& path); + Loader(StringView path); Loader(const ByteBuffer& buffer); mutable OwnPtr<LoaderPlugin> m_plugin; diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index 7cef7dc446..70514f4797 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -17,7 +17,7 @@ namespace Audio { static constexpr size_t maximum_wav_size = 1 * GiB; // FIXME: is there a more appropriate size limit? -WavLoaderPlugin::WavLoaderPlugin(const StringView& path) +WavLoaderPlugin::WavLoaderPlugin(StringView path) : m_file(Core::File::construct(path)) { if (!m_file->open(Core::OpenMode::ReadOnly)) { diff --git a/Userland/Libraries/LibAudio/WavLoader.h b/Userland/Libraries/LibAudio/WavLoader.h index 832d4066d7..1ae39dffb4 100644 --- a/Userland/Libraries/LibAudio/WavLoader.h +++ b/Userland/Libraries/LibAudio/WavLoader.h @@ -33,7 +33,7 @@ class Buffer; // Parses a WAV file and produces an Audio::Buffer. class WavLoaderPlugin : public LoaderPlugin { public: - WavLoaderPlugin(const StringView& path); + WavLoaderPlugin(StringView path); WavLoaderPlugin(const ByteBuffer& buffer); virtual bool sniff() override { return valid; } diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp index 92f98a562f..b4d7f0873e 100644 --- a/Userland/Libraries/LibAudio/WavWriter.cpp +++ b/Userland/Libraries/LibAudio/WavWriter.cpp @@ -8,7 +8,7 @@ namespace Audio { -WavWriter::WavWriter(const StringView& path, int sample_rate, int num_channels, int bits_per_sample) +WavWriter::WavWriter(StringView path, int sample_rate, int num_channels, int bits_per_sample) : m_sample_rate(sample_rate) , m_num_channels(num_channels) , m_bits_per_sample(bits_per_sample) @@ -29,7 +29,7 @@ WavWriter::~WavWriter() finalize(); } -void WavWriter::set_file(const StringView& path) +void WavWriter::set_file(StringView path) { m_file = Core::File::construct(path); if (!m_file->open(Core::OpenMode::ReadWrite)) { diff --git a/Userland/Libraries/LibAudio/WavWriter.h b/Userland/Libraries/LibAudio/WavWriter.h index 9a7a4a220f..555bc09cc2 100644 --- a/Userland/Libraries/LibAudio/WavWriter.h +++ b/Userland/Libraries/LibAudio/WavWriter.h @@ -13,7 +13,7 @@ namespace Audio { class WavWriter { public: - WavWriter(const StringView& path, int sample_rate = 44100, int num_channels = 2, int bits_per_sample = 16); + WavWriter(StringView path, int sample_rate = 44100, int num_channels = 2, int bits_per_sample = 16); WavWriter(int sample_rate = 44100, int num_channels = 2, int bits_per_sample = 16); ~WavWriter(); @@ -28,7 +28,7 @@ public: u16 bits_per_sample() const { return m_bits_per_sample; } RefPtr<Core::File> file() const { return m_file; } - void set_file(const StringView& path); + void set_file(StringView path); void set_num_channels(int num_channels) { m_num_channels = num_channels; } void set_sample_rate(int sample_rate) { m_sample_rate = sample_rate; } void set_bits_per_sample(int bits_per_sample) { m_bits_per_sample = bits_per_sample; } diff --git a/Userland/Libraries/LibC/getopt.cpp b/Userland/Libraries/LibC/getopt.cpp index e3d4f6f56d..addfa3e63e 100644 --- a/Userland/Libraries/LibC/getopt.cpp +++ b/Userland/Libraries/LibC/getopt.cpp @@ -41,7 +41,7 @@ namespace { class OptionParser { public: - OptionParser(int argc, char* const* argv, const StringView& short_options, const option* long_options, int* out_long_option_index = nullptr); + OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index = nullptr); int getopt(); private: @@ -65,7 +65,7 @@ private: size_t m_consumed_args { 0 }; }; -OptionParser::OptionParser(int argc, char* const* argv, const StringView& short_options, const option* long_options, int* out_long_option_index) +OptionParser::OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index) : m_argc(argc) , m_argv(argv) , m_short_options(short_options) diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index 81b044706b..e50ec108fc 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -32,7 +32,7 @@ String char_for_piece(Chess::Type type) } } -Chess::Type piece_for_char_promotion(const StringView& str) +Chess::Type piece_for_char_promotion(StringView str) { String string = String(str).to_lowercase(); if (string == "") @@ -56,7 +56,7 @@ Color opposing_color(Color color) return (color == Color::White) ? Color::Black : Color::White; } -Square::Square(const StringView& name) +Square::Square(StringView name) { VERIFY(name.length() == 2); char filec = name[0]; @@ -85,7 +85,7 @@ String Square::to_algebraic() const return builder.build(); } -Move::Move(const StringView& long_algebraic) +Move::Move(StringView long_algebraic) : from(long_algebraic.substring_view(0, 2)) , to(long_algebraic.substring_view(2, 2)) , promote_to(piece_for_char_promotion((long_algebraic.length() >= 5) ? long_algebraic.substring_view(4, 1) : "")) @@ -101,7 +101,7 @@ String Move::to_long_algebraic() const return builder.build(); } -Move Move::from_algebraic(const StringView& algebraic, const Color turn, const Board& board) +Move Move::from_algebraic(StringView algebraic, const Color turn, const Board& board) { String move_string = algebraic; Move move({ 50, 50 }, { 50, 50 }); diff --git a/Userland/Libraries/LibChess/Chess.h b/Userland/Libraries/LibChess/Chess.h index 2a25972484..e20a683cec 100644 --- a/Userland/Libraries/LibChess/Chess.h +++ b/Userland/Libraries/LibChess/Chess.h @@ -26,7 +26,7 @@ enum class Type : u8 { }; String char_for_piece(Type type); -Chess::Type piece_for_char_promotion(const StringView& str); +Chess::Type piece_for_char_promotion(StringView str); enum class Color : u8 { White, @@ -57,7 +57,7 @@ constexpr Piece EmptyPiece = { Color::None, Type::None }; struct Square { i8 rank; // zero indexed; i8 file; - Square(const StringView& name); + Square(StringView name); Square(const int& rank, const int& file) : rank(rank) , file(file) @@ -93,7 +93,7 @@ struct Move { bool is_capture : 1 = false; bool is_ambiguous : 1 = false; Square ambiguous { 50, 50 }; - Move(const StringView& long_algebraic); + Move(StringView long_algebraic); Move(const Square& from, const Square& to, const Type& promote_to = Type::None) : from(from) , to(to) @@ -102,7 +102,7 @@ struct Move { } bool operator==(const Move& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; } - static Move from_algebraic(const StringView& algebraic, const Color turn, const Board& board); + static Move from_algebraic(StringView algebraic, const Color turn, const Board& board); String to_long_algebraic() const; String to_algebraic() const; }; diff --git a/Userland/Libraries/LibChess/UCICommand.cpp b/Userland/Libraries/LibChess/UCICommand.cpp index 022f906c40..91e0a531d6 100644 --- a/Userland/Libraries/LibChess/UCICommand.cpp +++ b/Userland/Libraries/LibChess/UCICommand.cpp @@ -9,7 +9,7 @@ namespace Chess::UCI { -UCICommand UCICommand::from_string(const StringView& command) +UCICommand UCICommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "uci"); @@ -22,7 +22,7 @@ String UCICommand::to_string() const return "uci\n"; } -DebugCommand DebugCommand::from_string(const StringView& command) +DebugCommand DebugCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "debug"); @@ -44,7 +44,7 @@ String DebugCommand::to_string() const } } -IsReadyCommand IsReadyCommand::from_string(const StringView& command) +IsReadyCommand IsReadyCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "isready"); @@ -57,7 +57,7 @@ String IsReadyCommand::to_string() const return "isready\n"; } -SetOptionCommand SetOptionCommand::from_string(const StringView& command) +SetOptionCommand SetOptionCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "setoption"); @@ -108,7 +108,7 @@ String SetOptionCommand::to_string() const return builder.build(); } -PositionCommand PositionCommand::from_string(const StringView& command) +PositionCommand PositionCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens.size() >= 3); @@ -144,7 +144,7 @@ String PositionCommand::to_string() const return builder.build(); } -GoCommand GoCommand::from_string(const StringView& command) +GoCommand GoCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "go"); @@ -230,7 +230,7 @@ String GoCommand::to_string() const return builder.build(); } -StopCommand StopCommand::from_string(const StringView& command) +StopCommand StopCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "stop"); @@ -243,7 +243,7 @@ String StopCommand::to_string() const return "stop\n"; } -IdCommand IdCommand::from_string(const StringView& command) +IdCommand IdCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "id"); @@ -277,7 +277,7 @@ String IdCommand::to_string() const return builder.build(); } -UCIOkCommand UCIOkCommand::from_string(const StringView& command) +UCIOkCommand UCIOkCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "uciok"); @@ -290,7 +290,7 @@ String UCIOkCommand::to_string() const return "uciok\n"; } -ReadyOkCommand ReadyOkCommand::from_string(const StringView& command) +ReadyOkCommand ReadyOkCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "readyok"); @@ -303,7 +303,7 @@ String ReadyOkCommand::to_string() const return "readyok\n"; } -BestMoveCommand BestMoveCommand::from_string(const StringView& command) +BestMoveCommand BestMoveCommand::from_string(StringView command) { auto tokens = command.split_view(' '); VERIFY(tokens[0] == "bestmove"); @@ -320,7 +320,7 @@ String BestMoveCommand::to_string() const return builder.build(); } -InfoCommand InfoCommand::from_string([[maybe_unused]] const StringView& command) +InfoCommand InfoCommand::from_string([[maybe_unused]] StringView command) { // FIXME: Implement this. VERIFY_NOT_REACHED(); diff --git a/Userland/Libraries/LibChess/UCICommand.h b/Userland/Libraries/LibChess/UCICommand.h index 55753d0793..e591906e5c 100644 --- a/Userland/Libraries/LibChess/UCICommand.h +++ b/Userland/Libraries/LibChess/UCICommand.h @@ -56,7 +56,7 @@ public: { } - static UCICommand from_string(const StringView& command); + static UCICommand from_string(StringView command); virtual String to_string() const; }; @@ -74,7 +74,7 @@ public: { } - static DebugCommand from_string(const StringView& command); + static DebugCommand from_string(StringView command); virtual String to_string() const; @@ -91,21 +91,21 @@ public: { } - static IsReadyCommand from_string(const StringView& command); + static IsReadyCommand from_string(StringView command); virtual String to_string() const; }; class SetOptionCommand : public Command { public: - explicit SetOptionCommand(const StringView& name, Optional<String> value = {}) + explicit SetOptionCommand(StringView name, Optional<String> value = {}) : Command(Command::Type::SetOption) , m_name(name) , m_value(value) { } - static SetOptionCommand from_string(const StringView& command); + static SetOptionCommand from_string(StringView command); virtual String to_string() const; @@ -126,7 +126,7 @@ public: { } - static PositionCommand from_string(const StringView& command); + static PositionCommand from_string(StringView command); virtual String to_string() const; @@ -145,7 +145,7 @@ public: { } - static GoCommand from_string(const StringView& command); + static GoCommand from_string(StringView command); virtual String to_string() const; @@ -170,7 +170,7 @@ public: { } - static StopCommand from_string(const StringView& command); + static StopCommand from_string(StringView command); virtual String to_string() const; }; @@ -182,14 +182,14 @@ public: Author, }; - explicit IdCommand(Type field_type, const StringView& value) + explicit IdCommand(Type field_type, StringView value) : Command(Command::Type::Id) , m_field_type(field_type) , m_value(value) { } - static IdCommand from_string(const StringView& command); + static IdCommand from_string(StringView command); virtual String to_string() const; @@ -208,7 +208,7 @@ public: { } - static UCIOkCommand from_string(const StringView& command); + static UCIOkCommand from_string(StringView command); virtual String to_string() const; }; @@ -220,7 +220,7 @@ public: { } - static ReadyOkCommand from_string(const StringView& command); + static ReadyOkCommand from_string(StringView command); virtual String to_string() const; }; @@ -233,7 +233,7 @@ public: { } - static BestMoveCommand from_string(const StringView& command); + static BestMoveCommand from_string(StringView command); virtual String to_string() const; @@ -250,7 +250,7 @@ public: { } - static InfoCommand from_string(const StringView& command); + static InfoCommand from_string(StringView command); virtual String to_string() const; diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp index 6dbe69e69e..1dff9e941c 100644 --- a/Userland/Libraries/LibCore/IODevice.cpp +++ b/Userland/Libraries/LibCore/IODevice.cpp @@ -294,7 +294,7 @@ void IODevice::set_fd(int fd) did_update_fd(fd); } -bool IODevice::write(const StringView& v) +bool IODevice::write(StringView v) { return write((const u8*)v.characters_without_null_termination(), v.length()); } diff --git a/Userland/Libraries/LibCore/IODevice.h b/Userland/Libraries/LibCore/IODevice.h index 6941dfc789..1caa82a5c7 100644 --- a/Userland/Libraries/LibCore/IODevice.h +++ b/Userland/Libraries/LibCore/IODevice.h @@ -75,7 +75,7 @@ public: String read_line(size_t max_size = 16384); bool write(const u8*, int size); - bool write(const StringView&); + bool write(StringView); bool truncate(off_t); diff --git a/Userland/Libraries/LibCore/MimeData.cpp b/Userland/Libraries/LibCore/MimeData.cpp index 74d681c7be..e6cbe8a5ef 100644 --- a/Userland/Libraries/LibCore/MimeData.cpp +++ b/Userland/Libraries/LibCore/MimeData.cpp @@ -50,7 +50,7 @@ void MimeData::set_text(const String& text) set_data("text/plain", text.to_byte_buffer()); } -String guess_mime_type_based_on_filename(const StringView& path) +String guess_mime_type_based_on_filename(StringView path) { if (path.ends_with(".pbm", CaseSensitivity::CaseInsensitive)) return "image/x‑portable‑bitmap"; diff --git a/Userland/Libraries/LibCore/MimeData.h b/Userland/Libraries/LibCore/MimeData.h index a145cdd552..852b9bdad6 100644 --- a/Userland/Libraries/LibCore/MimeData.h +++ b/Userland/Libraries/LibCore/MimeData.h @@ -47,7 +47,7 @@ private: HashMap<String, ByteBuffer> m_data; }; -String guess_mime_type_based_on_filename(const StringView&); +String guess_mime_type_based_on_filename(StringView); Optional<String> guess_mime_type_based_on_sniffed_bytes(const ReadonlyBytes&); diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h index 1505ef109b..7bb7b25f35 100644 --- a/Userland/Libraries/LibCpp/AST.h +++ b/Userland/Libraries/LibCpp/AST.h @@ -125,8 +125,8 @@ public: virtual bool is_function() const { return false; } virtual bool is_namespace() const { return false; } virtual bool is_member() const { return false; } - const StringView& name() const { return m_name; } - void set_name(const StringView& name) { m_name = move(name); } + StringView name() const { return m_name; } + void set_name(StringView name) { m_name = move(name); } protected: Declaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename) @@ -417,7 +417,7 @@ public: virtual bool is_identifier() const override { return true; } - StringView const& name() const { return m_name; } + StringView name() const { return m_name; } void set_name(StringView&& name) { m_name = move(name); } private: diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp index 85c61b8c6c..247ce2f667 100644 --- a/Userland/Libraries/LibCpp/Lexer.cpp +++ b/Userland/Libraries/LibCpp/Lexer.cpp @@ -13,7 +13,7 @@ namespace Cpp { -Lexer::Lexer(StringView const& input, size_t start_line) +Lexer::Lexer(StringView input, size_t start_line) : m_input(input) , m_previous_position { start_line, 0 } , m_position { start_line, 0 } @@ -188,7 +188,7 @@ constexpr char const* s_known_types[] = { "wchar_t" }; -static bool is_keyword(StringView const& string) +static bool is_keyword(StringView string) { static HashTable<String> keywords(array_size(s_known_keywords)); if (keywords.is_empty()) { @@ -197,7 +197,7 @@ static bool is_keyword(StringView const& string) return keywords.contains(string); } -static bool is_known_type(StringView const& string) +static bool is_known_type(StringView string) { static HashTable<String> types(array_size(s_known_types)); if (types.is_empty()) { diff --git a/Userland/Libraries/LibCpp/Lexer.h b/Userland/Libraries/LibCpp/Lexer.h index e3f958ac7e..814de33c46 100644 --- a/Userland/Libraries/LibCpp/Lexer.h +++ b/Userland/Libraries/LibCpp/Lexer.h @@ -14,7 +14,7 @@ namespace Cpp { class Lexer { public: - explicit Lexer(StringView const&, size_t start_line = 0); + explicit Lexer(StringView, size_t start_line = 0); Vector<Token> lex(); template<typename Callback> diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index 7314050cba..439fb79d9a 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -628,7 +628,7 @@ Optional<Parser::DeclarationType> Parser::match_declaration_in_translation_unit( return {}; } -Optional<Parser::DeclarationType> Parser::match_class_member(const StringView& class_name) +Optional<Parser::DeclarationType> Parser::match_class_member(StringView class_name) { if (match_function_declaration()) return DeclarationType::Function; @@ -1557,7 +1557,7 @@ NonnullRefPtr<BracedInitList> Parser::parse_braced_init_list(ASTNode& parent) } NonnullRefPtrVector<Declaration> Parser::parse_class_members(StructOrClassDeclaration& parent) { - auto& class_name = parent.name(); + auto class_name = parent.name(); NonnullRefPtrVector<Declaration> members; while (!eof() && peek().type() != Token::Type::RightCurly) { @@ -1588,7 +1588,7 @@ void Parser::consume_access_specifier() consume(Token::Type::Colon); } -bool Parser::match_constructor(const StringView& class_name) +bool Parser::match_constructor(StringView class_name) { save_state(); ScopeGuard state_guard = [this] { load_state(); }; @@ -1606,7 +1606,7 @@ bool Parser::match_constructor(const StringView& class_name) return (peek(Token::Type::Semicolon).has_value() || peek(Token::Type::LeftCurly).has_value()); } -bool Parser::match_destructor(const StringView& class_name) +bool Parser::match_destructor(StringView class_name) { save_state(); ScopeGuard state_guard = [this] { load_state(); }; diff --git a/Userland/Libraries/LibCpp/Parser.h b/Userland/Libraries/LibCpp/Parser.h index 4bdf381a0a..9a0f457fac 100644 --- a/Userland/Libraries/LibCpp/Parser.h +++ b/Userland/Libraries/LibCpp/Parser.h @@ -56,7 +56,7 @@ private: }; Optional<DeclarationType> match_declaration_in_translation_unit(); - Optional<Parser::DeclarationType> match_class_member(const StringView& class_name); + Optional<Parser::DeclarationType> match_class_member(StringView class_name); bool match_function_declaration(); bool match_comment(); @@ -82,8 +82,8 @@ private: bool match_type(); bool match_named_type(); bool match_access_specifier(); - bool match_constructor(const StringView& class_name); - bool match_destructor(const StringView& class_name); + bool match_constructor(StringView class_name); + bool match_destructor(StringView class_name); Optional<NonnullRefPtrVector<Parameter>> parse_parameter_list(ASTNode& parent); Optional<Token> consume_whitespace(); diff --git a/Userland/Libraries/LibCpp/Preprocessor.cpp b/Userland/Libraries/LibCpp/Preprocessor.cpp index 5432df8ca4..08f68b48fe 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.cpp +++ b/Userland/Libraries/LibCpp/Preprocessor.cpp @@ -12,7 +12,7 @@ #include <ctype.h> namespace Cpp { -Preprocessor::Preprocessor(const String& filename, const StringView& program) +Preprocessor::Preprocessor(const String& filename, StringView program) : m_filename(filename) , m_program(program) { @@ -86,7 +86,7 @@ static void consume_whitespace(GenericLexer& lexer) } } -void Preprocessor::handle_preprocessor_statement(StringView const& line) +void Preprocessor::handle_preprocessor_statement(StringView line) { GenericLexer lexer(line); @@ -100,7 +100,7 @@ void Preprocessor::handle_preprocessor_statement(StringView const& line) handle_preprocessor_keyword(keyword, lexer); } -void Preprocessor::handle_include_statement(StringView const& include_path) +void Preprocessor::handle_include_statement(StringView include_path) { m_included_paths.append(include_path); if (definitions_in_header_callback) { @@ -109,7 +109,7 @@ void Preprocessor::handle_include_statement(StringView const& include_path) } } -void Preprocessor::handle_preprocessor_keyword(const StringView& keyword, GenericLexer& line_lexer) +void Preprocessor::handle_preprocessor_keyword(StringView keyword, GenericLexer& line_lexer) { if (keyword == "include") { // Should have called 'handle_include_statement'. @@ -345,7 +345,7 @@ Optional<Preprocessor::Definition> Preprocessor::create_definition(StringView li return definition; } -String Preprocessor::remove_escaped_newlines(StringView const& value) +String Preprocessor::remove_escaped_newlines(StringView value) { AK::StringBuilder processed_value; GenericLexer lexer { value }; diff --git a/Userland/Libraries/LibCpp/Preprocessor.h b/Userland/Libraries/LibCpp/Preprocessor.h index 96b79d05ff..d5fc287dbb 100644 --- a/Userland/Libraries/LibCpp/Preprocessor.h +++ b/Userland/Libraries/LibCpp/Preprocessor.h @@ -20,7 +20,7 @@ namespace Cpp { class Preprocessor { public: - explicit Preprocessor(const String& filename, const StringView& program); + explicit Preprocessor(const String& filename, StringView program); Vector<Token> process_and_lex(); Vector<StringView> included_paths() const { return m_included_paths; } @@ -49,10 +49,10 @@ public: Function<Definitions(StringView)> definitions_in_header_callback { nullptr }; private: - void handle_preprocessor_statement(StringView const&); - void handle_include_statement(StringView const&); - void handle_preprocessor_keyword(StringView const& keyword, GenericLexer& line_lexer); - String remove_escaped_newlines(StringView const& value); + void handle_preprocessor_statement(StringView); + void handle_include_statement(StringView); + void handle_preprocessor_keyword(StringView keyword, GenericLexer& line_lexer); + String remove_escaped_newlines(StringView value); size_t do_substitution(Vector<Token> const& tokens, size_t token_index, Definition const&); Optional<Definition> create_definition(StringView line); diff --git a/Userland/Libraries/LibCpp/Token.h b/Userland/Libraries/LibCpp/Token.h index 7a2fc919ed..70b4b3cfe0 100644 --- a/Userland/Libraries/LibCpp/Token.h +++ b/Userland/Libraries/LibCpp/Token.h @@ -96,7 +96,7 @@ struct Token { #undef __TOKEN }; - Token(Type type, const Position& start, const Position& end, const StringView& text) + Token(Type type, const Position& start, const Position& end, StringView text) : m_type(type) , m_start(start) , m_end(end) @@ -125,7 +125,7 @@ struct Token { void set_start(const Position& other) { m_start = other; } void set_end(const Position& other) { m_end = other; } Type type() const { return m_type; } - const StringView& text() const { return m_text; } + StringView text() const { return m_text; } private: Type m_type { Type::Unknown }; diff --git a/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp b/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp index 55d02516d0..aff3ae91e5 100644 --- a/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/ASN1.cpp @@ -73,7 +73,7 @@ String type_name(Type type) return "InvalidType"; } -Optional<Core::DateTime> parse_utc_time(const StringView& time) +Optional<Core::DateTime> parse_utc_time(StringView time) { // YYMMDDhhmm[ss]Z or YYMMDDhhmm[ss](+|-)hhmm GenericLexer lexer(time); @@ -120,7 +120,7 @@ Optional<Core::DateTime> parse_utc_time(const StringView& time) return Core::DateTime::create(full_year, month.value(), day.value(), hour.value(), minute.value(), full_seconds); } -Optional<Core::DateTime> parse_generalized_time(const StringView& time) +Optional<Core::DateTime> parse_generalized_time(StringView time) { // YYYYMMDDhh[mm[ss[.fff]]] or YYYYMMDDhh[mm[ss[.fff]]]Z or YYYYMMDDhh[mm[ss[.fff]]](+|-)hhmm GenericLexer lexer(time); diff --git a/Userland/Libraries/LibCrypto/ASN1/ASN1.h b/Userland/Libraries/LibCrypto/ASN1/ASN1.h index 8fc8dec320..f368b5ddd1 100644 --- a/Userland/Libraries/LibCrypto/ASN1/ASN1.h +++ b/Userland/Libraries/LibCrypto/ASN1/ASN1.h @@ -52,7 +52,7 @@ String kind_name(Kind); String class_name(Class); String type_name(Type); -Optional<Core::DateTime> parse_utc_time(const StringView&); -Optional<Core::DateTime> parse_generalized_time(const StringView&); +Optional<Core::DateTime> parse_utc_time(StringView); +Optional<Core::DateTime> parse_generalized_time(StringView); } diff --git a/Userland/Libraries/LibCrypto/Authentication/HMAC.h b/Userland/Libraries/LibCrypto/Authentication/HMAC.h index 6925c2cebd..55d919c238 100644 --- a/Userland/Libraries/LibCrypto/Authentication/HMAC.h +++ b/Userland/Libraries/LibCrypto/Authentication/HMAC.h @@ -49,10 +49,10 @@ public: } TagType process(ReadonlyBytes span) { return process(span.data(), span.size()); } - TagType process(const StringView& string) { return process((const u8*)string.characters_without_null_termination(), string.length()); } + TagType process(StringView string) { return process((const u8*)string.characters_without_null_termination(), string.length()); } void update(ReadonlyBytes span) { return update(span.data(), span.size()); } - void update(const StringView& string) { return update((const u8*)string.characters_without_null_termination(), string.length()); } + void update(StringView string) { return update((const u8*)string.characters_without_null_termination(), string.length()); } TagType digest() { @@ -110,7 +110,7 @@ private: } void derive_key(ReadonlyBytes key) { derive_key(key.data(), key.size()); } - void derive_key(const StringView& key) { derive_key(key.bytes()); } + void derive_key(StringView key) { derive_key(key.bytes()); } HashType m_inner_hasher, m_outer_hasher; u8 m_key_data[2048]; diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h index 4440dd9f00..f85a4969d9 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h @@ -44,7 +44,7 @@ public: return { UnsignedBigInteger::create_invalid(), false }; } - static SignedBigInteger import_data(const StringView& data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } + static SignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } static SignedBigInteger import_data(const u8* ptr, size_t length); static SignedBigInteger create_from(i64 value) diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index 2d899f96ea..76c916d052 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -35,7 +35,7 @@ public: static UnsignedBigInteger create_invalid(); - static UnsignedBigInteger import_data(const StringView& data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } + static UnsignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); } static UnsignedBigInteger import_data(const u8* ptr, size_t length) { return UnsignedBigInteger(ptr, length); diff --git a/Userland/Libraries/LibCrypto/Hash/HashFunction.h b/Userland/Libraries/LibCrypto/Hash/HashFunction.h index 091c252661..71a10043f6 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashFunction.h +++ b/Userland/Libraries/LibCrypto/Hash/HashFunction.h @@ -29,7 +29,7 @@ public: void update(const Bytes& buffer) { update(buffer.data(), buffer.size()); }; void update(const ReadonlyBytes& buffer) { update(buffer.data(), buffer.size()); }; void update(const ByteBuffer& buffer) { update(buffer.data(), buffer.size()); }; - void update(const StringView& string) { update((const u8*)string.characters_without_null_termination(), string.length()); }; + void update(StringView string) { update((const u8*)string.characters_without_null_termination(), string.length()); }; virtual DigestType peek() = 0; virtual DigestType digest() = 0; diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.h b/Userland/Libraries/LibCrypto/Hash/MD5.h index 3a06e2f2f8..9f07c6b899 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.h +++ b/Userland/Libraries/LibCrypto/Hash/MD5.h @@ -71,7 +71,7 @@ public: } inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(const StringView& buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } inline virtual void reset() override { m_A = MD5Constants::init_A; diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.h b/Userland/Libraries/LibCrypto/Hash/SHA1.h index af56b9fe60..27756c3ba3 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.h @@ -56,7 +56,7 @@ public: } inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(const StringView& buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } virtual String class_name() const override { diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.h b/Userland/Libraries/LibCrypto/Hash/SHA2.h index b72f4e95f0..b9377e2c48 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.h @@ -103,7 +103,7 @@ public: } inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(const StringView& buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } virtual String class_name() const override { @@ -153,7 +153,7 @@ public: } inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(const StringView& buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } virtual String class_name() const override { @@ -203,7 +203,7 @@ public: } inline static DigestType hash(const ByteBuffer& buffer) { return hash(buffer.data(), buffer.size()); } - inline static DigestType hash(const StringView& buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } + inline static DigestType hash(StringView buffer) { return hash((const u8*)buffer.characters_without_null_termination(), buffer.length()); } virtual String class_name() const override { diff --git a/Userland/Libraries/LibCrypto/PK/RSA.h b/Userland/Libraries/LibCrypto/PK/RSA.h index 97867c3055..4663359e95 100644 --- a/Userland/Libraries/LibCrypto/PK/RSA.h +++ b/Userland/Libraries/LibCrypto/PK/RSA.h @@ -141,7 +141,7 @@ public: import_private_key(privateKeyPEM); } - RSA(const StringView& privKeyPEM) + RSA(StringView privKeyPEM) { import_private_key(privKeyPEM.bytes()); m_public_key.set(m_private_key.modulus(), m_private_key.public_exponent()); diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index cdfb2b5c17..08d1689bc5 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -29,7 +29,7 @@ DwarfInfo::DwarfInfo(ELF::Image const& elf) populate_compilation_units(); } -ReadonlyBytes DwarfInfo::section_data(StringView const& section_name) const +ReadonlyBytes DwarfInfo::section_data(StringView section_name) const { auto section = m_elf.lookup_section(section_name); if (!section.has_value()) diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h index 70c63452cc..bcb4253710 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h @@ -53,7 +53,7 @@ private: void populate_compilation_units(); void build_cached_dies() const; - ReadonlyBytes section_data(StringView const& section_name) const; + ReadonlyBytes section_data(StringView section_name) const; ELF::Image const& m_elf; ReadonlyBytes m_debug_info_data; diff --git a/Userland/Libraries/LibDesktop/AppFile.cpp b/Userland/Libraries/LibDesktop/AppFile.cpp index 7c7386293f..bbaf23f3c1 100644 --- a/Userland/Libraries/LibDesktop/AppFile.cpp +++ b/Userland/Libraries/LibDesktop/AppFile.cpp @@ -14,18 +14,18 @@ namespace Desktop { -NonnullRefPtr<AppFile> AppFile::get_for_app(const StringView& app_name) +NonnullRefPtr<AppFile> AppFile::get_for_app(StringView app_name) { auto path = String::formatted("{}/{}.af", APP_FILES_DIRECTORY, app_name); return open(path); } -NonnullRefPtr<AppFile> AppFile::open(const StringView& path) +NonnullRefPtr<AppFile> AppFile::open(StringView path) { return adopt_ref(*new AppFile(path)); } -void AppFile::for_each(Function<void(NonnullRefPtr<AppFile>)> callback, const StringView& directory) +void AppFile::for_each(Function<void(NonnullRefPtr<AppFile>)> callback, StringView directory) { Core::DirIterator di(directory, Core::DirIterator::SkipDots); if (di.has_error()) @@ -42,7 +42,7 @@ void AppFile::for_each(Function<void(NonnullRefPtr<AppFile>)> callback, const St } } -AppFile::AppFile(const StringView& path) +AppFile::AppFile(StringView path) : m_config(Core::ConfigFile::open(path)) , m_valid(validate()) { diff --git a/Userland/Libraries/LibDesktop/AppFile.h b/Userland/Libraries/LibDesktop/AppFile.h index e67a4ec9b9..92756bf341 100644 --- a/Userland/Libraries/LibDesktop/AppFile.h +++ b/Userland/Libraries/LibDesktop/AppFile.h @@ -15,9 +15,9 @@ namespace Desktop { class AppFile : public RefCounted<AppFile> { public: static constexpr const char* APP_FILES_DIRECTORY = "/res/apps"; - static NonnullRefPtr<AppFile> get_for_app(const StringView& app_name); - static NonnullRefPtr<AppFile> open(const StringView& path); - static void for_each(Function<void(NonnullRefPtr<AppFile>)>, const StringView& directory = APP_FILES_DIRECTORY); + static NonnullRefPtr<AppFile> get_for_app(StringView app_name); + static NonnullRefPtr<AppFile> open(StringView path); + static void for_each(Function<void(NonnullRefPtr<AppFile>)>, StringView directory = APP_FILES_DIRECTORY); ~AppFile(); bool is_valid() const { return m_valid; } @@ -35,7 +35,7 @@ public: bool spawn() const; private: - explicit AppFile(const StringView& path); + explicit AppFile(StringView path); bool validate() const; diff --git a/Userland/Libraries/LibDiff/Generator.cpp b/Userland/Libraries/LibDiff/Generator.cpp index 6994303005..3224ea6525 100644 --- a/Userland/Libraries/LibDiff/Generator.cpp +++ b/Userland/Libraries/LibDiff/Generator.cpp @@ -8,7 +8,7 @@ namespace Diff { -Vector<Hunk> from_text(StringView const& old_text, StringView const& new_text) +Vector<Hunk> from_text(StringView old_text, StringView new_text) { auto old_lines = old_text.lines(); auto new_lines = new_text.lines(); diff --git a/Userland/Libraries/LibDiff/Generator.h b/Userland/Libraries/LibDiff/Generator.h index 599cdd8461..d1b061edb8 100644 --- a/Userland/Libraries/LibDiff/Generator.h +++ b/Userland/Libraries/LibDiff/Generator.h @@ -10,6 +10,6 @@ namespace Diff { -Vector<Hunk> from_text(StringView const& old_text, StringView const& new_text); +Vector<Hunk> from_text(StringView old_text, StringView new_text); } diff --git a/Userland/Libraries/LibELF/DynamicLinker.cpp b/Userland/Libraries/LibELF/DynamicLinker.cpp index eb05122ad6..5365ce01bd 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.cpp +++ b/Userland/Libraries/LibELF/DynamicLinker.cpp @@ -58,7 +58,7 @@ static Result<void*, DlErrorMessage> __dlopen(const char* filename, int flags); static Result<void*, DlErrorMessage> __dlsym(void* handle, const char* symbol_name); static Result<void, DlErrorMessage> __dladdr(void* addr, Dl_info* info); -Optional<DynamicObject::SymbolLookupResult> DynamicLinker::lookup_global_symbol(const StringView& name) +Optional<DynamicObject::SymbolLookupResult> DynamicLinker::lookup_global_symbol(StringView name) { Optional<DynamicObject::SymbolLookupResult> weak_result; diff --git a/Userland/Libraries/LibELF/DynamicLinker.h b/Userland/Libraries/LibELF/DynamicLinker.h index e9a87fa981..a09f18bf5b 100644 --- a/Userland/Libraries/LibELF/DynamicLinker.h +++ b/Userland/Libraries/LibELF/DynamicLinker.h @@ -14,7 +14,7 @@ namespace ELF { class DynamicLinker { public: - static Optional<DynamicObject::SymbolLookupResult> lookup_global_symbol(const StringView& symbol); + static Optional<DynamicObject::SymbolLookupResult> lookup_global_symbol(StringView symbol); [[noreturn]] static void linker_main(String&& main_program_name, int fd, bool is_secure, int argc, char** argv, char** envp); private: diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index ca30748ad4..37d41c5114 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -249,7 +249,7 @@ const ElfW(Phdr) * DynamicObject::program_headers() const return (const ElfW(Phdr)*)(m_base_address.as_ptr() + header->e_phoff); } -auto DynamicObject::HashSection::lookup_sysv_symbol(const StringView& name, u32 hash_value) const -> Optional<Symbol> +auto DynamicObject::HashSection::lookup_sysv_symbol(StringView name, u32 hash_value) const -> Optional<Symbol> { u32* hash_table_begin = (u32*)address().as_ptr(); size_t num_buckets = hash_table_begin[0]; @@ -273,7 +273,7 @@ auto DynamicObject::HashSection::lookup_sysv_symbol(const StringView& name, u32 return {}; } -auto DynamicObject::HashSection::lookup_gnu_symbol(const StringView& name, u32 hash_value) const -> Optional<Symbol> +auto DynamicObject::HashSection::lookup_gnu_symbol(StringView name, u32 hash_value) const -> Optional<Symbol> { // Algorithm reference: https://ent-voy.blogspot.com/2011/02/ using BloomWord = FlatPtr; @@ -437,7 +437,7 @@ const char* DynamicObject::name_for_dtag(ElfW(Sword) d_tag) } } -auto DynamicObject::lookup_symbol(const StringView& name) const -> Optional<SymbolLookupResult> +auto DynamicObject::lookup_symbol(StringView name) const -> Optional<SymbolLookupResult> { return lookup_symbol(HashSymbol { name }); } @@ -500,7 +500,7 @@ u32 DynamicObject::HashSymbol::sysv_hash() const return m_sysv_hash.value(); } -void* DynamicObject::symbol_for_name(const StringView& name) +void* DynamicObject::symbol_for_name(StringView name) { auto result = hash_section().lookup_symbol(name); if (!result.has_value()) diff --git a/Userland/Libraries/LibELF/DynamicObject.h b/Userland/Libraries/LibELF/DynamicObject.h index 3c330cd004..bc1b3a7a57 100644 --- a/Userland/Libraries/LibELF/DynamicObject.h +++ b/Userland/Libraries/LibELF/DynamicObject.h @@ -99,7 +99,7 @@ public: class Section { public: - Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, const StringView& name) + Section(const DynamicObject& dynamic, unsigned section_offset, unsigned section_size_bytes, unsigned entry_size, StringView name) : m_dynamic(dynamic) , m_section_offset(section_offset) , m_section_size_bytes(section_size_bytes) @@ -212,7 +212,7 @@ public: class HashSymbol { public: - HashSymbol(const StringView& name) + HashSymbol(StringView name) : m_name(name) { } @@ -243,8 +243,8 @@ public: } private: - Optional<Symbol> lookup_sysv_symbol(const StringView& name, u32 hash_value) const; - Optional<Symbol> lookup_gnu_symbol(const StringView& name, u32 hash) const; + Optional<Symbol> lookup_sysv_symbol(StringView name, u32 hash_value) const; + Optional<Symbol> lookup_gnu_symbol(StringView name, u32 hash) const; HashType m_hash_type {}; }; @@ -320,7 +320,7 @@ public: const ELF::DynamicObject* dynamic_object { nullptr }; // The object in which the symbol is defined }; - Optional<SymbolLookupResult> lookup_symbol(const StringView& name) const; + Optional<SymbolLookupResult> lookup_symbol(StringView name) const; Optional<SymbolLookupResult> lookup_symbol(const HashSymbol& symbol) const; // Will be called from _fixup_plt_entry, as part of the PLT trampoline @@ -328,7 +328,7 @@ public: bool elf_is_dynamic() const { return m_is_elf_dynamic; } - void* symbol_for_name(const StringView& name); + void* symbol_for_name(StringView name); private: explicit DynamicObject(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address); diff --git a/Userland/Libraries/LibELF/Hashes.h b/Userland/Libraries/LibELF/Hashes.h index ae172e4b47..f941e450ba 100644 --- a/Userland/Libraries/LibELF/Hashes.h +++ b/Userland/Libraries/LibELF/Hashes.h @@ -11,7 +11,7 @@ namespace ELF { -constexpr u32 compute_sysv_hash(const StringView& name) +constexpr u32 compute_sysv_hash(StringView name) { // SYSV ELF hash algorithm // Note that the GNU HASH algorithm has less collisions @@ -30,7 +30,7 @@ constexpr u32 compute_sysv_hash(const StringView& name) return hash; } -constexpr u32 compute_gnu_hash(const StringView& name) +constexpr u32 compute_gnu_hash(StringView name) { // GNU ELF hash algorithm u32 hash = 5381; diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp index c3b599448e..d610a08291 100644 --- a/Userland/Libraries/LibELF/Image.cpp +++ b/Userland/Libraries/LibELF/Image.cpp @@ -252,7 +252,7 @@ Optional<Image::RelocationSection> Image::Section::relocations() const return static_cast<RelocationSection>(relocation_section.value()); } -Optional<Image::Section> Image::lookup_section(const StringView& name) const +Optional<Image::Section> Image::lookup_section(StringView name) const { VERIFY(m_valid); for (unsigned i = 0; i < section_count(); ++i) { @@ -354,7 +354,7 @@ StringView Image::Symbol::raw_data() const } #ifndef KERNEL -Optional<Image::Symbol> Image::find_demangled_function(const StringView& name) const +Optional<Image::Symbol> Image::find_demangled_function(StringView name) const { Optional<Image::Symbol> found; for_each_symbol([&](const Image::Symbol& symbol) { diff --git a/Userland/Libraries/LibELF/Image.h b/Userland/Libraries/LibELF/Image.h index fb4b06356f..3adcae87c1 100644 --- a/Userland/Libraries/LibELF/Image.h +++ b/Userland/Libraries/LibELF/Image.h @@ -217,7 +217,7 @@ public: template<VoidFunction<ProgramHeader> F> void for_each_program_header(F) const; - Optional<Section> lookup_section(StringView const& name) const; + Optional<Section> lookup_section(StringView name) const; bool is_executable() const { return header().e_type == ET_EXEC; } bool is_relocatable() const { return header().e_type == ET_REL; } @@ -233,7 +233,7 @@ public: bool has_symbols() const { return symbol_count(); } #ifndef KERNEL - Optional<Symbol> find_demangled_function(const StringView& name) const; + Optional<Symbol> find_demangled_function(StringView name) const; String symbolicate(FlatPtr address, u32* offset = nullptr) const; #endif Optional<Image::Symbol> find_symbol(FlatPtr address, u32* offset = nullptr) const; diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp index 1de1a4e666..000bdddf59 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.cpp +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.cpp @@ -68,7 +68,7 @@ Result Client::request_file(i32 parent_window_id, String const& path, Core::Open return m_promise->await(); } -Result Client::open_file(i32 parent_window_id, String const& window_title, StringView const& path) +Result Client::open_file(i32 parent_window_id, String const& window_title, StringView path) { m_promise = Core::Promise<Result>::construct(); auto parent_window_server_client_id = GUI::WindowServerConnection::the().expose_client_id(); diff --git a/Userland/Libraries/LibFileSystemAccessClient/Client.h b/Userland/Libraries/LibFileSystemAccessClient/Client.h index 4396d60392..4a242aa3f1 100644 --- a/Userland/Libraries/LibFileSystemAccessClient/Client.h +++ b/Userland/Libraries/LibFileSystemAccessClient/Client.h @@ -29,7 +29,7 @@ class Client final public: Result request_file_read_only_approved(i32 parent_window_id, String const& path); Result request_file(i32 parent_window_id, String const& path, Core::OpenMode mode); - Result open_file(i32 parent_window_id, String const& window_title = {}, StringView const& path = Core::StandardPaths::home_directory()); + Result open_file(i32 parent_window_id, String const& window_title = {}, StringView path = Core::StandardPaths::home_directory()); Result save_file(i32 parent_window_id, String const& name, String const ext); static Client& the(); diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index ba657eed0d..abda05c205 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -16,7 +16,7 @@ namespace GUI { -AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window* parent_window, const StringView& version) +AboutDialog::AboutDialog(StringView name, const Gfx::Bitmap* icon, Window* parent_window, StringView version) : Dialog(parent_window) , m_name(name) , m_icon(icon) @@ -58,7 +58,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window right_container.set_layout<VerticalBoxLayout>(); right_container.layout()->set_margins({ 12, 4, 4, 0 }); - auto make_label = [&](const StringView& text, bool bold = false) { + auto make_label = [&](StringView text, bool bold = false) { auto& label = right_container.add<Label>(text); label.set_text_alignment(Gfx::TextAlignment::CenterLeft); label.set_fixed_height(14); diff --git a/Userland/Libraries/LibGUI/AboutDialog.h b/Userland/Libraries/LibGUI/AboutDialog.h index 3d41704498..840ae8295e 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.h +++ b/Userland/Libraries/LibGUI/AboutDialog.h @@ -16,7 +16,7 @@ class AboutDialog final : public Dialog { public: virtual ~AboutDialog() override; - static void show(const StringView& name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, const Gfx::Bitmap* window_icon = nullptr, const StringView& version = Core::Version::SERENITY_VERSION) + static void show(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, const Gfx::Bitmap* window_icon = nullptr, StringView version = Core::Version::SERENITY_VERSION) { auto dialog = AboutDialog::construct(name, icon, parent_window, version); if (window_icon) @@ -25,7 +25,7 @@ public: } private: - AboutDialog(const StringView& name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, const StringView& version = Core::Version::SERENITY_VERSION); + AboutDialog(StringView name, const Gfx::Bitmap* icon = nullptr, Window* parent_window = nullptr, StringView version = Core::Version::SERENITY_VERSION); String m_name; RefPtr<Gfx::Bitmap> m_icon; diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index 77eab48f55..1af93ffa35 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -684,7 +684,7 @@ void AbstractView::set_searchable(bool searchable) stop_highlighted_search_timer(); } -void AbstractView::draw_item_text(Gfx::Painter& painter, ModelIndex const& index, bool is_selected, Gfx::IntRect const& text_rect, StringView const& item_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::TextElision elision, size_t search_highlighting_offset) +void AbstractView::draw_item_text(Gfx::Painter& painter, ModelIndex const& index, bool is_selected, Gfx::IntRect const& text_rect, StringView item_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::TextElision elision, size_t search_highlighting_offset) { if (m_edit_index == index) return; diff --git a/Userland/Libraries/LibGUI/AbstractView.h b/Userland/Libraries/LibGUI/AbstractView.h index ded681917e..cc13084541 100644 --- a/Userland/Libraries/LibGUI/AbstractView.h +++ b/Userland/Libraries/LibGUI/AbstractView.h @@ -154,7 +154,7 @@ protected: virtual void did_change_cursor_index([[maybe_unused]] ModelIndex const& old_index, [[maybe_unused]] ModelIndex const& new_index) { } virtual void editing_widget_did_change([[maybe_unused]] ModelIndex const& index) { } - void draw_item_text(Gfx::Painter&, ModelIndex const&, bool, Gfx::IntRect const&, StringView const&, Gfx::Font const&, Gfx::TextAlignment, Gfx::TextElision, size_t search_highlighting_offset = 0); + void draw_item_text(Gfx::Painter&, ModelIndex const&, bool, Gfx::IntRect const&, StringView, Gfx::Font const&, Gfx::TextAlignment, Gfx::TextElision, size_t search_highlighting_offset = 0); void set_suppress_update_on_selection_change(bool value) { m_suppress_update_on_selection_change = value; } diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index 3d7ac21772..aae3474a07 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -141,7 +141,7 @@ ComboBox::~ComboBox() { } -void ComboBox::set_editor_placeholder(const StringView& placeholder) +void ComboBox::set_editor_placeholder(StringView placeholder) { m_editor->set_placeholder(placeholder); } diff --git a/Userland/Libraries/LibGUI/ComboBox.h b/Userland/Libraries/LibGUI/ComboBox.h index 6c76d2d5ba..a772718838 100644 --- a/Userland/Libraries/LibGUI/ComboBox.h +++ b/Userland/Libraries/LibGUI/ComboBox.h @@ -40,7 +40,7 @@ public: int model_column() const; void set_model_column(int); - void set_editor_placeholder(const StringView& placeholder); + void set_editor_placeholder(StringView placeholder); const String& editor_placeholder() const; Function<void(const String&, const ModelIndex&)> on_change; diff --git a/Userland/Libraries/LibGUI/Desktop.cpp b/Userland/Libraries/LibGUI/Desktop.cpp index ce9bf989b9..0fcf69dc23 100644 --- a/Userland/Libraries/LibGUI/Desktop.cpp +++ b/Userland/Libraries/LibGUI/Desktop.cpp @@ -45,17 +45,17 @@ void Desktop::did_receive_screen_rects(Badge<WindowServerConnection>, const Vect callback(*this); } -void Desktop::set_background_color(const StringView& background_color) +void Desktop::set_background_color(StringView background_color) { WindowServerConnection::the().async_set_background_color(background_color); } -void Desktop::set_wallpaper_mode(const StringView& mode) +void Desktop::set_wallpaper_mode(StringView mode) { WindowServerConnection::the().async_set_wallpaper_mode(mode); } -bool Desktop::set_wallpaper(const StringView& path, bool save_config) +bool Desktop::set_wallpaper(StringView path, bool save_config) { WindowServerConnection::the().async_set_wallpaper(path); auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::SetWallpaperFinished>()->success(); diff --git a/Userland/Libraries/LibGUI/Desktop.h b/Userland/Libraries/LibGUI/Desktop.h index 554b723ad4..9dc0842923 100644 --- a/Userland/Libraries/LibGUI/Desktop.h +++ b/Userland/Libraries/LibGUI/Desktop.h @@ -25,12 +25,12 @@ public: static Desktop& the(); Desktop(); - void set_background_color(const StringView& background_color); + void set_background_color(StringView background_color); - void set_wallpaper_mode(const StringView& mode); + void set_wallpaper_mode(StringView mode); String wallpaper() const; - bool set_wallpaper(const StringView& path, bool save_config = true); + bool set_wallpaper(StringView path, bool save_config = true); Gfx::IntRect rect() const { return m_bounding_rect; } const Vector<Gfx::IntRect, 4>& rects() const { return m_rects; } diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index b1ec3267c1..5553f0f3e5 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -26,7 +26,7 @@ static Vector<u32> supported_emoji_code_points() auto lexical_path = LexicalPath(filename); if (lexical_path.extension() != "png") continue; - auto& basename = lexical_path.basename(); + auto basename = lexical_path.basename(); if (!basename.starts_with("U+")) continue; u32 code_point = strtoul(basename.to_string().characters() + 2, nullptr, 16); diff --git a/Userland/Libraries/LibGUI/Event.h b/Userland/Libraries/LibGUI/Event.h index 4f174225ae..13e7b3953b 100644 --- a/Userland/Libraries/LibGUI/Event.h +++ b/Userland/Libraries/LibGUI/Event.h @@ -138,7 +138,7 @@ public: class WMWindowStateChangedEvent : public WMEvent { public: - WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, const StringView& title, const Gfx::IntRect& rect, unsigned virtual_desktop_row, unsigned virtual_desktop_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress) + WMWindowStateChangedEvent(int client_id, int window_id, int parent_client_id, int parent_window_id, StringView title, const Gfx::IntRect& rect, unsigned virtual_desktop_row, unsigned virtual_desktop_column, bool is_active, bool is_modal, WindowType window_type, bool is_minimized, bool is_frameless, Optional<int> progress) : WMEvent(Event::Type::WM_WindowStateChanged, client_id, window_id) , m_parent_client_id(parent_client_id) , m_parent_window_id(parent_window_id) diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index 04d264b7cc..a92a3006f9 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -32,7 +32,7 @@ namespace GUI { -Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, const StringView& path, bool folder, ScreenPosition screen_position) +Optional<String> FilePicker::get_open_filepath(Window* parent_window, const String& window_title, StringView path, bool folder, ScreenPosition screen_position) { auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, "", path, screen_position); @@ -50,7 +50,7 @@ Optional<String> FilePicker::get_open_filepath(Window* parent_window, const Stri return {}; } -Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, const StringView& path, ScreenPosition screen_position) +Optional<String> FilePicker::get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path, ScreenPosition screen_position) { auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension), path, screen_position); @@ -65,7 +65,7 @@ Optional<String> FilePicker::get_save_filepath(Window* parent_window, const Stri return {}; } -FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filename, const StringView& path, ScreenPosition screen_position) +FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, StringView path, ScreenPosition screen_position) : Dialog(parent_window, screen_position) , m_model(FileSystemModel::create(path)) , m_mode(mode) diff --git a/Userland/Libraries/LibGUI/FilePicker.h b/Userland/Libraries/LibGUI/FilePicker.h index 149016fcd3..1152e95f4a 100644 --- a/Userland/Libraries/LibGUI/FilePicker.h +++ b/Userland/Libraries/LibGUI/FilePicker.h @@ -28,8 +28,8 @@ public: Save }; - static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {}, const StringView& path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); - static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension, const StringView& path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); + static Optional<String> get_open_filepath(Window* parent_window, const String& window_title = {}, StringView path = Core::StandardPaths::home_directory(), bool folder = false, ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); + static Optional<String> get_save_filepath(Window* parent_window, const String& title, const String& extension, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); virtual ~FilePicker() override; @@ -43,7 +43,7 @@ private: // ^GUI::ModelClient virtual void model_did_update(unsigned) override; - FilePicker(Window* parent_window, Mode type = Mode::Open, const StringView& filename = "Untitled", const StringView& path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); + FilePicker(Window* parent_window, Mode type = Mode::Open, StringView filename = "Untitled", StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent); static String ok_button_name(Mode mode) { diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 014f73a99c..0a71f25062 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -615,7 +615,7 @@ Icon FileSystemModel::icon_for(Node const& node) const static HashMap<String, RefPtr<Gfx::Bitmap>> s_thumbnail_cache; -static RefPtr<Gfx::Bitmap> render_thumbnail(StringView const& path) +static RefPtr<Gfx::Bitmap> render_thumbnail(StringView path) { auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path); if (bitmap_or_error.is_error()) @@ -760,7 +760,7 @@ void FileSystemModel::set_data(ModelIndex const& index, Variant const& data) on_rename_successful(node.full_path(), new_full_path); } -Vector<ModelIndex> FileSystemModel::matches(StringView const& searching, unsigned flags, ModelIndex const& index) +Vector<ModelIndex> FileSystemModel::matches(StringView searching, unsigned flags, ModelIndex const& index) { Node& node = const_cast<Node&>(this->node(index)); node.reify_if_needed(); diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index 67973e5625..4eede5e947 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -133,7 +133,7 @@ public: virtual bool is_editable(ModelIndex const&) const override; virtual bool is_searchable() const override { return true; } virtual void set_data(ModelIndex const&, Variant const&) override; - virtual Vector<ModelIndex> matches(StringView const&, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; + virtual Vector<ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; virtual void invalidate() override; static String timestamp_string(time_t timestamp) diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index c3b884453c..23df13616c 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -79,7 +79,7 @@ void FilteringProxyModel::filter() add_matching(parent_index); } -void FilteringProxyModel::set_filter_term(StringView const& term) +void FilteringProxyModel::set_filter_term(StringView term) { if (m_filter_term == term) return; @@ -104,7 +104,7 @@ bool FilteringProxyModel::is_searchable() const return m_model.is_searchable(); } -Vector<ModelIndex> FilteringProxyModel::matches(StringView const& searching, unsigned flags, ModelIndex const& index) +Vector<ModelIndex> FilteringProxyModel::matches(StringView searching, unsigned flags, ModelIndex const& index) { auto found_indices = m_model.matches(searching, flags, index); for (size_t i = 0; i < found_indices.size(); i++) diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.h b/Userland/Libraries/LibGUI/FilteringProxyModel.h index 27689123df..b642e55b07 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.h +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.h @@ -29,9 +29,9 @@ public: virtual void invalidate() override; virtual ModelIndex index(int row, int column = 0, ModelIndex const& parent = ModelIndex()) const override; virtual bool is_searchable() const override; - virtual Vector<ModelIndex> matches(StringView const&, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; + virtual Vector<ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; - void set_filter_term(StringView const& term); + void set_filter_term(StringView term); ModelIndex map(ModelIndex const&) const; diff --git a/Userland/Libraries/LibGUI/GMLAutocompleteProvider.h b/Userland/Libraries/LibGUI/GMLAutocompleteProvider.h index b08e30db51..85133f8e45 100644 --- a/Userland/Libraries/LibGUI/GMLAutocompleteProvider.h +++ b/Userland/Libraries/LibGUI/GMLAutocompleteProvider.h @@ -16,7 +16,7 @@ public: virtual ~GMLAutocompleteProvider() override { } private: - static bool can_have_declared_layout(const StringView& class_name) + static bool can_have_declared_layout(StringView class_name) { return class_name.is_one_of("GUI::Widget", "GUI::Frame"); } diff --git a/Userland/Libraries/LibGUI/GMLFormatter.cpp b/Userland/Libraries/LibGUI/GMLFormatter.cpp index 2391d4a4c4..07f378fbcc 100644 --- a/Userland/Libraries/LibGUI/GMLFormatter.cpp +++ b/Userland/Libraries/LibGUI/GMLFormatter.cpp @@ -86,7 +86,7 @@ static String format_gml_object(const JsonObject& node, size_t indentation = 0, return builder.to_string(); } -String format_gml(const StringView& string) +String format_gml(StringView string) { // FIXME: Preserve comments somehow, they're not contained // in the JSON object returned by parse_gml() diff --git a/Userland/Libraries/LibGUI/GMLFormatter.h b/Userland/Libraries/LibGUI/GMLFormatter.h index 7f2a0a50b7..0f3c347b67 100644 --- a/Userland/Libraries/LibGUI/GMLFormatter.h +++ b/Userland/Libraries/LibGUI/GMLFormatter.h @@ -10,6 +10,6 @@ namespace GUI { -String format_gml(const StringView&); +String format_gml(StringView); } diff --git a/Userland/Libraries/LibGUI/GMLLexer.cpp b/Userland/Libraries/LibGUI/GMLLexer.cpp index e884e087ca..72fc43eba6 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.cpp +++ b/Userland/Libraries/LibGUI/GMLLexer.cpp @@ -10,7 +10,7 @@ namespace GUI { -GMLLexer::GMLLexer(StringView const& input) +GMLLexer::GMLLexer(StringView input) : m_input(input) { } diff --git a/Userland/Libraries/LibGUI/GMLLexer.h b/Userland/Libraries/LibGUI/GMLLexer.h index 9e418c6cae..9d1f31d84e 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.h +++ b/Userland/Libraries/LibGUI/GMLLexer.h @@ -53,7 +53,7 @@ struct GMLToken { class GMLLexer { public: - GMLLexer(StringView const&); + GMLLexer(StringView); Vector<GMLToken> lex(); diff --git a/Userland/Libraries/LibGUI/GMLParser.cpp b/Userland/Libraries/LibGUI/GMLParser.cpp index 301ab3f7b4..3a8baf25af 100644 --- a/Userland/Libraries/LibGUI/GMLParser.cpp +++ b/Userland/Libraries/LibGUI/GMLParser.cpp @@ -121,7 +121,7 @@ static Optional<JsonValue> parse_core_object(Queue<GMLToken>& tokens) return object; } -JsonValue parse_gml(const StringView& string) +JsonValue parse_gml(StringView string) { auto lexer = GMLLexer(string); diff --git a/Userland/Libraries/LibGUI/GMLParser.h b/Userland/Libraries/LibGUI/GMLParser.h index 3e4b0cebc8..4670199a6e 100644 --- a/Userland/Libraries/LibGUI/GMLParser.h +++ b/Userland/Libraries/LibGUI/GMLParser.h @@ -10,6 +10,6 @@ namespace GUI { -JsonValue parse_gml(const StringView&); +JsonValue parse_gml(StringView); } diff --git a/Userland/Libraries/LibGUI/GroupBox.cpp b/Userland/Libraries/LibGUI/GroupBox.cpp index 6918f5ba6f..f0f4a853ff 100644 --- a/Userland/Libraries/LibGUI/GroupBox.cpp +++ b/Userland/Libraries/LibGUI/GroupBox.cpp @@ -14,7 +14,7 @@ REGISTER_WIDGET(GUI, GroupBox) namespace GUI { -GroupBox::GroupBox(const StringView& title) +GroupBox::GroupBox(StringView title) : m_title(title) { REGISTER_STRING_PROPERTY("title", title, set_title); @@ -58,7 +58,7 @@ void GroupBox::fonts_change_event(FontsChangeEvent& event) invalidate_layout(); } -void GroupBox::set_title(const StringView& title) +void GroupBox::set_title(StringView title) { if (m_title == title) return; diff --git a/Userland/Libraries/LibGUI/GroupBox.h b/Userland/Libraries/LibGUI/GroupBox.h index 8d7da6037c..a928bd8789 100644 --- a/Userland/Libraries/LibGUI/GroupBox.h +++ b/Userland/Libraries/LibGUI/GroupBox.h @@ -16,11 +16,11 @@ public: virtual ~GroupBox() override; String title() const { return m_title; } - void set_title(const StringView&); + void set_title(StringView); virtual Margins content_margins() const override; protected: - explicit GroupBox(const StringView& title = {}); + explicit GroupBox(StringView title = {}); virtual void paint_event(PaintEvent&) override; virtual void fonts_change_event(FontsChangeEvent&) override; diff --git a/Userland/Libraries/LibGUI/INILexer.cpp b/Userland/Libraries/LibGUI/INILexer.cpp index ce2c850d99..fd5ee1fd1f 100644 --- a/Userland/Libraries/LibGUI/INILexer.cpp +++ b/Userland/Libraries/LibGUI/INILexer.cpp @@ -10,7 +10,7 @@ namespace GUI { -IniLexer::IniLexer(StringView const& input) +IniLexer::IniLexer(StringView input) : m_input(input) { } diff --git a/Userland/Libraries/LibGUI/INILexer.h b/Userland/Libraries/LibGUI/INILexer.h index f6a01e08f3..411a01bba7 100644 --- a/Userland/Libraries/LibGUI/INILexer.h +++ b/Userland/Libraries/LibGUI/INILexer.h @@ -52,7 +52,7 @@ struct IniToken { class IniLexer { public: - IniLexer(StringView const&); + IniLexer(StringView); Vector<IniToken> lex(); diff --git a/Userland/Libraries/LibGUI/Icon.cpp b/Userland/Libraries/LibGUI/Icon.cpp index 5bd64a3ae6..803a1a1c7c 100644 --- a/Userland/Libraries/LibGUI/Icon.cpp +++ b/Userland/Libraries/LibGUI/Icon.cpp @@ -72,7 +72,7 @@ void IconImpl::set_bitmap_for_size(int size, RefPtr<Gfx::Bitmap>&& bitmap) m_bitmaps.set(size, move(bitmap)); } -Icon Icon::default_icon(const StringView& name) +Icon Icon::default_icon(StringView name) { RefPtr<Gfx::Bitmap> bitmap16; RefPtr<Gfx::Bitmap> bitmap32; diff --git a/Userland/Libraries/LibGUI/Icon.h b/Userland/Libraries/LibGUI/Icon.h index 3be0b7a3c4..fbe01f66da 100644 --- a/Userland/Libraries/LibGUI/Icon.h +++ b/Userland/Libraries/LibGUI/Icon.h @@ -43,7 +43,7 @@ public: Icon(const Icon&); ~Icon() { } - static Icon default_icon(const StringView&); + static Icon default_icon(StringView); Icon& operator=(const Icon& other) { diff --git a/Userland/Libraries/LibGUI/ImageWidget.cpp b/Userland/Libraries/LibGUI/ImageWidget.cpp index 71e05e87bc..dcf4f16d25 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.cpp +++ b/Userland/Libraries/LibGUI/ImageWidget.cpp @@ -14,7 +14,7 @@ REGISTER_WIDGET(GUI, ImageWidget) namespace GUI { -ImageWidget::ImageWidget(const StringView&) +ImageWidget::ImageWidget(StringView) : m_timer(Core::Timer::construct()) { @@ -71,7 +71,7 @@ void ImageWidget::animate() } } -void ImageWidget::load_from_file(const StringView& path) +void ImageWidget::load_from_file(StringView path) { auto file_or_error = MappedFile::map(path); if (file_or_error.is_error()) diff --git a/Userland/Libraries/LibGUI/ImageWidget.h b/Userland/Libraries/LibGUI/ImageWidget.h index d2b3d46571..8acae2c23e 100644 --- a/Userland/Libraries/LibGUI/ImageWidget.h +++ b/Userland/Libraries/LibGUI/ImageWidget.h @@ -26,7 +26,7 @@ public: bool auto_resize() const { return m_auto_resize; } void animate(); - void load_from_file(const StringView&); + void load_from_file(StringView); int opacity_percent() const { return m_opacity_percent; } void set_opacity_percent(int percent); @@ -34,7 +34,7 @@ public: Function<void()> on_click; protected: - explicit ImageWidget(const StringView& text = {}); + explicit ImageWidget(StringView text = {}); virtual void mousedown_event(GUI::MouseEvent&) override; virtual void paint_event(PaintEvent&) override; diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index 4096100bfb..39427aaa6e 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -14,7 +14,7 @@ namespace GUI { -InputBox::InputBox(Window* parent_window, String& text_value, StringView const& prompt, StringView const& title, StringView const& placeholder, InputType input_type) +InputBox::InputBox(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) : Dialog(parent_window) , m_text_value(text_value) , m_prompt(prompt) @@ -28,7 +28,7 @@ InputBox::~InputBox() { } -int InputBox::show(Window* parent_window, String& text_value, StringView const& prompt, StringView const& title, StringView const& placeholder, InputType input_type) +int InputBox::show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) { auto box = InputBox::construct(parent_window, text_value, prompt, title, placeholder, input_type); box->set_resizable(false); diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h index dbf6e9d778..60705ad21c 100644 --- a/Userland/Libraries/LibGUI/InputBox.h +++ b/Userland/Libraries/LibGUI/InputBox.h @@ -21,10 +21,10 @@ class InputBox : public Dialog { public: virtual ~InputBox() override; - static int show(Window* parent_window, String& text_value, StringView const& prompt, StringView const& title, StringView const& placeholder = {}, InputType input_type = InputType::Text); + static int show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text); private: - explicit InputBox(Window* parent_window, String& text_value, StringView const& prompt, StringView const& title, StringView const& placeholder, InputType input_type); + explicit InputBox(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type); String text_value() const { return m_text_value; } diff --git a/Userland/Libraries/LibGUI/ItemListModel.h b/Userland/Libraries/LibGUI/ItemListModel.h index eaa9b333ca..ff7639ef1c 100644 --- a/Userland/Libraries/LibGUI/ItemListModel.h +++ b/Userland/Libraries/LibGUI/ItemListModel.h @@ -78,7 +78,7 @@ public: } virtual bool is_searchable() const override { return true; } - virtual Vector<GUI::ModelIndex> matches(StringView const& searching, unsigned flags, GUI::ModelIndex const&) override + virtual Vector<GUI::ModelIndex> matches(StringView searching, unsigned flags, GUI::ModelIndex const&) override { Vector<GUI::ModelIndex> found_indices; if constexpr (IsTwoDimensional) { diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 28a2d71efc..08e2ce3f72 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -13,7 +13,7 @@ namespace GUI { -int MessageBox::show(Window* parent_window, const StringView& text, const StringView& title, Type type, InputType input_type) +int MessageBox::show(Window* parent_window, StringView text, StringView title, Type type, InputType input_type) { auto box = MessageBox::construct(parent_window, text, title, type, input_type); if (parent_window) @@ -21,12 +21,12 @@ int MessageBox::show(Window* parent_window, const StringView& text, const String return box->exec(); } -int MessageBox::show_error(Window* parent_window, const StringView& text) +int MessageBox::show_error(Window* parent_window, StringView text) { return show(parent_window, text, "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); } -MessageBox::MessageBox(Window* parent_window, const StringView& text, const StringView& title, Type type, InputType input_type) +MessageBox::MessageBox(Window* parent_window, StringView text, StringView title, Type type, InputType input_type) : Dialog(parent_window) , m_text(text) , m_type(type) diff --git a/Userland/Libraries/LibGUI/MessageBox.h b/Userland/Libraries/LibGUI/MessageBox.h index bcd68bb175..8ca4ba2a04 100644 --- a/Userland/Libraries/LibGUI/MessageBox.h +++ b/Userland/Libraries/LibGUI/MessageBox.h @@ -30,11 +30,11 @@ public: virtual ~MessageBox() override; - static int show(Window* parent_window, const StringView& text, const StringView& title, Type type = Type::None, InputType input_type = InputType::OK); - static int show_error(Window* parent_window, const StringView& text); + static int show(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK); + static int show_error(Window* parent_window, StringView text); private: - explicit MessageBox(Window* parent_window, const StringView& text, const StringView& title, Type type = Type::None, InputType input_type = InputType::OK); + explicit MessageBox(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK); bool should_include_ok_button() const; bool should_include_cancel_button() const; diff --git a/Userland/Libraries/LibGUI/Model.h b/Userland/Libraries/LibGUI/Model.h index 2afeca4e45..498cea4dbe 100644 --- a/Userland/Libraries/LibGUI/Model.h +++ b/Userland/Libraries/LibGUI/Model.h @@ -75,7 +75,7 @@ public: virtual void set_data(ModelIndex const&, Variant const&) { } virtual int tree_column() const { return 0; } virtual bool accepts_drag(ModelIndex const&, Vector<String> const& mime_types) const; - virtual Vector<ModelIndex> matches(StringView const&, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) { return {}; } + virtual Vector<ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) { return {}; } virtual bool is_column_sortable([[maybe_unused]] int column_index) const { return true; } virtual void sort([[maybe_unused]] int column, SortOrder) { } @@ -104,7 +104,7 @@ protected: void for_each_client(Function<void(ModelClient&)>); void did_update(unsigned flags = UpdateFlag::InvalidateAllIndices); - static bool string_matches(StringView const& str, StringView const& needle, unsigned flags) + static bool string_matches(StringView str, StringView needle, unsigned flags) { auto case_sensitivity = (flags & CaseInsensitive) ? CaseSensitivity::CaseInsensitive : CaseSensitivity::CaseSensitive; if (flags & MatchFull) diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 82fa40b90d..91c9b9dab1 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -14,7 +14,7 @@ namespace GUI { -ProcessChooser::ProcessChooser(const StringView& window_title, const StringView& button_label, const Gfx::Bitmap* window_icon, GUI::Window* parent_window) +ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, const Gfx::Bitmap* window_icon, GUI::Window* parent_window) : Dialog(parent_window) , m_window_title(window_title) , m_button_label(button_label) diff --git a/Userland/Libraries/LibGUI/ProcessChooser.h b/Userland/Libraries/LibGUI/ProcessChooser.h index 412648bbde..983abb3f65 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.h +++ b/Userland/Libraries/LibGUI/ProcessChooser.h @@ -21,7 +21,7 @@ public: pid_t pid() const { return m_pid; } private: - ProcessChooser(const StringView& window_title = "Process Chooser", const StringView& button_label = "Select", const Gfx::Bitmap* window_icon = nullptr, GUI::Window* parent_window = nullptr); + ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", const Gfx::Bitmap* window_icon = nullptr, GUI::Window* parent_window = nullptr); void set_pid_from_index_and_close(const ModelIndex&); diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index e2f1efe2e2..33bc1db1cf 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -288,7 +288,7 @@ bool SortingProxyModel::is_searchable() const return source().is_searchable(); } -Vector<ModelIndex> SortingProxyModel::matches(StringView const& searching, unsigned flags, ModelIndex const& proxy_index) +Vector<ModelIndex> SortingProxyModel::matches(StringView searching, unsigned flags, ModelIndex const& proxy_index) { auto found_indices = source().matches(searching, flags, map_to_source(proxy_index)); for (size_t i = 0; i < found_indices.size(); i++) diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.h b/Userland/Libraries/LibGUI/SortingProxyModel.h index ef93f73bab..85ca910cb0 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.h +++ b/Userland/Libraries/LibGUI/SortingProxyModel.h @@ -28,7 +28,7 @@ public: virtual bool is_editable(ModelIndex const&) const override; virtual bool is_searchable() const override; virtual void set_data(ModelIndex const&, Variant const&) override; - virtual Vector<ModelIndex> matches(StringView const&, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; + virtual Vector<ModelIndex> matches(StringView, unsigned = MatchesFlag::AllMatching, ModelIndex const& = ModelIndex()) override; virtual bool accepts_drag(ModelIndex const&, Vector<String> const& mime_types) const override; virtual bool is_column_sortable(int column_index) const override; diff --git a/Userland/Libraries/LibGUI/TabWidget.cpp b/Userland/Libraries/LibGUI/TabWidget.cpp index c0220f0681..474b805a9d 100644 --- a/Userland/Libraries/LibGUI/TabWidget.cpp +++ b/Userland/Libraries/LibGUI/TabWidget.cpp @@ -44,7 +44,7 @@ TabWidget::~TabWidget() { } -void TabWidget::add_widget(const StringView& title, Widget& widget) +void TabWidget::add_widget(StringView title, Widget& widget) { m_tabs.append({ title, nullptr, &widget }); add_child(widget); @@ -537,7 +537,7 @@ Optional<size_t> TabWidget::active_tab_index() const return {}; } -void TabWidget::set_tab_title(Widget& tab, const StringView& title) +void TabWidget::set_tab_title(Widget& tab, StringView title) { for (auto& t : m_tabs) { if (t.widget == &tab) { diff --git a/Userland/Libraries/LibGUI/TabWidget.h b/Userland/Libraries/LibGUI/TabWidget.h index ee86e15690..bd232857e1 100644 --- a/Userland/Libraries/LibGUI/TabWidget.h +++ b/Userland/Libraries/LibGUI/TabWidget.h @@ -36,11 +36,11 @@ public: GUI::Margins const& container_margins() const { return m_container_margins; } void set_container_margins(GUI::Margins const&); - void add_widget(const StringView&, Widget&); + void add_widget(StringView, Widget&); void remove_widget(Widget&); template<class T, class... Args> - T& add_tab(const StringView& title, Args&&... args) + T& add_tab(StringView title, Args&&... args) { auto t = T::construct(forward<Args>(args)...); add_widget(title, *t); @@ -50,7 +50,7 @@ public: void remove_tab(Widget& tab) { remove_widget(tab); } void remove_all_tabs_except(Widget& tab); - void set_tab_title(Widget& tab, const StringView& title); + void set_tab_title(Widget& tab, StringView title); void set_tab_icon(Widget& tab, const Gfx::Bitmap*); void activate_next_tab(); diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index 832220a172..aaed29702c 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -39,7 +39,7 @@ TextDocument::~TextDocument() { } -bool TextDocument::set_text(const StringView& text, AllowCallback allow_callback) +bool TextDocument::set_text(StringView text, AllowCallback allow_callback) { m_client_notifications_enabled = false; m_undo_stack.clear(); @@ -161,7 +161,7 @@ TextDocumentLine::TextDocumentLine(TextDocument& document) clear(document); } -TextDocumentLine::TextDocumentLine(TextDocument& document, const StringView& text) +TextDocumentLine::TextDocumentLine(TextDocument& document, StringView text) { set_text(document, text); } @@ -178,7 +178,7 @@ void TextDocumentLine::set_text(TextDocument& document, const Vector<u32> text) document.update_views({}); } -bool TextDocumentLine::set_text(TextDocument& document, const StringView& text) +bool TextDocumentLine::set_text(TextDocument& document, StringView text) { if (text.is_empty()) { clear(document); @@ -403,7 +403,7 @@ TextPosition TextDocument::previous_position_before(const TextPosition& position return { position.line(), position.column() - 1 }; } -void TextDocument::update_regex_matches(const StringView& needle) +void TextDocument::update_regex_matches(StringView needle) { if (m_regex_needs_update || needle != m_regex_needle) { Regex<PosixExtended> re(needle); @@ -421,7 +421,7 @@ void TextDocument::update_regex_matches(const StringView& needle) } } -TextRange TextDocument::find_next(const StringView& needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) +TextRange TextDocument::find_next(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) { if (needle.is_empty()) return {}; @@ -501,7 +501,7 @@ TextRange TextDocument::find_next(const StringView& needle, const TextPosition& return {}; } -TextRange TextDocument::find_previous(const StringView& needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) +TextRange TextDocument::find_previous(StringView needle, const TextPosition& start, SearchShouldWrap should_wrap, bool regmatch, bool match_case) { if (needle.is_empty()) return {}; @@ -585,7 +585,7 @@ TextRange TextDocument::find_previous(const StringView& needle, const TextPositi return {}; } -Vector<TextRange> TextDocument::find_all(const StringView& needle, bool regmatch) +Vector<TextRange> TextDocument::find_all(StringView needle, bool regmatch) { Vector<TextRange> ranges; @@ -889,7 +889,7 @@ void RemoveTextCommand::undo() m_document.set_all_cursors(new_cursor); } -TextPosition TextDocument::insert_at(const TextPosition& position, const StringView& text, const Client* client) +TextPosition TextDocument::insert_at(const TextPosition& position, StringView text, const Client* client) { TextPosition cursor = position; Utf8View utf8_view(text); diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h index 17218725b5..efe7a3e4e0 100644 --- a/Userland/Libraries/LibGUI/TextDocument.h +++ b/Userland/Libraries/LibGUI/TextDocument.h @@ -63,7 +63,7 @@ public: void set_spans(Vector<TextDocumentSpan> spans) { m_spans = move(spans); } - bool set_text(const StringView&, AllowCallback = AllowCallback::Yes); + bool set_text(StringView, AllowCallback = AllowCallback::Yes); const NonnullOwnPtrVector<TextDocumentLine>& lines() const { return m_lines; } NonnullOwnPtrVector<TextDocumentLine>& lines() { return m_lines; } @@ -88,11 +88,11 @@ public: String text() const; String text_in_range(const TextRange&) const; - Vector<TextRange> find_all(const StringView& needle, bool regmatch = false); + Vector<TextRange> find_all(StringView needle, bool regmatch = false); - void update_regex_matches(const StringView&); - TextRange find_next(const StringView&, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); - TextRange find_previous(const StringView&, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); + void update_regex_matches(StringView); + TextRange find_next(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); + TextRange find_previous(StringView, const TextPosition& start = {}, SearchShouldWrap = SearchShouldWrap::Yes, bool regmatch = false, bool match_case = true); TextPosition next_position_after(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const; TextPosition previous_position_before(const TextPosition&, SearchShouldWrap = SearchShouldWrap::Yes) const; @@ -122,7 +122,7 @@ public: void set_all_cursors(const TextPosition&); TextPosition insert_at(const TextPosition&, u32, const Client* = nullptr); - TextPosition insert_at(const TextPosition&, const StringView&, const Client* = nullptr); + TextPosition insert_at(const TextPosition&, StringView, const Client* = nullptr); void remove(const TextRange&); virtual bool is_code_document() const { return false; } @@ -154,14 +154,14 @@ private: class TextDocumentLine { public: explicit TextDocumentLine(TextDocument&); - explicit TextDocumentLine(TextDocument&, const StringView&); + explicit TextDocumentLine(TextDocument&, StringView); String to_utf8() const; Utf32View view() const { return { code_points(), length() }; } const u32* code_points() const { return m_text.data(); } size_t length() const { return m_text.size(); } - bool set_text(TextDocument&, const StringView&); + bool set_text(TextDocument&, StringView); void set_text(TextDocument&, Vector<u32>); void append(TextDocument&, u32); void prepend(TextDocument&, u32); diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 59b65c7467..1d84ae18ea 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -101,7 +101,7 @@ void TextEditor::create_actions() m_select_all_action = CommonActions::make_select_all_action([this](auto&) { select_all(); }, this); } -void TextEditor::set_text(StringView const& text, AllowCallback allow_callback) +void TextEditor::set_text(StringView text, AllowCallback allow_callback) { m_selection.clear(); @@ -1378,7 +1378,7 @@ void TextEditor::delete_text_range(TextRange range) update(); } -void TextEditor::insert_at_cursor_or_replace_selection(StringView const& text) +void TextEditor::insert_at_cursor_or_replace_selection(StringView text) { ReflowDeferrer defer(*this); VERIFY(is_editable()); diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index 596e48a65d..2b84abaf3c 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -57,7 +57,7 @@ public: virtual void set_document(TextDocument&); String const& placeholder() const { return m_placeholder; } - void set_placeholder(StringView const& placeholder) { m_placeholder = placeholder; } + void set_placeholder(StringView placeholder) { m_placeholder = placeholder; } TextDocumentLine& current_line() { return line(m_cursor.line()); } TextDocumentLine const& current_line() const { return line(m_cursor.line()); } @@ -108,7 +108,7 @@ public: Function<void()> on_focusin; Function<void()> on_focusout; - void set_text(StringView const&, AllowCallback = AllowCallback::Yes); + void set_text(StringView, AllowCallback = AllowCallback::Yes); void scroll_cursor_into_view(); void scroll_position_into_view(TextPosition const&); size_t line_count() const { return document().line_count(); } @@ -121,7 +121,7 @@ public: TextPosition cursor() const { return m_cursor; } TextRange normalized_selection() const { return m_selection.normalized(); } - void insert_at_cursor_or_replace_selection(StringView const&); + void insert_at_cursor_or_replace_selection(StringView); bool write_to_file(String const& path); bool write_to_file_and_close(int fd); bool has_selection() const { return m_selection.is_valid(); } diff --git a/Userland/Libraries/LibGUI/Variant.cpp b/Userland/Libraries/LibGUI/Variant.cpp index 541ed1a542..1098e0bce0 100644 --- a/Userland/Libraries/LibGUI/Variant.cpp +++ b/Userland/Libraries/LibGUI/Variant.cpp @@ -163,7 +163,7 @@ Variant::Variant(const FlyString& value) { } -Variant::Variant(const StringView& value) +Variant::Variant(StringView value) : Variant(value.to_string()) { } diff --git a/Userland/Libraries/LibGUI/Variant.h b/Userland/Libraries/LibGUI/Variant.h index 3bfb91e39e..501859cd81 100644 --- a/Userland/Libraries/LibGUI/Variant.h +++ b/Userland/Libraries/LibGUI/Variant.h @@ -24,7 +24,7 @@ public: Variant(u32); Variant(u64); Variant(const char*); - Variant(const StringView&); + Variant(StringView); Variant(const String&); Variant(const FlyString&); Variant(const Gfx::Bitmap&); diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 6b9a56f9b3..edc1702fa7 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -1055,7 +1055,7 @@ void Widget::set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr< } } -bool Widget::load_from_gml(const StringView& gml_string) +bool Widget::load_from_gml(StringView gml_string) { return load_from_gml(gml_string, [](const String& class_name) -> RefPtr<Core::Object> { dbgln("Class '{}' not registered", class_name); @@ -1063,7 +1063,7 @@ bool Widget::load_from_gml(const StringView& gml_string) }); } -bool Widget::load_from_gml(const StringView& gml_string, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) +bool Widget::load_from_gml(StringView gml_string, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)) { auto value = parse_gml(gml_string); if (!value.is_object()) diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 40fb9e1b3b..ba27266ce4 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -280,8 +280,8 @@ public: AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> override_cursor() const { return m_override_cursor; } void set_override_cursor(AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>>); - bool load_from_gml(const StringView&); - bool load_from_gml(const StringView&, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)); + bool load_from_gml(StringView); + bool load_from_gml(StringView, RefPtr<Core::Object> (*unregistered_child_handler)(const String&)); void set_shrink_to_fit(bool); bool is_shrink_to_fit() const { return m_shrink_to_fit; } diff --git a/Userland/Libraries/LibGemini/Document.cpp b/Userland/Libraries/LibGemini/Document.cpp index 011c887ad8..623a6b22f7 100644 --- a/Userland/Libraries/LibGemini/Document.cpp +++ b/Userland/Libraries/LibGemini/Document.cpp @@ -28,14 +28,14 @@ String Document::render_to_html() const return html_builder.build(); } -NonnullRefPtr<Document> Document::parse(const StringView& lines, const URL& url) +NonnullRefPtr<Document> Document::parse(StringView lines, const URL& url) { auto document = adopt_ref(*new Document(url)); document->read_lines(lines); return document; } -void Document::read_lines(const StringView& source) +void Document::read_lines(StringView source) { auto close_list_if_needed = [&] { if (m_inside_unordered_list) { diff --git a/Userland/Libraries/LibGemini/Document.h b/Userland/Libraries/LibGemini/Document.h index 07b60fdd1a..cae3ff673f 100644 --- a/Userland/Libraries/LibGemini/Document.h +++ b/Userland/Libraries/LibGemini/Document.h @@ -33,7 +33,7 @@ class Document : public RefCounted<Document> { public: String render_to_html() const; - static NonnullRefPtr<Document> parse(const StringView& source, const URL&); + static NonnullRefPtr<Document> parse(StringView source, const URL&); const URL& url() const { return m_url; }; @@ -43,7 +43,7 @@ private: { } - void read_lines(const StringView&); + void read_lines(StringView); NonnullOwnPtrVector<Line> m_lines; URL m_url; diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h index 8b02f22e8a..c3eebd6a35 100644 --- a/Userland/Libraries/LibGfx/Bitmap.h +++ b/Userland/Libraries/LibGfx/Bitmap.h @@ -97,7 +97,7 @@ public: [[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize const&, int intrinsic_scale, Vector<RGBA32> const& palette); static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_byte_buffer(ByteBuffer&&); - static bool is_path_a_supported_image_format(StringView const& path) + static bool is_path_a_supported_image_format(StringView path) { #define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \ if (path.ends_with(Ext, CaseSensitivity::CaseInsensitive)) \ diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp index b97968b013..46bc5d8219 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/BitmapFont.cpp @@ -316,7 +316,7 @@ int BitmapFont::glyph_or_emoji_width_for_variable_width_font(u32 code_point) con return emoji->size().width(); } -int BitmapFont::width(StringView const& view) const { return unicode_view_width(Utf8View(view)); } +int BitmapFont::width(StringView view) const { return unicode_view_width(Utf8View(view)); } int BitmapFont::width(Utf8View const& view) const { return unicode_view_width(view); } int BitmapFont::width(Utf32View const& view) const { return unicode_view_width(view); } diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h index 73b79b0135..85a636c963 100644 --- a/Userland/Libraries/LibGfx/BitmapFont.h +++ b/Userland/Libraries/LibGfx/BitmapFont.h @@ -74,7 +74,7 @@ public: update_x_height(); } - int width(StringView const&) const override; + int width(StringView) const override; int width(Utf8View const&) const override; int width(Utf32View const&) const override; diff --git a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp index 1d00f703ba..045522398e 100644 --- a/Userland/Libraries/LibGfx/ClassicStylePainter.cpp +++ b/Userland/Libraries/LibGfx/ClassicStylePainter.cpp @@ -306,7 +306,7 @@ void ClassicStylePainter::paint_window_frame(Painter& painter, IntRect const& re painter.draw_line(rect.bottom_left().translated(3, -3), rect.bottom_right().translated(-3, -3), base_color); } -void ClassicStylePainter::paint_progressbar(Painter& painter, IntRect const& rect, Palette const& palette, int min, int max, int value, StringView const& text, Orientation orientation) +void ClassicStylePainter::paint_progressbar(Painter& painter, IntRect const& rect, Palette const& palette, int min, int max, int value, StringView text, Orientation orientation) { // First we fill the entire widget with the gradient. This incurs a bit of // overdraw but ensures a consistent look throughout the progression. diff --git a/Userland/Libraries/LibGfx/ClassicStylePainter.h b/Userland/Libraries/LibGfx/ClassicStylePainter.h index 44200510ae..d8ce836370 100644 --- a/Userland/Libraries/LibGfx/ClassicStylePainter.h +++ b/Userland/Libraries/LibGfx/ClassicStylePainter.h @@ -19,7 +19,7 @@ public: virtual void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, bool top, bool in_active_window) override; virtual void paint_frame(Painter&, IntRect const&, Palette const&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false) override; virtual void paint_window_frame(Painter&, IntRect const&, Palette const&) override; - virtual void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView const& text, Orientation = Orientation::Horizontal) override; + virtual void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView text, Orientation = Orientation::Horizontal) override; virtual void paint_radio_button(Painter&, IntRect const&, Palette const&, bool is_checked, bool is_being_pressed) override; virtual void paint_check_box(Painter&, IntRect const&, Palette const&, bool is_enabled, bool is_checked, bool is_being_pressed) override; virtual void paint_transparency_grid(Painter&, IntRect const&, Palette const&) override; diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp index 185013767d..e3806bfc0f 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.cpp @@ -52,7 +52,7 @@ Gfx::IntRect ClassicWindowTheme::titlebar_text_rect(WindowType window_type, cons }; } -void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, const StringView& window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, [[maybe_unused]] bool window_modified) const +void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, [[maybe_unused]] bool window_modified) const { auto frame_rect = frame_rect_for_window(WindowType::Normal, window_rect, palette, menu_row_count); frame_rect.set_location({ 0, 0 }); @@ -94,7 +94,7 @@ void ClassicWindowTheme::paint_normal_frame(Painter& painter, WindowState window painter.draw_scaled_bitmap(titlebar_icon_rect, icon, icon.rect()); } -void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, const StringView& title_text, const Palette& palette, const IntRect& leftmost_button_rect) const +void ClassicWindowTheme::paint_tool_window_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView title_text, const Palette& palette, const IntRect& leftmost_button_rect) const { auto frame_rect = frame_rect_for_window(WindowType::ToolWindow, window_rect, palette, 0); frame_rect.set_location({ 0, 0 }); diff --git a/Userland/Libraries/LibGfx/ClassicWindowTheme.h b/Userland/Libraries/LibGfx/ClassicWindowTheme.h index 529f9d0fde..0a07e63f1b 100644 --- a/Userland/Libraries/LibGfx/ClassicWindowTheme.h +++ b/Userland/Libraries/LibGfx/ClassicWindowTheme.h @@ -16,8 +16,8 @@ public: ClassicWindowTheme(); virtual ~ClassicWindowTheme() override; - virtual void paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, const StringView& window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const override; - virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Palette&, const IntRect& leftmost_button_rect) const override; + virtual void paint_normal_frame(Painter& painter, WindowState window_state, const IntRect& window_rect, StringView window_title, const Bitmap& icon, const Palette& palette, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const override; + virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Palette&, const IntRect& leftmost_button_rect) const override; virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const override; virtual int titlebar_height(WindowType, const Palette&) const override; diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index aeae569155..92fd42c0b6 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -28,7 +28,7 @@ String Color::to_string_without_alpha() const return String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue()); } -static Optional<Color> parse_rgb_color(StringView const& string) +static Optional<Color> parse_rgb_color(StringView string) { VERIFY(string.starts_with("rgb(", CaseSensitivity::CaseInsensitive)); VERIFY(string.ends_with(")")); @@ -49,7 +49,7 @@ static Optional<Color> parse_rgb_color(StringView const& string) return Color(r, g, b); } -static Optional<Color> parse_rgba_color(StringView const& string) +static Optional<Color> parse_rgba_color(StringView string) { VERIFY(string.starts_with("rgba(", CaseSensitivity::CaseInsensitive)); VERIFY(string.ends_with(")")); @@ -73,7 +73,7 @@ static Optional<Color> parse_rgba_color(StringView const& string) return Color(r, g, b, a); } -Optional<Color> Color::from_string(StringView const& string) +Optional<Color> Color::from_string(StringView string) { if (string.is_empty()) return {}; diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index d8ed58f4f2..1c21741568 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -269,7 +269,7 @@ public: String to_string() const; String to_string_without_alpha() const; - static Optional<Color> from_string(StringView const&); + static Optional<Color> from_string(StringView); constexpr HSV to_hsv() const { diff --git a/Userland/Libraries/LibGfx/CursorParams.cpp b/Userland/Libraries/LibGfx/CursorParams.cpp index 31ae7105ae..8c2b2e43f2 100644 --- a/Userland/Libraries/LibGfx/CursorParams.cpp +++ b/Userland/Libraries/LibGfx/CursorParams.cpp @@ -11,7 +11,7 @@ namespace Gfx { -CursorParams CursorParams::parse_from_filename(StringView const& cursor_path, Gfx::IntPoint const& default_hotspot) +CursorParams CursorParams::parse_from_filename(StringView cursor_path, Gfx::IntPoint const& default_hotspot) { LexicalPath path(cursor_path); auto file_title = path.title(); diff --git a/Userland/Libraries/LibGfx/CursorParams.h b/Userland/Libraries/LibGfx/CursorParams.h index d3bbd07945..7a69aa2f64 100644 --- a/Userland/Libraries/LibGfx/CursorParams.h +++ b/Userland/Libraries/LibGfx/CursorParams.h @@ -13,7 +13,7 @@ namespace Gfx { class CursorParams { public: - static CursorParams parse_from_filename(StringView const&, Gfx::IntPoint const&); + static CursorParams parse_from_filename(StringView, Gfx::IntPoint const&); CursorParams() = default; diff --git a/Userland/Libraries/LibGfx/Font.h b/Userland/Libraries/LibGfx/Font.h index fb680685a8..af576ec704 100644 --- a/Userland/Libraries/LibGfx/Font.h +++ b/Userland/Libraries/LibGfx/Font.h @@ -113,7 +113,7 @@ public: virtual u8 baseline() const = 0; virtual u8 mean_line() const = 0; - virtual int width(const StringView&) const = 0; + virtual int width(StringView) const = 0; virtual int width(const Utf8View&) const = 0; virtual int width(const Utf32View&) const = 0; diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp index 70e379390a..e2e5397541 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.cpp +++ b/Userland/Libraries/LibGfx/FontDatabase.cpp @@ -136,7 +136,7 @@ void FontDatabase::for_each_fixed_width_font(Function<void(const Gfx::Font&)> ca callback(*font); } -RefPtr<Gfx::Font> FontDatabase::get_by_name(const StringView& name) +RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name) { auto it = m_private->full_name_to_font_map.find(name); if (it == m_private->full_name_to_font_map.end()) { diff --git a/Userland/Libraries/LibGfx/FontDatabase.h b/Userland/Libraries/LibGfx/FontDatabase.h index 4f75ee5c88..35c98bfb08 100644 --- a/Userland/Libraries/LibGfx/FontDatabase.h +++ b/Userland/Libraries/LibGfx/FontDatabase.h @@ -44,7 +44,7 @@ public: RefPtr<Gfx::Font> get(const String& family, unsigned size, unsigned weight); RefPtr<Gfx::Font> get(const String& family, const String& variant, unsigned size); - RefPtr<Gfx::Font> get_by_name(const StringView&); + RefPtr<Gfx::Font> get_by_name(StringView); void for_each_font(Function<void(const Gfx::Font&)>); void for_each_fixed_width_font(Function<void(const Gfx::Font&)>); diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index 1855f084e2..dd4890c01c 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -91,7 +91,7 @@ struct ICOLoadingContext { size_t largest_index; }; -RefPtr<Gfx::Bitmap> load_ico(const StringView& path) +RefPtr<Gfx::Bitmap> load_ico(StringView path) { auto file_or_error = MappedFile::map(path); if (file_or_error.is_error()) diff --git a/Userland/Libraries/LibGfx/ICOLoader.h b/Userland/Libraries/LibGfx/ICOLoader.h index 3c0fd8ba3f..eb2b948c70 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.h +++ b/Userland/Libraries/LibGfx/ICOLoader.h @@ -12,7 +12,7 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_ico(const StringView& path); +RefPtr<Gfx::Bitmap> load_ico(StringView path); RefPtr<Gfx::Bitmap> load_ico_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct ICOLoadingContext; diff --git a/Userland/Libraries/LibGfx/PBMLoader.cpp b/Userland/Libraries/LibGfx/PBMLoader.cpp index a90cd05c80..8373a076e9 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.cpp +++ b/Userland/Libraries/LibGfx/PBMLoader.cpp @@ -97,7 +97,7 @@ static bool read_image_data(PBMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_pbm(const StringView& path) +RefPtr<Gfx::Bitmap> load_pbm(StringView path) { return load<PBMLoadingContext>(path); } diff --git a/Userland/Libraries/LibGfx/PBMLoader.h b/Userland/Libraries/LibGfx/PBMLoader.h index 1c022f9e45..7520823b4d 100644 --- a/Userland/Libraries/LibGfx/PBMLoader.h +++ b/Userland/Libraries/LibGfx/PBMLoader.h @@ -12,7 +12,7 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_pbm(const StringView& path); +RefPtr<Gfx::Bitmap> load_pbm(StringView path); RefPtr<Gfx::Bitmap> load_pbm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PBMLoadingContext; diff --git a/Userland/Libraries/LibGfx/PGMLoader.cpp b/Userland/Libraries/LibGfx/PGMLoader.cpp index be2aad4821..eb04c31139 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.cpp +++ b/Userland/Libraries/LibGfx/PGMLoader.cpp @@ -99,7 +99,7 @@ static bool read_image_data(PGMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_pgm(const StringView& path) +RefPtr<Gfx::Bitmap> load_pgm(StringView path) { return load<PGMLoadingContext>(path); } diff --git a/Userland/Libraries/LibGfx/PGMLoader.h b/Userland/Libraries/LibGfx/PGMLoader.h index dab535e3be..a64259a66a 100644 --- a/Userland/Libraries/LibGfx/PGMLoader.h +++ b/Userland/Libraries/LibGfx/PGMLoader.h @@ -12,7 +12,7 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_pgm(const StringView& path); +RefPtr<Gfx::Bitmap> load_pgm(StringView path); RefPtr<Gfx::Bitmap> load_pgm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PGMLoadingContext; diff --git a/Userland/Libraries/LibGfx/PPMLoader.cpp b/Userland/Libraries/LibGfx/PPMLoader.cpp index 0d8112a0ae..dc4c0fbdce 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.cpp +++ b/Userland/Libraries/LibGfx/PPMLoader.cpp @@ -101,7 +101,7 @@ static bool read_image_data(PPMLoadingContext& context, Streamer& streamer) return true; } -RefPtr<Gfx::Bitmap> load_ppm(const StringView& path) +RefPtr<Gfx::Bitmap> load_ppm(StringView path) { return load<PPMLoadingContext>(path); } diff --git a/Userland/Libraries/LibGfx/PPMLoader.h b/Userland/Libraries/LibGfx/PPMLoader.h index 5668cfc8f1..82824a7d8f 100644 --- a/Userland/Libraries/LibGfx/PPMLoader.h +++ b/Userland/Libraries/LibGfx/PPMLoader.h @@ -12,7 +12,7 @@ namespace Gfx { -RefPtr<Gfx::Bitmap> load_ppm(const StringView& path); +RefPtr<Gfx::Bitmap> load_ppm(StringView path); RefPtr<Gfx::Bitmap> load_ppm_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>"); struct PPMLoadingContext; diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 868e42748f..1ade80691d 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -1548,7 +1548,7 @@ void Painter::do_draw_text(IntRect const& rect, Utf8View const& text, Font const } } -void Painter::draw_text(IntRect const& rect, StringView const& text, TextAlignment alignment, Color color, TextElision elision, TextWrapping wrapping) +void Painter::draw_text(IntRect const& rect, StringView text, TextAlignment alignment, Color color, TextElision elision, TextWrapping wrapping) { draw_text(rect, text, font(), alignment, color, elision, wrapping); } @@ -1558,7 +1558,7 @@ void Painter::draw_text(IntRect const& rect, Utf32View const& text, TextAlignmen draw_text(rect, text, font(), alignment, color, elision, wrapping); } -void Painter::draw_text(IntRect const& rect, StringView const& raw_text, Font const& font, TextAlignment alignment, Color color, TextElision elision, TextWrapping wrapping) +void Painter::draw_text(IntRect const& rect, StringView raw_text, Font const& font, TextAlignment alignment, Color color, TextElision elision, TextWrapping wrapping) { Utf8View text { raw_text }; do_draw_text(rect, text, font, alignment, elision, wrapping, [&](IntRect const& r, u32 code_point) { @@ -1587,7 +1587,7 @@ void Painter::draw_text(Function<void(IntRect const&, u32)> draw_one_glyph, IntR }); } -void Painter::draw_text(Function<void(IntRect const&, u32)> draw_one_glyph, IntRect const& rect, StringView const& raw_text, Font const& font, TextAlignment alignment, TextElision elision, TextWrapping wrapping) +void Painter::draw_text(Function<void(IntRect const&, u32)> draw_one_glyph, IntRect const& rect, StringView raw_text, Font const& font, TextAlignment alignment, TextElision elision, TextWrapping wrapping) { VERIFY(scale() == 1); // FIXME: Add scaling support. @@ -2143,7 +2143,7 @@ void Painter::blit_tiled(IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Int } } -String parse_ampersand_string(StringView const& raw_text, Optional<size_t>* underline_offset) +String parse_ampersand_string(StringView raw_text, Optional<size_t>* underline_offset) { if (raw_text.is_empty()) return String::empty(); @@ -2165,7 +2165,7 @@ String parse_ampersand_string(StringView const& raw_text, Optional<size_t>* unde return builder.to_string(); } -void Gfx::Painter::draw_ui_text(Gfx::IntRect const& rect, StringView const& text, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::Color color) +void Gfx::Painter::draw_ui_text(Gfx::IntRect const& rect, StringView text, Gfx::Font const& font, Gfx::TextAlignment text_alignment, Gfx::Color color) { Optional<size_t> underline_offset; auto name_to_draw = parse_ampersand_string(text, &underline_offset); diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h index 56b0cc9a58..1f26afeab2 100644 --- a/Userland/Libraries/LibGfx/Painter.h +++ b/Userland/Libraries/LibGfx/Painter.h @@ -69,14 +69,14 @@ public: void blit_offset(IntPoint const&, Gfx::Bitmap const&, IntRect const& src_rect, IntPoint const&); void blit_disabled(IntPoint const&, Gfx::Bitmap const&, IntRect const&, Palette const&); void blit_tiled(IntRect const&, Gfx::Bitmap const&, IntRect const& src_rect); - void draw_text(IntRect const&, StringView const&, Font const&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); - void draw_text(IntRect const&, StringView const&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); + void draw_text(IntRect const&, StringView, Font const&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); + void draw_text(IntRect const&, StringView, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); void draw_text(IntRect const&, Utf32View const&, Font const&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); void draw_text(IntRect const&, Utf32View const&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); - void draw_text(Function<void(IntRect const&, u32)>, IntRect const&, StringView const&, Font const&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); + void draw_text(Function<void(IntRect const&, u32)>, IntRect const&, StringView, Font const&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); void draw_text(Function<void(IntRect const&, u32)>, IntRect const&, Utf8View const&, Font const&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); void draw_text(Function<void(IntRect const&, u32)>, IntRect const&, Utf32View const&, Font const&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None, TextWrapping = TextWrapping::DontWrap); - void draw_ui_text(Gfx::IntRect const&, StringView const&, Gfx::Font const&, TextAlignment, Gfx::Color); + void draw_ui_text(Gfx::IntRect const&, StringView, Gfx::Font const&, TextAlignment, Gfx::Color); void draw_glyph(IntPoint const&, u32, Color); void draw_glyph(IntPoint const&, u32, Font const&, Color); void draw_emoji(IntPoint const&, Gfx::Bitmap const&, Font const&); @@ -180,6 +180,6 @@ private: Painter& m_painter; }; -String parse_ampersand_string(StringView const&, Optional<size_t>* underline_offset = nullptr); +String parse_ampersand_string(StringView, Optional<size_t>* underline_offset = nullptr); } diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h index 61882b6b05..fd901be4ac 100644 --- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h +++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h @@ -273,7 +273,7 @@ static RefPtr<Gfx::Bitmap> load_from_memory(u8 const* data, size_t length, Strin } template<typename TContext> -static RefPtr<Gfx::Bitmap> load(const StringView& path) +static RefPtr<Gfx::Bitmap> load(StringView path) { auto file_or_error = MappedFile::map(path); if (file_or_error.is_error()) diff --git a/Userland/Libraries/LibGfx/StylePainter.cpp b/Userland/Libraries/LibGfx/StylePainter.cpp index 09cf31b12b..affe70540b 100644 --- a/Userland/Libraries/LibGfx/StylePainter.cpp +++ b/Userland/Libraries/LibGfx/StylePainter.cpp @@ -38,7 +38,7 @@ void StylePainter::paint_window_frame(Painter& painter, const IntRect& rect, con current().paint_window_frame(painter, rect, palette); } -void StylePainter::paint_progressbar(Painter& painter, const IntRect& rect, const Palette& palette, int min, int max, int value, const StringView& text, Orientation orientation) +void StylePainter::paint_progressbar(Painter& painter, const IntRect& rect, const Palette& palette, int min, int max, int value, StringView text, Orientation orientation) { current().paint_progressbar(painter, rect, palette, min, max, value, text, orientation); } diff --git a/Userland/Libraries/LibGfx/StylePainter.h b/Userland/Libraries/LibGfx/StylePainter.h index 7eb47c0526..c3d3d34ad8 100644 --- a/Userland/Libraries/LibGfx/StylePainter.h +++ b/Userland/Libraries/LibGfx/StylePainter.h @@ -41,7 +41,7 @@ public: virtual void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, bool top, bool in_active_window) = 0; virtual void paint_frame(Painter&, IntRect const&, Palette const&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false) = 0; virtual void paint_window_frame(Painter&, IntRect const&, Palette const&) = 0; - virtual void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView const& text, Orientation = Orientation::Horizontal) = 0; + virtual void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView text, Orientation = Orientation::Horizontal) = 0; virtual void paint_radio_button(Painter&, IntRect const&, Palette const&, bool is_checked, bool is_being_pressed) = 0; virtual void paint_check_box(Painter&, IntRect const&, Palette const&, bool is_enabled, bool is_checked, bool is_being_pressed) = 0; virtual void paint_transparency_grid(Painter&, IntRect const&, Palette const&) = 0; @@ -60,7 +60,7 @@ public: static void paint_tab_button(Painter&, IntRect const&, Palette const&, bool active, bool hovered, bool enabled, bool top, bool in_active_window); static void paint_frame(Painter&, IntRect const&, Palette const&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false); static void paint_window_frame(Painter&, IntRect const&, Palette const&); - static void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView const& text, Orientation = Orientation::Horizontal); + static void paint_progressbar(Painter&, IntRect const&, Palette const&, int min, int max, int value, StringView text, Orientation = Orientation::Horizontal); static void paint_radio_button(Painter&, IntRect const&, Palette const&, bool is_checked, bool is_being_pressed); static void paint_check_box(Painter&, IntRect const&, Palette const&, bool is_enabled, bool is_checked, bool is_being_pressed); static void paint_transparency_grid(Painter&, IntRect const&, Palette const&); diff --git a/Userland/Libraries/LibGfx/TextAlignment.h b/Userland/Libraries/LibGfx/TextAlignment.h index 1b199eaecc..b3c9e84171 100644 --- a/Userland/Libraries/LibGfx/TextAlignment.h +++ b/Userland/Libraries/LibGfx/TextAlignment.h @@ -50,7 +50,7 @@ inline bool is_vertically_centered_text_alignment(TextAlignment alignment) } } -inline Optional<TextAlignment> text_alignment_from_string(const StringView& string) +inline Optional<TextAlignment> text_alignment_from_string(StringView string) { #define __ENUMERATE(x) \ if (string == #x) \ diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp index 9636371d49..38356bc0a9 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp @@ -477,7 +477,7 @@ bool Font::is_fixed_width() const return glyph_metrics(glyph_id_for_code_point('.'), 1, 1).advance_width == glyph_metrics(glyph_id_for_code_point('X'), 1, 1).advance_width; } -int ScaledFont::width(StringView const& view) const { return unicode_view_width(Utf8View(view)); } +int ScaledFont::width(StringView view) const { return unicode_view_width(Utf8View(view)); } int ScaledFont::width(Utf8View const& view) const { return unicode_view_width(view); } int ScaledFont::width(Utf32View const& view) const { return unicode_view_width(view); } diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Font.h b/Userland/Libraries/LibGfx/TrueTypeFont/Font.h index c22176a95e..a5cb528d04 100644 --- a/Userland/Libraries/LibGfx/TrueTypeFont/Font.h +++ b/Userland/Libraries/LibGfx/TrueTypeFont/Font.h @@ -134,7 +134,7 @@ public: virtual u8 glyph_fixed_width() const override; virtual u8 baseline() const override { return m_point_height; } // FIXME: Read from font virtual u8 mean_line() const override { return m_point_height; } // FIXME: Read from font - virtual int width(StringView const&) const override; + virtual int width(StringView) const override; virtual int width(Utf8View const&) const override; virtual int width(Utf32View const&) const override; virtual String name() const override { return String::formatted("{} {}", family(), variant()); } diff --git a/Userland/Libraries/LibGfx/WindowTheme.h b/Userland/Libraries/LibGfx/WindowTheme.h index 5f7cb652ba..29bf0049a8 100644 --- a/Userland/Libraries/LibGfx/WindowTheme.h +++ b/Userland/Libraries/LibGfx/WindowTheme.h @@ -31,8 +31,8 @@ public: static WindowTheme& current(); - virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const = 0; - virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, const StringView& title, const Palette&, const IntRect& leftmost_button_rect) const = 0; + virtual void paint_normal_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Bitmap& icon, const Palette&, const IntRect& leftmost_button_rect, int menu_row_count, bool window_modified) const = 0; + virtual void paint_tool_window_frame(Painter&, WindowState, const IntRect& window_rect, StringView title, const Palette&, const IntRect& leftmost_button_rect) const = 0; virtual void paint_notification_frame(Painter&, const IntRect& window_rect, const Palette&, const IntRect& close_button_rect) const = 0; virtual int titlebar_height(WindowType, const Palette&) const = 0; diff --git a/Userland/Libraries/LibIMAP/QuotedPrintable.cpp b/Userland/Libraries/LibIMAP/QuotedPrintable.cpp index 01c81c7383..901a59f000 100644 --- a/Userland/Libraries/LibIMAP/QuotedPrintable.cpp +++ b/Userland/Libraries/LibIMAP/QuotedPrintable.cpp @@ -17,7 +17,7 @@ static constexpr bool is_illegal_character(char c) } // RFC 2045 Section 6.7 "Quoted-Printable Content-Transfer-Encoding", https://datatracker.ietf.org/doc/html/rfc2045#section-6.7 -ByteBuffer decode_quoted_printable(StringView const& input) +ByteBuffer decode_quoted_printable(StringView input) { GenericLexer lexer(input); StringBuilder output; diff --git a/Userland/Libraries/LibIMAP/QuotedPrintable.h b/Userland/Libraries/LibIMAP/QuotedPrintable.h index 8b127b3783..ac6508deca 100644 --- a/Userland/Libraries/LibIMAP/QuotedPrintable.h +++ b/Userland/Libraries/LibIMAP/QuotedPrintable.h @@ -10,6 +10,6 @@ namespace IMAP { -ByteBuffer decode_quoted_printable(StringView const&); +ByteBuffer decode_quoted_printable(StringView); } diff --git a/Userland/Libraries/LibIPC/Encoder.cpp b/Userland/Libraries/LibIPC/Encoder.cpp index 31538e6c43..0fcb0d9516 100644 --- a/Userland/Libraries/LibIPC/Encoder.cpp +++ b/Userland/Libraries/LibIPC/Encoder.cpp @@ -115,7 +115,7 @@ Encoder& Encoder::operator<<(char const* value) return *this << StringView(value); } -Encoder& Encoder::operator<<(StringView const& value) +Encoder& Encoder::operator<<(StringView value) { m_buffer.data.append((u8 const*)value.characters_without_null_termination(), value.length()); return *this; diff --git a/Userland/Libraries/LibIPC/Encoder.h b/Userland/Libraries/LibIPC/Encoder.h index aea7637b34..5a10b55192 100644 --- a/Userland/Libraries/LibIPC/Encoder.h +++ b/Userland/Libraries/LibIPC/Encoder.h @@ -39,7 +39,7 @@ public: Encoder& operator<<(float); Encoder& operator<<(double); Encoder& operator<<(char const*); - Encoder& operator<<(StringView const&); + Encoder& operator<<(StringView); Encoder& operator<<(String const&); Encoder& operator<<(ByteBuffer const&); Encoder& operator<<(URL const&); diff --git a/Userland/Libraries/LibIPC/ServerConnection.h b/Userland/Libraries/LibIPC/ServerConnection.h index fcdf247173..3d6b78dba8 100644 --- a/Userland/Libraries/LibIPC/ServerConnection.h +++ b/Userland/Libraries/LibIPC/ServerConnection.h @@ -18,7 +18,7 @@ public: using ClientStub = typename ClientEndpoint::Stub; using IPCProxy = typename ServerEndpoint::template Proxy<ClientEndpoint>; - ServerConnection(ClientStub& local_endpoint, const StringView& address) + ServerConnection(ClientStub& local_endpoint, StringView address) : Connection<ClientEndpoint, ServerEndpoint>(local_endpoint, Core::LocalSocket::construct()) , ServerEndpoint::template Proxy<ClientEndpoint>(*this, {}) { diff --git a/Userland/Libraries/LibJS/Lexer.h b/Userland/Libraries/LibJS/Lexer.h index ee151a5753..6f5e3cbdb5 100644 --- a/Userland/Libraries/LibJS/Lexer.h +++ b/Userland/Libraries/LibJS/Lexer.h @@ -20,8 +20,8 @@ public: Token next(); - const StringView& source() const { return m_source; }; - const StringView& filename() const { return m_filename; }; + StringView source() const { return m_source; }; + StringView filename() const { return m_filename; }; void disallow_html_comments() { m_allow_html_comments = false; }; diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index ff82823b00..616de9a860 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -17,7 +17,7 @@ namespace JS { -String MarkupGenerator::html_from_source(const StringView& source) +String MarkupGenerator::html_from_source(StringView source) { StringBuilder builder; auto lexer = Lexer(source); diff --git a/Userland/Libraries/LibJS/MarkupGenerator.h b/Userland/Libraries/LibJS/MarkupGenerator.h index a6070c15b5..97940d64cb 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.h +++ b/Userland/Libraries/LibJS/MarkupGenerator.h @@ -14,7 +14,7 @@ namespace JS { class MarkupGenerator { public: - static String html_from_source(const StringView&); + static String html_from_source(StringView); static String html_from_value(Value); static String html_from_error(Object&); diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index 80c47e7fa6..fbe1312cc2 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -609,7 +609,7 @@ static constexpr AK::Array<StringView, 9> strict_reserved_words = { "implements" static bool is_strict_reserved_word(StringView str) { - return any_of(strict_reserved_words, [&str](StringView const& word) { + return any_of(strict_reserved_words, [&str](StringView word) { return word == str; }); } @@ -3575,7 +3575,7 @@ Token Parser::consume(TokenType expected_type) Token Parser::consume_and_validate_numeric_literal() { - auto is_unprefixed_octal_number = [](const StringView& value) { + auto is_unprefixed_octal_number = [](StringView value) { return value.length() > 1 && value[0] == '0' && is_ascii_digit(value[1]); }; auto literal_start = position(); diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h index 42c52ea939..b40649306b 100644 --- a/Userland/Libraries/LibJS/Parser.h +++ b/Userland/Libraries/LibJS/Parser.h @@ -130,7 +130,7 @@ public: return String::formatted("{} (line: {}, column: {})", message, position.value().line, position.value().column); } - String source_location_hint(const StringView& source, const char spacer = ' ', const char indicator = '^') const + String source_location_hint(StringView source, const char spacer = ' ', const char indicator = '^') const { if (!position.has_value()) return {}; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp index 5e14a77690..119bfe86ff 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp @@ -266,7 +266,7 @@ ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject& global_ } // 9.2.2 BestAvailableLocale ( availableLocales, locale ), https://tc39.es/ecma402/#sec-bestavailablelocale -Optional<String> best_available_locale(StringView const& locale) +Optional<String> best_available_locale(StringView locale) { // 1. Let candidate be locale. StringView candidate = locale; diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h index 16e5391053..a2f15493ab 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.h @@ -39,7 +39,7 @@ String canonicalize_unicode_locale_id(Unicode::LocaleID& locale); bool is_well_formed_currency_code(StringView currency); bool is_well_formed_unit_identifier(StringView unit_identifier); ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject&, Value locales); -Optional<String> best_available_locale(StringView const& locale); +Optional<String> best_available_locale(StringView locale); String insert_unicode_extension_and_canonicalize(Unicode::LocaleID locale_id, Unicode::LocaleExtension extension); LocaleResult resolve_locale(Vector<String> const& requested_locales, LocaleOptions const& options, Vector<StringView> const& relevant_extension_keys); Vector<String> lookup_supported_locales(Vector<String> const& requested_locales); diff --git a/Userland/Libraries/LibJS/Runtime/Utf16String.cpp b/Userland/Libraries/LibJS/Runtime/Utf16String.cpp index e5ad11e822..c1d98c1b5f 100644 --- a/Userland/Libraries/LibJS/Runtime/Utf16String.cpp +++ b/Userland/Libraries/LibJS/Runtime/Utf16String.cpp @@ -32,7 +32,7 @@ NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(Vector<u16, 1> string) return adopt_ref(*new Utf16StringImpl(move(string))); } -NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(StringView const& string) +NonnullRefPtr<Utf16StringImpl> Utf16StringImpl::create(StringView string) { return create(AK::utf8_to_utf16(string)); } @@ -67,7 +67,7 @@ Utf16String::Utf16String(Vector<u16, 1> string) { } -Utf16String::Utf16String(StringView const& string) +Utf16String::Utf16String(StringView string) : m_string(Detail::Utf16StringImpl::create(move(string))) { } diff --git a/Userland/Libraries/LibJS/Runtime/Utf16String.h b/Userland/Libraries/LibJS/Runtime/Utf16String.h index e38e5b4592..84d3afc364 100644 --- a/Userland/Libraries/LibJS/Runtime/Utf16String.h +++ b/Userland/Libraries/LibJS/Runtime/Utf16String.h @@ -21,7 +21,7 @@ public: static NonnullRefPtr<Utf16StringImpl> create(); static NonnullRefPtr<Utf16StringImpl> create(Vector<u16, 1>); - static NonnullRefPtr<Utf16StringImpl> create(StringView const&); + static NonnullRefPtr<Utf16StringImpl> create(StringView); static NonnullRefPtr<Utf16StringImpl> create(Utf16View const&); Vector<u16, 1> const& string() const; @@ -40,7 +40,7 @@ class Utf16String { public: Utf16String(); explicit Utf16String(Vector<u16, 1>); - explicit Utf16String(StringView const&); + explicit Utf16String(StringView); explicit Utf16String(Utf16View const&); Vector<u16, 1> const& string() const; diff --git a/Userland/Libraries/LibJS/Token.h b/Userland/Libraries/LibJS/Token.h index 36c2e048e8..cbdfda602f 100644 --- a/Userland/Libraries/LibJS/Token.h +++ b/Userland/Libraries/LibJS/Token.h @@ -201,16 +201,16 @@ public: static const char* name(TokenType); const String& message() const { return m_message; } - const StringView& trivia() const { return m_trivia; } - const StringView& original_value() const { return m_original_value; } + StringView trivia() const { return m_trivia; } + StringView original_value() const { return m_original_value; } StringView value() const { return m_value.visit( - [](StringView const& view) { return view; }, + [](StringView view) { return view; }, [](FlyString const& identifier) { return identifier.view(); }, [](Empty) -> StringView { VERIFY_NOT_REACHED(); }); } - const StringView& filename() const { return m_filename; } + StringView filename() const { return m_filename; } size_t line_number() const { return m_line_number; } size_t line_column() const { return m_line_column; } size_t offset() const { return m_offset; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index 1969aed99a..8d3bf9a331 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -36,7 +36,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; } namespace Line { -Configuration Configuration::from_config(const StringView& libname) +Configuration Configuration::from_config(StringView libname) { Configuration configuration; auto config_file = Core::ConfigFile::open_for_lib(libname); @@ -359,7 +359,7 @@ void Editor::insert(const String& string) insert(ch); } -void Editor::insert(const StringView& string_view) +void Editor::insert(StringView string_view) { for (auto ch : Utf8View { string_view }) insert(ch); @@ -1190,7 +1190,7 @@ void Editor::cleanup_suggestions() m_times_tab_pressed = 0; // Safe to say if we get here, the user didn't press TAB } -bool Editor::search(const StringView& phrase, bool allow_empty, bool from_beginning) +bool Editor::search(StringView phrase, bool allow_empty, bool from_beginning) { int last_matching_offset = -1; bool found = false; @@ -1690,7 +1690,7 @@ void VT::clear_to_end_of_line(OutputStream& stream) stream.write("\033[K"sv.bytes()); } -StringMetrics Editor::actual_rendered_string_metrics(const StringView& string) +StringMetrics Editor::actual_rendered_string_metrics(StringView string) { StringMetrics metrics; StringMetrics::LineMetrics current_line; diff --git a/Userland/Libraries/LibLine/Editor.h b/Userland/Libraries/LibLine/Editor.h index c4aa22fab7..ee7e237722 100644 --- a/Userland/Libraries/LibLine/Editor.h +++ b/Userland/Libraries/LibLine/Editor.h @@ -90,7 +90,7 @@ struct Configuration { enable_bracketed_paste = flags & Flags::BracketedPaste; } - static Configuration from_config(const StringView& libname = "line"); + static Configuration from_config(StringView libname = "line"); RefreshBehavior refresh_behavior { RefreshBehavior::Lazy }; SignalHandler m_signal_mode { SignalHandler::WithSignalHandlers }; @@ -159,14 +159,14 @@ public: void register_key_input_callback(Vector<Key> keys, Function<bool(Editor&)> callback) { m_callback_machine.register_key_input_callback(move(keys), move(callback)); } void register_key_input_callback(Key key, Function<bool(Editor&)> callback) { register_key_input_callback(Vector<Key> { key }, move(callback)); } - static StringMetrics actual_rendered_string_metrics(const StringView&); + static StringMetrics actual_rendered_string_metrics(StringView); static StringMetrics actual_rendered_string_metrics(const Utf32View&); Function<Vector<CompletionSuggestion>(const Editor&)> on_tab_complete; Function<void()> on_interrupt_handled; Function<void(Editor&)> on_display_refresh; - static Function<bool(Editor&)> find_internal_function(const StringView& name); + static Function<bool(Editor&)> find_internal_function(StringView name); enum class CaseChangeOp { Lowercase, Uppercase, @@ -207,7 +207,7 @@ public: void clear_line(); void insert(const String&); - void insert(const StringView&); + void insert(StringView); void insert(const Utf32View&); void insert(const u32); void stylize(const Span&, const Style&); @@ -282,7 +282,7 @@ private: Style find_applicable_style(size_t offset) const; - bool search(const StringView&, bool allow_empty = false, bool from_beginning = true); + bool search(StringView, bool allow_empty = false, bool from_beginning = true); inline void end_search() { m_is_searching = false; diff --git a/Userland/Libraries/LibLine/InternalFunctions.cpp b/Userland/Libraries/LibLine/InternalFunctions.cpp index 3eb981464e..00c39badeb 100644 --- a/Userland/Libraries/LibLine/InternalFunctions.cpp +++ b/Userland/Libraries/LibLine/InternalFunctions.cpp @@ -22,7 +22,7 @@ constexpr u32 ctrl(char c) { return c & 0x3f; } namespace Line { -Function<bool(Editor&)> Editor::find_internal_function(const StringView& name) +Function<bool(Editor&)> Editor::find_internal_function(StringView name) { #define __ENUMERATE(internal_name) \ if (name == #internal_name) \ diff --git a/Userland/Libraries/LibLine/Style.h b/Userland/Libraries/LibLine/Style.h index 1fc113eb52..d5099e46fd 100644 --- a/Userland/Libraries/LibLine/Style.h +++ b/Userland/Libraries/LibLine/Style.h @@ -90,7 +90,7 @@ public: struct Hyperlink { bool operator==(const Hyperlink&) const = default; - explicit Hyperlink(const StringView& link) + explicit Hyperlink(StringView link) : m_link(link) { m_has_link = true; diff --git a/Userland/Libraries/LibLine/SuggestionManager.cpp b/Userland/Libraries/LibLine/SuggestionManager.cpp index 6f0d5a5b57..89d51c5101 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.cpp +++ b/Userland/Libraries/LibLine/SuggestionManager.cpp @@ -9,7 +9,7 @@ namespace Line { -CompletionSuggestion::CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style) +CompletionSuggestion::CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style) : style(style) , text_string(completion) , is_valid(true) diff --git a/Userland/Libraries/LibLine/SuggestionManager.h b/Userland/Libraries/LibLine/SuggestionManager.h index d9ef339e77..89fa9dafe0 100644 --- a/Userland/Libraries/LibLine/SuggestionManager.h +++ b/Userland/Libraries/LibLine/SuggestionManager.h @@ -36,12 +36,12 @@ public: { } - CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia) + CompletionSuggestion(StringView completion, StringView trailing_trivia) : CompletionSuggestion(completion, trailing_trivia, {}) { } - CompletionSuggestion(const StringView& completion, const StringView& trailing_trivia, Style style); + CompletionSuggestion(StringView completion, StringView trailing_trivia, Style style); bool operator==(const CompletionSuggestion& suggestion) const { diff --git a/Userland/Libraries/LibMarkdown/Document.cpp b/Userland/Libraries/LibMarkdown/Document.cpp index ee53bf9686..2d00188ee2 100644 --- a/Userland/Libraries/LibMarkdown/Document.cpp +++ b/Userland/Libraries/LibMarkdown/Document.cpp @@ -51,7 +51,7 @@ RecursionDecision Document::walk(Visitor& visitor) const return m_container->walk(visitor); } -OwnPtr<Document> Document::parse(const StringView& str) +OwnPtr<Document> Document::parse(StringView str) { const Vector<StringView> lines_vec = str.lines(); LineIterator lines(lines_vec.begin()); diff --git a/Userland/Libraries/LibMarkdown/Document.h b/Userland/Libraries/LibMarkdown/Document.h index db3e0fc0d6..1f1ee4b247 100644 --- a/Userland/Libraries/LibMarkdown/Document.h +++ b/Userland/Libraries/LibMarkdown/Document.h @@ -34,7 +34,7 @@ public: */ RecursionDecision walk(Visitor&) const; - static OwnPtr<Document> parse(const StringView&); + static OwnPtr<Document> parse(StringView); private: OwnPtr<ContainerBlock> m_container; diff --git a/Userland/Libraries/LibMarkdown/Heading.cpp b/Userland/Libraries/LibMarkdown/Heading.cpp index 1dd321f8e5..21dff3f039 100644 --- a/Userland/Libraries/LibMarkdown/Heading.cpp +++ b/Userland/Libraries/LibMarkdown/Heading.cpp @@ -50,7 +50,7 @@ OwnPtr<Heading> Heading::parse(LineIterator& lines) if (lines.is_end()) return {}; - const StringView& line = *lines; + StringView line = *lines; size_t level; for (level = 0; level < line.length(); level++) { diff --git a/Userland/Libraries/LibMarkdown/HorizontalRule.cpp b/Userland/Libraries/LibMarkdown/HorizontalRule.cpp index 2e696143ed..d18a9a489a 100644 --- a/Userland/Libraries/LibMarkdown/HorizontalRule.cpp +++ b/Userland/Libraries/LibMarkdown/HorizontalRule.cpp @@ -39,7 +39,7 @@ OwnPtr<HorizontalRule> HorizontalRule::parse(LineIterator& lines) if (lines.is_end()) return {}; - const StringView& line = *lines; + StringView line = *lines; if (line.length() < 3) return {}; diff --git a/Userland/Libraries/LibMarkdown/LineIterator.cpp b/Userland/Libraries/LibMarkdown/LineIterator.cpp index ec77ca1642..7366716e72 100644 --- a/Userland/Libraries/LibMarkdown/LineIterator.cpp +++ b/Userland/Libraries/LibMarkdown/LineIterator.cpp @@ -16,7 +16,7 @@ void LineIterator::reset_ignore_prefix() } } -Optional<StringView> LineIterator::match_context(StringView const& line) const +Optional<StringView> LineIterator::match_context(StringView line) const { bool is_ws = line.is_whitespace(); size_t offset = 0; diff --git a/Userland/Libraries/LibMarkdown/LineIterator.h b/Userland/Libraries/LibMarkdown/LineIterator.h index 8109e1d8e4..6fdbfd6922 100644 --- a/Userland/Libraries/LibMarkdown/LineIterator.h +++ b/Userland/Libraries/LibMarkdown/LineIterator.h @@ -91,7 +91,7 @@ public: private: void reset_ignore_prefix(); - Optional<StringView> match_context(StringView const& line) const; + Optional<StringView> match_context(StringView line) const; Vector<StringView>::ConstIterator m_iterator; Vector<Context> m_context_stack; diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp index 187a5e5c11..0943234cc6 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -85,7 +85,7 @@ OwnPtr<List> List::parse(LineIterator& lines) size_t offset = 0; - const StringView& line = *lines; + StringView line = *lines; bool appears_unordered = false; diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp index 94a4456699..faae1d4353 100644 --- a/Userland/Libraries/LibMarkdown/Text.cpp +++ b/Userland/Libraries/LibMarkdown/Text.cpp @@ -251,7 +251,7 @@ RecursionDecision Text::walk(Visitor& visitor) const return m_node->walk(visitor); } -Text Text::parse(StringView const& str) +Text Text::parse(StringView str) { Text text; auto const tokens = tokenize(str); @@ -260,7 +260,7 @@ Text Text::parse(StringView const& str) return text; } -static bool flanking(StringView const& str, size_t start, size_t end, int dir) +static bool flanking(StringView str, size_t start, size_t end, int dir) { ssize_t next = ((dir > 0) ? end : start) + dir; if (next < 0 || next >= (ssize_t)str.length()) @@ -279,7 +279,7 @@ static bool flanking(StringView const& str, size_t start, size_t end, int dir) return isspace(str[prev]) || ispunct(str[prev]); } -Vector<Text::Token> Text::tokenize(StringView const& str) +Vector<Text::Token> Text::tokenize(StringView str) { Vector<Token> tokens; StringBuilder current_token; @@ -306,14 +306,14 @@ Vector<Text::Token> Text::tokenize(StringView const& str) bool in_space = false; for (size_t offset = 0; offset < str.length(); ++offset) { - auto has = [&](StringView const& seq) { + auto has = [&](StringView seq) { if (offset + seq.length() > str.length()) return false; return str.substring_view(offset, seq.length()) == seq; }; - auto expect = [&](StringView const& seq) { + auto expect = [&](StringView seq) { VERIFY(has(seq)); flush_token(); current_token.append(seq); diff --git a/Userland/Libraries/LibMarkdown/Text.h b/Userland/Libraries/LibMarkdown/Text.h index 7549fb94eb..7926eab8fc 100644 --- a/Userland/Libraries/LibMarkdown/Text.h +++ b/Userland/Libraries/LibMarkdown/Text.h @@ -73,13 +73,13 @@ public: String text; bool collapsible; - TextNode(StringView const& text) + TextNode(StringView text) : text(text) , collapsible(true) { } - TextNode(StringView const& text, bool collapsible) + TextNode(StringView text, bool collapsible) : text(text) , collapsible(collapsible) { @@ -126,7 +126,7 @@ public: String render_for_terminal() const; RecursionDecision walk(Visitor&) const; - static Text parse(StringView const&); + static Text parse(StringView); private: struct Token { @@ -157,10 +157,10 @@ private: { return data[0] == ' '; } - bool operator==(StringView const& str) const { return str == data; } + bool operator==(StringView str) const { return str == data; } }; - static Vector<Token> tokenize(StringView const&); + static Vector<Token> tokenize(StringView); static bool can_open(Token const& opening); static bool can_close_for(Token const& opening, Token const& closing); diff --git a/Userland/Libraries/LibPDF/Command.h b/Userland/Libraries/LibPDF/Command.h index c751ded5d0..967687d853 100644 --- a/Userland/Libraries/LibPDF/Command.h +++ b/Userland/Libraries/LibPDF/Command.h @@ -96,7 +96,7 @@ enum class CommandType { class Command { public: - static CommandType command_type_from_symbol(StringView const& symbol_string) + static CommandType command_type_from_symbol(StringView symbol_string) { #define V(name, snake_name, symbol) \ if (symbol_string == #symbol) \ diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp index e96bb67598..07df3077d3 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.cpp +++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp @@ -105,7 +105,7 @@ static char const* character_class_name(CharClass ch_class) } } -static void advance_string_position(MatchState& state, RegexStringView const& view, Optional<u32> code_point = {}) +static void advance_string_position(MatchState& state, RegexStringView view, Optional<u32> code_point = {}) { ++state.string_position; @@ -119,13 +119,13 @@ static void advance_string_position(MatchState& state, RegexStringView const& vi } } -static void advance_string_position(MatchState& state, RegexStringView const&, RegexStringView const& advance_by) +static void advance_string_position(MatchState& state, RegexStringView, RegexStringView advance_by) { state.string_position += advance_by.length(); state.string_position_in_code_units += advance_by.length_in_code_units(); } -static void reverse_string_position(MatchState& state, RegexStringView const& view, size_t amount) +static void reverse_string_position(MatchState& state, RegexStringView view, size_t amount) { VERIFY(state.string_position >= amount); state.string_position -= amount; @@ -603,7 +603,7 @@ ALWAYS_INLINE void OpCode_Compare::compare_char(MatchInput const& input, MatchSt } } -ALWAYS_INLINE bool OpCode_Compare::compare_string(MatchInput const& input, MatchState& state, RegexStringView const& str, bool& had_zero_length_match) +ALWAYS_INLINE bool OpCode_Compare::compare_string(MatchInput const& input, MatchState& state, RegexStringView str, bool& had_zero_length_match) { if (state.string_position + str.length() > input.view.length()) { if (str.is_empty()) { diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h index 449c2e7bc4..c6dddcb483 100644 --- a/Userland/Libraries/LibRegex/RegexByteCode.h +++ b/Userland/Libraries/LibRegex/RegexByteCode.h @@ -235,7 +235,7 @@ public: empend(capture_groups_count); } - void insert_bytecode_group_capture_right(size_t capture_groups_count, StringView const& name) + void insert_bytecode_group_capture_right(size_t capture_groups_count, StringView name) { empend(static_cast<ByteCodeValueType>(OpCodeId::SaveRightNamedCaptureGroup)); empend(reinterpret_cast<ByteCodeValueType>(name.characters_without_null_termination())); @@ -507,7 +507,7 @@ public: OpCode& get_opcode(MatchState& state) const; private: - void insert_string(StringView const& view) + void insert_string(StringView view) { empend((ByteCodeValueType)view.length()); for (size_t i = 0; i < view.length(); ++i) @@ -752,7 +752,7 @@ public: private: ALWAYS_INLINE static void compare_char(MatchInput const& input, MatchState& state, u32 ch1, bool inverse, bool& inverse_matched); - ALWAYS_INLINE static bool compare_string(MatchInput const& input, MatchState& state, RegexStringView const& str, bool& had_zero_length_match); + ALWAYS_INLINE static bool compare_string(MatchInput const& input, MatchState& state, RegexStringView str, bool& had_zero_length_match); ALWAYS_INLINE static void compare_character_class(MatchInput const& input, MatchState& state, CharClass character_class, u32 ch, bool inverse, bool& inverse_matched); ALWAYS_INLINE static void compare_character_range(MatchInput const& input, MatchState& state, u32 from, u32 to, u32 ch, bool inverse, bool& inverse_matched); ALWAYS_INLINE static void compare_property(MatchInput const& input, MatchState& state, Unicode::Property property, bool inverse, bool& inverse_matched); diff --git a/Userland/Libraries/LibRegex/RegexLexer.h b/Userland/Libraries/LibRegex/RegexLexer.h index c7a753c63a..33a335b8d1 100644 --- a/Userland/Libraries/LibRegex/RegexLexer.h +++ b/Userland/Libraries/LibRegex/RegexLexer.h @@ -52,7 +52,7 @@ public: } TokenType type() const { return m_type; } - StringView const& value() const { return m_value; } + StringView value() const { return m_value; } size_t position() const { return m_position; } char const* name() const; diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index 6d707650ee..2ebd0f5f8c 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -57,7 +57,7 @@ public: explicit RegexStringView(String&&) = delete; - StringView const& string_view() const + StringView string_view() const { return m_view.get<StringView>(); } @@ -280,7 +280,7 @@ public: size_t code_unit_offset_of(size_t code_point_index) const { return m_view.visit( - [&](StringView const& view) -> u32 { + [&](StringView view) -> u32 { Utf8View utf8_view { view }; return utf8_view.byte_offset_of(code_point_index); }, @@ -316,7 +316,7 @@ public: [&](StringView view) { return view == string; }); } - bool operator==(StringView const& string) const + bool operator==(StringView string) const { return m_view.visit( [&](Utf32View) { return to_string() == string; }, @@ -325,7 +325,7 @@ public: [&](StringView view) { return view == string; }); } - bool operator!=(StringView const& other) const + bool operator!=(StringView other) const { return !(*this == other); } @@ -374,12 +374,12 @@ public: return !(*this == other); } - bool equals(RegexStringView const& other) const + bool equals(RegexStringView other) const { return other.m_view.visit([&](auto const& view) { return operator==(view); }); } - bool equals_ignoring_case(RegexStringView const& other) const + bool equals_ignoring_case(RegexStringView other) const { // FIXME: Implement equals_ignoring_case() for unicode. return m_view.visit( @@ -396,7 +396,7 @@ public: [](auto&) -> bool { TODO(); }); } - bool starts_with(StringView const& str) const + bool starts_with(StringView str) const { return m_view.visit( [&](Utf32View) -> bool { @@ -536,7 +536,7 @@ using regex::RegexStringView; template<> struct AK::Formatter<regex::RegexStringView> : Formatter<StringView> { - void format(FormatBuilder& builder, regex::RegexStringView const& value) + void format(FormatBuilder& builder, regex::RegexStringView value) { auto string = value.to_string(); return Formatter<StringView>::format(builder, string); diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index dbc5b98cbe..f9b53c9325 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -100,7 +100,7 @@ String Regex<Parser>::error_string(Optional<String> message) const } template<typename Parser> -RegexResult Matcher<Parser>::match(RegexStringView const& view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const +RegexResult Matcher<Parser>::match(RegexStringView view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options) const { AllOptions options = m_regex_options | regex_options.value_or({}).value(); diff --git a/Userland/Libraries/LibRegex/RegexMatcher.h b/Userland/Libraries/LibRegex/RegexMatcher.h index a32e25ef8a..092c4953c9 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.h +++ b/Userland/Libraries/LibRegex/RegexMatcher.h @@ -60,7 +60,7 @@ public: } ~Matcher() = default; - RegexResult match(RegexStringView const&, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const; + RegexResult match(RegexStringView, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const; RegexResult match(Vector<RegexStringView> const&, Optional<typename ParserTraits<Parser>::OptionsType> = {}) const; typename ParserTraits<Parser>::OptionsType options() const @@ -100,7 +100,7 @@ public: void print_bytecode(FILE* f = stdout) const; String error_string(Optional<String> message = {}) const; - RegexResult match(RegexStringView const& view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + RegexResult match(RegexStringView view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { if (!matcher || parser_result.error != Error::NoError) return {}; @@ -114,7 +114,7 @@ public: return matcher->match(views, regex_options); } - String replace(RegexStringView const& view, StringView const& replacement_pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + String replace(RegexStringView view, StringView replacement_pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { if (!matcher || parser_result.error != Error::NoError) return {}; @@ -155,7 +155,7 @@ public: // FIXME: replace(Vector<RegexStringView> const , ...) - RegexResult search(RegexStringView const& view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + RegexResult search(RegexStringView view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { if (!matcher || parser_result.error != Error::NoError) return {}; @@ -187,7 +187,7 @@ public: return matcher->match(views, options); } - bool match(RegexStringView const& view, RegexResult& m, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + bool match(RegexStringView view, RegexResult& m, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { m = match(view, regex_options); return m.success; @@ -199,7 +199,7 @@ public: return m.success; } - bool search(RegexStringView const& view, RegexResult& m, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + bool search(RegexStringView view, RegexResult& m, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { m = search(view, regex_options); return m.success; @@ -211,7 +211,7 @@ public: return m.success; } - bool has_match(RegexStringView const& view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const + bool has_match(RegexStringView view, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) const { if (!matcher || parser_result.error != Error::NoError) return false; @@ -236,7 +236,7 @@ private: // free standing functions for match, search and has_match template<class Parser> -RegexResult match(RegexStringView const& view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) +RegexResult match(RegexStringView view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) { return pattern.match(view, regex_options); } @@ -248,7 +248,7 @@ RegexResult match(Vector<RegexStringView> const& view, Regex<Parser>& pattern, O } template<class Parser> -bool match(RegexStringView const& view, Regex<Parser>& pattern, RegexResult&, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) +bool match(RegexStringView view, Regex<Parser>& pattern, RegexResult&, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) { return pattern.match(view, regex_options); } @@ -260,7 +260,7 @@ bool match(Vector<RegexStringView> const& view, Regex<Parser>& pattern, RegexRes } template<class Parser> -RegexResult search(RegexStringView const& view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) +RegexResult search(RegexStringView view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) { return pattern.search(view, regex_options); } @@ -272,7 +272,7 @@ RegexResult search(Vector<RegexStringView> const& views, Regex<Parser>& pattern, } template<class Parser> -bool search(RegexStringView const& view, Regex<Parser>& pattern, RegexResult&, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) +bool search(RegexStringView view, Regex<Parser>& pattern, RegexResult&, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) { return pattern.search(view, regex_options); } @@ -284,7 +284,7 @@ bool search(Vector<RegexStringView> const& views, Regex<Parser>& pattern, RegexR } template<class Parser> -bool has_match(RegexStringView const& view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) +bool has_match(RegexStringView view, Regex<Parser>& pattern, Optional<typename ParserTraits<Parser>::OptionsType> regex_options = {}) { return pattern.has_match(view, regex_options); } diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp index ad48e4e709..ef35382831 100644 --- a/Userland/Libraries/LibRegex/RegexParser.cpp +++ b/Userland/Libraries/LibRegex/RegexParser.cpp @@ -1139,7 +1139,7 @@ StringView ECMA262Parser::read_digits_as_string(ReadDigitsInitialZeroState initi size_t offset = 0; auto start_token = m_parser_state.current_token; while (match(TokenType::Char)) { - auto& c = m_parser_state.current_token.value(); + auto const c = m_parser_state.current_token.value(); if (max_count > 0 && count >= max_count) break; diff --git a/Userland/Libraries/LibTLS/HandshakeClient.cpp b/Userland/Libraries/LibTLS/HandshakeClient.cpp index 8a4304eea2..f1f07b2bf5 100644 --- a/Userland/Libraries/LibTLS/HandshakeClient.cpp +++ b/Userland/Libraries/LibTLS/HandshakeClient.cpp @@ -140,7 +140,7 @@ bool TLSv12::compute_master_secret_from_pre_master_secret(size_t length) return true; } -static bool wildcard_matches(const StringView& host, const StringView& subject) +static bool wildcard_matches(StringView host, StringView subject) { if (host.matches(subject)) return true; @@ -151,7 +151,7 @@ static bool wildcard_matches(const StringView& host, const StringView& subject) return false; } -Optional<size_t> TLSv12::verify_chain_and_get_matching_certificate(const StringView& host) const +Optional<size_t> TLSv12::verify_chain_and_get_matching_certificate(StringView host) const { if (m_context.certificates.is_empty() || !m_context.verify_chain()) return {}; diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index 77b80b6a8e..7f9629615b 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -236,7 +236,7 @@ struct Context { bool verify() const; bool verify_chain() const; - static void print_file(const StringView& fname); + static void print_file(StringView fname); Options options; @@ -318,7 +318,7 @@ public: bool is_established() const { return m_context.connection_status == ConnectionStatus::Established; } virtual bool connect(const String&, int) override; - void set_sni(const StringView& sni) + void set_sni(StringView sni) { if (m_context.is_server || m_context.critical_error || m_context.connection_status != ConnectionStatus::Disconnected) { dbgln("invalid state for set_sni"); @@ -341,9 +341,9 @@ public: ByteBuffer finish_build(); - const StringView& alpn() const { return m_context.negotiated_alpn; } - void add_alpn(const StringView& alpn); - bool has_alpn(const StringView& alpn) const; + StringView alpn() const { return m_context.negotiated_alpn; } + void add_alpn(StringView alpn); + bool has_alpn(StringView alpn) const; bool supports_cipher(CipherSuite suite) const { @@ -508,7 +508,7 @@ private: bool compute_master_secret_from_pre_master_secret(size_t length); - Optional<size_t> verify_chain_and_get_matching_certificate(const StringView& host) const; + Optional<size_t> verify_chain_and_get_matching_certificate(StringView host) const; void try_disambiguate_error() const; diff --git a/Userland/Libraries/LibTextCodec/Decoder.cpp b/Userland/Libraries/LibTextCodec/Decoder.cpp index 7a1bc03c01..b306ac1af2 100644 --- a/Userland/Libraries/LibTextCodec/Decoder.cpp +++ b/Userland/Libraries/LibTextCodec/Decoder.cpp @@ -192,21 +192,21 @@ Optional<String> get_standardized_encoding(const String& encoding) return {}; } -String Decoder::to_utf8(const StringView& input) +String Decoder::to_utf8(StringView input) { StringBuilder builder(input.length()); process(input, [&builder](u32 c) { builder.append_code_point(c); }); return builder.to_string(); } -void UTF8Decoder::process(const StringView& input, Function<void(u32)> on_code_point) +void UTF8Decoder::process(StringView input, Function<void(u32)> on_code_point) { for (auto c : input) { on_code_point(c); } } -String UTF8Decoder::to_utf8(const StringView& input) +String UTF8Decoder::to_utf8(StringView input) { // Discard the BOM auto bomless_input = input; @@ -217,7 +217,7 @@ String UTF8Decoder::to_utf8(const StringView& input) return bomless_input; } -void UTF16BEDecoder::process(const StringView& input, Function<void(u32)> on_code_point) +void UTF16BEDecoder::process(StringView input, Function<void(u32)> on_code_point) { size_t utf16_length = input.length() - (input.length() % 2); for (size_t i = 0; i < utf16_length; i += 2) { @@ -226,7 +226,7 @@ void UTF16BEDecoder::process(const StringView& input, Function<void(u32)> on_cod } } -String UTF16BEDecoder::to_utf8(const StringView& input) +String UTF16BEDecoder::to_utf8(StringView input) { // Discard the BOM auto bomless_input = input; @@ -239,7 +239,7 @@ String UTF16BEDecoder::to_utf8(const StringView& input) return builder.to_string(); } -void Latin1Decoder::process(const StringView& input, Function<void(u32)> on_code_point) +void Latin1Decoder::process(StringView input, Function<void(u32)> on_code_point) { for (size_t i = 0; i < input.length(); ++i) { u8 ch = input[i]; @@ -327,14 +327,14 @@ u32 convert_latin2_to_utf8(u8 in) } } -void Latin2Decoder::process(const StringView& input, Function<void(u32)> on_code_point) +void Latin2Decoder::process(StringView input, Function<void(u32)> on_code_point) { for (auto c : input) { on_code_point(convert_latin2_to_utf8(c)); } } -void HebrewDecoder::process(const StringView& input, Function<void(u32)> on_code_point) +void HebrewDecoder::process(StringView input, Function<void(u32)> on_code_point) { static constexpr Array<u32, 128> translation_table = { 0x20AC, 0xFFFD, 0x201A, 0x192, 0x201E, 0x2026, 0x2020, 0x2021, 0x2C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, @@ -355,7 +355,7 @@ void HebrewDecoder::process(const StringView& input, Function<void(u32)> on_code } } -void CyrillicDecoder::process(const StringView& input, Function<void(u32)> on_code_point) +void CyrillicDecoder::process(StringView input, Function<void(u32)> on_code_point) { static constexpr Array<u32, 128> translation_table = { 0x402, 0x403, 0x201A, 0x453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x409, 0x2039, 0x40A, 0x40C, 0x40B, 0x40F, @@ -376,7 +376,7 @@ void CyrillicDecoder::process(const StringView& input, Function<void(u32)> on_co } } -void Latin9Decoder::process(const StringView& input, Function<void(u32)> on_code_point) +void Latin9Decoder::process(StringView input, Function<void(u32)> on_code_point) { auto convert_latin9_to_utf8 = [](u8 ch) -> u32 { // Latin9 is the same as the first 256 Unicode code points, except for 8 characters. @@ -407,7 +407,7 @@ void Latin9Decoder::process(const StringView& input, Function<void(u32)> on_code } } -void TurkishDecoder::process(const StringView& input, Function<void(u32)> on_code_point) +void TurkishDecoder::process(StringView input, Function<void(u32)> on_code_point) { auto convert_turkish_to_utf8 = [](u8 ch) -> u32 { // Turkish (aka ISO-8859-9, Windows-1254) is the same as the first 256 Unicode code points, except for 6 characters. diff --git a/Userland/Libraries/LibTextCodec/Decoder.h b/Userland/Libraries/LibTextCodec/Decoder.h index 6bbd515cb3..b1d0e2f429 100644 --- a/Userland/Libraries/LibTextCodec/Decoder.h +++ b/Userland/Libraries/LibTextCodec/Decoder.h @@ -13,8 +13,8 @@ namespace TextCodec { class Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) = 0; - virtual String to_utf8(StringView const&); + virtual void process(StringView, Function<void(u32)> on_code_point) = 0; + virtual String to_utf8(StringView); protected: virtual ~Decoder() = default; @@ -22,44 +22,44 @@ protected: class UTF8Decoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; - virtual String to_utf8(StringView const&) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; + virtual String to_utf8(StringView) override; }; class UTF16BEDecoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; - virtual String to_utf8(StringView const&) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; + virtual String to_utf8(StringView) override; }; class Latin1Decoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; class Latin2Decoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; class HebrewDecoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; class CyrillicDecoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; class Latin9Decoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; class TurkishDecoder final : public Decoder { public: - virtual void process(StringView const&, Function<void(u32)> on_code_point) override; + virtual void process(StringView, Function<void(u32)> on_code_point) override; }; Decoder* decoder_for(String const& encoding); diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.cpp b/Userland/Libraries/LibUnicode/CharacterTypes.cpp index 90788feb64..a48409e61f 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.cpp +++ b/Userland/Libraries/LibUnicode/CharacterTypes.cpp @@ -222,7 +222,7 @@ u32 to_unicode_uppercase(u32 code_point) #endif } -String to_unicode_lowercase_full(StringView const& string, [[maybe_unused]] Optional<StringView> locale) +String to_unicode_lowercase_full(StringView string, [[maybe_unused]] Optional<StringView> locale) { #if ENABLE_UNICODE_DATA Utf8View view { string }; @@ -251,7 +251,7 @@ String to_unicode_lowercase_full(StringView const& string, [[maybe_unused]] Opti #endif } -String to_unicode_uppercase_full(StringView const& string, [[maybe_unused]] Optional<StringView> locale) +String to_unicode_uppercase_full(StringView string, [[maybe_unused]] Optional<StringView> locale) { #if ENABLE_UNICODE_DATA Utf8View view { string }; @@ -280,7 +280,7 @@ String to_unicode_uppercase_full(StringView const& string, [[maybe_unused]] Opti #endif } -Optional<GeneralCategory> general_category_from_string([[maybe_unused]] StringView const& general_category) +Optional<GeneralCategory> general_category_from_string([[maybe_unused]] StringView general_category) { #if ENABLE_UNICODE_DATA return Detail::general_category_from_string(general_category); @@ -298,7 +298,7 @@ bool code_point_has_general_category([[maybe_unused]] u32 code_point, [[maybe_un #endif } -Optional<Property> property_from_string([[maybe_unused]] StringView const& property) +Optional<Property> property_from_string([[maybe_unused]] StringView property) { #if ENABLE_UNICODE_DATA return Detail::property_from_string(property); @@ -383,7 +383,7 @@ bool is_ecma262_property([[maybe_unused]] Property property) #endif } -Optional<Script> script_from_string([[maybe_unused]] StringView const& script) +Optional<Script> script_from_string([[maybe_unused]] StringView script) { #if ENABLE_UNICODE_DATA return Detail::script_from_string(script); diff --git a/Userland/Libraries/LibUnicode/CharacterTypes.h b/Userland/Libraries/LibUnicode/CharacterTypes.h index 62b34bf413..2193eb3826 100644 --- a/Userland/Libraries/LibUnicode/CharacterTypes.h +++ b/Userland/Libraries/LibUnicode/CharacterTypes.h @@ -19,17 +19,17 @@ namespace Unicode { u32 to_unicode_lowercase(u32 code_point); u32 to_unicode_uppercase(u32 code_point); -String to_unicode_lowercase_full(StringView const&, Optional<StringView> locale = {}); -String to_unicode_uppercase_full(StringView const&, Optional<StringView> locale = {}); +String to_unicode_lowercase_full(StringView, Optional<StringView> locale = {}); +String to_unicode_uppercase_full(StringView, Optional<StringView> locale = {}); -Optional<GeneralCategory> general_category_from_string(StringView const&); +Optional<GeneralCategory> general_category_from_string(StringView); bool code_point_has_general_category(u32 code_point, GeneralCategory general_category); -Optional<Property> property_from_string(StringView const&); +Optional<Property> property_from_string(StringView); bool code_point_has_property(u32 code_point, Property property); bool is_ecma262_property(Property); -Optional<Script> script_from_string(StringView const&); +Optional<Script> script_from_string(StringView); bool code_point_has_script(u32 code_point, Script script); bool code_point_has_script_extension(u32 code_point, Script script); diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp index 7b52dbd0b6..e4e3d990ab 100644 --- a/Userland/Libraries/LibVT/Terminal.cpp +++ b/Userland/Libraries/LibVT/Terminal.cpp @@ -1324,13 +1324,13 @@ void Terminal::execute_dcs_sequence() { } -void Terminal::inject_string(const StringView& str) +void Terminal::inject_string(StringView str) { for (size_t i = 0; i < str.length(); ++i) on_input(str[i]); } -void Terminal::emit_string(const StringView& string) +void Terminal::emit_string(StringView string) { m_client.emit((const u8*)string.characters_without_null_termination(), string.length()); } diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h index 6b78c2ef67..5313d20715 100644 --- a/Userland/Libraries/LibVT/Terminal.h +++ b/Userland/Libraries/LibVT/Terminal.h @@ -48,7 +48,7 @@ public: virtual ~TerminalClient() { } virtual void beep() = 0; - virtual void set_window_title(const StringView&) = 0; + virtual void set_window_title(StringView) = 0; virtual void set_window_progress(int value, int max) = 0; virtual void terminal_did_resize(u16 columns, u16 rows) = 0; virtual void terminal_history_changed(int delta) = 0; @@ -172,7 +172,7 @@ public: size_t history_size() const { return m_use_alternate_screen_buffer ? 0 : m_history.size(); } #endif - void inject_string(const StringView&); + void inject_string(StringView); void handle_key_press(KeyCode, u32, u8 flags); #ifndef KERNEL @@ -230,7 +230,7 @@ protected: void unimplemented_csi_sequence(Parameters, Intermediates, u8 last_byte); void unimplemented_osc_sequence(OscParameters, u8 last_byte); - void emit_string(const StringView&); + void emit_string(StringView); void alter_ansi_mode(bool should_set, Parameters); void alter_private_mode(bool should_set, Parameters); diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 980b678d54..ff99793918 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -458,7 +458,7 @@ void TerminalWidget::set_window_progress(int value, int max) window()->set_progress((int)roundf(progress)); } -void TerminalWidget::set_window_title(const StringView& title) +void TerminalWidget::set_window_title(StringView title) { if (!Utf8View(title).validate()) { dbgln("TerminalWidget: Attempted to set window title to invalid UTF-8 string"); @@ -649,7 +649,7 @@ static u32 to_lowercase_code_point(u32 code_point) return code_point; } -VT::Range TerminalWidget::find_next(const StringView& needle, const VT::Position& start, bool case_sensitivity, bool should_wrap) +VT::Range TerminalWidget::find_next(StringView needle, const VT::Position& start, bool case_sensitivity, bool should_wrap) { if (needle.is_empty()) return {}; @@ -681,7 +681,7 @@ VT::Range TerminalWidget::find_next(const StringView& needle, const VT::Position return {}; } -VT::Range TerminalWidget::find_previous(const StringView& needle, const VT::Position& start, bool case_sensitivity, bool should_wrap) +VT::Range TerminalWidget::find_previous(StringView needle, const VT::Position& start, bool case_sensitivity, bool should_wrap) { if (needle.is_empty()) return {}; @@ -1159,7 +1159,7 @@ void TerminalWidget::update_paste_action() m_paste_action->set_enabled(GUI::Clipboard::the().mime_type().starts_with("text/") && !GUI::Clipboard::the().data().is_empty()); } -void TerminalWidget::set_color_scheme(const StringView& name) +void TerminalWidget::set_color_scheme(StringView name) { if (name.contains('/')) { dbgln("Shenanigans! Color scheme names can't contain slashes."); diff --git a/Userland/Libraries/LibVT/TerminalWidget.h b/Userland/Libraries/LibVT/TerminalWidget.h index 3eaeb1f116..cc37a278fd 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.h +++ b/Userland/Libraries/LibVT/TerminalWidget.h @@ -30,7 +30,7 @@ public: virtual ~TerminalWidget() override; void set_pty_master_fd(int fd); - void inject_string(const StringView& string) + void inject_string(StringView string) { m_terminal.inject_string(string); flush_dirty_lines(); @@ -59,8 +59,8 @@ public: void set_selection(const VT::Range& selection); VT::Position buffer_position_at(const Gfx::IntPoint&) const; - VT::Range find_next(const StringView&, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); - VT::Range find_previous(const StringView&, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); + VT::Range find_next(StringView, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); + VT::Range find_previous(StringView, const VT::Position& start = {}, bool case_sensitivity = false, bool should_wrap = false); void scroll_to_bottom(); void scroll_to_row(int); @@ -81,7 +81,7 @@ public: const StringView color_scheme_name() const { return m_color_scheme_name; } - Function<void(const StringView&)> on_title_change; + Function<void(StringView)> on_title_change; Function<void(const Gfx::IntSize&)> on_terminal_size_change; Function<void()> on_command_exit; @@ -91,7 +91,7 @@ public: void set_font_and_resize_to_fit(const Gfx::Font&); - void set_color_scheme(const StringView&); + void set_color_scheme(StringView); private: TerminalWidget(int ptm_fd, bool automatic_size_policy); @@ -116,7 +116,7 @@ private: // ^TerminalClient virtual void beep() override; - virtual void set_window_title(const StringView&) override; + virtual void set_window_title(StringView) override; virtual void set_window_progress(int value, int max) override; virtual void terminal_did_resize(u16 columns, u16 rows) override; virtual void terminal_history_changed(int delta) override; diff --git a/Userland/Libraries/LibVideo/MatroskaReader.cpp b/Userland/Libraries/LibVideo/MatroskaReader.cpp index d988b3ac86..f7c0ddce14 100644 --- a/Userland/Libraries/LibVideo/MatroskaReader.cpp +++ b/Userland/Libraries/LibVideo/MatroskaReader.cpp @@ -41,7 +41,7 @@ constexpr u32 BIT_DEPTH_ID = 0x6264; constexpr u32 SIMPLE_BLOCK_ID = 0xA3; constexpr u32 TIMESTAMP_ID = 0xE7; -OwnPtr<MatroskaDocument> MatroskaReader::parse_matroska_from_file(StringView const& path) +OwnPtr<MatroskaDocument> MatroskaReader::parse_matroska_from_file(StringView path) { auto mapped_file_result = MappedFile::map(path); if (mapped_file_result.is_error()) @@ -83,7 +83,7 @@ OwnPtr<MatroskaDocument> MatroskaReader::parse() return matroska_document; } -bool MatroskaReader::parse_master_element([[maybe_unused]] StringView const& element_name, Function<bool(u64)> element_consumer) +bool MatroskaReader::parse_master_element([[maybe_unused]] StringView element_name, Function<bool(u64)> element_consumer) { auto element_data_size = m_streamer.read_variable_size_integer(); CHECK_HAS_VALUE(element_data_size); diff --git a/Userland/Libraries/LibVideo/MatroskaReader.h b/Userland/Libraries/LibVideo/MatroskaReader.h index 33d23c3dd3..29fc992e68 100644 --- a/Userland/Libraries/LibVideo/MatroskaReader.h +++ b/Userland/Libraries/LibVideo/MatroskaReader.h @@ -22,7 +22,7 @@ public: { } - static OwnPtr<MatroskaDocument> parse_matroska_from_file(StringView const& path); + static OwnPtr<MatroskaDocument> parse_matroska_from_file(StringView path); static OwnPtr<MatroskaDocument> parse_matroska_from_data(u8 const*, size_t); OwnPtr<MatroskaDocument> parse(); @@ -146,7 +146,7 @@ private: Vector<size_t> m_octets_read { 0 }; }; - bool parse_master_element(StringView const& element_name, Function<bool(u64 element_id)> element_consumer); + bool parse_master_element(StringView element_name, Function<bool(u64 element_id)> element_consumer); Optional<EBMLHeader> parse_ebml_header(); bool parse_segment_elements(MatroskaDocument&); diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp index 694f321066..c9e1a2ae58 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.cpp @@ -18,7 +18,7 @@ CSSGroupingRule::~CSSGroupingRule() { } -size_t CSSGroupingRule::insert_rule(StringView const&, size_t) +size_t CSSGroupingRule::insert_rule(StringView, size_t) { // https://www.w3.org/TR/cssom-1/#insert-a-css-rule TODO(); diff --git a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h index 108de57469..af12208697 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSGroupingRule.h @@ -23,7 +23,7 @@ public: CSSRuleList const& css_rules() const { return m_rules; } CSSRuleList& css_rules() { return m_rules; } - size_t insert_rule(StringView const& rule, size_t index = 0); + size_t insert_rule(StringView rule, size_t index = 0); void delete_rule(size_t index); virtual void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 314660fbdf..d52c1045e4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -147,7 +147,7 @@ void TokenStream<T>::dump_all_tokens() } } -Parser::Parser(ParsingContext const& context, StringView const& input, String const& encoding) +Parser::Parser(ParsingContext const& context, StringView input, String const& encoding) : m_context(context) , m_tokenizer(input, encoding) , m_tokens(m_tokenizer.parse()) @@ -3685,7 +3685,7 @@ Optional<Selector::SimpleSelector::ANPlusBPattern> Parser::parse_a_n_plus_b_patt auto is_dashndash = [](StyleComponentValueRule const& value) -> bool { return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n-"sv); }; - auto is_delim = [](StyleComponentValueRule const& value, StringView const& delim) -> bool { + auto is_delim = [](StyleComponentValueRule const& value, StringView delim) -> bool { return value.is(Token::Type::Delim) && value.token().delim().equals_ignoring_case(delim); }; auto is_n_dimension = [](StyleComponentValueRule const& value) -> bool { @@ -4208,7 +4208,7 @@ OwnPtr<CalculatedStyleValue::CalcSum> Parser::parse_calc_sum(ParsingContext cons return make<CalculatedStyleValue::CalcSum>(parsed_calc_product.release_nonnull(), move(additional)); } -bool Parser::has_ignored_vendor_prefix(StringView const& string) +bool Parser::has_ignored_vendor_prefix(StringView string) { if (!string.starts_with('-')) return false; @@ -4223,7 +4223,7 @@ bool Parser::has_ignored_vendor_prefix(StringView const& string) namespace Web { -RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringView const& css) +RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::CSSStyleSheet::create({}); @@ -4231,7 +4231,7 @@ RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const& context, StringV return parser.parse_as_stylesheet(); } -RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const& context, StringView const& css) +RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const& context, StringView css) { if (css.is_empty()) return CSS::PropertyOwningCSSStyleDeclaration::create({}, {}); @@ -4239,7 +4239,7 @@ RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::Parsin return parser.parse_as_list_of_declarations(); } -RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const& context, StringView const& string, CSS::PropertyID property_id) +RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const& context, StringView string, CSS::PropertyID property_id) { if (string.is_empty()) return {}; @@ -4253,25 +4253,25 @@ RefPtr<CSS::CSSRule> parse_css_rule(CSS::ParsingContext const& context, StringVi return parser.parse_as_rule(); } -Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const& context, StringView const& selector_text) +Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const& context, StringView selector_text) { CSS::Parser parser(context, selector_text); return parser.parse_as_selector(); } -RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const& context, StringView const& string) +RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query(); } -NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const& context, StringView const& string) +NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const& context, StringView string) { CSS::Parser parser(context, string); return parser.parse_as_media_query_list(); } -RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, StringView const& string) +RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, StringView string) { if (string.is_empty()) return {}; @@ -4279,7 +4279,7 @@ RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const& context, Str return parser.parse_as_supports(); } -RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const& document, StringView const& string) +RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const& document, StringView string) { auto integer = string.to_int(); if (integer.has_value()) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index 6592e73dc4..1377bf2ea4 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -80,7 +80,7 @@ private: class Parser { public: - Parser(ParsingContext const&, StringView const& input, String const& encoding = "utf-8"); + Parser(ParsingContext const&, StringView input, String const& encoding = "utf-8"); ~Parser(); // The normal parser entry point, for parsing stylesheets. @@ -260,7 +260,7 @@ private: Optional<Supports::InParens> parse_supports_in_parens(TokenStream<StyleComponentValueRule>&); Optional<Supports::Feature> parse_supports_feature(TokenStream<StyleComponentValueRule>&); - static bool has_ignored_vendor_prefix(StringView const&); + static bool has_ignored_vendor_prefix(StringView); ParsingContext m_context; @@ -273,15 +273,15 @@ private: namespace Web { -RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const&, StringView const&, CSS::PropertyID property_id = CSS::PropertyID::Invalid); -Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const&, StringView const&); +RefPtr<CSS::CSSStyleSheet> parse_css(CSS::ParsingContext const&, StringView); +RefPtr<CSS::PropertyOwningCSSStyleDeclaration> parse_css_declaration(CSS::ParsingContext const&, StringView); +RefPtr<CSS::StyleValue> parse_css_value(CSS::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid); +Optional<CSS::SelectorList> parse_selector(CSS::ParsingContext const&, StringView); RefPtr<CSS::CSSRule> parse_css_rule(CSS::ParsingContext const&, StringView); -RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const&, StringView const&); -NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const&, StringView const&); -RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const&, StringView const&); +RefPtr<CSS::MediaQuery> parse_media_query(CSS::ParsingContext const&, StringView); +NonnullRefPtrVector<CSS::MediaQuery> parse_media_query_list(CSS::ParsingContext const&, StringView); +RefPtr<CSS::Supports> parse_css_supports(CSS::ParsingContext const&, StringView); -RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const&, StringView const&); +RefPtr<CSS::StyleValue> parse_html_length(DOM::Document const&, StringView); } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp index 9c4602606a..d7f2808720 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.cpp @@ -191,7 +191,7 @@ static inline bool is_E(u32 code_point) namespace Web::CSS { -Tokenizer::Tokenizer(const StringView& input, const String& encoding) +Tokenizer::Tokenizer(StringView input, const String& encoding) { auto* decoder = TextCodec::decoder_for(encoding); VERIFY(decoder); diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h index d557bee3db..201ac94ae2 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Tokenizer.h @@ -66,7 +66,7 @@ public: class Tokenizer { public: - explicit Tokenizer(const StringView& input, const String& encoding); + explicit Tokenizer(StringView input, const String& encoding); [[nodiscard]] Vector<Token> parse(); diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.cpp b/Userland/Libraries/LibWeb/CSS/Serialize.cpp index 07e8eb7555..e43a5e03c3 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.cpp +++ b/Userland/Libraries/LibWeb/CSS/Serialize.cpp @@ -24,7 +24,7 @@ void escape_a_character_as_code_point(StringBuilder& builder, u32 character) } // https://www.w3.org/TR/cssom-1/#serialize-an-identifier -void serialize_an_identifier(StringBuilder& builder, StringView const& ident) +void serialize_an_identifier(StringBuilder& builder, StringView ident) { Utf8View characters { ident }; auto first_character = characters.is_empty() ? 0 : *characters.begin(); @@ -76,7 +76,7 @@ void serialize_an_identifier(StringBuilder& builder, StringView const& ident) } // https://www.w3.org/TR/cssom-1/#serialize-a-string -void serialize_a_string(StringBuilder& builder, StringView const& string) +void serialize_a_string(StringBuilder& builder, StringView string) { Utf8View characters { string }; @@ -108,7 +108,7 @@ void serialize_a_string(StringBuilder& builder, StringView const& string) } // https://www.w3.org/TR/cssom-1/#serialize-a-url -void serialize_a_url(StringBuilder& builder, StringView const& url) +void serialize_a_url(StringBuilder& builder, StringView url) { // To serialize a URL means to create a string represented by "url(", // followed by the serialization of the URL as a string, followed by ")". @@ -131,21 +131,21 @@ String escape_a_character_as_code_point(u32 character) return builder.to_string(); } -String serialize_an_identifier(StringView const& ident) +String serialize_an_identifier(StringView ident) { StringBuilder builder; serialize_an_identifier(builder, ident); return builder.to_string(); } -String serialize_a_string(StringView const& string) +String serialize_a_string(StringView string) { StringBuilder builder; serialize_a_string(builder, string); return builder.to_string(); } -String serialize_a_url(StringView const& url) +String serialize_a_url(StringView url) { StringBuilder builder; serialize_a_url(builder, url); diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.h b/Userland/Libraries/LibWeb/CSS/Serialize.h index 01281efbbb..15ca58151b 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.h +++ b/Userland/Libraries/LibWeb/CSS/Serialize.h @@ -14,14 +14,14 @@ namespace Web::CSS { void escape_a_character(StringBuilder&, u32 character); void escape_a_character_as_code_point(StringBuilder&, u32 character); -void serialize_an_identifier(StringBuilder&, StringView const& ident); -void serialize_a_string(StringBuilder&, StringView const& string); -void serialize_a_url(StringBuilder&, StringView const& url); +void serialize_an_identifier(StringBuilder&, StringView ident); +void serialize_a_string(StringBuilder&, StringView string); +void serialize_a_url(StringBuilder&, StringView url); String escape_a_character(u32 character); String escape_a_character_as_code_point(u32 character); -String serialize_an_identifier(StringView const& ident); -String serialize_a_string(StringView const& string); -String serialize_a_url(StringView const& url); +String serialize_an_identifier(StringView ident); +String serialize_a_string(StringView string); +String serialize_a_url(StringView url); } diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 3b2e13ce56..8c78d203b4 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -705,7 +705,7 @@ JS::Interpreter& Document::interpreter() return *m_interpreter; } -JS::Value Document::run_javascript(const StringView& source, const StringView& filename) +JS::Value Document::run_javascript(StringView source, StringView filename) { auto parser = JS::Parser(JS::Lexer(source, filename)); auto program = parser.parse_program(); diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index e9623c896c..98c65e68b9 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -177,7 +177,7 @@ public: JS::Realm& realm(); JS::Interpreter& interpreter(); - JS::Value run_javascript(const StringView& source, const StringView& filename = "(unknown)"); + JS::Value run_javascript(StringView source, StringView filename = "(unknown)"); NonnullRefPtr<Element> create_element(const String& tag_name); NonnullRefPtr<Element> create_element_ns(const String& namespace_, const String& qualifed_name); diff --git a/Userland/Libraries/LibWeb/DOM/Event.h b/Userland/Libraries/LibWeb/DOM/Event.h index cbd65fdc0d..80963e100d 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.h +++ b/Userland/Libraries/LibWeb/DOM/Event.h @@ -61,7 +61,7 @@ public: double time_stamp() const; const FlyString& type() const { return m_type; } - void set_type(const StringView& type) { m_type = type; } + void set_type(StringView type) { m_type = type; } RefPtr<EventTarget> target() const { return m_target; } void set_target(EventTarget* target) { m_target = target; } diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp index 0fdf89666e..ccde46a4c7 100644 --- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp +++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp @@ -94,7 +94,7 @@ int DOMTreeModel::column_count(const GUI::ModelIndex&) const return 1; } -static String with_whitespace_collapsed(const StringView& string) +static String with_whitespace_collapsed(StringView string) { StringBuilder builder; for (size_t i = 0; i < string.length(); ++i) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp index d0e6d90083..6371b62d8f 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp @@ -10,7 +10,7 @@ namespace Web { namespace HTML { -Optional<EntityMatch> code_points_from_entity(const StringView& entity) +Optional<EntityMatch> code_points_from_entity(StringView entity) { constexpr struct { StringView entity; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h index 937a3985e4..1b56616acb 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h @@ -17,7 +17,7 @@ struct EntityMatch { StringView entity; }; -Optional<EntityMatch> code_points_from_entity(const StringView&); +Optional<EntityMatch> code_points_from_entity(StringView); } } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 1a7ada5a10..3919802f57 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -118,7 +118,7 @@ static bool is_html_integration_point(DOM::Element const& element) return false; } -RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& url, const String& encoding) +RefPtr<DOM::Document> parse_html_document(StringView data, const AK::URL& url, const String& encoding) { auto document = DOM::Document::create(url); HTMLParser parser(document, data, encoding); @@ -126,7 +126,7 @@ RefPtr<DOM::Document> parse_html_document(const StringView& data, const AK::URL& return document; } -HTMLParser::HTMLParser(DOM::Document& document, const StringView& input, const String& encoding) +HTMLParser::HTMLParser(DOM::Document& document, StringView input, const String& encoding) : m_tokenizer(input, encoding) , m_document(document) { @@ -3107,7 +3107,7 @@ DOM::Document& HTMLParser::document() return *m_document; } -NonnullRefPtrVector<DOM::Node> HTMLParser::parse_html_fragment(DOM::Element& context_element, const StringView& markup) +NonnullRefPtrVector<DOM::Node> HTMLParser::parse_html_fragment(DOM::Element& context_element, StringView markup) { auto temp_document = DOM::Document::create(); HTMLParser parser(*temp_document, markup, "utf-8"); @@ -3193,7 +3193,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node) Yes, }; - auto escape_string = [](StringView const& string, AttributeMode attribute_mode) -> String { + auto escape_string = [](StringView string, AttributeMode attribute_mode) -> String { // https://html.spec.whatwg.org/multipage/parsing.html#escapingString StringBuilder builder; for (auto& ch : string) { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h index c30c374e7a..9805e43094 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.h @@ -39,11 +39,11 @@ namespace Web::HTML { __ENUMERATE_INSERTION_MODE(AfterAfterBody) \ __ENUMERATE_INSERTION_MODE(AfterAfterFrameset) -RefPtr<DOM::Document> parse_html_document(const StringView&, const AK::URL&, const String& encoding); +RefPtr<DOM::Document> parse_html_document(StringView, const AK::URL&, const String& encoding); class HTMLParser { public: - HTMLParser(DOM::Document&, const StringView& input, const String& encoding); + HTMLParser(DOM::Document&, StringView input, const String& encoding); ~HTMLParser(); static NonnullOwnPtr<HTMLParser> create_with_uncertain_encoding(DOM::Document&, const ByteBuffer& input); @@ -52,7 +52,7 @@ public: DOM::Document& document(); - static NonnullRefPtrVector<DOM::Node> parse_html_fragment(DOM::Element& context_element, const StringView&); + static NonnullRefPtrVector<DOM::Node> parse_html_fragment(DOM::Element& context_element, StringView); static String serialize_html_fragment(DOM::Node const& node); enum class InsertionMode { diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp index 98d268bab5..737fec0507 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp @@ -2639,7 +2639,7 @@ _StartOfFunction: } } -bool HTMLTokenizer::consume_next_if_match(StringView const& string, CaseSensitivity case_sensitivity) +bool HTMLTokenizer::consume_next_if_match(StringView string, CaseSensitivity case_sensitivity) { for (size_t i = 0; i < string.length(); ++i) { auto code_point = peek_code_point(i); @@ -2678,7 +2678,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type) m_current_token.set_start_position({}, nth_last_position(offset)); } -HTMLTokenizer::HTMLTokenizer(StringView const& input, String const& encoding) +HTMLTokenizer::HTMLTokenizer(StringView input, String const& encoding) { auto* decoder = TextCodec::decoder_for(encoding); VERIFY(decoder); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h index e70e97398e..23c14cba6e 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h @@ -100,7 +100,7 @@ namespace Web::HTML { class HTMLTokenizer { public: - explicit HTMLTokenizer(StringView const& input, String const& encoding); + explicit HTMLTokenizer(StringView input, String const& encoding); enum class State { #define __ENUMERATE_TOKENIZER_STATE(state) state, @@ -125,7 +125,7 @@ private: void skip(size_t count); Optional<u32> next_code_point(); Optional<u32> peek_code_point(size_t offset) const; - bool consume_next_if_match(StringView const&, CaseSensitivity = CaseSensitivity::CaseSensitive); + bool consume_next_if_match(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive); void create_new_token(HTMLToken::Type); bool current_end_tag_token_is_appropriate() const; String consume_current_builder(); diff --git a/Userland/Libraries/LibWeb/InProcessWebView.cpp b/Userland/Libraries/LibWeb/InProcessWebView.cpp index 02db62aa31..7fa34ca567 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/InProcessWebView.cpp @@ -295,7 +295,7 @@ void InProcessWebView::reload() load(url()); } -void InProcessWebView::load_html(const StringView& html, const AK::URL& url) +void InProcessWebView::load_html(StringView html, const AK::URL& url) { page().top_level_browsing_context().loader().load_html(html, url); } diff --git a/Userland/Libraries/LibWeb/InProcessWebView.h b/Userland/Libraries/LibWeb/InProcessWebView.h index 3cb56133ef..b51a384e2c 100644 --- a/Userland/Libraries/LibWeb/InProcessWebView.h +++ b/Userland/Libraries/LibWeb/InProcessWebView.h @@ -24,7 +24,7 @@ class InProcessWebView final public: virtual ~InProcessWebView() override; - void load_html(const StringView&, const AK::URL&); + void load_html(StringView, const AK::URL&); void load_empty_document(); DOM::Document* document(); diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.cpp b/Userland/Libraries/LibWeb/Layout/TextNode.cpp index e2aec8e005..2fd2ebdccc 100644 --- a/Userland/Libraries/LibWeb/Layout/TextNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/TextNode.cpp @@ -26,7 +26,7 @@ TextNode::~TextNode() { } -static bool is_all_whitespace(const StringView& string) +static bool is_all_whitespace(StringView string) { for (size_t i = 0; i < string.length(); ++i) { if (!is_ascii_space(string[i])) @@ -313,7 +313,7 @@ void TextNode::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& positi verify_cast<Label>(*parent()).handle_mousemove_on_label({}, position, button); } -TextNode::ChunkIterator::ChunkIterator(StringView const& text, LayoutMode layout_mode, bool wrap_lines, bool respect_linebreaks) +TextNode::ChunkIterator::ChunkIterator(StringView text, LayoutMode layout_mode, bool wrap_lines, bool respect_linebreaks) : m_layout_mode(layout_mode) , m_wrap_lines(wrap_lines) , m_respect_linebreaks(respect_linebreaks) diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.h b/Userland/Libraries/LibWeb/Layout/TextNode.h index fe561fba58..82fb9a0441 100644 --- a/Userland/Libraries/LibWeb/Layout/TextNode.h +++ b/Userland/Libraries/LibWeb/Layout/TextNode.h @@ -37,7 +37,7 @@ public: class ChunkIterator { public: - ChunkIterator(StringView const& text, LayoutMode, bool wrap_lines, bool respect_linebreaks); + ChunkIterator(StringView text, LayoutMode, bool wrap_lines, bool respect_linebreaks); Optional<Chunk> next(); private: diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 5eb2d9481b..50d9d8075b 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -210,7 +210,7 @@ bool FrameLoader::load(const AK::URL& url, Type type) return load(request, type); } -void FrameLoader::load_html(const StringView& html, const AK::URL& url) +void FrameLoader::load_html(StringView html, const AK::URL& url) { auto document = DOM::Document::create(url); HTML::HTMLParser parser(document, html, "utf-8"); diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.h b/Userland/Libraries/LibWeb/Loader/FrameLoader.h index 7e87e93a81..277e5a9ab4 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.h +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.h @@ -29,7 +29,7 @@ public: bool load(const AK::URL&, Type); bool load(LoadRequest&, Type); - void load_html(const StringView&, const AK::URL&); + void load_html(StringView, const AK::URL&); BrowsingContext& browsing_context() { return m_browsing_context; } const BrowsingContext& browsing_context() const { return m_browsing_context; } diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index a5b7ccf693..dbdbbc6249 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -80,7 +80,7 @@ void OutOfProcessWebView::load(const AK::URL& url) client().async_load_url(url); } -void OutOfProcessWebView::load_html(const StringView& html, const AK::URL& url) +void OutOfProcessWebView::load_html(StringView html, const AK::URL& url) { m_url = url; client().async_load_html(html, url); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index 6acdbfce56..e788f37d14 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -27,7 +27,7 @@ public: AK::URL url() const { return m_url; } void load(const AK::URL&); - void load_html(const StringView&, const AK::URL&); + void load_html(StringView, const AK::URL&); void load_empty_document(); void debug_request(const String& request, const String& argument = {}); diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index aa9e1be847..3557a7c078 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -41,7 +41,7 @@ void Page::load(LoadRequest& request) top_level_browsing_context().loader().load(request, FrameLoader::Type::Navigation); } -void Page::load_html(const StringView& html, const AK::URL& url) +void Page::load_html(StringView html, const AK::URL& url) { top_level_browsing_context().loader().load_html(html, url); } diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h index 4af4be19bc..4b5e007204 100644 --- a/Userland/Libraries/LibWeb/Page/Page.h +++ b/Userland/Libraries/LibWeb/Page/Page.h @@ -45,7 +45,7 @@ public: void load(const AK::URL&); void load(LoadRequest&); - void load_html(const StringView&, const AK::URL&); + void load_html(StringView, const AK::URL&); bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers); bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp index fc96c83e1a..5b7e29aa4f 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.cpp @@ -25,7 +25,7 @@ String url_encode(const Vector<QueryParam>& pairs, AK::URL::PercentEncodeSet per return builder.to_string(); } -Vector<QueryParam> url_decode(StringView const& input) +Vector<QueryParam> url_decode(StringView input) { // 1. Let sequences be the result of splitting input on 0x26 (&). auto sequences = input.split_view('&'); diff --git a/Userland/Libraries/LibWeb/URL/URLSearchParams.h b/Userland/Libraries/LibWeb/URL/URLSearchParams.h index 0adb6c2db3..94b07509e9 100644 --- a/Userland/Libraries/LibWeb/URL/URLSearchParams.h +++ b/Userland/Libraries/LibWeb/URL/URLSearchParams.h @@ -18,7 +18,7 @@ struct QueryParam { String value; }; String url_encode(const Vector<QueryParam>&, AK::URL::PercentEncodeSet); -Vector<QueryParam> url_decode(StringView const&); +Vector<QueryParam> url_decode(StringView); class URLSearchParams : public Bindings::Wrappable , public RefCounted<URLSearchParams> { diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index 56e2433a64..b413561c2a 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -25,7 +25,7 @@ namespace LaunchServer { static Launcher* s_the; static bool spawn(String executable, const Vector<String>& arguments); -String Handler::name_from_executable(const StringView& executable) +String Handler::name_from_executable(StringView executable) { auto separator = executable.find_last('/'); if (separator.has_value()) { diff --git a/Userland/Services/LaunchServer/Launcher.h b/Userland/Services/LaunchServer/Launcher.h index fd8a4b64e9..bc1dacdb57 100644 --- a/Userland/Services/LaunchServer/Launcher.h +++ b/Userland/Services/LaunchServer/Launcher.h @@ -27,7 +27,7 @@ struct Handler { HashTable<String> file_types {}; HashTable<String> protocols {}; - static String name_from_executable(const StringView&); + static String name_from_executable(StringView); void from_executable(Type, const String&); String to_details_str() const; }; diff --git a/Userland/Services/LoginServer/LoginWindow.h b/Userland/Services/LoginServer/LoginWindow.h index d1ff8d64d1..823eae55bf 100644 --- a/Userland/Services/LoginServer/LoginWindow.h +++ b/Userland/Services/LoginServer/LoginWindow.h @@ -20,10 +20,10 @@ public: Function<void()> on_submit; String username() const { return m_username->text(); } - void set_username(StringView const& username) { m_username->set_text(username); } + void set_username(StringView username) { m_username->set_text(username); } String password() const { return m_password->text(); } - void set_password(StringView const& password) { m_password->set_text(password); } + void set_password(StringView password) { m_password->set_text(password); } private: LoginWindow(GUI::Window* parent = nullptr); diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 3431f07606..877a2f8851 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -280,7 +280,7 @@ void Service::did_exit(int exit_code) activate(); } -Service::Service(const Core::ConfigFile& config, const StringView& name) +Service::Service(const Core::ConfigFile& config, StringView name) : Core::Object(nullptr) { VERIFY(config.has_group(name)); diff --git a/Userland/Services/SystemServer/Service.h b/Userland/Services/SystemServer/Service.h index 07a0c7adfa..dcc22a7244 100644 --- a/Userland/Services/SystemServer/Service.h +++ b/Userland/Services/SystemServer/Service.h @@ -27,7 +27,7 @@ public: void save_to(JsonObject&); private: - Service(const Core::ConfigFile&, const StringView& name); + Service(const Core::ConfigFile&, StringView name); void spawn(int socket_fd = -1); diff --git a/Userland/Services/Taskbar/TaskbarButton.cpp b/Userland/Services/Taskbar/TaskbarButton.cpp index 1ed0d239e7..d02cf99d68 100644 --- a/Userland/Services/Taskbar/TaskbarButton.cpp +++ b/Userland/Services/Taskbar/TaskbarButton.cpp @@ -53,7 +53,7 @@ void TaskbarButton::resize_event(GUI::ResizeEvent& event) return GUI::Button::resize_event(event); } -static void paint_custom_progressbar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, const StringView& text, const Gfx::Font& font, Gfx::TextAlignment text_alignment) +static void paint_custom_progressbar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, StringView text, const Gfx::Font& font, Gfx::TextAlignment text_alignment) { float range_size = max - min; float progress = (value - min) / range_size; diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index a1a23d3e4d..2839773bde 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -25,7 +25,7 @@ Client::Client(int id, RefPtr<Core::TCPSocket> socket, int ptm_fd) m_socket->on_ready_to_read = [this] { drain_socket(); }; m_ptm_notifier->on_ready_to_read = [this] { drain_pty(); }; m_parser.on_command = [this](const Command& command) { handle_command(command); }; - m_parser.on_data = [this](const StringView& data) { handle_data(data); }; + m_parser.on_data = [this](StringView data) { handle_data(data); }; m_parser.on_error = [this]() { handle_error(); }; send_commands({ { CMD_WILL, SUB_SUPPRESS_GO_AHEAD }, @@ -66,7 +66,7 @@ void Client::drain_pty() send_data(StringView(buffer, (size_t)nread)); } -void Client::handle_data(const StringView& data) +void Client::handle_data(StringView data) { write(m_ptm_fd, data.characters_without_null_termination(), data.length()); } diff --git a/Userland/Services/TelnetServer/Client.h b/Userland/Services/TelnetServer/Client.h index e717aee4b3..5ae9790f81 100644 --- a/Userland/Services/TelnetServer/Client.h +++ b/Userland/Services/TelnetServer/Client.h @@ -29,7 +29,7 @@ protected: void drain_socket(); void drain_pty(); - void handle_data(const StringView&); + void handle_data(StringView); void handle_command(const Command& command); void handle_error(); void send_data(StringView str); diff --git a/Userland/Services/TelnetServer/Parser.cpp b/Userland/Services/TelnetServer/Parser.cpp index a57b00a2a8..89aa2eeeac 100644 --- a/Userland/Services/TelnetServer/Parser.cpp +++ b/Userland/Services/TelnetServer/Parser.cpp @@ -9,7 +9,7 @@ #include "Parser.h" -void Parser::write(const StringView& data) +void Parser::write(StringView data) { for (size_t i = 0; i < data.length(); i++) { u8 ch = data[i]; diff --git a/Userland/Services/TelnetServer/Parser.h b/Userland/Services/TelnetServer/Parser.h index 57934518eb..fdc416b336 100644 --- a/Userland/Services/TelnetServer/Parser.h +++ b/Userland/Services/TelnetServer/Parser.h @@ -18,10 +18,10 @@ class Parser { public: Function<void(const Command&)> on_command; - Function<void(const StringView&)> on_data; + Function<void(StringView)> on_data; Function<void()> on_error; - void write(const StringView&); + void write(StringView); protected: enum State { diff --git a/Userland/Services/WindowServer/Cursor.cpp b/Userland/Services/WindowServer/Cursor.cpp index f0196d19bb..7f16bc36db 100644 --- a/Userland/Services/WindowServer/Cursor.cpp +++ b/Userland/Services/WindowServer/Cursor.cpp @@ -33,7 +33,7 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, int sc return adopt_ref(*new Cursor(move(bitmap), scale_factor, Gfx::CursorParams(hotspot))); } -RefPtr<Cursor> Cursor::create(const StringView& filename, const StringView& default_filename) +RefPtr<Cursor> Cursor::create(StringView filename, StringView default_filename) { auto cursor = adopt_ref(*new Cursor()); if (cursor->load(filename, default_filename)) @@ -41,11 +41,11 @@ RefPtr<Cursor> Cursor::create(const StringView& filename, const StringView& defa return {}; } -bool Cursor::load(const StringView& filename, const StringView& default_filename) +bool Cursor::load(StringView filename, StringView default_filename) { bool did_load_any = false; - auto load_bitmap = [&](const StringView& path, int scale_factor) { + auto load_bitmap = [&](StringView path, int scale_factor) { auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor); if (bitmap_or_error.is_error()) return; diff --git a/Userland/Services/WindowServer/Cursor.h b/Userland/Services/WindowServer/Cursor.h index 0dd939ba02..5a414029d6 100644 --- a/Userland/Services/WindowServer/Cursor.h +++ b/Userland/Services/WindowServer/Cursor.h @@ -15,7 +15,7 @@ namespace WindowServer { class Cursor : public RefCounted<Cursor> { public: - static RefPtr<Cursor> create(const StringView&, const StringView&); + static RefPtr<Cursor> create(StringView, StringView); static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, int); static RefPtr<Cursor> create(Gfx::StandardCursor); ~Cursor() = default; @@ -49,7 +49,7 @@ private: Cursor() { } Cursor(NonnullRefPtr<Gfx::Bitmap>&&, int, const Gfx::CursorParams&); - bool load(const StringView&, const StringView&); + bool load(StringView, StringView); void update_rect_if_animated(); HashMap<int, NonnullRefPtr<Gfx::Bitmap>> m_bitmaps; diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index e6c404d8ff..1346024b4f 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -24,7 +24,7 @@ namespace WindowServer { -u32 find_ampersand_shortcut_character(const StringView& string) +u32 find_ampersand_shortcut_character(StringView string) { Utf8View utf8_view { string }; for (auto it = utf8_view.begin(); it != utf8_view.end(); ++it) { diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index 384c54fe48..a2f72c7e12 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -164,6 +164,6 @@ private: HashMap<u32, Vector<size_t>> m_alt_shortcut_character_to_item_indices; }; -u32 find_ampersand_shortcut_character(const StringView&); +u32 find_ampersand_shortcut_character(StringView); } diff --git a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp index e6434ee21e..937f1bf028 100644 --- a/Userland/Services/WindowServer/MultiScaleBitmaps.cpp +++ b/Userland/Services/WindowServer/MultiScaleBitmaps.cpp @@ -36,7 +36,7 @@ RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create_empty() return adopt_ref(*new MultiScaleBitmaps()); } -RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView const& filename, StringView const& default_filename) +RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView filename, StringView default_filename) { auto per_scale_bitmap = adopt_ref(*new MultiScaleBitmaps()); if (per_scale_bitmap->load(filename, default_filename)) @@ -44,14 +44,14 @@ RefPtr<MultiScaleBitmaps> MultiScaleBitmaps::create(StringView const& filename, return {}; } -bool MultiScaleBitmaps::load(StringView const& filename, StringView const& default_filename) +bool MultiScaleBitmaps::load(StringView filename, StringView default_filename) { Optional<Gfx::BitmapFormat> bitmap_format; bool did_load_any = false; m_bitmaps.clear(); // If we're reloading the bitmaps get rid of the old ones - auto add_bitmap = [&](StringView const& path, int scale_factor) { + auto add_bitmap = [&](StringView path, int scale_factor) { auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path, scale_factor); if (bitmap_or_error.is_error()) return; diff --git a/Userland/Services/WindowServer/MultiScaleBitmaps.h b/Userland/Services/WindowServer/MultiScaleBitmaps.h index ee0593c44d..765efc58cc 100644 --- a/Userland/Services/WindowServer/MultiScaleBitmaps.h +++ b/Userland/Services/WindowServer/MultiScaleBitmaps.h @@ -16,13 +16,13 @@ namespace WindowServer { class MultiScaleBitmaps : public RefCounted<MultiScaleBitmaps> { public: static RefPtr<MultiScaleBitmaps> create_empty(); - static RefPtr<MultiScaleBitmaps> create(StringView const& filename, StringView const& default_filename = {}); + static RefPtr<MultiScaleBitmaps> create(StringView filename, StringView default_filename = {}); Gfx::Bitmap const& default_bitmap() const { return bitmap(1); } Gfx::Bitmap const& bitmap(int scale_factor) const; Gfx::Bitmap const* find_bitmap(int scale_factor) const; Gfx::BitmapFormat format() const { return m_format; } - bool load(StringView const& filename, StringView const& default_filename = {}); + bool load(StringView filename, StringView default_filename = {}); void add_bitmap(int scale_factor, NonnullRefPtr<Gfx::Bitmap>&&); private: diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index 8c5e0ba9df..6bb3c35394 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -125,7 +125,7 @@ void WindowFrame::reload_config() { String icons_path = WindowManager::the().palette().title_button_icons_path(); - auto reload_icon = [&](RefPtr<MultiScaleBitmaps>& icon, StringView const& path, StringView const& default_path) { + auto reload_icon = [&](RefPtr<MultiScaleBitmaps>& icon, StringView path, StringView default_path) { StringBuilder full_path; full_path.append(icons_path); full_path.append(path); diff --git a/Userland/Shell/Builtin.cpp b/Userland/Shell/Builtin.cpp index 95d99c50d2..9ce1dac6d1 100644 --- a/Userland/Shell/Builtin.cpp +++ b/Userland/Shell/Builtin.cpp @@ -1145,7 +1145,7 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A return false; } -bool Shell::has_builtin(const StringView& name) const +bool Shell::has_builtin(StringView name) const { #define __ENUMERATE_SHELL_BUILTIN(builtin) \ if (name == #builtin) { \ diff --git a/Userland/Shell/Formatter.h b/Userland/Shell/Formatter.h index 6a89a58912..c6c4e3fb1a 100644 --- a/Userland/Shell/Formatter.h +++ b/Userland/Shell/Formatter.h @@ -19,7 +19,7 @@ namespace Shell { class Formatter final : public AST::NodeVisitor { public: - Formatter(const StringView& source, ssize_t cursor = -1) + Formatter(StringView source, ssize_t cursor = -1) : m_builders({ StringBuilder { round_up_to_power_of_two(source.length(), 16) } }) , m_source(source) , m_cursor(cursor) diff --git a/Userland/Shell/ImmediateFunctions.cpp b/Userland/Shell/ImmediateFunctions.cpp index 1ca9f8f281..27b391dd1a 100644 --- a/Userland/Shell/ImmediateFunctions.cpp +++ b/Userland/Shell/ImmediateFunctions.cpp @@ -396,7 +396,7 @@ RefPtr<AST::Node> Shell::run_immediate_function(StringView str, AST::ImmediateEx return nullptr; } -bool Shell::has_immediate_function(const StringView& str) +bool Shell::has_immediate_function(StringView str) { #define __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(name) \ if (str == #name) \ diff --git a/Userland/Shell/Parser.cpp b/Userland/Shell/Parser.cpp index bc98b3f25e..2aea756487 100644 --- a/Userland/Shell/Parser.cpp +++ b/Userland/Shell/Parser.cpp @@ -63,7 +63,7 @@ bool Parser::expect(char ch) return expect(StringView { &ch, 1 }); } -bool Parser::expect(const StringView& expected) +bool Parser::expect(StringView expected) { auto offset_at_start = m_offset; auto line_at_start = line(); @@ -2130,7 +2130,7 @@ StringView Parser::consume_while(Function<bool(char)> condition) return m_input.substring_view(start_offset, m_offset - start_offset); } -bool Parser::next_is(const StringView& next) +bool Parser::next_is(StringView next) { auto start = current_position(); auto res = expect(next); diff --git a/Userland/Shell/Parser.h b/Userland/Shell/Parser.h index 003267f968..212c52c8a6 100644 --- a/Userland/Shell/Parser.h +++ b/Userland/Shell/Parser.h @@ -110,8 +110,8 @@ private: char peek(); char consume(); bool expect(char); - bool expect(const StringView&); - bool next_is(const StringView&); + bool expect(StringView); + bool next_is(StringView); void restore_to(size_t offset, AST::Position::Line line) { diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index e1a8137402..499e94eb2d 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -168,7 +168,7 @@ String Shell::expand_tilde(const String& expression) return String::formatted("{}/{}", passwd->pw_dir, path.to_string()); } -bool Shell::is_glob(const StringView& s) +bool Shell::is_glob(StringView s) { for (size_t i = 0; i < s.length(); i++) { char c = s.characters_without_null_termination()[i]; @@ -178,7 +178,7 @@ bool Shell::is_glob(const StringView& s) return false; } -Vector<StringView> Shell::split_path(const StringView& path) +Vector<StringView> Shell::split_path(StringView path) { Vector<StringView> parts; @@ -200,7 +200,7 @@ Vector<StringView> Shell::split_path(const StringView& path) return parts; } -Vector<String> Shell::expand_globs(const StringView& path, StringView base) +Vector<String> Shell::expand_globs(StringView path, StringView base) { auto explicitly_set_base = false; if (path.starts_with('/')) { @@ -238,7 +238,7 @@ Vector<String> Shell::expand_globs(const StringView& path, StringView base) return results; } -Vector<String> Shell::expand_globs(Vector<StringView> path_segments, const StringView& base) +Vector<String> Shell::expand_globs(Vector<StringView> path_segments, StringView base) { if (path_segments.is_empty()) { String base_str = base; @@ -472,7 +472,7 @@ bool Shell::invoke_function(const AST::Command& command, int& retval) return true; } -String Shell::format(const StringView& source, ssize_t& cursor) const +String Shell::format(StringView source, ssize_t& cursor) const { Formatter formatter(source, cursor); auto result = formatter.format(); @@ -513,7 +513,7 @@ String Shell::resolve_alias(const String& name) const return m_aliases.get(name).value_or({}); } -bool Shell::is_runnable(const StringView& name) +bool Shell::is_runnable(StringView name) { auto parts = name.split_view('/'); auto path = name.to_string(); @@ -527,7 +527,7 @@ bool Shell::is_runnable(const StringView& name) [](auto& name, auto& program) { return strcmp(name.characters(), program.characters()); }); } -int Shell::run_command(const StringView& cmd, Optional<SourcePosition> source_position_override) +int Shell::run_command(StringView cmd, Optional<SourcePosition> source_position_override) { // The default-constructed mode of the shell // should not be used for execution! @@ -1277,7 +1277,7 @@ String Shell::unescape_token(const String& token) return builder.build(); } -String Shell::find_in_path(const StringView& program_name) +String Shell::find_in_path(StringView program_name) { String path = getenv("PATH"); if (!path.is_empty()) { @@ -1593,7 +1593,7 @@ Vector<Line::CompletionSuggestion> Shell::complete_option(const String& program_ negate = true; option_pattern = option_pattern.substring_view(3, option_pattern.length() - 3); } - auto maybe_negate = [&](const StringView& view) { + auto maybe_negate = [&](StringView view) { static StringBuilder builder; builder.clear(); builder.append("--"); diff --git a/Userland/Shell/Shell.h b/Userland/Shell/Shell.h index ec6ed6e399..21d04505e2 100644 --- a/Userland/Shell/Shell.h +++ b/Userland/Shell/Shell.h @@ -85,27 +85,27 @@ public: Optional<AST::Position> position; }; - int run_command(const StringView&, Optional<SourcePosition> = {}); - bool is_runnable(const StringView&); + int run_command(StringView, Optional<SourcePosition> = {}); + bool is_runnable(StringView); RefPtr<Job> run_command(const AST::Command&); NonnullRefPtrVector<Job> run_commands(Vector<AST::Command>&); bool run_file(const String&, bool explicitly_invoked = true); bool run_builtin(const AST::Command&, const NonnullRefPtrVector<AST::Rewiring>&, int& retval); - bool has_builtin(const StringView&) const; + bool has_builtin(StringView) const; RefPtr<AST::Node> run_immediate_function(StringView name, AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>&); - static bool has_immediate_function(const StringView&); + static bool has_immediate_function(StringView); void block_on_job(RefPtr<Job>); void block_on_pipeline(RefPtr<AST::Pipeline>); String prompt() const; static String expand_tilde(const String&); - static Vector<String> expand_globs(const StringView& path, StringView base); - static Vector<String> expand_globs(Vector<StringView> path_segments, const StringView& base); + static Vector<String> expand_globs(StringView path, StringView base); + static Vector<String> expand_globs(Vector<StringView> path_segments, StringView base); Vector<AST::Command> expand_aliases(Vector<AST::Command>); String resolve_path(String) const; String resolve_alias(const String&) const; - static String find_in_path(const StringView& program_name); + static String find_in_path(StringView program_name); static bool has_history_event(StringView); @@ -119,7 +119,7 @@ public: bool has_function(const String&); bool invoke_function(const AST::Command&, int& retval); - String format(const StringView&, ssize_t& cursor) const; + String format(StringView, ssize_t& cursor) const; RefPtr<Line::Editor> editor() const { return m_editor; } @@ -165,8 +165,8 @@ public: }; static SpecialCharacterEscapeMode special_character_escape_mode(u32 c); - static bool is_glob(const StringView&); - static Vector<StringView> split_path(const StringView&); + static bool is_glob(StringView); + static Vector<StringView> split_path(StringView); enum class ExecutableOnly { Yes, diff --git a/Userland/Utilities/expr.cpp b/Userland/Utilities/expr.cpp index 5a6f12afe9..85471172e2 100644 --- a/Userland/Utilities/expr.cpp +++ b/Userland/Utilities/expr.cpp @@ -119,7 +119,7 @@ public: And, Or, }; - static BooleanOperator op_from(const StringView& sv) + static BooleanOperator op_from(StringView sv) { if (sv == "&") return BooleanOperator::And; @@ -204,7 +204,7 @@ public: Greater, }; - static ComparisonOperation op_from(const StringView& sv) + static ComparisonOperation op_from(StringView sv) { if (sv == "<") return ComparisonOperation::Less; @@ -274,7 +274,7 @@ public: Quotient, Remainder, }; - static ArithmeticOperation op_from(const StringView& sv) + static ArithmeticOperation op_from(StringView sv) { if (sv == "+") return ArithmeticOperation::Sum; diff --git a/Userland/Utilities/gml-format.cpp b/Userland/Utilities/gml-format.cpp index 5e3aecc1fe..bc7e53021b 100644 --- a/Userland/Utilities/gml-format.cpp +++ b/Userland/Utilities/gml-format.cpp @@ -9,9 +9,9 @@ #include <LibGUI/GMLFormatter.h> #include <unistd.h> -bool format_file(const StringView&, bool); +bool format_file(StringView, bool); -bool format_file(const StringView& path, bool inplace) +bool format_file(StringView path, bool inplace) { auto read_from_stdin = path == "-"; RefPtr<Core::File> file; diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 17a1c3a275..d94f592264 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -1308,7 +1308,7 @@ int main(int argc, char** argv) Vector<Line::CompletionSuggestion> results; - Function<void(JS::Shape const&, StringView const&)> list_all_properties = [&results, &list_all_properties](JS::Shape const& shape, auto& property_pattern) { + Function<void(JS::Shape const&, StringView)> list_all_properties = [&results, &list_all_properties](JS::Shape const& shape, auto property_pattern) { for (auto const& descriptor : shape.property_table()) { if (!descriptor.key.is_string()) continue; diff --git a/Userland/Utilities/less.cpp b/Userland/Utilities/less.cpp index 9c6868a5c1..916d39d413 100644 --- a/Userland/Utilities/less.cpp +++ b/Userland/Utilities/less.cpp @@ -93,7 +93,7 @@ static Vector<String> wrap_line(Utf8View const& string, size_t width) class Pager { public: - Pager(StringView const& filename, FILE* file, FILE* tty, StringView const& prompt) + Pager(StringView filename, FILE* file, FILE* tty, StringView prompt) : m_file(file) , m_tty(tty) , m_filename(filename) @@ -264,7 +264,7 @@ public: } private: - size_t render_status_line(StringView const& prompt, size_t off = 0, char end = '\0', bool ignored = false) + size_t render_status_line(StringView prompt, size_t off = 0, char end = '\0', bool ignored = false) { for (; prompt[off] != end && off < prompt.length(); ++off) { if (ignored) diff --git a/Userland/Utilities/mount.cpp b/Userland/Utilities/mount.cpp index 93cc57deda..a572c354fb 100644 --- a/Userland/Utilities/mount.cpp +++ b/Userland/Utilities/mount.cpp @@ -16,7 +16,7 @@ #include <string.h> #include <unistd.h> -static int parse_options(const StringView& options) +static int parse_options(StringView options) { int flags = 0; Vector<StringView> parts = options.split_view(','); diff --git a/Userland/Utilities/pro.cpp b/Userland/Utilities/pro.cpp index 28091cf683..fb596ad9c4 100644 --- a/Userland/Utilities/pro.cpp +++ b/Userland/Utilities/pro.cpp @@ -20,7 +20,7 @@ // FIXME: Move this somewhere else when it's needed (e.g. in the Browser) class ContentDispositionParser { public: - ContentDispositionParser(const StringView& value) + ContentDispositionParser(StringView value) { GenericLexer lexer(value); @@ -84,8 +84,8 @@ public: FormData, }; - const StringView& filename() const { return m_filename; } - const StringView& name() const { return m_name; } + StringView filename() const { return m_filename; } + StringView name() const { return m_name; } Kind kind() const { return m_kind; } bool might_be_wrong() const { return m_might_be_wrong; } diff --git a/Userland/Utilities/stty.cpp b/Userland/Utilities/stty.cpp index 3ace5088aa..e2a00c58b0 100644 --- a/Userland/Utilities/stty.cpp +++ b/Userland/Utilities/stty.cpp @@ -260,7 +260,7 @@ Result<void, int> apply_stty_readable_modes(StringView mode_string, termios& t) warnln("Save string has an incorrect number of parameters"); return 1; } - auto parse_hex = [&](const StringView& v) { + auto parse_hex = [&](StringView v) { tcflag_t ret = 0; for (auto c : v) { c = tolower(c); diff --git a/Userland/Utilities/sysctl.cpp b/Userland/Utilities/sysctl.cpp index 75d4e11a39..8d1a357374 100644 --- a/Userland/Utilities/sysctl.cpp +++ b/Userland/Utilities/sysctl.cpp @@ -10,7 +10,7 @@ static bool s_set_variable = false; -static String get_variable(StringView const& name) +static String get_variable(StringView name) { auto path = String::formatted("/proc/sys/{}", name); auto file = Core::File::construct(path); @@ -26,7 +26,7 @@ static String get_variable(StringView const& name) return { (char const*)buffer.data(), buffer.size(), Chomp }; } -static bool read_variable(StringView const& name) +static bool read_variable(StringView name) { auto value = get_variable(name); if (value.is_null()) @@ -35,7 +35,7 @@ static bool read_variable(StringView const& name) return true; } -static bool write_variable(StringView const& name, StringView const& value) +static bool write_variable(StringView name, StringView value) { auto old_value = get_variable(name); if (old_value.is_null()) diff --git a/Userland/Utilities/test.cpp b/Userland/Utilities/test.cpp index fc8308f050..ef5f79f307 100644 --- a/Userland/Utilities/test.cpp +++ b/Userland/Utilities/test.cpp @@ -316,7 +316,7 @@ private: static OwnPtr<Condition> parse_complex_expression(char* argv[]); -static bool should_treat_expression_as_single_string(const StringView& arg_after) +static bool should_treat_expression_as_single_string(StringView arg_after) { return arg_after.is_null() || arg_after == "-a" || arg_after == "-o"; } diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp index caa153d277..a7553e37ae 100644 --- a/Userland/Utilities/wasm.cpp +++ b/Userland/Utilities/wasm.cpp @@ -241,7 +241,7 @@ static bool pre_interpret_hook(Wasm::Configuration& config, Wasm::InstructionPoi } } -static Optional<Wasm::Module> parse(StringView const& filename) +static Optional<Wasm::Module> parse(StringView filename) { auto result = Core::File::open(filename, Core::OpenMode::ReadOnly); if (result.is_error()) { diff --git a/Userland/Utilities/xargs.cpp b/Userland/Utilities/xargs.cpp index 2e6b7d138a..c53e94b0ba 100644 --- a/Userland/Utilities/xargs.cpp +++ b/Userland/Utilities/xargs.cpp @@ -27,9 +27,9 @@ bool read_items(FILE* fp, char entry_separator, Function<Decision(StringView)>); class ParsedInitialArguments { public: - ParsedInitialArguments(Vector<const char*>&, const StringView& placeholder); + ParsedInitialArguments(Vector<const char*>&, StringView placeholder); - void for_each_joined_argument(const StringView&, Function<void(const String&)>) const; + void for_each_joined_argument(StringView, Function<void(const String&)>) const; size_t size() const { return m_all_parts.size(); } @@ -244,7 +244,7 @@ bool run_command(Vector<char*>&& child_argv, bool verbose, bool is_stdin, int de return true; } -ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, const StringView& placeholder) +ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, StringView placeholder) { m_all_parts.ensure_capacity(arguments.size()); bool some_argument_has_placeholder = false; @@ -270,7 +270,7 @@ ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, c } } -void ParsedInitialArguments::for_each_joined_argument(const StringView& separator, Function<void(const String&)> callback) const +void ParsedInitialArguments::for_each_joined_argument(StringView separator, Function<void(const String&)> callback) const { StringBuilder builder; for (auto& parts : m_all_parts) { |