Skip to content

Commit

Permalink
IMG_xcf.c (read_string): kill C99'ism
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Oct 16, 2018
1 parent 9fa1b8f commit 7c492c2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions IMG_xcf.c
Expand Up @@ -221,18 +221,20 @@ int IMG_isXCF(SDL_RWops *src)
}

static char * read_string (SDL_RWops * src) {
Sint64 remaining;
Uint32 tmp;
char * data;

tmp = SDL_ReadBE32(src);
Sint64 remaining = SDL_RWsize(src) - SDL_RWtell(src);
if (tmp > 0 && tmp <= remaining) {
remaining = SDL_RWsize(src) - SDL_RWtell(src);
if (tmp > 0 && (Sint32)tmp <= remaining) {
data = (char *) SDL_malloc (sizeof (char) * tmp);
if (data) {
SDL_RWread(src, data, tmp, 1);
data[tmp - 1] = '\0';
}
} else {
}
else {
data = NULL;
}
return data;
Expand Down

0 comments on commit 7c492c2

Please sign in to comment.