diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3b1b025cb6..fef069c093 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +20000502-09:30 GMT+1 Victor Szakats + + * utils/hbtest/rt_hvma.prg + + Added some tests for the new compile-time generated double widths. + + * source/vm/hvm.c + % Some optimization for hb_vmCalcDoubleWidth() + + * source/rdd/dbfcdx/dbfcdx1.c + ! Fixed two -O2 GCC warnings. + 2000-05-02 01:45 GMT-4 David G. Holm * include/hbapigt.h @@ -122,7 +133,7 @@ This is used for codeblocks which have no parameters, use no locals, and the total size is smaller than 255 bytes. The majority of codeblocks falls into this category. - HB_TEST is now 15K smaller. + HBTEST is now 15K smaller. ! WARNING ! All .PRGs must be recompiled after the changes of today. diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index 4110e94c9f..03ffd6c906 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -531,6 +531,7 @@ static int hb_cdxKeyCompare( LPKEYINFO pKey1, LPKEYINFO pKey2, USHORT * EndPos, return 1; if( pKey1 == NULL || pKey1->pItem->item.asString.length == 0 ) return ( pKey2->pItem->item.asString.length == 0 ) ? 0: -1; + switch( hb_itemType( pKey1->pItem ) ) { case HB_IT_STRING: @@ -544,6 +545,7 @@ static int hb_cdxKeyCompare( LPKEYINFO pKey1, LPKEYINFO pKey2, USHORT * EndPos, pKey2->pItem->item.asString.value[ * EndPos ]; * EndPos += 1; } while( iResult == 0 && * EndPos < iLimit ); + if( iResult == 0 ) { * EndPos += 1; @@ -555,8 +557,10 @@ static int hb_cdxKeyCompare( LPKEYINFO pKey1, LPKEYINFO pKey2, USHORT * EndPos, break; default: + iResult = 0; printf( "hb_cdxKeyCompare()" ); } + if( iResult < 0 ) return -1; else if( iResult > 0 ) @@ -2766,6 +2770,7 @@ static ERRCODE cdxOrderCreate( AREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) uiType = hb_itemType( pResult ); uiLen = 0; + switch( uiType ) { case HB_IT_INTEGER: @@ -2790,6 +2795,9 @@ static ERRCODE cdxOrderCreate( AREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) uiLen = pResult->item.asString.length > CDX_MAX_KEY ? CDX_MAX_KEY : pResult->item.asString.length; break; + + default: + bType = '\0'; } hb_itemRelease( pResult ); diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 5e704616e7..61e3dc907e 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -3097,16 +3097,13 @@ void hb_vmPushDouble( double dNumber, int iDec ) static int hb_vmCalcDoubleWidth( double dNumber, int iDec ) { char buffer[ 260 ]; - int iLength; sprintf( buffer, "%.*f", 0, dNumber ); - iLength = strlen( buffer ); - if( iDec == 0 ) - iLength++; - - return iLength; + return strlen( buffer ) + 1; + else + return strlen( buffer ); } static void hb_vmPushDoubleConst( double dNumber, int iWidth, int iDec ) diff --git a/harbour/utils/hbtest/rt_hvma.prg b/harbour/utils/hbtest/rt_hvma.prg index e36f4d30c1..e84457c32d 100644 --- a/harbour/utils/hbtest/rt_hvma.prg +++ b/harbour/utils/hbtest/rt_hvma.prg @@ -471,6 +471,8 @@ FUNCTION Main_HVMA() TEST_LINE( RTSTR( 1000000000.00 ) , " 13 1000000000.00" ) TEST_LINE( RTSTR( 1000000000.99 ) , " 13 1000000000.99" ) TEST_LINE( RTSTR( 4000000000 ) , " 11 4000000000" ) + TEST_LINE( RTSTR( 00005 ) , " 10 5" ) + TEST_LINE( RTSTR( 00005.5 ) , " 12 5.5" ) TEST_LINE( RTSTR( 5000000000 ) , " 11 5000000000" ) TEST_LINE( RTSTR( 50000000000 ) , " 12 50000000000" ) TEST_LINE( RTSTR( 500000000000 ) , " 13 500000000000" ) @@ -478,6 +480,10 @@ FUNCTION Main_HVMA() TEST_LINE( RTSTR( 5000000000000 ) , " 14 5000000000000" ) TEST_LINE( RTSTR( 50000000000000 ) , " 15 50000000000000" ) TEST_LINE( RTSTR( 500000000000000 ) , " 16 500000000000000" ) + TEST_LINE( RTSTR( 00000000000005 ) , " 10 5" ) + TEST_LINE( RTSTR( 00000500000000000000 ) , " 21 500000000000000" ) + TEST_LINE( RTSTR( 0500000000000000 ) , " 17 500000000000000" ) + TEST_LINE( RTSTR( 0500000000000000.5 ) , " 18 500000000000000.5" ) TEST_LINE( RTSTR( 5000000000000000 ) , " 17 5000000000000000" ) TEST_LINE( RTSTR( 50000000000000000 ) , " 18 50000000000000000" ) TEST_LINE( RTSTR( 500000000000000000 ) , " 19 500000000000000000" )