mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:57:34 +00:00
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.
This commit is contained in:
parent
c4d0b0cd6b
commit
53d0150827
16 changed files with 12 additions and 36 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue