diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-06-16 16:44:15 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-16 21:29:36 +0200 |
commit | bc3076f8944e5a4f72b15e4e13c16b2c3e2f2080 (patch) | |
tree | 95219ba7fb9555dae2876041cc2e30a28556e057 /Kernel/UserOrKernelBuffer.h | |
parent | ca3cae81eb8e20d63e36e7359a776af5eb4d5ea2 (diff) | |
download | serenity-bc3076f8944e5a4f72b15e4e13c16b2c3e2f2080.zip |
Kernel: Remove various other uses of ssize_t
Diffstat (limited to 'Kernel/UserOrKernelBuffer.h')
-rw-r--r-- | Kernel/UserOrKernelBuffer.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Kernel/UserOrKernelBuffer.h b/Kernel/UserOrKernelBuffer.h index 3407975708..93c023a47b 100644 --- a/Kernel/UserOrKernelBuffer.h +++ b/Kernel/UserOrKernelBuffer.h @@ -44,7 +44,7 @@ public: [[nodiscard]] bool is_kernel_buffer() const; [[nodiscard]] const void* user_or_kernel_ptr() const { return m_buffer; } - [[nodiscard]] UserOrKernelBuffer offset(ssize_t offset) const + [[nodiscard]] UserOrKernelBuffer offset(size_t offset) const { if (!m_buffer) return *this; @@ -97,9 +97,10 @@ public: size_t nwritten = 0; while (nwritten < len) { auto to_copy = min(sizeof(buffer), len - nwritten); - ssize_t copied = f(buffer, to_copy); - if (copied < 0) - return copied; + KResultOr<size_t> copied_or_error = f(buffer, to_copy); + 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)) return EFAULT; |