- replaced MIN/MAX in common code.

This commit is contained in:
Christoph Oelckers 2021-10-30 10:46:17 +02:00
commit eb69bbcae0
63 changed files with 200 additions and 236 deletions

View file

@ -246,7 +246,7 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text)
{
struct { uint32_t len, id; char key[80]; } head;
int len = (int)strlen (text);
int keylen = std::min ((int)strlen (keyword), 79);
int keylen = min ((int)strlen (keyword), 79);
uint32_t crc;
head.len = BigLong(len + keylen + 1);
@ -329,7 +329,7 @@ char *M_GetPNGText (PNGHandle *png, const char *keyword)
if (strncmp (keyword, png->TextChunks[i], 80) == 0)
{
// Woo! A match was found!
keylen = std::min<size_t> (80, strlen (keyword) + 1);
keylen = min<size_t> (80, strlen (keyword) + 1);
textlen = strlen (png->TextChunks[i] + keylen) + 1;
char *str = new char[textlen];
strcpy (str, png->TextChunks[i] + keylen);
@ -351,7 +351,7 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf
if (strncmp (keyword, png->TextChunks[i], 80) == 0)
{
// Woo! A match was found!
keylen = std::min<size_t> (80, strlen (keyword) + 1);
keylen = min<size_t> (80, strlen (keyword) + 1);
strncpy (buffer, png->TextChunks[i] + keylen, buffsize);
return true;
}
@ -566,7 +566,7 @@ bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int p
if (stream.avail_in == 0 && chunklen > 0)
{
stream.next_in = chunkbuffer;
stream.avail_in = (uInt)file.Read (chunkbuffer, std::min<uint32_t>(chunklen,sizeof(chunkbuffer)));
stream.avail_in = (uInt)file.Read (chunkbuffer, min<uint32_t>(chunklen,sizeof(chunkbuffer)));
chunklen -= stream.avail_in;
}