From 6e3bfcb967e601e6636b61399a32412fa3347135 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Fri, 10 Feb 2023 09:47:55 +0100
Subject: [PATCH] Fix static function and shadow variable warnings
---
playmus.c | 8 ++++----
playwave.c | 18 +++++++++---------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/playmus.c b/playmus.c
index 715bffde..832be82d 100644
--- a/playmus.c
+++ b/playmus.c
@@ -43,7 +43,7 @@ static int audio_open = 0;
static Mix_Music *music = NULL;
static int next_track = 0;
-void CleanUp(int exitcode)
+static void CleanUp(int exitcode)
{
if(Mix_PlayingMusic()) {
Mix_FadeOutMusic(1500);
@@ -61,13 +61,13 @@ void CleanUp(int exitcode)
exit(exitcode);
}
-void Usage(char *argv0)
+static void Usage(char *argv0)
{
SDL_Log("Usage: %s [-i] [-l] [-8] [-f32] [-r rate] [-c channels] [-b buffers] [-v N] [-rwops] <musicfile>\n", argv0);
}
/*#define SEEK_TEST */
-void Menu(void)
+static void Menu(void)
{
char buf[10];
@@ -101,7 +101,7 @@ void Menu(void)
}
#ifdef HAVE_SIGNAL_H
-void IntHandler(int sig)
+static void IntHandler(int sig)
{
switch (sig) {
case SIGINT:
diff --git a/playwave.c b/playwave.c
index 731826ba..260e4e7a 100644
--- a/playwave.c
+++ b/playwave.c
@@ -82,7 +82,7 @@ static void output_test_warnings(void)
static int audio_open = 0;
-static Mix_Chunk *wave = NULL;
+static Mix_Chunk *g_wave = NULL;
/* rcg06042009 Report available decoders. */
#if (defined TEST_MIX_DECODERS)
@@ -137,7 +137,7 @@ static void SDLCALL channel_complete_callback (int chan)
Mix_Chunk *done_chunk = Mix_GetChunk(chan);
SDL_Log("We were just alerted that Mixer channel #%d is done.\n", chan);
SDL_Log("Channel's chunk pointer is (%p).\n", (void*)done_chunk);
- SDL_Log(" Which %s correct.\n", (wave == done_chunk) ? "is" : "is NOT");
+ SDL_Log(" Which %s correct.\n", (g_wave == done_chunk) ? "is" : "is NOT");
channel_is_done = 1;
}
#endif
@@ -273,9 +273,9 @@ static void do_position_update(void)
static void CleanUp(int exitcode)
{
- if (wave) {
- Mix_FreeChunk(wave);
- wave = NULL;
+ if (g_wave) {
+ Mix_FreeChunk(g_wave);
+ g_wave = NULL;
}
if (audio_open) {
Mix_CloseAudio();
@@ -453,15 +453,15 @@ int main(int argc, char *argv[])
#endif
/* Load the requested wave file */
- wave = Mix_LoadWAV(argv[i]);
- if (wave == NULL) {
+ g_wave = Mix_LoadWAV(argv[i]);
+ if (g_wave == NULL) {
SDL_Log("Couldn't load %s: %s\n",
argv[i], SDL_GetError());
CleanUp(2);
}
if (reverse_sample) {
- flip_sample(wave);
+ flip_sample(g_wave);
}
#ifdef TEST_MIX_CHANNELFINISHED /* rcg06072001 */
@@ -476,7 +476,7 @@ int main(int argc, char *argv[])
}
/* Play and then exit */
- Mix_PlayChannel(0, wave, loops);
+ Mix_PlayChannel(0, g_wave, loops);
while (still_playing()) {