mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +00:00
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
This commit is contained in:
parent
510030971b
commit
a410bb8fd5
7 changed files with 28 additions and 29 deletions
|
@ -953,8 +953,8 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...)
|
||||||
void perror(const char* s)
|
void perror(const char* s)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
dbg() << "perror(): " << s << ": " << strerror(saved_errno);
|
dbgln("perror(): {}: {}", s, strerror(saved_errno));
|
||||||
fprintf(stderr, "%s: %s\n", s, strerror(saved_errno));
|
warnln("{}: {}", s, strerror(saved_errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_mode(const char* mode)
|
static int parse_mode(const char* mode)
|
||||||
|
@ -987,7 +987,7 @@ static int parse_mode(const char* mode)
|
||||||
// Ok...
|
// Ok...
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dbg() << "Potentially unsupported fopen mode _" << mode << "_ (because of '" << *ptr << "')";
|
dbgln("Potentially unsupported fopen mode _{}_ (because of '{}')", mode, *ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[])
|
||||||
int rc = execve(candidate.characters(), argv, envp);
|
int rc = execve(candidate.characters(), argv, envp);
|
||||||
if (rc < 0 && errno != ENOENT) {
|
if (rc < 0 && errno != ENOENT) {
|
||||||
errno_rollback.set_override_rollback_value(errno);
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ int execvp(const char* filename, char* const argv[])
|
||||||
{
|
{
|
||||||
int rc = execvpe(filename, argv, environ);
|
int rc = execvpe(filename, argv, environ);
|
||||||
int saved_errno = errno;
|
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;
|
errno = saved_errno;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ ssize_t pread(int fd, void* buf, size_t count, off_t offset)
|
||||||
|
|
||||||
char* getpass(const char* prompt)
|
char* getpass(const char* prompt)
|
||||||
{
|
{
|
||||||
dbg() << "FIXME: getpass(\"" << prompt << "\")";
|
dbgln("FIXME: getpass('{}')", prompt);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return (u8)0;
|
return (u8)0;
|
||||||
}
|
}
|
||||||
// dbg() << "read_byte: " << String::format("%x", data[current]);
|
|
||||||
return data[current++];
|
return data[current++];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +66,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
// Compression method
|
// Compression method
|
||||||
auto method = read_byte();
|
auto method = read_byte();
|
||||||
if (method != 8) {
|
if (method != 8) {
|
||||||
dbg() << "get_gzip_payload: Wrong compression method = " << method;
|
dbgln("get_gzip_payload: Wrong compression method={}", method);
|
||||||
return Optional<ByteBuffer>();
|
return Optional<ByteBuffer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||||
// FEXTRA
|
// FEXTRA
|
||||||
if (flags & 4) {
|
if (flags & 4) {
|
||||||
u16 length = read_byte() & read_byte() << 8;
|
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;
|
current += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data)
|
||||||
#endif
|
#endif
|
||||||
destination.grow(destination.size() * 2);
|
destination.grow(destination.size() * 2);
|
||||||
} else {
|
} else {
|
||||||
dbg() << "Gzip::decompress: Error. puff() returned: " << puff_ret;
|
dbgln("Gzip::decompress: Error. puff() returned: {}", puff_ret);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ bool Socket::connect(const String& hostname, int port)
|
||||||
{
|
{
|
||||||
auto* hostent = gethostbyname(hostname.characters());
|
auto* hostent = gethostbyname(hostname.characters());
|
||||||
if (!hostent) {
|
if (!hostent) {
|
||||||
dbg() << "Socket::connect: Unable to resolve '" << hostname << "'";
|
dbgln("Socket::connect: Unable to resolve '{}'", hostname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ ByteBuffer UDPServer::receive(size_t size, sockaddr_in& in)
|
||||||
socklen_t in_len = sizeof(in);
|
socklen_t in_len = sizeof(in);
|
||||||
ssize_t rlen = ::recvfrom(m_fd, buf.data(), size, 0, (sockaddr*)&in, &in_len);
|
ssize_t rlen = ::recvfrom(m_fd, buf.data(), size, 0, (sockaddr*)&in, &in_len);
|
||||||
if (rlen < 0) {
|
if (rlen < 0) {
|
||||||
dbg() << "recvfrom: " << strerror(errno);
|
dbgln("recvfrom: {}", strerror(errno));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -780,7 +780,7 @@ Vector<Token> Lexer::lex()
|
||||||
commit_token(Token::Type::Identifier);
|
commit_token(Token::Type::Identifier);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dbg() << "Unimplemented token character: " << ch;
|
dbgln("Unimplemented token character: {}", ch);
|
||||||
emit_token(Token::Type::Unknown);
|
emit_token(Token::Type::Unknown);
|
||||||
}
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
|
|
|
@ -35,14 +35,14 @@ namespace Crypto {
|
||||||
static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& number)
|
static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger& number)
|
||||||
{
|
{
|
||||||
if (length < 3) {
|
if (length < 3) {
|
||||||
dbg() << "invalid header size";
|
dbgln("invalid header size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t x { 0 };
|
size_t x { 0 };
|
||||||
// must start with 0x02
|
// must start with 0x02
|
||||||
if ((in[x++] & 0x1f) != 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger&
|
||||||
if ((x & 0x80) == 0) {
|
if ((x & 0x80) == 0) {
|
||||||
// overflow
|
// overflow
|
||||||
if (x + z > length) {
|
if (x + z > length) {
|
||||||
dbg() << "would overflow " << z + x << " > " << length;
|
dbgln("would overflow {} > {}", z + x, length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger&
|
||||||
|
|
||||||
// overflow
|
// overflow
|
||||||
if ((x + z) > length || z > 4 || z == 0) {
|
if ((x + z) > length || z > 4 || z == 0) {
|
||||||
dbg() << "would overflow " << z + x << " > " << length;
|
dbgln("would overflow {} > {}", z + x, length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger&
|
||||||
|
|
||||||
// overflow
|
// overflow
|
||||||
if (x + y > length) {
|
if (x + y > length) {
|
||||||
dbg() << "would overflow " << y + x << " > " << length;
|
dbgln("would overflow {} > {}", y + x, length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ static bool der_decode_integer(const u8* in, size_t length, UnsignedBigInteger&
|
||||||
|
|
||||||
// see if it's negative
|
// see if it's negative
|
||||||
if (in[x] & 0x80) {
|
if (in[x] & 0x80) {
|
||||||
dbg() << "negative bigint unsupported in der_decode_integer";
|
dbgln("negative bigint unsupported in der_decode_integer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ constexpr static bool der_length_sequence(ASN1::List* list, size_t in_length, si
|
||||||
y += x;
|
y += x;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dbg() << "Unhandled Kind " << ASN1::kind_name(type);
|
dbgln("Unhandled Kind {}", ASN1::kind_name(type));
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ constexpr static bool der_length_sequence(ASN1::List* list, size_t in_length, si
|
||||||
} else if (y < 16777216ul) {
|
} else if (y < 16777216ul) {
|
||||||
y += 5;
|
y += 5;
|
||||||
} else {
|
} else {
|
||||||
dbg() << "invalid length " << y;
|
dbgln("invalid length {}", y);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*out_length = y;
|
*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)
|
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) {
|
if (in_length < 2) {
|
||||||
dbg() << "header too small";
|
dbgln("header too small");
|
||||||
return false; // invalid header
|
return false; // invalid header
|
||||||
}
|
}
|
||||||
size_t x { 0 };
|
size_t x { 0 };
|
||||||
if (in[x++] != 0x30) {
|
if (in[x++] != 0x30) {
|
||||||
dbg() << "not a sequence: " << in[x - 1];
|
dbgln("not a sequence: {}", in[x - 1]);
|
||||||
return false; // not a sequence
|
return false; // not a sequence
|
||||||
}
|
}
|
||||||
size_t block_size { 0 };
|
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++];
|
block_size = in[x++];
|
||||||
} else if (in[x] & 0x80) {
|
} else if (in[x] & 0x80) {
|
||||||
if ((in[x] < 0x81) || (in[x] > 0x83)) {
|
if ((in[x] < 0x81) || (in[x] > 0x83)) {
|
||||||
dbg() << "invalid length element " << in[x];
|
dbgln("invalid length element {}", in[x]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = in[x++] & 0x7f;
|
y = in[x++] & 0x7f;
|
||||||
|
|
||||||
if (x + y > in_length) {
|
if (x + y > in_length) {
|
||||||
dbg() << "would overflow " << x + y << " -> " << in_length;
|
dbgln("would overflow {} > {}", x + y, in_length);
|
||||||
return false; // overflow
|
return false; // overflow
|
||||||
}
|
}
|
||||||
block_size = 0;
|
block_size = 0;
|
||||||
|
@ -299,7 +299,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis
|
||||||
|
|
||||||
// overflow
|
// overflow
|
||||||
if (x + block_size > in_length) {
|
if (x + block_size > in_length) {
|
||||||
dbg() << "would overflow " << x + block_size << " -> " << in_length;
|
dbgln("would overflow {} > {}", x + block_size, in_length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis
|
||||||
break;
|
break;
|
||||||
case ASN1::Kind::Sequence:
|
case ASN1::Kind::Sequence:
|
||||||
if ((in[x] & 0x3f) != 0x30) {
|
if ((in[x] & 0x3f) != 0x30) {
|
||||||
dbg() << "Not a sequence: " << (in[x] & 0x3f);
|
dbgln("Not a sequence: {}", (in[x] & 0x3f));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
z = in_length;
|
z = in_length;
|
||||||
|
@ -357,7 +357,7 @@ static inline bool der_decode_sequence(const u8* in, size_t in_length, ASN1::Lis
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dbg() << "Unhandled ASN1 kind " << ASN1::kind_name(kind);
|
dbgln("Unhandled ASN1 kind {}", ASN1::kind_name(kind));
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
break;
|
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)
|
for (size_t i = 0; i < out_length; ++i)
|
||||||
if (!list[i].used) {
|
if (!list[i].used) {
|
||||||
dbg() << "index " << i << " was not read";
|
dbgln("index {} was not read", i);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue