diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9497bafb28..bea597fbf9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-18 12:45 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/itemapi.c + ! fixed wrong exact condition hb_itemStrICmp() + % small optimization in hb_itemStr[I]Cmp() functions + 2009-02-18 12:20 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbextern.ch * common.mak diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index aae7bbb299..5812756172 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -1954,7 +1954,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) ulLenFirst = pFirst->item.asString.length; ulLenSecond = pSecond->item.asString.length; - if( hb_stackSetStruct()->HB_SET_EXACT && !bForceExact ) + if( !bForceExact && hb_stackSetStruct()->HB_SET_EXACT ) { /* SET EXACT ON and not using == */ /* Don't include trailing spaces */ @@ -1962,6 +1962,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) ulLenFirst--; while( ulLenSecond > ulLenFirst && szSecond[ ulLenSecond - 1 ] == ' ' ) ulLenSecond--; + bForceExact = TRUE; } ulMinLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; @@ -1973,7 +1974,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) PHB_CODEPAGE cdp = hb_vmCDP(); if( cdp && cdp->lSort ) iRet = hb_cdpcmp( szFirst, ulLenFirst, szSecond, ulLenSecond, - cdp, bForceExact || hb_stackSetStruct()->HB_SET_EXACT ); + cdp, bForceExact ); else #endif { @@ -1993,8 +1994,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) if( !iRet && ulLenFirst != ulLenSecond ) { /* Force an exact comparison? */ - if( bForceExact || ulLenSecond > ulLenFirst || - hb_stackSetStruct()->HB_SET_EXACT ) + if( bForceExact || ulLenSecond > ulLenFirst ) iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1; } } @@ -2004,7 +2004,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) /* Both empty ? */ if( ulLenFirst != ulLenSecond ) { - if( bForceExact || hb_stackSetStruct()->HB_SET_EXACT ) + if( bForceExact ) iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1; else iRet = ( ulLenSecond == 0 ) ? 0 : -1; @@ -2034,7 +2034,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) ulLenFirst = pFirst->item.asString.length; ulLenSecond = pSecond->item.asString.length; - if( !bForceExact || hb_stackSetStruct()->HB_SET_EXACT ) + if( !bForceExact && hb_stackSetStruct()->HB_SET_EXACT ) { /* SET EXACT ON and not using == */ /* Don't include trailing spaces */ @@ -2042,6 +2042,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) ulLenFirst--; while( ulLenSecond > ulLenFirst && szSecond[ ulLenSecond - 1 ] == ' ' ) ulLenSecond--; + bForceExact = TRUE; } ulMinLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond; @@ -2053,7 +2054,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) PHB_CODEPAGE cdp = hb_vmCDP(); if( cdp && cdp->lSort ) iRet = hb_cdpicmp( szFirst, ulLenFirst, szSecond, ulLenSecond, - cdp, bForceExact || hb_stackSetStruct()->HB_SET_EXACT ); + cdp, bForceExact ); else #endif { @@ -2075,8 +2076,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) if( !iRet && ulLenFirst != ulLenSecond ) { /* Force an exact comparison? */ - if( bForceExact || ulLenSecond > ulLenFirst || - hb_stackSetStruct()->HB_SET_EXACT ) + if( bForceExact || ulLenSecond > ulLenFirst ) iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1; } } @@ -2086,7 +2086,7 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) /* Both empty ? */ if( ulLenFirst != ulLenSecond ) { - if( bForceExact || hb_stackSetStruct()->HB_SET_EXACT ) + if( bForceExact ) iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1; else iRet = ( ulLenSecond == 0 ) ? 0 : -1;