diff --git a/SDL_stbimage.h b/SDL_stbimage.h index 9cab669..b7d914d 100644 --- a/SDL_stbimage.h +++ b/SDL_stbimage.h @@ -456,7 +456,7 @@ static int _STBIMG_io_read(void* user, char* data, int size) { STBIMG_stbio_RWops* io = (STBIMG_stbio_RWops*)user; - int ret = _STBIMG_RWread(io->src, data, size*sizeof(char)); + size_t ret = _STBIMG_RWread(io->src, data, size*sizeof(char)); if(ret == 0) { // we're at EOF or some error happend @@ -640,7 +640,7 @@ SDL_STBIMG_DEF SDL_Surface* STBIMG_Load_RW_noSeek(_STBIMG_RWops* src, bool frees goto end; } - buf = (unsigned char*)SDL_malloc(fileSize); + buf = (unsigned char*)SDL_malloc((size_t)fileSize); if(buf == NULL) { SDL_SetError("STBIMG_Load_RW_noSeek(): Couldn't allocate buffer to read src into!"); @@ -648,7 +648,7 @@ SDL_STBIMG_DEF SDL_Surface* STBIMG_Load_RW_noSeek(_STBIMG_RWops* src, bool frees } while(bytesRead < fileSize) { - size_t read = _STBIMG_RWread(src, buf+bytesRead, fileSize-bytesRead); + size_t read = _STBIMG_RWread(src, buf+bytesRead, (size_t)(fileSize-bytesRead)); if(read == 0) { // TODO: set error? SDL_RWread/SDL_ReadIO should set one, I think? goto end; @@ -658,7 +658,7 @@ SDL_STBIMG_DEF SDL_Surface* STBIMG_Load_RW_noSeek(_STBIMG_RWops* src, bool frees // if that fails, STBIMG_LoadFromMemory() has set an SDL error // and ret is NULL, so nothing special to do for us - ret = STBIMG_LoadFromMemory(buf, fileSize); + ret = STBIMG_LoadFromMemory(buf, (int)fileSize); end: if(freesrc)