mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-29 01:08:44 +00:00
[SDL2] pointer boolean (#8523)
This commit is contained in:
parent
4a3a9f3ad8
commit
a14b948b6c
394 changed files with 2564 additions and 2559 deletions
|
|
@ -70,12 +70,12 @@ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
|
|||
SDL_assert(surface->pitch == surface->w * 4);
|
||||
|
||||
cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor));
|
||||
if (cursor == NULL) {
|
||||
if (!cursor) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
curdata = (RPI_CursorData *)SDL_calloc(1, sizeof(*curdata));
|
||||
if (curdata == NULL) {
|
||||
if (!curdata) {
|
||||
SDL_OutOfMemory();
|
||||
SDL_free(cursor);
|
||||
return NULL;
|
||||
|
|
@ -119,12 +119,12 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
|
|||
const char *env;
|
||||
|
||||
mouse = SDL_GetMouse();
|
||||
if (mouse == NULL) {
|
||||
if (!mouse) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cursor != global_cursor) {
|
||||
if (global_cursor != NULL) {
|
||||
if (global_cursor) {
|
||||
curdata = (RPI_CursorData *)global_cursor->driverdata;
|
||||
if (curdata && curdata->element > DISPMANX_NO_HANDLE) {
|
||||
update = vc_dispmanx_update_start(0);
|
||||
|
|
@ -139,26 +139,26 @@ static int RPI_ShowCursor(SDL_Cursor *cursor)
|
|||
global_cursor = cursor;
|
||||
}
|
||||
|
||||
if (cursor == NULL) {
|
||||
if (!cursor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
curdata = (RPI_CursorData *)cursor->driverdata;
|
||||
if (curdata == NULL) {
|
||||
if (!curdata) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mouse->focus == NULL) {
|
||||
if (!mouse->focus) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
display = SDL_GetDisplayForWindow(mouse->focus);
|
||||
if (display == NULL) {
|
||||
if (!display) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = (SDL_DisplayData *)display->driverdata;
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -199,10 +199,10 @@ static void RPI_FreeCursor(SDL_Cursor *cursor)
|
|||
DISPMANX_UPDATE_HANDLE_T update;
|
||||
RPI_CursorData *curdata;
|
||||
|
||||
if (cursor != NULL) {
|
||||
if (cursor) {
|
||||
curdata = (RPI_CursorData *)cursor->driverdata;
|
||||
|
||||
if (curdata != NULL) {
|
||||
if (curdata) {
|
||||
if (curdata->element != DISPMANX_NO_HANDLE) {
|
||||
update = vc_dispmanx_update_start(0);
|
||||
SDL_assert(update);
|
||||
|
|
@ -242,7 +242,7 @@ static int RPI_WarpMouseGlobal(int x, int y)
|
|||
VC_RECT_T src_rect;
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
|
||||
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ static int RPI_WarpMouseGlobalGraphicOnly(int x, int y)
|
|||
VC_RECT_T src_rect;
|
||||
SDL_Mouse *mouse = SDL_GetMouse();
|
||||
|
||||
if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) {
|
||||
if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,14 +77,14 @@ static SDL_VideoDevice *RPI_Create()
|
|||
|
||||
/* Initialize SDL_VideoDevice structure */
|
||||
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
if (device == NULL) {
|
||||
if (!device) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize internal data */
|
||||
phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData));
|
||||
if (phdata == NULL) {
|
||||
if (!phdata) {
|
||||
SDL_OutOfMemory();
|
||||
SDL_free(device);
|
||||
return NULL;
|
||||
|
|
@ -179,7 +179,7 @@ static void AddDispManXDisplay(const int display_id)
|
|||
|
||||
/* Allocate display internal data */
|
||||
data = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
vc_dispmanx_display_close(handle);
|
||||
return; /* oh well */
|
||||
}
|
||||
|
|
@ -256,7 +256,7 @@ int RPI_CreateWindow(_THIS, SDL_Window *window)
|
|||
|
||||
/* Allocate window internal data */
|
||||
wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
|
||||
if (wdata == NULL) {
|
||||
if (!wdata) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
display = SDL_GetDisplayForWindow(window);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue