From 164d9ecad7e8fd652fa7f52748c26fb128be7f5b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 29 Jan 2020 18:29:04 +0100 Subject: Kernel: Some more int => size_t in NetworkAdapter and subclasses --- Kernel/Net/E1000NetworkAdapter.cpp | 6 +++--- Kernel/Net/E1000NetworkAdapter.h | 2 +- Kernel/Net/LoopbackAdapter.cpp | 2 +- Kernel/Net/LoopbackAdapter.h | 2 +- Kernel/Net/NetworkAdapter.cpp | 4 ++-- Kernel/Net/NetworkAdapter.h | 4 ++-- Kernel/Net/RTL8139NetworkAdapter.cpp | 4 ++-- Kernel/Net/RTL8139NetworkAdapter.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) (limited to 'Kernel/Net') diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp index 8ab2937fb9..128009d220 100644 --- a/Kernel/Net/E1000NetworkAdapter.cpp +++ b/Kernel/Net/E1000NetworkAdapter.cpp @@ -371,12 +371,12 @@ u32 E1000NetworkAdapter::in32(u16 address) return IO::in32(m_io_base + address); } -void E1000NetworkAdapter::send_raw(const u8* data, int length) +void E1000NetworkAdapter::send_raw(const u8* data, size_t length) { disable_irq(); u32 tx_current = in32(REG_TXDESCTAIL); #ifdef E1000_DEBUG - kprintf("E1000: Sending packet (%d bytes)\n", length); + kprintf("E1000: Sending packet (%zu bytes)\n", length); #endif auto& descriptor = m_tx_descriptors[tx_current]; ASSERT(length <= 8192); @@ -417,7 +417,7 @@ void E1000NetworkAdapter::receive() auto* buffer = (u8*)(m_rx_descriptors[rx_current].addr + 0xc0000000); u16 length = m_rx_descriptors[rx_current].length; #ifdef E1000_DEBUG - kprintf("E1000: Received 1 packet @ %p (%u) bytes!\n", buffer, length); + kprintf("E1000: Received 1 packet @ %p (%zu) bytes!\n", buffer, length); #endif did_receive(buffer, length); m_rx_descriptors[rx_current].status = 0; diff --git a/Kernel/Net/E1000NetworkAdapter.h b/Kernel/Net/E1000NetworkAdapter.h index 93efc84faf..2999b8803c 100644 --- a/Kernel/Net/E1000NetworkAdapter.h +++ b/Kernel/Net/E1000NetworkAdapter.h @@ -39,7 +39,7 @@ public: E1000NetworkAdapter(PCI::Address, u8 irq); virtual ~E1000NetworkAdapter() override; - virtual void send_raw(const u8*, int) override; + virtual void send_raw(const u8*, size_t) override; virtual bool link_up() override; private: diff --git a/Kernel/Net/LoopbackAdapter.cpp b/Kernel/Net/LoopbackAdapter.cpp index b8de34287f..1e8c56f784 100644 --- a/Kernel/Net/LoopbackAdapter.cpp +++ b/Kernel/Net/LoopbackAdapter.cpp @@ -44,7 +44,7 @@ LoopbackAdapter::~LoopbackAdapter() { } -void LoopbackAdapter::send_raw(const u8* data, int size) +void LoopbackAdapter::send_raw(const u8* data, size_t size) { dbgprintf("LoopbackAdapter: Sending %d byte(s) to myself.\n", size); did_receive(data, size); diff --git a/Kernel/Net/LoopbackAdapter.h b/Kernel/Net/LoopbackAdapter.h index f85c2eb8c9..9bb83151d6 100644 --- a/Kernel/Net/LoopbackAdapter.h +++ b/Kernel/Net/LoopbackAdapter.h @@ -35,7 +35,7 @@ public: virtual ~LoopbackAdapter() override; - virtual void send_raw(const u8*, int) override; + virtual void send_raw(const u8*, size_t) override; virtual const char* class_name() const override { return "LoopbackAdapter"; } private: diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 6646884f4a..62e91714b3 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -127,7 +127,7 @@ void NetworkAdapter::send_ipv4(const MACAddress& destination_mac, const IPv4Addr send_raw((const u8*)ð, ethernet_frame_size); } -void NetworkAdapter::did_receive(const u8* data, int length) +void NetworkAdapter::did_receive(const u8* data, size_t length) { InterruptDisabler disabler; m_packets_in++; @@ -140,7 +140,7 @@ void NetworkAdapter::did_receive(const u8* data, int length) } else { buffer = m_unused_packet_buffers.take_first(); --m_unused_packet_buffers_count; - if ((size_t)length <= buffer.value().size()) { + if (length <= buffer.value().size()) { memcpy(buffer.value().data(), data, length); buffer.value().set_size(length); } else { diff --git a/Kernel/Net/NetworkAdapter.h b/Kernel/Net/NetworkAdapter.h index c690d87c36..f2648c2a6b 100644 --- a/Kernel/Net/NetworkAdapter.h +++ b/Kernel/Net/NetworkAdapter.h @@ -81,8 +81,8 @@ protected: NetworkAdapter(); void set_interface_name(const StringView& basename); void set_mac_address(const MACAddress& mac_address) { m_mac_address = mac_address; } - virtual void send_raw(const u8*, int) = 0; - void did_receive(const u8*, int); + virtual void send_raw(const u8*, size_t) = 0; + void did_receive(const u8*, size_t); private: MACAddress m_mac_address; diff --git a/Kernel/Net/RTL8139NetworkAdapter.cpp b/Kernel/Net/RTL8139NetworkAdapter.cpp index c24704f3d9..18a08d81c7 100644 --- a/Kernel/Net/RTL8139NetworkAdapter.cpp +++ b/Kernel/Net/RTL8139NetworkAdapter.cpp @@ -291,7 +291,7 @@ void RTL8139NetworkAdapter::read_mac_address() set_mac_address(mac); } -void RTL8139NetworkAdapter::send_raw(const u8* data, int length) +void RTL8139NetworkAdapter::send_raw(const u8* data, size_t length) { #ifdef RTL8139_DEBUG kprintf("RTL8139NetworkAdapter::send_raw length=%d\n", length); @@ -332,7 +332,7 @@ void RTL8139NetworkAdapter::send_raw(const u8* data, int length) // 60 bytes if necessary to make sure the whole thing is large enough. if (length < 60) { #ifdef RTL8139_DEBUG - kprintf("RTL8139NetworkAdapter: adjusting payload size from %d to 60\n", length); + kprintf("RTL8139NetworkAdapter: adjusting payload size from %zu to 60\n", length); #endif length = 60; } diff --git a/Kernel/Net/RTL8139NetworkAdapter.h b/Kernel/Net/RTL8139NetworkAdapter.h index a9d941a0fe..31403c7d25 100644 --- a/Kernel/Net/RTL8139NetworkAdapter.h +++ b/Kernel/Net/RTL8139NetworkAdapter.h @@ -41,7 +41,7 @@ public: RTL8139NetworkAdapter(PCI::Address, u8 irq); virtual ~RTL8139NetworkAdapter() override; - virtual void send_raw(const u8*, int) override; + virtual void send_raw(const u8*, size_t) override; virtual bool link_up() override { return m_link_up; } private: -- cgit v1.2.3