SIZE_MAX need not be defined in limits.h

it can be in limits.h (windows) or stdint.h.
This commit is contained in:
Ozkan Sezer 2020-11-11 12:33:55 +03:00
parent e12457d8bf
commit 53b166797d
2 changed files with 5 additions and 7 deletions

View File

@ -22,14 +22,13 @@
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#else
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1)
#endif #endif
#ifndef INT_MAX #ifndef INT_MAX
/* Make a lucky guess. */ /* Make a lucky guess. */
#define INT_MAX SDL_MAX_SINT32 #define INT_MAX SDL_MAX_SINT32
#endif #endif
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1)
#endif #endif
/* Microsoft WAVE file loading routines */ /* Microsoft WAVE file loading routines */
@ -928,7 +927,7 @@ IMA_ADPCM_DecodeBlockHeader(ADPCM_DecoderState *state)
{ {
Sint16 step; Sint16 step;
Uint32 c; Uint32 c;
Uint8 *cstate = state->cstate; Uint8 *cstate = (Uint8 *) state->cstate;
for (c = 0; c < state->channels; c++) { for (c = 0; c < state->channels; c++) {
size_t o = state->block.pos + c * 4; size_t o = state->block.pos + c * 4;
@ -1561,7 +1560,7 @@ WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t length)
} }
if (length > 0) { if (length > 0) {
chunk->data = SDL_malloc(length); chunk->data = (Uint8 *) SDL_malloc(length);
if (chunk->data == NULL) { if (chunk->data == NULL) {
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }

View File

@ -24,11 +24,10 @@
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#else #endif
#ifndef SIZE_MAX #ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1) #define SIZE_MAX ((size_t)-1)
#endif #endif
#endif
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"