From 16bb6a0b3deb80a567d711d3daa665f488578e5d Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 8 Mar 2023 11:40:07 +0100 Subject: [PATCH] Fix warnings about static function and prototype --- test/checkkeys.c | 4 ++-- test/checkkeysthreads.c | 6 +++--- test/gamepadmap.c | 2 +- test/loopwave.c | 10 +++++----- test/loopwavequeue.c | 4 ++-- test/testaudiohotplug.c | 13 ++++++------- test/testcustomcursor.c | 4 ++-- test/testdraw.c | 10 +++++----- test/testdrawchessboard.c | 13 +++++++------ test/testgamepad.c | 12 ++++++------ test/testgeometry.c | 6 +++--- test/testgles2_sdf.c | 22 +++++++++++----------- test/testintersections.c | 24 +++++++++++------------- test/testjoystick.c | 2 +- test/testmouse.c | 8 ++++---- test/testmultiaudio.c | 10 +++++----- test/testnative.c | 2 +- test/testoffscreen.c | 6 +++--- test/testoverlay.c | 24 ++++++++++++------------ test/testrendercopyex.c | 8 ++++---- test/testrendertarget.c | 12 ++++++------ test/testscale.c | 11 ++++------- test/testsem.c | 2 +- test/testshader.c | 10 +++++----- test/testsprite.c | 8 ++++---- test/testspriteminimal.c | 8 ++++---- test/teststreaming.c | 18 +++++++++--------- test/testviewport.c | 4 ++-- test/testwm.c | 12 ++++++------ test/torturethread.c | 4 ++-- 30 files changed, 137 insertions(+), 142 deletions(-) diff --git a/test/checkkeys.c b/test/checkkeys.c index fc2767388..78b72651c 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -106,7 +106,7 @@ print_modifiers(char **text, size_t *maxlen) } static void -PrintModifierState() +PrintModifierState(void) { char message[512]; char *spot; @@ -165,7 +165,7 @@ PrintText(const char *eventtype, const char *text) SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text); } -void loop() +static void loop(void) { SDL_Event event; /* Check for events */ diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c index ca11ece8c..7ba3d8720 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -25,7 +25,7 @@ #include #include -int done; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -103,7 +103,7 @@ print_modifiers(char **text, size_t *maxlen) } static void -PrintModifierState() +PrintModifierState(void) { char message[512]; char *spot; @@ -162,7 +162,7 @@ PrintText(const char *eventtype, const char *text) SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text); } -void loop() +static void loop(void) { SDL_Event event; /* Check for events */ diff --git a/test/gamepadmap.c b/test/gamepadmap.c index 568fbcdfe..f41968da6 100644 --- a/test/gamepadmap.c +++ b/test/gamepadmap.c @@ -705,7 +705,7 @@ WatchJoystick(SDL_Joystick *joystick) SDL_DestroyRenderer(screen); } -static SDL_bool HasJoysticks() +static SDL_bool HasJoysticks(void) { int num_joysticks = 0; SDL_JoystickID *joysticks; diff --git a/test/loopwave.c b/test/loopwave.c index 38c6e30be..f4182fadb 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -44,7 +44,7 @@ quit(int rc) } static void -close_audio() +close_audio(void) { if (device != 0) { SDL_CloseAudioDevice(device); @@ -53,7 +53,7 @@ close_audio() } static void -open_audio() +open_audio(void) { /* Initialize fillerup() variables */ device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); @@ -68,14 +68,14 @@ open_audio() } #ifndef __EMSCRIPTEN__ -static void reopen_audio() +static void reopen_audio(void) { close_audio(); open_audio(); } #endif -void SDLCALL +static void SDLCALL fillerup(void *unused, Uint8 *stream, int len) { Uint8 *waveptr; @@ -101,7 +101,7 @@ fillerup(void *unused, Uint8 *stream, int len) static int done = 0; #ifdef __EMSCRIPTEN__ -void loop() +static void loop(void) { if (done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) { emscripten_cancel_main_loop(); diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c index b56990fb9..0ecf5d296 100644 --- a/test/loopwavequeue.c +++ b/test/loopwavequeue.c @@ -43,14 +43,14 @@ quit(int rc) } static int done = 0; -void poked(int sig) +static void poked(int sig) { done = 1; } static SDL_AudioDeviceID g_audio_id = 0; -void loop() +static void loop(void) { #ifdef __EMSCRIPTEN__ if (done || (SDL_GetAudioDeviceStatus(g_audio_id) != SDL_AUDIO_PLAYING)) { diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c index 7e1fb5cf2..150e1f7eb 100644 --- a/test/testaudiohotplug.c +++ b/test/testaudiohotplug.c @@ -41,7 +41,7 @@ quit(int rc) exit(rc); } -void SDLCALL +static void SDLCALL fillerup(void *_pos, Uint8 *stream, int len) { Uint32 pos = *((Uint32 *)_pos); @@ -67,19 +67,18 @@ fillerup(void *_pos, Uint8 *stream, int len) } static int done = 0; -void poked(int sig) + +static void poked(int sig) { done = 1; } -static const char * -devtypestr(int iscapture) +static const char *devtypestr(int iscapture) { return iscapture ? "capture" : "output"; } -static void -iteration() +static void iteration(void) { SDL_Event e; SDL_AudioDeviceID dev; @@ -122,7 +121,7 @@ iteration() } #ifdef __EMSCRIPTEN__ -void loop() +static void loop(void) { if (done) emscripten_cancel_main_loop(); diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c index 467c5fbe1..9438613a6 100644 --- a/test/testcustomcursor.c +++ b/test/testcustomcursor.c @@ -132,7 +132,7 @@ init_system_cursor(const char *image[]) } static SDLTest_CommonState *state; -int done; +static int done; static SDL_Cursor *cursors[1 + SDL_NUM_SYSTEM_CURSORS]; static SDL_SystemCursor cursor_types[1 + SDL_NUM_SYSTEM_CURSORS]; static int num_cursors; @@ -147,7 +147,7 @@ quit(int rc) exit(rc); } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testdraw.c b/test/testdraw.c index 844e07a67..833b1b5e7 100644 --- a/test/testdraw.c +++ b/test/testdraw.c @@ -36,9 +36,9 @@ static Uint64 next_fps_check; static Uint32 frames; static const int fps_check_delay = 5000; -int done; +static int done; -void DrawPoints(SDL_Renderer *renderer) +static void DrawPoints(SDL_Renderer *renderer) { int i; float x, y; @@ -80,7 +80,7 @@ void DrawPoints(SDL_Renderer *renderer) } } -void DrawLines(SDL_Renderer *renderer) +static void DrawLines(SDL_Renderer *renderer) { int i; float x1, y1, x2, y2; @@ -131,7 +131,7 @@ void DrawLines(SDL_Renderer *renderer) } } -void DrawRects(SDL_Renderer *renderer) +static void DrawRects(SDL_Renderer *renderer) { int i; SDL_FRect rect; @@ -175,7 +175,7 @@ void DrawRects(SDL_Renderer *renderer) } } -void loop() +static void loop(void) { Uint64 now; int i; diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c index 4bac05606..80b43197d 100644 --- a/test/testdrawchessboard.c +++ b/test/testdrawchessboard.c @@ -21,12 +21,13 @@ #include #include -SDL_Window *window; -SDL_Renderer *renderer; -SDL_Surface *surface; -int done; +static SDL_Window *window; +static SDL_Renderer *renderer; +static SDL_Surface *surface; +static int done; -void DrawChessBoard() + +static void DrawChessBoard(void) { int row = 0, column = 0, x = 0; SDL_FRect rect; @@ -57,7 +58,7 @@ void DrawChessBoard() } } -void loop() +static void loop(void) { SDL_Event e; while (SDL_PollEvent(&e)) { diff --git a/test/testgamepad.c b/test/testgamepad.c index 7a3a6a852..247878b34 100644 --- a/test/testgamepad.c +++ b/test/testgamepad.c @@ -166,7 +166,7 @@ static void PrintJoystickInfo(SDL_JoystickID instance_id) } } -static void UpdateWindowTitle() +static void UpdateWindowTitle(void) { if (window == NULL) { return; @@ -380,7 +380,7 @@ typedef struct Uint8 ucLedBlue; /* 46 */ } DS5EffectsState_t; -static void CyclePS5TriggerEffect() +static void CyclePS5TriggerEffect(void) { DS5EffectsState_t state; @@ -402,7 +402,7 @@ static void CyclePS5TriggerEffect() SDL_SendGamepadEffect(gamepad, &state, sizeof(state)); } -static SDL_bool ShowingFront() +static SDL_bool ShowingFront(void) { SDL_bool showing_front = SDL_TRUE; int i; @@ -445,7 +445,7 @@ static int SDLCALL VirtualGamepadSetLED(void *userdata, Uint8 red, Uint8 green, return 0; } -static void OpenVirtualGamepad() +static void OpenVirtualGamepad(void) { SDL_VirtualJoystickDesc desc; SDL_JoystickID virtual_id; @@ -471,7 +471,7 @@ static void OpenVirtualGamepad() } } -static void CloseVirtualGamepad() +static void CloseVirtualGamepad(void) { int i; SDL_JoystickID *joysticks = SDL_GetJoysticks(NULL); @@ -617,7 +617,7 @@ static void VirtualGamepadMouseUp(float x, float y) } } -void loop(void *arg) +static void loop(void *arg) { SDL_Event event; int i; diff --git a/test/testgeometry.c b/test/testgeometry.c index 9d0a2abe5..6f1b60b80 100644 --- a/test/testgeometry.c +++ b/test/testgeometry.c @@ -30,7 +30,7 @@ static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; static float angle = 0.0f; static int sprite_w, sprite_h; -int done; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -41,7 +41,7 @@ quit(int rc) exit(rc); } -int LoadSprite(const char *file) +static int LoadSprite(const char *file) { int i; @@ -62,7 +62,7 @@ int LoadSprite(const char *file) return 0; } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index 56e1e803e..510140a85 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -35,9 +35,9 @@ typedef struct GLES2_Context } GLES2_Context; static SDL_Surface *g_surf_sdf = NULL; -GLenum g_texture; -GLenum g_texture_type = GL_TEXTURE_2D; -GLfloat g_verts[24]; +static GLenum g_texture; +static GLenum g_texture_type = GL_TEXTURE_2D; +static GLfloat g_verts[24]; typedef enum { GLES2_ATTRIBUTE_POSITION = 0, @@ -53,7 +53,7 @@ typedef enum GLES2_UNIFORM_COLOR, } GLES2_Uniform; -GLint g_uniform_locations[16]; +static GLint g_uniform_locations[16]; static SDLTest_CommonState *state; static SDL_GLContext *context = NULL; @@ -122,7 +122,7 @@ quit(int rc) * source: Passed-in shader source code. * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER. */ -void process_shader(GLenum *shader, const char *source, GLenum shader_type) +static void process_shader(GLenum *shader, const char *source, GLenum shader_type) { GLint status = GL_FALSE; const char *shaders[1] = { NULL }; @@ -266,7 +266,7 @@ Render(int width, int height, shader_data *data) GL_CHECK(ctx.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)); } -void renderCopy_angle(float degree_angle) +static void renderCopy_angle(float degree_angle) { const float radian_angle = (float)(3.141592 * degree_angle) / 180.0f; const GLfloat s = (GLfloat)SDL_sin(radian_angle); @@ -282,7 +282,7 @@ void renderCopy_angle(float degree_angle) *(verts++) = c; } -void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect) +static void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect) { GLfloat minx, miny, maxx, maxy; GLfloat minu, maxu, minv, maxv; @@ -317,11 +317,11 @@ void renderCopy_position(SDL_Rect *srcrect, SDL_Rect *dstrect) *(verts++) = maxv; } -int done; -Uint32 frames; -shader_data *datas; +static int done; +static Uint32 frames; +static shader_data *datas; -void loop() +static void loop(void) { SDL_Event event; int i; diff --git a/test/testintersections.c b/test/testintersections.c index 2fa16bb3d..d5f53cb76 100644 --- a/test/testintersections.c +++ b/test/testintersections.c @@ -39,10 +39,10 @@ static int current_alpha = 255; static int current_color = 255; static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE; -float mouse_begin_x = -1.0f, mouse_begin_y = -1.0f; -int done; +static float mouse_begin_x = -1.0f, mouse_begin_y = -1.0f; +static int done; -void DrawPoints(SDL_Renderer *renderer) +static void DrawPoints(SDL_Renderer *renderer) { int i; float x, y; @@ -85,10 +85,9 @@ void DrawPoints(SDL_Renderer *renderer) } #define MAX_LINES 16 -int num_lines = 0; -SDL_FRect lines[MAX_LINES]; -static int -add_line(float x1, float y1, float x2, float y2) +static int num_lines = 0; +static SDL_FRect lines[MAX_LINES]; +static int add_line(float x1, float y1, float x2, float y2) { if (num_lines >= MAX_LINES) { return 0; @@ -106,7 +105,7 @@ add_line(float x1, float y1, float x2, float y2) return ++num_lines; } -void DrawLines(SDL_Renderer *renderer) +static void DrawLines(SDL_Renderer *renderer) { int i; SDL_Rect viewport; @@ -129,10 +128,9 @@ void DrawLines(SDL_Renderer *renderer) } #define MAX_RECTS 16 -int num_rects = 0; -SDL_FRect rects[MAX_RECTS]; -static int -add_rect(float x1, float y1, float x2, float y2) +static int num_rects = 0; +static SDL_FRect rects[MAX_RECTS]; +static int add_rect(float x1, float y1, float x2, float y2) { if (num_rects >= MAX_RECTS) { return 0; @@ -208,7 +206,7 @@ DrawRectRectIntersections(SDL_Renderer *renderer) } } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testjoystick.c b/test/testjoystick.c index 057a6606c..f741c86af 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -99,7 +99,7 @@ DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h) SDL_RenderFillRect(r, &area); } -void loop(void *arg) +static void loop(void *arg) { SDL_Event event; int i; diff --git a/test/testmouse.c b/test/testmouse.c index c6dc9c711..e0e3c70c0 100644 --- a/test/testmouse.c +++ b/test/testmouse.c @@ -51,7 +51,7 @@ static float wheel_y = SCREEN_HEIGHT * 0.5f; static SDL_bool done = SDL_FALSE; -void DrawObject(SDL_Renderer *renderer, Object *object) +static void DrawObject(SDL_Renderer *renderer, Object *object) { SDL_SetRenderDrawColor(renderer, object->r, object->g, object->b, 255); @@ -80,7 +80,7 @@ void DrawObject(SDL_Renderer *renderer, Object *object) } } -void DrawObjects(SDL_Renderer *renderer) +static void DrawObjects(SDL_Renderer *renderer) { Object *next = objects; while (next != NULL) { @@ -89,7 +89,7 @@ void DrawObjects(SDL_Renderer *renderer) } } -void AppendObject(Object *object) +static void AppendObject(Object *object) { if (objects) { Object *next = objects; @@ -102,7 +102,7 @@ void AppendObject(Object *object) } } -void loop(void *arg) +static void loop(void *arg) { SDL_Renderer *renderer = (SDL_Renderer *)arg; SDL_Event event; diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c index 45a5fec1b..a80c6e724 100644 --- a/test/testmultiaudio.c +++ b/test/testmultiaudio.c @@ -31,9 +31,9 @@ typedef struct SDL_atomic_t done; } callback_data; -callback_data cbd[64]; +static callback_data cbd[64]; -void SDLCALL +static void SDLCALL play_through_once(void *arg, Uint8 *stream, int len) { callback_data *cbdata = (callback_data *)arg; @@ -54,18 +54,18 @@ play_through_once(void *arg, Uint8 *stream, int len) } } -void loop() +#ifdef __EMSCRIPTEN__ +static void loop(void) { if (SDL_AtomicGet(&cbd[0].done)) { -#ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); -#endif SDL_PauseAudioDevice(cbd[0].dev); SDL_CloseAudioDevice(cbd[0].dev); SDL_free(sound); SDL_Quit(); } } +#endif static void test_multi_audio(int devcount) diff --git a/test/testnative.c b/test/testnative.c index 993cb7b7d..792327751 100644 --- a/test/testnative.c +++ b/test/testnative.c @@ -51,7 +51,7 @@ quit(int rc) exit(rc); } -void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) +static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) { int sprite_w, sprite_h; int i; diff --git a/test/testoffscreen.c b/test/testoffscreen.c index f2ac3babd..78c1b382d 100644 --- a/test/testoffscreen.c +++ b/test/testoffscreen.c @@ -31,7 +31,7 @@ static int width = 640; static int height = 480; static unsigned int max_frames = 200; -void draw() +static void draw(void) { SDL_FRect rect; @@ -49,7 +49,7 @@ void draw() SDL_RenderPresent(renderer); } -void save_surface_to_bmp() +static void save_surface_to_bmp(void) { SDL_Surface* surface; Uint32 pixel_format; @@ -68,7 +68,7 @@ void save_surface_to_bmp() SDL_DestroySurface(surface); } -void loop() +static void loop(void) { SDL_Event event; diff --git a/test/testoverlay.c b/test/testoverlay.c index 39011934a..6b9adefa5 100644 --- a/test/testoverlay.c +++ b/test/testoverlay.c @@ -34,7 +34,7 @@ #define MOOSEFRAMES_COUNT 10 /* *INDENT-OFF* */ /* clang-format off */ -SDL_Color MooseColors[84] = { +static SDL_Color MooseColors[84] = { {49, 49, 49, SDL_ALPHA_OPAQUE} , {66, 24, 0, SDL_ALPHA_OPAQUE} , {66, 33, 0, SDL_ALPHA_OPAQUE} @@ -147,16 +147,16 @@ static Uint64 next_fps_check; static Uint32 frames; static const Uint32 fps_check_delay = 5000; -SDL_Surface *MooseYUVSurfaces[MOOSEFRAMES_COUNT]; -SDL_Texture *MooseTexture = NULL; -SDL_FRect displayrect; -int window_w; -int window_h; -int paused = 0; -int done = 0; +static SDL_Surface *MooseYUVSurfaces[MOOSEFRAMES_COUNT]; +static SDL_Texture *MooseTexture = NULL; +static SDL_FRect displayrect; +static int window_w; +static int window_h; +static int paused = 0; +static int done = 0; static int fpsdelay; -SDL_bool streaming = SDL_TRUE; -Uint8 *RawMooseData = NULL; +static SDL_bool streaming = SDL_TRUE; +static Uint8 *RawMooseData = NULL; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -182,7 +182,7 @@ quit(int rc) } } -void MoveSprites(SDL_Renderer *renderer) +static void MoveSprites(SDL_Renderer *renderer) { static int i = 0; @@ -216,7 +216,7 @@ void MoveSprites(SDL_Renderer *renderer) } -void loop() +static void loop(void) { Uint64 now; int i; diff --git a/test/testrendercopyex.c b/test/testrendercopyex.c index 408d7a2d1..9a3dc5bfc 100644 --- a/test/testrendercopyex.c +++ b/test/testrendercopyex.c @@ -33,8 +33,8 @@ typedef struct int scale_direction; } DrawState; -DrawState *drawstates; -int done; +static DrawState *drawstates; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -44,7 +44,7 @@ quit(int rc) exit(rc); } -void Draw(DrawState *s) +static void Draw(DrawState *s) { SDL_Rect viewport; SDL_Texture *target; @@ -86,7 +86,7 @@ void Draw(DrawState *s) /* SDL_Delay(10); */ } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testrendertarget.c b/test/testrendertarget.c index e1e0b7912..19b07fba2 100644 --- a/test/testrendertarget.c +++ b/test/testrendertarget.c @@ -33,9 +33,9 @@ typedef struct int scale_direction; } DrawState; -DrawState *drawstates; -int done; -SDL_bool test_composite = SDL_FALSE; +static DrawState *drawstates; +static int done; +static SDL_bool test_composite = SDL_FALSE; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -45,7 +45,7 @@ quit(int rc) exit(rc); } -SDL_bool +static SDL_bool DrawComposite(DrawState *s) { SDL_Rect viewport; @@ -129,7 +129,7 @@ DrawComposite(DrawState *s) return SDL_TRUE; } -SDL_bool +static SDL_bool Draw(DrawState *s) { SDL_Rect viewport; @@ -173,7 +173,7 @@ Draw(DrawState *s) return SDL_TRUE; } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testscale.c b/test/testscale.c index 2f133f53b..d8139269b 100644 --- a/test/testscale.c +++ b/test/testscale.c @@ -21,9 +21,6 @@ #include #include "testutils.h" -#define WINDOW_WIDTH 640 -#define WINDOW_HEIGHT 480 - static SDLTest_CommonState *state; typedef struct @@ -36,8 +33,8 @@ typedef struct int scale_direction; } DrawState; -DrawState *drawstates; -int done; +static DrawState *drawstates; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -47,7 +44,7 @@ quit(int rc) exit(rc); } -void Draw(DrawState *s) +static void Draw(DrawState *s) { SDL_Rect viewport; @@ -77,7 +74,7 @@ void Draw(DrawState *s) SDL_RenderPresent(s->renderer); } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/testsem.c b/test/testsem.c index 0a159aee3..db1940015 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -24,7 +24,7 @@ #define NUM_OVERHEAD_OPS_MULT 10 static SDL_sem *sem; -int alive; +static int alive; typedef struct Thread_State { diff --git a/test/testshader.c b/test/testshader.c index d61ddefe6..1cfdd74e9 100644 --- a/test/testshader.c +++ b/test/testshader.c @@ -231,7 +231,7 @@ static void DestroyShaderProgram(ShaderData *data) } } -static SDL_bool InitShaders() +static SDL_bool InitShaders(void) { int i; @@ -285,7 +285,7 @@ static SDL_bool InitShaders() return SDL_TRUE; } -static void QuitShaders() +static void QuitShaders(void) { int i; @@ -306,7 +306,7 @@ power_of_two(int input) return value; } -GLuint +static GLuint SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) { GLuint texture; @@ -356,7 +356,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) } /* A general OpenGL initialization function. Sets all of the initial parameters. */ -void InitGL(int Width, int Height) /* We call this right after our OpenGL window is created. */ +static void InitGL(int Width, int Height) /* We call this right after our OpenGL window is created. */ { GLdouble aspect; @@ -377,7 +377,7 @@ void InitGL(int Width, int Height) /* We call this right after our OpenGL window } /* The main drawing function. */ -void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat *texcoord) +static void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat *texcoord) { /* Texture coordinate lookup, to make it simple */ enum diff --git a/test/testsprite.c b/test/testsprite.c index a022a5464..75ac45d14 100644 --- a/test/testsprite.c +++ b/test/testsprite.c @@ -47,7 +47,7 @@ static int use_rendergeometry = 0; /* -1: infinite random moves (default); >=0: enables N deterministic moves */ static int iterations = -1; -int done; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -65,7 +65,7 @@ quit(int rc) } } -int LoadSprite(const char *file) +static int LoadSprite(const char *file) { int i, w, h; @@ -88,7 +88,7 @@ int LoadSprite(const char *file) return 0; } -void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) +static void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) { int i; SDL_Rect viewport; @@ -396,7 +396,7 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) SDL_RenderPresent(renderer); } -void loop() +static void loop(void) { Uint64 now; int i; diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c index f7267ce14..51eb59451 100644 --- a/test/testspriteminimal.c +++ b/test/testspriteminimal.c @@ -32,8 +32,8 @@ static SDL_FRect positions[NUM_SPRITES]; static SDL_FRect velocities[NUM_SPRITES]; static int sprite_w, sprite_h; -SDL_Renderer *renderer; -int done; +static SDL_Renderer *renderer; +static int done; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -43,7 +43,7 @@ quit(int rc) exit(rc); } -void MoveSprites() +static void MoveSprites(void) { int i; int window_w = WINDOW_WIDTH; @@ -77,7 +77,7 @@ void MoveSprites() SDL_RenderPresent(renderer); } -void loop() +static void loop(void) { SDL_Event event; diff --git a/test/teststreaming.c b/test/teststreaming.c index 72d0881d2..93045f374 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -32,7 +32,7 @@ #define MOOSEFRAMES_COUNT 10 /* *INDENT-OFF* */ /* clang-format off */ -SDL_Color MooseColors[84] = { +static SDL_Color MooseColors[84] = { {49, 49, 49, 255}, {66, 24, 0, 255}, {66, 33, 0, 255}, {66, 66, 66, 255}, {66, 115, 49, 255}, {74, 33, 0, 255}, {74, 41, 16, 255}, {82, 33, 8, 255}, {82, 41, 8, 255}, {82, 49, 16, 255}, {82, 82, 82, 255}, {90, 41, 8, 255}, @@ -57,20 +57,20 @@ SDL_Color MooseColors[84] = { }; /* *INDENT-ON* */ /* clang-format on */ -Uint8 MooseFrames[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE]; +static Uint8 MooseFrames[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE]; -SDL_Renderer *renderer; -int frame; -SDL_Texture *MooseTexture; -SDL_bool done = SDL_FALSE; +static SDL_Renderer *renderer; +static int frame; +static SDL_Texture *MooseTexture; +static SDL_bool done = SDL_FALSE; -void quit(int rc) +static void quit(int rc) { SDL_Quit(); exit(rc); } -void UpdateTexture(SDL_Texture *texture) +static void UpdateTexture(SDL_Texture *texture) { SDL_Color *color; Uint8 *src; @@ -94,7 +94,7 @@ void UpdateTexture(SDL_Texture *texture) SDL_UnlockTexture(texture); } -void loop() +static void loop(void) { SDL_Event event; diff --git a/test/testviewport.c b/test/testviewport.c index a30859bc7..004f3f047 100644 --- a/test/testviewport.c +++ b/test/testviewport.c @@ -41,7 +41,7 @@ quit(int rc) exit(rc); } -void DrawOnViewport(SDL_Renderer *renderer) +static void DrawOnViewport(SDL_Renderer *renderer) { SDL_FRect rect; SDL_Rect cliprect; @@ -102,7 +102,7 @@ void DrawOnViewport(SDL_Renderer *renderer) SDL_SetRenderClipRect(renderer, NULL); } -void loop() +static void loop(void) { SDL_Event event; int i; diff --git a/test/testwm.c b/test/testwm.c index 09668bf38..456446a67 100644 --- a/test/testwm.c +++ b/test/testwm.c @@ -21,7 +21,7 @@ #include static SDLTest_CommonState *state; -int done; +static int done; static const char *cursorNames[] = { "arrow", @@ -37,10 +37,10 @@ static const char *cursorNames[] = { "NO", "hand", }; -int system_cursor = -1; -SDL_Cursor *cursor = NULL; -SDL_bool relative_mode = SDL_FALSE; -const SDL_DisplayMode *highlighted_mode = NULL; +static int system_cursor = -1; +static SDL_Cursor *cursor = NULL; +static SDL_bool relative_mode = SDL_FALSE; +static const SDL_DisplayMode *highlighted_mode = NULL; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -150,7 +150,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport) } } -void loop() +static void loop(void) { int i; SDL_Event event; diff --git a/test/torturethread.c b/test/torturethread.c index 27d6167b0..7dd441180 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -30,7 +30,7 @@ quit(int rc) exit(rc); } -int SDLCALL +static int SDLCALL SubThreadFunc(void *data) { while (!*(int volatile *)data) { @@ -39,7 +39,7 @@ SubThreadFunc(void *data) return 0; } -int SDLCALL +static int SDLCALL ThreadFunc(void *data) { SDL_Thread *sub_threads[NUMTHREADS];