From e7eebf6b026707e98e2d8bc1e64c69fd873def17 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Thu, 2 May 2024 21:31:51 +0200 Subject: [PATCH] fix -Wdeprecated-non-prototype in hsort() --- rott/rt_draw.c | 7 +++++-- rott/rt_ted.c | 6 ++++-- rott/rt_util.c | 8 ++++---- rott/rt_util.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/rott/rt_draw.c b/rott/rt_draw.c index 0da7a99..f8038c0 100644 --- a/rott/rt_draw.c +++ b/rott/rt_draw.c @@ -751,14 +751,17 @@ int CalcRotate (objtype *ob) #define SGN(x) ((x>0) ? (1) : ((x==0) ? (0) : (-1))) /*--------------------------------------------------------------------------*/ -int CompareHeights(visobj_t **s1p, visobj_t **s2p) +int CompareHeights(void *v1p, void *v2p) { + visobj_t **s1p = (visobj_t **) v1p, **s2p = (visobj_t **) v2p; + whereami=3; return SGN((*s1p)->viewheight-(*s2p)->viewheight); } -void SwitchPointers(visobj_t **s1p, visobj_t **s2p) +void SwitchPointers(void *v1p, void *v2p) { + visobj_t **s1p = (visobj_t **) v1p, **s2p = (visobj_t **) v2p; visobj_t * temp; whereami=4; diff --git a/rott/rt_ted.c b/rott/rt_ted.c index 5bef04c..d12cbba 100644 --- a/rott/rt_ted.c +++ b/rott/rt_ted.c @@ -179,13 +179,15 @@ int GetLumpForTile(int tile); #define SGN(x) ((x>0) ? (1) : ((x==0) ? (0) : (-1))) /*--------------------------------------------------------------------------*/ -int CompareTags(cachetype *s1p, cachetype *s2p) +int CompareTags(void *v1p, void *v2p) { + cachetype *s1p = (cachetype *) v1p, *s2p = (cachetype *) v2p; return SGN(s1p->lump-s2p->lump); } -void SwitchCacheEntries(cachetype *s1p, cachetype *s2p) +void SwitchCacheEntries(void *v1p, void *v2p) { + cachetype *s1p = (cachetype *) v1p, *s2p = (cachetype *) v2p; cachetype temp; temp=*s1p; diff --git a/rott/rt_util.c b/rott/rt_util.c index 04ba739..831c7d4 100644 --- a/rott/rt_util.c +++ b/rott/rt_util.c @@ -1201,15 +1201,15 @@ int SideOfLine(int x1, int y1, int x2, int y2, int x3, int y3) // //****************************************************************************** -typedef int (*PFI)(); /* pointer to a function returning int */ -typedef void (*PFV)(); /* pointer to a function returning int */ +typedef int (*PFI)(void *, void*); /* pointer to a function returning int */ +typedef void (*PFV)(void *, void*); /* pointer to a function returning int */ static PFI Comp; /* pointer to comparison routine */ static PFV Switch; /* pointer to comparison routine */ static int Width; /* width of an object in bytes */ static char *Base; /* pointer to element [-1] of array */ -static void newsift_down(L,U) int L,U; +static void newsift_down(int L, int U) { int c; while(1) @@ -1222,7 +1222,7 @@ static void newsift_down(L,U) int L,U; } } -void hsort(char * base, int nel, int width, int (*compare)(), void (*switcher)()) +void hsort(char * base, int nel, int width, int (*compare)(void *, void*), void (*switcher)(void *, void*)) { static int i,n,stop; /* Perform a heap sort on an array starting at base. The array is diff --git a/rott/rt_util.h b/rott/rt_util.h index d3b4988..3bf8163 100644 --- a/rott/rt_util.h +++ b/rott/rt_util.h @@ -94,7 +94,7 @@ void UL_DisplayMemoryError ( int memneeded ); int SideOfLine(int x1, int y1, int x2, int y2, int x3, int y3); -void hsort(char * base, int nel, int width, int (*compare)(), void (*switcher)()); +void hsort(char * base, int nel, int width, int (*compare)(void *, void*), void (*switcher)(void *, void*)); char * UL_GetPath (char * path, char *dir); boolean UL_ChangeDirectory (char *path);