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:
@ -338,7 +338,7 @@ static NtOpSocketWrite * SocketQueueAsyncWrite (
|
||||
NtOpSocketWrite * lastQueuedWrite = (NtOpSocketWrite *) opCurr;
|
||||
|
||||
unsigned bytesLeft = lastQueuedWrite->bytesAlloc - lastQueuedWrite->write.bytes;
|
||||
bytesLeft = min(bytesLeft, bytes);
|
||||
bytesLeft = std::min(bytesLeft, bytes);
|
||||
if (bytesLeft) {
|
||||
PerfAddCounter(kAsyncPerfSocketBytesWaitQueued, 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
|
||||
// extra space in case more data needs to be queued later
|
||||
unsigned bytesAlloc = max(bytes, sock->backlogAlloc);
|
||||
bytesAlloc = max(bytesAlloc, kMinBacklogBytes);
|
||||
unsigned bytesAlloc = std::max(bytes, sock->backlogAlloc);
|
||||
bytesAlloc = std::max(bytesAlloc, kMinBacklogBytes);
|
||||
NtOpSocketWrite * op = new(malloc(sizeof(NtOpSocketWrite) + bytesAlloc)) NtOpSocketWrite;
|
||||
|
||||
// init Operation
|
||||
@ -883,7 +883,7 @@ static unsigned SocketCloseTimerCallback (void *) {
|
||||
HardCloseSocket(*cur);
|
||||
|
||||
// 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 dataIdx = 0;
|
||||
uint32_t cur = 0;
|
||||
uint32_t end = max(length, sizeof(ShaDigest));
|
||||
size_t cur = 0;
|
||||
size_t end = std::max(length, sizeof(ShaDigest));
|
||||
|
||||
// Combine seed with input data
|
||||
for (; cur < end; cur++) {
|
||||
|
@ -205,7 +205,7 @@ static unsigned MaxMsgId (const T msgs[], unsigned count) {
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
ASSERT(msgs[i].msg.count);
|
||||
maxMsgId = max(msgs[i].msg.messageId, maxMsgId);
|
||||
maxMsgId = std::max(msgs[i].msg.messageId, maxMsgId);
|
||||
}
|
||||
return maxMsgId;
|
||||
}
|
||||
@ -248,7 +248,7 @@ static void AddRecvMsgs_CS (
|
||||
*dst = *src;
|
||||
|
||||
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
|
||||
// to determine the maximum number of bytes that will fit
|
||||
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
|
||||
for (unsigned i = 0; i < copy; ++i)
|
||||
@ -678,7 +678,7 @@ static void ClientConnect (NetCli * cli) {
|
||||
memset(&cli->seed, 0, sizeof(cli->seed));
|
||||
unsigned 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;
|
||||
}
|
||||
|
||||
@ -740,7 +740,7 @@ static bool ServerRecvConnect (
|
||||
memset(&clientSeed, 0, sizeof(clientSeed));
|
||||
unsigned 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;
|
||||
}
|
||||
|
||||
@ -964,7 +964,7 @@ static void SetConnSeed (
|
||||
const uint8_t seedData[]
|
||||
) {
|
||||
if (seedBytes)
|
||||
memcpy(cli->seed, seedData, min(sizeof(cli->seed), seedBytes));
|
||||
memcpy(cli->seed, seedData, std::min(sizeof(cli->seed), seedBytes));
|
||||
else
|
||||
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
|
||||
// than twice as big as the old allocation and larger than the chunk
|
||||
// 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;
|
||||
|
||||
// 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
|
||||
if (newAlloc < *chunkSize)
|
||||
return max(newAlloc, 2 * oldAlloc);
|
||||
return std::max(newAlloc, 2 * oldAlloc);
|
||||
|
||||
// For larger allocations, grow by the chunk size each time
|
||||
if (oldAlloc + *chunkSize > newAlloc) {
|
||||
|
@ -740,25 +740,25 @@ public:
|
||||
//===========================================================================
|
||||
template<class T, class 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>
|
||||
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>
|
||||
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>
|
||||
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
|
||||
if (destIndex >= sourceIndex) {
|
||||
C::Destruct(this->m_data + sourceIndex, min(count, destIndex - sourceIndex));
|
||||
C::Construct(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, std::min(count, destIndex - sourceIndex));
|
||||
}
|
||||
else {
|
||||
unsigned overlap = (destIndex + count > sourceIndex) ? (destIndex + count - sourceIndex) : 0;
|
||||
@ -936,7 +936,7 @@ T TArray<T,C>::Pop () {
|
||||
//===========================================================================
|
||||
template<class T, class C>
|
||||
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>
|
||||
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.isSpecified = false;
|
||||
SetDefaultValue(arg);
|
||||
maxId = max(maxId, def[loop].id);
|
||||
maxId = std::max(maxId, def[loop].id);
|
||||
|
||||
// Track the number of unflagged arguments
|
||||
if (!flagged)
|
||||
@ -167,7 +167,7 @@ CICmdParser::CICmdParser (const CmdArgDef def[], unsigned defCount) {
|
||||
}
|
||||
|
||||
// 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.Zero();
|
||||
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++;
|
||||
|
||||
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>
|
||||
void TBaseHashTable<T>::SetSlotMaxCount (unsigned count) {
|
||||
if (count)
|
||||
m_slotMaxCount = max(kSlotMinCount, count);
|
||||
m_slotMaxCount = std::max(static_cast<unsigned>(kSlotMinCount), count);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
Reference in New Issue
Block a user