1
0
Fork 0
forked from len0rd/rockbox

SDL: Silence a large number of compile warnings (WIP)

There are some real bugs in here, but we're drowning in warnings.

Change-Id: I7c2c0eafc8426327521bdd8a3ac2d3742ac16864
This commit is contained in:
Solomon Peachy 2020-04-04 20:24:33 -04:00
parent 2ad6c3438e
commit e28d1fe916
44 changed files with 424 additions and 395 deletions

View file

@ -60,15 +60,15 @@ const SDL_version *IMG_Linked_Version(void)
return(&linked_version);
}
extern int IMG_InitJPG();
extern void IMG_QuitJPG();
extern int IMG_InitPNG();
extern void IMG_QuitPNG();
extern int IMG_InitTIF();
extern void IMG_QuitTIF();
extern int IMG_InitJPG(void);
extern void IMG_QuitJPG(void);
extern int IMG_InitPNG(void);
extern void IMG_QuitPNG(void);
extern int IMG_InitTIF(void);
extern void IMG_QuitTIF(void);
extern int IMG_InitWEBP();
extern void IMG_QuitWEBP();
extern int IMG_InitWEBP(void);
extern void IMG_QuitWEBP(void);
static int initialized = 0;

View file

@ -60,7 +60,7 @@ static struct {
} lib;
#ifdef LOAD_JPG_DYNAMIC
int IMG_InitJPG()
int IMG_InitJPG(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
@ -74,56 +74,56 @@ int IMG_InitJPG()
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_CreateDecompress =
lib.jpeg_CreateDecompress =
(void (*) (j_decompress_ptr, int, size_t))
SDL_LoadFunction(lib.handle, "jpeg_CreateDecompress");
if ( lib.jpeg_CreateDecompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_destroy_decompress =
lib.jpeg_destroy_decompress =
(void (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_destroy_decompress");
if ( lib.jpeg_destroy_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_finish_decompress =
lib.jpeg_finish_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_finish_decompress");
if ( lib.jpeg_finish_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_read_header =
lib.jpeg_read_header =
(int (*) (j_decompress_ptr, boolean))
SDL_LoadFunction(lib.handle, "jpeg_read_header");
if ( lib.jpeg_read_header == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_read_scanlines =
lib.jpeg_read_scanlines =
(JDIMENSION (*) (j_decompress_ptr, JSAMPARRAY, JDIMENSION))
SDL_LoadFunction(lib.handle, "jpeg_read_scanlines");
if ( lib.jpeg_read_scanlines == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_resync_to_restart =
lib.jpeg_resync_to_restart =
(boolean (*) (j_decompress_ptr, int))
SDL_LoadFunction(lib.handle, "jpeg_resync_to_restart");
if ( lib.jpeg_resync_to_restart == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_start_decompress =
lib.jpeg_start_decompress =
(boolean (*) (j_decompress_ptr))
SDL_LoadFunction(lib.handle, "jpeg_start_decompress");
if ( lib.jpeg_start_decompress == NULL ) {
SDL_UnloadObject(lib.handle);
return -1;
}
lib.jpeg_std_error =
lib.jpeg_std_error =
(struct jpeg_error_mgr * (*) (struct jpeg_error_mgr *))
SDL_LoadFunction(lib.handle, "jpeg_std_error");
if ( lib.jpeg_std_error == NULL ) {
@ -135,7 +135,7 @@ int IMG_InitJPG()
return 0;
}
void IMG_QuitJPG()
void IMG_QuitJPG(void)
{
if ( lib.loaded == 0 ) {
return;
@ -146,7 +146,7 @@ void IMG_QuitJPG()
--lib.loaded;
}
#else
int IMG_InitJPG()
int IMG_InitJPG(void)
{
if ( lib.loaded == 0 ) {
lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;
@ -163,7 +163,7 @@ int IMG_InitJPG()
return 0;
}
void IMG_QuitJPG()
void IMG_QuitJPG(void)
{
if ( lib.loaded == 0 ) {
return;
@ -468,13 +468,13 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
#else
int IMG_InitJPG()
int IMG_InitJPG(void)
{
IMG_SetError("JPEG images are not supported");
return(-1);
}
void IMG_QuitJPG()
void IMG_QuitJPG(void)
{
}

View file

@ -32,25 +32,25 @@
/*=============================================================================
File: SDL_png.c
Purpose: A PNG loader and saver for the SDL library
Revision:
Purpose: A PNG loader and saver for the SDL library
Revision:
Created by: Philippe Lavoie (2 November 1998)
lavoie@zeus.genie.uottawa.ca
Modified by:
Modified by:
Copyright notice:
Copyright (C) 1998 Philippe Lavoie
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@ -102,7 +102,7 @@ static struct {
} lib;
#ifdef LOAD_PNG_DYNAMIC
int IMG_InitPNG()
int IMG_InitPNG(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
@ -249,7 +249,7 @@ int IMG_InitPNG()
return 0;
}
void IMG_QuitPNG()
void IMG_QuitPNG(void)
{
if ( lib.loaded == 0 ) {
return;
@ -260,7 +260,7 @@ void IMG_QuitPNG()
--lib.loaded;
}
#else
int IMG_InitPNG()
int IMG_InitPNG(void)
{
if ( lib.loaded == 0 ) {
lib.png_create_info_struct = png_create_info_struct;
@ -289,7 +289,7 @@ int IMG_InitPNG()
return 0;
}
void IMG_QuitPNG()
void IMG_QuitPNG(void)
{
if ( lib.loaded == 0 ) {
return;
@ -526,7 +526,7 @@ SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
palette->colors[i].b = i;
}
} else if (png_num_palette > 0 ) {
palette->ncolors = png_num_palette;
palette->ncolors = png_num_palette;
for( i=0; i<png_num_palette; ++i ) {
palette->colors[i].b = png_palette[i].blue;
palette->colors[i].g = png_palette[i].green;
@ -552,18 +552,18 @@ done: /* Clean up and return */
}
IMG_SetError(error);
}
return(surface);
return(surface);
}
#else
int IMG_InitPNG()
int IMG_InitPNG(void)
{
IMG_SetError("PNG images are not supported");
return(-1);
}
void IMG_QuitPNG()
void IMG_QuitPNG(void)
{
}

View file

@ -42,7 +42,7 @@ static struct {
} lib;
#ifdef LOAD_TIF_DYNAMIC
int IMG_InitTIF()
int IMG_InitTIF(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
@ -89,7 +89,7 @@ int IMG_InitTIF()
return 0;
}
void IMG_QuitTIF()
void IMG_QuitTIF(void)
{
if ( lib.loaded == 0 ) {
return;
@ -100,7 +100,7 @@ void IMG_QuitTIF()
--lib.loaded;
}
#else
int IMG_InitTIF()
int IMG_InitTIF(void)
{
if ( lib.loaded == 0 ) {
lib.TIFFClientOpen = TIFFClientOpen;
@ -113,7 +113,7 @@ int IMG_InitTIF()
return 0;
}
void IMG_QuitTIF()
void IMG_QuitTIF(void)
{
if ( lib.loaded == 0 ) {
return;
@ -222,7 +222,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
}
/* turn off memory mapped access with the m flag */
tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
tiff = lib.TIFFClientOpen("SDL_image", "rm", (thandle_t)src,
tiff_read, tiff_write, tiff_seek, tiff_close, tiff_size, tiff_map, tiff_unmap);
if(!tiff)
goto error;
@ -239,7 +239,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
Rmask, Gmask, Bmask, Amask);
if(!surface)
goto error;
if(!lib.TIFFReadRGBAImage(tiff, img_width, img_height, surface->pixels, 0))
goto error;
@ -258,7 +258,7 @@ SDL_Surface* IMG_LoadTIF_RW(SDL_RWops* src)
}
}
lib.TIFFClose(tiff);
return surface;
error:
@ -271,13 +271,13 @@ error:
#else
int IMG_InitTIF()
int IMG_InitTIF(void)
{
IMG_SetError("TIFF images are not supported");
return(-1);
}
void IMG_QuitTIF()
void IMG_QuitTIF(void)
{
}

View file

@ -30,8 +30,8 @@
/*=============================================================================
File: SDL_webp.c
Purpose: A WEBP loader for the SDL library
Revision:
Purpose: A WEBP loader for the SDL library
Revision:
Created by: Michael Bonfils (Murlock) (26 November 2011)
murlock42@gmail.com
@ -53,14 +53,14 @@ static struct {
} lib;
#ifdef LOAD_WEBP_DYNAMIC
int IMG_InitWEBP()
int IMG_InitWEBP(void)
{
if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC);
if ( lib.handle == NULL ) {
return -1;
}
lib.webp_get_features_internal =
lib.webp_get_features_internal =
( int (*) (const uint8_t *, uint32_t, WebPBitstreamFeatures* const, int) )
SDL_LoadFunction(lib.handle, "WebPGetFeaturesInternal" );
if ( lib.webp_get_features_internal == NULL ) {
@ -68,7 +68,7 @@ int IMG_InitWEBP()
return -1;
}
lib.webp_decode_rgb_into =
lib.webp_decode_rgb_into =
( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) )
SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" );
if ( lib.webp_decode_rgb_into == NULL ) {
@ -76,7 +76,7 @@ int IMG_InitWEBP()
return -1;
}
lib.webp_decode_rgba_into =
lib.webp_decode_rgba_into =
( uint8_t* (*) (const uint8_t*, uint32_t, uint8_t*, int, int ) )
SDL_LoadFunction(lib.handle, "WebPDecodeRGBInto" );
if ( lib.webp_decode_rgba_into == NULL ) {
@ -88,7 +88,7 @@ int IMG_InitWEBP()
return 0;
}
void IMG_QuitWEBP()
void IMG_QuitWEBP(void)
{
if ( lib.loaded == 0 ) {
return;
@ -99,7 +99,7 @@ void IMG_QuitWEBP()
--lib.loaded;
}
#else
int IMG_InitWEBP()
int IMG_InitWEBP(void)
{
if ( lib.loaded == 0 ) {
lib.webp_get_features_internal = WebPGetFeaturesInternal;
@ -110,7 +110,7 @@ int IMG_InitWEBP()
return 0;
}
void IMG_QuitWEBP()
void IMG_QuitWEBP(void)
{
if ( lib.loaded == 0 ) {
return;
@ -207,7 +207,7 @@ SDL_Surface *IMG_LoadWEBP_RW(SDL_RWops *src)
error = "Failed to read WEBP";
goto error;
}
#if 0
// extract size of picture, not interesting since we don't know about alpha channel
int width = -1, height = -1;
@ -270,13 +270,13 @@ error:
#else
int IMG_InitWEBP()
int IMG_InitWEBP(void)
{
IMG_SetError("WEBP images are not supported");
return(-1);
}
void IMG_QuitWEBP()
void IMG_QuitWEBP(void)
{
}