diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-16 08:47:46 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-16 17:49:42 +0200 |
commit | 53d015082749b9bf43a2160d5553bc0e9e1086ef (patch) | |
tree | 75a4730a88c2a99bb3d0af0200274d1c72f430d7 /Userland/Libraries | |
parent | c4d0b0cd6b0d0b2c773ce8f11ac9d0aaec36f9b6 (diff) | |
download | serenity-53d015082749b9bf43a2160d5553bc0e9e1086ef.zip |
AK+Userland: Remove nullability feature for the ByteBuffer type
Nobody seems to use this particular feature, in fact there were some
bugs which were uncovered by removing operator bool.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibCore/IODevice.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/Job.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibHTTP/Job.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibTLS/ClientHandshake.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Loader/Resource.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 2 |
7 files changed, 6 insertions, 12 deletions
diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp index cde5c55548..6dd7e3dc9c 100644 --- a/Userland/Libraries/LibCore/IODevice.cpp +++ b/Userland/Libraries/LibCore/IODevice.cpp @@ -33,8 +33,6 @@ const char* IODevice::error_string() const int IODevice::read(u8* buffer, int length) { auto read_buffer = read(length); - if (read_buffer.is_null()) - return 0; memcpy(buffer, read_buffer.data(), length); return read_buffer.size(); } @@ -151,8 +149,6 @@ ByteBuffer IODevice::read_all() } data.append((const u8*)read_buffer, nread); } - if (data.is_empty()) - return {}; return ByteBuffer::copy(data.data(), data.size()); } diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index e7c2f20eca..bd0dfa5db3 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -110,7 +110,7 @@ void Job::on_socket_connected() auto read_size = 64 * KiB; auto payload = receive(read_size); - if (!payload) { + if (payload.is_empty()) { if (eof()) { finish_up(); return IterationDecision::Break; diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 6ead5fad10..bed513576b 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -283,7 +283,7 @@ void Job::on_socket_connected() } auto payload = receive(read_size); - if (!payload) { + if (payload.is_empty()) { if (eof()) { finish_up(); return IterationDecision::Break; diff --git a/Userland/Libraries/LibTLS/ClientHandshake.cpp b/Userland/Libraries/LibTLS/ClientHandshake.cpp index c012df5bc7..ebe9949abc 100644 --- a/Userland/Libraries/LibTLS/ClientHandshake.cpp +++ b/Userland/Libraries/LibTLS/ClientHandshake.cpp @@ -474,9 +474,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer) } break; case Finished: - if (m_context.cached_handshake) { - m_context.cached_handshake.clear(); - } + m_context.cached_handshake.clear(); if (m_context.handshake_messages[10] >= 1) { dbgln("unexpected finished message"); payload_res = (i8)Error::UnexpectedMessage; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp index 83366ae1f7..244ba6c0cc 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp @@ -431,7 +431,7 @@ public: if (type != CSS::Selector::SimpleSelector::Type::Universal) { while (is_valid_selector_char(peek())) buffer.append(consume_one()); - PARSE_VERIFY(!buffer.is_null()); + PARSE_VERIFY(!buffer.is_empty()); } auto value = String::copy(buffer); diff --git a/Userland/Libraries/LibWeb/Loader/Resource.h b/Userland/Libraries/LibWeb/Loader/Resource.h index 1575040ba0..1fca238e3e 100644 --- a/Userland/Libraries/LibWeb/Loader/Resource.h +++ b/Userland/Libraries/LibWeb/Loader/Resource.h @@ -42,7 +42,7 @@ public: bool is_failed() const { return m_failed; } const String& error() const { return m_error; } - bool has_encoded_data() const { return !m_encoded_data.is_null(); } + bool has_encoded_data() const { return !m_encoded_data.is_empty(); } const URL& url() const { return m_request.url(); } const ByteBuffer& encoded_data() const { return m_encoded_data; } diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index baa68b4727..250f22fc39 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -47,7 +47,7 @@ void XMLHttpRequest::fire_progress_event(const String& event_name, u64 transmitt String XMLHttpRequest::response_text() const { - if (m_response_object.is_null()) + if (m_response_object.is_empty()) return {}; return String::copy(m_response_object); } |