1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)

Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
This commit is contained in:
AnotherTest 2021-02-07 15:33:24 +03:30 committed by Andreas Kling
parent 1f8a633cc7
commit 09a43969ba
95 changed files with 427 additions and 425 deletions

View file

@ -36,14 +36,14 @@ namespace HTTP {
static ByteBuffer handle_content_encoding(const ByteBuffer& buf, const String& content_encoding)
{
dbgln<JOB_DEBUG>("Job::handle_content_encoding: buf has content_encoding={}", content_encoding);
dbgln_if(JOB_DEBUG, "Job::handle_content_encoding: buf has content_encoding={}", content_encoding);
if (content_encoding == "gzip") {
if (!Core::Gzip::is_compressed(buf)) {
dbgln("Job::handle_content_encoding: buf is not gzip compressed!");
}
dbgln<JOB_DEBUG>("Job::handle_content_encoding: buf is gzip compressed!");
dbgln_if(JOB_DEBUG, "Job::handle_content_encoding: buf is gzip compressed!");
auto uncompressed = Core::Gzip::decompress(buf);
if (!uncompressed.has_value()) {
@ -77,7 +77,7 @@ void Job::flush_received_buffers()
{
if (!m_can_stream_response || m_buffered_size == 0)
return;
dbgln<JOB_DEBUG>("Job: Flushing received buffers: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size());
dbgln_if(JOB_DEBUG, "Job: Flushing received buffers: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size());
for (size_t i = 0; i < m_received_buffers.size(); ++i) {
auto& payload = m_received_buffers[i];
auto written = do_write(payload);
@ -92,7 +92,7 @@ void Job::flush_received_buffers()
payload = payload.slice(written, payload.size() - written);
break;
}
dbgln<JOB_DEBUG>("Job: Flushing received buffers done: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size());
dbgln_if(JOB_DEBUG, "Job: Flushing received buffers done: have {} bytes in {} buffers", m_buffered_size, m_received_buffers.size());
}
void Job::on_socket_connected()
@ -198,10 +198,10 @@ void Job::on_socket_connected()
m_headers.set(name, value);
if (name.equals_ignoring_case("Content-Encoding")) {
// Assume that any content-encoding means that we can't decode it as a stream :(
dbgln<JOB_DEBUG>("Content-Encoding {} detected, cannot stream output :(", value);
dbgln_if(JOB_DEBUG, "Content-Encoding {} detected, cannot stream output :(", value);
m_can_stream_response = false;
}
dbgln<JOB_DEBUG>("Job: [{}] = '{}'", name, value);
dbgln_if(JOB_DEBUG, "Job: [{}] = '{}'", name, value);
return;
}
ASSERT(m_state == State::InBody);
@ -216,7 +216,7 @@ void Job::on_socket_connected()
// read size
auto size_data = read_line(PAGE_SIZE);
auto size_lines = size_data.view().lines();
dbgln<JOB_DEBUG>("Job: Received a chunk with size '{}'", size_data);
dbgln_if(JOB_DEBUG, "Job: Received a chunk with size '{}'", size_data);
if (size_lines.size() == 0) {
dbgln("Job: Reached end of stream");
finish_up();
@ -239,26 +239,26 @@ void Job::on_socket_connected()
m_current_chunk_total_size = 0;
m_current_chunk_remaining_size = 0;
dbgln<JOB_DEBUG>("Job: Received the last chunk with extensions '{}'", size_string.substring_view(1, size_string.length() - 1));
dbgln_if(JOB_DEBUG, "Job: Received the last chunk with extensions '{}'", size_string.substring_view(1, size_string.length() - 1));
} else {
m_current_chunk_total_size = size;
m_current_chunk_remaining_size = size;
read_size = size;
dbgln<JOB_DEBUG>("Job: Chunk of size '{}' started", size);
dbgln_if(JOB_DEBUG, "Job: Chunk of size '{}' started", size);
}
}
} else {
read_size = remaining;
dbgln<JOB_DEBUG>("Job: Resuming chunk with '{}' bytes left over", remaining);
dbgln_if(JOB_DEBUG, "Job: Resuming chunk with '{}' bytes left over", remaining);
}
} else {
auto transfer_encoding = m_headers.get("Transfer-Encoding");
if (transfer_encoding.has_value()) {
auto encoding = transfer_encoding.value();
dbgln<JOB_DEBUG>("Job: This content has transfer encoding '{}'", encoding);
dbgln_if(JOB_DEBUG, "Job: This content has transfer encoding '{}'", encoding);
if (encoding.equals_ignoring_case("chunked")) {
m_current_chunk_remaining_size = -1;
goto read_chunk_size;
@ -289,9 +289,9 @@ void Job::on_socket_connected()
if (m_current_chunk_remaining_size.has_value()) {
auto size = m_current_chunk_remaining_size.value() - payload.size();
dbgln<JOB_DEBUG>("Job: We have {} bytes left over in this chunk", size);
dbgln_if(JOB_DEBUG, "Job: We have {} bytes left over in this chunk", size);
if (size == 0) {
dbgln<JOB_DEBUG>("Job: Finished a chunk of {} bytes", m_current_chunk_total_size.value());
dbgln_if(JOB_DEBUG, "Job: Finished a chunk of {} bytes", m_current_chunk_total_size.value());
if (m_current_chunk_total_size.value() == 0) {
m_state = State::Trailers;