mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
BufferStream: It's not an error to read up to the very end of a buffer
Don't signal an error before we've reached the very end of the buffer.
This commit is contained in:
parent
6e956f2a0b
commit
18aeda2e0d
1 changed files with 8 additions and 8 deletions
|
@ -24,7 +24,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(i8& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(u8& value )
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(bool& value )
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(char& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(u16& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(i16& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(u32& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
}
|
||||
BufferStream& operator>>(i32& value)
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
if (m_offset + sizeof(value) > unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue