diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-03 21:17:35 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-03 21:20:13 +0200 |
commit | 27f699ef0c8c2dce0f1dff19eef25f02e3da397e (patch) | |
tree | 52f95be1d05ba2a621d3bb8ac9129341f8d9973b /AK/ByteBuffer.h | |
parent | c4c4bbc5ba5119e9ccc8ded948b26e7c4851a909 (diff) | |
download | serenity-27f699ef0c8c2dce0f1dff19eef25f02e3da397e.zip |
AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:
* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
Diffstat (limited to 'AK/ByteBuffer.h')
-rw-r--r-- | AK/ByteBuffer.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index f62a4c04d6..3946a19440 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -28,12 +28,12 @@ public: m_data = nullptr; } - byte& operator[](int i) + u8& operator[](int i) { ASSERT(i < m_size); return m_data[i]; } - const byte& operator[](int i) const + const u8& operator[](int i) const { ASSERT(i < m_size); return m_data[i]; @@ -41,11 +41,11 @@ public: bool is_empty() const { return !m_size; } int size() const { return m_size; } - byte* pointer() { return m_data; } - const byte* pointer() const { return m_data; } + u8* pointer() { return m_data; } + const u8* pointer() const { return m_data; } - byte* offset_pointer(int offset) { return m_data + offset; } - const byte* offset_pointer(int offset) const { return m_data + offset; } + u8* offset_pointer(int offset) { return m_data + offset; } + const u8* offset_pointer(int offset) const { return m_data + offset; } void* end_pointer() { return m_data + m_size; } const void* end_pointer() const { return m_data + m_size; } @@ -71,7 +71,7 @@ private: ByteBufferImpl(void*, int, ConstructionMode); // For ConstructionMode=Wrap/Adopt ByteBufferImpl() {} - byte* m_data { nullptr }; + u8* m_data { nullptr }; int m_size { 0 }; bool m_owned { false }; }; @@ -114,12 +114,12 @@ public: bool operator!() const { return is_null(); } bool is_null() const { return m_impl == nullptr; } - byte& operator[](int i) + u8& operator[](int i) { ASSERT(m_impl); return (*m_impl)[i]; } - byte operator[](int i) const + u8 operator[](int i) const { ASSERT(m_impl); return (*m_impl)[i]; @@ -127,14 +127,14 @@ public: bool is_empty() const { return !m_impl || m_impl->is_empty(); } int size() const { return m_impl ? m_impl->size() : 0; } - byte* data() { return pointer(); } - const byte* data() const { return pointer(); } + u8* data() { return pointer(); } + const u8* data() const { return pointer(); } - byte* pointer() { return m_impl ? m_impl->pointer() : nullptr; } - const byte* pointer() const { return m_impl ? m_impl->pointer() : nullptr; } + u8* pointer() { return m_impl ? m_impl->pointer() : nullptr; } + const u8* pointer() const { return m_impl ? m_impl->pointer() : nullptr; } - byte* offset_pointer(int offset) { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } - const byte* offset_pointer(int offset) const { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } + u8* offset_pointer(int offset) { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } + const u8* offset_pointer(int offset) const { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } void* end_pointer() { return m_impl ? m_impl->end_pointer() : nullptr; } const void* end_pointer() const { return m_impl ? m_impl->end_pointer() : nullptr; } @@ -191,7 +191,7 @@ private: inline ByteBufferImpl::ByteBufferImpl(int size) : m_size(size) { - m_data = static_cast<byte*>(kmalloc(size)); + m_data = static_cast<u8*>(kmalloc(size)); m_owned = true; } @@ -199,13 +199,13 @@ inline ByteBufferImpl::ByteBufferImpl(const void* data, int size, ConstructionMo : m_size(size) { ASSERT(mode == Copy); - m_data = static_cast<byte*>(kmalloc(size)); + m_data = static_cast<u8*>(kmalloc(size)); memcpy(m_data, data, size); m_owned = true; } inline ByteBufferImpl::ByteBufferImpl(void* data, int size, ConstructionMode mode) - : m_data(static_cast<byte*>(data)) + : m_data(static_cast<u8*>(data)) , m_size(size) { if (mode == Adopt) { @@ -219,9 +219,9 @@ inline void ByteBufferImpl::grow(int size) { ASSERT(size > m_size); ASSERT(m_owned); - byte* new_data = static_cast<byte*>(kmalloc(size)); + u8* new_data = static_cast<u8*>(kmalloc(size)); memcpy(new_data, m_data, m_size); - byte* old_data = m_data; + u8* old_data = m_data; m_data = new_data; m_size = size; kfree(old_data); |