From e7f9a7ea3342e6b69f213cd5b426aa9d80a13d4a Mon Sep 17 00:00:00 2001 From: Eddie Runia Date: Thu, 3 Jun 1999 15:03:47 +0000 Subject: [PATCH] see changelog --- harbour/ChangeLog | 4 ++++ harbour/source/rtl/classes.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6ea33068e1..d1c85b19e7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +19990603-16:00 CET Eddie Runia + * source/rtl/classes.c + wLimit bug resolved + 19990603-15:25 CET Eddie Runia * source/compiler/harbour.y ()[] syntax added diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 614a2836b5..ead63f53ba 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -367,7 +367,7 @@ HARBOUR CLASSADD() /* hClass, cMessage, pFunction, nType, xInit */ pMessage = GetDynSym( _parc( 2 ) ); wAt = ( ( ( unsigned ) pMessage ) % pClass->wHashKey ) * BUCKET; wMask = pClass->wHashKey * BUCKET; - wLimit = ( wAt - 1 ) % wMask; + wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 ); if( pClass->wMethods > ( pClass->wHashKey * BUCKET * 2/3 ) ) DictRealloc( pClass ); @@ -375,7 +375,7 @@ HARBOUR CLASSADD() /* hClass, cMessage, pFunction, nType, xInit */ while( ( wAt != wLimit ) && pClass->pMethods[ wAt ].pMessage && ( pClass->pMethods[ wAt ].pMessage != pMessage ) ) - wAt = ( wAt + 1 ) % wMask; + wAt = ( wAt == wMask ) ? 0 : wAt + 1; if( wAt != wLimit ) { @@ -508,7 +508,7 @@ HARBOURFUNC GetMethod( PITEM pObject, PSYMBOL pMessage ) pClass = &pClasses[ wClass - 1 ]; wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET; wMask = pClass->wHashKey * BUCKET; - wLimit = ( wAt - 1 ) % wMask; + wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 ); pMethod = 0; @@ -519,7 +519,7 @@ HARBOURFUNC GetMethod( PITEM pObject, PSYMBOL pMessage ) pMethod = &pClass->pMethods[ wAt ]; return pClass->pMethods[ wAt ].pFunction; } - wAt = ( wAt + 1 ) % wMask; + wAt = ( wAt == wMask ) ? 0 : wAt + 1; } } @@ -669,12 +669,12 @@ HARBOUR CLASSMOD() /* Modify message (only for INLINE and METHOD) */ pClass = pClasses + wClass - 1; wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET; wMask = pClass->wHashKey * BUCKET; - wLimit = ( wAt - 1 ) % wMask; + wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 ); while( ( wAt != wLimit ) && ( pClass->pMethods[ wAt ].pMessage && ( pClass->pMethods[ wAt ].pMessage != pMsg ) ) ) - wAt = ( wAt + 1 ) % wMask; + wAt = ( wAt == wMask ) ? 0 : wAt + 1; if( wAt != wLimit ) { /* Requested method found */ @@ -722,7 +722,7 @@ HARBOUR CLASSDEL() /* Delete message (only for INLINE and METHOD) */ while( ( wAt != wLimit ) && ( pClass->pMethods[ wAt ].pMessage && ( pClass->pMethods[ wAt ].pMessage != pMsg ) ) ) - wAt = ( wAt + 1 ) % wMask; + wAt = ( wAt == wMask ) ? 0 : wAt + 1; if( wAt != wLimit ) { /* Requested method found */