diff options
-rw-r--r-- | source3/ubiqx/ubi_BinTree.c | 23 | ||||
-rw-r--r-- | source3/ubiqx/ubi_BinTree.h | 8 |
2 files changed, 21 insertions, 10 deletions
diff --git a/source3/ubiqx/ubi_BinTree.c b/source3/ubiqx/ubi_BinTree.c index c0f527e2d7..ed565bbfba 100644 --- a/source3/ubiqx/ubi_BinTree.c +++ b/source3/ubiqx/ubi_BinTree.c @@ -27,6 +27,11 @@ * -------------------------------------------------------------------------- ** * * Log: ubi_BinTree.c,v + * Revision 4.1 1998/03/31 06:11:57 crh + * Thomas Aglassinger sent E'mail pointing out errors in the + * dereferencing of function pointers, and a missing typecast. + * Thanks, Thomas! + * * Revision 4.0 1998/03/10 03:19:22 crh * Added the AVL field 'balance' to the ubi_btNode structure. This means * that all BinTree modules now use the same basic node structure, which @@ -125,8 +130,8 @@ */ static char ModuleID[] = "ubi_BinTree\n\ -\tRevision: 4.0\n\ -\tDate: 1998/03/10 03:19:22\n\ +\tRevision: 4.1\n\ +\tDate: 1998/03/31 06:11:57\n\ \tAuthor: crh\n"; /* ========================================================================== ** @@ -198,16 +203,16 @@ static ubi_btNodePtr TreeFind( ubi_btItemPtr findme, * ------------------------------------------------------------------------ ** */ { - register ubi_btNodePtr tmp_p = p; - ubi_btNodePtr tmp_pp = NULL; - int tmp_gender = ubi_trEQUAL; - int tmp_cmp; + register ubi_btNodePtr tmp_p = p; + ubi_btNodePtr tmp_pp = NULL; + signed char tmp_gender = ubi_trEQUAL; + int tmp_cmp; while( tmp_p && (ubi_trEQUAL != (tmp_cmp = ubi_trAbNormal((*CmpFunc)(findme, tmp_p)))) ) { tmp_pp = tmp_p; /* Keep track of previous node. */ - tmp_gender = tmp_cmp; /* Keep track of sex of child. */ + tmp_gender = (signed char)tmp_cmp; /* Keep track of sex of child. */ tmp_p = tmp_p->Link[tmp_cmp]; /* Go to child. */ } *parentp = tmp_pp; /* Return results. */ @@ -926,7 +931,7 @@ ubi_trBool ubi_btTraverse( ubi_btRootPtr RootPtr, while( p ) { - EachNode( p, UserData ); + (*EachNode)( p, UserData ); p = ubi_btNext( p ); } return( ubi_trTRUE ); @@ -964,7 +969,7 @@ ubi_trBool ubi_btKillTree( ubi_btRootPtr RootPtr, p = q->Link[ubi_trPARENT]; if( p ) p->Link[ ((p->Link[ubi_trLEFT] == q)?ubi_trLEFT:ubi_trRIGHT) ] = NULL; - FreeNode((void *)q); + (*FreeNode)((void *)q); } (void)ubi_btInitTree( RootPtr, diff --git a/source3/ubiqx/ubi_BinTree.h b/source3/ubiqx/ubi_BinTree.h index f3c49c95e1..8a99f28045 100644 --- a/source3/ubiqx/ubi_BinTree.h +++ b/source3/ubiqx/ubi_BinTree.h @@ -29,6 +29,11 @@ * -------------------------------------------------------------------------- ** * * Log: ubi_BinTree.h,v + * Revision 4.1 1998/03/31 06:13:47 crh + * Thomas Aglassinger sent E'mail pointing out errors in the + * dereferencing of function pointers, and a missing typecast. + * Thanks, Thomas! + * * Revision 4.0 1998/03/10 03:16:04 crh * Added the AVL field 'balance' to the ubi_btNode structure. This means * that all BinTree modules now use the same basic node structure, which @@ -193,7 +198,8 @@ typedef enum { * -------------------------------------------------------------------------- ** */ #define ubi_trNormalize(W) ((char)( (W) - ubi_trEQUAL )) -#define ubi_trAbNormal(W) ((char)( ((char)ubi_btSgn( W )) + ubi_trEQUAL )) +#define ubi_trAbNormal(W) ((char)( ((char)ubi_btSgn( (long)(W) )) \ + + ubi_trEQUAL )) #define ubi_trRevWay(W) ((char)( ubi_trEQUAL - ((W) - ubi_trEQUAL) )) /* -------------------------------------------------------------------------- ** |