Fix warnings: static, include, un-initialized vairables

This commit is contained in:
Sylvain 2021-11-23 10:33:12 +01:00
parent 2a24418bd3
commit fae7034901
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
12 changed files with 27 additions and 24 deletions

View File

@ -84,7 +84,8 @@ GetAppName()
return SDL_strdup("SDL_App");
}
size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) {
static size_t
Fcitx_GetPreeditString(SDL_DBusContext *dbus, DBusMessage *msg, char **ret) {
char *text = NULL, *subtext;
size_t text_bytes = 0;
DBusMessageIter iter, array, sub;

View File

@ -23,13 +23,13 @@
#include "SDL_ibus.h"
#include "SDL_fcitx.h"
typedef SDL_bool (*_SDL_IME_Init)();
typedef void (*_SDL_IME_Quit)();
typedef SDL_bool (*_SDL_IME_Init)(void);
typedef void (*_SDL_IME_Quit)(void);
typedef void (*_SDL_IME_SetFocus)(SDL_bool);
typedef void (*_SDL_IME_Reset)();
typedef void (*_SDL_IME_Reset)(void);
typedef SDL_bool (*_SDL_IME_ProcessKeyEvent)(Uint32, Uint32);
typedef void (*_SDL_IME_UpdateTextRect)(SDL_Rect *);
typedef void (*_SDL_IME_PumpEvents)();
typedef void (*_SDL_IME_PumpEvents)(void);
static _SDL_IME_Init SDL_IME_Init_Real = NULL;
static _SDL_IME_Quit SDL_IME_Quit_Real = NULL;

View File

@ -65,8 +65,6 @@ SDL_SYS_OpenURL(const char *url)
return SDL_SetError("Waiting on xdg-open failed: %s", strerror(errno));
}
}
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -83,7 +83,8 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext)
if (rndContext==NULL) return -1;
xh = rndContext->x >> 16, xl = rndContext->x & 65535;
xh = rndContext->x >> 16;
xl = rndContext->x & 65535;
rndContext->x = rndContext->x * rndContext->a + rndContext->c;
rndContext->c =
xh * rndContext->ah + ((xh * rndContext->al) >> 16) +

View File

@ -119,7 +119,7 @@ KMSDRM_CreateCursorBO (SDL_VideoDisplay *display) {
}
/* Remove a cursor buffer from a display's DRM cursor BO. */
int
static int
KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display)
{
int ret = 0;
@ -138,7 +138,7 @@ KMSDRM_RemoveCursorFromBO(SDL_VideoDisplay *display)
}
/* Dump a cursor buffer to a display's DRM cursor BO. */
int
static int
KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor)
{
SDL_DisplayData *dispdata = (SDL_DisplayData *) display->driverdata;
@ -403,8 +403,6 @@ KMSDRM_WarpMouseGlobal(int x, int y)
} else {
return SDL_SetError("No mouse or current cursor.");
}
return 0;
}
void

View File

@ -48,7 +48,7 @@ extern void KMSDRM_QuitMouse(_THIS);
extern void KMSDRM_CreateCursorBO(SDL_VideoDisplay *display);
extern void KMSDRM_DestroyCursorBO(_THIS, SDL_VideoDisplay *display);
extern void KMSDRM_InitCursor();
extern void KMSDRM_InitCursor(void);
#endif /* SDL_KMSDRM_mouse_h_ */

View File

@ -471,7 +471,7 @@ KMSDRM_WaitPageflip(_THIS, SDL_WindowData *windata) {
available on the DRM connector of the display.
We use the SDL mode list (which we filled in KMSDRM_GetDisplayModes)
because it's ordered, while the list on the connector is mostly random.*/
drmModeModeInfo*
static drmModeModeInfo*
KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay * display,
uint32_t width, uint32_t height, uint32_t refresh_rate){
@ -502,7 +502,8 @@ uint32_t width, uint32_t height, uint32_t refresh_rate){
/*****************************************************************************/
/* Deinitializes the driverdata of the SDL Displays in the SDL display list. */
void KMSDRM_DeinitDisplays (_THIS) {
static void
KMSDRM_DeinitDisplays (_THIS) {
SDL_DisplayData *dispdata;
int num_displays, i;
@ -531,7 +532,8 @@ void KMSDRM_DeinitDisplays (_THIS) {
/* Gets a DRM connector, builds an SDL_Display with it, and adds it to the
list of SDL Displays in _this->displays[] */
void KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) {
static void
KMSDRM_AddDisplay (_THIS, drmModeConnector *connector, drmModeRes *resources) {
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
SDL_DisplayData *dispdata = NULL;
@ -719,7 +721,8 @@ cleanup:
closed when we get to the end of this function.
This is to be called early, in VideoInit(), because it gets us
the videomode information, which SDL needs immediately after VideoInit(). */
int KMSDRM_InitDisplays (_THIS) {
static int
KMSDRM_InitDisplays (_THIS) {
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
drmModeRes *resources = NULL;
@ -813,7 +816,7 @@ cleanup:
These things are incompatible with Vulkan, which accesses the same resources
internally so they must be free when trying to build a Vulkan surface.
*/
int
static int
KMSDRM_GBMInit (_THIS, SDL_DisplayData *dispdata)
{
SDL_VideoData *viddata = (SDL_VideoData *)_this->driverdata;
@ -837,7 +840,7 @@ KMSDRM_GBMInit (_THIS, SDL_DisplayData *dispdata)
}
/* Deinit the Vulkan-incompatible KMSDRM stuff. */
void
static void
KMSDRM_GBMDeinit (_THIS, SDL_DisplayData *dispdata)
{
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
@ -858,7 +861,7 @@ KMSDRM_GBMDeinit (_THIS, SDL_DisplayData *dispdata)
viddata->gbm_init = SDL_FALSE;
}
void
static void
KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
{
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);

View File

@ -182,7 +182,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
VkInstance instance,
VkSurfaceKHR *surface)
{
VkPhysicalDevice gpu;
VkPhysicalDevice gpu = NULL;
uint32_t gpu_count;
uint32_t display_count;
uint32_t mode_count;

View File

@ -24,6 +24,7 @@
#include "SDL_waylanddatamanager.h"
#include "SDL_waylandevents_c.h"
#include "SDL_waylandclipboard.h"
int
Wayland_SetClipboardText(_THIS, const char *text)

View File

@ -31,6 +31,8 @@
#include <string.h> /* strerr */
#include <errno.h>
#include "SDL_waylandmessagebox.h"
#define MAX_BUTTONS 8 /* Maximum number of buttons supported */
int
@ -186,7 +188,6 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
return SDL_SetError("Waiting on zenity failed: %s", strerror(errno));
}
}
return 0;
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND */

View File

@ -38,7 +38,7 @@
#include "SDL_waylandevents_c.h"
#include "wayland-cursor.h"
#include "SDL_waylandmouse.h"
typedef struct {

View File

@ -1693,7 +1693,7 @@ X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
if (!data->videodata->broken_pointer_grab) {
const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask;
int attempts;
int result;
int result = 0;
/* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */
for (attempts = 0; attempts < 100; attempts++) {