Skip to content

Fix some compile warnings #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions SDL_stbimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -640,15 +640,15 @@ 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!");
goto end;
}

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;
Expand All @@ -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)
Expand Down