1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

Everywhere: Debug macros instead of constexpr.

This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
This commit is contained in:
asynts 2021-01-23 23:59:27 +01:00 committed by Andreas Kling
parent bb483f7ef4
commit 8465683dcf
98 changed files with 414 additions and 972 deletions

View file

@ -112,7 +112,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
return (i8)Error::NoCommonCipher;
}
m_context.cipher = cipher;
dbgln<debug_tls>("Cipher: {}", (u16)cipher);
dbgln<TLS_DEBUG>("Cipher: {}", (u16)cipher);
// The handshake hash function is _always_ SHA256
m_context.handshake_hash.initialize(Crypto::Hash::HashKind::SHA256);
@ -146,7 +146,7 @@ ssize_t TLSv12::handle_hello(ReadonlyBytes buffer, WritePacketStage& write_packe
u16 extension_length = AK::convert_between_host_and_network_endian(*(const u16*)buffer.offset_pointer(res));
res += 2;
dbgln<debug_tls>("extension {} with length {}", (u16)extension_type, extension_length);
dbgln<TLS_DEBUG>("extension {} with length {}", (u16)extension_type, extension_length);
if (extension_length) {
if (buffer.size() - res < extension_length) {
@ -218,12 +218,12 @@ ssize_t TLSv12::handle_finished(ReadonlyBytes buffer, WritePacketStage& write_pa
u32 size = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2];
if (size < 12) {
dbgln<debug_tls>("finished packet smaller than minimum size: {}", size);
dbgln<TLS_DEBUG>("finished packet smaller than minimum size: {}", size);
return (i8)Error::BrokenPacket;
}
if (size < buffer.size() - index) {
dbgln<debug_tls>("not enough data after length: {} > {}", size, buffer.size() - index);
dbgln<TLS_DEBUG>("not enough data after length: {} > {}", size, buffer.size() - index);
return (i8)Error::NeedMoreData;
}
@ -324,7 +324,7 @@ ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)
auto type = buffer[0];
auto write_packets { WritePacketStage::Initial };
size_t payload_size = buffer[1] * 0x10000 + buffer[2] * 0x100 + buffer[3] + 3;
dbgln<debug_tls>("payload size: {} buffer length: {}", payload_size, buffer_length);
dbgln<TLS_DEBUG>("payload size: {} buffer length: {}", payload_size, buffer_length);
if (payload_size + 1 > buffer_length)
return (i8)Error::NeedMoreData;