Re-add SDL_assert() with non boolean ptr syntax (#8530)

main
Sylvain Becker 2023-11-11 10:28:24 +01:00 committed by GitHub
parent b374105975
commit 04b6b2979f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 88 additions and 88 deletions

View File

@ -139,7 +139,7 @@ static int GetDefaultSampleFramesFromFreq(const int freq)
void OnAudioStreamCreated(SDL_AudioStream *stream)
{
SDL_assert(stream);
SDL_assert(stream != NULL);
// NOTE that you can create an audio stream without initializing the audio subsystem,
// but it will not be automatically destroyed during a later call to SDL_Quit!
@ -159,7 +159,7 @@ void OnAudioStreamCreated(SDL_AudioStream *stream)
void OnAudioStreamDestroy(SDL_AudioStream *stream)
{
SDL_assert(stream);
SDL_assert(stream != NULL);
// NOTE that you can create an audio stream without initializing the audio subsystem,
// but it will not be automatically destroyed during a later call to SDL_Quit!
@ -500,7 +500,7 @@ void RefPhysicalAudioDevice(SDL_AudioDevice *device)
static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, SDL_bool iscapture, const SDL_AudioSpec *spec, void *handle, SDL_AtomicInt *device_count)
{
SDL_assert(name);
SDL_assert(name != NULL);
SDL_LockRWLockForReading(current_audio.device_hash_lock);
const int shutting_down = SDL_AtomicGet(&current_audio.shutting_down);
@ -593,8 +593,8 @@ SDL_AudioDevice *SDL_AddAudioDevice(const SDL_bool iscapture, const char *name,
p->devid = device->instance_id;
p->next = NULL;
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
SDL_assert(current_audio.pending_events_tail);
SDL_assert(!current_audio.pending_events_tail->next);
SDL_assert(current_audio.pending_events_tail != NULL);
SDL_assert(current_audio.pending_events_tail->next == NULL);
current_audio.pending_events_tail->next = p;
current_audio.pending_events_tail = p;
SDL_UnlockRWLock(current_audio.device_hash_lock);
@ -670,8 +670,8 @@ void SDL_AudioDeviceDisconnected(SDL_AudioDevice *device)
if (first_disconnect) {
if (pending.next) { // NULL if event is disabled or disaster struck.
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
SDL_assert(current_audio.pending_events_tail);
SDL_assert(!current_audio.pending_events_tail->next);
SDL_assert(current_audio.pending_events_tail != NULL);
SDL_assert(current_audio.pending_events_tail->next == NULL);
current_audio.pending_events_tail->next = pending.next;
current_audio.pending_events_tail = pending_tail;
SDL_UnlockRWLock(current_audio.device_hash_lock);
@ -1127,7 +1127,7 @@ void SDL_OutputAudioThreadShutdown(SDL_AudioDevice *device)
static int SDLCALL OutputAudioThread(void *devicep) // thread entry point
{
SDL_AudioDevice *device = (SDL_AudioDevice *)devicep;
SDL_assert(device);
SDL_assert(device != NULL);
SDL_assert(!device->iscapture);
SDL_OutputAudioThreadSetup(device);
@ -1233,7 +1233,7 @@ void SDL_CaptureAudioThreadShutdown(SDL_AudioDevice *device)
static int SDLCALL CaptureAudioThread(void *devicep) // thread entry point
{
SDL_AudioDevice *device = (SDL_AudioDevice *)devicep;
SDL_assert(device);
SDL_assert(device != NULL);
SDL_assert(device->iscapture);
SDL_CaptureAudioThreadSetup(device);
@ -1726,7 +1726,7 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
// !!! FIXME: Actually, why do we allow there to be an invalid format, again?
// make sure start of list is sane.
SDL_assert(!logdev->bound_streams || (!logdev->bound_streams->prev_binding));
SDL_assert(!logdev->bound_streams || (logdev->bound_streams->prev_binding == NULL));
// lock all the streams upfront, so we can verify they aren't bound elsewhere and add them all in one block, as this is intended to add everything or nothing.
for (int i = 0; i < num_streams; i++) {
@ -1735,7 +1735,7 @@ int SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int
retval = SDL_SetError("Stream #%d is NULL", i);
} else {
SDL_LockMutex(stream->lock);
SDL_assert((!stream->bound_device) == ((!stream->prev_binding) || (!stream->next_binding)));
SDL_assert((stream->bound_device == NULL) == ((stream->prev_binding == NULL) || (stream->next_binding == NULL)));
if (stream->bound_device) {
retval = SDL_SetError("Stream #%d is already bound to a device", i);
} else if (stream->simplified) { // You can get here if you closed the device instead of destroying the stream.
@ -1892,7 +1892,7 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au
} else {
SDL_AtomicSet(&logdev->paused, 1); // start the device paused, to match SDL2.
SDL_assert(device);
SDL_assert(device != NULL);
const SDL_bool iscapture = device->iscapture;
if (iscapture) {
@ -2105,8 +2105,8 @@ void SDL_DefaultAudioDeviceChanged(SDL_AudioDevice *new_default_device)
if (pending.next) {
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
SDL_assert(current_audio.pending_events_tail);
SDL_assert(!current_audio.pending_events_tail->next);
SDL_assert(current_audio.pending_events_tail != NULL);
SDL_assert(current_audio.pending_events_tail->next == NULL);
current_audio.pending_events_tail->next = pending.next;
current_audio.pending_events_tail = pending_tail;
SDL_UnlockRWLock(current_audio.device_hash_lock);
@ -2186,8 +2186,8 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
if (pending.next) {
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
SDL_assert(current_audio.pending_events_tail);
SDL_assert(!current_audio.pending_events_tail->next);
SDL_assert(current_audio.pending_events_tail != NULL);
SDL_assert(current_audio.pending_events_tail->next == NULL);
current_audio.pending_events_tail->next = pending.next;
current_audio.pending_events_tail = pending_tail;
SDL_UnlockRWLock(current_audio.device_hash_lock);

View File

@ -221,8 +221,8 @@ static SDL_bool SDL_IsSupportedChannelCount(const int channels)
void ConvertAudio(int num_frames, const void *src, SDL_AudioFormat src_format, int src_channels,
void *dst, SDL_AudioFormat dst_format, int dst_channels, void* scratch)
{
SDL_assert(src);
SDL_assert(dst);
SDL_assert(src != NULL);
SDL_assert(dst != NULL);
SDL_assert(SDL_IsSupportedAudioFormat(src_format));
SDL_assert(SDL_IsSupportedAudioFormat(dst_format));
SDL_assert(SDL_IsSupportedChannelCount(src_channels));
@ -313,7 +313,7 @@ void ConvertAudio(int num_frames, const void *src, SDL_AudioFormat src_format, i
SDL_assert(dst_channels <= SDL_arraysize(channel_converters[0]));
channel_converter = channel_converters[src_channels - 1][dst_channels - 1];
SDL_assert(channel_converter);
SDL_assert(channel_converter != NULL);
// swap in some SIMD versions for a few of these.
if (channel_converter == SDL_ConvertStereoToMono) {

View File

@ -153,7 +153,7 @@ static int WriteToChunkedAudioTrack(void *ctx, const Uint8 *data, size_t len)
return SDL_OutOfMemory();
}
SDL_assert((!track->head) && (!track->tail) && (track->queued_bytes == 0));
SDL_assert((track->head == NULL) && (track->tail == NULL) && (track->queued_bytes == 0));
track->head = chunk;
track->tail = chunk;
}
@ -423,7 +423,7 @@ void *SDL_BeginAudioQueueIter(SDL_AudioQueue *queue)
size_t SDL_NextAudioQueueIter(SDL_AudioQueue *queue, void **inout_iter, SDL_AudioSpec *out_spec, SDL_bool *out_flushed)
{
SDL_AudioTrack *iter = *inout_iter;
SDL_assert(iter);
SDL_assert(iter != NULL);
SDL_copyp(out_spec, &iter->spec);

View File

@ -224,7 +224,7 @@ static const ALSA_Device default_capture_handle = {
static const char *get_audio_device(void *handle, const int channels)
{
SDL_assert(handle); // SDL2 used NULL to mean "default" but that's not true in SDL3.
SDL_assert(handle != NULL); // SDL2 used NULL to mean "default" but that's not true in SDL3.
ALSA_Device *dev = (ALSA_Device *)handle;
if (SDL_strcmp(dev->name, "default") == 0) {
@ -723,7 +723,7 @@ static void add_device(const SDL_bool iscapture, const char *name, void *hint, A
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

View File

@ -358,7 +358,7 @@ static int DSOUND_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, int b
}
SDL_assert(ptr1len == (DWORD)buflen);
SDL_assert(!ptr2);
SDL_assert(ptr2 == NULL);
SDL_assert(ptr2len == 0);
SDL_memcpy(buffer, ptr1, ptr1len);

View File

@ -39,7 +39,7 @@ extern "C"
static Uint8 *HAIKUAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
{
SDL_assert(device->hidden->current_buffer);
SDL_assert(device->hidden->current_buffer != NULL);
SDL_assert(device->hidden->current_buffer_len > 0);
*buffer_size = device->hidden->current_buffer_len;
return device->hidden->current_buffer;
@ -48,7 +48,7 @@ static Uint8 *HAIKUAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
static int HAIKUAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buffer_size)
{
// We already wrote our output right into the BSoundPlayer's callback's stream. Just clean up our stuff.
SDL_assert(device->hidden->current_buffer);
SDL_assert(device->hidden->current_buffer != NULL);
SDL_assert(device->hidden->current_buffer_len > 0);
device->hidden->current_buffer = NULL;
device->hidden->current_buffer_len = 0;
@ -59,7 +59,7 @@ static int HAIKUAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, i
static void FillSound(void *data, void *stream, size_t len, const media_raw_audio_format & format)
{
SDL_AudioDevice *device = (SDL_AudioDevice *)data;
SDL_assert(!device->hidden->current_buffer);
SDL_assert(device->hidden->current_buffer == NULL);
SDL_assert(device->hidden->current_buffer_len == 0);
device->hidden->current_buffer = (Uint8 *) stream;
device->hidden->current_buffer_len = (int) len;

View File

@ -361,7 +361,7 @@ static struct io_node *io_list_get_by_id(Uint32 id)
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);
@ -373,7 +373,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);
}

View File

@ -297,7 +297,7 @@ static void OperationStateChangeCallback(pa_operation *o, void *userdata)
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) {
// note that if PULSEAUDIO_pa_operation_set_state_callback == NULL, then `o` must have a callback that will signal pulseaudio_threaded_mainloop.
// If not, on really old (earlier PulseAudio 4.0, from the year 2013!) installs, this call will block forever.
@ -339,8 +339,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())) {
@ -360,7 +360,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) {
@ -609,8 +609,8 @@ static int PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
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 = device->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*device->hidden));

View File

@ -433,7 +433,7 @@ static Uint8 *WASAPI_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
if (device->hidden->render) {
if (WasapiFailed(device, IAudioRenderClient_GetBuffer(device->hidden->render, device->sample_frames, &buffer))) {
SDL_assert(!buffer);
SDL_assert(buffer == NULL);
if (device->hidden->device_lost) { // just use an available buffer, we won't be playing it anyhow.
*buffer_size = 0; // we'll recover during WaitDevice and try again.
}
@ -562,7 +562,7 @@ static int mgmtthrtask_PrepDevice(void *userdata)
const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED;
IAudioClient *client = device->hidden->client;
SDL_assert(client);
SDL_assert(client != NULL);
#if defined(__WINRT__) || defined(__GDK__) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP.
device->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
@ -581,7 +581,7 @@ static int mgmtthrtask_PrepDevice(void *userdata)
if (FAILED(ret)) {
return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret);
}
SDL_assert(waveformat);
SDL_assert(waveformat != NULL);
device->hidden->waveformat = waveformat;
SDL_AudioSpec newspec;
@ -662,7 +662,7 @@ static int mgmtthrtask_PrepDevice(void *userdata)
return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret);
}
SDL_assert(capture);
SDL_assert(capture != NULL);
device->hidden->capture = capture;
ret = IAudioClient_Start(client);
if (FAILED(ret)) {
@ -677,7 +677,7 @@ static int mgmtthrtask_PrepDevice(void *userdata)
return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret);
}
SDL_assert(render);
SDL_assert(render != NULL);
device->hidden->render = render;
ret = IAudioClient_Start(client);
if (FAILED(ret)) {

View File

@ -164,11 +164,11 @@ int WASAPI_ActivateDevice(SDL_AudioDevice *device)
IMMDevice_Release(immdevice);
if (FAILED(ret)) {
SDL_assert(!device->hidden->client);
SDL_assert(device->hidden->client == NULL);
return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret);
}
SDL_assert(device->hidden->client);
SDL_assert(device->hidden->client != NULL);
if (WASAPI_PrepDevice(device) == -1) { // not async, fire it right away.
return -1;
}

View File

@ -250,8 +250,8 @@ void SDL_EVDEV_Quit(void)
SDL_EVDEV_kbd_quit(_this->kbd);
SDL_assert(!_this->first);
SDL_assert(!_this->last);
SDL_assert(_this->first == NULL);
SDL_assert(_this->last == NULL);
SDL_assert(_this->num_devices == 0);
SDL_free(_this);

View File

@ -342,8 +342,8 @@ int SDL_IMMDevice_Get(SDL_AudioDevice *device, IMMDevice **immdevice, SDL_bool i
{
const Uint64 timeout = SDL_GetTicks() + 8000; /* intel's audio drivers can fail for up to EIGHT SECONDS after a device is connected or we wake from sleep. */
SDL_assert(device);
SDL_assert(immdevice);
SDL_assert(device != NULL);
SDL_assert(immdevice != NULL);
LPCWSTR devid = SDL_IMMDevice_GetDevID(device);
SDL_assert(devid != NULL);

View File

@ -787,7 +787,7 @@ int SDL_SetKeyboardFocus(SDL_Window *window)
if (keyboard->focus && keyboard->focus != window) {
/* new window shouldn't think it has mouse captured. */
SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
SDL_assert(window == NULL || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
/* old window must lose an existing mouse capture. */
if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {

View File

@ -47,7 +47,7 @@ char *SDL_GetBasePath(void)
rc = path.GetParent(&path); /* chop filename, keep directory. */
SDL_assert(rc == B_OK);
const char *str = path.Path();
SDL_assert(str);
SDL_assert(str != NULL);
const size_t len = SDL_strlen(str);
char *retval = (char *) SDL_malloc(len + 2);

View File

@ -89,7 +89,7 @@ static char *search_path_for_binary(const char *bin)
return NULL;
}
SDL_assert(bin);
SDL_assert(bin != NULL);
alloc_size = SDL_strlen(bin) + SDL_strlen(envr) + 2;
exe = (char *)SDL_malloc(alloc_size);

View File

@ -59,7 +59,7 @@ static SDL_hapticlist_item *HapticByOrder(int index)
return NULL;
}
while (index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
--index;
item = item->next;
}

View File

@ -193,7 +193,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
}
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
--device_index;
item = item->next;
}

View File

@ -188,7 +188,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
}
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
--device_index;
item = item->next;
}

View File

@ -120,7 +120,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
}
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
--device_index;
item = item->next;
}

View File

@ -499,7 +499,7 @@ static SDL_joylist_item *GetJoystickByDevIndex(int device_index)
}
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
device_index--;
item = item->next;
}

View File

@ -526,7 +526,7 @@ static SDL_joylist_item *GetJoystickByDevIndex(int device_index)
}
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
device_index--;
item = item->next;
}

View File

@ -1001,7 +1001,7 @@ static SDL_joylist_item *GetJoystickByDevIndex(int device_index)
item = SDL_joylist;
while (device_index > 0) {
SDL_assert(item);
SDL_assert(item != NULL);
device_index--;
item = item->next;
}
@ -1481,8 +1481,8 @@ static int LINUX_JoystickOpen(SDL_Joystick *joystick, int device_index)
return -1; /* SDL_SetError will already have been called */
}
SDL_assert(!item->hwdata);
SDL_assert(!item_sensor || !item_sensor->hwdata);
SDL_assert(item->hwdata == NULL);
SDL_assert(!item_sensor || item_sensor->hwdata == NULL);
item->hwdata = joystick->hwdata;
if (item_sensor) {
item_sensor->hwdata = joystick->hwdata;

View File

@ -61,7 +61,7 @@ static int SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
ULONG wbuflen = 0;
SDL_bool isstack;
SDL_assert(pGetUserPreferredUILanguages);
SDL_assert(pGetUserPreferredUILanguages != NULL);
pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, NULL, &wbuflen);
wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack);

View File

@ -229,7 +229,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
{
int retval;
SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
if (!renderer->render_commands) { /* nothing to do! */
SDL_assert(renderer->vertex_data_used == 0);
@ -327,7 +327,7 @@ static SDL_RenderCommand *AllocateRenderCommand(SDL_Renderer *renderer)
}
}
SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
if (renderer->render_commands_tail) {
renderer->render_commands_tail->next = retval;
} else {
@ -751,13 +751,13 @@ static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer)
{
/* all of these functions are required to be implemented, even as no-ops, so we don't
have to check that they aren't NULL over and over. */
SDL_assert(renderer->QueueSetViewport);
SDL_assert(renderer->QueueSetDrawColor);
SDL_assert(renderer->QueueDrawPoints);
SDL_assert(renderer->QueueDrawLines || renderer->QueueGeometry);
SDL_assert(renderer->QueueFillRects || renderer->QueueGeometry);
SDL_assert(renderer->QueueCopy || renderer->QueueGeometry);
SDL_assert(renderer->RunCommandQueue);
SDL_assert(renderer->QueueSetViewport != NULL);
SDL_assert(renderer->QueueSetDrawColor != NULL);
SDL_assert(renderer->QueueDrawPoints != NULL);
SDL_assert(renderer->QueueDrawLines != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->QueueFillRects != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->QueueCopy != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->RunCommandQueue != NULL);
}
static SDL_RenderLineMethod SDL_GetRenderLineMethod(void)
@ -2304,7 +2304,7 @@ static void SDL_RenderLogicalBorders(SDL_Renderer *renderer)
static void SDL_RenderLogicalPresentation(SDL_Renderer *renderer)
{
SDL_assert(!renderer->target);
SDL_assert(renderer->target == NULL);
SDL_SetRenderViewport(renderer, NULL);
SDL_SetRenderClipRect(renderer, NULL);
SDL_SetRenderScale(renderer, 1.0f, 1.0f);

View File

@ -928,7 +928,7 @@ static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, LPDIREC
{
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
SDL_assert(!*shader);
SDL_assert(*shader == NULL);
if (!texturedata) {
return SDL_SetError("Texture is not currently available");

View File

@ -641,7 +641,7 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
if (drawstate->surface_cliprect_dirty) {
const SDL_Rect *viewport = drawstate->viewport;
const SDL_Rect *cliprect = drawstate->cliprect;
SDL_assert_release(viewport); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
SDL_assert_release(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
if (cliprect) {
SDL_Rect clip_rect;

View File

@ -200,7 +200,7 @@ SDL_ShapeTree *SDL_CalculateShapeTree(SDL_WindowShapeMode mode, SDL_Surface *sha
void SDL_TraverseShapeTree(SDL_ShapeTree *tree, SDL_TraversalFunction function, void *closure)
{
SDL_assert(tree);
SDL_assert(tree != NULL);
if (tree->kind == QuadShape) {
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft, function, closure);
SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright, function, closure);

View File

@ -271,7 +271,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
}
}
SDL_assert(renderer); /* should have explicitly checked this above. */
SDL_assert(renderer != NULL); /* should have explicitly checked this above. */
/* Create the data after we successfully create the renderer (bug #1116) */
data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
@ -570,7 +570,7 @@ int SDL_VideoInit(const char *driver_name)
return 0;
pre_driver_error:
SDL_assert(!_this);
SDL_assert(_this == NULL);
if (init_video_capture) {
SDL_QuitVideoCapture();
}

View File

@ -442,7 +442,7 @@ static int create_buffer_from_shm(Wayland_CursorData *d,
return SDL_SetError("mmap() failed.");
}
SDL_assert(d->shm_data);
SDL_assert(d->shm_data != NULL);
shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
d->buffer = wl_shm_pool_create_buffer(shm_pool,

View File

@ -689,7 +689,7 @@ int WIN_GL_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_bool WIN_GL_UseEGL(SDL_VideoDevice *_this)
{
SDL_assert(_this->gl_data);
SDL_assert(_this->gl_data != NULL);
SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); /* No WGL extension for OpenGL ES 1.x profiles. */
@ -829,7 +829,7 @@ int WIN_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext
}
/* sanity check that higher level handled this. */
SDL_assert(window || (!window && !context));
SDL_assert(window || (window == NULL && !context));
/* Some Windows drivers freak out if hdc is NULL, even when context is
NULL, against spec. Since hdc is _supposed_ to be ignored if context

View File

@ -821,7 +821,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
XClientMessageEvent m;
int i;
SDL_assert(videodata);
SDL_assert(videodata != NULL);
display = videodata->display;
/* Save the original keycode for dead keys, which are filtered out by

View File

@ -120,7 +120,7 @@ int X11_ConfineCursorWithFlags(SDL_VideoDevice *_this, SDL_Window *window, const
X11_DestroyPointerBarrier(_this, data->active_cursor_confined_window);
}
SDL_assert(window);
SDL_assert(window != NULL);
wdata = window->driverdata;
/* If user did not specify an area to confine, destroy the barrier that was/is assigned to

View File

@ -190,7 +190,7 @@ static void xinput2_remove_device_info(SDL_VideoData *videodata, const int devic
for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
if (devinfo->device_id == device_id) {
SDL_assert((devinfo == videodata->mouse_device_info) == (!prev));
SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL));
if (!prev) {
videodata->mouse_device_info = devinfo->next;
} else {
@ -214,7 +214,7 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata,
for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
if (devinfo->device_id == device_id) {
SDL_assert((devinfo == videodata->mouse_device_info) == (!prev));
SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL));
if (prev) { /* move this to the front of the list, assuming we'll get more from this one. */
prev->next = devinfo->next;
devinfo->next = videodata->mouse_device_info;

View File

@ -188,7 +188,7 @@ static Thing *CreateThing(ThingType what, float x, float y, float z, float w, fl
}
if ((w < 0) || (h < 0)) {
SDL_assert(texture);
SDL_assert(texture != NULL);
if (w < 0) {
w = texture->w;
}

View File

@ -353,21 +353,21 @@ static int surface_testCompleteSurfaceConversion(void *arg)
for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
for (j = 0; j < SDL_arraysize(pixel_formats); ++j) {
fmt1 = SDL_CreatePixelFormat(pixel_formats[i]);
SDL_assert(fmt1);
SDL_assert(fmt1 != NULL);
cvt1 = SDL_ConvertSurface(face, fmt1);
SDL_assert(cvt1);
SDL_assert(cvt1 != NULL);
fmt2 = SDL_CreatePixelFormat(pixel_formats[j]);
SDL_assert(fmt1);
SDL_assert(fmt1 != NULL);
cvt2 = SDL_ConvertSurface(cvt1, fmt2);
SDL_assert(cvt2);
SDL_assert(cvt2 != NULL);
if (fmt1->BytesPerPixel == face->format->BytesPerPixel &&
fmt2->BytesPerPixel == face->format->BytesPerPixel &&
(fmt1->Amask != 0) == (face->format->Amask != 0) &&
(fmt2->Amask != 0) == (face->format->Amask != 0)) {
final = SDL_ConvertSurface(cvt2, face->format);
SDL_assert(final);
SDL_assert(final != NULL);
/* Compare surface. */
ret = SDLTest_CompareSurfaces(face, final, 0);