mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[freerdp,warnings] properly handle function return
This commit is contained in:
35
libfreerdp/cache/offscreen.c
vendored
35
libfreerdp/cache/offscreen.c
vendored
@@ -52,15 +52,11 @@ static BOOL
|
||||
update_gdi_create_offscreen_bitmap(rdpContext* context,
|
||||
const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
|
||||
{
|
||||
UINT16 index = 0;
|
||||
rdpBitmap* bitmap = NULL;
|
||||
rdpCache* cache = NULL;
|
||||
|
||||
if (!context || !createOffscreenBitmap || !context->cache)
|
||||
return FALSE;
|
||||
|
||||
cache = context->cache;
|
||||
bitmap = Bitmap_Alloc(context);
|
||||
rdpCache* cache = context->cache;
|
||||
rdpBitmap* bitmap = Bitmap_Alloc(context);
|
||||
|
||||
if (!bitmap)
|
||||
return FALSE;
|
||||
@@ -82,11 +78,14 @@ update_gdi_create_offscreen_bitmap(rdpContext* context,
|
||||
offscreen_cache_put(cache->offscreen, createOffscreenBitmap->id, bitmap);
|
||||
|
||||
if (cache->offscreen->currentSurface == createOffscreenBitmap->id)
|
||||
bitmap->SetSurface(context, bitmap, FALSE);
|
||||
{
|
||||
if (!bitmap->SetSurface(context, bitmap, FALSE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (UINT32 i = 0; i < createOffscreenBitmap->deleteList.cIndices; i++)
|
||||
{
|
||||
index = createOffscreenBitmap->deleteList.indices[i];
|
||||
const UINT16 index = createOffscreenBitmap->deleteList.indices[i];
|
||||
offscreen_cache_delete(cache->offscreen, index);
|
||||
}
|
||||
|
||||
@@ -96,20 +95,18 @@ update_gdi_create_offscreen_bitmap(rdpContext* context,
|
||||
static BOOL update_gdi_switch_surface(rdpContext* context,
|
||||
const SWITCH_SURFACE_ORDER* switchSurface)
|
||||
{
|
||||
rdpCache* cache = NULL;
|
||||
rdpBitmap* bitmap = NULL;
|
||||
|
||||
if (!context || !context->cache || !switchSurface || !context->graphics)
|
||||
return FALSE;
|
||||
|
||||
cache = context->cache;
|
||||
bitmap = context->graphics->Bitmap_Prototype;
|
||||
rdpCache* cache = context->cache;
|
||||
rdpBitmap* bitmap = context->graphics->Bitmap_Prototype;
|
||||
if (!bitmap)
|
||||
return FALSE;
|
||||
|
||||
if (switchSurface->bitmapId == SCREEN_BITMAP_SURFACE)
|
||||
{
|
||||
bitmap->SetSurface(context, NULL, TRUE);
|
||||
if (!bitmap->SetSurface(context, NULL, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,7 +115,8 @@ static BOOL update_gdi_switch_surface(rdpContext* context,
|
||||
if (bmp == NULL)
|
||||
return FALSE;
|
||||
|
||||
bitmap->SetSurface(context, bmp, FALSE);
|
||||
if (!bitmap->SetSurface(context, bmp, FALSE))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cache->offscreen->currentSurface = switchSurface->bitmapId;
|
||||
@@ -179,7 +177,12 @@ void offscreen_cache_delete(rdpOffscreenCache* offscreenCache, UINT32 index)
|
||||
WINPR_ASSERT(offscreenCache->context);
|
||||
|
||||
/* Ensure that the bitmap is no longer used in GDI */
|
||||
IFCALL(prevBitmap->SetSurface, offscreenCache->context, NULL, FALSE);
|
||||
if (prevBitmap->SetSurface)
|
||||
{
|
||||
if (!prevBitmap->SetSurface(offscreenCache->context, NULL, FALSE))
|
||||
WLog_WARN(TAG, "prevBitmap->SetSurface failed");
|
||||
}
|
||||
|
||||
Bitmap_Free(offscreenCache->context, prevBitmap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user