Skip to content

Commit

Permalink
IMG_xcf.c: fix version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
miniupnp committed Oct 26, 2020
1 parent 77e83e2 commit ab1258b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion IMG_xcf.c
Expand Up @@ -321,7 +321,10 @@ static xcf_header * read_xcf_header (SDL_RWops * src) {
h->width = SDL_ReadBE32 (src);
h->height = SDL_ReadBE32 (src);
h->image_type = SDL_ReadBE32 (src);
h->file_version = (h->sign[10] - '0') * 100 + (h->sign[11] - '0') * 10 + (h->sign[12] - '0');
if (h->sign[9] == 'v' && h->sign[10] >= '0' && h->sign[10] <= '9' && h->sign[11] >= '0' && h->sign[11] <= '9' && h->sign[12] >= '0' && h->sign[12] <= '9')
h->file_version = (h->sign[10] - '0') * 100 + (h->sign[11] - '0') * 10 + (h->sign[12] - '0');
else
h->file_version = 0;
#ifdef DEBUG
printf ("XCF signature : %.14s (version %u)\n", h->sign, h->file_version);
printf (" (%u,%u) type=%u\n", h->width, h->height, h->image_type);
Expand Down

0 comments on commit ab1258b

Please sign in to comment.