From 6515373b2a63a24b77ff20a26e9b18468f29a6f9 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sun, 2 Feb 2014 12:59:36 +0100 Subject: [PATCH] removing casts of gfxAlloc() return value as that is the whole idea behind having a void pointer --- demos/3rdparty/doom/i_system.c | 4 ++-- demos/modules/gadc/gwinosc.c | 4 ++-- drivers/gaudin/Win32/gaudin_lld.c | 2 +- drivers/multiple/Win32/gdisp_lld_Win32.c | 2 +- drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c | 2 +- src/gos/raw32.c | 2 +- src/gwin/console.c | 2 +- src/gwin/gwidget.c | 2 +- src/gwin/gwin.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/demos/3rdparty/doom/i_system.c b/demos/3rdparty/doom/i_system.c index 094144f6..aa1d7481 100644 --- a/demos/3rdparty/doom/i_system.c +++ b/demos/3rdparty/doom/i_system.c @@ -66,7 +66,7 @@ int I_GetHeapSize (void) byte* I_ZoneBase (int* size) { *size = mb_used*1024*1024; - return (byte *) gfxAlloc (*size); + return gfxAlloc (*size); } @@ -124,7 +124,7 @@ byte* I_Malloc(int length) { byte* mem; - mem = (byte *)gfxAlloc (length); + mem = gfxAlloc (length); memset (mem,0,length); return mem; } diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index b7201088..4cc1fc3a 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -70,9 +70,9 @@ GHandle gwinGScopeCreate(GDisplay *g, GScopeObject *gs, GWindowInit *pInit, uint return 0; gfxSemInit(&gs->bsem, 0, 1); gs->nextx = 0; - if (!(gs->lastscopetrace = (coord_t *)gfxAlloc(gs->g.width * sizeof(coord_t)))) + if (!(gs->lastscopetrace = gfxAlloc(gs->g.width * sizeof(coord_t)))) return 0; - if (!(gs->audiobuf = (adcsample_t *)gfxAlloc(AUDIOBUFSZ * sizeof(adcsample_t)))) + if (!(gs->audiobuf = gfxAlloc(AUDIOBUFSZ * sizeof(adcsample_t)))) return 0; #if TRIGGER_METHOD == TRIGGER_POSITIVERAMP gs->lasty = gs->g.height/2; diff --git a/drivers/gaudin/Win32/gaudin_lld.c b/drivers/gaudin/Win32/gaudin_lld.c index 665c89f7..dce4cad3 100644 --- a/drivers/gaudin/Win32/gaudin_lld.c +++ b/drivers/gaudin/Win32/gaudin_lld.c @@ -139,7 +139,7 @@ void gaudin_lld_init(const gaudin_params *paud) { /* We need to allocate a wave header for each buffer */ nBuffers = (paud->bufcount + paud->samplesPerEvent - 1) / paud->samplesPerEvent; - if (!(pWaveHdrs = (WAVEHDR *)gfxAlloc(nBuffers * sizeof(WAVEHDR)))) { + if (!(pWaveHdrs = gfxAlloc(nBuffers * sizeof(WAVEHDR)))) { fprintf(stderr, "GAUDIN: Buffer header allocation failed\n"); return; } diff --git a/drivers/multiple/Win32/gdisp_lld_Win32.c b/drivers/multiple/Win32/gdisp_lld_Win32.c index 2910e9eb..9425bd36 100644 --- a/drivers/multiple/Win32/gdisp_lld_Win32.c +++ b/drivers/multiple/Win32/gdisp_lld_Win32.c @@ -458,7 +458,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif // Create a private area for this window - priv = (winPriv *)gfxAlloc(sizeof(winPriv)); + priv = gfxAlloc(sizeof(winPriv)); assert(priv != 0); memset(priv, 0, sizeof(winPriv)); g->priv = priv; diff --git a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c index 6f75b512..787062f6 100644 --- a/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c +++ b/drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c @@ -433,7 +433,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif // Create a private area for this window - if (!(priv = (netPriv *)gfxAlloc(sizeof(netPriv)))) + if (!(priv = gfxAlloc(sizeof(netPriv)))) gfxHalt("GDISP: uGFXnet - Memory allocation failed"); memset(priv, 0, sizeof(netPriv)); g->priv = priv; diff --git a/src/gos/raw32.c b/src/gos/raw32.c index 5a65ea86..5e11064c 100644 --- a/src/gos/raw32.c +++ b/src/gos/raw32.c @@ -542,7 +542,7 @@ static void _gosThreadsInit(void) { char * framebase; // Allocate a buffer to store our test data - pframeinfo = (saveloc *)gfxAlloc(sizeof(saveloc)*2); + pframeinfo = gfxAlloc(sizeof(saveloc)*2); // Get details of the stack frame from within a function get_stack_state_in_fn(); diff --git a/src/gwin/console.c b/src/gwin/console.c index ef374220..623404be 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -285,7 +285,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p gcw->bufsize *= gh->height / gdispGetFontMetric(gh->font, fontHeight); // Allocate the buffer - if (!(gcw->buffer = (char*)gfxAlloc(gcw->bufsize))) + if (!(gcw->buffer = gfxAlloc(gcw->bufsize))) return FALSE; // All good! diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index db9dc9fa..484b8c37 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -338,7 +338,7 @@ void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) { else if (useAlloc) { char *str; - if ((str = (char *)gfxAlloc(strlen(text)+1))) { + if ((str = gfxAlloc(strlen(text)+1))) { gh->flags |= GWIN_FLG_ALLOCTXT; strcpy(str, text); } diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 6b9cb81e..11dcdaf1 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -102,7 +102,7 @@ void _gwinInit(void) { GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) { // Allocate the structure if necessary if (!pgw) { - if (!(pgw = (GWindowObject *)gfxAlloc(vmt->size))) + if (!(pgw = gfxAlloc(vmt->size))) return 0; pgw->flags = flags|GWIN_FLG_DYNAMIC; } else