Sam Lantinga - Sun Nov 8 07:52:11 PST 2009
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Nov 2009 15:53:24 +0000
changeset 233fd5471011130
parent 232 c98cc5bc497b
child 234 cefead35d5c7
Sam Lantinga - Sun Nov 8 07:52:11 PST 2009
* Fixed checking for IMG_Init() return value in image loaders
CHANGES
IMG.c
IMG_ImageIO.c
IMG_UIImage.m
IMG_jpg.c
IMG_png.c
IMG_tif.c
SDL_image.h
     1.1 --- a/CHANGES	Thu Oct 29 04:24:39 2009 +0000
     1.2 +++ b/CHANGES	Sun Nov 08 15:53:24 2009 +0000
     1.3 @@ -1,3 +1,7 @@
     1.4 +1.2.9:
     1.5 +Sam Lantinga - Sun Nov  8 07:52:11 PST 2009
     1.6 + * Fixed checking for IMG_Init() return value in image loaders
     1.7 +
     1.8  1.2.8:
     1.9  Sam Lantinga - Sun Oct  4 13:12:54 PDT 2009
    1.10   * Added support for uncompressed PCX files
     2.1 --- a/IMG.c	Thu Oct 29 04:24:39 2009 +0000
     2.2 +++ b/IMG.c	Sun Nov 08 15:53:24 2009 +0000
     2.3 @@ -61,20 +61,16 @@
     2.4  }
     2.5  
     2.6  extern int IMG_InitJPG();
     2.7 -extern int IMG_QuitJPG();
     2.8 +extern void IMG_QuitJPG();
     2.9  extern int IMG_InitPNG();
    2.10 -extern int IMG_QuitPNG();
    2.11 +extern void IMG_QuitPNG();
    2.12  extern int IMG_InitTIF();
    2.13 -extern int IMG_QuitTIF();
    2.14 +extern void IMG_QuitTIF();
    2.15  
    2.16  static int initialized = 0;
    2.17  
    2.18  int IMG_Init(int flags)
    2.19  {
    2.20 -#if defined(__APPLE__) && !defined(SDL_IMAGE_USE_COMMON_BACKEND)
    2.21 -	initialized = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF;
    2.22 -	return initialized;
    2.23 -#else
    2.24  	int result = 0;
    2.25  
    2.26  	if ((flags & IMG_INIT_JPG) && !(initialized & IMG_INIT_JPG)) {
    2.27 @@ -95,12 +91,10 @@
    2.28  	initialized |= result;
    2.29  
    2.30  	return (result);
    2.31 -#endif
    2.32  }
    2.33  
    2.34  void IMG_Quit()
    2.35  {
    2.36 -#if !defined(__APPLE__) || defined(SDL_IMAGE_USE_COMMON_BACKEND)
    2.37  	if (initialized & IMG_INIT_JPG) {
    2.38  		IMG_QuitJPG();
    2.39  	}
    2.40 @@ -110,7 +104,6 @@
    2.41  	if (initialized & IMG_INIT_TIF) {
    2.42  		IMG_QuitTIF();
    2.43  	}
    2.44 -#endif
    2.45  	initialized = 0;
    2.46  }
    2.47  
     3.1 --- a/IMG_ImageIO.c	Thu Oct 29 04:24:39 2009 +0000
     3.2 +++ b/IMG_ImageIO.c	Sun Nov 08 15:53:24 2009 +0000
     3.3 @@ -449,6 +449,32 @@
     3.4  	return sdl_surface;	
     3.5  }
     3.6  
     3.7 +int IMG_InitJPG()
     3.8 +{
     3.9 +	return 0;
    3.10 +}
    3.11 +
    3.12 +void IMG_QuitJPG()
    3.13 +{
    3.14 +}
    3.15 +
    3.16 +int IMG_InitPNG()
    3.17 +{
    3.18 +	return 0;
    3.19 +}
    3.20 +
    3.21 +void IMG_QuitPNG()
    3.22 +{
    3.23 +}
    3.24 +
    3.25 +int IMG_InitTIF()
    3.26 +{
    3.27 +	return 0;
    3.28 +}
    3.29 +
    3.30 +void IMG_QuitTIF()
    3.31 +{
    3.32 +}
    3.33  
    3.34  int IMG_isCUR(SDL_RWops *src)
    3.35  {
     4.1 --- a/IMG_UIImage.m	Thu Oct 29 04:24:39 2009 +0000
     4.2 +++ b/IMG_UIImage.m	Sun Nov 08 15:53:24 2009 +0000
     4.3 @@ -265,6 +265,32 @@
     4.4  }
     4.5  
     4.6  
     4.7 +int IMG_InitJPG()
     4.8 +{
     4.9 +	return 0;
    4.10 +}
    4.11 +
    4.12 +void IMG_QuitJPG()
    4.13 +{
    4.14 +}
    4.15 +
    4.16 +int IMG_InitPNG()
    4.17 +{
    4.18 +	return 0;
    4.19 +}
    4.20 +
    4.21 +void IMG_QuitPNG()
    4.22 +{
    4.23 +}
    4.24 +
    4.25 +int IMG_InitTIF()
    4.26 +{
    4.27 +	return 0;
    4.28 +}
    4.29 +
    4.30 +void IMG_QuitTIF()
    4.31 +{
    4.32 +}
    4.33  
    4.34  /* Copied straight from other files so I don't have to alter them. */
    4.35  static int IMG_isICOCUR(SDL_RWops *src, int type)
     5.1 --- a/IMG_jpg.c	Thu Oct 29 04:24:39 2009 +0000
     5.2 +++ b/IMG_jpg.c	Sun Nov 08 15:53:24 2009 +0000
     5.3 @@ -379,7 +379,7 @@
     5.4  	}
     5.5  	start = SDL_RWtell(src);
     5.6  
     5.7 -	if ( IMG_Init(IMG_INIT_JPG) < 0 ) {
     5.8 +	if ( !IMG_Init(IMG_INIT_JPG) ) {
     5.9  		return NULL;
    5.10  	}
    5.11  
     6.1 --- a/IMG_png.c	Thu Oct 29 04:24:39 2009 +0000
     6.2 +++ b/IMG_png.c	Sun Nov 08 15:53:24 2009 +0000
     6.3 @@ -318,7 +318,7 @@
     6.4  	}
     6.5  	start = SDL_RWtell(src);
     6.6  
     6.7 -	if ( IMG_Init(IMG_INIT_PNG) < 0 ) {
     6.8 +	if ( !IMG_Init(IMG_INIT_PNG) ) {
     6.9  		return NULL;
    6.10  	}
    6.11  
     7.1 --- a/IMG_tif.c	Thu Oct 29 04:24:39 2009 +0000
     7.2 +++ b/IMG_tif.c	Sun Nov 08 15:53:24 2009 +0000
     7.3 @@ -216,7 +216,7 @@
     7.4  	}
     7.5  	start = SDL_RWtell(src);
     7.6  
     7.7 -	if ( IMG_Init(IMG_INIT_TIF) < 0 ) {
     7.8 +	if ( !IMG_Init(IMG_INIT_TIF) ) {
     7.9  		return NULL;
    7.10  	}
    7.11  
     8.1 --- a/SDL_image.h	Thu Oct 29 04:24:39 2009 +0000
     8.2 +++ b/SDL_image.h	Sun Nov 08 15:53:24 2009 +0000
     8.3 @@ -64,7 +64,9 @@
     8.4  } IMG_InitFlags;
     8.5  
     8.6  /* Loads dynamic libraries and prepares them for use.  Flags should be
     8.7 -   one or more flags from IMG_InitFlags OR'd together */
     8.8 +   one or more flags from IMG_InitFlags OR'd together.
     8.9 +   It returns the flags successfully initialized, or 0 on failure.
    8.10 + */
    8.11  extern DECLSPEC int SDLCALL IMG_Init(int flags);
    8.12  
    8.13  /* Unloads libraries loaded with IMG_Init */