mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 23:05:49 +00:00
Re-add SDL_assert() with non boolean ptr syntax (#8531)
This commit is contained in:
@@ -77,8 +77,8 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
|
||||
aaudio_result_t res;
|
||||
LOGI(__func__);
|
||||
|
||||
SDL_assert((!captureDevice) || !iscapture);
|
||||
SDL_assert((!audioDevice) || iscapture);
|
||||
SDL_assert((captureDevice == NULL) || !iscapture);
|
||||
SDL_assert((audioDevice == NULL) || iscapture);
|
||||
|
||||
if (iscapture) {
|
||||
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {
|
||||
|
||||
@@ -735,7 +735,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
|
||||
desc = (char *)name;
|
||||
}
|
||||
|
||||
SDL_assert(name);
|
||||
SDL_assert(name != NULL);
|
||||
|
||||
/* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output".
|
||||
just chop the extra lines off, this seems to get a reasonable device
|
||||
|
||||
@@ -41,8 +41,8 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
SDL_AudioFormat test_format;
|
||||
SDL_bool iscapture = this->iscapture;
|
||||
|
||||
SDL_assert((!captureDevice) || !iscapture);
|
||||
SDL_assert((!audioDevice) || iscapture);
|
||||
SDL_assert((captureDevice == NULL) || !iscapture);
|
||||
SDL_assert((audioDevice == NULL) || iscapture);
|
||||
|
||||
if (iscapture) {
|
||||
captureDevice = this;
|
||||
|
||||
@@ -354,7 +354,7 @@ static int DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen)
|
||||
}
|
||||
|
||||
SDL_assert(ptr1len == this->spec.size);
|
||||
SDL_assert(!ptr2);
|
||||
SDL_assert(ptr2 == NULL);
|
||||
SDL_assert(ptr2len == 0);
|
||||
|
||||
SDL_memcpy(buffer, ptr1, ptr1len);
|
||||
|
||||
@@ -399,7 +399,7 @@ static struct io_node *io_list_get_by_path(char *path)
|
||||
|
||||
static void node_object_destroy(struct node_object *node)
|
||||
{
|
||||
SDL_assert(node);
|
||||
SDL_assert(node != NULL);
|
||||
|
||||
spa_list_remove(&node->link);
|
||||
spa_hook_remove(&node->node_listener);
|
||||
@@ -411,7 +411,7 @@ static void node_object_destroy(struct node_object *node)
|
||||
/* The pending node list */
|
||||
static void pending_list_add(struct node_object *node)
|
||||
{
|
||||
SDL_assert(node);
|
||||
SDL_assert(node != NULL);
|
||||
spa_list_append(&hotplug_pending_list, &node->link);
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ static const char *getAppName(void)
|
||||
static void WaitForPulseOperation(pa_operation *o)
|
||||
{
|
||||
/* This checks for NO errors currently. Either fix that, check results elsewhere, or do things you don't care about. */
|
||||
SDL_assert(pulseaudio_threaded_mainloop);
|
||||
SDL_assert(pulseaudio_threaded_mainloop != NULL);
|
||||
if (o) {
|
||||
while (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING) {
|
||||
PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); /* this releases the lock and blocks on an internal condition variable. */
|
||||
@@ -310,8 +310,8 @@ static int ConnectToPulseServer(void)
|
||||
pa_mainloop_api *mainloop_api = NULL;
|
||||
int state = 0;
|
||||
|
||||
SDL_assert(!pulseaudio_threaded_mainloop);
|
||||
SDL_assert(!pulseaudio_context);
|
||||
SDL_assert(pulseaudio_threaded_mainloop == NULL);
|
||||
SDL_assert(pulseaudio_context == NULL);
|
||||
|
||||
/* Set up a new main loop */
|
||||
if (!(pulseaudio_threaded_mainloop = PULSEAUDIO_pa_threaded_mainloop_new())) {
|
||||
@@ -331,7 +331,7 @@ static int ConnectToPulseServer(void)
|
||||
PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
|
||||
|
||||
mainloop_api = PULSEAUDIO_pa_threaded_mainloop_get_api(pulseaudio_threaded_mainloop);
|
||||
SDL_assert(mainloop_api); /* this never fails, right? */
|
||||
SDL_assert(mainloop_api != NULL); /* this never fails, right? */
|
||||
|
||||
pulseaudio_context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
|
||||
if (!pulseaudio_context) {
|
||||
@@ -596,8 +596,8 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname)
|
||||
int format = PA_SAMPLE_INVALID;
|
||||
int retval = 0;
|
||||
|
||||
SDL_assert(pulseaudio_threaded_mainloop);
|
||||
SDL_assert(pulseaudio_context);
|
||||
SDL_assert(pulseaudio_threaded_mainloop != NULL);
|
||||
SDL_assert(pulseaudio_context != NULL);
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));
|
||||
|
||||
@@ -181,7 +181,7 @@ static Uint8 *WASAPI_GetDeviceBuf(_THIS)
|
||||
if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) {
|
||||
return (Uint8 *)buffer;
|
||||
}
|
||||
SDL_assert(!buffer);
|
||||
SDL_assert(buffer == NULL);
|
||||
}
|
||||
|
||||
return (Uint8 *)buffer;
|
||||
@@ -407,7 +407,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
HRESULT ret = S_OK;
|
||||
DWORD streamflags = 0;
|
||||
|
||||
SDL_assert(client);
|
||||
SDL_assert(client != NULL);
|
||||
|
||||
#if defined(__WINRT__) || defined(__GDK__) /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */
|
||||
this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
|
||||
@@ -424,7 +424,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret);
|
||||
}
|
||||
|
||||
SDL_assert(waveformat);
|
||||
SDL_assert(waveformat != NULL);
|
||||
this->hidden->waveformat = waveformat;
|
||||
|
||||
this->spec.channels = (Uint8)waveformat->nChannels;
|
||||
@@ -502,7 +502,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret);
|
||||
}
|
||||
|
||||
SDL_assert(capture);
|
||||
SDL_assert(capture != NULL);
|
||||
this->hidden->capture = capture;
|
||||
ret = IAudioClient_Start(client);
|
||||
if (FAILED(ret)) {
|
||||
@@ -516,7 +516,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret);
|
||||
}
|
||||
|
||||
SDL_assert(render);
|
||||
SDL_assert(render != NULL);
|
||||
this->hidden->render = render;
|
||||
ret = IAudioClient_Start(client);
|
||||
if (FAILED(ret)) {
|
||||
|
||||
@@ -120,11 +120,11 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
|
||||
IMMDevice_Release(device);
|
||||
|
||||
if (FAILED(ret)) {
|
||||
SDL_assert(!this->hidden->client);
|
||||
SDL_assert(this->hidden->client == NULL);
|
||||
return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret);
|
||||
}
|
||||
|
||||
SDL_assert(this->hidden->client);
|
||||
SDL_assert(this->hidden->client != NULL);
|
||||
if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user