mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:27:35 +00:00
AK+IPCCompiler: Get rid of BufferStream overloads for size_t
Since BufferStream is about creating specific binary stream formats, let's not have a flaky type like size_t in there. Instead, clients of BufferStream can cast their size_t to the binary size they want to use. Account for this in IPCCompiler by making String lengths always 32-bit.
This commit is contained in:
parent
be0034d2ca
commit
0cff25ac78
2 changed files with 3 additions and 40 deletions
|
@ -297,43 +297,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
BufferStream& operator<<(size_t value)
|
||||
{
|
||||
if constexpr(sizeof(size_t) == 4)
|
||||
return *this << (u32)value;
|
||||
else if constexpr(sizeof(size_t) == 8)
|
||||
return *this << (u64)value;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
BufferStream& operator>>(size_t& value)
|
||||
{
|
||||
if constexpr(sizeof(size_t) == 4)
|
||||
return *this >> (u32&)value;
|
||||
else if constexpr(sizeof(size_t) == 8)
|
||||
return *this >> (u64&)value;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
#ifndef __i386__
|
||||
BufferStream& operator<<(ssize_t value)
|
||||
{
|
||||
if constexpr(sizeof(ssize_t) == 4)
|
||||
return *this << (i32)value;
|
||||
else if constexpr(sizeof(ssize_t) == 8)
|
||||
return *this << (i64)value;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
BufferStream& operator>>(ssize_t& value)
|
||||
{
|
||||
if constexpr(sizeof(ssize_t) == 4)
|
||||
return *this >> (i32&)value;
|
||||
else if constexpr(sizeof(ssize_t) == 8)
|
||||
return *this >> (i64&)value;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
BufferStream& operator<<(const char* value)
|
||||
{
|
||||
return *this << StringView(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue