2003-05-06 10:45 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>

This commit is contained in:
Alexander S.Kresin
2003-05-06 06:40:36 +00:00
parent 947dc925d1
commit cf2440c957
5 changed files with 19 additions and 9 deletions

View File

@@ -8,6 +8,13 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2003-05-06 10:45 UTC+0300 Alexander Kresin <alex@belacy.belgorod.su>
* 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 <alinares@fivetechsoft.com>
+ source/codepage/cdpesdos.c
+ source/codepage/cdpeswin.c

View File

@@ -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_ */

View File

@@ -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 )

View File

@@ -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; i<iLen; i++,szFirst++,szSecond++ )
for( ul=0; ul<ulLen; ul++,szFirst++,szSecond++ )
if( *szFirst != *szSecond )
{
if( ( n1 = (int)cdpage->s_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 )

View File

@@ -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++ )
{