From d3d247b5f9e686547a78df309cb8aa5fd7227b20 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 30 Oct 2015 15:22:23 +0200 Subject: [PATCH] Simlified the buffer size calculation in Player type. Fixed bug which multiplied by the type size instead of dividing. thanks @VRocker --- source/Entity/Player.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/Entity/Player.cpp b/source/Entity/Player.cpp index 60ce85a8..c68f65c8 100644 --- a/source/Entity/Player.cpp +++ b/source/Entity/Player.cpp @@ -88,8 +88,8 @@ const SQChar * CPlayer::GetIP() const noexcept // Attempt to retrieve the ip address if (VALID_ENTITY(m_ID)) { - std::memset(s_Buffer, '\0', std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); - _Func->GetPlayerIP(m_ID, s_Buffer, std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); + std::memset(s_Buffer, '\0', sizeof(s_Buffer)); + _Func->GetPlayerIP(m_ID, s_Buffer, sizeof(s_Buffer)); } else { @@ -279,8 +279,8 @@ const SQChar * CPlayer::GetName() const noexcept // Attempt to retrieve the ip address if (VALID_ENTITY(m_ID)) { - std::memset(s_Buffer, '\0', std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); - _Func->GetPlayerName(m_ID, s_Buffer, std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); + std::memset(s_Buffer, '\0', sizeof(s_Buffer)); + _Func->GetPlayerName(m_ID, s_Buffer, sizeof(s_Buffer)); } else { @@ -586,8 +586,8 @@ const SQChar * CPlayer::GetUID() const noexcept // Attempt to retrieve the uid if (VALID_ENTITY(m_ID)) { - std::memset(s_Buffer, '\0', std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); - _Func->GetPlayerUID(m_ID, s_Buffer, std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); + std::memset(s_Buffer, '\0', sizeof(s_Buffer)); + _Func->GetPlayerUID(m_ID, s_Buffer, sizeof(s_Buffer)); } else { @@ -605,8 +605,8 @@ const SQChar * CPlayer::GetUID2() const noexcept // Attempt to retrieve the uid2 if (VALID_ENTITY(m_ID)) { - std::memset(s_Buffer, '\0', std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); - _Func->GetPlayerUID2(m_ID, s_Buffer, std::extent< decltype(s_Buffer) >::value * sizeof(SQChar)); + std::memset(s_Buffer, '\0', sizeof(s_Buffer)); + _Func->GetPlayerUID2(m_ID, s_Buffer, sizeof(s_Buffer)); } else {