From 8ae2d0e27fe8047ee6620b96cb680a8b91bc658f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 19 Nov 2010 11:39:20 +0000 Subject: [PATCH] 2010-11-19 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbdefs.h * harbour/src/rdd/dbfntx/dbfntx1.c * harbour/src/rdd/dbfnsx/dbfnsx1.c * harbour/src/rdd/dbfcdx/dbfcdx1.c * harbour/src/rdd/dbffpt/dbffpt1.c * harbour/contrib/hbct/token2.c * harbour/contrib/hbct/charsort.c * harbour/contrib/hbct/charop.c * harbour/contrib/hbct/pos1.c * harbour/contrib/hbct/token1.c * harbour/contrib/hbct/pack.c * harbour/contrib/hbct/range.c * harbour/contrib/sddmy/sddmy.c * harbour/contrib/xhb/hbcrypt.c * harbour/contrib/xhb/xhbsave.c * harbour/contrib/xhb/txtline.c * harbour/contrib/xhb/cstructc.c * harbour/contrib/hbmzip/hbmzip.c * harbour/contrib/sddsqlt3/sddsqlt3.c * cleaned const pointer casting --- harbour/ChangeLog | 22 ++++++++++++ harbour/contrib/hbct/charop.c | 2 +- harbour/contrib/hbct/charsort.c | 8 ++--- harbour/contrib/hbct/pack.c | 4 +-- harbour/contrib/hbct/pos1.c | 6 ++-- harbour/contrib/hbct/range.c | 18 +++++----- harbour/contrib/hbct/token1.c | 2 +- harbour/contrib/hbct/token2.c | 2 +- harbour/contrib/hbmzip/hbmzip.c | 4 +-- harbour/contrib/sddmy/sddmy.c | 4 +-- harbour/contrib/sddsqlt3/sddsqlt3.c | 2 +- harbour/contrib/xhb/cstructc.c | 2 +- harbour/contrib/xhb/hbcrypt.c | 8 ++--- harbour/contrib/xhb/txtline.c | 12 +++---- harbour/contrib/xhb/xhbsave.c | 2 +- harbour/include/hbdefs.h | 36 ++++++++++---------- harbour/src/rdd/dbfcdx/dbfcdx1.c | 49 ++++++++++++++------------- harbour/src/rdd/dbffpt/dbffpt1.c | 52 +++++++++++++++-------------- harbour/src/rdd/dbfnsx/dbfnsx1.c | 9 ++--- harbour/src/rdd/dbfntx/dbfntx1.c | 10 +++--- 20 files changed, 140 insertions(+), 114 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b4a1e05cd8..fe74ba39d9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-19 12:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbdefs.h + * harbour/src/rdd/dbfntx/dbfntx1.c + * harbour/src/rdd/dbfnsx/dbfnsx1.c + * harbour/src/rdd/dbfcdx/dbfcdx1.c + * harbour/src/rdd/dbffpt/dbffpt1.c + * harbour/contrib/hbct/token2.c + * harbour/contrib/hbct/charsort.c + * harbour/contrib/hbct/charop.c + * harbour/contrib/hbct/pos1.c + * harbour/contrib/hbct/token1.c + * harbour/contrib/hbct/pack.c + * harbour/contrib/hbct/range.c + * harbour/contrib/sddmy/sddmy.c + * harbour/contrib/xhb/hbcrypt.c + * harbour/contrib/xhb/xhbsave.c + * harbour/contrib/xhb/txtline.c + * harbour/contrib/xhb/cstructc.c + * harbour/contrib/hbmzip/hbmzip.c + * harbour/contrib/sddsqlt3/sddsqlt3.c + * cleaned const pointer casting + 2010-11-19 11:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/ChangeLog * marked may last TODO note as DONE - thanks to Viktor and Mindaugas diff --git a/harbour/contrib/hbct/charop.c b/harbour/contrib/hbct/charop.c index b96d0b858c..a4dab6a437 100644 --- a/harbour/contrib/hbct/charop.c +++ b/harbour/contrib/hbct/charop.c @@ -69,7 +69,7 @@ void ct_charop( int iMode ) { HB_SIZE sStrLen = hb_parclen( 1 ); HB_SIZE sPos; - unsigned char * pucString = ( unsigned char * ) hb_parc( 1 ); + const unsigned char * pucString = ( const unsigned char * ) hb_parc( 1 ); unsigned char * pucResult; if( sStrLen == 0 ) diff --git a/harbour/contrib/hbct/charsort.c b/harbour/contrib/hbct/charsort.c index ec47076f01..0739d798be 100644 --- a/harbour/contrib/hbct/charsort.c +++ b/harbour/contrib/hbct/charsort.c @@ -66,8 +66,8 @@ static int #endif _hb_do_sortascend( const void *p1, const void *p2 ) { - char *pc1 = ( char * ) p1; - char *pc2 = ( char * ) p2; + const char *pc1 = ( const char * ) p1; + const char *pc2 = ( const char * ) p2; pc1 += s_sElementPos; pc2 += s_sElementPos; @@ -82,8 +82,8 @@ static int #endif _hb_do_sortdescend( const void *p1, const void *p2 ) { - char *pc1 = ( char * ) p1; - char *pc2 = ( char * ) p2; + const char *pc1 = ( const char * ) p1; + const char *pc2 = ( const char * ) p2; pc1 += s_sElementPos; pc2 += s_sElementPos; diff --git a/harbour/contrib/hbct/pack.c b/harbour/contrib/hbct/pack.c index a34926f9e0..1b410a04d8 100644 --- a/harbour/contrib/hbct/pack.c +++ b/harbour/contrib/hbct/pack.c @@ -55,7 +55,7 @@ HB_FUNC( CHARPACK ) { HB_SIZE len = hb_parclen( 1 ); - HB_UCHAR * in = ( HB_UCHAR * ) hb_parcx( 1 ); + const HB_UCHAR * in = ( const HB_UCHAR * ) hb_parcx( 1 ); if( hb_parni( 2 ) == 0 ) { @@ -102,7 +102,7 @@ static HB_UCHAR * buf_append( HB_UCHAR * buf, HB_SIZE * buf_size, HB_SIZE count, HB_FUNC( CHARUNPACK ) { HB_SIZE len = hb_parclen( 1 ); - HB_UCHAR * in = ( HB_UCHAR * ) hb_parcx( 1 ); + const HB_UCHAR * in = ( const HB_UCHAR * ) hb_parcx( 1 ); if( hb_parni( 2 ) == 0 ) { diff --git a/harbour/contrib/hbct/pos1.c b/harbour/contrib/hbct/pos1.c index a8e6c980d1..67a6496c1d 100644 --- a/harbour/contrib/hbct/pos1.c +++ b/harbour/contrib/hbct/pos1.c @@ -72,9 +72,9 @@ static void do_pos1( int iSwitch ) HB_ISCHAR( 2 ) && /* .. string as 2nd .. */ HB_ISCHAR( 3 ) ) ) ) /* .. and 3rd param */ { - unsigned char *pcString; + const unsigned char *pcString, *puc; HB_SIZE sStrLen; - unsigned char *puc, ucChar1 = ' ', ucChar2 = ' '; + unsigned char ucChar1 = ' ', ucChar2 = ' '; int iMode; HB_SIZE sIgnore; int iParamShift = 0; @@ -105,7 +105,7 @@ static void do_pos1( int iSwitch ) iParamShift += 2; } - pcString = ( unsigned char * ) hb_parc( iParamShift + 1 ); + pcString = ( const unsigned char * ) hb_parc( iParamShift + 1 ); sStrLen = hb_parclen( iParamShift + 1 ); if( HB_ISLOG( iParamShift + 2 ) ) diff --git a/harbour/contrib/hbct/range.c b/harbour/contrib/hbct/range.c index b70652b012..6bf1f6dbde 100644 --- a/harbour/contrib/hbct/range.c +++ b/harbour/contrib/hbct/range.c @@ -62,18 +62,18 @@ HB_FUNC( RANGEREM ) const char *pcString = hb_parc( 3 ); HB_SIZE sStrLen = hb_parclen( 3 ); char *pcRet; - unsigned char *pc; + const unsigned char *pc; unsigned char ucChar1, ucChar2; HB_SIZE sRetIndex; int iMode, iBool; if( HB_ISCHAR( 1 ) ) - ucChar1 = *( ( unsigned char * ) hb_parc( 1 ) ); + ucChar1 = *( ( const unsigned char * ) hb_parc( 1 ) ); else ucChar1 = ( unsigned char ) ( hb_parni( 1 ) % 256 ); if( HB_ISCHAR( 2 ) ) - ucChar2 = *( ( unsigned char * ) hb_parc( 2 ) ); + ucChar2 = *( ( const unsigned char * ) hb_parc( 2 ) ); else ucChar2 = ( unsigned char ) ( hb_parni( 2 ) % 256 ); @@ -81,7 +81,7 @@ HB_FUNC( RANGEREM ) pcRet = ( char * ) hb_xgrab( sStrLen + 1 ); sRetIndex = 0; - for( pc = ( unsigned char * ) pcString; pc < ( unsigned char * ) pcString + sStrLen; pc++ ) + for( pc = ( const unsigned char * ) pcString; pc < ( const unsigned char * ) pcString + sStrLen; pc++ ) { iBool = ( ( *pc ) >= ucChar1 ); if( iMode ) @@ -132,23 +132,23 @@ HB_FUNC( RANGEREPL ) const char *pcString = hb_parc( 3 ); HB_SIZE sStrLen = hb_parclen( 3 ); char *pcRet; - unsigned char *pc; + const unsigned char *pc; unsigned char ucChar1, ucChar2, ucReplace; HB_SIZE sRetIndex; int iMode, iBool; if( HB_ISCHAR( 1 ) ) - ucChar1 = *( ( unsigned char * ) hb_parc( 1 ) ); + ucChar1 = *( ( const unsigned char * ) hb_parc( 1 ) ); else ucChar1 = ( unsigned char ) ( hb_parni( 1 ) % 256 ); if( HB_ISCHAR( 2 ) ) - ucChar2 = *( ( unsigned char * ) hb_parc( 2 ) ); + ucChar2 = *( ( const unsigned char * ) hb_parc( 2 ) ); else ucChar2 = ( unsigned char ) ( hb_parni( 2 ) % 256 ); if( HB_ISCHAR( 4 ) ) - ucReplace = *( ( unsigned char * ) hb_parc( 4 ) ); + ucReplace = *( ( const unsigned char * ) hb_parc( 4 ) ); else ucReplace = ( unsigned char ) ( hb_parni( 4 ) % 256 ); @@ -156,7 +156,7 @@ HB_FUNC( RANGEREPL ) pcRet = ( char * ) hb_xgrab( sStrLen + 1 ); sRetIndex = 0; - for( pc = ( unsigned char * ) pcString; pc < ( unsigned char * ) pcString + sStrLen; pc++ ) + for( pc = ( const unsigned char * ) pcString; pc < ( const unsigned char * ) pcString + sStrLen; pc++ ) { iBool = ( ( *pc ) >= ucChar1 ); if( iMode ) diff --git a/harbour/contrib/hbct/token1.c b/harbour/contrib/hbct/token1.c index 356002d584..54e3191459 100644 --- a/harbour/contrib/hbct/token1.c +++ b/harbour/contrib/hbct/token1.c @@ -118,7 +118,7 @@ static void do_token1( int iSwitch ) pcSeparatorStr = hb_parc( 2 ); else { - pcSeparatorStr = ( char * ) s_pcSeparatorStr; + pcSeparatorStr = ( const char * ) s_pcSeparatorStr; sSeparatorStrLen = s_sSeparatorStrLen; } diff --git a/harbour/contrib/hbct/token2.c b/harbour/contrib/hbct/token2.c index e5c2e839c3..155d57d059 100644 --- a/harbour/contrib/hbct/token2.c +++ b/harbour/contrib/hbct/token2.c @@ -299,7 +299,7 @@ HB_FUNC( TOKENINIT ) pcSeparatorStr = hb_parc( 2 ); else { - pcSeparatorStr = ( char * ) spcSeparatorStr; + pcSeparatorStr = ( const char * ) spcSeparatorStr; sSeparatorStrLen = ssSeparatorStrLen; } diff --git a/harbour/contrib/hbmzip/hbmzip.c b/harbour/contrib/hbmzip/hbmzip.c index fe164026c1..a019591a18 100644 --- a/harbour/contrib/hbmzip/hbmzip.c +++ b/harbour/contrib/hbmzip/hbmzip.c @@ -193,7 +193,7 @@ HB_FUNC( HB_ZIPOPEN ) hb_retptrGC( phZip ); if( pszGlobalComment ) - hb_storc( ( char * ) pszGlobalComment, 3 ); + hb_storc( ( const char * ) pszGlobalComment, 3 ); } } else @@ -294,7 +294,7 @@ HB_FUNC( HB_ZIPFILEWRITE ) nLen = hb_parns( 3 ); if( hZip ) - hb_retni( zipWriteInFileInZip( hZip, (void*) pData, ( unsigned ) nLen ) ); + hb_retni( zipWriteInFileInZip( hZip, pData, ( unsigned ) nLen ) ); } else hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/harbour/contrib/sddmy/sddmy.c b/harbour/contrib/sddmy/sddmy.c index 6631f8b7b7..0acde743ea 100644 --- a/harbour/contrib/sddmy/sddmy.c +++ b/harbour/contrib/sddmy/sddmy.c @@ -247,14 +247,14 @@ static HB_ERRCODE mysqlOpen( SQLBASEAREAP pArea ) if ( mysql_real_query( pMySql, pArea->szQuery, ( unsigned long ) strlen( pArea->szQuery ) ) ) { - hb_errRT_MySQLDD( EG_OPEN, ESQLDD_INVALIDQUERY, ( char * ) mysql_error( pMySql ), pArea->szQuery, + hb_errRT_MySQLDD( EG_OPEN, ESQLDD_INVALIDQUERY, ( const char * ) mysql_error( pMySql ), pArea->szQuery, mysql_errno( pMySql ) ); return HB_FAILURE; } if ( ( pSDDData->pResult = mysql_store_result( pMySql ) ) == NULL ) { - hb_errRT_MySQLDD( EG_MEM, ESQLDD_INVALIDQUERY, ( char * ) mysql_error( pMySql ), pArea->szQuery, + hb_errRT_MySQLDD( EG_MEM, ESQLDD_INVALIDQUERY, ( const char * ) mysql_error( pMySql ), pArea->szQuery, mysql_errno( pMySql ) ); return HB_FAILURE; } diff --git a/harbour/contrib/sddsqlt3/sddsqlt3.c b/harbour/contrib/sddsqlt3/sddsqlt3.c index 3d1e5ffddb..1104a3fcf1 100644 --- a/harbour/contrib/sddsqlt3/sddsqlt3.c +++ b/harbour/contrib/sddsqlt3/sddsqlt3.c @@ -465,7 +465,7 @@ static HB_ERRCODE sqlite3GoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) break; case HB_FT_BLOB: - pItem = hb_itemPutCL( NULL, ( char * ) sqlite3_column_blob( st, ui ), sqlite3_column_bytes( st, ui ) ); + pItem = hb_itemPutCL( NULL, ( const char * ) sqlite3_column_blob( st, ui ), sqlite3_column_bytes( st, ui ) ); break; } diff --git a/harbour/contrib/xhb/cstructc.c b/harbour/contrib/xhb/cstructc.c index 570e81a816..6a00c77765 100644 --- a/harbour/contrib/xhb/cstructc.c +++ b/harbour/contrib/xhb/cstructc.c @@ -1451,5 +1451,5 @@ HB_FUNC( __CSTR_COPYTO ) hb_vmPush( pStructure ); hb_vmSend( 0 ); - memcpy( pPointer, ( void * ) hb_parc( -1 ), hb_arrayGetNI( pStructure, hb_arrayLen( pStructure ) - 2 ) ); + memcpy( pPointer, hb_parc( -1 ), hb_arrayGetNI( pStructure, hb_arrayLen( pStructure ) - 2 ) ); } diff --git a/harbour/contrib/xhb/hbcrypt.c b/harbour/contrib/xhb/hbcrypt.c index fa5a03bb49..355ff3c873 100644 --- a/harbour/contrib/xhb/hbcrypt.c +++ b/harbour/contrib/xhb/hbcrypt.c @@ -405,8 +405,8 @@ HB_FUNC( HB_CRYPT ) unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 ); nxs_crypt( - ( unsigned char * ) hb_itemGetCPtr( pSource ), hb_itemGetCLen( pSource ), - ( unsigned char * ) hb_itemGetCPtr( pKey ), hb_itemGetCLen( pKey ), + ( const unsigned char * ) hb_itemGetCPtr( pSource ), hb_itemGetCLen( pSource ), + ( const unsigned char * ) hb_itemGetCPtr( pKey ), hb_itemGetCLen( pKey ), cRes ); hb_retclen_buffer( ( char * ) cRes, hb_itemGetCLen( pSource ) ); @@ -426,8 +426,8 @@ HB_FUNC( HB_DECRYPT ) unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 ); nxs_decrypt( - ( unsigned char * ) hb_itemGetCPtr( pSource ), hb_itemGetCLen( pSource ), - ( unsigned char * ) hb_itemGetCPtr( pKey ), hb_itemGetCLen( pKey ), + ( const unsigned char * ) hb_itemGetCPtr( pSource ), hb_itemGetCLen( pSource ), + ( const unsigned char * ) hb_itemGetCPtr( pKey ), hb_itemGetCLen( pKey ), cRes ); hb_retclen_buffer( ( char * ) cRes, hb_itemGetCLen( pSource ) ); diff --git a/harbour/contrib/xhb/txtline.c b/harbour/contrib/xhb/txtline.c index ef0a4385b7..b5e6253d73 100644 --- a/harbour/contrib/xhb/txtline.c +++ b/harbour/contrib/xhb/txtline.c @@ -56,7 +56,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset ) +static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, const char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset ) { HB_SIZE nPosTerm, nPosition; HB_SIZE nPos, nCurrCol, nLastBlk; @@ -225,7 +225,7 @@ HB_FUNC( HB_READLINE ) { PHB_ITEM pTerm1; const char * szText = hb_parcx( 1 ); - char ** pTerm; + const char ** pTerm; HB_SIZE * pnTermSizes; HB_SIZE nTabLen, nTerms; HB_SIZE nLineSize = hb_parni( 3 ); @@ -270,21 +270,21 @@ HB_FUNC( HB_READLINE ) if( HB_IS_ARRAY( pTerm1 ) ) { nTerms = hb_arrayLen( pTerm1 ); - pTerm = ( char ** ) hb_xgrab( sizeof( char * ) * nTerms ); + pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms ); pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * nTerms ); for( i = 0; i < nTerms; i++ ) { hb_arrayGet( pTerm1, i + 1, pOpt ); - pTerm[ i ] = ( char * ) hb_itemGetCPtr( pOpt ); + pTerm[ i ] = hb_itemGetCPtr( pOpt ); pnTermSizes[ i ] = hb_itemGetCLen( pOpt ); } } else { - pTerm = ( char ** ) hb_xgrab( sizeof( char * ) ); + pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) ); pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 1 ); - pTerm[ 0 ] = ( char * ) hb_itemGetCPtr( pTerm1 ); + pTerm[ 0 ] = hb_itemGetCPtr( pTerm1 ); pnTermSizes[ 0 ] = hb_itemGetCLen( pTerm1 ); nTerms = 1; } diff --git a/harbour/contrib/xhb/xhbsave.c b/harbour/contrib/xhb/xhbsave.c index 935ddfc670..cd38db2c56 100644 --- a/harbour/contrib/xhb/xhbsave.c +++ b/harbour/contrib/xhb/xhbsave.c @@ -120,6 +120,6 @@ HB_FUNC( XHB_RESTSCREEN ) hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE ); hb_getScreenRange( &iLeft, &iRight, fNoCheck, HB_FALSE ); - hb_gtRest( iTop, iLeft, iBottom, iRight, ( void * ) hb_parc( 5 ) ); + hb_gtRest( iTop, iLeft, iBottom, iRight, hb_parc( 5 ) ); } } diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index 9a229c4857..42fb4abb4b 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -1323,7 +1323,7 @@ typedef HB_U32 HB_FATTR; # if defined( HB_BIG_ENDIAN ) #define HB_ORD2DBL( o, d ) do { \ - if ( ( ( HB_BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \ + if ( ( ( const HB_BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \ ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( const HB_BYTE * ) ( o ) )[ 0 ]; \ ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( const HB_BYTE * ) ( o ) )[ 1 ]; \ ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( const HB_BYTE * ) ( o ) )[ 2 ]; \ @@ -1368,24 +1368,24 @@ typedef HB_U32 HB_FATTR; # else /* HB_LITTLE_ENDIAN */ #define HB_ORD2DBL( o, d ) do { \ - if ( ( ( HB_BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \ - ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( HB_BYTE * ) ( o ) )[ 7 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( HB_BYTE * ) ( o ) )[ 6 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( HB_BYTE * ) ( o ) )[ 5 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( HB_BYTE * ) ( o ) )[ 4 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( HB_BYTE * ) ( o ) )[ 3 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( HB_BYTE * ) ( o ) )[ 2 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( HB_BYTE * ) ( o ) )[ 1 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0x80; \ + if ( ( ( const HB_BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \ + ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( const HB_BYTE * ) ( o ) )[ 7 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( const HB_BYTE * ) ( o ) )[ 6 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( const HB_BYTE * ) ( o ) )[ 5 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( const HB_BYTE * ) ( o ) )[ 4 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( const HB_BYTE * ) ( o ) )[ 3 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( const HB_BYTE * ) ( o ) )[ 2 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( const HB_BYTE * ) ( o ) )[ 1 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( const HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0x80; \ } else { \ - ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( HB_BYTE * ) ( o ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( HB_BYTE * ) ( o ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( HB_BYTE * ) ( o ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( HB_BYTE * ) ( o ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( HB_BYTE * ) ( o ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( HB_BYTE * ) ( o ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( const HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( const HB_BYTE * ) ( o ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( const HB_BYTE * ) ( o ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( const HB_BYTE * ) ( o ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( const HB_BYTE * ) ( o ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( const HB_BYTE * ) ( o ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( const HB_BYTE * ) ( o ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( const HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ } } while ( 0 ) #define HB_DBL2ORD( d, o ) do { \ diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index 760b793c80..7eca3e560f 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -326,7 +326,7 @@ static LPCDXKEY hb_cdxKeyCopy( LPCDXKEY pKeyDest, LPCDXKEY pKey ) /* * store bytes value in inkdex key */ -static LPCDXKEY hb_cdxKeyPut( LPCDXKEY pKey, HB_BYTE * pbVal, HB_USHORT uiLen, HB_ULONG ulRec ) +static LPCDXKEY hb_cdxKeyPut( LPCDXKEY pKey, const HB_BYTE * pbVal, HB_USHORT uiLen, HB_ULONG ulRec ) { if( !pKey ) pKey = hb_cdxKeyNew(); @@ -388,8 +388,8 @@ static LPCDXKEY hb_cdxKeyPutC( LPCDXKEY pKey, const char * szText, HB_USHORT uiR /* * compare two values using Tag conditions (len & type) */ -static int hb_cdxValCompare( LPCDXTAG pTag, HB_BYTE * val1, int len1, - HB_BYTE * val2, int len2, int iMode ) +static int hb_cdxValCompare( LPCDXTAG pTag, const HB_BYTE * val1, int len1, + const HB_BYTE * val2, int len2, int iMode ) { int iLimit, iResult = 0; @@ -497,7 +497,8 @@ static HB_BYTE hb_cdxItemTypeCmp( HB_BYTE bType ) */ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, LPCDXTAG pTag, HB_BOOL fTrans, int iMode ) { - HB_BYTE buf[ CDX_MAXKEY ], *ptr; + HB_BYTE buf[ CDX_MAXKEY ]; + const HB_BYTE * ptr; HB_SIZE nLen = 0; double d; @@ -517,16 +518,16 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, ul = ( HB_SIZE ) sizeof( tmp ); memcpy( tmp, hb_itemGetCPtr( pItem ), ul ); hb_strUpper( tmp, ul ); - hb_cdpnDup2( tmp, ul, ( char * ) ptr, &nLen, + hb_cdpnDup2( tmp, ul, ( char * ) buf, &nLen, hb_vmCDP(), pTag->pIndex->pArea->dbfarea.area.cdPage ); } else hb_cdpnDup2( hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ), - ( char * ) ptr, &nLen, + ( char * ) buf, &nLen, hb_vmCDP(), pTag->pIndex->pArea->dbfarea.area.cdPage ); if( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen ) { - memset( ptr + nLen, pTag->bTrail, pTag->uiLen - nLen ); + memset( buf + nLen, pTag->bTrail, pTag->uiLen - nLen ); nLen = pTag->uiLen; } } @@ -539,36 +540,36 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, if( pTag->IgnoreCase || ( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen ) ) { - memcpy( ptr, hb_itemGetCPtr( pItem ), nLen ); + memcpy( buf, hb_itemGetCPtr( pItem ), nLen ); if( pTag->IgnoreCase ) - hb_strUpper( ( char * ) ptr, nLen ); + hb_strUpper( ( char * ) buf, nLen ); if( iMode == CDX_CMP_EXACT && nLen < ( HB_SIZE ) pTag->uiLen ) { - memset( ptr + nLen, pTag->bTrail, pTag->uiLen - nLen ); + memset( buf + nLen, pTag->bTrail, pTag->uiLen - nLen ); nLen = pTag->uiLen; } } else - ptr = ( HB_BYTE * ) hb_itemGetCPtr( pItem ); + ptr = ( const HB_BYTE * ) hb_itemGetCPtr( pItem ); } break; case 'N': if( pTag->uiLen == 4 ) { HB_U32 uiVal = ( HB_U32 ) hb_itemGetNI( pItem ) + 0x80000000; - HB_PUT_BE_UINT32( ptr, uiVal ); + HB_PUT_BE_UINT32( buf, uiVal ); nLen = 4; } else { d = hb_itemGetND( pItem ); - HB_DBL2ORD( &d, ptr ); + HB_DBL2ORD( &d, buf ); nLen = 8; } break; case 'D': d = ( double ) hb_itemGetDL( pItem ); - HB_DBL2ORD( &d, ptr ); + HB_DBL2ORD( &d, buf ); nLen = 8; if( iMode == CDX_CMP_PREFIX && pTag->uiType == 'T' ) iMode = CDX_CMP_DATE; @@ -578,11 +579,11 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, d = ( double ) hb_itemGetDL( pItem ); else d = hb_itemGetTD( pItem ); - HB_DBL2ORD( &d, ptr ); + HB_DBL2ORD( &d, buf ); nLen = 8; break; case 'L': - *ptr = ( HB_BYTE ) ( hb_itemGetL( pItem ) ? 'T' : 'F' ); + *buf = ( HB_BYTE ) ( hb_itemGetL( pItem ) ? 'T' : 'F' ); nLen = 1; break; default: @@ -5490,13 +5491,13 @@ static HB_BOOL hb_cdxDBOISkipWild( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa iStop = -iStop; if( iFixed && !pTag->TagEOF && pTag->CurKey->rec != 0 && - hb_cdxValCompare( pTag, ( HB_BYTE * ) szPattern, iFixed, + hb_cdxValCompare( pTag, ( const HB_BYTE * ) szPattern, iFixed, pTag->CurKey->val, iFixed, CDX_CMP_PREFIX ) == -iStop ) { LPCDXKEY pKey; - pKey = hb_cdxKeyPut( NULL, ( HB_BYTE * ) szPattern, iFixed, + pKey = hb_cdxKeyPut( NULL, ( const HB_BYTE * ) szPattern, iFixed, pTag->UsrAscend ? CDX_IGNORE_REC_NUM : CDX_MAX_REC_NUM ); pKey->mode = CDX_CMP_PREFIX; if( !hb_cdxTagKeyFind( pTag, pKey ) ) @@ -5529,7 +5530,7 @@ static HB_BOOL hb_cdxDBOISkipWild( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa break; } } - if( iFixed && hb_cdxValCompare( pTag, ( HB_BYTE * ) szPattern, iFixed, + if( iFixed && hb_cdxValCompare( pTag, ( const HB_BYTE * ) szPattern, iFixed, pTag->CurKey->val, iFixed, CDX_CMP_PREFIX ) == iStop ) { @@ -5559,7 +5560,7 @@ static HB_BOOL hb_cdxDBOISkipWild( CDXAREAP pArea, LPCDXTAG pTag, HB_BOOL fForwa break; } } - if( iFixed && hb_cdxValCompare( pTag, ( HB_BYTE * ) szPattern, iFixed, + if( iFixed && hb_cdxValCompare( pTag, ( const HB_BYTE * ) szPattern, iFixed, pTag->CurKey->val, iFixed, CDX_CMP_PREFIX ) == iStop ) { @@ -7605,12 +7606,12 @@ static HB_ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderI * 3. add the Tag to index file */ - hb_cdxCreateFName( pArea, ( char * ) pOrderInfo->abBagName, + hb_cdxCreateFName( pArea, pOrderInfo->abBagName, &fProd, szFileName, szCpndTagName ); if( pOrderInfo->atomBagName && pOrderInfo->atomBagName[0] ) { - hb_strncpyUpperTrim( szTagName, ( char * ) pOrderInfo->atomBagName, sizeof( szTagName ) - 1 ); + hb_strncpyUpperTrim( szTagName, pOrderInfo->atomBagName, sizeof( szTagName ) - 1 ); fNewFile = HB_FALSE; } else @@ -9126,7 +9127,7 @@ static HB_BOOL hb_cdxSortKeyGet( LPCDXSORTINFO pSort, HB_BYTE ** pKeyVal, HB_ULO #endif -static void hb_cdxSortKeyAdd( LPCDXSORTINFO pSort, HB_ULONG ulRec, HB_BYTE * pKeyVal, int iKeyLen ) +static void hb_cdxSortKeyAdd( LPCDXSORTINFO pSort, HB_ULONG ulRec, const HB_BYTE * pKeyVal, int iKeyLen ) { int iLen = pSort->keyLen; HB_BYTE *pDst; @@ -9559,7 +9560,7 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, HB_BOOL fReindex ) case HB_IT_STRING: case HB_IT_STRING | HB_IT_MEMO: hb_cdxSortKeyAdd( pSort, pArea->dbfarea.ulRecNo, - ( HB_BYTE * ) hb_itemGetCPtr( pItem ), + ( const HB_BYTE * ) hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ) ); break; diff --git a/harbour/src/rdd/dbffpt/dbffpt1.c b/harbour/src/rdd/dbffpt/dbffpt1.c index faf04b0ef2..6bc14bf033 100644 --- a/harbour/src/rdd/dbffpt/dbffpt1.c +++ b/harbour/src/rdd/dbffpt/dbffpt1.c @@ -99,7 +99,7 @@ static RDDFUNCS fptSuper; * generate Run-Time error */ static HB_ERRCODE hb_memoErrorRT( FPTAREAP pArea, HB_ERRCODE uiGenCode, HB_ERRCODE uiSubCode, - char * szFileName, HB_ERRCODE uiOsCode, HB_USHORT uiFlags ) + const char * szFileName, HB_ERRCODE uiOsCode, HB_USHORT uiFlags ) { HB_ERRCODE errCode = HB_FAILURE; @@ -3047,7 +3047,8 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt { HB_ULONG ulBlock = 0, ulSize, ulType, ulOldSize = 0, ulOldType = 0, ulArrayCount = 0; HB_BYTE itmBuffer[ FLEX_ITEM_BUFSIZE ]; - HB_BYTE *bBufPtr = NULL, *bBufAlloc = NULL; + const HB_BYTE *bBufPtr = NULL; + HB_BYTE *bBufAlloc = NULL, * pbTmp; HB_ERRCODE errCode; HB_MAXINT iVal; HB_LONG lVal; @@ -3064,19 +3065,19 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt { bBufPtr = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize ); hb_itemCopyStrU16( pItem, HB_CDP_ENDIAN_LITTLE, - ( HB_WCHAR * ) bBufPtr, ulSize / sizeof( HB_WCHAR ) ); + ( HB_WCHAR * ) bBufAlloc, ulSize / sizeof( HB_WCHAR ) ); } } else { ulSize = hb_itemGetCLen( pItem ); - bBufPtr = ( HB_BYTE * ) hb_itemGetCPtr( pItem ); + bBufPtr = ( const HB_BYTE * ) hb_itemGetCPtr( pItem ); if( iTrans == FPT_TRANS_CP && ulSize > 0 ) { HB_SIZE nSize = ulSize; - bBufPtr = bBufAlloc = ( HB_BYTE * ) - hb_cdpnDup( ( const char * ) bBufPtr, &nSize, - hb_vmCDP(), pArea->area.cdPage ); + bBufAlloc = ( HB_BYTE * ) hb_cdpnDup( ( const char * ) bBufPtr, &nSize, + hb_vmCDP(), pArea->area.cdPage ); + bBufPtr = bBufAlloc; ulSize = ( HB_ULONG ) nSize; } } @@ -3094,8 +3095,8 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt ulSize = hb_fptCountSMTItemLength( pArea, pItem, &ulArrayCount, iTrans ); if( ulSize == 0 ) return EDBF_DATATYPE; - bBufPtr = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize ); - hb_fptStoreSMTItem( pArea, pItem, &bBufPtr, iTrans ); + pbTmp = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize ); + hb_fptStoreSMTItem( pArea, pItem, &pbTmp, iTrans ); ulType = ( HB_ULONG ) bBufAlloc[ 0 ]; bBufPtr = bBufAlloc; } @@ -3111,8 +3112,8 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt ulSize = hb_fptCountSixItemLength( pArea, pItem, &ulArrayCount, iTrans ); if( ulSize > 0 ) { - bBufPtr = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize ); - hb_fptStoreSixItem( pArea, pItem, &bBufPtr, iTrans ); + pbTmp = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize ); + hb_fptStoreSixItem( pArea, pItem, &pbTmp, iTrans ); ulType = ( HB_ULONG ) HB_GET_LE_UINT16( bBufAlloc ); bBufPtr = bBufAlloc; } @@ -3131,8 +3132,8 @@ static HB_ERRCODE hb_fptPutMemo( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pIt ulSize = hb_fptCountFlexItemLength( pArea, pItem, &ulArrayCount, iTrans ) - 1; if( ulSize > 0 ) { - bBufPtr = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize + 1 ); - hb_fptStoreFlexItem( pArea, pItem, &bBufPtr, iTrans ); + pbTmp = bBufAlloc = ( HB_BYTE * ) hb_xgrab( ulSize + 1 ); + hb_fptStoreFlexItem( pArea, pItem, &pbTmp, iTrans ); bBufPtr = bBufAlloc + 1; /* FLEX doesn't store the first byte of array ID */ } break; @@ -3573,7 +3574,7 @@ static HB_ERRCODE hb_fptGetVarFile( FPTAREAP pArea, HB_ULONG ulBlock, const char { hb_memoErrorRT( pArea, 0, errCode, errCode == EDBF_OPEN_DBF || errCode == EDBF_CREATE || - errCode == EDBF_WRITE ? ( char * ) szFile : + errCode == EDBF_WRITE ? szFile : pArea->szMemoFileName, 0, 0 ); } return HB_FAILURE; @@ -3621,7 +3622,7 @@ static HB_ULONG hb_fptPutVarFile( FPTAREAP pArea, HB_ULONG ulBlock, const char * { hb_memoErrorRT( pArea, 0, errCode, errCode == EDBF_OPEN_DBF || errCode == EDBF_READ ? - ( char * ) szFile : pArea->szMemoFileName, 0, 0 ); + szFile : pArea->szMemoFileName, 0, 0 ); ulBlock = 0; } @@ -3708,7 +3709,8 @@ static HB_ERRCODE hb_fptPutVarField( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM } else { - HB_BYTE buffer[ 11 ], *pBlock = NULL, *pAlloc = NULL; + HB_BYTE buffer[ 11 ], *pAlloc = NULL, *pbTmp; + const HB_BYTE * pBlock = NULL; HB_ULONG ulOldBlock = 0, ulOldSize = 0, ulNewSize = 0; HB_USHORT uiType = HB_GET_LE_UINT16( pFieldBuf + pField->uiLen - 2 ); @@ -3785,7 +3787,7 @@ static HB_ERRCODE hb_fptPutVarField( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM { HB_SIZE ulLen = hb_itemGetCLen( pItem ); - pBlock = ( HB_BYTE * ) hb_itemGetCPtr( pItem ); + pBlock = ( const HB_BYTE * ) hb_itemGetCPtr( pItem ); if( ulLen > HB_VF_CHAR ) ulLen = HB_VF_CHAR; if( ulLen > 0 && ( pField->uiFlags & HB_FF_BINARY ) == 0 && @@ -3830,8 +3832,8 @@ static HB_ERRCODE hb_fptPutVarField( FPTAREAP pArea, HB_USHORT uiIndex, PHB_ITEM iTrans = FPT_TRANS_NONE; ulNewSize = hb_fptCountSMTItemLength( pArea, pItem, &ulArrayCount, iTrans ); - pBlock = pAlloc = ( HB_BYTE * ) hb_xgrab( ulNewSize ); - hb_fptStoreSMTItem( pArea, pItem, &pBlock, iTrans ); + pbTmp = pAlloc = ( HB_BYTE * ) hb_xgrab( ulNewSize ); + hb_fptStoreSMTItem( pArea, pItem, &pbTmp, iTrans ); pBlock = pAlloc; uiType = HB_VF_ARRAY; } @@ -4017,7 +4019,7 @@ static HB_ERRCODE hb_fptCreateMemFile( FPTAREAP pArea, LPDBOPENINFO pCreateInfo pArea->bMemoType != DB_MEMO_SMT ) { hb_memoErrorRT( pArea, EG_CREATE, EDBF_MEMOTYPE, - ( char * ) pCreateInfo->abName, 0, 0 ); + pCreateInfo->abName, 0, 0 ); hb_itemRelease( pItem ); return HB_FAILURE; } @@ -4063,7 +4065,7 @@ static HB_ERRCODE hb_fptCreateMemFile( FPTAREAP pArea, LPDBOPENINFO pCreateInfo } else { - hb_strncpy( ( char * ) szFileName, ( char * ) pCreateInfo->abName, sizeof( szFileName ) - 1 ); + hb_strncpy( szFileName, pCreateInfo->abName, sizeof( szFileName ) - 1 ); } hb_xfree( pFileName ); } @@ -4211,7 +4213,7 @@ static HB_ERRCODE hb_fptGetValueFile( FPTAREAP pArea, HB_USHORT uiIndex, const c { hb_memoErrorRT( pArea, 0, errCode, errCode == EDBF_OPEN_DBF || errCode == EDBF_CREATE || - errCode == EDBF_WRITE ? ( char * ) szFile : + errCode == EDBF_WRITE ? szFile : pArea->szMemoFileName, 0, 0 ); } return HB_FAILURE; @@ -4245,7 +4247,7 @@ static HB_ERRCODE hb_fptOpenMemFile( FPTAREAP pArea, LPDBOPENINFO pOpenInfo ) pArea->bMemoType != DB_MEMO_SMT ) { hb_memoErrorRT( pArea, EG_OPEN, EDBF_MEMOTYPE, - ( char * ) pOpenInfo->abName, 0, 0 ); + pOpenInfo->abName, 0, 0 ); return HB_FAILURE; } @@ -4261,7 +4263,7 @@ static HB_ERRCODE hb_fptOpenMemFile( FPTAREAP pArea, LPDBOPENINFO pOpenInfo ) } else { - hb_strncpy( ( char * ) szFileName, ( char * ) pOpenInfo->abName, sizeof( szFileName ) - 1 ); + hb_strncpy( szFileName, pOpenInfo->abName, sizeof( szFileName ) - 1 ); } hb_xfree( pFileName ); @@ -4480,7 +4482,7 @@ static HB_ERRCODE hb_fptPutValueFile( FPTAREAP pArea, HB_USHORT uiIndex, const c { hb_memoErrorRT( pArea, 0, errCode, errCode == EDBF_OPEN_DBF || errCode == EDBF_READ ? - ( char * ) szFile : pArea->szMemoFileName, 0, 0 ); + szFile : pArea->szMemoFileName, 0, 0 ); return HB_FAILURE; } return HB_SUCCESS; diff --git a/harbour/src/rdd/dbfnsx/dbfnsx1.c b/harbour/src/rdd/dbfnsx/dbfnsx1.c index 6b917ae879..3c4e23916c 100644 --- a/harbour/src/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -848,8 +848,8 @@ static HB_BOOL hb_nsxEvalSeekCond( LPTAGINFO pTag, PHB_ITEM pCondItem ) /* * compare two values using Tag conditions (len & type) */ -static int hb_nsxValCompare( LPTAGINFO pTag, HB_UCHAR * val1, int len1, - HB_UCHAR * val2, int len2, int iMode ) +static int hb_nsxValCompare( LPTAGINFO pTag, const HB_UCHAR * val1, int len1, + const HB_UCHAR * val2, int len2, int iMode ) { int iLimit, iResult = 0; @@ -4642,7 +4642,8 @@ static HB_BOOL hb_nsxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi int iStop = fForward ? -1 : 1; if( pTag->fUsrDescend ) iStop = -iStop; - if( iFixed && hb_nsxValCompare( pTag, ( HB_UCHAR * ) szPattern, iFixed, + if( iFixed && hb_nsxValCompare( pTag, + ( const HB_UCHAR * ) szPattern, iFixed, pTag->CurKeyInfo->val, iFixed, NSX_CMP_PREFIX ) == -iStop ) { @@ -4682,7 +4683,7 @@ static HB_BOOL hb_nsxOrdSkipWild( LPTAGINFO pTag, HB_BOOL fForward, PHB_ITEM pWi break; } } - if( iFixed && hb_nsxValCompare( pTag, ( HB_UCHAR * ) szPattern, iFixed, + if( iFixed && hb_nsxValCompare( pTag, ( const HB_UCHAR * ) szPattern, iFixed, pTag->CurKeyInfo->val, iFixed, NSX_CMP_PREFIX ) == iStop ) { break; diff --git a/harbour/src/rdd/dbfntx/dbfntx1.c b/harbour/src/rdd/dbfntx/dbfntx1.c index 4fb51fbaa2..283bebd384 100644 --- a/harbour/src/rdd/dbfntx/dbfntx1.c +++ b/harbour/src/rdd/dbfntx/dbfntx1.c @@ -3607,14 +3607,14 @@ static LPNTXINDEX hb_ntxFindBag( NTXAREAP pArea, const char * szBagName ) pSeek = hb_fsFNameSplit( szBagName ); if( ! pSeek->szName ) - pSeek->szName = ( char * ) ""; + pSeek->szName = ""; pIndex = pArea->lpIndexes; while( pIndex ) { pName = hb_fsFNameSplit( pIndex->IndexName ); if( ! pName->szName ) - pName->szName = ( char * ) ""; + pName->szName = ""; fFound = !hb_stricmp( pName->szName, pSeek->szName ) && ( !pSeek->szPath || ( pName->szPath && !hb_stricmp( pName->szPath, pSeek->szPath ) ) ) && @@ -6368,11 +6368,11 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI #else fCompound = fTagName && pData->fMultiTag; #endif - hb_ntxCreateFName( pArea, ( char * ) ( ( fBagName || fCompound ) ? - pOrderInfo->abBagName : pOrderInfo->atomBagName ), + hb_ntxCreateFName( pArea, ( fBagName || fCompound ) ? + pOrderInfo->abBagName : pOrderInfo->atomBagName, &fProd, szFileName, szTagName ); if( fTagName ) - hb_strncpyUpperTrim( szTagName, ( char * ) pOrderInfo->atomBagName, NTX_MAX_TAGNAME ); + hb_strncpyUpperTrim( szTagName, pOrderInfo->atomBagName, NTX_MAX_TAGNAME ); pIndex = hb_ntxFindBag( pArea, szFileName ); if( pIndex && !fCompound )