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); return(&linked_version);
} }
extern int IMG_InitJPG(); extern int IMG_InitJPG(void);
extern void IMG_QuitJPG(); extern void IMG_QuitJPG(void);
extern int IMG_InitPNG(); extern int IMG_InitPNG(void);
extern void IMG_QuitPNG(); extern void IMG_QuitPNG(void);
extern int IMG_InitTIF(); extern int IMG_InitTIF(void);
extern void IMG_QuitTIF(); extern void IMG_QuitTIF(void);
extern int IMG_InitWEBP(); extern int IMG_InitWEBP(void);
extern void IMG_QuitWEBP(); extern void IMG_QuitWEBP(void);
static int initialized = 0; static int initialized = 0;

View file

@ -60,7 +60,7 @@ static struct {
} lib; } lib;
#ifdef LOAD_JPG_DYNAMIC #ifdef LOAD_JPG_DYNAMIC
int IMG_InitJPG() int IMG_InitJPG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC); lib.handle = SDL_LoadObject(LOAD_JPG_DYNAMIC);
@ -135,7 +135,7 @@ int IMG_InitJPG()
return 0; return 0;
} }
void IMG_QuitJPG() void IMG_QuitJPG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -146,7 +146,7 @@ void IMG_QuitJPG()
--lib.loaded; --lib.loaded;
} }
#else #else
int IMG_InitJPG() int IMG_InitJPG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions; lib.jpeg_calc_output_dimensions = jpeg_calc_output_dimensions;
@ -163,7 +163,7 @@ int IMG_InitJPG()
return 0; return 0;
} }
void IMG_QuitJPG() void IMG_QuitJPG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -468,13 +468,13 @@ SDL_Surface *IMG_LoadJPG_RW(SDL_RWops *src)
#else #else
int IMG_InitJPG() int IMG_InitJPG(void)
{ {
IMG_SetError("JPEG images are not supported"); IMG_SetError("JPEG images are not supported");
return(-1); return(-1);
} }
void IMG_QuitJPG() void IMG_QuitJPG(void)
{ {
} }

View file

@ -102,7 +102,7 @@ static struct {
} lib; } lib;
#ifdef LOAD_PNG_DYNAMIC #ifdef LOAD_PNG_DYNAMIC
int IMG_InitPNG() int IMG_InitPNG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC); lib.handle = SDL_LoadObject(LOAD_PNG_DYNAMIC);
@ -249,7 +249,7 @@ int IMG_InitPNG()
return 0; return 0;
} }
void IMG_QuitPNG() void IMG_QuitPNG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -260,7 +260,7 @@ void IMG_QuitPNG()
--lib.loaded; --lib.loaded;
} }
#else #else
int IMG_InitPNG() int IMG_InitPNG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.png_create_info_struct = png_create_info_struct; lib.png_create_info_struct = png_create_info_struct;
@ -289,7 +289,7 @@ int IMG_InitPNG()
return 0; return 0;
} }
void IMG_QuitPNG() void IMG_QuitPNG(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -557,13 +557,13 @@ done: /* Clean up and return */
#else #else
int IMG_InitPNG() int IMG_InitPNG(void)
{ {
IMG_SetError("PNG images are not supported"); IMG_SetError("PNG images are not supported");
return(-1); return(-1);
} }
void IMG_QuitPNG() void IMG_QuitPNG(void)
{ {
} }

View file

@ -42,7 +42,7 @@ static struct {
} lib; } lib;
#ifdef LOAD_TIF_DYNAMIC #ifdef LOAD_TIF_DYNAMIC
int IMG_InitTIF() int IMG_InitTIF(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC); lib.handle = SDL_LoadObject(LOAD_TIF_DYNAMIC);
@ -89,7 +89,7 @@ int IMG_InitTIF()
return 0; return 0;
} }
void IMG_QuitTIF() void IMG_QuitTIF(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -100,7 +100,7 @@ void IMG_QuitTIF()
--lib.loaded; --lib.loaded;
} }
#else #else
int IMG_InitTIF() int IMG_InitTIF(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.TIFFClientOpen = TIFFClientOpen; lib.TIFFClientOpen = TIFFClientOpen;
@ -113,7 +113,7 @@ int IMG_InitTIF()
return 0; return 0;
} }
void IMG_QuitTIF() void IMG_QuitTIF(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -271,13 +271,13 @@ error:
#else #else
int IMG_InitTIF() int IMG_InitTIF(void)
{ {
IMG_SetError("TIFF images are not supported"); IMG_SetError("TIFF images are not supported");
return(-1); return(-1);
} }
void IMG_QuitTIF() void IMG_QuitTIF(void)
{ {
} }

View file

@ -53,7 +53,7 @@ static struct {
} lib; } lib;
#ifdef LOAD_WEBP_DYNAMIC #ifdef LOAD_WEBP_DYNAMIC
int IMG_InitWEBP() int IMG_InitWEBP(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC); lib.handle = SDL_LoadObject(LOAD_WEBP_DYNAMIC);
@ -88,7 +88,7 @@ int IMG_InitWEBP()
return 0; return 0;
} }
void IMG_QuitWEBP() void IMG_QuitWEBP(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -99,7 +99,7 @@ void IMG_QuitWEBP()
--lib.loaded; --lib.loaded;
} }
#else #else
int IMG_InitWEBP() int IMG_InitWEBP(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
lib.webp_get_features_internal = WebPGetFeaturesInternal; lib.webp_get_features_internal = WebPGetFeaturesInternal;
@ -110,7 +110,7 @@ int IMG_InitWEBP()
return 0; return 0;
} }
void IMG_QuitWEBP() void IMG_QuitWEBP(void)
{ {
if ( lib.loaded == 0 ) { if ( lib.loaded == 0 ) {
return; return;
@ -270,13 +270,13 @@ error:
#else #else
int IMG_InitWEBP() int IMG_InitWEBP(void)
{ {
IMG_SetError("WEBP images are not supported"); IMG_SetError("WEBP images are not supported");
return(-1); return(-1);
} }
void IMG_QuitWEBP() void IMG_QuitWEBP(void)
{ {
} }

View file

@ -62,5 +62,5 @@ extern flac_loader flac;
#endif /* FLAC_MUSIC */ #endif /* FLAC_MUSIC */
extern int Mix_InitFLAC(); extern int Mix_InitFLAC(void);
extern void Mix_QuitFLAC(); extern void Mix_QuitFLAC(void);

View file

@ -58,5 +58,5 @@ extern mikmod_loader mikmod;
#endif /* MOD_MUSIC */ #endif /* MOD_MUSIC */
extern int Mix_InitMOD(); extern int Mix_InitMOD(void);
extern void Mix_QuitMOD(); extern void Mix_QuitMOD(void);

View file

@ -43,5 +43,5 @@ extern smpeg_loader smpeg;
#endif /* MUSIC_MP3 */ #endif /* MUSIC_MP3 */
extern int Mix_InitMP3(); extern int Mix_InitMP3(void);
extern void Mix_QuitMP3(); extern void Mix_QuitMP3(void);

View file

@ -49,5 +49,5 @@ extern vorbis_loader vorbis;
#endif /* OGG_MUSIC */ #endif /* OGG_MUSIC */
extern int Mix_InitOgg(); extern int Mix_InitOgg(void);
extern void Mix_QuitOgg(); extern void Mix_QuitOgg(void);

View file

@ -173,7 +173,7 @@ static void music_internal_initialize_volume(void);
static void music_internal_volume(int volume); static void music_internal_volume(int volume);
static int music_internal_play(Mix_Music *music, double position); static int music_internal_play(Mix_Music *music, double position);
static int music_internal_position(double position); static int music_internal_position(double position);
static int music_internal_playing(); static int music_internal_playing(void);
static void music_internal_halt(void); static void music_internal_halt(void);

View file

@ -9,7 +9,9 @@
/* This is for use with the SDL library */ /* This is for use with the SDL library */
#ifndef __TIMIDITY_CONFIG_H__ #ifndef __TIMIDITY_CONFIG_H__
#define __TIMIDITY_CONFIG_H__ #define __TIMIDITY_CONFIG_H__
#ifndef SDL
#define SDL #define SDL
#endif
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_endian.h" #include "SDL_endian.h"

View file

@ -6,9 +6,10 @@
it under the terms of the Perl Artistic License, available in COPYING. it under the terms of the Perl Artistic License, available in COPYING.
*/ */
#include "config.h"
#include <SDL_rwops.h> #include <SDL_rwops.h>
#include "config.h"
#include "common.h" #include "common.h"
#include "instrum.h" #include "instrum.h"
#include "playmidi.h" #include "playmidi.h"
@ -1743,4 +1744,3 @@ void Timidity_Close(void)
free_instruments(); free_instruments();
free_pathlist(); free_pathlist();
} }

View file

@ -6,9 +6,10 @@
it under the terms of the Perl Artistic License, available in COPYING. it under the terms of the Perl Artistic License, available in COPYING.
*/ */
#include "config.h"
#include <SDL_rwops.h> #include <SDL_rwops.h>
#include "config.h"
#include "common.h" #include "common.h"
#include "instrum.h" #include "instrum.h"
#include "playmidi.h" #include "playmidi.h"

View file

@ -6,8 +6,8 @@
it under the terms of the Perl Artistic License, available in COPYING. it under the terms of the Perl Artistic License, available in COPYING.
*/ */
#include "SDL.h"
#include "config.h" #include "config.h"
#include "SDL.h"
#include "common.h" #include "common.h"
#include "instrum.h" #include "instrum.h"
#include "playmidi.h" #include "playmidi.h"
@ -356,4 +356,3 @@ const char *Timidity_Error(void)
{ {
return(timidity_error); return(timidity_error);
} }

View file

@ -286,7 +286,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
/* WAV magic header */ /* WAV magic header */
Uint32 RIFFchunk; Uint32 RIFFchunk;
Uint32 wavelen; // Uint32 wavelen;
Uint32 WAVEmagic; Uint32 WAVEmagic;
/* FMT chunk */ /* FMT chunk */
@ -296,7 +296,7 @@ static SDL_RWops *LoadWAVStream (SDL_RWops *src, SDL_AudioSpec *spec,
/* Check the magic header */ /* Check the magic header */
RIFFchunk = SDL_ReadLE32(src); RIFFchunk = SDL_ReadLE32(src);
wavelen = SDL_ReadLE32(src); // wavelen = SDL_ReadLE32(src);
WAVEmagic = SDL_ReadLE32(src); WAVEmagic = SDL_ReadLE32(src);
if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) { if ( (RIFFchunk != RIFF) || (WAVEmagic != WAVE) ) {
Mix_SetError("Unrecognized file type (not WAVE)"); Mix_SetError("Unrecognized file type (not WAVE)");
@ -416,7 +416,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
Uint32 AIFFmagic; Uint32 AIFFmagic;
/* SSND chunk */ /* SSND chunk */
Uint32 offset; Uint32 offset;
Uint32 blocksize; // Uint32 blocksize;
/* COMM format chunk */ /* COMM format chunk */
Uint16 channels = 0; Uint16 channels = 0;
Uint32 numsamples = 0; Uint32 numsamples = 0;
@ -459,7 +459,7 @@ static SDL_RWops *LoadAIFFStream (SDL_RWops *src, SDL_AudioSpec *spec,
case SSND: case SSND:
found_SSND = 1; found_SSND = 1;
offset = SDL_ReadBE32(src); offset = SDL_ReadBE32(src);
blocksize = SDL_ReadBE32(src); // blocksize = SDL_ReadBE32(src);
*start = SDL_RWtell(src) + offset; *start = SDL_RWtell(src) + offset;
break; break;
@ -518,4 +518,3 @@ done:
} }
return(src); return(src);
} }

View file

@ -92,6 +92,9 @@
#undef strdup #undef strdup
/* clock() wraps current_tick */ /* clock() wraps current_tick */
#ifdef CLOCKS_PER_SEC
#undef CLOCKS_PER_SEC
#endif
#define CLOCKS_PER_SEC HZ #define CLOCKS_PER_SEC HZ
/* /*
@ -160,9 +163,13 @@
#define strlcpy rb->strlcpy #define strlcpy rb->strlcpy
#define strlen rb->strlen #define strlen rb->strlen
#define strncasecmp rb->strncasecmp #define strncasecmp rb->strncasecmp
#ifndef strncat
#define strncat rb->strlcat /* hack */ #define strncat rb->strlcat /* hack */
#endif
#define strncmp rb->strncmp #define strncmp rb->strncmp
#ifndef strncat
#define strpbrk strpbrk_wrapper #define strpbrk strpbrk_wrapper
#endif
#define strrchr rb->strrchr #define strrchr rb->strrchr
#define strstr SDL_strstr #define strstr SDL_strstr
#define strtok strtok_wrapper #define strtok strtok_wrapper

View file

@ -71,8 +71,8 @@ void cleanup(void)
#endif #endif
} }
/* 256KB */ static long main_stack[1024 * 1024 / 4]; /* ie 1 MB */
static long main_stack[1024 * 1024 / 2];
int (*main_fn)(int argc, char *argv[]); int (*main_fn)(int argc, char *argv[]);
int prog_idx; int prog_idx;
static void main_thread(void) static void main_thread(void)

View file

@ -1318,7 +1318,7 @@ void WritePaletteToFile(uint8_t* palette,const char* filename,int width, int hei
} }
void WriteLastPaletteToFile(){ void WriteLastPaletteToFile(void){
WritePaletteToFile(lastPalette,"lastPalette.tga",16,16); WritePaletteToFile(lastPalette,"lastPalette.tga",16,16);
} }
@ -1913,4 +1913,3 @@ void TIMER_GetPlatformTicks(int64_t* t)
*t = SDL_GetTicks(); *t = SDL_GetTicks();
} }
/* end of sdl_driver.c ... */ /* end of sdl_driver.c ... */

View file

@ -96,7 +96,7 @@ void timerhandler(void);
/* resolution inits. sdl_driver.c ... */ /* resolution inits. sdl_driver.c ... */
int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim); int32_t _setgamemode(uint8_t davidoption, int32_t daxdim, int32_t daydim);
uint32_t getticks(); uint32_t getticks(void);
void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color); void drawline16(int32_t XStart, int32_t YStart, int32_t XEnd, int32_t YEnd, uint8_t Color);
void setcolor16(uint8_t color); void setcolor16(uint8_t color);
@ -106,5 +106,3 @@ void setcolor16(uint8_t color);
void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority); void initmultiplayers(uint8_t damultioption, uint8_t dacomrateoption, uint8_t dapriority);
#endif #endif

View file

@ -11,8 +11,8 @@
#include "platform.h" #include "platform.h"
void Setup_UnstableNetworking(); void Setup_UnstableNetworking(void);
void Setup_StableNetworking(); void Setup_StableNetworking(void);
void callcommit(void); void callcommit(void);
void initcrc(void); void initcrc(void);

View file

@ -56,8 +56,12 @@
#define IP_RECVERR SO_BROADCAST #define IP_RECVERR SO_BROADCAST
*/ */
#ifndef stricmp
#define stricmp strcasecmp #define stricmp strcasecmp
#endif
#ifndef strcmpi
#define strcmpi strcasecmp #define strcmpi strcasecmp
#endif
#define S_IREAD S_IRUSR #define S_IREAD S_IRUSR

View file

@ -51,7 +51,7 @@ static inline int cnv_offset(int src)
// extern __stdcall OutputDebugStringA(char *); // extern __stdcall OutputDebugStringA(char *);
static inline void check_buffer() static inline void check_buffer(void)
{ {
int new_delay = cnv_offset(MV_ReverbDelay); int new_delay = cnv_offset(MV_ReverbDelay);

View file

@ -23,8 +23,8 @@ typedef struct console_element
// Private member functions // Private member functions
void CONSOLE_InsertUsedCommand(const char * szUsedCommand); void CONSOLE_InsertUsedCommand(const char * szUsedCommand);
void CONSOLE_ClearUsedCommandList(); void CONSOLE_ClearUsedCommandList(void);
void CONSOLE_RecalculateDirtyBuffer(); void CONSOLE_RecalculateDirtyBuffer(void);
// console argument tracker // console argument tracker
int argc; int argc;
@ -50,7 +50,7 @@ int nConsole_Active = 0;
void CVAR_RegisterDefaultCvarBindings(void); void CVAR_RegisterDefaultCvarBindings(void);
// Initialize the console // Initialize the console
void CONSOLE_Init() void CONSOLE_Init(void)
{ {
CONSOLE_Reset(); CONSOLE_Reset();
@ -63,7 +63,7 @@ void CONSOLE_Init()
CONSOLE_Printf("Type \'HELP\' for help with console Commands."); CONSOLE_Printf("Type \'HELP\' for help with console Commands.");
} }
void CONSOLE_Reset() void CONSOLE_Reset(void)
{ {
CONSOLEELEMENT *pElement; CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement; CONSOLEELEMENT *pDelElement;
@ -354,7 +354,7 @@ void CONSOLE_HandleInput()
KB_ClearLastScanCode(); KB_ClearLastScanCode();
} }
void CONSOLE_Render() void CONSOLE_Render(void)
{ {
if(g_CV_classic) if(g_CV_classic)
{ {
@ -517,7 +517,7 @@ void CONSOLE_InsertUsedCommand(const char * szUsedCommand)
} }
} }
void CONSOLE_ClearUsedCommandList() void CONSOLE_ClearUsedCommandList(void)
{ {
CONSOLEELEMENT *pElement; CONSOLEELEMENT *pElement;
CONSOLEELEMENT *pDelElement; CONSOLEELEMENT *pDelElement;
@ -537,7 +537,7 @@ void CONSOLE_ClearUsedCommandList()
} }
void CONSOLE_RecalculateDirtyBuffer() void CONSOLE_RecalculateDirtyBuffer(void)
{ {
int len; int len;
int l; int l;
@ -605,7 +605,7 @@ void CONSOLE_Printf(const char *newmsg, ...)
} }
// Get the current number of args for this keyword // Get the current number of args for this keyword
int CONSOLE_GetArgc() int CONSOLE_GetArgc(void)
{ {
return argc; return argc;
} }
@ -617,7 +617,7 @@ char * CONSOLE_GetArgv(unsigned int var)
} }
// Is our console showing? // Is our console showing?
int CONSOLE_IsActive() int CONSOLE_IsActive(void)
{ {
return nConsole_Active; return nConsole_Active;

View file

@ -3,17 +3,17 @@
// Public member functions // Public member functions
void CONSOLE_Init(); void CONSOLE_Init(void);
void CONSOLE_Reset(); void CONSOLE_Reset(void);
void CONSOLE_Term(); void CONSOLE_Term(void);
void CONSOLE_ParseStartupScript(); void CONSOLE_ParseStartupScript(void);
void CONSOLE_HandleInput(); void CONSOLE_HandleInput(void);
void CONSOLE_Render(); void CONSOLE_Render(void);
void CONSOLE_ParseCommand(char * command); void CONSOLE_ParseCommand(char * command);
void CONSOLE_Printf(const char *newmsg, ...); void CONSOLE_Printf(const char *newmsg, ...);
int CONSOLE_GetArgc(); int CONSOLE_GetArgc(void);
char * CONSOLE_GetArgv(unsigned int var); char * CONSOLE_GetArgv(unsigned int var);
int CONSOLE_IsActive(); int CONSOLE_IsActive(void);
void CONSOLE_SetActive(int i); void CONSOLE_SetActive(int i);
#endif #endif

View file

@ -3,8 +3,8 @@
#include <inttypes.h> #include <inttypes.h>
void CVARDEFS_Init(); void CVARDEFS_Init(void);
void CVARDEFS_Render(); void CVARDEFS_Render(void);
// //
// Function declarations // Function declarations
// //

View file

@ -18,8 +18,8 @@ typedef struct t_cvar_binding
void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function); void CVAR_RegisterCvar(const char * varname, const char * varhelp, void* variable, function_t function);
int CVAR_GetNumCvarBindings(); int CVAR_GetNumCvarBindings(void);
cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding); cvar_binding* CVAR_GetCvarBinding(unsigned int nBinding);
void CVAR_Render(); void CVAR_Render(void);
#endif #endif

View file

@ -31,6 +31,7 @@ void Shutdown(void);
#endif #endif
#ifdef ROCKBOX #ifdef ROCKBOX
#undef BYTE_ORDER
#ifdef ROCKBOX_LITTLE_ENDIAN #ifdef ROCKBOX_LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN #define BYTE_ORDER LITTLE_ENDIAN
#else #else

View file

@ -67,8 +67,12 @@ typedef float64 appfloat;
// //
//*************************************************************************** //***************************************************************************
#ifndef true
#define true ( 1 == 1 ) #define true ( 1 == 1 )
#endif
#ifndef false
#define false ( ! true ) #define false ( ! true )
#endif
//*************************************************************************** //***************************************************************************
// //

View file

@ -60,7 +60,7 @@ int16 IntelShort (int16 l);
int32_t Motoint32_t (int32_t l); int32_t Motoint32_t (int32_t l);
int32_t Intelint32_t (int32_t l); int32_t Intelint32_t (int32_t l);
void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)()); //void HeapSort(uint8_t * base, int32 nel, int32 width, int32 (*compare)(), void (*switcher)());
#ifdef __cplusplus #ifdef __cplusplus
}; };

View file

@ -178,26 +178,27 @@ float CL_KeyState (kbutton_t *key)
down = key->state & 1; down = key->state & 1;
val = 0; val = 0;
if (impulsedown && !impulseup) if (impulsedown && !impulseup) {
if (down) if (down)
val = 0.5; // pressed and held this frame val = 0.5; // pressed and held this frame
else else
val = 0; // I_Error (); val = 0; // I_Error ();
if (impulseup && !impulsedown) } else if (impulseup && !impulsedown) {
if (down) if (down)
val = 0; // I_Error (); val = 0; // I_Error ();
else else
val = 0; // released this frame val = 0; // released this frame
if (!impulsedown && !impulseup) } else if (!impulsedown && !impulseup) {
if (down) if (down)
val = 1.0; // held the entire frame val = 1.0; // held the entire frame
else else
val = 0; // up the entire frame val = 0; // up the entire frame
if (impulsedown && impulseup) } else if (impulsedown && impulseup) {
if (down) if (down)
val = 0.75; // released and re-pressed this frame val = 0.75; // released and re-pressed this frame
else else
val = 0.25; // pressed and released this frame val = 0.25; // pressed and released this frame
}
key->state &= 1; // clear impulses key->state &= 1; // clear impulses

View file

@ -182,6 +182,9 @@ extern byte *r_skysource;
#define DR_TRANSPARENT 1 #define DR_TRANSPARENT 1
// !!! must be kept the same as in quakeasm.h !!! // !!! must be kept the same as in quakeasm.h !!!
#ifdef TRANSPARENT_COLOR
#undef TRANSPARENT_COLOR
#endif
#define TRANSPARENT_COLOR 0xFF #define TRANSPARENT_COLOR 0xFF
extern void *acolormap; // FIXME: should go away extern void *acolormap; // FIXME: should go away

View file

@ -69,6 +69,8 @@ void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
//void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt //void VectorNormalizeNoRet (vec3_t v); // uses finvsqrt
//float VectorNormalize (vec3_t v); // returns vector length //float VectorNormalize (vec3_t v); // returns vector length
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
static inline float InvSqrt( float number ) { static inline float InvSqrt( float number ) {
long i; long i;
float x2, y; float x2, y;
@ -84,6 +86,7 @@ static inline float InvSqrt( float number ) {
return y; return y;
} }
#pragma GCC diagnostic pop
static inline void VectorNormalizeNoRet (vec3_t v) static inline void VectorNormalizeNoRet (vec3_t v)
{ {

View file

@ -314,7 +314,7 @@ typedef struct _PollProcedure
{ {
struct _PollProcedure *next; struct _PollProcedure *next;
double nextTime; double nextTime;
void (*procedure)(); void (*procedure)(void *);
void *arg; void *arg;
} PollProcedure; } PollProcedure;

View file

@ -250,7 +250,7 @@ void SV_MoveToGoal (void);
void SV_CheckForNewClients (void); void SV_CheckForNewClients (void);
void SV_RunClients (void); void SV_RunClients (void);
void SV_SaveSpawnparms (); void SV_SaveSpawnparms (void);
#ifdef QUAKE2 #ifdef QUAKE2
void SV_SpawnServer (char *server, char *startspot); void SV_SpawnServer (char *server, char *startspot);
#else #else

View file

@ -165,12 +165,12 @@ extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy); extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode); extern const char *IN_GetScanName(ScanCode);
void IN_WaitAndProcessEvents(); void IN_WaitAndProcessEvents(void);
void IN_ProcessEvents(); void IN_ProcessEvents(void);
int IN_MouseButtons (void); int IN_MouseButtons (void);
boolean IN_JoyPresent(); boolean IN_JoyPresent(void);
void IN_SetJoyCurrent(int joyIndex); void IN_SetJoyCurrent(int joyIndex);
int IN_JoyButtons (void); int IN_JoyButtons (void);
void IN_GetJoyDelta(int *dx,int *dy); void IN_GetJoyDelta(int *dx,int *dy);
@ -178,6 +178,6 @@ void IN_GetJoyFineDelta(int *dx, int *dy);
void IN_StartAck(void); void IN_StartAck(void);
boolean IN_CheckAck (void); boolean IN_CheckAck (void);
bool IN_IsInputGrabbed(); bool IN_IsInputGrabbed(void);
void IN_CenterMouse(); void IN_CenterMouse(void);
#endif #endif

View file

@ -17,40 +17,40 @@ extern bool PMSoundInfoPagePadded;
// The last pointer points one byte after the last page. // The last pointer points one byte after the last page.
extern uint8_t **PMPages; extern uint8_t **PMPages;
void PM_Startup(); void PM_Startup(void);
void PM_Shutdown(); void PM_Shutdown(void);
static uint32_t PM_GetPageSize(int page) static inline uint32_t PM_GetPageSize(int page)
{ {
if(page < 0 || page >= ChunksInFile) if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPageSize: Tried to access illegal page: %i", page); Quit("PM_GetPageSize: Tried to access illegal page: %i", page);
return (uint32_t) (PMPages[page + 1] - PMPages[page]); return (uint32_t) (PMPages[page + 1] - PMPages[page]);
} }
static uint8_t *PM_GetPage(int page) static inline uint8_t *PM_GetPage(int page)
{ {
if(page < 0 || page >= ChunksInFile) if(page < 0 || page >= ChunksInFile)
Quit("PM_GetPage: Tried to access illegal page: %i", page); Quit("PM_GetPage: Tried to access illegal page: %i", page);
return PMPages[page]; return PMPages[page];
} }
static uint8_t *PM_GetEnd() static inline uint8_t *PM_GetEnd(void)
{ {
return PMPages[ChunksInFile]; return PMPages[ChunksInFile];
} }
static byte *PM_GetTexture(int wallpic) static inline byte *PM_GetTexture(int wallpic)
{ {
return PM_GetPage(wallpic); return PM_GetPage(wallpic);
} }
static uint16_t *PM_GetSprite(int shapenum) static inline uint16_t *PM_GetSprite(int shapenum)
{ {
// correct alignment is enforced by PM_Startup() // correct alignment is enforced by PM_Startup()
return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum); return (uint16_t *) (void *) PM_GetPage(PMSpriteStart + shapenum);
} }
static byte *PM_GetSound(int soundpagenum) static inline byte *PM_GetSound(int soundpagenum)
{ {
return PM_GetPage(PMSoundStart + soundpagenum); return PM_GetPage(PMSoundStart + soundpagenum);
} }

View file

@ -96,6 +96,6 @@ void USL_PrintInCenter(const char *s,Rect r);
char *USL_GiveSaveName(word game); char *USL_GiveSaveName(word game);
void US_InitRndT(int randomize); void US_InitRndT(int randomize);
int US_RndT(); int US_RndT(void);
#endif #endif

View file

@ -64,7 +64,7 @@ void VWB_Vlin (int y1, int y2, int x, int color);
#define VWB_HlinScaledCoord VW_Hlin #define VWB_HlinScaledCoord VW_Hlin
#define VWB_VlinScaledCoord VW_Vlin #define VWB_VlinScaledCoord VW_Vlin
void VH_UpdateScreen(); void VH_UpdateScreen(void);
#define VW_UpdateScreen VH_UpdateScreen #define VW_UpdateScreen VH_UpdateScreen
// //
@ -91,7 +91,7 @@ void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum); void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum);
void LoadLatchMem (void); void LoadLatchMem (void);
void VH_Startup(); void VH_Startup(void);
boolean FizzleFade (SDL_Surface *source, int x1, int y1, boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable); unsigned width, unsigned height, unsigned frames, boolean abortable);

View file

@ -961,7 +961,7 @@ void DrawPlayBorder (void);
void DrawStatusBorder (byte color); void DrawStatusBorder (byte color);
void DrawPlayScreen (void); void DrawPlayScreen (void);
void DrawPlayBorderSides (void); void DrawPlayBorderSides (void);
void ShowActStatus(); void ShowActStatus(void);
void PlayDemo (int demonumber); void PlayDemo (int demonumber);
void RecordDemo (void); void RecordDemo (void);
@ -1372,7 +1372,7 @@ void GP2X_ButtonUp(int button);
============================================================================= =============================================================================
*/ */
static fixed FixedMul(fixed a, fixed b) static inline fixed FixedMul(fixed a, fixed b)
{ {
return (fixed)(((int64_t)a * b + 0x8000) >> 16); return (fixed)(((int64_t)a * b + 0x8000) >> 16);
} }
@ -1394,13 +1394,13 @@ static fixed FixedMul(fixed a, fixed b)
#define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__)
static char* itoa(int value, char* string, int radix) static inline char* itoa(int value, char* string, int radix)
{ {
sprintf(string, "%d", value); sprintf(string, "%d", value);
return string; return string;
} }
static char* ltoa(long value, char* string, int radix) static inline char* ltoa(long value, char* string, int radix)
{ {
sprintf(string, "%ld", value); sprintf(string, "%ld", value);
return string; return string;
@ -1409,14 +1409,14 @@ static char* ltoa(long value, char* string, int radix)
#define lengthof(x) (sizeof(x) / sizeof(*(x))) #define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define endof(x) ((x) + lengthof(x)) #define endof(x) ((x) + lengthof(x))
static word READWORD(byte **ptr) static inline word READWORD(byte **ptr)
{ {
word val = (*ptr)[0] | (*ptr)[1] << 8; word val = (*ptr)[0] | (*ptr)[1] << 8;
*ptr += 2; *ptr += 2;
return val; return val;
} }
static longword READLONGWORD(byte **ptr) static inline longword READLONGWORD(byte **ptr)
{ {
longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24; longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24;
*ptr += 4; *ptr += 4;
@ -1454,7 +1454,7 @@ static longword READLONGWORD(byte **ptr)
*************************************************************/ *************************************************************/
// The feature flags are stored as a wall in the upper right corner of each level // The feature flags are stored as a wall in the upper right corner of each level
static word GetFeatureFlags() static inline word GetFeatureFlags()
{ {
return ffDataTopRight; return ffDataTopRight;
} }

View file

@ -251,7 +251,7 @@ boolean TransformTile (int tx, int ty, short *dispx, short *dispheight)
==================== ====================
*/ */
int CalcHeight() int CalcHeight(void)
{ {
fixed z = FixedMul(xintercept - viewx, viewcos) fixed z = FixedMul(xintercept - viewx, viewcos)
- FixedMul(yintercept - viewy, viewsin); - FixedMul(yintercept - viewy, viewsin);
@ -275,7 +275,7 @@ byte *postsource;
int postx; int postx;
int postwidth; int postwidth;
void ScalePost() void ScalePost(void)
{ {
int ywcount, yoffs, yw, yd, yendoffs; int ywcount, yoffs, yw, yd, yendoffs;
byte col; byte col;
@ -1091,7 +1091,7 @@ void CalcTics (void)
//========================================================================== //==========================================================================
void AsmRefresh() void AsmRefresh(void)
{ {
int32_t xstep,ystep; int32_t xstep,ystep;
longword xpartial,ypartial; longword xpartial,ypartial;
@ -1517,7 +1517,7 @@ void WallRefresh (void)
ScalePost (); // no more optimization on last post ScalePost (); // no more optimization on last post
} }
void CalcViewVariables() void CalcViewVariables(void)
{ {
viewangle = player->angle; viewangle = player->angle;
midangle = viewangle*(FINEANGLES/ANGLES); midangle = viewangle*(FINEANGLES/ANGLES);

View file

@ -118,10 +118,10 @@ extern CP_iteminfo MainItems;
void US_ControlPanel(ScanCode); void US_ControlPanel(ScanCode);
void EnableEndGameMenuItem(); void EnableEndGameMenuItem(void);
void SetupControlPanel(void); void SetupControlPanel(void);
void SetupSaveGames(); void SetupSaveGames(void);
void CleanupControlPanel(void); void CleanupControlPanel(void);
void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items); void DrawMenu(CP_iteminfo *item_i,CP_itemtype *items);

View file

@ -32,6 +32,13 @@ SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \ -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings -D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings
# WIP SDLFLAGS for warning deletions
#SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
#-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wno-sign-compare \
#-Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unknown-pragmas \
#-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
#-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF
# use FPU on ARMv6 # use FPU on ARMv6
ifeq ($(ARCH_VERSION),6) ifeq ($(ARCH_VERSION),6)
SDLFLAGS += -mfloat-abi=softfp SDLFLAGS += -mfloat-abi=softfp

View file

@ -413,6 +413,8 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
was_error = 1; was_error = 1;
goto done; goto done;
} }
chunk.data = NULL;
chunk.length = 0;
/* Check the magic header */ /* Check the magic header */
RIFFchunk = SDL_ReadLE32(src); RIFFchunk = SDL_ReadLE32(src);
@ -432,7 +434,6 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
headerDiff += sizeof(Uint32); /* for WAVE */ headerDiff += sizeof(Uint32); /* for WAVE */
/* Read the audio data format chunk */ /* Read the audio data format chunk */
chunk.data = NULL;
do { do {
if ( chunk.data != NULL ) { if ( chunk.data != NULL ) {
SDL_free(chunk.data); SDL_free(chunk.data);

View file

@ -29,10 +29,10 @@
/* Math routines from uClibc: http://www.uclibc.org */ /* Math routines from uClibc: http://www.uclibc.org */
#include "math_private.h" #include "math_private.h"
#include "e_sqrt.h" #include "e_sqrt.h"
#include "e_pow.h" //#include "e_pow.h"
#include "e_log.h" //#include "e_log.h"
#define pow(x, y) __ieee754_pow(x, y) //#define pow(x, y) __ieee754_pow(x, y)
#define log(x) __ieee754_log(x) //#define log(x) __ieee754_log(x)
#endif #endif
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"