فهرست منبع

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

Sylvain Becker 1 سال پیش
والد
کامیت
f3419d8c04
37فایلهای تغییر یافته به همراه73 افزوده شده و 73 حذف شده
  1. 3 3
      src/SDL_dataqueue.c
  2. 2 2
      src/audio/aaudio/SDL_aaudio.c
  3. 1 1
      src/audio/alsa/SDL_alsa_audio.c
  4. 2 2
      src/audio/android/SDL_androidaudio.c
  5. 1 1
      src/audio/directsound/SDL_directsound.c
  6. 2 2
      src/audio/pipewire/SDL_pipewire.c
  7. 6 6
      src/audio/pulseaudio/SDL_pulseaudio.c
  8. 5 5
      src/audio/wasapi/SDL_wasapi.c
  9. 2 2
      src/audio/wasapi/SDL_wasapi_win32.c
  10. 3 3
      src/core/linux/SDL_evdev.c
  11. 2 2
      src/core/windows/SDL_immdevice.c
  12. 1 1
      src/events/SDL_keyboard.c
  13. 1 1
      src/filesystem/haiku/SDL_sysfilesystem.cc
  14. 1 1
      src/filesystem/unix/SDL_sysfilesystem.c
  15. 1 1
      src/haptic/android/SDL_syshaptic.c
  16. 1 1
      src/haptic/darwin/SDL_syshaptic.c
  17. 1 1
      src/haptic/linux/SDL_syshaptic.c
  18. 1 1
      src/haptic/windows/SDL_windowshaptic.c
  19. 1 1
      src/joystick/android/SDL_sysjoystick.c
  20. 1 1
      src/joystick/bsd/SDL_bsdjoystick.c
  21. 3 3
      src/joystick/linux/SDL_sysjoystick.c
  22. 1 1
      src/locale/windows/SDL_syslocale.c
  23. 9 9
      src/render/SDL_render.c
  24. 1 1
      src/render/direct3d/SDL_render_d3d.c
  25. 1 1
      src/render/software/SDL_render_sw.c
  26. 1 1
      src/test/SDL_test_memory.c
  27. 1 1
      src/video/SDL_shape.c
  28. 3 3
      src/video/SDL_video.c
  29. 1 1
      src/video/directfb/SDL_DirectFB_shape.c
  30. 1 1
      src/video/wayland/SDL_waylandmouse.c
  31. 2 2
      src/video/windows/SDL_windowsopengl.c
  32. 1 1
      src/video/x11/SDL_x11events.c
  33. 1 1
      src/video/x11/SDL_x11modes.c
  34. 1 1
      src/video/x11/SDL_x11shape.c
  35. 1 1
      src/video/x11/SDL_x11xfixes.c
  36. 2 2
      src/video/x11/SDL_x11xinput2.c
  37. 5 5
      test/testautomation_surface.c

+ 3 - 3
src/SDL_dataqueue.c

@@ -144,7 +144,7 @@ static SDL_DataQueuePacket *AllocateDataQueuePacket(SDL_DataQueue *queue)
 {
     SDL_DataQueuePacket *packet;
 
-    SDL_assert(queue);
+    SDL_assert(queue != NULL);
 
     packet = queue->pool;
     if (packet) {
@@ -194,7 +194,7 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _
 
     while (len > 0) {
         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)) {
             /* tail packet missing or completely full; we need a new packet. */
             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. */
             queue->head = packet->next;
-            SDL_assert((packet->next) || (packet == queue->tail));
+            SDL_assert((packet->next != NULL) || (packet == queue->tail));
             packet->next = queue->pool;
             queue->pool = packet;
         }

+ 2 - 2
src/audio/aaudio/SDL_aaudio.c

@@ -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")) {

+ 1 - 1
src/audio/alsa/SDL_alsa_audio.c

@@ -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

+ 2 - 2
src/audio/android/SDL_androidaudio.c

@@ -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;

+ 1 - 1
src/audio/directsound/SDL_directsound.c

@@ -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);

+ 2 - 2
src/audio/pipewire/SDL_pipewire.c

@@ -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);
 }
 

+ 6 - 6
src/audio/pulseaudio/SDL_pulseaudio.c

@@ -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));

+ 5 - 5
src/audio/wasapi/SDL_wasapi.c

@@ -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)) {

+ 2 - 2
src/audio/wasapi/SDL_wasapi_win32.c

@@ -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;
     }

+ 3 - 3
src/core/linux/SDL_evdev.c

@@ -245,8 +245,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);
@@ -287,7 +287,7 @@ void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *relea
                                     void (*acquire_callback)(void*), void *acquire_callback_data)
 {
     SDL_EVDEV_kbd_set_vt_switch_callbacks(_this->kbd,
-                                          release_callback, release_callback_data, 
+                                          release_callback, release_callback_data,
                                           acquire_callback, acquire_callback_data);
 }
 

+ 2 - 2
src/core/windows/SDL_immdevice.c

@@ -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. */
     HRESULT ret;
 
-    SDL_assert(device);
+    SDL_assert(device != NULL);
 
     while (SDL_TRUE) {
         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);
 
     if (FAILED(ret)) {
-        SDL_assert(!device);
+        SDL_assert(device == NULL);
         return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret);
     }
 

+ 1 - 1
src/events/SDL_keyboard.c

@@ -777,7 +777,7 @@ void 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) {

+ 1 - 1
src/filesystem/haiku/SDL_sysfilesystem.cc

@@ -52,7 +52,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);

+ 1 - 1
src/filesystem/unix/SDL_sysfilesystem.c

@@ -97,7 +97,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);

+ 1 - 1
src/haptic/android/SDL_syshaptic.c

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

+ 1 - 1
src/haptic/darwin/SDL_syshaptic.c

@@ -196,7 +196,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;
     }

+ 1 - 1
src/haptic/linux/SDL_syshaptic.c

@@ -195,7 +195,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;
     }

+ 1 - 1
src/haptic/windows/SDL_windowshaptic.c

@@ -126,7 +126,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;
     }

+ 1 - 1
src/joystick/android/SDL_sysjoystick.c

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

+ 1 - 1
src/joystick/bsd/SDL_bsdjoystick.c

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

+ 3 - 3
src/joystick/linux/SDL_sysjoystick.c

@@ -997,7 +997,7 @@ static SDL_joylist_item *JoystickByDevIndex(int device_index)
 
     item = SDL_joylist;
     while (device_index > 0) {
-        SDL_assert(item);
+        SDL_assert(item != NULL);
         device_index--;
         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 */
     }
 
-    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;

+ 1 - 1
src/locale/windows/SDL_syslocale.c

@@ -61,7 +61,7 @@ static void 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);

+ 9 - 9
src/render/SDL_render.c

@@ -237,7 +237,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);
@@ -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) {
         renderer->render_commands_tail->next = retval;
     } 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
         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()

+ 1 - 1
src/render/direct3d/SDL_render_d3d.c

@@ -939,7 +939,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");

+ 1 - 1
src/render/software/SDL_render_sw.c

@@ -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;

+ 1 - 1
src/test/SDL_test_memory.c

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

+ 1 - 1
src/video/SDL_shape.c

@@ -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)
 {
-    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);

+ 3 - 3
src/video/SDL_video.c

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

+ 1 - 1
src/video/directfb/SDL_DirectFB_shape.c

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

+ 1 - 1
src/video/wayland/SDL_waylandmouse.c

@@ -357,7 +357,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,

+ 2 - 2
src/video/windows/SDL_windowsopengl.c

@@ -690,7 +690,7 @@ int WIN_GL_SetupWindow(_THIS, SDL_Window *window)
 
 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);
 
     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. */
-    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

+ 1 - 1
src/video/x11/SDL_x11events.c

@@ -803,7 +803,7 @@ static void X11_DispatchEvent(_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

+ 1 - 1
src/video/x11/SDL_x11modes.c

@@ -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 (display) {

+ 1 - 1
src/video/x11/SDL_x11shape.c

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

+ 1 - 1
src/video/x11/SDL_x11xfixes.c

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

+ 2 - 2
src/video/x11/SDL_x11xinput2.c

@@ -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;

+ 5 - 5
test/testautomation_surface.c

@@ -369,21 +369,21 @@ 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_AllocFormat(pixel_formats[i]);
-            SDL_assert(fmt1);
+            SDL_assert(fmt1 != NULL);
             cvt1 = SDL_ConvertSurface(face, fmt1, 0);
-            SDL_assert(cvt1);
+            SDL_assert(cvt1 != NULL);
 
             fmt2 = SDL_AllocFormat(pixel_formats[j]);
-            SDL_assert(fmt1);
+            SDL_assert(fmt1 != NULL);
             cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
-            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, 0 );
-                SDL_assert(final);
+                SDL_assert(final != NULL);
 
                 /* Compare surface. */
                 ret = SDLTest_CompareSurfaces(face, final, 0);