diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2ad7adcaf5..7f8d8c47ed 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-05-06 10:45 UTC+0300 Alexander Kresin + * include/hbapicdp.h + * source/rtl/cdpapi.c + * source/vm/itemapi.c + * source/rdd/dbfntx/dbfntx1.c + ! Some fix, regarding strings comparison via CODEPAGE API + 2003-05-01 21:19 UTC+0100 Antonio Linares + source/codepage/cdpesdos.c + source/codepage/cdpeswin.c diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index f76ff0abcf..fb4ae3fa21 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -98,7 +98,7 @@ extern PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE ); extern PHB_CODEPAGE hb_cdpFind( char * ); extern void hb_cdpTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE ); extern void hb_cdpnTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE, unsigned int ); -extern int hb_cdpcmp( char*, char*, int, PHB_CODEPAGE ); +extern int hb_cdpcmp( char*, char*, ULONG, PHB_CODEPAGE, ULONG* ); #endif /* HB_APICDP_H_ */ diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index bc0da88806..596a201be3 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -1169,7 +1169,7 @@ static int hb_ntxItemCompare( char* s1, char* s2, int ilen1, int ilen2, BOOL Exa return -1; iLimit = ( ilen1 > ilen2 ) ? ilen2 : ilen1; - iResult = (cdpage->lSort)? hb_cdpcmp( s1, s2, iLimit, cdpage ):memcmp( s1, s2, iLimit ); + iResult = (cdpage->lSort)? hb_cdpcmp( s1, s2, (ULONG)iLimit, cdpage, NULL ):memcmp( s1, s2, iLimit ); if( !iResult ) { if( ( iResult = ilen1 - ilen2 ) != 0 ) @@ -1940,7 +1940,7 @@ static void hb_ntxKeysSort( LPNTXSORTINFO pSortInfo, LPSORTITEM* pKeyFirst, LPSO else if( pSortInfo->pKey1 ) { result = (s_cdpage->lSort)? - hb_cdpcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength, s_cdpage ):memcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength ); + hb_cdpcmp( pKeyNew->key, pSortInfo->pKey1->key, (ULONG)KeyLength, s_cdpage, NULL ):memcmp( pKeyNew->key, pSortInfo->pKey1->key, KeyLength ); if( fDescend && result ) result = ( result > 0 )? -1:1; if( result >= 0 ) @@ -1965,7 +1965,7 @@ static void hb_ntxKeysSort( LPNTXSORTINFO pSortInfo, LPSORTITEM* pKeyFirst, LPSO while( pKey ) { result = (s_cdpage->lSort)? - hb_cdpcmp( pKeyNew->key, pKey->key, KeyLength, s_cdpage ):memcmp( pKeyNew->key, pKey->key, KeyLength ); + hb_cdpcmp( pKeyNew->key, pKey->key, (ULONG)KeyLength, s_cdpage, NULL ):memcmp( pKeyNew->key, pKey->key, KeyLength ); if( fDescend && result ) result = ( result > 0 )? -1:1; if( result < 0 ) diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index 968dedede8..ddf99f89e4 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -295,12 +295,13 @@ void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsig } } -int hb_cdpcmp( char* szFirst, char* szSecond, int iLen, PHB_CODEPAGE cdpage ) +int hb_cdpcmp( char* szFirst, char* szSecond, ULONG ulLen, PHB_CODEPAGE cdpage, ULONG* piCounter ) { - int i, iRet = 0, n1, n2; + ULONG ul; + int iRet = 0, n1, n2; int lAcc1 = 0, lAcc2 = 0; /* printf( "\nhb_cdpcmp-0 %s %s",szFirst,szSecond ); */ - for( i=0; is_chars[ ((int)*szFirst)&255 ] ) == 0 || @@ -311,7 +312,7 @@ int hb_cdpcmp( char* szFirst, char* szSecond, int iLen, PHB_CODEPAGE cdpage ) /* printf( "\n|%c|%c|%d %d %d",*szFirst,*szSecond,((int)*szFirst)&255,((int)*szSecond)&255,iRet ); */ break; } - if( cdpage->nMulti && i ) + if( cdpage->nMulti && ul ) { int j, nd1 = 0, nd2 = 0; PHB_MULTICHAR pmulti = cdpage->multi; @@ -369,6 +370,8 @@ int hb_cdpcmp( char* szFirst, char* szSecond, int iLen, PHB_CODEPAGE cdpage ) } /* printf( " : %d",iRet ); */ + if( piCounter ) + *piCounter = ul; if( !iRet && lAcc1 ) return 1; else if( !iRet && lAcc2 ) diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index a8c7aeff79..3de677cc92 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -1061,7 +1061,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) if( ulMinLen ) { if( s_cdpage->lSort ) - iRet = hb_cdpcmp( szFirst,szSecond,ulMinLen,s_cdpage ); + iRet = hb_cdpcmp( szFirst,szSecond,ulMinLen,s_cdpage, &ulCounter ); else for( ulCounter = 0; ulCounter < ulMinLen && !iRet; ulCounter++ ) {