[c23,freerdp] replace NULL with nullptr

This commit is contained in:
Armin Novak
2026-02-26 15:06:27 +01:00
parent 20b4cb6edc
commit 5c510af477
225 changed files with 4115 additions and 4083 deletions

View File

@@ -46,8 +46,8 @@ static BOOL bitmap_cache_put(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 inde
static BOOL update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
rdpBitmap* bitmap = NULL;
rdpCache* cache = NULL;
rdpBitmap* bitmap = nullptr;
rdpCache* cache = nullptr;
cache = context->cache;
@@ -57,7 +57,7 @@ static BOOL update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
bitmap = bitmap_cache_get(cache->bitmap, (BYTE)memblt->cacheId, memblt->cacheIndex);
/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
if (bitmap == NULL)
if (bitmap == nullptr)
return TRUE;
memblt->bitmap = bitmap;
@@ -66,7 +66,7 @@ static BOOL update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
static BOOL update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
rdpBitmap* bitmap = NULL;
rdpBitmap* bitmap = nullptr;
rdpCache* cache = context->cache;
rdpBrush* brush = &mem3blt->brush;
BOOL ret = TRUE;
@@ -100,8 +100,8 @@ static BOOL update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
static BOOL update_gdi_cache_bitmap(rdpContext* context, const CACHE_BITMAP_ORDER* cacheBitmap)
{
rdpBitmap* bitmap = NULL;
rdpBitmap* prevBitmap = NULL;
rdpBitmap* bitmap = nullptr;
rdpBitmap* prevBitmap = nullptr;
rdpCache* cache = context->cache;
bitmap = Bitmap_Alloc(context);
@@ -133,7 +133,7 @@ fail:
static BOOL update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2)
{
rdpBitmap* prevBitmap = NULL;
rdpBitmap* prevBitmap = nullptr;
rdpCache* cache = context->cache;
rdpSettings* settings = context->settings;
rdpBitmap* bitmap = Bitmap_Alloc(context);
@@ -176,8 +176,8 @@ fail:
static BOOL update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3)
{
rdpBitmap* bitmap = NULL;
rdpBitmap* prevBitmap = NULL;
rdpBitmap* bitmap = nullptr;
rdpBitmap* prevBitmap = nullptr;
BOOL compressed = TRUE;
rdpCache* cache = context->cache;
rdpSettings* settings = context->settings;
@@ -219,12 +219,12 @@ fail:
rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index)
{
rdpBitmap* bitmap = NULL;
rdpBitmap* bitmap = nullptr;
if (id >= bitmapCache->maxCells)
{
WLog_ERR(TAG, "get invalid bitmap cell id: %" PRIu32 "", id);
return NULL;
return nullptr;
}
if (index == BITMAP_CACHE_WAITING_LIST_INDEX)
@@ -234,7 +234,7 @@ rdpBitmap* bitmap_cache_get(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index
else if (index > bitmapCache->cells[id].number)
{
WLog_ERR(TAG, "get invalid bitmap index %" PRIu32 " in cell id: %" PRIu32 "", index, id);
return NULL;
return nullptr;
}
bitmap = bitmapCache->cells[id].entries[index];
@@ -265,7 +265,7 @@ BOOL bitmap_cache_put(rdpBitmapCache* bitmapCache, UINT32 id, UINT32 index, rdpB
void bitmap_cache_register_callbacks(rdpUpdate* update)
{
rdpCache* cache = NULL;
rdpCache* cache = nullptr;
WINPR_ASSERT(update);
WINPR_ASSERT(update->context);
@@ -357,8 +357,8 @@ end:
rdpBitmapCache* bitmap_cache_new(rdpContext* context)
{
rdpSettings* settings = NULL;
rdpBitmapCache* bitmapCache = NULL;
rdpSettings* settings = nullptr;
rdpBitmapCache* bitmapCache = nullptr;
WINPR_ASSERT(context);
@@ -368,7 +368,7 @@ rdpBitmapCache* bitmap_cache_new(rdpContext* context)
bitmapCache = (rdpBitmapCache*)calloc(1, sizeof(rdpBitmapCache));
if (!bitmapCache)
return NULL;
return nullptr;
const UINT32 BitmapCacheV2NumCells =
freerdp_settings_get_uint32(settings, FreeRDP_BitmapCacheV2NumCells);
@@ -399,7 +399,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
bitmap_cache_free(bitmapCache);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void bitmap_cache_free(rdpBitmapCache* bitmapCache)
@@ -472,7 +472,7 @@ static BITMAP_DATA* copy_bitmap_data(const BITMAP_DATA* data, size_t count)
return dst;
fail:
free_bitmap_data(dst, count);
return NULL;
return nullptr;
}
void free_bitmap_update(WINPR_ATTR_UNUSED rdpContext* context,
@@ -504,7 +504,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_bitmap_update(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
CACHE_BITMAP_ORDER* copy_cache_bitmap_order(rdpContext* context, const CACHE_BITMAP_ORDER* order)
@@ -532,7 +532,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_cache_bitmap_order(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void free_cache_bitmap_order(WINPR_ATTR_UNUSED rdpContext* context, CACHE_BITMAP_ORDER* order)
@@ -569,7 +569,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_cache_bitmap_v2_order(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void free_cache_bitmap_v2_order(WINPR_ATTR_UNUSED rdpContext* context,
@@ -607,7 +607,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_cache_bitmap_v3_order(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void free_cache_bitmap_v3_order(WINPR_ATTR_UNUSED rdpContext* context, CACHE_BITMAP_V3_ORDER* order)

View File

@@ -84,7 +84,7 @@ static BOOL update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
static BOOL update_gdi_polygon_sc(rdpContext* context, const POLYGON_SC_ORDER* polygon_sc)
{
rdpCache* cache = NULL;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
cache = context->cache;
WINPR_ASSERT(cache);
@@ -121,8 +121,8 @@ static BOOL update_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon
static BOOL update_gdi_cache_brush(rdpContext* context, const CACHE_BRUSH_ORDER* cacheBrush)
{
UINT32 length = 0;
void* data = NULL;
rdpCache* cache = NULL;
void* data = nullptr;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(cacheBrush);
@@ -143,20 +143,20 @@ static BOOL update_gdi_cache_brush(rdpContext* context, const CACHE_BRUSH_ORDER*
void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp)
{
void* entry = NULL;
void* entry = nullptr;
if (!brushCache)
return NULL;
return nullptr;
if (!bpp)
return NULL;
return nullptr;
if (*bpp == 1)
{
if (index >= brushCache->maxMonoEntries)
{
WLog_ERR(TAG, "invalid brush (%" PRIu32 " bpp) index: 0x%08" PRIX32 "", *bpp, index);
return NULL;
return nullptr;
}
*bpp = brushCache->monoEntries[index].bpp;
@@ -167,17 +167,17 @@ void* brush_cache_get(rdpBrushCache* brushCache, UINT32 index, UINT32* bpp)
if (index >= brushCache->maxEntries)
{
WLog_ERR(TAG, "invalid brush (%" PRIu32 " bpp) index: 0x%08" PRIX32 "", *bpp, index);
return NULL;
return nullptr;
}
*bpp = brushCache->entries[index].bpp;
entry = brushCache->entries[index].entry;
}
if (entry == NULL)
if (entry == nullptr)
{
WLog_ERR(TAG, "invalid brush (%" PRIu32 " bpp) at index: 0x%08" PRIX32 "", *bpp, index);
return NULL;
return nullptr;
}
return entry;
@@ -242,14 +242,14 @@ void brush_cache_register_callbacks(rdpUpdate* update)
rdpBrushCache* brush_cache_new(rdpContext* context)
{
rdpBrushCache* brushCache = NULL;
rdpBrushCache* brushCache = nullptr;
WINPR_ASSERT(context);
brushCache = (rdpBrushCache*)calloc(1, sizeof(rdpBrushCache));
if (!brushCache)
return NULL;
return nullptr;
brushCache->context = context;
brushCache->maxEntries = 64;
@@ -270,7 +270,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
brush_cache_free(brushCache);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void brush_cache_free(rdpBrushCache* brushCache)
@@ -305,7 +305,7 @@ void free_cache_brush_order(rdpContext* context, CACHE_BRUSH_ORDER* order)
CACHE_BRUSH_ORDER* copy_cache_brush_order(rdpContext* context, const CACHE_BRUSH_ORDER* order)
{
CACHE_BRUSH_ORDER* dst = NULL;
CACHE_BRUSH_ORDER* dst = nullptr;
WINPR_ASSERT(context);
@@ -318,5 +318,5 @@ CACHE_BRUSH_ORDER* copy_cache_brush_order(rdpContext* context, const CACHE_BRUSH
return dst;
fail:
free_cache_brush_order(context, dst);
return NULL;
return nullptr;
}

View File

@@ -27,14 +27,14 @@
rdpCache* cache_new(rdpContext* context)
{
rdpCache* cache = NULL;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
cache = (rdpCache*)calloc(1, sizeof(rdpCache));
if (!cache)
return NULL;
return nullptr;
cache->glyph = glyph_cache_new(context);
@@ -77,12 +77,12 @@ error:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
cache_free(cache);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void cache_free(rdpCache* cache)
{
if (cache != NULL)
if (cache != nullptr)
{
glyph_cache_free(cache->glyph);
brush_cache_free(cache->brush);
@@ -110,7 +110,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_cache_color_table_order(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void free_cache_color_table_order(WINPR_ATTR_UNUSED rdpContext* context,
@@ -142,7 +142,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_surface_bits_command(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void free_surface_bits_command(WINPR_ATTR_UNUSED rdpContext* context, SURFACE_BITS_COMMAND* order)

View File

@@ -138,7 +138,7 @@ static BOOL update_process_glyph_fragments(rdpContext* context, const BYTE* data
UINT32 id = 0;
UINT32 size = 0;
UINT32 index = 0;
const BYTE* fragments = NULL;
const BYTE* fragments = nullptr;
RDP_RECT bound = WINPR_C_ARRAY_INIT;
BOOL rc = FALSE;
@@ -250,7 +250,7 @@ static BOOL update_process_glyph_fragments(rdpContext* context, const BYTE* data
id = data[index++];
fragments = (const BYTE*)glyph_cache_fragment_get(glyph_cache, id, &size);
if (fragments == NULL)
if (fragments == nullptr)
goto fail;
for (UINT32 n = 0; n < size;)
@@ -414,7 +414,7 @@ static BOOL update_gdi_fast_glyph(rdpContext* context, const FAST_GLYPH_ORDER* f
INT32 opHeight = 0;
INT32 bkWidth = 0;
INT32 bkHeight = 0;
rdpCache* cache = NULL;
rdpCache* cache = nullptr;
if (!context || !fastGlyph || !context->cache)
return FALSE;
@@ -463,7 +463,7 @@ static BOOL update_gdi_fast_glyph(rdpContext* context, const FAST_GLYPH_ORDER* f
if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj))
{
/* got option font that needs to go into cache */
rdpGlyph* glyph = NULL;
rdpGlyph* glyph = nullptr;
const GLYPH_DATA_V2* glyphData = &fastGlyph->glyphData;
glyph = Glyph_Alloc(context, glyphData->x, glyphData->y, glyphData->cx, glyphData->cy,
@@ -561,14 +561,14 @@ rdpGlyph* glyph_cache_get(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index)
if (id >= ARRAYSIZE(glyphCache->glyphCache))
{
WLog_ERR(TAG, "invalid glyph cache id: %" PRIu32 "", id);
return NULL;
return nullptr;
}
GLYPH_CACHE* cache = &glyphCache->glyphCache[id];
if (index > cache->number)
{
WLog_ERR(TAG, "index %" PRIu32 " out of range for cache id: %" PRIu32 "", index, id);
return NULL;
return nullptr;
}
rdpGlyph* glyph = cache->entries[index];
@@ -612,7 +612,7 @@ BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index, rdpGlyp
const void* glyph_cache_fragment_get(rdpGlyphCache* glyphCache, UINT32 index, UINT32* size)
{
void* fragment = NULL;
void* fragment = nullptr;
WINPR_ASSERT(glyphCache);
WINPR_ASSERT(glyphCache->fragCache.entries);
@@ -620,7 +620,7 @@ const void* glyph_cache_fragment_get(rdpGlyphCache* glyphCache, UINT32 index, UI
if (index > 255)
{
WLog_ERR(TAG, "invalid glyph cache fragment index: %" PRIu32 "", index);
return NULL;
return nullptr;
}
fragment = glyphCache->fragCache.entries[index].fragment;
@@ -684,8 +684,8 @@ void glyph_cache_register_callbacks(rdpUpdate* update)
rdpGlyphCache* glyph_cache_new(rdpContext* context)
{
rdpGlyphCache* glyphCache = NULL;
rdpSettings* settings = NULL;
rdpGlyphCache* glyphCache = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(context);
@@ -695,7 +695,7 @@ rdpGlyphCache* glyph_cache_new(rdpContext* context)
glyphCache = (rdpGlyphCache*)calloc(1, sizeof(rdpGlyphCache));
if (!glyphCache)
return NULL;
return nullptr;
glyphCache->log = WLog_Get("com.freerdp.cache.glyph");
glyphCache->context = context;
@@ -719,7 +719,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
glyph_cache_free(glyphCache);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void glyph_cache_free(rdpGlyphCache* glyphCache)
@@ -742,18 +742,18 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
if (glyph)
{
glyph->Free(glyphCache->context, glyph);
entries[j] = NULL;
entries[j] = nullptr;
}
}
free((void*)entries);
cache[i].entries = NULL;
cache[i].entries = nullptr;
}
for (size_t i = 0; i < ARRAYSIZE(glyphCache->fragCache.entries); i++)
{
free(glyphCache->fragCache.entries[i].fragment);
glyphCache->fragCache.entries[i].fragment = NULL;
glyphCache->fragCache.entries[i].fragment = nullptr;
}
free(glyphCache);
@@ -762,7 +762,7 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH_ORDER* glyph)
{
CACHE_GLYPH_ORDER* dst = NULL;
CACHE_GLYPH_ORDER* dst = nullptr;
WINPR_ASSERT(context);
@@ -806,7 +806,7 @@ CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH
return dst;
fail:
free_cache_glyph_order(context, dst);
return NULL;
return nullptr;
}
void free_cache_glyph_order(WINPR_ATTR_UNUSED rdpContext* context, CACHE_GLYPH_ORDER* glyph)
@@ -825,7 +825,7 @@ void free_cache_glyph_order(WINPR_ATTR_UNUSED rdpContext* context, CACHE_GLYPH_O
CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context,
const CACHE_GLYPH_V2_ORDER* glyph)
{
CACHE_GLYPH_V2_ORDER* dst = NULL;
CACHE_GLYPH_V2_ORDER* dst = nullptr;
WINPR_ASSERT(context);
@@ -869,7 +869,7 @@ CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context,
return dst;
fail:
free_cache_glyph_v2_order(context, dst);
return NULL;
return nullptr;
}
void free_cache_glyph_v2_order(WINPR_ATTR_UNUSED rdpContext* context, CACHE_GLYPH_V2_ORDER* glyph)

View File

@@ -76,8 +76,8 @@ void nine_grid_cache_register_callbacks(rdpUpdate* update)
rdpNineGridCache* nine_grid_cache_new(rdpContext* context)
{
rdpNineGridCache* nine_grid = NULL;
rdpSettings* settings = NULL;
rdpNineGridCache* nine_grid = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(context);
@@ -86,7 +86,7 @@ rdpNineGridCache* nine_grid_cache_new(rdpContext* context)
nine_grid = (rdpNineGridCache*)calloc(1, sizeof(rdpNineGridCache));
if (!nine_grid)
return NULL;
return nullptr;
nine_grid->context = context;
@@ -110,14 +110,14 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
nine_grid_cache_free(nine_grid);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void nine_grid_cache_free(rdpNineGridCache* nine_grid)
{
if (nine_grid != NULL)
if (nine_grid != nullptr)
{
if (nine_grid->entries != NULL)
if (nine_grid->entries != nullptr)
{
for (size_t i = 0; i < nine_grid->maxEntries; i++)
free(nine_grid->entries[i].entry);

View File

@@ -105,14 +105,14 @@ static BOOL update_gdi_switch_surface(rdpContext* context,
if (switchSurface->bitmapId == SCREEN_BITMAP_SURFACE)
{
if (!bitmap->SetSurface(context, NULL, TRUE))
if (!bitmap->SetSurface(context, nullptr, TRUE))
return FALSE;
}
else
{
rdpBitmap* bmp = NULL;
rdpBitmap* bmp = nullptr;
bmp = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId);
if (bmp == NULL)
if (bmp == nullptr)
return FALSE;
if (!bitmap->SetSurface(context, bmp, FALSE))
@@ -125,14 +125,14 @@ static BOOL update_gdi_switch_surface(rdpContext* context,
rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreenCache, UINT32 index)
{
rdpBitmap* bitmap = NULL;
rdpBitmap* bitmap = nullptr;
WINPR_ASSERT(offscreenCache);
if (index >= offscreenCache->maxEntries)
{
WLog_ERR(TAG, "invalid offscreen bitmap index: 0x%08" PRIX32 "", index);
return NULL;
return nullptr;
}
bitmap = offscreenCache->entries[index];
@@ -140,7 +140,7 @@ rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreenCache, UINT32 index)
if (!bitmap)
{
WLog_ERR(TAG, "invalid offscreen bitmap at index: 0x%08" PRIX32 "", index);
return NULL;
return nullptr;
}
return bitmap;
@@ -172,21 +172,21 @@ void offscreen_cache_delete(rdpOffscreenCache* offscreenCache, UINT32 index)
rdpBitmap* prevBitmap = offscreenCache->entries[index];
if (prevBitmap != NULL)
if (prevBitmap != nullptr)
{
WINPR_ASSERT(offscreenCache->context);
/* Ensure that the bitmap is no longer used in GDI */
if (prevBitmap->SetSurface)
{
if (!prevBitmap->SetSurface(offscreenCache->context, NULL, FALSE))
if (!prevBitmap->SetSurface(offscreenCache->context, nullptr, FALSE))
WLog_WARN(TAG, "prevBitmap->SetSurface failed");
}
Bitmap_Free(offscreenCache->context, prevBitmap);
}
offscreenCache->entries[index] = NULL;
offscreenCache->entries[index] = nullptr;
}
void offscreen_cache_register_callbacks(rdpUpdate* update)
@@ -200,8 +200,8 @@ void offscreen_cache_register_callbacks(rdpUpdate* update)
rdpOffscreenCache* offscreen_cache_new(rdpContext* context)
{
rdpOffscreenCache* offscreenCache = NULL;
rdpSettings* settings = NULL;
rdpOffscreenCache* offscreenCache = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(context);
@@ -211,7 +211,7 @@ rdpOffscreenCache* offscreen_cache_new(rdpContext* context)
offscreenCache = (rdpOffscreenCache*)calloc(1, sizeof(rdpOffscreenCache));
if (!offscreenCache)
return NULL;
return nullptr;
offscreenCache->context = context;
offscreenCache->currentSurface = SCREEN_BITMAP_SURFACE;
@@ -233,7 +233,7 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
offscreen_cache_free(offscreenCache);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}
void offscreen_cache_free(rdpOffscreenCache* offscreenCache)

View File

@@ -35,7 +35,7 @@ static void palette_cache_put(rdpPaletteCache* palette, UINT32 index, void* entr
static BOOL update_gdi_cache_color_table(rdpContext* context,
const CACHE_COLOR_TABLE_ORDER* cacheColorTable)
{
UINT32* colorTable = NULL;
UINT32* colorTable = nullptr;
rdpCache* cache = context->cache;
colorTable = (UINT32*)malloc(sizeof(UINT32) * 256);
@@ -69,7 +69,7 @@ void palette_cache_register_callbacks(rdpUpdate* update)
rdpPaletteCache* palette_cache_new(rdpContext* context)
{
rdpPaletteCache* paletteCache = NULL;
rdpPaletteCache* paletteCache = nullptr;
WINPR_ASSERT(context);
@@ -117,5 +117,5 @@ fail:
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
free_palette_update(context, dst);
WINPR_PRAGMA_DIAG_POP
return NULL;
return nullptr;
}

View File

@@ -336,7 +336,7 @@ int persistent_cache_close(rdpPersistentCache* persistent)
if (persistent->fp)
{
(void)fclose(persistent->fp);
persistent->fp = NULL;
persistent->fp = nullptr;
}
return 1;
@@ -347,7 +347,7 @@ rdpPersistentCache* persistent_cache_new(void)
rdpPersistentCache* persistent = calloc(1, sizeof(rdpPersistentCache));
if (!persistent)
return NULL;
return nullptr;
persistent->bmpSize = 0x4000;
persistent->bmpData = calloc(1, persistent->bmpSize);
@@ -355,7 +355,7 @@ rdpPersistentCache* persistent_cache_new(void)
if (!persistent->bmpData)
{
free(persistent);
return NULL;
return nullptr;
}
return persistent;

View File

@@ -42,11 +42,11 @@ static void pointer_clear(rdpPointer* pointer)
{
pointer->lengthAndMask = 0;
free(pointer->andMaskData);
pointer->andMaskData = NULL;
pointer->andMaskData = nullptr;
pointer->lengthXorMask = 0;
free(pointer->xorMaskData);
pointer->xorMaskData = NULL;
pointer->xorMaskData = nullptr;
}
}
@@ -80,7 +80,7 @@ static BOOL update_pointer_position(rdpContext* context,
static BOOL update_pointer_system(rdpContext* context, const POINTER_SYSTEM_UPDATE* pointer_system)
{
rdpPointer* pointer = NULL;
rdpPointer* pointer = nullptr;
if (!context || !context->graphics || !context->graphics->Pointer_Prototype || !pointer_system)
return FALSE;
@@ -137,8 +137,8 @@ static BOOL upate_pointer_copy_andxor(rdpPointer* pointer, const BYTE* andMaskDa
static BOOL update_pointer_color(rdpContext* context, const POINTER_COLOR_UPDATE* pointer_color)
{
rdpPointer* pointer = NULL;
rdpCache* cache = NULL;
rdpPointer* pointer = nullptr;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(pointer_color);
@@ -148,7 +148,7 @@ static BOOL update_pointer_color(rdpContext* context, const POINTER_COLOR_UPDATE
pointer = Pointer_Alloc(context);
if (pointer == NULL)
if (pointer == nullptr)
return FALSE;
pointer->xorBpp = 24;
pointer->xPos = pointer_color->hotSpotX;
@@ -176,8 +176,8 @@ out_fail:
static BOOL update_pointer_large(rdpContext* context, const POINTER_LARGE_UPDATE* pointer_large)
{
rdpPointer* pointer = NULL;
rdpCache* cache = NULL;
rdpPointer* pointer = nullptr;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(pointer_large);
@@ -186,7 +186,7 @@ static BOOL update_pointer_large(rdpContext* context, const POINTER_LARGE_UPDATE
WINPR_ASSERT(cache);
pointer = Pointer_Alloc(context);
if (pointer == NULL)
if (pointer == nullptr)
return FALSE;
pointer->xorBpp = pointer_large->xorBpp;
pointer->xPos = pointer_large->hotSpotX;
@@ -248,8 +248,8 @@ out_fail:
static BOOL update_pointer_cached(rdpContext* context, const POINTER_CACHED_UPDATE* pointer_cached)
{
rdpPointer* pointer = NULL;
rdpCache* cache = NULL;
rdpPointer* pointer = nullptr;
rdpCache* cache = nullptr;
WINPR_ASSERT(context);
WINPR_ASSERT(pointer_cached);
@@ -259,7 +259,7 @@ static BOOL update_pointer_cached(rdpContext* context, const POINTER_CACHED_UPDA
pointer = pointer_cache_get(cache->pointer, pointer_cached->cacheIndex);
if (pointer != NULL)
if (pointer != nullptr)
return IFCALLRESULT(TRUE, pointer->Set, context, pointer);
return FALSE;
@@ -267,7 +267,7 @@ static BOOL update_pointer_cached(rdpContext* context, const POINTER_CACHED_UPDA
rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index)
{
rdpPointer* pointer = NULL;
rdpPointer* pointer = nullptr;
WINPR_ASSERT(pointer_cache);
@@ -275,7 +275,7 @@ rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index)
{
WLog_ERR(TAG, "invalid pointer index:%" PRIu32 " [%" PRIu32 "]", index,
pointer_cache->cacheSize);
return NULL;
return nullptr;
}
WINPR_ASSERT(pointer_cache->entries);
@@ -286,7 +286,7 @@ rdpPointer* pointer_cache_get(rdpPointerCache* pointer_cache, UINT32 index)
BOOL pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer* pointer,
BOOL colorCache)
{
rdpPointer* prevPointer = NULL;
rdpPointer* prevPointer = nullptr;
const FreeRDP_Settings_Keys_UInt32 id =
colorCache ? FreeRDP_ColorPointerCacheSize : FreeRDP_PointerCacheSize;
@@ -320,7 +320,7 @@ BOOL pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer*
void pointer_cache_register_callbacks(rdpUpdate* update)
{
rdpPointerUpdate* pointer = NULL;
rdpPointerUpdate* pointer = nullptr;
WINPR_ASSERT(update);
WINPR_ASSERT(update->context);
@@ -341,8 +341,8 @@ void pointer_cache_register_callbacks(rdpUpdate* update)
rdpPointerCache* pointer_cache_new(rdpContext* context)
{
rdpPointerCache* pointer_cache = NULL;
rdpSettings* settings = NULL;
rdpPointerCache* pointer_cache = nullptr;
rdpSettings* settings = nullptr;
WINPR_ASSERT(context);
@@ -352,7 +352,7 @@ rdpPointerCache* pointer_cache_new(rdpContext* context)
pointer_cache = (rdpPointerCache*)calloc(1, sizeof(rdpPointerCache));
if (!pointer_cache)
return NULL;
return nullptr;
pointer_cache->context = context;
@@ -367,7 +367,7 @@ rdpPointerCache* pointer_cache_new(rdpContext* context)
if (!pointer_cache->entries)
{
free(pointer_cache);
return NULL;
return nullptr;
}
return pointer_cache;
@@ -375,7 +375,7 @@ rdpPointerCache* pointer_cache_new(rdpContext* context)
void pointer_cache_free(rdpPointerCache* pointer_cache)
{
if (pointer_cache != NULL)
if (pointer_cache != nullptr)
{
if (pointer_cache->entries)
{
@@ -424,7 +424,7 @@ POINTER_COLOR_UPDATE* copy_pointer_color_update(rdpContext* context,
return dst;
fail:
free_pointer_color_update(context, dst);
return NULL;
return nullptr;
}
void free_pointer_color_update(rdpContext* context, POINTER_COLOR_UPDATE* pointer)
@@ -472,7 +472,7 @@ POINTER_LARGE_UPDATE* copy_pointer_large_update(rdpContext* context,
return dst;
fail:
free_pointer_large_update(context, dst);
return NULL;
return nullptr;
}
void free_pointer_large_update(rdpContext* context, POINTER_LARGE_UPDATE* pointer)
@@ -520,7 +520,7 @@ POINTER_NEW_UPDATE* copy_pointer_new_update(rdpContext* context, const POINTER_N
return dst;
fail:
free_pointer_new_update(context, dst);
return NULL;
return nullptr;
}
void free_pointer_new_update(WINPR_ATTR_UNUSED rdpContext* context, POINTER_NEW_UPDATE* pointer)
@@ -545,7 +545,7 @@ POINTER_CACHED_UPDATE* copy_pointer_cached_update(rdpContext* context,
return dst;
fail:
free_pointer_cached_update(context, dst);
return NULL;
return nullptr;
}
void free_pointer_cached_update(rdpContext* context, POINTER_CACHED_UPDATE* pointer)
@@ -572,7 +572,7 @@ POINTER_POSITION_UPDATE* copy_pointer_position_update(rdpContext* context,
return dst;
fail:
free_pointer_position_update(context, dst);
return NULL;
return nullptr;
}
void free_pointer_system_update(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer)
@@ -593,5 +593,5 @@ POINTER_SYSTEM_UPDATE* copy_pointer_system_update(rdpContext* context,
return dst;
fail:
free_pointer_system_update(context, dst);
return NULL;
return nullptr;
}