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

This commit is contained in:
Sylvain Becker 2023-11-11 10:29:05 +01:00 committed by GitHub
parent c29df1699e
commit f3419d8c04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 73 additions and 73 deletions

View file

@ -144,7 +144,7 @@ static SDL_DataQueuePacket *AllocateDataQueuePacket(SDL_DataQueue *queue)
{ {
SDL_DataQueuePacket *packet; SDL_DataQueuePacket *packet;
SDL_assert(queue); SDL_assert(queue != NULL);
packet = queue->pool; packet = queue->pool;
if (packet) { if (packet) {
@ -194,7 +194,7 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _
while (len > 0) { while (len > 0) {
SDL_DataQueuePacket *packet = queue->tail; SDL_DataQueuePacket *packet = queue->tail;
SDL_assert(!packet || (packet->datalen <= packet_size)); SDL_assert(packet == NULL || (packet->datalen <= packet_size));
if (!packet || (packet->datalen >= packet_size)) { if (!packet || (packet->datalen >= packet_size)) {
/* tail packet missing or completely full; we need a new packet. */ /* tail packet missing or completely full; we need a new packet. */
packet = AllocateDataQueuePacket(queue); packet = AllocateDataQueuePacket(queue);
@ -286,7 +286,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */
queue->head = packet->next; queue->head = packet->next;
SDL_assert((packet->next) || (packet == queue->tail)); SDL_assert((packet->next != NULL) || (packet == queue->tail));
packet->next = queue->pool; packet->next = queue->pool;
queue->pool = packet; queue->pool = packet;
} }

View file

@ -77,8 +77,8 @@ static int aaudio_OpenDevice(_THIS, const char *devname)
aaudio_result_t res; aaudio_result_t res;
LOGI(__func__); LOGI(__func__);
SDL_assert((!captureDevice) || !iscapture); SDL_assert((captureDevice == NULL) || !iscapture);
SDL_assert((!audioDevice) || iscapture); SDL_assert((audioDevice == NULL) || iscapture);
if (iscapture) { if (iscapture) {
if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) { if (!Android_JNI_RequestPermission("android.permission.RECORD_AUDIO")) {

View file

@ -735,7 +735,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D
desc = (char *)name; desc = (char *)name;
} }
SDL_assert(name); SDL_assert(name != NULL);
/* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output". /* 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 just chop the extra lines off, this seems to get a reasonable device

View file

@ -41,8 +41,8 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
SDL_AudioFormat test_format; SDL_AudioFormat test_format;
SDL_bool iscapture = this->iscapture; SDL_bool iscapture = this->iscapture;
SDL_assert((!captureDevice) || !iscapture); SDL_assert((captureDevice == NULL) || !iscapture);
SDL_assert((!audioDevice) || iscapture); SDL_assert((audioDevice == NULL) || iscapture);
if (iscapture) { if (iscapture) {
captureDevice = this; captureDevice = this;

View file

@ -354,7 +354,7 @@ static int DSOUND_CaptureFromDevice(_THIS, void *buffer, int buflen)
} }
SDL_assert(ptr1len == this->spec.size); SDL_assert(ptr1len == this->spec.size);
SDL_assert(!ptr2); SDL_assert(ptr2 == NULL);
SDL_assert(ptr2len == 0); SDL_assert(ptr2len == 0);
SDL_memcpy(buffer, ptr1, ptr1len); SDL_memcpy(buffer, ptr1, ptr1len);

View file

@ -399,7 +399,7 @@ static struct io_node *io_list_get_by_path(char *path)
static void node_object_destroy(struct node_object *node) static void node_object_destroy(struct node_object *node)
{ {
SDL_assert(node); SDL_assert(node != NULL);
spa_list_remove(&node->link); spa_list_remove(&node->link);
spa_hook_remove(&node->node_listener); spa_hook_remove(&node->node_listener);
@ -411,7 +411,7 @@ static void node_object_destroy(struct node_object *node)
/* The pending node list */ /* The pending node list */
static void pending_list_add(struct node_object *node) static void pending_list_add(struct node_object *node)
{ {
SDL_assert(node); SDL_assert(node != NULL);
spa_list_append(&hotplug_pending_list, &node->link); spa_list_append(&hotplug_pending_list, &node->link);
} }

View file

@ -275,7 +275,7 @@ static const char *getAppName(void)
static void WaitForPulseOperation(pa_operation *o) 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. */ /* 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) { if (o) {
while (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING) { 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. */ 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; pa_mainloop_api *mainloop_api = NULL;
int state = 0; int state = 0;
SDL_assert(!pulseaudio_threaded_mainloop); SDL_assert(pulseaudio_threaded_mainloop == NULL);
SDL_assert(!pulseaudio_context); SDL_assert(pulseaudio_context == NULL);
/* Set up a new main loop */ /* Set up a new main loop */
if (!(pulseaudio_threaded_mainloop = PULSEAUDIO_pa_threaded_mainloop_new())) { 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); PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
mainloop_api = PULSEAUDIO_pa_threaded_mainloop_get_api(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()); pulseaudio_context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName());
if (!pulseaudio_context) { if (!pulseaudio_context) {
@ -596,8 +596,8 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname)
int format = PA_SAMPLE_INVALID; int format = PA_SAMPLE_INVALID;
int retval = 0; int retval = 0;
SDL_assert(pulseaudio_threaded_mainloop); SDL_assert(pulseaudio_threaded_mainloop != NULL);
SDL_assert(pulseaudio_context); SDL_assert(pulseaudio_context != NULL);
/* Initialize all variables that we clean on shutdown */ /* Initialize all variables that we clean on shutdown */
h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden));

View file

@ -181,7 +181,7 @@ static Uint8 *WASAPI_GetDeviceBuf(_THIS)
if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) { if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) {
return (Uint8 *)buffer; return (Uint8 *)buffer;
} }
SDL_assert(!buffer); SDL_assert(buffer == NULL);
} }
return (Uint8 *)buffer; return (Uint8 *)buffer;
@ -407,7 +407,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
HRESULT ret = S_OK; HRESULT ret = S_OK;
DWORD streamflags = 0; 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. */ #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); 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); return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret);
} }
SDL_assert(waveformat); SDL_assert(waveformat != NULL);
this->hidden->waveformat = waveformat; this->hidden->waveformat = waveformat;
this->spec.channels = (Uint8)waveformat->nChannels; 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); return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret);
} }
SDL_assert(capture); SDL_assert(capture != NULL);
this->hidden->capture = capture; this->hidden->capture = capture;
ret = IAudioClient_Start(client); ret = IAudioClient_Start(client);
if (FAILED(ret)) { 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); return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret);
} }
SDL_assert(render); SDL_assert(render != NULL);
this->hidden->render = render; this->hidden->render = render;
ret = IAudioClient_Start(client); ret = IAudioClient_Start(client);
if (FAILED(ret)) { if (FAILED(ret)) {

View file

@ -120,11 +120,11 @@ int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery)
IMMDevice_Release(device); IMMDevice_Release(device);
if (FAILED(ret)) { if (FAILED(ret)) {
SDL_assert(!this->hidden->client); SDL_assert(this->hidden->client == NULL);
return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret); 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. */ if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */
return -1; return -1;
} }

View file

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

View file

@ -361,7 +361,7 @@ int SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture)
const Uint64 timeout = SDL_GetTicks64() + 8000; /* intel's audio drivers can fail for up to EIGHT SECONDS after a device is connected or we wake from sleep. */ const Uint64 timeout = SDL_GetTicks64() + 8000; /* intel's audio drivers can fail for up to EIGHT SECONDS after a device is connected or we wake from sleep. */
HRESULT ret; HRESULT ret;
SDL_assert(device); SDL_assert(device != NULL);
while (SDL_TRUE) { while (SDL_TRUE) {
if (!devid) { if (!devid) {
@ -496,7 +496,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca
HRESULT ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, &device); HRESULT ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, &device);
if (FAILED(ret)) { if (FAILED(ret)) {
SDL_assert(!device); SDL_assert(device == NULL);
return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret); return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret);
} }

View file

@ -777,7 +777,7 @@ void SDL_SetKeyboardFocus(SDL_Window *window)
if (keyboard->focus && keyboard->focus != window) { if (keyboard->focus && keyboard->focus != window) {
/* new window shouldn't think it has mouse captured. */ /* 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. */ /* old window must lose an existing mouse capture. */
if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) { if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -237,7 +237,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
{ {
int retval; 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! */ if (!renderer->render_commands) { /* nothing to do! */
SDL_assert(renderer->vertex_data_used == 0); SDL_assert(renderer->vertex_data_used == 0);
@ -335,7 +335,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) { if (renderer->render_commands_tail) {
renderer->render_commands_tail->next = retval; renderer->render_commands_tail->next = retval;
} else { } else {
@ -883,13 +883,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 /* 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. */ have to check that they aren't NULL over and over. */
SDL_assert(renderer->QueueSetViewport); SDL_assert(renderer->QueueSetViewport != NULL);
SDL_assert(renderer->QueueSetDrawColor); SDL_assert(renderer->QueueSetDrawColor != NULL);
SDL_assert(renderer->QueueDrawPoints); SDL_assert(renderer->QueueDrawPoints != NULL);
SDL_assert(renderer->QueueDrawLines || renderer->QueueGeometry); SDL_assert(renderer->QueueDrawLines != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->QueueFillRects || renderer->QueueGeometry); SDL_assert(renderer->QueueFillRects != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->QueueCopy || renderer->QueueGeometry); SDL_assert(renderer->QueueCopy != NULL || renderer->QueueGeometry != NULL);
SDL_assert(renderer->RunCommandQueue); SDL_assert(renderer->RunCommandQueue != NULL);
} }
static SDL_RenderLineMethod SDL_GetRenderLineMethod() static SDL_RenderLineMethod SDL_GetRenderLineMethod()

View file

@ -939,7 +939,7 @@ static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, LPDIREC
{ {
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
SDL_assert(!*shader); SDL_assert(*shader == NULL);
if (!texturedata) { if (!texturedata) {
return SDL_SetError("Texture is not currently available"); 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) { if (drawstate->surface_cliprect_dirty) {
const SDL_Rect *viewport = drawstate->viewport; const SDL_Rect *viewport = drawstate->viewport;
const SDL_Rect *cliprect = drawstate->cliprect; 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) { if (cliprect) {
SDL_Rect clip_rect; SDL_Rect clip_rect;

View file

@ -171,7 +171,7 @@ static void *SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size)
{ {
void *mem; void *mem;
SDL_assert(!ptr || SDL_IsAllocationTracked(ptr)); SDL_assert(ptr == NULL || SDL_IsAllocationTracked(ptr));
mem = SDL_realloc_orig(ptr, size); mem = SDL_realloc_orig(ptr, size);
if (mem && mem != ptr) { if (mem && mem != ptr) {
if (ptr) { if (ptr) {

View file

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

View file

@ -267,7 +267,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) */ /* Create the data after we successfully create the renderer (bug #1116) */
data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data));
@ -556,7 +556,7 @@ int SDL_VideoInit(const char *driver_name)
return 0; return 0;
pre_driver_error: pre_driver_error:
SDL_assert(!_this); SDL_assert(_this == NULL);
if (init_touch) { if (init_touch) {
SDL_TouchQuit(); SDL_TouchQuit();
} }
@ -2853,7 +2853,7 @@ int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red,
if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) { if (SDL_GetWindowGammaRamp(window, NULL, NULL, NULL) < 0) {
return -1; return -1;
} }
SDL_assert(window->gamma); SDL_assert(window->gamma != NULL);
} }
if (red) { if (red) {

View file

@ -61,7 +61,7 @@ SDL_WindowShaper *DirectFB_CreateShaper(SDL_Window* window)
int DirectFB_ResizeWindowShape(SDL_Window* window) int DirectFB_ResizeWindowShape(SDL_Window* window)
{ {
SDL_ShapeData* data = window->shaper->driverdata; SDL_ShapeData* data = window->shaper->driverdata;
SDL_assert(data); SDL_assert(data != NULL);
if (window->x != -1000) if (window->x != -1000)
{ {

View file

@ -357,7 +357,7 @@ static int create_buffer_from_shm(Wayland_CursorData *d,
return SDL_SetError("mmap() failed."); 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); shm_pool = wl_shm_create_pool(data->shm, shm_fd, size);
d->buffer = wl_shm_pool_create_buffer(shm_pool, d->buffer = wl_shm_pool_create_buffer(shm_pool,

View file

@ -690,7 +690,7 @@ int WIN_GL_SetupWindow(_THIS, SDL_Window *window)
SDL_bool WIN_GL_UseEGL(_THIS) SDL_bool WIN_GL_UseEGL(_THIS)
{ {
SDL_assert(_this->gl_data); SDL_assert(_this->gl_data != NULL);
SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); 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. */ 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(_THIS, SDL_Window *window, SDL_GLContext context)
} }
/* sanity check that higher level handled this. */ /* 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 /* 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 NULL, against spec. Since hdc is _supposed_ to be ignored if context

View file

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

View file

@ -410,7 +410,7 @@ static void X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent
} }
} }
SDL_assert((displayidx == -1) == (!display)); SDL_assert((displayidx == -1) == (display == NULL));
if (ev->connection == RR_Disconnected) { /* output is going away */ if (ev->connection == RR_Disconnected) { /* output is going away */
if (display) { if (display) {

View file

@ -69,7 +69,7 @@ int X11_ResizeWindowShape(SDL_Window *window)
{ {
SDL_ShapeData *data = window->shaper->driverdata; SDL_ShapeData *data = window->shaper->driverdata;
unsigned int bitmapsize = window->w / 8; unsigned int bitmapsize = window->w / 8;
SDL_assert(data); SDL_assert(data != NULL);
if (window->w % 8 > 0) { if (window->w % 8 > 0) {
bitmapsize += 1; bitmapsize += 1;

View file

@ -120,7 +120,7 @@ int X11_ConfineCursorWithFlags(_THIS, SDL_Window *window, const SDL_Rect *rect,
X11_DestroyPointerBarrier(_this, data->active_cursor_confined_window); X11_DestroyPointerBarrier(_this, data->active_cursor_confined_window);
} }
SDL_assert(window); SDL_assert(window != NULL);
wdata = (SDL_WindowData *)window->driverdata; wdata = (SDL_WindowData *)window->driverdata;
/* If user did not specify an area to confine, destroy the barrier that was/is assigned to /* 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) { for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
if (devinfo->device_id == device_id) { 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) { if (!prev) {
videodata->mouse_device_info = devinfo->next; videodata->mouse_device_info = devinfo->next;
} else { } 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) { for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) {
if (devinfo->device_id == device_id) { 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. */ if (prev) { /* move this to the front of the list, assuming we'll get more from this one. */
prev->next = devinfo->next; prev->next = devinfo->next;
devinfo->next = videodata->mouse_device_info; devinfo->next = videodata->mouse_device_info;

View file

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