Pointer as bool (libsdl-org#7214)

This commit is contained in:
Sylvain
2023-11-09 22:29:15 +01:00
committed by Sam Lantinga
parent 23db971681
commit d8600f717e
371 changed files with 2448 additions and 2442 deletions

View File

@@ -642,7 +642,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer,
}
pipelineStates = (D3D12_PipelineState *)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates));
if (pipelineStates == NULL) {
if (!pipelineStates) {
SAFE_RELEASE(pipelineState);
SDL_OutOfMemory();
return NULL;
@@ -757,7 +757,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
}
}
#endif
if (CreateEventExFunc == NULL) {
if (!CreateEventExFunc) {
result = E_FAIL;
goto done;
}
@@ -770,7 +770,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
}
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
if (CreateDXGIFactoryFunc == NULL) {
if (!CreateDXGIFactoryFunc) {
result = E_FAIL;
goto done;
}
@@ -814,7 +814,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
/* If the debug hint is set, also create the DXGI factory in debug mode */
DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
if (DXGIGetDebugInterfaceFunc == NULL) {
if (!DXGIGetDebugInterfaceFunc) {
result = E_FAIL;
goto done;
}
@@ -1445,7 +1445,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
}
textureData = (D3D12_TextureData *)SDL_calloc(1, sizeof(*textureData));
if (textureData == NULL) {
if (!textureData) {
SDL_OutOfMemory();
return -1;
}
@@ -1603,7 +1603,7 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
if (textureData == NULL) {
if (!textureData) {
return;
}
@@ -1770,7 +1770,7 @@ static int D3D12_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
if (textureData == NULL) {
if (!textureData) {
return SDL_SetError("Texture is not currently available");
}
@@ -1815,7 +1815,7 @@ static int D3D12_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
if (textureData == NULL) {
if (!textureData) {
return SDL_SetError("Texture is not currently available");
}
@@ -1839,7 +1839,7 @@ static int D3D12_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
if (textureData == NULL) {
if (!textureData) {
return SDL_SetError("Texture is not currently available");
}
@@ -1868,7 +1868,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
BYTE *textureMemory;
int bpp;
if (textureData == NULL) {
if (!textureData) {
return SDL_SetError("Texture is not currently available");
}
#if SDL_HAVE_YUV
@@ -1987,7 +1987,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
D3D12_TEXTURE_COPY_LOCATION dstLocation;
int bpp;
if (textureData == NULL) {
if (!textureData) {
return;
}
#if SDL_HAVE_YUV
@@ -2058,7 +2058,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
{
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
if (textureData == NULL) {
if (!textureData) {
return;
}
@@ -2071,7 +2071,7 @@ static IDXGIResource *D3D12_GetTextureDXGIResource(SDL_Texture *texture)
IDXGIResource *resource = NULL;
HRESULT result;
if (textureData == NULL || textureData->mainTexture == NULL) {
if (!textureData || !textureData->mainTexture) {
SDL_SetError("Texture is not currently available");
return NULL;
}
@@ -2089,7 +2089,7 @@ static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
D3D12_TextureData *textureData = NULL;
if (texture == NULL) {
if (!texture) {
if (rendererData->textureRenderTarget) {
D3D12_TransitionResource(rendererData,
rendererData->textureRenderTarget->mainTexture,
@@ -2132,7 +2132,7 @@ static int D3D12_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
if (verts == NULL) {
if (!verts) {
return -1;
}
@@ -2159,7 +2159,7 @@ static int D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
int count = indices ? num_indices : num_vertices;
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
if (verts == NULL) {
if (!verts) {
return -1;
}
@@ -2958,14 +2958,14 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, Uint32 flags)
D3D12_RenderData *data;
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
if (renderer == NULL) {
if (!renderer) {
SDL_OutOfMemory();
return NULL;
}
renderer->magic = &SDL_renderer_magic;
data = (D3D12_RenderData *)SDL_calloc(1, sizeof(*data));
if (data == NULL) {
if (!data) {
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;