Adding of _t to (u)int types, and WChar to char32_t

See: eaae0bb5e
This commit is contained in:
Jonathan G Rennison
2024-01-07 16:41:53 +00:00
parent 55d78a23be
commit 97e6f3062e
655 changed files with 7555 additions and 7555 deletions

View File

@@ -20,10 +20,10 @@
#include <limits>
void BufferSend_bool (std::vector<byte> &buffer, size_t limit, bool data);
void BufferSend_uint8 (std::vector<byte> &buffer, size_t limit, uint8 data);
void BufferSend_uint16(std::vector<byte> &buffer, size_t limit, uint16 data);
void BufferSend_uint32(std::vector<byte> &buffer, size_t limit, uint32 data);
void BufferSend_uint64(std::vector<byte> &buffer, size_t limit, uint64 data);
void BufferSend_uint8 (std::vector<byte> &buffer, size_t limit, uint8_t data);
void BufferSend_uint16(std::vector<byte> &buffer, size_t limit, uint16_t data);
void BufferSend_uint32(std::vector<byte> &buffer, size_t limit, uint32_t data);
void BufferSend_uint64(std::vector<byte> &buffer, size_t limit, uint64_t data);
void BufferSend_string(std::vector<byte> &buffer, size_t limit, const std::string_view data);
size_t BufferSend_binary_until_full(std::vector<byte> &buffer, size_t limit, const byte *begin, const byte *end);
void BufferSend_binary(std::vector<byte> &buffer, size_t limit, const byte *data, const size_t size);
@@ -37,25 +37,25 @@ struct BufferSerialisationHelper {
BufferSend_bool(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data);
}
void Send_uint8(uint8 data)
void Send_uint8(uint8_t data)
{
T *self = static_cast<T *>(this);
BufferSend_uint8(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data);
}
void Send_uint16(uint16 data)
void Send_uint16(uint16_t data)
{
T *self = static_cast<T *>(this);
BufferSend_uint16(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data);
}
void Send_uint32(uint32 data)
void Send_uint32(uint32_t data)
{
T *self = static_cast<T *>(this);
BufferSend_uint32(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data);
}
void Send_uint64(uint64 data)
void Send_uint64(uint64_t data)
{
T *self = static_cast<T *>(this);
BufferSend_uint64(self->GetSerialisationBuffer(), self->GetSerialisationLimit(), data);
@@ -130,9 +130,9 @@ public:
* Read a 8 bits integer from the packet.
* @return The read data.
*/
uint8 Recv_uint8()
uint8_t Recv_uint8()
{
uint8 n;
uint8_t n;
if (!this->CanRecvBytes(sizeof(n), true)) return 0;
@@ -146,16 +146,16 @@ public:
* Read a 16 bits integer from the packet.
* @return The read data.
*/
uint16 Recv_uint16()
uint16_t Recv_uint16()
{
uint16 n;
uint16_t n;
if (!this->CanRecvBytes(sizeof(n), true)) return 0;
auto &pos = static_cast<T *>(this)->GetDeserialisationPosition();
n = (uint16)this->GetBuffer()[pos++];
n += (uint16)this->GetBuffer()[pos++] << 8;
n = (uint16_t)this->GetBuffer()[pos++];
n += (uint16_t)this->GetBuffer()[pos++] << 8;
return n;
}
@@ -163,18 +163,18 @@ public:
* Read a 32 bits integer from the packet.
* @return The read data.
*/
uint32 Recv_uint32()
uint32_t Recv_uint32()
{
uint32 n;
uint32_t n;
if (!this->CanRecvBytes(sizeof(n), true)) return 0;
auto &pos = static_cast<T *>(this)->GetDeserialisationPosition();
n = (uint32)this->GetBuffer()[pos++];
n += (uint32)this->GetBuffer()[pos++] << 8;
n += (uint32)this->GetBuffer()[pos++] << 16;
n += (uint32)this->GetBuffer()[pos++] << 24;
n = (uint32_t)this->GetBuffer()[pos++];
n += (uint32_t)this->GetBuffer()[pos++] << 8;
n += (uint32_t)this->GetBuffer()[pos++] << 16;
n += (uint32_t)this->GetBuffer()[pos++] << 24;
return n;
}
@@ -182,22 +182,22 @@ public:
* Read a 64 bits integer from the packet.
* @return The read data.
*/
uint64 Recv_uint64()
uint64_t Recv_uint64()
{
uint64 n;
uint64_t n;
if (!this->CanRecvBytes(sizeof(n), true)) return 0;
auto &pos = static_cast<T *>(this)->GetDeserialisationPosition();
n = (uint64)this->GetBuffer()[pos++];
n += (uint64)this->GetBuffer()[pos++] << 8;
n += (uint64)this->GetBuffer()[pos++] << 16;
n += (uint64)this->GetBuffer()[pos++] << 24;
n += (uint64)this->GetBuffer()[pos++] << 32;
n += (uint64)this->GetBuffer()[pos++] << 40;
n += (uint64)this->GetBuffer()[pos++] << 48;
n += (uint64)this->GetBuffer()[pos++] << 56;
n = (uint64_t)this->GetBuffer()[pos++];
n += (uint64_t)this->GetBuffer()[pos++] << 8;
n += (uint64_t)this->GetBuffer()[pos++] << 16;
n += (uint64_t)this->GetBuffer()[pos++] << 24;
n += (uint64_t)this->GetBuffer()[pos++] << 32;
n += (uint64_t)this->GetBuffer()[pos++] << 40;
n += (uint64_t)this->GetBuffer()[pos++] << 48;
n += (uint64_t)this->GetBuffer()[pos++] << 56;
return n;
}
@@ -269,13 +269,13 @@ public:
* @param size The size of the data.
* @return The view of the data.
*/
span<const uint8> Recv_binary_view(size_t size)
span<const uint8_t> Recv_binary_view(size_t size)
{
if (!this->CanRecvBytes(size, true)) return {};
auto &pos = static_cast<T *>(this)->GetDeserialisationPosition();
span<const uint8> view { &this->GetBuffer()[pos], size };
span<const uint8_t> view { &this->GetBuffer()[pos], size };
pos += (decltype(pos)) size;
return view;
@@ -286,9 +286,9 @@ public:
* @param size The size of the data.
* @return The binary buffer.
*/
std::vector<uint8> Recv_binary(size_t size)
std::vector<uint8_t> Recv_binary(size_t size)
{
span<const uint8> view = this->Recv_binary_view(size);
span<const uint8_t> view = this->Recv_binary_view(size);
return { view.begin(), view.end() };
}
@@ -297,14 +297,14 @@ public:
* Returns a view of a length-prefixed binary buffer from the packet.
* @return The binary buffer.
*/
span<const uint8> Recv_buffer_view()
span<const uint8_t> Recv_buffer_view()
{
uint16 length = this->Recv_uint16();
uint16_t length = this->Recv_uint16();
if (!this->CanRecvBytes(length, true)) return {};
auto &pos = static_cast<T *>(this)->GetDeserialisationPosition();
span<const uint8> buffer { &this->GetBuffer()[pos], length };
span<const uint8_t> buffer { &this->GetBuffer()[pos], length };
pos += length;
return buffer;
@@ -314,9 +314,9 @@ public:
* Reads a length-prefixed binary buffer from the packet.
* @return The binary buffer.
*/
std::vector<uint8> Recv_buffer()
std::vector<uint8_t> Recv_buffer()
{
span<const uint8> view = this->Recv_buffer_view();
span<const uint8_t> view = this->Recv_buffer_view();
return { view.begin(), view.end() };
}