AK: Use size_t for ByteBuffer offsets

These should be unsigned values.

An east-const conversion was also performed by clang-format 15.
This commit is contained in:
Timothy Flynn 2022-10-28 18:20:00 -04:00 committed by Linus Groh
parent 6490529ef7
commit 6d15cbd411
Notes: sideshowbarker 2024-07-17 04:54:26 +09:00

View file

@ -126,10 +126,10 @@ public:
[[nodiscard]] ReadonlyBytes bytes() const { return { data(), size() }; }
[[nodiscard]] AK::Span<u8> span() { return { data(), size() }; }
[[nodiscard]] AK::Span<const u8> span() const { return { data(), size() }; }
[[nodiscard]] AK::Span<u8 const> span() const { return { data(), size() }; }
[[nodiscard]] u8* offset_pointer(int offset) { return data() + offset; }
[[nodiscard]] u8 const* offset_pointer(int offset) const { return data() + offset; }
[[nodiscard]] u8* offset_pointer(size_t offset) { return data() + offset; }
[[nodiscard]] u8 const* offset_pointer(size_t offset) const { return data() + offset; }
[[nodiscard]] void* end_pointer() { return data() + m_size; }
[[nodiscard]] void const* end_pointer() const { return data() + m_size; }
@ -226,7 +226,7 @@ public:
if (data_size == 0)
return {};
VERIFY(data != nullptr);
int old_size = size();
auto old_size = size();
TRY(try_resize(size() + data_size));
__builtin_memcpy(this->data() + old_size, data, data_size);
return {};