mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:47:45 +00:00
AK: Use size_t for ByteBuffer sizes
This matches what we already do for string types.
This commit is contained in:
parent
1dfc66c7cc
commit
88b9fcb976
14 changed files with 75 additions and 70 deletions
|
@ -90,7 +90,7 @@ public:
|
|||
s_rpc_clients.set(m_client_id, this);
|
||||
add_child(*m_socket);
|
||||
m_socket->on_ready_to_read = [this] {
|
||||
i32 length;
|
||||
u32 length;
|
||||
int nread = m_socket->read((u8*)&length, sizeof(length));
|
||||
if (nread == 0) {
|
||||
dbg() << "RPC client disconnected";
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
void send_response(const JsonObject& response)
|
||||
{
|
||||
auto serialized = response.to_string();
|
||||
i32 length = serialized.length();
|
||||
u32 length = serialized.length();
|
||||
m_socket->write((const u8*)&length, sizeof(length));
|
||||
m_socket->write(serialized);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ bool CGzip::is_compressed(const ByteBuffer& data)
|
|||
// see: https://tools.ietf.org/html/rfc1952#page-5
|
||||
static Optional<ByteBuffer> get_gzip_payload(const ByteBuffer& data)
|
||||
{
|
||||
int current = 0;
|
||||
size_t current = 0;
|
||||
auto read_byte = [&]() {
|
||||
if (current >= data.size()) {
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -82,7 +82,7 @@ Optional<HttpRequest> HttpRequest::from_raw_request(const ByteBuffer& raw_reques
|
|||
};
|
||||
|
||||
State state { State::InMethod };
|
||||
int index = 0;
|
||||
size_t index = 0;
|
||||
|
||||
auto peek = [&](int offset = 0) -> u8 {
|
||||
if (index + offset >= raw_request.size())
|
||||
|
|
|
@ -162,12 +162,12 @@ ByteBuffer Socket::receive(int max_size)
|
|||
|
||||
bool Socket::send(const ByteBuffer& data)
|
||||
{
|
||||
int nsent = ::send(fd(), data.data(), data.size(), 0);
|
||||
ssize_t nsent = ::send(fd(), data.data(), data.size(), 0);
|
||||
if (nsent < 0) {
|
||||
set_error(errno);
|
||||
return false;
|
||||
}
|
||||
ASSERT(nsent == data.size());
|
||||
ASSERT(static_cast<size_t>(nsent) == data.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue