mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/PacketIO: Read directly into output variable for numeric ByteBuffer::operator>> overloads
This commit is contained in:
@@ -41,7 +41,7 @@ ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* typ
|
||||
|
||||
ByteBuffer& ByteBuffer::operator>>(float& value)
|
||||
{
|
||||
value = read<float>();
|
||||
read(&value, 1);
|
||||
if (!std::isfinite(value))
|
||||
throw ByteBufferInvalidValueException("float", "infinity");
|
||||
return *this;
|
||||
@@ -49,7 +49,7 @@ ByteBuffer& ByteBuffer::operator>>(float& value)
|
||||
|
||||
ByteBuffer& ByteBuffer::operator>>(double& value)
|
||||
{
|
||||
value = read<double>();
|
||||
read(&value, 1);
|
||||
if (!std::isfinite(value))
|
||||
throw ByteBufferInvalidValueException("double", "infinity");
|
||||
return *this;
|
||||
|
||||
@@ -320,50 +320,50 @@ class TC_SHARED_API ByteBuffer
|
||||
|
||||
ByteBuffer& operator>>(uint8& value)
|
||||
{
|
||||
value = read<uint8>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(uint16& value)
|
||||
{
|
||||
value = read<uint16>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(uint32& value)
|
||||
{
|
||||
value = read<uint32>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(uint64& value)
|
||||
{
|
||||
value = read<uint64>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//signed as in 2e complement
|
||||
ByteBuffer& operator>>(int8& value)
|
||||
{
|
||||
value = read<int8>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(int16& value)
|
||||
{
|
||||
value = read<int16>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(int32& value)
|
||||
{
|
||||
value = read<int32>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteBuffer& operator>>(int64& value)
|
||||
{
|
||||
value = read<int64>();
|
||||
read(&value, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user