Fixed crash if some initialization succeeded and some didn't, thanks to Dongwon Kang
authorSam Lantinga <slouken@libsdl.org>
Mon, 15 Feb 2016 08:42:35 -0800
changeset 490fd7214657669
parent 489 9a970a20248b
child 491 4088a517f9a5
Fixed crash if some initialization succeeded and some didn't, thanks to Dongwon Kang
IMG_jpg.c
IMG_png.c
IMG_tif.c
IMG_webp.c
     1.1 --- a/IMG_jpg.c	Thu Jan 07 12:17:19 2016 -0800
     1.2 +++ b/IMG_jpg.c	Mon Feb 15 08:42:35 2016 -0800
     1.3 @@ -386,7 +386,7 @@
     1.4      }
     1.5      start = SDL_RWtell(src);
     1.6  
     1.7 -    if ( !IMG_Init(IMG_INIT_JPG) ) {
     1.8 +    if ( (IMG_Init(IMG_INIT_JPG) & IMG_INIT_JPG) == 0 ) {
     1.9          return NULL;
    1.10      }
    1.11  
     2.1 --- a/IMG_png.c	Thu Jan 07 12:17:19 2016 -0800
     2.2 +++ b/IMG_png.c	Mon Feb 15 08:42:35 2016 -0800
     2.3 @@ -362,7 +362,7 @@
     2.4      }
     2.5      start = SDL_RWtell(src);
     2.6  
     2.7 -    if ( !IMG_Init(IMG_INIT_PNG) ) {
     2.8 +    if ( (IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG) == 0 ) {
     2.9          return NULL;
    2.10      }
    2.11  
     3.1 --- a/IMG_tif.c	Thu Jan 07 12:17:19 2016 -0800
     3.2 +++ b/IMG_tif.c	Mon Feb 15 08:42:35 2016 -0800
     3.3 @@ -217,7 +217,7 @@
     3.4      }
     3.5      start = SDL_RWtell(src);
     3.6  
     3.7 -    if ( !IMG_Init(IMG_INIT_TIF) ) {
     3.8 +    if ( (IMG_Init(IMG_INIT_TIF) & IMG_INIT_TIF) == 0 ) {
     3.9          return NULL;
    3.10      }
    3.11  
     4.1 --- a/IMG_webp.c	Thu Jan 07 12:17:19 2016 -0800
     4.2 +++ b/IMG_webp.c	Mon Feb 15 08:42:35 2016 -0800
     4.3 @@ -196,7 +196,7 @@
     4.4  
     4.5      start = SDL_RWtell(src);
     4.6  
     4.7 -    if ( !IMG_Init(IMG_INIT_WEBP) ) {
     4.8 +    if ( (IMG_Init(IMG_INIT_WEBP) & IMG_INIT_WEBP) == 0 ) {
     4.9          goto error;
    4.10      }
    4.11