2011-02-11 19:24 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/base64d.c
    ! Fixed TOFIX to handle too large result. Now it will RTE.
      Please check me.

  * src/rtl/hbrandom.c
    * Formatting.

  * src/rtl/space.c
    * Fixed commented call.
This commit is contained in:
Viktor Szakats
2011-02-11 18:24:49 +00:00
parent d03611893a
commit 3aea6dfbdc
4 changed files with 28 additions and 8 deletions

View File

@@ -16,6 +16,17 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-02-11 19:24 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/base64d.c
! Fixed TOFIX to handle too large result. Now it will RTE.
Please check me.
* src/rtl/hbrandom.c
* Formatting.
* src/rtl/space.c
* Fixed commented call.
2011-02-11 15:45 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtcore/hbqt_pointer.cpp
* contrib/hbqt/qtcore/hbqt.h

View File

@@ -54,6 +54,7 @@
*/
#include "hbapi.h"
#include "hbapierr.h"
/* Warning: this code works only on ASCII based machines */
@@ -125,14 +126,22 @@ static HB_SIZE base64_decode_block( const char * code_in, const HB_SIZE length_i
HB_FUNC( HB_BASE64DECODE )
{
HB_SIZE len = hb_parclen( 1 );
HB_SIZE nSrcLen = hb_parclen( 1 );
if( len > 0 && len <= INT_MAX ) /* TOFIX */
if( nSrcLen > 0 )
{
char * code = ( char * ) hb_xgrab( ( ( ( len * 3 ) / 4 ) + 1 ) * sizeof( char ) );
HB_SIZE nSize = base64_decode_block( hb_parcx( 1 ), len, code );
HB_SIZE nDstLen = ( ( ( nSrcLen * 3 ) / 4 ) + 1 );
hb_retclen_buffer( code, nSize );
if( nDstLen <= HB_SIZE_MAX )
{
char * code = ( char * ) hb_xgrab( nDstLen * sizeof( char ) );
nDstLen = base64_decode_block( hb_parcx( 1 ), nSrcLen, code );
hb_retclen_buffer( code, nDstLen );
}
else
hb_errRT_BASE( EG_STROVERFLOW, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_retc_null();

View File

@@ -66,7 +66,7 @@ static volatile int s_fInit = 0;
*
* HB_RANDOM() --> returns a real value n so that 0 <= n < 1
* HB_RANDOM( x ) --> returns a real number n so that 0 <= n < x
* HB_RANDOM( x, y) --> Returns a real number n so that x <= n < y
* HB_RANDOM( x, y ) --> Returns a real number n so that x <= n < y
*/
HB_FUNC( HB_RANDOM )
{
@@ -95,7 +95,7 @@ HB_FUNC( HB_RANDOM )
*
* HB_RANDOMINT() --> returns 0 or 1, evenly distributed
* HB_RANDOMINT( N ) --> returns an integer between 1 and N (inclusive)
* HB_RANDOMINT( x, y) --> Returns a real number between x and y (inclusive)
* HB_RANDOMINT( x, y ) --> Returns a real number between x and y (inclusive)
* The integer returned is of the longest type available
*/
HB_FUNC( HB_RANDOMINT )

View File

@@ -71,7 +71,7 @@ HB_FUNC( SPACE )
/* NOTE: String overflow could never occure since a string can
be as large as ULONG_MAX, and the maximum length that
can be specified is LONG_MAX here. [vszakats] */
/* hb_errRT_BASE( EG_STROVERFLOW, 1233, NULL, HB_ERR_FUNCNAME ); */
/* hb_errRT_BASE( EG_STROVERFLOW, 1233, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); */
hb_xmemset( szResult, ' ', nLen );
hb_retclen_buffer( szResult, nLen );