mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Include limits
instead of climits
Consistently use `std::numeric_limits` instead of `INT_MIN` and `INT_MAX`.
This commit is contained in:
parent
42319546a6
commit
5e510cdbf4
|
@ -63,7 +63,7 @@
|
|||
#endif
|
||||
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
#include <stack>
|
||||
#include <thread>
|
||||
|
@ -3798,7 +3798,7 @@ int CClient::HandleChecksum(int Conn, CUuid Uuid, CUnpacker *pUnpacker)
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
if(Start < 0 || Length < 0 || Start > INT_MAX - Length)
|
||||
if(Start < 0 || Length < 0 || Start > std::numeric_limits<int>::max() - Length)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "serverbrowser_ping_cache.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
#include <engine/graphics.h>
|
||||
#include <engine/shared/config.h>
|
||||
|
@ -132,7 +132,7 @@ void CSpectator::ConSpectateClosest(IConsole::IResult *pResult, void *pUserData)
|
|||
CurPosition.y = CurCharacter.m_Y;
|
||||
}
|
||||
|
||||
int ClosestDistance = INT_MAX;
|
||||
int ClosestDistance = std::numeric_limits<int>::max();
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(i == SpectatorID || !Snap.m_apPlayerInfos[i] || Snap.m_apPlayerInfos[i]->m_Team == TEAM_SPECTATORS || (SpectatorID == SPEC_FREEVIEW && i == Snap.m_LocalClientID))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <base/system.h>
|
||||
#include <engine/shared/jsonwriter.h>
|
||||
|
||||
#include <climits>
|
||||
#include <limits>
|
||||
|
||||
class JsonFileWriter
|
||||
{
|
||||
|
@ -201,12 +201,12 @@ TYPED_TEST(JsonWriters, MinusOne)
|
|||
|
||||
TYPED_TEST(JsonWriters, Large)
|
||||
{
|
||||
this->Impl.m_pJson->WriteIntValue(INT_MAX);
|
||||
this->Impl.m_pJson->WriteIntValue(std::numeric_limits<int>::max());
|
||||
this->Impl.Expect("2147483647\n");
|
||||
}
|
||||
|
||||
TYPED_TEST(JsonWriters, Small)
|
||||
{
|
||||
this->Impl.m_pJson->WriteIntValue(INT_MIN);
|
||||
this->Impl.m_pJson->WriteIntValue(std::numeric_limits<int>::min());
|
||||
this->Impl.Expect("-2147483648\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue