2010-02-07 13:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbct/ctchksum.c
    ! Fixed to not strip const from type.
    * ULONG -> HB_SIZE, HB_U32
    * UCHAR -> HB_UCHAR

  * contrib/hbct/asciisum.c
    * size_t -> HB_SIZE
    * Formatting.
This commit is contained in:
Viktor Szakats
2010-02-07 12:58:41 +00:00
parent 11f39645d2
commit 85ac3af0f1
3 changed files with 20 additions and 15 deletions

View File

@@ -17,6 +17,16 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-07 13:58 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbct/ctchksum.c
! Fixed to not strip const from type.
* ULONG -> HB_SIZE, HB_U32
* UCHAR -> HB_UCHAR
* contrib/hbct/asciisum.c
* size_t -> HB_SIZE
* Formatting.
2010-02-07 13:16 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/vm/fm.c
* src/vm/extrap.c

View File

@@ -96,16 +96,15 @@
HB_FUNC( ASCIISUM )
{
if( HB_ISCHAR( 1 ) )
{
size_t sStrSize = hb_parclen( 1 );
const char *pcString = hb_parc( 1 );
size_t sPos;
const char * pcString = hb_parc( 1 );
HB_SIZE sStrSize = hb_parclen( 1 );
HB_SIZE sPos;
ULONG ulResult = 0;
for( sPos = 0; sPos < sStrSize; sPos++ )
ulResult += ( ULONG ) pcString[sPos];
ulResult += ( ULONG ) pcString[ sPos ];
hb_retnl( ulResult );
}
@@ -122,12 +121,8 @@ HB_FUNC( ASCIISUM )
}
if( pSubst != NULL )
{
hb_itemReturnRelease( pSubst );
}
else
{
hb_retni( 0 );
}
}
}

View File

@@ -54,13 +54,13 @@
HB_FUNC( CHECKSUM )
{
UCHAR *pbyString = ( UCHAR * ) hb_parc( 1 );
ULONG ulLen = hb_parclen( 1 );
ULONG ulPos;
ULONG ulResult = 0;
const HB_UCHAR * pbyString = ( const HB_UCHAR * ) hb_parc( 1 );
HB_SIZE ulLen = hb_parclen( 1 );
HB_SIZE ulPos;
HB_U32 ulResult = 0;
for( ulPos = 0; ulPos < ulLen; ulPos++ )
ulResult += pbyString[ulPos] | ( pbyString[ulPos + 1] << 8 );
ulResult += pbyString[ ulPos ] | ( pbyString[ ulPos + 1 ] << 8 );
hb_retnint( ( ULONG ) ( ( ulResult & 0x00FFFFFF ) | ( ( ulLen & 0xFF ) << 24 ) ) );
hb_retnint( ( HB_U32 ) ( ( ulResult & 0x00FFFFFF ) | ( ( ulLen & 0xFF ) << 24 ) ) );
}