Skip to content

Commit

Permalink
fix -Wdeprecated-non-prototype in hsort()
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed May 2, 2024
1 parent 9e328fb commit e7eebf6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
7 changes: 5 additions & 2 deletions rott/rt_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions rott/rt_ted.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions rott/rt_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rott/rt_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e7eebf6

Please sign in to comment.