summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-17 11:15:55 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-17 19:52:54 +0200
commitbf779e182ec4f38b6d4abf470e21fcba0184c8d4 (patch)
treec6c684f216bd4eeae3a61006432a93319ed7078c
parent9b14a8605a8ef4ab81141f7baff634d472912beb (diff)
downloadserenity-bf779e182ec4f38b6d4abf470e21fcba0184c8d4.zip
Kernel: Remove obsolete size_t casts
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp2
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp2
-rw-r--r--Kernel/FileSystem/ProcFS.cpp2
-rw-r--r--Kernel/Syscalls/hostname.cpp2
-rw-r--r--Kernel/Syscalls/thread.cpp2
-rw-r--r--Kernel/Syscalls/write.cpp2
-rw-r--r--Kernel/TTY/VirtualConsole.cpp2
-rw-r--r--Kernel/UserOrKernelBuffer.h8
8 files changed, 11 insertions, 11 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 7b1977ba77..c04f4940ab 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -838,7 +838,7 @@ KResultOr<size_t> Ext2FSInode::read_bytes(off_t offset, size_t count, UserOrKern
if (is_symlink() && size() < max_inline_symlink_length) {
VERIFY(offset == 0);
size_t nread = min((off_t)size() - offset, static_cast<off_t>(count));
- if (!buffer.write(((const u8*)m_raw_inode.i_block) + offset, (size_t)nread))
+ if (!buffer.write(((const u8*)m_raw_inode.i_block) + offset, nread))
return EFAULT;
return nread;
}
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index aa8bb7df95..1122213fdf 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -760,7 +760,7 @@ KResultOr<size_t> Plan9FSInode::read_bytes(off_t offset, size_t size, UserOrKern
}
// Guard against the server returning more data than requested.
- size_t nread = min(data.length(), (size_t)size);
+ size_t nread = min(data.length(), size);
if (!buffer.write(data.characters_without_null_termination(), nread))
return EFAULT;
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index 977162e6bc..76bad8a63a 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -1503,7 +1503,7 @@ KResultOr<size_t> ProcFSInode::write_bytes(off_t offset, size_t size, const User
VERIFY(is_persistent_inode(identifier()));
// FIXME: Being able to write into ProcFS at a non-zero offset seems like something we should maybe support..
VERIFY(offset == 0);
- auto nwritten_or_error = write_callback(identifier(), buffer, (size_t)size);
+ auto nwritten_or_error = write_callback(identifier(), buffer, size);
if (nwritten_or_error.is_error())
dbgln("ProcFS: Writing {} bytes failed: {}", size, nwritten_or_error.error());
return nwritten_or_error;
diff --git a/Kernel/Syscalls/hostname.cpp b/Kernel/Syscalls/hostname.cpp
index b5e08f098f..7e9b18b931 100644
--- a/Kernel/Syscalls/hostname.cpp
+++ b/Kernel/Syscalls/hostname.cpp
@@ -17,7 +17,7 @@ KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, size_t size)
if (size > NumericLimits<ssize_t>::max())
return EINVAL;
Locker locker(*g_hostname_lock, Lock::Mode::Shared);
- if ((size_t)size < (g_hostname->length() + 1))
+ if (size < (g_hostname->length() + 1))
return ENAMETOOLONG;
if (!copy_to_user(buffer, g_hostname->characters(), g_hostname->length() + 1))
return EFAULT;
diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp
index a57fc30e05..6ecdd3c46b 100644
--- a/Kernel/Syscalls/thread.cpp
+++ b/Kernel/Syscalls/thread.cpp
@@ -179,7 +179,7 @@ KResultOr<int> Process::sys$get_thread_name(pid_t tid, Userspace<char*> buffer,
// We must make a temporary copy here to avoid a race with sys$set_thread_name
auto thread_name = thread->name();
- if (thread_name.length() + 1 > (size_t)buffer_size)
+ if (thread_name.length() + 1 > buffer_size)
return ENAMETOOLONG;
if (!copy_to_user(buffer, thread_name.characters(), thread_name.length() + 1))
diff --git a/Kernel/Syscalls/write.cpp b/Kernel/Syscalls/write.cpp
index 88c8217321..b2585745dc 100644
--- a/Kernel/Syscalls/write.cpp
+++ b/Kernel/Syscalls/write.cpp
@@ -67,7 +67,7 @@ KResultOr<size_t> Process::do_write(FileDescription& description, const UserOrKe
return seek_result.error();
}
- while ((size_t)total_nwritten < data_size) {
+ while (total_nwritten < data_size) {
while (!description.can_write()) {
if (!description.is_blocking()) {
if (total_nwritten > 0)
diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp
index 117879c90c..e82a8e854d 100644
--- a/Kernel/TTY/VirtualConsole.cpp
+++ b/Kernel/TTY/VirtualConsole.cpp
@@ -269,7 +269,7 @@ KResultOr<size_t> VirtualConsole::on_tty_write(const UserOrKernelBuffer& data, s
{
ScopedSpinLock global_lock(ConsoleManagement::the().tty_write_lock());
ScopedSpinLock lock(m_lock);
- auto result = data.read_buffered<512>((size_t)size, [&](u8 const* buffer, size_t buffer_bytes) {
+ auto result = data.read_buffered<512>(size, [&](u8 const* buffer, size_t buffer_bytes) {
for (size_t i = 0; i < buffer_bytes; ++i)
m_console_impl.on_input(buffer[i]);
return buffer_bytes;
diff --git a/Kernel/UserOrKernelBuffer.h b/Kernel/UserOrKernelBuffer.h
index 93c023a47b..8f5a2685de 100644
--- a/Kernel/UserOrKernelBuffer.h
+++ b/Kernel/UserOrKernelBuffer.h
@@ -101,11 +101,11 @@ public:
if (copied_or_error.is_error())
return copied_or_error.error();
auto copied = copied_or_error.value();
- VERIFY((size_t)copied <= to_copy);
- if (!write(buffer, nwritten, (size_t)copied))
+ VERIFY(copied <= to_copy);
+ if (!write(buffer, nwritten, copied))
return EFAULT;
- nwritten += (size_t)copied;
- if ((size_t)copied < to_copy)
+ nwritten += copied;
+ if (copied < to_copy)
break;
}
return nwritten;