minor clean-up in SDL_os2audio.c

main
Ozkan Sezer 2021-01-24 17:02:40 +03:00
parent 141f441633
commit b852590ba5
1 changed files with 14 additions and 14 deletions

View File

@ -42,36 +42,36 @@ void lockDecr(volatile int *piVal);
parm [eax]; parm [eax];
*/ */
static ULONG _getEnvULong(PSZ pszName, ULONG ulMax, ULONG ulDefault) static ULONG _getEnvULong(const char *name, ULONG ulMax, ULONG ulDefault)
{ {
ULONG ulValue; ULONG ulValue;
PCHAR pcEnd; char* end;
PSZ pszEnvVal = SDL_getenv(pszName); char* envval = SDL_getenv(name);
if (pszEnvVal == NULL) if (envval == NULL)
return ulDefault; return ulDefault;
ulValue = SDL_strtoul((const char *)pszEnvVal, &pcEnd, 10); ulValue = SDL_strtoul(envval, &end, 10);
return (pcEnd == pszEnvVal) || (ulValue > ulMax)? ulDefault : ulMax; return (end == envval) || (ulValue > ulMax)? ulDefault : ulMax;
} }
static int _MCIError(PSZ pszFunc, ULONG ulResult) static int _MCIError(const char *func, ULONG ulResult)
{ {
CHAR acBuf[128]; CHAR acBuf[128];
mciGetErrorString(ulResult, acBuf, sizeof(acBuf)); mciGetErrorString(ulResult, acBuf, sizeof(acBuf));
return SDL_SetError("[%s] %s", pszFunc, acBuf); return SDL_SetError("[%s] %s", func, acBuf);
} }
static void _mixIOError(PSZ pszFunction, ULONG ulRC) static void _mixIOError(const char *function, ULONG ulRC)
{ {
debug_os2("%s() - failed, rc = 0x%X (%s)", debug_os2("%s() - failed, rc = 0x%X (%s)",
pszFunction, ulRC, function, ulRC,
(ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" : (ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" :
(ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown"); (ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown");
} }
LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, static LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
ULONG ulFlags) ULONG ulFlags)
{ {
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
ULONG ulRC; ULONG ulRC;
@ -90,8 +90,8 @@ LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
return 1; /* It seems, return value is not matter. */ return 1; /* It seems, return value is not matter. */
} }
LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, static LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
ULONG ulFlags) ULONG ulFlags)
{ {
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm; SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
ULONG ulRC; ULONG ulRC;