Remove more reserved identifiers (#6925)

This commit is contained in:
Sylvain Becker
2022-12-29 22:58:16 +01:00
committed by GitHub
parent ce412c2c71
commit d7d3c22dbf
29 changed files with 517 additions and 517 deletions

View File

@@ -17,7 +17,7 @@
/* Fixture */
void _audioSetUp(void *arg)
static void audioSetUp(void *arg)
{
/* Start SDL audio subsystem */
int ret = SDL_InitSubSystem(SDL_INIT_AUDIO);
@@ -28,7 +28,7 @@ void _audioSetUp(void *arg)
}
}
void _audioTearDown(void *arg)
static void audioTearDown(void *arg)
{
/* Remove a possibly created file from SDL disk writer audio driver; ignore errors */
(void)remove("sdlaudio.raw");
@@ -37,17 +37,17 @@ void _audioTearDown(void *arg)
}
/* Global counter for callback invocation */
int _audio_testCallbackCounter;
static int g_audio_testCallbackCounter;
/* Global accumulator for total callback length */
int _audio_testCallbackLength;
static int g_audio_testCallbackLength;
/* Test callback function */
void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len)
static void SDLCALL audio_testCallback(void *userdata, Uint8 *stream, int len)
{
/* track that callback was called */
_audio_testCallbackCounter++;
_audio_testCallbackLength += len;
g_audio_testCallbackCounter++;
g_audio_testCallbackLength += len;
}
/* Test case functions */
@@ -65,7 +65,7 @@ int audio_quitInitAudioSubSystem()
SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
/* Restart audio again */
_audioSetUp(NULL);
audioSetUp(NULL);
return TEST_COMPLETED;
}
@@ -121,7 +121,7 @@ int audio_initQuitAudio()
SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)");
/* Restart audio again */
_audioSetUp(NULL);
audioSetUp(NULL);
return TEST_COMPLETED;
}
@@ -173,7 +173,7 @@ int audio_initOpenCloseQuitAudio()
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 4096;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
case 1:
@@ -182,7 +182,7 @@ int audio_initOpenCloseQuitAudio()
desired.format = AUDIO_F32SYS;
desired.channels = 2;
desired.samples = 2048;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
break;
}
@@ -211,7 +211,7 @@ int audio_initOpenCloseQuitAudio()
} /* driver loop */
/* Restart audio again */
_audioSetUp(NULL);
audioSetUp(NULL);
return TEST_COMPLETED;
}
@@ -263,7 +263,7 @@ int audio_pauseUnpauseAudio()
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 4096;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
case 1:
@@ -272,7 +272,7 @@ int audio_pauseUnpauseAudio()
desired.format = AUDIO_F32SYS;
desired.channels = 2;
desired.samples = 2048;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
break;
}
@@ -287,8 +287,8 @@ int audio_pauseUnpauseAudio()
SDLTest_Log("Pause/Unpause iteration: %d", l + 1);
/* Reset callback counters */
_audio_testCallbackCounter = 0;
_audio_testCallbackLength = 0;
g_audio_testCallbackCounter = 0;
g_audio_testCallbackLength = 0;
/* Un-pause audio to start playing (maybe multiple times) */
pause_on = 0;
@@ -302,9 +302,9 @@ int audio_pauseUnpauseAudio()
do {
SDL_Delay(10);
totalDelay += 10;
} while (_audio_testCallbackCounter == 0 && totalDelay < 1000);
SDLTest_AssertCheck(_audio_testCallbackCounter > 0, "Verify callback counter; expected: >0 got: %d", _audio_testCallbackCounter);
SDLTest_AssertCheck(_audio_testCallbackLength > 0, "Verify callback length; expected: >0 got: %d", _audio_testCallbackLength);
} while (g_audio_testCallbackCounter == 0 && totalDelay < 1000);
SDLTest_AssertCheck(g_audio_testCallbackCounter > 0, "Verify callback counter; expected: >0 got: %d", g_audio_testCallbackCounter);
SDLTest_AssertCheck(g_audio_testCallbackLength > 0, "Verify callback length; expected: >0 got: %d", g_audio_testCallbackLength);
/* Pause audio to stop playing (maybe multiple times) */
for (k = 0; k <= j; k++) {
@@ -314,9 +314,9 @@ int audio_pauseUnpauseAudio()
}
/* Ensure callback is not called again */
originalCounter = _audio_testCallbackCounter;
originalCounter = g_audio_testCallbackCounter;
SDL_Delay(totalDelay + 10);
SDLTest_AssertCheck(originalCounter == _audio_testCallbackCounter, "Verify callback counter; expected: %d, got: %d", originalCounter, _audio_testCallbackCounter);
SDLTest_AssertCheck(originalCounter == g_audio_testCallbackCounter, "Verify callback counter; expected: %d, got: %d", originalCounter, g_audio_testCallbackCounter);
}
/* Call Close */
@@ -331,7 +331,7 @@ int audio_pauseUnpauseAudio()
} /* driver loop */
/* Restart audio again */
_audioSetUp(NULL);
audioSetUp(NULL);
return TEST_COMPLETED;
}
@@ -490,17 +490,17 @@ int audio_printCurrentAudioDriver()
}
/* Definition of all formats, channels, and frequencies used to test audio conversions */
const int _numAudioFormats = 18;
SDL_AudioFormat _audioFormats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, AUDIO_U16LSB,
const int g_numAudioFormats = 18;
static SDL_AudioFormat g_audioFormats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, AUDIO_U16LSB,
AUDIO_U16MSB, AUDIO_U16SYS, AUDIO_U16, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S32SYS, AUDIO_S32,
AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_F32SYS, AUDIO_F32 };
const char *_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
const char *g_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", "AUDIO_U16LSB",
"AUDIO_U16MSB", "AUDIO_U16SYS", "AUDIO_U16", "AUDIO_S32LSB", "AUDIO_S32MSB", "AUDIO_S32SYS", "AUDIO_S32",
"AUDIO_F32LSB", "AUDIO_F32MSB", "AUDIO_F32SYS", "AUDIO_F32" };
const int _numAudioChannels = 4;
Uint8 _audioChannels[] = { 1, 2, 4, 6 };
const int _numAudioFrequencies = 4;
int _audioFrequencies[] = { 11025, 22050, 44100, 48000 };
const int g_numAudioChannels = 4;
Uint8 g_audioChannels[] = { 1, 2, 4, 6 };
const int g_numAudioFrequencies = 4;
int g_audioFrequencies[] = { 11025, 22050, 44100, 48000 };
/**
* \brief Builds various audio conversion structures
@@ -537,22 +537,22 @@ int audio_buildAudioCVT()
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
/* All source conversions with random conversion targets, allow 'null' conversions */
for (i = 0; i < _numAudioFormats; i++) {
for (j = 0; j < _numAudioChannels; j++) {
for (k = 0; k < _numAudioFrequencies; k++) {
spec1.format = _audioFormats[i];
spec1.channels = _audioChannels[j];
spec1.freq = _audioFrequencies[k];
ii = SDLTest_RandomIntegerInRange(0, _numAudioFormats - 1);
jj = SDLTest_RandomIntegerInRange(0, _numAudioChannels - 1);
kk = SDLTest_RandomIntegerInRange(0, _numAudioFrequencies - 1);
spec2.format = _audioFormats[ii];
spec2.channels = _audioChannels[jj];
spec2.freq = _audioFrequencies[kk];
for (i = 0; i < g_numAudioFormats; i++) {
for (j = 0; j < g_numAudioChannels; j++) {
for (k = 0; k < g_numAudioFrequencies; k++) {
spec1.format = g_audioFormats[i];
spec1.channels = g_audioChannels[j];
spec1.freq = g_audioFrequencies[k];
ii = SDLTest_RandomIntegerInRange(0, g_numAudioFormats - 1);
jj = SDLTest_RandomIntegerInRange(0, g_numAudioChannels - 1);
kk = SDLTest_RandomIntegerInRange(0, g_numAudioFrequencies - 1);
spec2.format = g_audioFormats[ii];
spec2.channels = g_audioChannels[jj];
spec2.freq = g_audioFrequencies[kk];
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
spec2.format, spec2.channels, spec2.freq);
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
i, _audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
i, g_audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, g_audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
SDLTest_AssertCheck(result == 0 || result == 1, "Verify result value; expected: 0 or 1, got: %i", result);
if (result < 0) {
SDLTest_LogError("%s", SDL_GetError());
@@ -712,7 +712,7 @@ int audio_openCloseAndGetAudioStatus()
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 4096;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
/* Open device */
@@ -772,7 +772,7 @@ int audio_lockUnlockOpenAudioDevice()
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 4096;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
/* Open device */
@@ -834,39 +834,39 @@ int audio_convertAudio()
}
SDLTest_Log("%s", message);
/* All source conversions with random conversion targets */
for (i = 0; i < _numAudioFormats; i++) {
for (j = 0; j < _numAudioChannels; j++) {
for (k = 0; k < _numAudioFrequencies; k++) {
spec1.format = _audioFormats[i];
spec1.channels = _audioChannels[j];
spec1.freq = _audioFrequencies[k];
for (i = 0; i < g_numAudioFormats; i++) {
for (j = 0; j < g_numAudioChannels; j++) {
for (k = 0; k < g_numAudioFrequencies; k++) {
spec1.format = g_audioFormats[i];
spec1.channels = g_audioChannels[j];
spec1.freq = g_audioFrequencies[k];
/* Ensure we have a different target format */
do {
if (c & 1) {
ii = SDLTest_RandomIntegerInRange(0, _numAudioFormats - 1);
ii = SDLTest_RandomIntegerInRange(0, g_numAudioFormats - 1);
} else {
ii = 1;
}
if (c & 2) {
jj = SDLTest_RandomIntegerInRange(0, _numAudioChannels - 1);
jj = SDLTest_RandomIntegerInRange(0, g_numAudioChannels - 1);
} else {
jj = j;
}
if (c & 4) {
kk = SDLTest_RandomIntegerInRange(0, _numAudioFrequencies - 1);
kk = SDLTest_RandomIntegerInRange(0, g_numAudioFrequencies - 1);
} else {
kk = k;
}
} while ((i == ii) && (j == jj) && (k == kk));
spec2.format = _audioFormats[ii];
spec2.channels = _audioChannels[jj];
spec2.freq = _audioFrequencies[kk];
spec2.format = g_audioFormats[ii];
spec2.channels = g_audioChannels[jj];
spec2.freq = g_audioFrequencies[kk];
result = SDL_BuildAudioCVT(&cvt, spec1.format, spec1.channels, spec1.freq,
spec2.format, spec2.channels, spec2.freq);
SDLTest_AssertPass("Call to SDL_BuildAudioCVT(format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i ==> format[%i]=%s(%i),channels[%i]=%i,freq[%i]=%i)",
i, _audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, _audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
i, g_audioFormatsVerbose[i], spec1.format, j, spec1.channels, k, spec1.freq, ii, g_audioFormatsVerbose[ii], spec2.format, jj, spec2.channels, kk, spec2.freq);
SDLTest_AssertCheck(result == 1, "Verify result value; expected: 1, got: %i", result);
if (result != 1) {
SDLTest_LogError("%s", SDL_GetError());
@@ -938,7 +938,7 @@ int audio_openCloseAudioDeviceConnected()
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = 4096;
desired.callback = _audio_testCallback;
desired.callback = audio_testCallback;
desired.userdata = NULL;
/* Open device */
@@ -1046,7 +1046,7 @@ static const SDLTest_TestCaseReference *audioTests[] = {
/* Audio test suite (global) */
SDLTest_TestSuiteReference audioTestSuite = {
"Audio",
_audioSetUp,
audioSetUp,
audioTests,
_audioTearDown
audioTearDown
};