Patch from Sylvain to fix clang warnings

This commit is contained in:
Sam Lantinga 2016-11-13 22:57:41 -08:00
parent c13a077d15
commit 57d01d7d67
50 changed files with 285 additions and 167 deletions

View File

@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription,
/** /**
* \brief Resets the assert summary counters to zero. * \brief Resets the assert summary counters to zero.
*/ */
void SDLTest_ResetAssertSummary(); void SDLTest_ResetAssertSummary(void);
/** /**
* \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/ */
void SDLTest_LogAssertSummary(); void SDLTest_LogAssertSummary(void);
/** /**
@ -93,7 +93,7 @@ void SDLTest_LogAssertSummary();
* *
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
*/ */
int SDLTest_AssertSummaryToTestResult(); int SDLTest_AssertSummaryToTestResult(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey);
* *
* \returns Generated integer * \returns Generated integer
*/ */
Uint8 SDLTest_RandomUint8(); Uint8 SDLTest_RandomUint8(void);
/** /**
* Returns a random Sint8 * Returns a random Sint8
* *
* \returns Generated signed integer * \returns Generated signed integer
*/ */
Sint8 SDLTest_RandomSint8(); Sint8 SDLTest_RandomSint8(void);
/** /**
@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8();
* *
* \returns Generated integer * \returns Generated integer
*/ */
Uint16 SDLTest_RandomUint16(); Uint16 SDLTest_RandomUint16(void);
/** /**
* Returns a random Sint16 * Returns a random Sint16
* *
* \returns Generated signed integer * \returns Generated signed integer
*/ */
Sint16 SDLTest_RandomSint16(); Sint16 SDLTest_RandomSint16(void);
/** /**
@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16();
* *
* \returns Generated integer * \returns Generated integer
*/ */
Sint32 SDLTest_RandomSint32(); Sint32 SDLTest_RandomSint32(void);
/** /**
@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32();
* *
* \returns Generated integer * \returns Generated integer
*/ */
Uint32 SDLTest_RandomUint32(); Uint32 SDLTest_RandomUint32(void);
/** /**
* Returns random Uint64. * Returns random Uint64.
* *
* \returns Generated integer * \returns Generated integer
*/ */
Uint64 SDLTest_RandomUint64(); Uint64 SDLTest_RandomUint64(void);
/** /**
@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64();
* *
* \returns Generated signed integer * \returns Generated signed integer
*/ */
Sint64 SDLTest_RandomSint64(); Sint64 SDLTest_RandomSint64(void);
/** /**
* \returns random float in range [0.0 - 1.0[ * \returns random float in range [0.0 - 1.0[
*/ */
float SDLTest_RandomUnitFloat(); float SDLTest_RandomUnitFloat(void);
/** /**
* \returns random double in range [0.0 - 1.0[ * \returns random double in range [0.0 - 1.0[
*/ */
double SDLTest_RandomUnitDouble(); double SDLTest_RandomUnitDouble(void);
/** /**
* \returns random float. * \returns random float.
* *
*/ */
float SDLTest_RandomFloat(); float SDLTest_RandomFloat(void);
/** /**
* \returns random double. * \returns random double.
* *
*/ */
double SDLTest_RandomDouble(); double SDLTest_RandomDouble(void);
/** /**
* Returns a random boundary value for Uint8 within the given boundaries. * Returns a random boundary value for Uint8 within the given boundaries.
@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
* *
* \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/ */
char * SDLTest_RandomAsciiString(); char * SDLTest_RandomAsciiString(void);
/** /**
@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size);
/** /**
* Returns the invocation count for the fuzzer since last ...FuzzerInit. * Returns the invocation count for the fuzzer since last ...FuzzerInit.
*/ */
int SDLTest_GetFuzzerInvocationCount(); int SDLTest_GetFuzzerInvocationCount(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s {
} SDLTest_SurfaceImage_t; } SDLTest_SurfaceImage_t;
/* Test images */ /* Test images */
SDL_Surface *SDLTest_ImageBlit(); SDL_Surface *SDLTest_ImageBlit(void);
SDL_Surface *SDLTest_ImageBlitColor(); SDL_Surface *SDLTest_ImageBlitColor(void);
SDL_Surface *SDLTest_ImageBlitAlpha(); SDL_Surface *SDLTest_ImageBlitAlpha(void);
SDL_Surface *SDLTest_ImageBlitBlendAdd(); SDL_Surface *SDLTest_ImageBlitBlendAdd(void);
SDL_Surface *SDLTest_ImageBlitBlend(); SDL_Surface *SDLTest_ImageBlitBlend(void);
SDL_Surface *SDLTest_ImageBlitBlendMod(); SDL_Surface *SDLTest_ImageBlitBlendMod(void);
SDL_Surface *SDLTest_ImageBlitBlendNone(); SDL_Surface *SDLTest_ImageBlitBlendNone(void);
SDL_Surface *SDLTest_ImageBlitBlendAll(); SDL_Surface *SDLTest_ImageBlitBlendAll(void);
SDL_Surface *SDLTest_ImageFace(); SDL_Surface *SDLTest_ImageFace(void);
SDL_Surface *SDLTest_ImagePrimitives(); SDL_Surface *SDLTest_ImagePrimitives(void);
SDL_Surface *SDLTest_ImagePrimitivesBlend(); SDL_Surface *SDLTest_ImagePrimitivesBlend(void);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -36,10 +36,7 @@
/* Initialization/Cleanup routines */ /* Initialization/Cleanup routines */
#if !SDL_TIMERS_DISABLED #if !SDL_TIMERS_DISABLED
extern int SDL_TimerInit(void); # include "timer/SDL_timer_c.h"
extern void SDL_TimerQuit(void);
extern void SDL_TicksInit(void);
extern void SDL_TicksQuit(void);
#endif #endif
#if SDL_VIDEO_DRIVER_WINDOWS #if SDL_VIDEO_DRIVER_WINDOWS
extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowCreate(void);

View File

@ -33,36 +33,6 @@
static SDL_AudioDriver current_audio; static SDL_AudioDriver current_audio;
static SDL_AudioDevice *open_devices[16]; static SDL_AudioDevice *open_devices[16];
/*
* Not all of these will be compiled and linked in, but it's convenient
* to have a complete list here and saves yet-another block of #ifdefs...
* Please see bootstrap[], below, for the actual #ifdef mess.
*/
extern AudioBootStrap PULSEAUDIO_bootstrap;
extern AudioBootStrap ALSA_bootstrap;
extern AudioBootStrap SNDIO_bootstrap;
extern AudioBootStrap BSD_AUDIO_bootstrap;
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap QSAAUDIO_bootstrap;
extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap ARTS_bootstrap;
extern AudioBootStrap ESD_bootstrap;
extern AudioBootStrap NACLAUDIO_bootstrap;
extern AudioBootStrap NAS_bootstrap;
extern AudioBootStrap XAUDIO2_bootstrap;
extern AudioBootStrap DSOUND_bootstrap;
extern AudioBootStrap WINMM_bootstrap;
extern AudioBootStrap PAUDIO_bootstrap;
extern AudioBootStrap HAIKUAUDIO_bootstrap;
extern AudioBootStrap COREAUDIO_bootstrap;
extern AudioBootStrap DISKAUDIO_bootstrap;
extern AudioBootStrap DUMMYAUDIO_bootstrap;
extern AudioBootStrap FUSIONSOUND_bootstrap;
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
extern AudioBootStrap PSPAUDIO_bootstrap;
extern AudioBootStrap SNDIO_bootstrap;
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
/* Available audio drivers */ /* Available audio drivers */
static const AudioBootStrap *const bootstrap[] = { static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_PULSEAUDIO #if SDL_AUDIO_DRIVER_PULSEAUDIO

View File

@ -200,6 +200,78 @@ typedef struct AudioBootStrap
int demand_only; /* 1==request explicitly, or it won't be available. */ int demand_only; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap; } AudioBootStrap;
#if SDL_AUDIO_DRIVER_PULSEAUDIO
extern AudioBootStrap PULSEAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ALSA
extern AudioBootStrap ALSA_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_SNDIO
extern AudioBootStrap SNDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_BSD
extern AudioBootStrap BSD_AUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_OSS
extern AudioBootStrap DSP_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_QSA
extern AudioBootStrap QSAAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_SUNAUDIO
extern AudioBootStrap SUNAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ARTS
extern AudioBootStrap ARTS_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ESD
extern AudioBootStrap ESD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_NACL
extern AudioBootStrap NACLAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_NAS
extern AudioBootStrap NAS_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_XAUDIO2
extern AudioBootStrap XAUDIO2_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DSOUND
extern AudioBootStrap DSOUND_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_WINMM
extern AudioBootStrap WINMM_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PAUDIO
extern AudioBootStrap PAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_HAIKU
extern AudioBootStrap HAIKUAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_COREAUDIO
extern AudioBootStrap COREAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DISK
extern AudioBootStrap DISKAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DUMMY
extern AudioBootStrap DUMMYAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_FUSIONSOUND
extern AudioBootStrap FUSIONSOUND_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_ANDROID
extern AudioBootStrap ANDROIDAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PSP
extern AudioBootStrap PSPAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_EMSCRIPTEN
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
#endif
#endif /* _SDL_sysaudio_h */ #endif /* _SDL_sysaudio_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View File

@ -27,12 +27,12 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_rect.h" #include "SDL_rect.h"
extern SDL_bool SDL_IME_Init(); extern SDL_bool SDL_IME_Init(void);
extern void SDL_IME_Quit(); extern void SDL_IME_Quit(void);
extern void SDL_IME_SetFocus(SDL_bool focused); extern void SDL_IME_SetFocus(SDL_bool focused);
extern void SDL_IME_Reset(); extern void SDL_IME_Reset(void);
extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode);
extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect);
extern void SDL_IME_PumpEvents(); extern void SDL_IME_PumpEvents(void);
#endif /* _SDL_ime_h */ #endif /* _SDL_ime_h */

View File

@ -280,7 +280,7 @@ SDL_UDEV_LoadLibrary(void)
#define BITS_PER_LONG (sizeof(unsigned long) * 8) #define BITS_PER_LONG (sizeof(unsigned long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define OFF(x) ((x)%BITS_PER_LONG) #define OFF(x) ((x)%BITS_PER_LONG)
#define BIT(x) (1UL<<OFF(x)) /* #define BIT(x) (1UL<<OFF(x)) */
#define LONG(x) ((x)/BITS_PER_LONG) #define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1)

View File

@ -71,9 +71,9 @@ typedef struct {
SDL_bool recording; SDL_bool recording;
} SDL_GestureTouch; } SDL_GestureTouch;
SDL_GestureTouch *SDL_gestureTouch; static SDL_GestureTouch *SDL_gestureTouch;
int SDL_numGestureTouches = 0; static int SDL_numGestureTouches = 0;
SDL_bool recordAll; static SDL_bool recordAll;
#if 0 #if 0
static void PrintPath(SDL_FloatPoint *path) static void PrintPath(SDL_FloatPoint *path)
@ -468,7 +468,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id)
return NULL; return NULL;
} }
int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
{ {
SDL_Event event; SDL_Event event;
event.mgesture.type = SDL_MULTIGESTURE; event.mgesture.type = SDL_MULTIGESTURE;

View File

@ -82,6 +82,7 @@ SDL_GetMouseFocus(void)
return mouse->focus; return mouse->focus;
} }
#if 0
void void
SDL_ResetMouse(void) SDL_ResetMouse(void)
{ {
@ -98,6 +99,7 @@ SDL_ResetMouse(void)
} }
SDL_assert(mouse->buttonstate == 0); SDL_assert(mouse->buttonstate == 0);
} }
#endif
void void
SDL_SetMouseFocus(SDL_Window * window) SDL_SetMouseFocus(SDL_Window * window)

View File

@ -92,7 +92,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid)
return -1; return -1;
} }
SDL_Finger * static SDL_Finger *
SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id)
{ {
int index = SDL_GetFingerIndex(touch, id); int index = SDL_GetFingerIndex(touch, id);

View File

@ -25,7 +25,7 @@
#include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
#include "SDL_assert.h" #include "SDL_assert.h"
SDL_Haptic *SDL_haptics = NULL; static SDL_Haptic *SDL_haptics = NULL;
/* /*

View File

@ -62,7 +62,7 @@ struct _SDL_Haptic
extern int SDL_SYS_HapticInit(void); extern int SDL_SYS_HapticInit(void);
/* Function to return the number of haptic devices plugged in right now */ /* Function to return the number of haptic devices plugged in right now */
extern int SDL_SYS_NumHaptics(); extern int SDL_SYS_NumHaptics(void);
/* /*
* Gets the device dependent name of the haptic device * Gets the device dependent name of the haptic device

View File

@ -146,7 +146,7 @@ static void UpdateEventsForDeviceRemoval()
/* /*
* Event filter to fire controller events from joystick ones * Event filter to fire controller events from joystick ones
*/ */
int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) static int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
{ {
switch(event->type) { switch(event->type) {
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
@ -291,7 +291,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event)
/* /*
* Helper function to scan the mappings database for a controller with the specified GUID * Helper function to scan the mappings database for a controller with the specified GUID
*/ */
ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid)
{ {
ControllerMapping_t *pSupportedController = s_pSupportedControllers; ControllerMapping_t *pSupportedController = s_pSupportedControllers;
while (pSupportedController) { while (pSupportedController) {
@ -389,7 +389,7 @@ const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis)
/* /*
* given a controller button name and a joystick name update our mapping structure with it * given a controller button name and a joystick name update our mapping structure with it
*/ */
void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping) static void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping)
{ {
int iSDLButton = 0; int iSDLButton = 0;
SDL_GameControllerButton button; SDL_GameControllerButton button;
@ -502,7 +502,7 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi
/* /*
* Make a new button mapping struct * Make a new button mapping struct
*/ */
void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) static void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping)
{ {
int j; int j;
@ -538,7 +538,7 @@ void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_J
/* /*
* grab the guid string from a mapping string * grab the guid string from a mapping string
*/ */
char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
{ {
const char *pFirstComma = SDL_strchr(pMapping, ','); const char *pFirstComma = SDL_strchr(pMapping, ',');
if (pFirstComma) { if (pFirstComma) {
@ -577,7 +577,7 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping)
/* /*
* grab the name string from a mapping string * grab the name string from a mapping string
*/ */
char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
{ {
const char *pFirstComma, *pSecondComma; const char *pFirstComma, *pSecondComma;
char *pchName; char *pchName;
@ -604,7 +604,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
/* /*
* grab the button mapping string from a mapping string * grab the button mapping string from a mapping string
*/ */
char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
{ {
const char *pFirstComma, *pSecondComma; const char *pFirstComma, *pSecondComma;
@ -622,7 +622,7 @@ char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping)
/* /*
* Helper function to refresh a mapping * Helper function to refresh a mapping
*/ */
void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping)
{ {
SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; SDL_GameController *gamecontrollerlist = SDL_gamecontrollers;
while (gamecontrollerlist) { while (gamecontrollerlist) {
@ -699,7 +699,7 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString,
/* /*
* Helper function to determine pre-calculated offset to certain joystick mappings * Helper function to determine pre-calculated offset to certain joystick mappings
*/ */
ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
{ {
SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index);
ControllerMapping_t *mapping; ControllerMapping_t *mapping;

View File

@ -67,10 +67,10 @@ struct _SDL_Joystick
extern int SDL_SYS_JoystickInit(void); extern int SDL_SYS_JoystickInit(void);
/* Function to return the number of joystick devices plugged in right now */ /* Function to return the number of joystick devices plugged in right now */
extern int SDL_SYS_NumJoysticks(); extern int SDL_SYS_NumJoysticks(void);
/* Function to cause any queued joystick insertions to be processed */ /* Function to cause any queued joystick insertions to be processed */
extern void SDL_SYS_JoystickDetect(); extern void SDL_SYS_JoystickDetect(void);
/* Function to get the device-dependent name of a joystick */ /* Function to get the device-dependent name of a joystick */
extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index); extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index);

View File

@ -282,6 +282,7 @@ MaybeRemoveDevice(const char *path)
} }
#endif #endif
#if ! SDL_USE_LIBUDEV
static int static int
JoystickInitWithoutUdev(void) JoystickInitWithoutUdev(void)
{ {
@ -298,7 +299,7 @@ JoystickInitWithoutUdev(void)
return numjoysticks; return numjoysticks;
} }
#endif
#if SDL_USE_LIBUDEV #if SDL_USE_LIBUDEV
static int static int
@ -342,9 +343,9 @@ SDL_SYS_JoystickInit(void)
#if SDL_USE_LIBUDEV #if SDL_USE_LIBUDEV
return JoystickInitWithUdev(); return JoystickInitWithUdev();
#endif #else
return JoystickInitWithoutUdev(); return JoystickInitWithoutUdev();
#endif
} }
int SDL_SYS_NumJoysticks() int SDL_SYS_NumJoysticks()

View File

@ -20,6 +20,7 @@
*/ */
#include "../SDL_internal.h" #include "../SDL_internal.h"
#include "SDL_power.h" #include "SDL_power.h"
#include "SDL_syspower.h"
/* /*
* Returns SDL_TRUE if we have a definitive answer. * Returns SDL_TRUE if we have a definitive answer.
@ -29,18 +30,6 @@ typedef SDL_bool
(*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds, (*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds,
int *percent); int *percent);
SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *);
#ifndef SDL_POWER_DISABLED #ifndef SDL_POWER_DISABLED
#ifdef SDL_POWER_HARDWIRED #ifdef SDL_POWER_HARDWIRED
/* This is for things that _never_ have a battery */ /* This is for things that _never_ have a battery */

68
src/power/SDL_syspower.h Normal file
View File

@ -0,0 +1,68 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
/* These are functions that need to be implemented by a port of SDL */
#ifndef _SDL_syspower_h
#define _SDL_syspower_h
#include "SDL_power.h"
#ifndef SDL_POWER_DISABLED
#ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */
SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *);
SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_WINDOWS /* handles Win32, Win64, PocketPC. */
SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_UIKIT /* handles iPhone/iPad/etc */
SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_MACOSX /* handles Mac OS X, Darwin. */
SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_HAIKU /* with BeOS euc.jp apm driver. Does this work on Haiku? */
SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_ANDROID /* handles Android. */
SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_PSP /* handles PSP. */
SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_WINRT /* handles WinRT */
SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_EMSCRIPTEN /* handles Emscripten */
SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *);
#endif
#ifdef SDL_POWER_HARDWIRED
SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *);
#endif
#endif
#endif /* _SDL_syspower_h */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -32,6 +32,7 @@
#include <fcntl.h> #include <fcntl.h>
#include "SDL_power.h" #include "SDL_power.h"
#include "../SDL_syspower.h"
static const char *proc_apm_path = "/proc/apm"; static const char *proc_apm_path = "/proc/apm";
static const char *proc_acpi_battery_path = "/proc/acpi/battery"; static const char *proc_acpi_battery_path = "/proc/acpi/battery";

View File

@ -34,7 +34,7 @@ typedef enum {
typedef struct GL_ShaderContext GL_ShaderContext; typedef struct GL_ShaderContext GL_ShaderContext;
extern GL_ShaderContext * GL_CreateShaderContext(); extern GL_ShaderContext * GL_CreateShaderContext(void);
extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader); extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader);
extern void GL_DestroyShaderContext(GL_ShaderContext *ctx); extern void GL_DestroyShaderContext(GL_ShaderContext *ctx);

View File

@ -214,7 +214,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data)
static SDL_GLContext SDL_CurrentContext = NULL; static SDL_GLContext SDL_CurrentContext = NULL;
GLES_FBOList * static GLES_FBOList *
GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h)
{ {
GLES_FBOList *result = data->framebuffers; GLES_FBOList *result = data->framebuffers;

View File

@ -307,7 +307,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data)
return 0; return 0;
} }
GLES2_FBOList * static GLES2_FBOList *
GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h) GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h)
{ {
GLES2_FBOList *result = data->framebuffers; GLES2_FBOList *result = data->framebuffers;
@ -1923,7 +1923,9 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
* Renderer instantiation * * Renderer instantiation *
*************************************************************************************************/ *************************************************************************************************/
#ifdef ZUNE_HD
#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B #define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B
#endif
static void static void
GLES2_ResetState(SDL_Renderer *renderer) GLES2_ResetState(SDL_Renderer *renderer)
@ -1963,7 +1965,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
#ifndef ZUNE_HD #ifndef ZUNE_HD
GLboolean hasCompiler; GLboolean hasCompiler;
#endif #endif
Uint32 window_flags; Uint32 window_flags = 0; /* -Wconditional-uninitialized */
GLint window_framebuffer; GLint window_framebuffer;
GLint value; GLint value;
int profile_mask = 0, major = 0, minor = 0; int profile_mask = 0, major = 0, minor = 0;

View File

@ -245,7 +245,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect,
} else { } else {
return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a); return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
} }
break; /* break; -Wunreachable-code-break */
} }
break; break;
default: default:

View File

@ -685,7 +685,7 @@ SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt)
} else { } else {
return SDL_BlendLine_RGB2; return SDL_BlendLine_RGB2;
} }
break; /* break; -Wunreachable-code-break */
case 4: case 4:
if (fmt->Rmask == 0x00FF0000) { if (fmt->Rmask == 0x00FF0000) {
if (fmt->Amask) { if (fmt->Amask) {

View File

@ -235,13 +235,11 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r
switch (dst->format->Rmask) { switch (dst->format->Rmask) {
case 0x00FF0000: case 0x00FF0000:
if (!dst->format->Amask) { if (!dst->format->Amask) {
return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a);
a);
} else { } else {
return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
a);
} }
break; /* break; -Wunreachable-code-break */
} }
break; break;
default: default:

View File

@ -79,7 +79,7 @@ to a situation where the program can segfault.
/* ! /* !
\brief Lower limit of absolute zoom factor or rotation degrees. \brief Lower limit of absolute zoom factor or rotation degrees.
*/ */
#define VALUE_LIMIT 0.001 /* #define VALUE_LIMIT 0.001 */
/* ! /* !
\brief Returns colorkey info for a surface \brief Returns colorkey info for a surface

View File

@ -28,9 +28,10 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD)
#define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F'))
#define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) #define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f'))
#endif
#define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4) #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4)
#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)

View File

@ -69,7 +69,7 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
} }
/* Complete CRC32 calculation on a memory block */ /* Complete CRC32 calculation on a memory block */
/* un-used
int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32) int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
{ {
if (SDLTest_Crc32CalcStart(crcContext,crc32)) { if (SDLTest_Crc32CalcStart(crcContext,crc32)) {
@ -86,6 +86,7 @@ int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUin
return 0; return 0;
} }
*/
/* Start crc calculation */ /* Start crc calculation */

View File

@ -196,7 +196,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax)
* *
* \returns Returns a random boundary value for the domain or 0 in case of error * \returns Returns a random boundary value for the domain or 0 in case of error
*/ */
Uint64 static Uint64
SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
{ {
Uint64 b1, b2; Uint64 b1, b2;
@ -328,7 +328,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
* *
* \returns Returns a random boundary value for the domain or 0 in case of error * \returns Returns a random boundary value for the domain or 0 in case of error
*/ */
Sint64 static Sint64
SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
{ {
Sint64 b1, b2; Sint64 b1, b2;

View File

@ -50,7 +50,7 @@ static Uint32 SDLTest_TestCaseTimeout = 3600;
* *
* \returns The generated seed string * \returns The generated seed string
*/ */
char * static char *
SDLTest_GenerateRunSeed(const int length) SDLTest_GenerateRunSeed(const int length)
{ {
char *seed = NULL; char *seed = NULL;
@ -97,8 +97,8 @@ SDLTest_GenerateRunSeed(const int length)
* \returns The generated execution key to initialize the fuzzer with. * \returns The generated execution key to initialize the fuzzer with.
* *
*/ */
Uint64 static Uint64
SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration) SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration)
{ {
SDLTest_Md5Context md5Context; SDLTest_Md5Context md5Context;
Uint64 *keys; Uint64 *keys;
@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter
* *
* \return Timer id or -1 on failure. * \return Timer id or -1 on failure.
*/ */
SDL_TimerID static SDL_TimerID
SDLTest_SetTestTimeout(int timeout, void (*callback)()) SDLTest_SetTestTimeout(int timeout, void (*callback)())
{ {
Uint32 timeoutInMilliseconds; Uint32 timeoutInMilliseconds;
@ -206,8 +206,8 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)())
/** /**
* \brief Timeout handler. Aborts test run and exits harness process. * \brief Timeout handler. Aborts test run and exits harness process.
*/ */
void static void
SDLTest_BailOut() SDLTest_BailOut()
{ {
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
exit(TEST_ABORTED); /* bail out from the test */ exit(TEST_ABORTED); /* bail out from the test */
@ -223,8 +223,8 @@ void
* *
* \returns Test case result. * \returns Test case result.
*/ */
int static int
SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
{ {
SDL_TimerID timer = 0; SDL_TimerID timer = 0;
int testCaseResult = 0; int testCaseResult = 0;
@ -313,7 +313,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
} }
/* Prints summary of all suites/tests contained in the given reference */ /* Prints summary of all suites/tests contained in the given reference */
void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) #if 0
static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
{ {
int suiteCounter; int suiteCounter;
int testCounter; int testCounter;
@ -340,12 +341,13 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites)
} }
} }
} }
#endif
/* Gets a timer value in seconds */ /* Gets a timer value in seconds */
float GetClock() static float GetClock()
{ {
float currentClock = (float)clock(); float currentClock = clock() / (float) CLOCKS_PER_SEC;
return currentClock / (float)CLOCKS_PER_SEC; return currentClock;
} }
/** /**
@ -370,7 +372,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
int testCounter; int testCounter;
int iterationCounter; int iterationCounter;
SDLTest_TestSuiteReference *testSuite; SDLTest_TestSuiteReference *testSuite;
SDLTest_TestCaseReference *testCase; const SDLTest_TestCaseReference *testCase;
const char *runSeed = NULL; const char *runSeed = NULL;
char *currentSuiteName; char *currentSuiteName;
char *currentTestName; char *currentTestName;
@ -396,7 +398,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
Uint32 testPassedCount = 0; Uint32 testPassedCount = 0;
Uint32 testSkippedCount = 0; Uint32 testSkippedCount = 0;
Uint32 countSum = 0; Uint32 countSum = 0;
SDLTest_TestCaseReference **failedTests; const SDLTest_TestCaseReference **failedTests;
/* Sanitize test iterations */ /* Sanitize test iterations */
if (testIterations < 1) { if (testIterations < 1) {
@ -440,7 +442,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
} }
/* Pre-allocate an array for tracking failed tests (potentially all test cases) */ /* Pre-allocate an array for tracking failed tests (potentially all test cases) */
failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *));
if (failedTests == NULL) { if (failedTests == NULL) {
SDLTest_LogError("Unable to allocate cache for failed tests"); SDLTest_LogError("Unable to allocate cache for failed tests");
SDL_Error(SDL_ENOMEM); SDL_Error(SDL_ENOMEM);
@ -466,7 +468,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
testCounter = 0; testCounter = 0;
while (testSuite->testCases[testCounter] && testFilter == 0) while (testSuite->testCases[testCounter] && testFilter == 0)
{ {
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; testCase = testSuite->testCases[testCounter];
testCounter++; testCounter++;
if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) { if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) {
/* Matched a test name */ /* Matched a test name */
@ -521,7 +523,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
testCounter = 0; testCounter = 0;
while(testSuite->testCases[testCounter]) while(testSuite->testCases[testCounter])
{ {
testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; testCase = testSuite->testCases[testCounter];
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
testCounter++; testCounter++;
@ -562,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
if (userExecKey != 0) { if (userExecKey != 0) {
execKey = userExecKey; execKey = userExecKey;
} else { } else {
execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
} }
SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey); SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey);

View File

@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (blit.c) */ /* GIMP RGB C-Source image dump (blit.c) */
const SDLTest_SurfaceImage_t SDLTest_imageBlit = { static const SDLTest_SurfaceImage_t SDLTest_imageBlit = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"

View File

@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (alpha.c) */ /* GIMP RGB C-Source image dump (alpha.c) */
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = {
80, 60, 3, 80, 60, 3,
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"
@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone()
return surface; return surface;
} }
const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = {
80, 60, 3, 80, 60, 3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"

View File

@ -24,7 +24,7 @@
/* GIMP RGBA C-Source image dump (face.c) */ /* GIMP RGBA C-Source image dump (face.c) */
const SDLTest_SurfaceImage_t SDLTest_imageFace = { static const SDLTest_SurfaceImage_t SDLTest_imageFace = {
32, 32, 4, 32, 32, 4,
"\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"
"\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377"

View File

@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (primitives.c) */ /* GIMP RGB C-Source image dump (primitives.c) */
const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = {
80, 60, 3, 80, 60, 3,
"\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"

View File

@ -24,7 +24,7 @@
/* GIMP RGB C-Source image dump (alpha.c) */ /* GIMP RGB C-Source image dump (alpha.c) */
const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = {
80, 60, 3, 80, 60, 3,
"\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321" "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321"
",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377" ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377"

View File

@ -50,7 +50,7 @@
* *
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02' * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/ */
char *SDLTest_TimestampToString(const time_t timestamp) static char *SDLTest_TimestampToString(const time_t timestamp)
{ {
time_t copy; time_t copy;
static char buffer[64]; static char buffer[64];

View File

@ -55,7 +55,7 @@ extern void SDL_SYS_WaitThread(SDL_Thread * thread);
extern void SDL_SYS_DetachThread(SDL_Thread * thread); extern void SDL_SYS_DetachThread(SDL_Thread * thread);
/* Get the thread local storage for this thread */ /* Get the thread local storage for this thread */
extern SDL_TLSData *SDL_SYS_GetTLSData(); extern SDL_TLSData *SDL_SYS_GetTLSData(void);
/* Set the thread local storage for this thread */ /* Set the thread local storage for this thread */
extern int SDL_SYS_SetTLSData(SDL_TLSData *data); extern int SDL_SYS_SetTLSData(SDL_TLSData *data);

View File

@ -82,7 +82,7 @@ typedef struct {
This is only intended as a fallback if getting real thread-local This is only intended as a fallback if getting real thread-local
storage fails or isn't supported on this platform. storage fails or isn't supported on this platform.
*/ */
extern SDL_TLSData *SDL_Generic_GetTLSData(); extern SDL_TLSData *SDL_Generic_GetTLSData(void);
/* Set cross-platform, slow, thread local storage for this thread. /* Set cross-platform, slow, thread local storage for this thread.
This is only intended as a fallback if getting real thread-local This is only intended as a fallback if getting real thread-local

View File

@ -129,7 +129,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms)
switch (retval) { switch (retval) {
case EINTR: case EINTR:
goto tryagain; goto tryagain;
break; /* break; -Wunreachable-code-break */
case ETIMEDOUT: case ETIMEDOUT:
retval = SDL_MUTEX_TIMEDOUT; retval = SDL_MUTEX_TIMEDOUT;
break; break;

View File

@ -20,6 +20,7 @@
*/ */
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#include "SDL_thread.h" #include "SDL_thread.h"
#include "../SDL_systhread.h"
#include "../SDL_thread_c.h" #include "../SDL_thread_c.h"
#include <pthread.h> #include <pthread.h>

View File

@ -29,6 +29,7 @@
#include "SDL_timer.h" #include "SDL_timer.h"
#include "SDL_assert.h" #include "SDL_assert.h"
#include "../SDL_timer_c.h"
/* The clock_gettime provides monotonous time, so we should use it if /* The clock_gettime provides monotonous time, so we should use it if
it's available. The clock_gettime function is behind ifdef it's available. The clock_gettime function is behind ifdef

View File

@ -90,9 +90,11 @@
#include "SDL_blit.h" #include "SDL_blit.h"
#include "SDL_RLEaccel_c.h" #include "SDL_RLEaccel_c.h"
/*
#ifndef MAX #ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif #endif
*/
#ifndef MIN #ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif #endif

View File

@ -70,12 +70,14 @@ Blit1to1(SDL_BlitInfo * info)
} }
/* This is now endian dependent */ /* This is now endian dependent */
#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) #ifndef USE_DUFFS_LOOP
#define HI 1 # if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
#define LO 0 # define HI 1
#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ # define LO 0
#define HI 0 # else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
#define LO 1 # define HI 0
# define LO 1
# endif
#endif #endif
static void static void
Blit1to2(SDL_BlitInfo * info) Blit1to2(SDL_BlitInfo * info)

View File

@ -43,8 +43,8 @@
/* Compression encodings for BMP files */ /* Compression encodings for BMP files */
#ifndef BI_RGB #ifndef BI_RGB
#define BI_RGB 0 #define BI_RGB 0
#define BI_RLE8 1 /* #define BI_RLE8 1 */
#define BI_RLE4 2 /* #define BI_RLE4 2 */
#define BI_BITFIELDS 3 #define BI_BITFIELDS 3
#endif #endif

View File

@ -46,9 +46,11 @@
#include "SDL_opengles2.h" #include "SDL_opengles2.h"
#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */
#if !SDL_VIDEO_OPENGL
#ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
#endif #endif
#endif
/* On Windows, windows.h defines CreateWindow */ /* On Windows, windows.h defines CreateWindow */
#ifdef CreateWindow #ifdef CreateWindow
@ -3617,8 +3619,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window)
#include "x11/SDL_x11messagebox.h" #include "x11/SDL_x11messagebox.h"
#endif #endif
// This function will be unused if none of the above video drivers are present.
SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{ {
SDL_SysWMinfo info; SDL_SysWMinfo info;
SDL_Window *window = messageboxdata->window; SDL_Window *window = messageboxdata->window;
@ -3634,6 +3637,7 @@ SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData
return (info.subsystem == drivertype); return (info.subsystem == drivertype);
} }
} }
#endif
int int
SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)

View File

@ -201,7 +201,7 @@ X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks)
On error, -1 is returned. On error, -1 is returned.
*/ */
int X11_URIDecode(char *buf, int len) { static int X11_URIDecode(char *buf, int len) {
int ri, wi, di; int ri, wi, di;
char decode = '\0'; char decode = '\0';
if (buf == NULL || len < 0) { if (buf == NULL || len < 0) {

View File

@ -27,6 +27,7 @@
#include "SDL_x11video.h" #include "SDL_x11video.h"
#include "SDL_x11dyn.h" #include "SDL_x11dyn.h"
#include "SDL_assert.h" #include "SDL_assert.h"
#include "SDL_x11messagebox.h"
#include <X11/keysym.h> #include <X11/keysym.h>
#include <locale.h> #include <locale.h>

View File

@ -134,14 +134,14 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo)
} else { } else {
return SDL_PIXELFORMAT_INDEX4MSB; return SDL_PIXELFORMAT_INDEX4MSB;
} }
break; /* break; -Wunreachable-code-break */
case 1: case 1:
if (BitmapBitOrder(display) == LSBFirst) { if (BitmapBitOrder(display) == LSBFirst) {
return SDL_PIXELFORMAT_INDEX1LSB; return SDL_PIXELFORMAT_INDEX1LSB;
} else { } else {
return SDL_PIXELFORMAT_INDEX1MSB; return SDL_PIXELFORMAT_INDEX1MSB;
} }
break; /* break; -Wunreachable-code-break */
} }
} }
@ -149,7 +149,7 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo)
} }
/* Global for the error handler */ /* Global for the error handler */
int vm_event, vm_error = -1; static int vm_event, vm_error = -1;
#if SDL_VIDEO_DRIVER_X11_XINERAMA #if SDL_VIDEO_DRIVER_X11_XINERAMA
static SDL_bool static SDL_bool
@ -349,7 +349,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen,
} }
int static int
X11_InitModes_XRandR(_THIS) X11_InitModes_XRandR(_THIS)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
@ -569,7 +569,7 @@ CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info)
info->vtotal)) : 0; info->vtotal)) : 0;
} }
SDL_bool static SDL_bool
SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode)
{ {
mode->w = info->hdisplay; mode->w = info->hdisplay;
@ -584,7 +584,7 @@ int
X11_InitModes(_THIS) X11_InitModes(_THIS)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
int snum, screen, screencount; int snum, screen, screencount = 0;
#if SDL_VIDEO_DRIVER_X11_XINERAMA #if SDL_VIDEO_DRIVER_X11_XINERAMA
int xinerama_major, xinerama_minor; int xinerama_major, xinerama_minor;
int use_xinerama = 0; int use_xinerama = 0;

View File

@ -519,6 +519,7 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
return vinfo; return vinfo;
} }
#if 0
#ifndef GLXBadContext #ifndef GLXBadContext
#define GLXBadContext 0 #define GLXBadContext 0
#endif #endif
@ -528,6 +529,8 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
#ifndef GLXBadProfileARB #ifndef GLXBadProfileARB
#define GLXBadProfileARB 13 #define GLXBadProfileARB 13
#endif #endif
#endif
static int (*handler) (Display *, XErrorEvent *) = NULL; static int (*handler) (Display *, XErrorEvent *) = NULL;
static const char *errorHandlerOperation = NULL; static const char *errorHandlerOperation = NULL;
static int errorBase = 0; static int errorBase = 0;

View File

@ -44,7 +44,7 @@
#define _NET_WM_STATE_REMOVE 0l #define _NET_WM_STATE_REMOVE 0l
#define _NET_WM_STATE_ADD 1l #define _NET_WM_STATE_ADD 1l
#define _NET_WM_STATE_TOGGLE 2l /* #define _NET_WM_STATE_TOGGLE 2l */
static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win) static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win)
{ {