1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00

Kernel: Fix all compiler warnings.

This commit is contained in:
Andreas Kling 2019-06-22 16:22:34 +02:00
parent 17acc1e0a8
commit 46a06c23e3
13 changed files with 19 additions and 19 deletions

View file

@ -139,8 +139,9 @@ ByteBuffer DiskBackedFS::read_blocks(unsigned index, unsigned count) const
return blocks; return blocks;
} }
void DiskBackedFS::set_block_size(unsigned block_size) void DiskBackedFS::set_block_size(int block_size)
{ {
ASSERT(block_size > 0);
if (block_size == m_block_size) if (block_size == m_block_size)
return; return;
m_block_size = block_size; m_block_size = block_size;

View file

@ -17,7 +17,7 @@ public:
protected: protected:
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&); explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
void set_block_size(unsigned); void set_block_size(int);
ByteBuffer read_block(unsigned index) const; ByteBuffer read_block(unsigned index) const;
ByteBuffer read_blocks(unsigned index, unsigned count) const; ByteBuffer read_blocks(unsigned index, unsigned count) const;

View file

@ -294,7 +294,7 @@ ByteBuffer procfs$pid_vmo(InodeIdentifier identifier)
region->vmo().name().characters(), region->vmo().name().characters(),
&region->vmo(), &region->vmo(),
region->vmo().ref_count()); region->vmo().ref_count());
for (size_t i = 0; i < region->vmo().page_count(); ++i) { for (int i = 0; i < region->vmo().page_count(); ++i) {
auto& physical_page = region->vmo().physical_pages()[i]; auto& physical_page = region->vmo().physical_pages()[i];
builder.appendf("P%x%s(%u) ", builder.appendf("P%x%s(%u) ",
physical_page ? physical_page->paddr().get() : 0, physical_page ? physical_page->paddr().get() : 0,

View file

@ -246,7 +246,7 @@ ssize_t IPv4Socket::recvfrom(FileDescription& description, void* buffer, size_t
return ipv4_packet.payload_size(); return ipv4_packet.payload_size();
} }
return protocol_receive(packet.data, buffer, buffer_length, flags, addr, addr_length); return protocol_receive(packet.data, buffer, buffer_length, flags);
} }
void IPv4Socket::did_receive(const IPv4Address& source_address, word source_port, ByteBuffer&& packet) void IPv4Socket::did_receive(const IPv4Address& source_address, word source_port, ByteBuffer&& packet)

View file

@ -50,7 +50,7 @@ protected:
int allocate_local_port_if_needed(); int allocate_local_port_if_needed();
virtual KResult protocol_bind() { return KSuccess; } virtual KResult protocol_bind() { return KSuccess; }
virtual int protocol_receive(const ByteBuffer&, void*, size_t, int, sockaddr*, socklen_t*) { return -ENOTIMPL; } virtual int protocol_receive(const ByteBuffer&, void*, size_t, int) { return -ENOTIMPL; }
virtual int protocol_send(const void*, int) { return -ENOTIMPL; } virtual int protocol_send(const void*, int) { return -ENOTIMPL; }
virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; } virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; }
virtual int protocol_allocate_local_port() { return 0; } virtual int protocol_allocate_local_port() { return 0; }

View file

@ -43,10 +43,9 @@ NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
return adopt(*new TCPSocket(protocol)); return adopt(*new TCPSocket(protocol));
} }
int TCPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) int TCPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags)
{ {
(void)flags; (void)flags;
(void)addr_length;
ASSERT(!packet_buffer.is_null()); ASSERT(!packet_buffer.is_null());
auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer()); auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer());
auto& tcp_packet = *static_cast<const TCPPacket*>(ipv4_packet.payload()); auto& tcp_packet = *static_cast<const TCPPacket*>(ipv4_packet.payload());

View file

@ -33,7 +33,7 @@ private:
static NetworkOrdered<word> compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket&, word payload_size); static NetworkOrdered<word> compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket&, word payload_size);
virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) override; virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override; virtual int protocol_send(const void*, int) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override; virtual KResult protocol_connect(FileDescription&, ShouldBlock) override;
virtual int protocol_allocate_local_port() override; virtual int protocol_allocate_local_port() override;

View file

@ -43,10 +43,9 @@ NonnullRefPtr<UDPSocket> UDPSocket::create(int protocol)
return adopt(*new UDPSocket(protocol)); return adopt(*new UDPSocket(protocol));
} }
int UDPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) int UDPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags)
{ {
(void)flags; (void)flags;
(void)addr_length;
ASSERT(!packet_buffer.is_null()); ASSERT(!packet_buffer.is_null());
auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer()); auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer());
auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload()); auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload());

View file

@ -16,7 +16,7 @@ private:
virtual const char* class_name() const override { return "UDPSocket"; } virtual const char* class_name() const override { return "UDPSocket"; }
static Lockable<HashMap<word, UDPSocket*>>& sockets_by_port(); static Lockable<HashMap<word, UDPSocket*>>& sockets_by_port();
virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) override; virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override; virtual int protocol_send(const void*, int) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override { return KSuccess; } virtual KResult protocol_connect(FileDescription&, ShouldBlock) override { return KSuccess; }
virtual int protocol_allocate_local_port() override; virtual int protocol_allocate_local_port() override;

View file

@ -2499,7 +2499,7 @@ int Process::sys$create_shared_buffer(pid_t peer_pid, int size, void** buffer)
int shared_buffer_id = ++s_next_shared_buffer_id; int shared_buffer_id = ++s_next_shared_buffer_id;
auto shared_buffer = make<SharedBuffer>(m_pid, peer_pid, size); auto shared_buffer = make<SharedBuffer>(m_pid, peer_pid, size);
shared_buffer->m_shared_buffer_id = shared_buffer_id; shared_buffer->m_shared_buffer_id = shared_buffer_id;
ASSERT(shared_buffer->size() >= size); ASSERT((int)shared_buffer->size() >= size);
shared_buffer->m_pid1_region = allocate_region_with_vmo(VirtualAddress(), shared_buffer->size(), shared_buffer->m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | PROT_WRITE); shared_buffer->m_pid1_region = allocate_region_with_vmo(VirtualAddress(), shared_buffer->size(), shared_buffer->m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | PROT_WRITE);
shared_buffer->m_pid1_region->set_shared(true); shared_buffer->m_pid1_region->set_shared(true);
*buffer = shared_buffer->m_pid1_region->vaddr().as_ptr(); *buffer = shared_buffer->m_pid1_region->vaddr().as_ptr();

View file

@ -78,10 +78,11 @@ void PhysicalRegion::return_page_at(PhysicalAddress addr)
int local_offset = addr.get() - m_lower.get(); int local_offset = addr.get() - m_lower.get();
ASSERT(local_offset >= 0); ASSERT(local_offset >= 0);
ASSERT(local_offset < m_pages * PAGE_SIZE); ASSERT(local_offset < (int)(m_pages * PAGE_SIZE));
auto page = local_offset / PAGE_SIZE; auto page = (unsigned)local_offset / PAGE_SIZE;
if (page < m_last) m_last = page; if (page < m_last)
m_last = page;
m_bitmap.set(page, false); m_bitmap.set(page, false);
m_used--; m_used--;

View file

@ -98,16 +98,16 @@ void VMObject::inode_size_changed(Badge<Inode>, size_t old_size, size_t new_size
InterruptDisabler disabler; InterruptDisabler disabler;
size_t old_page_count = page_count(); auto old_page_count = page_count();
m_size = new_size; m_size = new_size;
if (page_count() > old_page_count) { if (page_count() > old_page_count) {
// Add null pages and let the fault handler page these in when that day comes. // Add null pages and let the fault handler page these in when that day comes.
for (size_t i = old_page_count; i < page_count(); ++i) for (auto i = old_page_count; i < page_count(); ++i)
m_physical_pages.append(nullptr); m_physical_pages.append(nullptr);
} else { } else {
// Prune the no-longer valid pages. I'm not sure this is actually correct behavior. // Prune the no-longer valid pages. I'm not sure this is actually correct behavior.
for (size_t i = page_count(); i < old_page_count; ++i) for (auto i = page_count(); i < old_page_count; ++i)
m_physical_pages.take_last(); m_physical_pages.take_last();
} }

View file

@ -33,7 +33,7 @@ public:
const String& name() const { return m_name; } const String& name() const { return m_name; }
void set_name(const String& name) { m_name = name; } void set_name(const String& name) { m_name = name; }
size_t page_count() const { return m_size / PAGE_SIZE; } int page_count() const { return m_size / PAGE_SIZE; }
const Vector<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; } const Vector<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
Vector<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; } Vector<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }