mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-19 15:31:15 +00:00
Re-add SDL_assert() with non boolean ptr syntax (#8531)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user