mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Complete the previous commit by also removing the inline min and max
functions defined in HeadSpin.h without breaking (3ds)Max compilation
This commit is contained in:
@ -75,7 +75,7 @@ void GenerateKey(bool useDefault)
|
|||||||
uint32_t key[4];
|
uint32_t key[4];
|
||||||
if (useDefault)
|
if (useDefault)
|
||||||
{
|
{
|
||||||
unsigned memSize = min(arrsize(key), arrsize(plSecureStream::kDefaultKey));
|
unsigned memSize = std::min(arrsize(key), arrsize(plSecureStream::kDefaultKey));
|
||||||
memSize *= sizeof(uint32_t);
|
memSize *= sizeof(uint32_t);
|
||||||
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
||||||
}
|
}
|
||||||
|
@ -242,51 +242,6 @@ inline void hsSwap(float& a, float& b)
|
|||||||
# define NULL_STMT ((void)0)
|
# define NULL_STMT ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
template<class T>
|
|
||||||
inline T max (const T & a, const T & b) {
|
|
||||||
return (a > b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
inline unsigned max (int a, unsigned b) {
|
|
||||||
return ((unsigned)a > b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
inline unsigned max (unsigned a, int b) {
|
|
||||||
return (a > (unsigned)b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
template<class T>
|
|
||||||
inline T min (const T & a, const T & b) {
|
|
||||||
return (a < b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
inline unsigned min (int a, unsigned b) {
|
|
||||||
return ((unsigned)a < b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
inline unsigned min (unsigned a, int b) {
|
|
||||||
return (a < (unsigned)b) ? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
*
|
|
||||||
* MAX/MIN macros
|
|
||||||
* These are less safe than the inline function versions, since they
|
|
||||||
* evaluate parameters twice. However, they can be used to produce
|
|
||||||
* compile-time constants.
|
|
||||||
*
|
|
||||||
***/
|
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* SWAP
|
* SWAP
|
||||||
|
@ -61,8 +61,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
# define _WIN32_IE 0x400
|
# define _WIN32_IE 0x400
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
// HACK: Max headers depend on the min() and max() macros normally pulled
|
||||||
|
// in by windows.h... However, we usually disable those, since they break
|
||||||
|
// std::min and std::max. Therefore, we bring the std:: versions down to
|
||||||
|
// the global namespace so we can still compile max code without breaking
|
||||||
|
// everything else :/
|
||||||
# ifndef NOMINMAX
|
# ifndef NOMINMAX
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
|
# include <algorithm>
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -338,7 +338,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
|
|||||||
NtOpSocketWrite * lastQueuedWrite = (NtOpSocketWrite *) opCurr;
|
NtOpSocketWrite * lastQueuedWrite = (NtOpSocketWrite *) opCurr;
|
||||||
|
|
||||||
unsigned bytesLeft = lastQueuedWrite->bytesAlloc - lastQueuedWrite->write.bytes;
|
unsigned bytesLeft = lastQueuedWrite->bytesAlloc - lastQueuedWrite->write.bytes;
|
||||||
bytesLeft = min(bytesLeft, bytes);
|
bytesLeft = std::min(bytesLeft, bytes);
|
||||||
if (bytesLeft) {
|
if (bytesLeft) {
|
||||||
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytesLeft);
|
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, bytesLeft);
|
||||||
memcpy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft);
|
memcpy(lastQueuedWrite->write.buffer + lastQueuedWrite->write.bytes, data, bytesLeft);
|
||||||
@ -353,8 +353,8 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
|
|||||||
|
|
||||||
// allocate a buffer large enough to hold the data, plus
|
// allocate a buffer large enough to hold the data, plus
|
||||||
// extra space in case more data needs to be queued later
|
// extra space in case more data needs to be queued later
|
||||||
unsigned bytesAlloc = max(bytes, sock->backlogAlloc);
|
unsigned bytesAlloc = std::max(bytes, sock->backlogAlloc);
|
||||||
bytesAlloc = max(bytesAlloc, kMinBacklogBytes);
|
bytesAlloc = std::max(bytesAlloc, kMinBacklogBytes);
|
||||||
NtOpSocketWrite * op = new(malloc(sizeof(NtOpSocketWrite) + bytesAlloc)) NtOpSocketWrite;
|
NtOpSocketWrite * op = new(malloc(sizeof(NtOpSocketWrite) + bytesAlloc)) NtOpSocketWrite;
|
||||||
|
|
||||||
// init Operation
|
// init Operation
|
||||||
@ -883,7 +883,7 @@ static unsigned SocketCloseTimerCallback (void *) {
|
|||||||
HardCloseSocket(*cur);
|
HardCloseSocket(*cur);
|
||||||
|
|
||||||
// Don't run too frequently
|
// Don't run too frequently
|
||||||
return max(sleepMs, 2000);
|
return std::max(sleepMs, 2000u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ void CryptCreateRandomSeed(size_t length, uint8_t* data)
|
|||||||
{
|
{
|
||||||
uint32_t seedIdx = 0;
|
uint32_t seedIdx = 0;
|
||||||
uint32_t dataIdx = 0;
|
uint32_t dataIdx = 0;
|
||||||
uint32_t cur = 0;
|
size_t cur = 0;
|
||||||
uint32_t end = max(length, sizeof(ShaDigest));
|
size_t end = std::max(length, sizeof(ShaDigest));
|
||||||
|
|
||||||
// Combine seed with input data
|
// Combine seed with input data
|
||||||
for (; cur < end; cur++) {
|
for (; cur < end; cur++) {
|
||||||
|
@ -205,7 +205,7 @@ static unsigned MaxMsgId (const T msgs[], unsigned count) {
|
|||||||
|
|
||||||
for (unsigned i = 0; i < count; i++) {
|
for (unsigned i = 0; i < count; i++) {
|
||||||
ASSERT(msgs[i].msg.count);
|
ASSERT(msgs[i].msg.count);
|
||||||
maxMsgId = max(msgs[i].msg.messageId, maxMsgId);
|
maxMsgId = std::max(msgs[i].msg.messageId, maxMsgId);
|
||||||
}
|
}
|
||||||
return maxMsgId;
|
return maxMsgId;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ static void AddRecvMsgs_CS (
|
|||||||
*dst = *src;
|
*dst = *src;
|
||||||
|
|
||||||
const uint32_t bytes = ValidateMsg(dst->msg);
|
const uint32_t bytes = ValidateMsg(dst->msg);
|
||||||
channel->m_largestRecv = max(channel->m_largestRecv, bytes);
|
channel->m_largestRecv = std::max(channel->m_largestRecv, bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ static void AddToSendBuffer (
|
|||||||
// calculate the space left in the output buffer and use it
|
// calculate the space left in the output buffer and use it
|
||||||
// to determine the maximum number of bytes that will fit
|
// to determine the maximum number of bytes that will fit
|
||||||
unsigned const left = &cli->sendBuffer[arrsize(cli->sendBuffer)] - cli->sendCurr;
|
unsigned const left = &cli->sendBuffer[arrsize(cli->sendBuffer)] - cli->sendCurr;
|
||||||
unsigned const copy = min(bytes, left);
|
unsigned const copy = std::min(bytes, left);
|
||||||
|
|
||||||
// copy the data into the buffer
|
// copy the data into the buffer
|
||||||
for (unsigned i = 0; i < copy; ++i)
|
for (unsigned i = 0; i < copy; ++i)
|
||||||
@ -678,7 +678,7 @@ static void ClientConnect (NetCli * cli) {
|
|||||||
memset(&cli->seed, 0, sizeof(cli->seed));
|
memset(&cli->seed, 0, sizeof(cli->seed));
|
||||||
unsigned bytes;
|
unsigned bytes;
|
||||||
unsigned char * data = clientSeed.GetData_LE(&bytes);
|
unsigned char * data = clientSeed.GetData_LE(&bytes);
|
||||||
memcpy(cli->seed, data, min(bytes, sizeof(cli->seed)));
|
memcpy(cli->seed, data, std::min(bytes, sizeof(cli->seed)));
|
||||||
delete [] data;
|
delete [] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ static bool ServerRecvConnect (
|
|||||||
memset(&clientSeed, 0, sizeof(clientSeed));
|
memset(&clientSeed, 0, sizeof(clientSeed));
|
||||||
unsigned bytes;
|
unsigned bytes;
|
||||||
unsigned char * data = clientSeedValue.GetData_LE(&bytes);
|
unsigned char * data = clientSeedValue.GetData_LE(&bytes);
|
||||||
memcpy(clientSeed, data, min(bytes, sizeof(clientSeed)));
|
memcpy(clientSeed, data, std::min(bytes, sizeof(clientSeed)));
|
||||||
delete [] data;
|
delete [] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ static void SetConnSeed (
|
|||||||
const uint8_t seedData[]
|
const uint8_t seedData[]
|
||||||
) {
|
) {
|
||||||
if (seedBytes)
|
if (seedBytes)
|
||||||
memcpy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes));
|
memcpy(cli->seed, seedData, std::min(sizeof(cli->seed), seedBytes));
|
||||||
else
|
else
|
||||||
CryptCreateRandomSeed(sizeof(cli->seed), cli->seed);
|
CryptCreateRandomSeed(sizeof(cli->seed), cli->seed);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ unsigned CBaseArray::CalcAllocGrowth (unsigned newAlloc, unsigned oldAlloc, unsi
|
|||||||
// If this is the initial allocation, or if the new allocation is more
|
// If this is the initial allocation, or if the new allocation is more
|
||||||
// than twice as big as the old allocation and larger than the chunk
|
// than twice as big as the old allocation and larger than the chunk
|
||||||
// size, then allocate exactly the amount of memory requested
|
// size, then allocate exactly the amount of memory requested
|
||||||
if (!oldAlloc || (newAlloc >= max(2 * oldAlloc, *chunkSize)))
|
if (!oldAlloc || (newAlloc >= std::max(2 * oldAlloc, *chunkSize)))
|
||||||
return newAlloc;
|
return newAlloc;
|
||||||
|
|
||||||
// Otherwise, allocate memory beyond what was requested in preparation
|
// Otherwise, allocate memory beyond what was requested in preparation
|
||||||
@ -69,7 +69,7 @@ unsigned CBaseArray::CalcAllocGrowth (unsigned newAlloc, unsigned oldAlloc, unsi
|
|||||||
|
|
||||||
// For small allocations, double the size of the buffer each time
|
// For small allocations, double the size of the buffer each time
|
||||||
if (newAlloc < *chunkSize)
|
if (newAlloc < *chunkSize)
|
||||||
return max(newAlloc, 2 * oldAlloc);
|
return std::max(newAlloc, 2 * oldAlloc);
|
||||||
|
|
||||||
// For larger allocations, grow by the chunk size each time
|
// For larger allocations, grow by the chunk size each time
|
||||||
if (oldAlloc + *chunkSize > newAlloc) {
|
if (oldAlloc + *chunkSize > newAlloc) {
|
||||||
|
@ -740,25 +740,25 @@ public:
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
TArray<T,C>::TArray () : TFArray<T,C>() {
|
TArray<T,C>::TArray () : TFArray<T,C>() {
|
||||||
m_chunkSize = max(1, 256 / sizeof(T));
|
m_chunkSize = std::max(1u, 256 / sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
TArray<T,C>::TArray (const char file[], int line) : TFArray<T,C>(file, line) {
|
TArray<T,C>::TArray (const char file[], int line) : TFArray<T,C>(file, line) {
|
||||||
m_chunkSize = max(1, 256 / sizeof(T));
|
m_chunkSize = std::max(1u, 256 / sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
TArray<T,C>::TArray (unsigned count) : TFArray<T,C>(count) {
|
TArray<T,C>::TArray (unsigned count) : TFArray<T,C>(count) {
|
||||||
m_chunkSize = max(1, 256 / sizeof(T));
|
m_chunkSize = std::max(1u, 256 / sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
TArray<T,C>::TArray (const T * source, unsigned count) : TFArray<T,C>(source, count) {
|
TArray<T,C>::TArray (const T * source, unsigned count) : TFArray<T,C>(source, count) {
|
||||||
m_chunkSize = max(1, 256 / sizeof(T));
|
m_chunkSize = std::max(1u, 256 / sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -890,8 +890,8 @@ void TArray<T,C>::Move (unsigned destIndex, unsigned sourceIndex, unsigned count
|
|||||||
|
|
||||||
// Remove it from the source
|
// Remove it from the source
|
||||||
if (destIndex >= sourceIndex) {
|
if (destIndex >= sourceIndex) {
|
||||||
C::Destruct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex));
|
C::Destruct(this->m_data + sourceIndex, std::min(count, destIndex - sourceIndex));
|
||||||
C::Construct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex));
|
C::Construct(this->m_data + sourceIndex, std::min(count, destIndex - sourceIndex));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0;
|
unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0;
|
||||||
@ -936,7 +936,7 @@ T TArray<T,C>::Pop () {
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
void TArray<T,C>::Reserve (unsigned additionalCount) {
|
void TArray<T,C>::Reserve (unsigned additionalCount) {
|
||||||
AdjustSizeChunked(max(this->m_alloc, this->m_count + additionalCount), this->m_count);
|
AdjustSizeChunked(std::max(this->m_alloc, this->m_count + additionalCount), this->m_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -956,7 +956,7 @@ void TArray<T,C>::SetChunkSize (unsigned chunkSize) {
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
template<class T, class C>
|
template<class T, class C>
|
||||||
void TArray<T,C>::SetCount (unsigned count) {
|
void TArray<T,C>::SetCount (unsigned count) {
|
||||||
AdjustSizeChunked(max(this->m_alloc, count), count);
|
AdjustSizeChunked(std::max(this->m_alloc, count), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -158,7 +158,7 @@ CICmdParser::CICmdParser (const CmdArgDef def[], unsigned defCount) {
|
|||||||
arg.nameChars = def[loop].name ? StrLen(def[loop].name) : 0;
|
arg.nameChars = def[loop].name ? StrLen(def[loop].name) : 0;
|
||||||
arg.isSpecified = false;
|
arg.isSpecified = false;
|
||||||
SetDefaultValue(arg);
|
SetDefaultValue(arg);
|
||||||
maxId = max(maxId, def[loop].id);
|
maxId = std::max(maxId, def[loop].id);
|
||||||
|
|
||||||
// Track the number of unflagged arguments
|
// Track the number of unflagged arguments
|
||||||
if (!flagged)
|
if (!flagged)
|
||||||
@ -167,7 +167,7 @@ CICmdParser::CICmdParser (const CmdArgDef def[], unsigned defCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the id lookup table
|
// Build the id lookup table
|
||||||
unsigned idTableSize = min(maxId + 1, defCount * 2);
|
unsigned idTableSize = std::min(maxId + 1, defCount * 2);
|
||||||
m_idLookupArray.SetCount(idTableSize);
|
m_idLookupArray.SetCount(idTableSize);
|
||||||
m_idLookupArray.Zero();
|
m_idLookupArray.Zero();
|
||||||
for (loop = 0; loop < defCount; ++loop)
|
for (loop = 0; loop < defCount; ++loop)
|
||||||
|
@ -432,7 +432,7 @@ void TBaseHashTable<T>::SetLinkOffset (int linkOffset, unsigned maxSize) {
|
|||||||
v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16;
|
v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16;
|
||||||
v++;
|
v++;
|
||||||
|
|
||||||
SetSlotCount(max(kSlotMinCount, v));
|
SetSlotCount(std::max(static_cast<unsigned>(kSlotMinCount), v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ void TBaseHashTable<T>::SetSlotCount (unsigned count) {
|
|||||||
template<class T>
|
template<class T>
|
||||||
void TBaseHashTable<T>::SetSlotMaxCount (unsigned count) {
|
void TBaseHashTable<T>::SetSlotMaxCount (unsigned count) {
|
||||||
if (count)
|
if (count)
|
||||||
m_slotMaxCount = max(kSlotMinCount, count);
|
m_slotMaxCount = std::max(static_cast<unsigned>(kSlotMinCount), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -439,9 +439,9 @@ void plArmatureModBase::AdjustLOD()
|
|||||||
hsPoint3 delta = ourPos - camPos;
|
hsPoint3 delta = ourPos - camPos;
|
||||||
float distanceSquared = delta.MagnitudeSquared();
|
float distanceSquared = delta.MagnitudeSquared();
|
||||||
if (distanceSquared < fLODDistance * fLODDistance)
|
if (distanceSquared < fLODDistance * fLODDistance)
|
||||||
SetLOD(max(0, fMinLOD));
|
SetLOD(std::max(0, fMinLOD));
|
||||||
else if (distanceSquared < fLODDistance * fLODDistance * 4.0)
|
else if (distanceSquared < fLODDistance * fLODDistance * 4.0)
|
||||||
SetLOD(max(1, fMinLOD));
|
SetLOD(std::max(1, fMinLOD));
|
||||||
else
|
else
|
||||||
SetLOD(2);
|
SetLOD(2);
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, plDebugText &
|
|||||||
float strength = GetStrength();
|
float strength = GetStrength();
|
||||||
const char *onOff = strength > 0 ? "on" : "off";
|
const char *onOff = strength > 0 ? "on" : "off";
|
||||||
char blendBar[] = "||||||||||";
|
char blendBar[] = "||||||||||";
|
||||||
int bars = (int)min(10 * strength, 10);
|
int bars = std::min(static_cast<int>(10 * strength), 10);
|
||||||
blendBar[bars] = '\0';
|
blendBar[bars] = '\0';
|
||||||
|
|
||||||
plString details;
|
plString details;
|
||||||
|
@ -179,7 +179,7 @@ public:
|
|||||||
|
|
||||||
float oldSpeed = fabs(fSwimBrain->fSwimStrategy->GetTurnStrength());
|
float oldSpeed = fabs(fSwimBrain->fSwimStrategy->GetTurnStrength());
|
||||||
float thisInc = elapsed * incPerSec;
|
float thisInc = elapsed * incPerSec;
|
||||||
float newSpeed = min(oldSpeed + thisInc, maxTurnSpeed);
|
float newSpeed = std::min(oldSpeed + thisInc, maxTurnSpeed);
|
||||||
fSwimBrain->fSwimStrategy->SetTurnStrength(newSpeed * fAvMod->GetKeyTurnStrength() + fAvMod->GetAnalogTurnStrength());
|
fSwimBrain->fSwimStrategy->SetTurnStrength(newSpeed * fAvMod->GetKeyTurnStrength() + fAvMod->GetAnalogTurnStrength());
|
||||||
// the turn is actually applied during PhysicsUpdate
|
// the turn is actually applied during PhysicsUpdate
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ bool plWalkingStrategy::EnableControlledFlight(bool status)
|
|||||||
++fControlledFlight;
|
++fControlledFlight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fControlledFlight = max(--fControlledFlight, 0);
|
fControlledFlight = std::max(--fControlledFlight, 0);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -713,7 +713,7 @@ bool plSecureStream::GetSecureEncryptionKey(const plFileName& filename, uint32_t
|
|||||||
|
|
||||||
file.Close();
|
file.Close();
|
||||||
|
|
||||||
unsigned memSize = min(bytesToRead, bytesRead);
|
unsigned memSize = std::min(bytesToRead, bytesRead);
|
||||||
memcpy(key, buffer, memSize);
|
memcpy(key, buffer, memSize);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ bool plSecureStream::GetSecureEncryptionKey(const plFileName& filename, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// file doesn't exist, use default key
|
// file doesn't exist, use default key
|
||||||
unsigned memSize = min(length, arrsize(plSecureStream::kDefaultKey));
|
unsigned memSize = std::min(length, arrsize(plSecureStream::kDefaultKey));
|
||||||
memSize *= sizeof(uint32_t);
|
memSize *= sizeof(uint32_t);
|
||||||
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
memcpy(key, plSecureStream::kDefaultKey, memSize);
|
||||||
|
|
||||||
|
@ -2701,7 +2701,7 @@ bool LoginRequestTrans::Recv (
|
|||||||
m_accountFlags = reply.accountFlags;
|
m_accountFlags = reply.accountFlags;
|
||||||
m_billingType = reply.billingType;
|
m_billingType = reply.billingType;
|
||||||
|
|
||||||
unsigned memSize = min(arrsize(s_encryptionKey), arrsize(reply.encryptionKey));
|
unsigned memSize = std::min(arrsize(s_encryptionKey), arrsize(reply.encryptionKey));
|
||||||
memSize *= sizeof(uint32_t);
|
memSize *= sizeof(uint32_t);
|
||||||
memcpy(s_encryptionKey, reply.encryptionKey, memSize);
|
memcpy(s_encryptionKey, reply.encryptionKey, memSize);
|
||||||
}
|
}
|
||||||
@ -5130,7 +5130,7 @@ void NetCliAuthStartConnect (
|
|||||||
) {
|
) {
|
||||||
// TEMP: Only connect to one auth server until we fill out this module
|
// TEMP: Only connect to one auth server until we fill out this module
|
||||||
// to choose the "best" auth connection.
|
// to choose the "best" auth connection.
|
||||||
authAddrCount = min(authAddrCount, 1);
|
authAddrCount = std::min(authAddrCount, 1u);
|
||||||
|
|
||||||
for (unsigned i = 0; i < authAddrCount; ++i) {
|
for (unsigned i = 0; i < authAddrCount; ++i) {
|
||||||
// Do we need to lookup the address?
|
// Do we need to lookup the address?
|
||||||
@ -5273,7 +5273,7 @@ void NetCliAuthGetEncryptionKey (
|
|||||||
uint32_t key[],
|
uint32_t key[],
|
||||||
unsigned size
|
unsigned size
|
||||||
) {
|
) {
|
||||||
unsigned memSize = min(arrsize(s_encryptionKey), size);
|
unsigned memSize = std::min(arrsize(s_encryptionKey), size);
|
||||||
memSize *= sizeof(uint32_t);
|
memSize *= sizeof(uint32_t);
|
||||||
memcpy(key, s_encryptionKey, memSize);
|
memcpy(key, s_encryptionKey, memSize);
|
||||||
}
|
}
|
||||||
|
@ -1350,7 +1350,7 @@ void NetCliFileStartConnect (
|
|||||||
) {
|
) {
|
||||||
// TEMP: Only connect to one file server until we fill out this module
|
// TEMP: Only connect to one file server until we fill out this module
|
||||||
// to choose the "best" file connection.
|
// to choose the "best" file connection.
|
||||||
fileAddrCount = min(fileAddrCount, 1);
|
fileAddrCount = std::min(fileAddrCount, 1u);
|
||||||
s_connectBuildId = isPatcher ? kFileSrvBuildId : plProduct::BuildId();
|
s_connectBuildId = isPatcher ? kFileSrvBuildId : plProduct::BuildId();
|
||||||
s_serverType = kSrvTypeNone;
|
s_serverType = kSrvTypeNone;
|
||||||
|
|
||||||
@ -1387,7 +1387,7 @@ void NetCliFileStartConnectAsServer (
|
|||||||
) {
|
) {
|
||||||
// TEMP: Only connect to one file server until we fill out this module
|
// TEMP: Only connect to one file server until we fill out this module
|
||||||
// to choose the "best" file connection.
|
// to choose the "best" file connection.
|
||||||
fileAddrCount = min(fileAddrCount, 1);
|
fileAddrCount = std::min(fileAddrCount, 1u);
|
||||||
s_connectBuildId = serverBuildId;
|
s_connectBuildId = serverBuildId;
|
||||||
s_serverType = serverType;
|
s_serverType = serverType;
|
||||||
|
|
||||||
|
@ -1062,7 +1062,7 @@ void NetCliGateKeeperStartConnect (
|
|||||||
const char* gateKeeperAddrList[],
|
const char* gateKeeperAddrList[],
|
||||||
uint32_t gateKeeperAddrCount
|
uint32_t gateKeeperAddrCount
|
||||||
) {
|
) {
|
||||||
gateKeeperAddrCount = min(gateKeeperAddrCount, 1);
|
gateKeeperAddrCount = std::min(gateKeeperAddrCount, 1u);
|
||||||
|
|
||||||
for (unsigned i = 0; i < gateKeeperAddrCount; ++i) {
|
for (unsigned i = 0; i < gateKeeperAddrCount; ++i) {
|
||||||
// Do we need to lookup the address?
|
// Do we need to lookup the address?
|
||||||
|
@ -79,7 +79,7 @@ int plBufferedSocketWriter::Flush(plTcpSocket & sck) // this is where things
|
|||||||
{
|
{
|
||||||
int ans = kSuccessNoDataSent;
|
int ans = kSuccessNoDataSent;
|
||||||
|
|
||||||
int writeSize = MIN(FastAmountBuffered(),fBytesPerFlush);
|
int writeSize = std::min(FastAmountBuffered(), fBytesPerFlush);
|
||||||
|
|
||||||
if(writeSize > 0)
|
if(writeSize > 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user