diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index 99d6f15a1a..1cdf9d4a73 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -953,8 +953,8 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...) void perror(const char* s) { int saved_errno = errno; - dbg() << "perror(): " << s << ": " << strerror(saved_errno); - fprintf(stderr, "%s: %s\n", s, strerror(saved_errno)); + dbgln("perror(): {}: {}", s, strerror(saved_errno)); + warnln("{}: {}", s, strerror(saved_errno)); } static int parse_mode(const char* mode) @@ -987,7 +987,7 @@ static int parse_mode(const char* mode) // Ok... break; default: - dbg() << "Potentially unsupported fopen mode _" << mode << "_ (because of '" << *ptr << "')"; + dbgln("Potentially unsupported fopen mode _{}_ (because of '{}')", mode, *ptr); } } diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index de5838be4a..b35f011289 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -133,7 +133,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[]) int rc = execve(candidate.characters(), argv, envp); if (rc < 0 && errno != ENOENT) { errno_rollback.set_override_rollback_value(errno); - dbg() << "execvpe() failed on attempt (" << candidate << ") with " << strerror(errno); + dbgln("execvpe() failed on attempt ({}) with {}", candidate, strerror(errno)); return rc; } } @@ -146,7 +146,7 @@ int execvp(const char* filename, char* const argv[]) { int rc = execvpe(filename, argv, environ); int saved_errno = errno; - dbg() << "execvp() about to return " << rc << " with errno=" << saved_errno; + dbgln("execvp() about to return {} with errno={}", rc, saved_errno); errno = saved_errno; return rc; } @@ -708,7 +708,7 @@ ssize_t pread(int fd, void* buf, size_t count, off_t offset) char* getpass(const char* prompt) { - dbg() << "FIXME: getpass(\"" << prompt << "\")"; + dbgln("FIXME: getpass('{}')", prompt); ASSERT_NOT_REACHED(); } diff --git a/Libraries/LibCore/Gzip.cpp b/Libraries/LibCore/Gzip.cpp index 268e9a4702..49cf14c3a0 100644 --- a/Libraries/LibCore/Gzip.cpp +++ b/Libraries/LibCore/Gzip.cpp @@ -50,7 +50,6 @@ static Optional get_gzip_payload(const ByteBuffer& data) ASSERT_NOT_REACHED(); return (u8)0; } - // dbg() << "read_byte: " << String::format("%x", data[current]); return data[current++]; }; @@ -67,7 +66,7 @@ static Optional get_gzip_payload(const ByteBuffer& data) // Compression method auto method = read_byte(); if (method != 8) { - dbg() << "get_gzip_payload: Wrong compression method = " << method; + dbgln("get_gzip_payload: Wrong compression method={}", method); return Optional(); } @@ -79,7 +78,7 @@ static Optional get_gzip_payload(const ByteBuffer& data) // FEXTRA if (flags & 4) { u16 length = read_byte() & read_byte() << 8; - dbg() << "get_gzip_payload: Header has FEXTRA flag set. Length = " << length; + dbgln("get_gzip_payload: Header has FEXTRA flag set. length={}", length); current += length; } @@ -155,7 +154,7 @@ Optional Gzip::decompress(const ByteBuffer& data) #endif destination.grow(destination.size() * 2); } else { - dbg() << "Gzip::decompress: Error. puff() returned: " << puff_ret; + dbgln("Gzip::decompress: Error. puff() returned: {}", puff_ret); ASSERT_NOT_REACHED(); } } diff --git a/Libraries/LibCore/Socket.cpp b/Libraries/LibCore/Socket.cpp index 98d8b2566a..4ced6734b1 100644 --- a/Libraries/LibCore/Socket.cpp +++ b/Libraries/LibCore/Socket.cpp @@ -75,7 +75,7 @@ bool Socket::connect(const String& hostname, int port) { auto* hostent = gethostbyname(hostname.characters()); if (!hostent) { - dbg() << "Socket::connect: Unable to resolve '" << hostname << "'"; + dbgln("Socket::connect: Unable to resolve '{}'", hostname); return false; } diff --git a/Libraries/LibCore/UDPServer.cpp b/Libraries/LibCore/UDPServer.cpp index b7aaea78e7..6716865e6b 100644 --- a/Libraries/LibCore/UDPServer.cpp +++ b/Libraries/LibCore/UDPServer.cpp @@ -86,7 +86,7 @@ ByteBuffer UDPServer::receive(size_t size, sockaddr_in& in) socklen_t in_len = sizeof(in); ssize_t rlen = ::recvfrom(m_fd, buf.data(), size, 0, (sockaddr*)&in, &in_len); if (rlen < 0) { - dbg() << "recvfrom: " << strerror(errno); + dbgln("recvfrom: {}", strerror(errno)); return {}; } diff --git a/Libraries/LibCpp/Lexer.cpp b/Libraries/LibCpp/Lexer.cpp index 0153c21760..831822e5a5 100644 --- a/Libraries/LibCpp/Lexer.cpp +++ b/Libraries/LibCpp/Lexer.cpp @@ -780,7 +780,7 @@ Vector Lexer::lex() commit_token(Token::Type::Identifier); continue; } - dbg() << "Unimplemented token character: " << ch; + dbgln("Unimplemented token character: {}", ch); emit_token(Token::Type::Unknown); } return tokens; diff --git a/Libraries/LibCrypto/ASN1/DER.h b/Libraries/LibCrypto/ASN1/DER.h index 9f78efba97..0c4c63e2f1 100644 --- a/Libraries/LibCrypto/ASN1/DER.h +++ b/Libraries/LibCrypto/ASN1/DER.h @@ -35,14 +35,14 @@ namespace Crypto { static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& number) { if (length < 3) { - dbg() << "invalid header size"; + dbgln("invalid header size"); return false; } size_t x { 0 }; // must start with 0x02 if ((in[x++] & 0x1f) != 0x02) { - dbg() << "not an integer " << in[x - 1] << " (" << in[x] << " follows)"; + dbgln("not an integer {} ({} follows)", in[x - 1], in[x]); return false; } @@ -51,7 +51,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& if ((x & 0x80) == 0) { // overflow if (x + z > length) { - dbg() << "would overflow " << z + x << " > " << length; + dbgln("would overflow {} > {}", z + x, length); return false; } @@ -63,7 +63,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& // overflow if ((x + z) > length || z > 4 || z == 0) { - dbg() << "would overflow " << z + x << " > " << length; + dbgln("would overflow {} > {}", z + x, length); return false; } @@ -74,7 +74,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& // overflow if (x + y > length) { - dbg() << "would overflow " << y + x << " > " << length; + dbgln("would overflow {} > {}", y + x, length); return false; } @@ -84,7 +84,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& // see if it's negative if (in[x] & 0x80) { - dbg() << "negative bigint unsupported in der_decode_integer"; + dbgln("negative bigint unsupported in der_decode_integer"); return false; } @@ -243,7 +243,7 @@ constexpr static bool der_length_sequence(ASN1::List* list, size_t in_length, si y += x; break; default: - dbg() << "Unhandled Kind " << ASN1::kind_name(type); + dbgln("Unhandled Kind {}", ASN1::kind_name(type)); ASSERT_NOT_REACHED(); break; } @@ -258,7 +258,7 @@ constexpr static bool der_length_sequence(ASN1::List* list, size_t in_length, si } else if (y < 16777216ul) { y += 5; } else { - dbg() << "invalid length " << y; + dbgln("invalid length {}", y); return false; } *out_length = y; @@ -268,12 +268,12 @@ constexpr static bool der_length_sequence(ASN1::List* list, size_t in_length, si static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::List* list, size_t out_length, bool ordered = true) { if (in_length < 2) { - dbg() << "header too small"; + dbgln("header too small"); return false; // invalid header } size_t x { 0 }; if (in[x++] != 0x30) { - dbg() << "not a sequence: " << in[x - 1]; + dbgln("not a sequence: {}", in[x - 1]); return false; // not a sequence } size_t block_size { 0 }; @@ -282,14 +282,14 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis block_size = in[x++]; } else if (in[x] & 0x80) { if ((in[x] < 0x81) || (in[x] > 0x83)) { - dbg() << "invalid length element " << in[x]; + dbgln("invalid length element {}", in[x]); return false; } y = in[x++] & 0x7f; if (x + y > in_length) { - dbg() << "would overflow " << x + y << " -> " << in_length; + dbgln("would overflow {} > {}", x + y, in_length); return false; // overflow } block_size = 0; @@ -299,7 +299,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis // overflow if (x + block_size > in_length) { - dbg() << "would overflow " << x + block_size << " -> " << in_length; + dbgln("would overflow {} > {}", x + block_size, in_length); return false; } @@ -343,7 +343,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis break; case ASN1::Kind::Sequence: if ((in[x] & 0x3f) != 0x30) { - dbg() << "Not a sequence: " << (in[x] & 0x3f); + dbgln("Not a sequence: {}", (in[x] & 0x3f)); return false; } z = in_length; @@ -357,7 +357,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis } break; default: - dbg() << "Unhandled ASN1 kind " << ASN1::kind_name(kind); + dbgln("Unhandled ASN1 kind {}", ASN1::kind_name(kind)); ASSERT_NOT_REACHED(); break; } @@ -369,7 +369,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis } for (size_t i = 0; i < out_length; ++i) if (!list[i].used) { - dbg() << "index " << i << " was not read"; + dbgln("index {} was not read", i); return false; }