Skip to content

Commit

Permalink
xpm, xv: minor warning fixes (SDL_RWread() doesn't return negative)
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Sep 11, 2019
1 parent fdcf483 commit 020a29a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions IMG_xpm.c
Expand Up @@ -934,7 +934,7 @@ static char *get_next_line(char ***lines, SDL_RWops *src, int len)
char c;
int n;
do {
if (SDL_RWread(src, &c, 1, 1) <= 0) {
if (!SDL_RWread(src, &c, 1, 1)) {
error = "Premature end of data";
return NULL;
}
Expand All @@ -951,7 +951,7 @@ static char *get_next_line(char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
if (!SDL_RWread(src, linebuf, len - 1, 1)) {
error = "Premature end of data";
return NULL;
}
Expand All @@ -971,7 +971,7 @@ static char *get_next_line(char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
if (!SDL_RWread(src, linebuf + n, 1, 1)) {
error = "Premature end of data";
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions IMG_xv.c
Expand Up @@ -28,7 +28,7 @@
static int get_line(SDL_RWops *src, char *line, int size)
{
while ( size > 0 ) {
if ( SDL_RWread(src, line, 1, 1) <= 0 ) {
if ( !SDL_RWread(src, line, 1, 1) ) {
return -1;
}
if ( *line == '\r' ) {
Expand Down Expand Up @@ -126,7 +126,7 @@ SDL_Surface *IMG_LoadXV_RW(SDL_RWops *src)

/* Load the image data */
for ( pixels = (Uint8 *)surface->pixels; h > 0; --h ) {
if ( SDL_RWread(src, pixels, w, 1) <= 0 ) {
if ( !SDL_RWread(src, pixels, w, 1) ) {
error = "Couldn't read image data";
goto done;
}
Expand Down

0 comments on commit 020a29a

Please sign in to comment.