2009-06-26 15:52 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rdd/hsx/hsx.c
    * removed ( BYTE * ) casting

  * harbour/include/hbchksum.h
  * harbour/source/rtl/hbadler.c
  * harbour/source/rtl/hbcrc.c
  * harbour/source/rtl/hbmd5.c
    * use 'const char *' for passed memory buffers
         ULONG hb_adler32( ULONG adler, const char *buf, ULONG len );
         ULONG hb_crc16( ULONG crc, const char *buf, ULONG len );
         ULONG hb_crc32( ULONG crc, const char *buf, ULONG len );
         HB_ULONG hb_crc( HB_ULONG crc, const char * buf, ULONG len,
                          HB_ULONG poly );
         HB_ULONG hb_crcct( HB_ULONG crc, const char * buf, ULONG len,
                            HB_ULONG poly );
         void hb_md5( const char * ucData, ULONG ulLen, char * ucDigest );
         void hb_md5file( HB_FHANDLE hFile, char * ucDigest );

  * harbour/include/hbsxfunc.h
  * harbour/source/rdd/hbsix/sxcompr.c
  * harbour/source/rdd/hbsix/sxcrypt.c
    * use '[const] char *' for passed memory buffers in:
         void hb_sxEnCrypt( const char * pSrc, char * pDst,
                            const char * pKeyVal, ULONG ulLen );
         void hb_sxDeCrypt( const char * pSrc, char * pDst,
                            const char * pKeyVal, ULONG ulLen );
         BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, ULONG ulSrcLen,
                                     char * pDstBuf, ULONG ulDstLen );
         BOOL hb_LZSSxCompressMem( const char * pSrcBuf, ULONG ulSrcLen,
                                   char * pDstBuf, ULONG ulDstLen,
                                   ULONG * pulSize );

  * harbour/include/hbapigt.h
  * harbour/include/hbgtcore.h
  * harbour/source/rtl/hbgtcore.c
  * harbour/source/rtl/mouse53.c
  * harbour/source/rtl/mouseapi.c
  * harbour/source/rtl/gtdos/gtdos.c
    * changed 'const BYTE *' to 'const char *' in MouseSaveState()
      and MouseRestoreState() GT methods and functions.

  * harbour/source/rtl/cdpapi.c
  * harbour/source/rtl/is.c
    * added ( char * ) casting as workaround for wrong in MSVC strchr()
      declaration.

  * harbour/include/hbrdddbf.h
  * harbour/source/rdd/dbf1.c
  * harbour/source/rtl/hbi18n1.c
  * harbour/contrib/xhb/hbcrypt.c
    * updated for above modifications
This commit is contained in:
Przemyslaw Czerpak
2009-06-26 13:53:41 +00:00
parent 83a6162d7f
commit c9731a76a7
21 changed files with 242 additions and 174 deletions

View File

@@ -17,6 +17,59 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-26 15:52 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rdd/hsx/hsx.c
* removed ( BYTE * ) casting
* harbour/include/hbchksum.h
* harbour/source/rtl/hbadler.c
* harbour/source/rtl/hbcrc.c
* harbour/source/rtl/hbmd5.c
* use 'const char *' for passed memory buffers
ULONG hb_adler32( ULONG adler, const char *buf, ULONG len );
ULONG hb_crc16( ULONG crc, const char *buf, ULONG len );
ULONG hb_crc32( ULONG crc, const char *buf, ULONG len );
HB_ULONG hb_crc( HB_ULONG crc, const char * buf, ULONG len,
HB_ULONG poly );
HB_ULONG hb_crcct( HB_ULONG crc, const char * buf, ULONG len,
HB_ULONG poly );
void hb_md5( const char * ucData, ULONG ulLen, char * ucDigest );
void hb_md5file( HB_FHANDLE hFile, char * ucDigest );
* harbour/include/hbsxfunc.h
* harbour/source/rdd/hbsix/sxcompr.c
* harbour/source/rdd/hbsix/sxcrypt.c
* use '[const] char *' for passed memory buffers in:
void hb_sxEnCrypt( const char * pSrc, char * pDst,
const char * pKeyVal, ULONG ulLen );
void hb_sxDeCrypt( const char * pSrc, char * pDst,
const char * pKeyVal, ULONG ulLen );
BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, ULONG ulSrcLen,
char * pDstBuf, ULONG ulDstLen );
BOOL hb_LZSSxCompressMem( const char * pSrcBuf, ULONG ulSrcLen,
char * pDstBuf, ULONG ulDstLen,
ULONG * pulSize );
* harbour/include/hbapigt.h
* harbour/include/hbgtcore.h
* harbour/source/rtl/hbgtcore.c
* harbour/source/rtl/mouse53.c
* harbour/source/rtl/mouseapi.c
* harbour/source/rtl/gtdos/gtdos.c
* changed 'const BYTE *' to 'const char *' in MouseSaveState()
and MouseRestoreState() GT methods and functions.
* harbour/source/rtl/cdpapi.c
* harbour/source/rtl/is.c
* added ( char * ) casting as workaround for wrong in MSVC strchr()
declaration.
* harbour/include/hbrdddbf.h
* harbour/source/rdd/dbf1.c
* harbour/source/rtl/hbi18n1.c
* harbour/contrib/xhb/hbcrypt.c
* updated for above modifications
2009-06-25 14:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbapi.h
* source/vm/maindllp.c

View File

@@ -328,9 +328,9 @@ void nxs_xorcyclic(
ULONG crc1l, crc2l, crc3l;
/* Build the cyclic key seed */
crc1 = keylen >= 2 ? hb_adler32( 0, ( BYTE * ) key + 0, keylen - 2 ) : 1;
crc2 = keylen >= 4 ? hb_adler32( 0, ( BYTE * ) key + 2, keylen - 4 ) : 1;
crc3 = keylen >= 2 ? hb_adler32( 0, ( BYTE * ) key + 1, keylen - 2 ) : 1;
crc1 = keylen >= 2 ? hb_adler32( 0, ( const char * ) key + 0, keylen - 2 ) : 1;
crc2 = keylen >= 4 ? hb_adler32( 0, ( const char * ) key + 2, keylen - 4 ) : 1;
crc3 = keylen >= 2 ? hb_adler32( 0, ( const char * ) key + 1, keylen - 2 ) : 1;
crc1l = crc1 = nxs_cyclic_sequence( crc1 );
crc2l = crc2 = nxs_cyclic_sequence( crc2 );

View File

@@ -249,8 +249,8 @@ extern HB_EXPORT void hb_mouseSetPos( int iRow, int iCol );
extern HB_EXPORT void hb_mouseSetBounds( int iTop, int iLeft, int iBottom, int iRight );
extern HB_EXPORT void hb_mouseGetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight );
extern HB_EXPORT int hb_mouseStorageSize( void );
extern HB_EXPORT void hb_mouseSaveState( BYTE * pBuffer );
extern HB_EXPORT void hb_mouseRestoreState( const BYTE * pBuffer );
extern HB_EXPORT void hb_mouseSaveState( char * pBuffer );
extern HB_EXPORT void hb_mouseRestoreState( const char * pBuffer );
extern HB_EXPORT int hb_mouseGetDoubleClickSpeed( void );
extern HB_EXPORT void hb_mouseSetDoubleClickSpeed( int iSpeed );
extern HB_EXPORT int hb_mouseCountButton( void );

View File

@@ -54,12 +54,12 @@
HB_EXTERN_BEGIN
extern HB_EXPORT ULONG hb_adler32( ULONG adler, const BYTE *buf, ULONG len );
extern HB_EXPORT ULONG hb_crc16( ULONG crc, const BYTE *buf, ULONG len );
extern HB_EXPORT ULONG hb_crc32( ULONG crc, const BYTE *buf, ULONG len );
extern HB_EXPORT HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly );
extern HB_EXPORT HB_ULONG hb_crcct( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly );
extern HB_EXPORT void hb_md5( BYTE * ucData, ULONG ulLen, BYTE * ucDigest );
extern HB_EXPORT void hb_md5file( HB_FHANDLE hFile, BYTE * ucDigest );
extern HB_EXPORT ULONG hb_adler32( ULONG adler, const char *buf, ULONG len );
extern HB_EXPORT ULONG hb_crc16( ULONG crc, const char *buf, ULONG len );
extern HB_EXPORT ULONG hb_crc32( ULONG crc, const char *buf, ULONG len );
extern HB_EXPORT HB_ULONG hb_crc( HB_ULONG crc, const char * buf, ULONG len, HB_ULONG poly );
extern HB_EXPORT HB_ULONG hb_crcct( HB_ULONG crc, const char * buf, ULONG len, HB_ULONG poly );
extern HB_EXPORT void hb_md5( const char * ucData, ULONG ulLen, char * ucDigest );
extern HB_EXPORT void hb_md5file( HB_FHANDLE hFile, char * ucDigest );
HB_EXTERN_END

View File

@@ -223,8 +223,8 @@ typedef struct
void (* MouseSetBounds) ( HB_GT_PTR, int, int, int, int );
void (* MouseGetBounds) ( HB_GT_PTR, int *, int *, int *, int * );
int (* MouseStorageSize) ( HB_GT_PTR );
void (* MouseSaveState) ( HB_GT_PTR, BYTE * );
void (* MouseRestoreState) ( HB_GT_PTR, const BYTE * );
void (* MouseSaveState) ( HB_GT_PTR, char * );
void (* MouseRestoreState) ( HB_GT_PTR, const char * );
int (* MouseGetDoubleClickSpeed) ( HB_GT_PTR );
void (* MouseSetDoubleClickSpeed) ( HB_GT_PTR, int );
int (* MouseCountButton) ( HB_GT_PTR );

View File

@@ -246,7 +246,7 @@ typedef struct _DBFAREA
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
ULONG * pLocksPos; /* List of records locked */
ULONG ulNumLocksPos; /* Number of records locked */
BYTE * pCryptKey; /* Pointer to encryption key */
char * pCryptKey; /* Pointer to encryption key */
PHB_DYNS pTriggerSym; /* DynSym pointer to trigger function */
} DBFAREA;

View File

@@ -65,11 +65,11 @@ HB_EXTERN_BEGIN
char * hb_sxDtoP( char * pDate, LONG lJulian );
LONG hb_sxPtoD( const char * pDate );
void hb_sxEnCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen );
void hb_sxDeCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen );
void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, ULONG ulLen );
void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, ULONG ulLen );
BOOL hb_LZSSxDecompressMem( BYTE * pSrcBuf, ULONG ulSrcLen, BYTE * pDstBuf, ULONG ulDstLen );
BOOL hb_LZSSxCompressMem( BYTE * pSrcBuf, ULONG ulSrcLen, BYTE * pDstBuf, ULONG ulDstLen, ULONG * pulSize );
BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, ULONG ulSrcLen, char * pDstBuf, ULONG ulDstLen );
BOOL hb_LZSSxCompressMem( const char * pSrcBuf, ULONG ulSrcLen, char * pDstBuf, ULONG ulDstLen, ULONG * pulSize );
BOOL hb_LZSSxCompressFile( HB_FHANDLE hInput, HB_FHANDLE hOutput, ULONG * pulSize );
BOOL hb_LZSSxDecompressFile( HB_FHANDLE hInput, HB_FHANDLE hOutput );

View File

@@ -598,7 +598,7 @@ static BOOL hb_dbfWriteRecord( DBFAREAP pArea )
*/
static BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, BOOL fRaw )
{
BYTE byBuffer[ 8 ];
char pKeyBuffer[ 8 ];
ULONG ulLen;
BOOL fKeySet = FALSE, fSet;
@@ -614,16 +614,16 @@ static BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, BOOL fRaw )
{
if( ulLen < 8 )
{
memcpy( byBuffer, hb_itemGetCPtr( pPasswd ), ulLen );
memset( byBuffer + ulLen, '\0', 8 - ulLen );
memcpy( pKeyBuffer, hb_itemGetCPtr( pPasswd ), ulLen );
memset( pKeyBuffer + ulLen, '\0', 8 - ulLen );
}
else
memcpy( byBuffer, hb_itemGetCPtr( pPasswd ), 8 );
memcpy( pKeyBuffer, hb_itemGetCPtr( pPasswd ), 8 );
}
}
if( pArea->pCryptKey )
hb_itemPutCL( pPasswd, ( char * ) pArea->pCryptKey, 8 );
hb_itemPutCL( pPasswd, pArea->pCryptKey, 8 );
else
hb_itemClear( pPasswd );
@@ -648,13 +648,13 @@ static BOOL hb_dbfPasswordSet( DBFAREAP pArea, PHB_ITEM pPasswd, BOOL fRaw )
/* at this moment only one encryption method is used,
I'll add other later, [druzus] */
pArea->bCryptType = DB_CRYPT_SIX;
pArea->pCryptKey = ( BYTE * ) hb_xgrab( 8 );
pArea->pCryptKey = ( char * ) hb_xgrab( 8 );
/* SIX encode the key with its own value before use */
if( !fRaw )
hb_sxEnCrypt( byBuffer, pArea->pCryptKey, byBuffer, 8 );
hb_sxEnCrypt( pKeyBuffer, pArea->pCryptKey, pKeyBuffer, 8 );
else
memcpy( pArea->pCryptKey, byBuffer, 8 );
memcpy( pArea->pCryptKey, pKeyBuffer, 8 );
fKeySet = TRUE;
}
}
@@ -678,7 +678,7 @@ static void hb_dbfTableCrypt( DBFAREAP pArea, PHB_ITEM pPasswd, BOOL fEncrypt )
if( SELF_RECCOUNT( ( AREAP ) pArea, &ulRecords ) == HB_SUCCESS )
{
HB_ERRCODE errCode = HB_SUCCESS;
BYTE * pOldCryptKey, * pNewCryptKey;
char * pOldCryptKey, * pNewCryptKey;
pOldCryptKey = pArea->pCryptKey;
pArea->pCryptKey = NULL;
@@ -1856,7 +1856,8 @@ static HB_ERRCODE hb_dbfGetRec( DBFAREAP pArea, BYTE ** pBuffer )
pArea->pRecord[ 0 ] = pArea->pRecord[ 0 ] == 'D' ? '*' : ' ';
if( pArea->pCryptKey && pArea->bCryptType == DB_CRYPT_SIX )
{
hb_sxDeCrypt( pArea->pRecord + 1, pArea->pRecord + 1,
hb_sxDeCrypt( ( const char * ) pArea->pRecord + 1,
( char * ) pArea->pRecord + 1,
pArea->pCryptKey, pArea->uiRecordLen - 1 );
}
}
@@ -2257,8 +2258,9 @@ static HB_ERRCODE hb_dbfPutRec( DBFAREAP pArea, BYTE * pBuffer )
{
pRecord = ( BYTE * ) hb_xgrab( pArea->uiRecordLen );
pRecord[ 0 ] = pArea->fDeleted ? 'D' : 'E';
hb_sxEnCrypt( pArea->pRecord + 1, pRecord + 1, pArea->pCryptKey,
pArea->uiRecordLen - 1 );
hb_sxEnCrypt( ( const char * ) pArea->pRecord + 1,
( char * ) pRecord + 1,
pArea->pCryptKey, pArea->uiRecordLen - 1 );
}
}

View File

@@ -156,10 +156,10 @@
/* create compressed item from match position and length */
#define LZSS_ITEM(o, l) ( ( (o) << LENGTHBITS ) | ( (l) - MINLENGTH ) )
/* create low byte of compressed item */
#define LZSS_ITMLO(o, l) ( ( BYTE ) (o) )
#define LZSS_ITMLO(o, l) ( ( UCHAR ) (o) )
/* create high byte of compressed item */
#define LZSS_ITMHI(o, l) ( ( BYTE ) ( ( ( (o) >> ( 8 - LENGTHBITS ) ) & ~MATCHMASK ) | \
( (l) - MINLENGTH ) ) )
#define LZSS_ITMHI(o, l) ( ( UCHAR ) ( ( ( (o) >> ( 8 - LENGTHBITS ) ) & ~MATCHMASK ) | \
( (l) - MINLENGTH ) ) )
/* maximum size of item set: byte with item type bits plus 8 items */
#define ITEMSETSIZE ( ( ITEMBITS << 3 ) + 1 )
@@ -190,7 +190,7 @@ typedef struct _HB_LZSSX_COMPR
BOOL fResult;
BOOL fContinue;
BYTE ring_buffer[ RBUFLENGTH + MAXLENGTH - 1 ];
UCHAR ring_buffer[ RBUFLENGTH + MAXLENGTH - 1 ];
SHORT match_offset;
SHORT match_length;
@@ -211,8 +211,8 @@ static void hb_LZSSxExit( PHB_LZSSX_COMPR pCompr )
}
static PHB_LZSSX_COMPR hb_LZSSxInit(
HB_FHANDLE hInput, BYTE * pSrcBuf, ULONG ulSrcBuf,
HB_FHANDLE hOutput, BYTE * pDstBuf, ULONG ulDstBuf )
HB_FHANDLE hInput, BYTE * pSrcBuf, ULONG ulSrcBuf,
HB_FHANDLE hOutput, BYTE * pDstBuf, ULONG ulDstBuf )
{
PHB_LZSSX_COMPR pCompr = ( PHB_LZSSX_COMPR ) hb_xgrab( sizeof( HB_LZSSX_COMPR ) );
@@ -269,14 +269,14 @@ static BOOL hb_LZSSxFlush( PHB_LZSSX_COMPR pCompr )
return pCompr->fResult;
}
static BOOL hb_LZSSxWrite( PHB_LZSSX_COMPR pCompr, BYTE bVal )
static BOOL hb_LZSSxWrite( PHB_LZSSX_COMPR pCompr, UCHAR ucVal )
{
if( pCompr->fResult )
{
if( pCompr->outBuffPos == pCompr->outBuffSize )
hb_LZSSxFlush( pCompr );
if( pCompr->outBuffPos < pCompr->outBuffSize )
pCompr->outBuffer[pCompr->outBuffPos] = bVal;
pCompr->outBuffer[ pCompr->outBuffPos ] = ucVal;
else
pCompr->fResult = FALSE;
}
@@ -287,7 +287,7 @@ static BOOL hb_LZSSxWrite( PHB_LZSSX_COMPR pCompr, BYTE bVal )
static int hb_LZSSxRead( PHB_LZSSX_COMPR pCompr )
{
if( pCompr->inBuffPos < pCompr->inBuffRead )
return pCompr->inBuffer[ pCompr->inBuffPos++ ];
return ( UCHAR ) pCompr->inBuffer[ pCompr->inBuffPos++ ];
if( pCompr->hInput != FS_ERROR )
{
@@ -295,7 +295,7 @@ static int hb_LZSSxRead( PHB_LZSSX_COMPR pCompr )
pCompr->inBuffSize );
pCompr->inBuffPos = 0;
if( pCompr->inBuffPos < pCompr->inBuffRead )
return pCompr->inBuffer[ pCompr->inBuffPos++ ];
return ( UCHAR ) pCompr->inBuffer[ pCompr->inBuffPos++ ];
}
return -1;
}
@@ -325,12 +325,12 @@ static BOOL hb_LZSSxDecode( PHB_LZSSX_COMPR pCompr )
if( itemMask & 1 ) /* Is the next character normal byte ? */
{
if( ! hb_LZSSxWrite( pCompr, ( BYTE ) c ) )
if( ! hb_LZSSxWrite( pCompr, ( UCHAR ) c ) )
{
fResult = FALSE;
break;
}
pCompr->ring_buffer[ index ] = ( BYTE ) c;
pCompr->ring_buffer[ index ] = ( UCHAR ) c;
index = RBUFINDEX( index + 1 );
}
else /* we have an item pair (ring buffer offset : match length) */
@@ -345,7 +345,7 @@ static BOOL hb_LZSSxDecode( PHB_LZSSX_COMPR pCompr )
for( h = 0; h < length; h++ )
{
c = pCompr->ring_buffer[ RBUFINDEX( offset + h ) ];
if( ! hb_LZSSxWrite( pCompr, ( BYTE ) c ) )
if( ! hb_LZSSxWrite( pCompr, ( UCHAR ) c ) )
{
fResult = FALSE;
break;
@@ -354,7 +354,7 @@ static BOOL hb_LZSSxDecode( PHB_LZSSX_COMPR pCompr )
overwrite the ring buffer - we have to make exactly
the same or our results will be differ when
abs( offset - index ) < length */
pCompr->ring_buffer[ index ] = ( BYTE ) c;
pCompr->ring_buffer[ index ] = ( UCHAR ) c;
index = RBUFINDEX( index + 1 );
}
}
@@ -369,7 +369,7 @@ static BOOL hb_LZSSxDecode( PHB_LZSSX_COMPR pCompr )
static void hb_LZSSxNodeInsert( PHB_LZSSX_COMPR pCompr, int r )
{
int i, p, cmp;
unsigned char *key;
UCHAR *key;
cmp = 1;
key = &pCompr->ring_buffer[ r ];
@@ -464,8 +464,8 @@ static void hb_LZSSxNodeDelete( PHB_LZSSX_COMPR pCompr, int p )
static ULONG hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
{
BYTE itemSet[ITEMSETSIZE];
BYTE itemMask;
UCHAR itemSet[ITEMSETSIZE];
UCHAR itemMask;
ULONG ulSize = 0;
int iItem;
short int i, c, len, r, s, last_match_length;
@@ -484,7 +484,7 @@ static ULONG hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
{
if( ( c = hb_LZSSxRead( pCompr ) ) == -1 )
break;
pCompr->ring_buffer[ r + len ] = ( BYTE ) c;
pCompr->ring_buffer[ r + len ] = ( UCHAR ) c;
}
if( len == 0 )
return ulSize;
@@ -526,9 +526,9 @@ static ULONG hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
( c = hb_LZSSxRead( pCompr ) ) != -1; i++ )
{
hb_LZSSxNodeDelete( pCompr, s );
pCompr->ring_buffer[ s ] = ( BYTE ) c;
pCompr->ring_buffer[ s ] = ( UCHAR ) c;
if( s < MAXLENGTH - 1 )
pCompr->ring_buffer[ s + RBUFLENGTH ] = ( BYTE ) c;
pCompr->ring_buffer[ s + RBUFLENGTH ] = ( UCHAR ) c;
s = ( short int ) RBUFINDEX( s + 1 );
r = ( short int ) RBUFINDEX( r + 1 );
hb_LZSSxNodeInsert( pCompr, r );
@@ -560,15 +560,15 @@ static ULONG hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
}
BOOL hb_LZSSxCompressMem( BYTE * pSrcBuf, ULONG ulSrcLen,
BYTE * pDstBuf, ULONG ulDstLen,
BOOL hb_LZSSxCompressMem( const char * pSrcBuf, ULONG ulSrcLen,
char * pDstBuf, ULONG ulDstLen,
ULONG * pulSize )
{
PHB_LZSSX_COMPR pCompr;
ULONG ulSize;
pCompr = hb_LZSSxInit( FS_ERROR, pSrcBuf, ulSrcLen,
FS_ERROR, pDstBuf, ulDstLen );
pCompr = hb_LZSSxInit( FS_ERROR, ( BYTE * ) pSrcBuf, ulSrcLen,
FS_ERROR, ( BYTE * ) pDstBuf, ulDstLen );
ulSize = hb_LZSSxEncode( pCompr );
hb_LZSSxExit( pCompr );
if( pulSize )
@@ -576,14 +576,14 @@ BOOL hb_LZSSxCompressMem( BYTE * pSrcBuf, ULONG ulSrcLen,
return ( ulSize <= ulDstLen );
}
BOOL hb_LZSSxDecompressMem( BYTE * pSrcBuf, ULONG ulSrcLen,
BYTE * pDstBuf, ULONG ulDstLen )
BOOL hb_LZSSxDecompressMem( const char * pSrcBuf, ULONG ulSrcLen,
char * pDstBuf, ULONG ulDstLen )
{
PHB_LZSSX_COMPR pCompr;
BOOL fResult;
pCompr = hb_LZSSxInit( FS_ERROR, pSrcBuf, ulSrcLen,
FS_ERROR, pDstBuf, ulDstLen );
pCompr = hb_LZSSxInit( FS_ERROR, ( BYTE * ) pSrcBuf, ulSrcLen,
FS_ERROR, ( BYTE * ) pDstBuf, ulDstLen );
fResult = hb_LZSSxDecode( pCompr );
hb_LZSSxExit( pCompr );
return fResult;
@@ -680,7 +680,8 @@ HB_FUNC( SX_FDECOMPRESS )
HB_FUNC( _SX_STRCOMPRESS )
{
BYTE * pStr = ( BYTE * ) hb_parc( 1 ), * pBuf;
const char * pStr = hb_parc( 1 );
char * pBuf;
if( pStr )
{
@@ -688,7 +689,7 @@ HB_FUNC( _SX_STRCOMPRESS )
/* this is for strict SIX compatibility - in general very bad idea */
ulBuf = ulLen + 257;
pBuf = ( BYTE * ) hb_xgrab( ulBuf );
pBuf = ( char * ) hb_xgrab( ulBuf );
HB_PUT_LE_UINT32( pBuf, ulLen );
if( ! hb_LZSSxCompressMem( pStr, ulLen, pBuf + 4, ulBuf - 4, &ulDst ) )
{
@@ -697,7 +698,7 @@ HB_FUNC( _SX_STRCOMPRESS )
memcpy( pBuf + 4, pStr, ulLen );
ulDst = ulLen;
}
hb_retclen( ( char * ) pBuf, ulDst + 4 );
hb_retclen( pBuf, ulDst + 4 );
hb_xfree( pBuf );
}
else
@@ -707,7 +708,8 @@ HB_FUNC( _SX_STRCOMPRESS )
HB_FUNC( _SX_STRDECOMPRESS )
{
BOOL fOK = FALSE;
BYTE * pStr = ( BYTE * ) hb_parc( 1 ), * pBuf;
const char * pStr = hb_parc( 1 );
char * pBuf;
if( pStr )
{
@@ -718,17 +720,17 @@ HB_FUNC( _SX_STRDECOMPRESS )
ulBuf = HB_GET_LE_UINT32( pStr );
if( ulBuf == HB_SX_UNCOMPRESED )
{
hb_retclen( ( char * ) pStr + 4, ulLen - 4 );
hb_retclen( pStr + 4, ulLen - 4 );
fOK = TRUE;
}
else
{
pBuf = ( BYTE * ) hb_xalloc( ulBuf + 1 );
pBuf = ( char * ) hb_xalloc( ulBuf + 1 );
if( pBuf )
{
fOK = hb_LZSSxDecompressMem( pStr + 4, ulLen - 4, pBuf, ulBuf );
if( fOK )
hb_retclen_buffer( ( char * ) pBuf, ulBuf );
hb_retclen_buffer( pBuf, ulBuf );
else
hb_xfree( pBuf );
}

View File

@@ -60,7 +60,7 @@
#define rnd_mul1 0x0de6d
#define rnd_mul2 0x0278d
static UINT32 hb_sxInitSeed( BYTE * pKeyVal, UINT16 * puiKey )
static UINT32 hb_sxInitSeed( const char * pKeyVal, UINT16 * puiKey )
{
UINT32 ulSeed = 0;
int i;
@@ -75,7 +75,7 @@ static UINT32 hb_sxInitSeed( BYTE * pKeyVal, UINT16 * puiKey )
return ( ulSeed << 16 ) + ( ulSeed >> 16 );
}
static UINT32 hb_sxNextSeed( UINT32 ulSeed, BYTE * pKeyVal, UINT16 * puiKey )
static UINT32 hb_sxNextSeed( UINT32 ulSeed, const char * pKeyVal, UINT16 * puiKey )
{
UINT32 ulTemp1, ulTemp2;
UINT16 uiSeedLo, uiSeedHi;
@@ -92,48 +92,48 @@ static UINT32 hb_sxNextSeed( UINT32 ulSeed, BYTE * pKeyVal, UINT16 * puiKey )
return ulSeed;
}
void hb_sxEnCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen )
void hb_sxEnCrypt( const char * pSrc, char * pDst, const char * pKeyVal, ULONG ulLen )
{
UINT32 ulSeed;
UINT16 uiKey;
BYTE uChar, uShft;
UCHAR ucChar, ucShft;
ULONG ul;
int i;
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
for( ul = 0, i = 0; ul < ulLen; ul++ )
{
uChar = pSrc[ul];
uShft = uiKey & 0x07;
pDst[ul] = ( uChar >> uShft ) + ( uChar << ( 8 - uShft ) ) +
( uiKey & 0xFF );
ucChar = ( UCHAR ) pSrc[ul];
ucShft = ( UCHAR ) ( uiKey & 0x07 );
pDst[ul] = ( ( ucChar >> ucShft ) + ( ucChar << ( 8 - ucShft ) ) +
( uiKey & 0xFF ) );
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[i], &uiKey );
if( ++i == 7 )
i = 0;
}
}
void hb_sxDeCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen )
void hb_sxDeCrypt( const char * pSrc, char * pDst, const char * pKeyVal, ULONG ulLen )
{
UINT32 ulSeed;
UINT16 uiKey;
BYTE uChar, uShft;
UCHAR ucChar, ucShft;
ULONG ul;
int i;
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
for( ul = 0, i = 0; ul < ulLen; ul++ )
{
uChar = pSrc[ul] - ( uiKey & 0xFF );
uShft = uiKey & 0x07;
pDst[ul] = ( uChar << uShft ) + ( uChar >> ( 8 - uShft ) );
ucChar = ( UCHAR ) pSrc[ul] - ( uiKey & 0xFF );
ucShft = ( UCHAR ) ( uiKey & 0x07 );
pDst[ul] = ( ( ucChar << ucShft ) + ( ucChar >> ( 8 - ucShft ) ) );
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[i], &uiKey );
if( ++i == 7 )
i = 0;
}
}
static BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, BYTE * pKeyVal )
static BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, char * pKeyVal )
{
BOOL fResult = FALSE;
PHB_ITEM pItem = NULL;
@@ -168,15 +168,15 @@ HB_FUNC( SX_ENCRYPT )
{
if( hb_pcount() > 0 )
{
BYTE keyBuf[ 8 ];
char keyBuf[ 8 ];
ULONG ulLen = hb_parclen( 1 );
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
{
BYTE * pDst = ( BYTE * ) hb_xgrab( ulLen + 1 );
hb_sxEnCrypt( ( BYTE * ) hb_parc( 1 ), pDst, keyBuf, ulLen );
char * pDst = ( char * ) hb_xgrab( ulLen + 1 );
hb_sxEnCrypt( hb_parc( 1 ), pDst, keyBuf, ulLen );
pDst[ ulLen ] = 0;
hb_retclen_buffer( ( char * ) pDst, ulLen );
hb_retclen_buffer( pDst, ulLen );
}
else
{
@@ -189,15 +189,15 @@ HB_FUNC( SX_DECRYPT )
{
if( hb_pcount() > 0 )
{
BYTE keyBuf[ 8 ];
char keyBuf[ 8 ];
ULONG ulLen = hb_parclen( 1 );
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
{
BYTE * pDst = ( BYTE * ) hb_xgrab( ulLen + 1 );
hb_sxDeCrypt( ( BYTE * ) hb_parc( 1 ), pDst, keyBuf, ulLen );
char * pDst = ( char * ) hb_xgrab( ulLen + 1 );
hb_sxDeCrypt( hb_parc( 1 ), pDst, keyBuf, ulLen );
pDst[ ulLen ] = 0;
hb_retclen_buffer( ( char * ) pDst, ulLen );
hb_retclen_buffer( pDst, ulLen );
}
else
{

View File

@@ -327,7 +327,7 @@ typedef struct _HSXINFO
BOOL fHdrChanged; /* new records, header file has to be updated */
BOOL fWrLocked; /* the index is locked for writing */
BYTE * pSearchVal; /* current search value for HS_NEXT */
char * pSearchVal; /* current search value for HS_NEXT */
ULONG ulSearch; /* the length of search value */
BYTE * pSearchKey; /* current search key val for HS_NEXT */
ULONG ulCurrRec; /* current record for HS_NEXT */
@@ -388,7 +388,7 @@ static HB_CRITICAL_NEW( s_hsxMtx );
#endif
/* the conversion table for ASCII alpha pairs */
static const BYTE hb_hsxHashArray[] = {
static const UCHAR hb_hsxHashArray[] = {
/* A B C D E F G H I J K L M N O P Q R S T U W V X Y Z */
/* A */ 7,102,222,185, 19, 48,167, 4,173, 4, 79,251,194,250, 7,187, 7,251,209,249, 41,101, 39, 29, 71, 40,
/* B */ 156, 3, 7, 7,149, 7, 7, 7,172, 7, 7,100, 7, 7,148, 7, 7,107, 38, 7,126, 7, 7, 7, 7, 7,
@@ -428,8 +428,8 @@ static int hb_hsxHashVal( int c1, int c2, int iKeyBits,
PHB_CODEPAGE cdp;
if( iFilter == 3 && ( cdp = hb_vmCDP() )->nChars )
{
c1 = ( BYTE ) cdp->s_upper[ c1 ];
c2 = ( BYTE ) cdp->s_upper[ c2 ];
c1 = ( UCHAR ) cdp->s_upper[ c1 ];
c2 = ( UCHAR ) cdp->s_upper[ c2 ];
}
else
#endif
@@ -463,7 +463,7 @@ static int hb_hsxHashVal( int c1, int c2, int iKeyBits,
return iBitNum;
}
static void hb_hsxHashStr( BYTE * pStr, ULONG ulLen, BYTE * pKey, int iKeySize,
static void hb_hsxHashStr( const char * pStr, ULONG ulLen, BYTE * pKey, int iKeySize,
BOOL fNoCase, int iFilter, BOOL fUseHash )
{
int c1, c2, iBitNum, iKeyBits = iKeySize << 3;
@@ -472,18 +472,18 @@ static void hb_hsxHashStr( BYTE * pStr, ULONG ulLen, BYTE * pKey, int iKeySize,
#if 0
/* This code keeps the strict CFTS behavior which stops string
manipulating at first chr(0) character */
if( pStr && ulLen-- && ( c1 = *pStr++ ) != 0 )
if( pStr && ulLen-- && ( c1 = ( UCHAR ) *pStr++ ) != 0 )
{
while( ulLen-- && ( c2 = *pStr++ ) != 0 )
while( ulLen-- && ( c2 = ( UCHAR ) *pStr++ ) != 0 )
{
#else
/* This version can work well with embedded 0 characters */
if( pStr && ulLen-- )
{
c1 = *pStr++;
c1 = ( UCHAR ) *pStr++;
while( ulLen-- )
{
c2 = *pStr++;
c2 = ( UCHAR ) *pStr++;
#endif
iBitNum = hb_hsxHashVal( c1, c2, iKeyBits, fNoCase, iFilter, fUseHash );
if( iBitNum-- )
@@ -495,11 +495,11 @@ static void hb_hsxHashStr( BYTE * pStr, ULONG ulLen, BYTE * pKey, int iKeySize,
}
}
static int hb_hsxStrCmp( BYTE * pSub, ULONG ulSub, BYTE * pStr, ULONG ulLen,
static int hb_hsxStrCmp( const char * pSub, ULONG ulSub, const char * pStr, ULONG ulLen,
BOOL fNoCase, int iFilter )
{
BOOL fResult = FALSE;
BYTE c1, c2;
UCHAR c1, c2;
ULONG ul;
if( ulSub == 0 )
@@ -510,16 +510,16 @@ static int hb_hsxStrCmp( BYTE * pSub, ULONG ulSub, BYTE * pStr, ULONG ulLen,
fResult = TRUE;
for( ul = 0; fResult && ul < ulSub; ul++ )
{
c1 = pSub[ ul ];
c2 = pStr[ ul ];
c1 = ( UCHAR ) pSub[ ul ];
c2 = ( UCHAR ) pStr[ ul ];
if( fNoCase )
{
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdp;
if( iFilter == 3 && ( cdp = hb_vmCDP() )->nChars )
{
c1 = ( BYTE ) cdp->s_upper[ c1 ];
c2 = ( BYTE ) cdp->s_upper[ c2 ];
c1 = ( UCHAR ) cdp->s_upper[ c1 ];
c2 = ( UCHAR ) cdp->s_upper[ c2 ];
}
else
#endif
@@ -593,7 +593,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, BYTE *pKey, BOOL *fDeleted )
{
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
int iResult = HSX_SUCCESS;
BYTE * pStr;
const char * pStr;
ULONG ulLen;
if( ! pHSX )
@@ -607,7 +607,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, BYTE *pKey, BOOL *fDeleted )
if( hb_itemType( pExpr ) & HB_IT_STRING )
{
pStr = ( BYTE * ) hb_itemGetCPtr( pExpr );
pStr = hb_itemGetCPtr( pExpr );
ulLen = hb_itemGetCLen( pExpr );
if( fDeleted )
*fDeleted = FALSE;
@@ -626,7 +626,7 @@ static int hb_hsxEval( int iHandle, PHB_ITEM pExpr, BYTE *pKey, BOOL *fDeleted )
iArea = 0;
}
pItem = hb_vmEvalBlockOrMacro( pExpr );
pStr = ( BYTE * ) hb_itemGetCPtr( pItem );
pStr = hb_itemGetCPtr( pItem );
ulLen = hb_itemGetCLen( pItem );
if( fDeleted )
{
@@ -1143,7 +1143,7 @@ static int hb_hsxAdd( int iHandle, ULONG *pulRecNo, PHB_ITEM pExpr, BOOL fDelete
return iRetVal;
}
static int hb_hsxSeekSet( int iHandle, BYTE * pStr, ULONG ulLen )
static int hb_hsxSeekSet( int iHandle, const char * pStr, ULONG ulLen )
{
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
int iRetVal;
@@ -1160,7 +1160,7 @@ static int hb_hsxSeekSet( int iHandle, BYTE * pStr, ULONG ulLen )
{
if( pHSX->pSearchVal )
hb_xfree( pHSX->pSearchVal );
pHSX->pSearchVal = ( BYTE * ) hb_xgrab( ulLen + 1 );
pHSX->pSearchVal = ( char * ) hb_xgrab( ulLen + 1 );
memcpy( pHSX->pSearchVal, pStr, ulLen );
pHSX->pSearchVal[ ulLen ] = '\0';
pHSX->ulSearch = ulLen;
@@ -1267,8 +1267,8 @@ static void hb_hsxExpDestroy( PHB_ITEM pItem )
hb_itemRelease( pItem );
}
static int hb_hsxVerify( int iHandle, BYTE * szText, ULONG ulLen,
BYTE * szSub, ULONG ulSub, int iType )
static int hb_hsxVerify( int iHandle, const char * szText, ULONG ulLen,
const char * szSub, ULONG ulSub, int iType )
{
LPHSXINFO pHSX = hb_hsxGetPointer( iHandle );
int iResult;
@@ -1604,7 +1604,7 @@ static int hb_hsxIndex( const char * szFile, PHB_ITEM pExpr, int iKeySize,
return hb_hsxOpen( szFile, iBufSize, iMode );
}
static int hb_hsxFilter( int iHandle, BYTE * pSeek, ULONG ulSeek,
static int hb_hsxFilter( int iHandle, const char * pSeek, ULONG ulSeek,
PHB_ITEM pVerify, int iVerifyType )
{
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
@@ -1661,7 +1661,7 @@ static int hb_hsxFilter( int iHandle, BYTE * pSeek, ULONG ulSeek,
if( errCode == HB_FAILURE )
break;
fValid = hb_hsxVerify( iHandle,
( BYTE * ) hb_itemGetCPtr( pArea->valResult ),
hb_itemGetCPtr( pArea->valResult ),
hb_itemGetCLen( pArea->valResult ),
pSeek, ulSeek, iVerifyType ) == HSX_SUCCESS;
}
@@ -1824,7 +1824,7 @@ HB_FUNC( HS_KEYCOUNT )
Sets up parameters for a subsequent hs_Next() call */
HB_FUNC( HS_SET )
{
BYTE * pStr = ( BYTE * ) hb_parc( 2 );
const char * pStr = hb_parc( 2 );
int iRetVal = HSX_BADPARMS;
if( pStr && hb_param( 1, HB_IT_NUMERIC ) )
@@ -1836,7 +1836,8 @@ HB_FUNC( HS_SET )
Sets a WA RM filter using a HiPer-SEEK index */
HB_FUNC( HS_FILTER )
{
BYTE * szText = ( BYTE * ) hb_parc( 2 ), * pBuff = NULL;
const char * szText = hb_parc( 2 );
char * pBuff = NULL;
ULONG ulLen = hb_parclen( 2 ), ulRecords = 0, ull, ul;
int iHandle = -1, iResult = HSX_BADPARMS;
BOOL fNew = FALSE, fToken = TRUE;
@@ -1867,7 +1868,7 @@ HB_FUNC( HS_FILTER )
ulLen = pHSX->ulSearch;
if( ulLen && pHSX->pSearchVal )
{
pBuff = ( BYTE * ) hb_xgrab( ulLen + 1 );
pBuff = ( char * ) hb_xgrab( ulLen + 1 );
memcpy( pBuff, pHSX->pSearchVal, ulLen );
pBuff[ ulLen ] = '\0';
szText = pBuff;
@@ -1962,7 +1963,7 @@ HB_FUNC( HS_VERIFY )
{
int iHandle = hb_parni( 1 );
PHB_ITEM pExpr = hb_param( 2, HB_IT_BLOCK );
BYTE * szText = NULL;
const char * szText = NULL;
ULONG ulLen = 0;
LPHSXINFO pHSX;
@@ -1982,18 +1983,18 @@ HB_FUNC( HS_VERIFY )
}
if( pExpr )
{
szText = ( BYTE * ) hb_itemGetCPtr( pExpr );
szText = hb_itemGetCPtr( pExpr );
ulLen = hb_itemGetCLen( pExpr );
}
hb_retni( hb_hsxVerify( hb_parni( 1 ), szText, ulLen,
( BYTE * ) hb_parc( 3 ), hb_parclen( 3 ),
hb_parc( 3 ), hb_parclen( 3 ),
hb_parni( 4 ) ) );
}
else
{
PHB_ITEM pExpr = hb_param( 1, HB_IT_BLOCK );
BYTE * szSub = ( BYTE * ) hb_parc( 2 ), * szText = NULL;
const char * szSub = hb_parc( 2 ), * szText = NULL;
ULONG ulSub = hb_parclen( 2 ), ulLen = 0;
BOOL fIgnoreCase = hb_parl( 3 );
@@ -2003,7 +2004,7 @@ HB_FUNC( HS_VERIFY )
if( pExpr )
{
szText = ( BYTE * ) hb_itemGetCPtr( pExpr );
szText = hb_itemGetCPtr( pExpr );
ulLen = hb_itemGetCLen( pExpr );
}
}

View File

@@ -502,12 +502,14 @@ void hb_cdpTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut )
{
char * ptr;
ptr = strchr( cdpIn->CharsUpper, *psz );
/* ( char * ) casting for MSVC */
ptr = strchr( ( char * ) cdpIn->CharsUpper, *psz );
if( ptr )
*psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ];
else
{
ptr = strchr( cdpIn->CharsLower, *psz );
/* ( char * ) casting for MSVC */
ptr = strchr( ( char * ) cdpIn->CharsLower, *psz );
if( ptr )
*psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ];
}
@@ -544,12 +546,14 @@ void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG
{
char * ptr;
ptr = strchr( cdpIn->CharsUpper, *psz );
/* ( char * ) casting for MSVC */
ptr = strchr( ( char * ) cdpIn->CharsUpper, *psz );
if( ptr )
*psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ];
else
{
ptr = strchr( cdpIn->CharsLower, *psz );
/* ( char * ) casting for MSVC */
ptr = strchr( ( char * ) cdpIn->CharsLower, *psz );
if( ptr )
*psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ];
}
@@ -1520,7 +1524,7 @@ HB_FUNC( HB_UTF8LEN )
const char *szString = hb_parc( 1 );
if( szString )
hb_retnint( hb_cdpUTF8StringLength( ( BYTE * ) szString, hb_parclen( 1 ) ) );
hb_retnint( hb_cdpUTF8StringLength( ( const BYTE * ) szString, hb_parclen( 1 ) ) );
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}

View File

@@ -643,7 +643,7 @@ static int hb_gt_dos_mouse_StorageSize( PHB_GT pGT )
return iSize;
}
static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, BYTE * pBuffer )
static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, char * pBuffer )
{
if( s_fMousePresent )
{
@@ -680,7 +680,7 @@ static void hb_gt_dos_mouse_SaveState( PHB_GT pGT, BYTE * pBuffer )
}
}
static void hb_gt_dos_mouse_RestoreState( PHB_GT pGT, const BYTE * pBuffer )
static void hb_gt_dos_mouse_RestoreState( PHB_GT pGT, const char * pBuffer )
{
if( s_fMousePresent )
{

View File

@@ -59,7 +59,7 @@
#define BASE 65521 /* largest prime smaller than 65536 */
#define NMAX 5552 /* largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
ULONG hb_adler32( ULONG adler, const BYTE *buf, ULONG len )
ULONG hb_adler32( ULONG adler, const char *buf, ULONG len )
{
ULONG s1 = adler & 0xffff;
ULONG s2 = ( adler >> 16 ) & 0xffff;
@@ -90,7 +90,7 @@ HB_FUNC( HB_ADLER32 )
const char * szString = hb_parc( 1 );
if( szString )
hb_retnint( hb_adler32( ( ULONG ) hb_parnl( 2 ), ( BYTE * ) szString, hb_parclen( 1 ) ) );
hb_retnint( hb_adler32( ( ULONG ) hb_parnl( 2 ), szString, hb_parclen( 1 ) ) );
else
hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}

View File

@@ -149,31 +149,31 @@ static const ULONG crc16_tab[] =
};
ULONG hb_crc32( ULONG crc, const BYTE *buf, ULONG len )
ULONG hb_crc32( ULONG crc, const char *buf, ULONG len )
{
crc ^= 0xffffffffL;
if( buf && len )
{
do
crc = crc32_tab[ ( crc ^ *buf++ ) & 0xFF ] ^ ( crc >> 8 );
crc = crc32_tab[ ( crc ^ ( UCHAR ) *buf++ ) & 0xFF ] ^ ( crc >> 8 );
while( --len );
}
return crc ^ 0xffffffffL;
}
ULONG hb_crc16( ULONG crc, const BYTE *buf, ULONG len )
ULONG hb_crc16( ULONG crc, const char *buf, ULONG len )
{
crc ^= 0xffff;
if( buf && len )
{
do
crc = crc16_tab[ ( crc ^ *buf++ ) & 0xFF ] ^ ( crc >> 8 );
crc = crc16_tab[ ( crc ^ ( UCHAR ) *buf++ ) & 0xFF ] ^ ( crc >> 8 );
while( --len );
}
return crc ^ 0xffff;
}
HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly )
HB_ULONG hb_crc( HB_ULONG crc, const char * buf, ULONG len, HB_ULONG poly )
{
if( buf && len )
{
@@ -190,7 +190,7 @@ HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly )
crc ^= --mask;
do
{
HB_ULONG b = ( crc ^ ( UCHAR ) * buf++ ) & 0xFF;
HB_ULONG b = ( crc ^ ( UCHAR ) *buf++ ) & 0xFF;
int i = 8;
do
b = b & 1 ? revp ^ ( b >> 1 ) : b >> 1;
@@ -203,7 +203,7 @@ HB_ULONG hb_crc( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly )
return crc;
}
HB_ULONG hb_crcct( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly )
HB_ULONG hb_crcct( HB_ULONG crc, const char * buf, ULONG len, HB_ULONG poly )
{
if( buf && len )
{
@@ -217,7 +217,7 @@ HB_ULONG hb_crcct( HB_ULONG crc, const BYTE * buf, ULONG len, HB_ULONG poly )
do
{
int i = 8;
crc ^= ( HB_ULONG ) * buf++ << bits;
crc ^= ( HB_ULONG ) ( ( UCHAR ) *buf++ ) << bits;
do
crc = crc & mask ? poly ^ ( crc << 1 ) : crc << 1;
while( --i );
@@ -233,7 +233,7 @@ HB_FUNC( HB_CRC32 )
const char * szString = hb_parc( 1 );
if( szString )
hb_retnint( hb_crc32( ( ULONG ) hb_parnl( 2 ), ( BYTE * ) szString, hb_parclen( 1 ) ) );
hb_retnint( hb_crc32( ( ULONG ) hb_parnl( 2 ), szString, hb_parclen( 1 ) ) );
else
hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
@@ -243,7 +243,7 @@ HB_FUNC( HB_CRC16 )
const char * szString = hb_parc( 1 );
if( szString )
hb_retnint( hb_crc16( ( ULONG ) hb_parnl( 2 ), ( BYTE * ) szString, hb_parclen( 1 ) ) );
hb_retnint( hb_crc16( ( ULONG ) hb_parnl( 2 ), szString, hb_parclen( 1 ) ) );
else
hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
@@ -257,7 +257,7 @@ HB_FUNC( HB_CRC )
HB_ULONG ulPolynomial = ( HB_ULONG ) hb_parnint( 3 );
if( ulPolynomial == 0 )
ulPolynomial = 0x11021;
hb_retnint( hb_crc( ( HB_ULONG ) hb_parnint( 2 ), ( BYTE * ) szString, hb_parclen( 1 ), ulPolynomial ) );
hb_retnint( hb_crc( ( HB_ULONG ) hb_parnint( 2 ), szString, hb_parclen( 1 ), ulPolynomial ) );
}
else
hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
@@ -272,7 +272,7 @@ HB_FUNC( HB_CRCCT )
HB_ULONG ulPolynomial = ( HB_ULONG ) hb_parnint( 3 );
if( ulPolynomial == 0 )
ulPolynomial = 0x11021;
hb_retnint( hb_crcct( ( HB_ULONG ) hb_parnint( 2 ), ( BYTE * ) szString, hb_parclen( 1 ), ulPolynomial ) );
hb_retnint( hb_crcct( ( HB_ULONG ) hb_parnint( 2 ), szString, hb_parclen( 1 ), ulPolynomial ) );
}
else
hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );

View File

@@ -2686,7 +2686,7 @@ static int hb_gt_def_mouseStorageSize( PHB_GT pGT )
return sizeof( _HB_MOUSE_STORAGE );
}
static void hb_gt_def_mouseSaveState( PHB_GT pGT, BYTE * pBuffer )
static void hb_gt_def_mouseSaveState( PHB_GT pGT, char * pBuffer )
{
_HB_MOUSE_STORAGE * pStore = ( _HB_MOUSE_STORAGE * ) pBuffer;
int iRow, iCol, iTop, iLeft, iBottom, iRight;
@@ -2703,7 +2703,7 @@ static void hb_gt_def_mouseSaveState( PHB_GT pGT, BYTE * pBuffer )
pStore->iRight = iRight;
}
static void hb_gt_def_mouseRestoreState( PHB_GT pGT, const BYTE * pBuffer )
static void hb_gt_def_mouseRestoreState( PHB_GT pGT, const char * pBuffer )
{
_HB_MOUSE_STORAGE * pStore = ( _HB_MOUSE_STORAGE * ) pBuffer;

View File

@@ -372,7 +372,7 @@ static PHB_ITEM hb_i18n_serialize( PHB_I18N_TRANS pI18N )
char * pI18Nbuffer;
PHB_ITEM pKey, pValue;
ulCRC = hb_crc32( 0, ( const BYTE * ) pBuffer, ulSize );
ulCRC = hb_crc32( 0, pBuffer, ulSize );
pI18Nbuffer = ( char * ) memset( hb_xgrab( ulSize + HB_I18N_HEADER_SIZE + 1 ),
0, HB_I18N_HEADER_SIZE );
memcpy( pI18Nbuffer + HB_I18N_HEADER_SIZE, pBuffer, ulSize );
@@ -404,8 +404,7 @@ static BOOL hb_i18n_headercheck( const char * pBuffer, ULONG ulLen )
( ulLen == 0 ||
( HB_GET_LE_UINT32( &pBuffer[ HB_I18N_SIZE_OFFSET ] ) == ulLen &&
HB_GET_LE_UINT32( &pBuffer[ HB_I18N_CRC_OFFSET ] ) ==
hb_crc32( 0, ( const BYTE * ) pBuffer + HB_I18N_HEADER_SIZE,
ulLen ) ) );
hb_crc32( 0, pBuffer + HB_I18N_HEADER_SIZE, ulLen ) ) );
}
static PHB_I18N_TRANS hb_i18n_deserialize( PHB_ITEM pItem )

View File

@@ -79,14 +79,14 @@ PRG functions:
C functions:
void hb_md5( BYTE * data, ULONG datalen, BYTE * digest )
void hb_md5( const char * data, ULONG datalen, char * digest )
Parameters:
data - input byte stream
datalen - input stream length
digest - raw (unformatted) MD5 digest buffer
(at least 16 bytes long)
void hb_md5file( HB_FHANDLE hFile, BYTE * digest )
void hb_md5file( HB_FHANDLE hFile, char * digest )
Parameters:
hFile - file handle
digest - raw (unformatted) MD5 digest buffer
@@ -250,31 +250,31 @@ static void hb_md5accinit( UINT32 accum[] )
accum[ 3 ] = 0x10325476;
}
static void hb_md5val( UINT32 accum[], BYTE * md5val )
static void hb_md5val( UINT32 accum[], char * md5val )
{
int i, n;
for( i = 0; i < 4; i++ )
{
for( n = 0; n < 4; n++ )
*md5val++ = ( BYTE ) ( ( accum[ i ] >> ( n << 3 ) ) & 0xFF );
*md5val++ = ( char ) ( ( accum[ i ] >> ( n << 3 ) ) & 0xFF );
}
}
static void hb_md5digest( BYTE * md5val, char * digest )
static void hb_md5digest( const char * md5val, char * digest )
{
int i, b;
for( i = 0; i < 16; i++ )
{
b = ( md5val[ i ] >> 4 ) & 0x0F;
b = ( ( UCHAR ) md5val[ i ] >> 4 ) & 0x0F;
*digest++ = ( char ) ( b + ( b > 9 ? 'a' - 10 : '0' ) );
b = md5val[ i ] & 0x0F;
b = ( UCHAR ) md5val[ i ] & 0x0F;
*digest++ = ( char ) ( b + ( b > 9 ? 'a' - 10 : '0' ) );
}
}
void hb_md5( BYTE * ucData, ULONG ulLen, BYTE * ucDigest )
void hb_md5( const char * ucData, ULONG ulLen, char * ucDigest )
{
UCHAR buf[ 128 ];
MD5_BUF md5;
@@ -316,16 +316,17 @@ void hb_md5( BYTE * ucData, ULONG ulLen, BYTE * ucDigest )
hb_md5val( md5.accum, ucDigest );
}
void hb_md5file( HB_FHANDLE hFile, BYTE * ucDigest )
void hb_md5file( HB_FHANDLE hFile, char * ucDigest )
{
MD5_BUF md5;
ULONG n;
int i;
HB_FOFFSET flen = 0;
UCHAR buf[ 128 ], * readbuf = ( UCHAR * ) hb_xgrab( MAX_FBUF );
UCHAR buf[ 128 ];
BYTE * readbuf = ( BYTE * ) hb_xgrab( MAX_FBUF );
hb_md5accinit( md5.accum );
n = hb_fsReadLarge( hFile, ( BYTE * ) readbuf, MAX_FBUF );
n = hb_fsReadLarge( hFile, readbuf, MAX_FBUF );
flen += n;
while( n == MAX_FBUF )
{
@@ -334,7 +335,7 @@ void hb_md5file( HB_FHANDLE hFile, BYTE * ucDigest )
memcpy( md5.buf, readbuf + ( i << 6 ), 64 );
hb_md5go( &md5 );
}
n = hb_fsReadLarge( hFile, ( BYTE * ) readbuf, MAX_FBUF );
n = hb_fsReadLarge( hFile, readbuf, MAX_FBUF );
flen += n;
}
hb_fsClose( hFile );
@@ -376,10 +377,10 @@ HB_FUNC( HB_MD5 )
if( pszStr )
{
ULONG ulLen = hb_parclen( 1 );
BYTE dststr[ 16 ];
char dststr[ 16 ];
char digest[ 33 ];
hb_md5( ( BYTE * ) pszStr, ulLen, dststr );
hb_md5( pszStr, ulLen, dststr );
hb_md5digest( dststr, digest );
hb_retclen( digest, 32 );
}
@@ -397,7 +398,7 @@ HB_FUNC( HB_MD5FILE )
if( hFile != FS_ERROR )
{
BYTE dststr[ 16 ];
char dststr[ 16 ];
char digest[ 33 ];
hb_md5file( hFile, dststr );

View File

@@ -66,9 +66,10 @@ BOOL hb_charIsAlpha( int iChar )
else
{
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && iChar &&
( strchr( cdp->CharsUpper, iChar ) ||
strchr( cdp->CharsLower, iChar ) ) )
( strchr( ( char * ) cdp->CharsUpper, iChar ) ||
strchr( ( char * ) cdp->CharsLower, iChar ) ) )
return TRUE;
}
#endif
@@ -84,8 +85,9 @@ BOOL hb_charIsLower( int iChar )
else
{
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && iChar &&
strchr( cdp->CharsUpper, iChar ) )
strchr( ( char * ) cdp->CharsUpper, iChar ) )
return TRUE;
}
#endif
@@ -101,8 +103,9 @@ BOOL hb_charIsUpper( int iChar )
else
{
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && iChar &&
strchr( cdp->CharsLower, iChar ) )
strchr( ( char * ) cdp->CharsLower, iChar ) )
return TRUE;
}
#endif
@@ -124,9 +127,10 @@ HB_FUNC( ISALPHA )
{
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && szString[ 0 ] &&
( strchr( cdp->CharsUpper, *szString ) ||
strchr( cdp->CharsLower, *szString ) ) )
( strchr( ( char * ) cdp->CharsUpper, *szString ) ||
strchr( ( char * ) cdp->CharsLower, *szString ) ) )
hb_retl( TRUE );
else
#endif
@@ -160,8 +164,9 @@ HB_FUNC( ISUPPER )
{
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && szString[ 0 ] &&
strchr( cdp->CharsUpper, *szString ) )
strchr( ( char * ) cdp->CharsUpper, *szString ) )
hb_retl( TRUE );
else
#endif
@@ -186,8 +191,9 @@ HB_FUNC( ISLOWER )
{
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdp = hb_vmCDP();
/* ( char * ) casting for MSVC */
if( cdp && cdp->nChars && szString[ 0 ] &&
strchr( cdp->CharsLower, *szString ) )
strchr( ( char * ) cdp->CharsLower, *szString ) )
hb_retl( TRUE );
else
#endif

View File

@@ -141,10 +141,10 @@ HB_FUNC( MSAVESTATE )
if( iLen > 0 )
{
BYTE * pBuffer = ( BYTE * ) hb_xgrab( iLen + 1 );
char * pBuffer = ( char * ) hb_xgrab( iLen + 1 );
hb_mouseSaveState( pBuffer );
hb_retclen_buffer( ( char * ) pBuffer, iLen );
hb_retclen_buffer( pBuffer, iLen );
}
else
hb_retc( NULL );
@@ -154,7 +154,7 @@ HB_FUNC( MRESTSTATE )
{
if( HB_ISCHAR( 1 ) && hb_parclen( 1 ) == ( ULONG ) hb_mouseStorageSize() )
{
hb_mouseRestoreState( ( const BYTE * ) hb_parc( 1 ) );
hb_mouseRestoreState( hb_parc( 1 ) );
}
}

View File

@@ -220,7 +220,7 @@ int hb_mouseStorageSize( void )
return iSize;
}
void hb_mouseSaveState( BYTE * pBuffer )
void hb_mouseSaveState( char * pBuffer )
{
PHB_GT pGT;
@@ -234,7 +234,7 @@ void hb_mouseSaveState( BYTE * pBuffer )
}
}
void hb_mouseRestoreState( const BYTE * pBuffer )
void hb_mouseRestoreState( const char * pBuffer )
{
PHB_GT pGT;