2011-03-01 02:06 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/utils/hbmk2/hbmk2.prg
  * harbour/config/dos/watcom.mk
  * harbour/config/win/watcom.mk
  * harbour/config/linux/watcom.mk
  * harbour/config/os2/watcom.mk
    ! fixed to not use -wcd124 and -wcd136 in OpenWatcom C++ builds

   * harbour/config/win/xcc.mk
     ! added -noexpobj as workaround for problems with creating
       shared library
     * removed now unnecessary $(RM) harbour*.dll

  * harbour/src/rtl/base64d.c
    * pacified warning
    % removed unnecessary condition with RTE - decoded string has to
      be shorter then the source one taken from HVM string item so for
      sure it cannot exceed maximum string item size

  * harbour/src/rtl/base64c.c
    * generate RTE if encode string size is too big 
    * eliminated unnecessary INT_MAX string limit
This commit is contained in:
Przemyslaw Czerpak
2011-03-01 01:07:16 +00:00
parent 7e41cd70bc
commit 701acbb116
9 changed files with 90 additions and 50 deletions

View File

@@ -16,6 +16,29 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-03-01 02:06 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/utils/hbmk2/hbmk2.prg
* harbour/config/dos/watcom.mk
* harbour/config/win/watcom.mk
* harbour/config/linux/watcom.mk
* harbour/config/os2/watcom.mk
! fixed to not use -wcd124 and -wcd136 in OpenWatcom C++ builds
* harbour/config/win/xcc.mk
! added -noexpobj as workaround for problems with creating
shared library
* removed now unnecessary $(RM) harbour*.dll
* harbour/src/rtl/base64d.c
* pacified warning
% removed unnecessary condition with RTE - decoded string has to
be shorter then the source one taken from HVM string item so for
sure it cannot exceed maximum string item size
* harbour/src/rtl/base64c.c
* generate RTE if encode string size is too big
* eliminated unnecessary INT_MAX string limit
2011-02-28 23:21 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
* contrib/hbqt/qtcore/hbqt_init.cpp

View File

@@ -23,7 +23,10 @@ LDFLAGS += OP quiet
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -w3
else
CFLAGS += -w1 -wcd124 -wcd136 -wcd201 -wcd367 -wcd368
CFLAGS += -w1 -wcd201 -wcd367 -wcd368
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -wcd124 -wcd136
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)

View File

@@ -22,7 +22,10 @@ LDFLAGS += OP quiet
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -w3
else
CFLAGS += -w1 -wcd124 -wcd136 -wcd201 -wcd367 -wcd368
CFLAGS += -w1 -wcd201 -wcd367 -wcd368
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -wcd124 -wcd136
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)

View File

@@ -24,7 +24,10 @@ LDFLAGS += OP quiet
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -w3
else
CFLAGS += -w1 -wcd124 -wcd136 -wcd201 -wcd367 -wcd368
CFLAGS += -w1 -wcd201 -wcd367 -wcd368
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -wcd124 -wcd136
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)

View File

@@ -24,7 +24,10 @@ LDFLAGS += OP quiet
ifneq ($(HB_BUILD_WARN),no)
CFLAGS += -w3
else
CFLAGS += -w1 -wcd124 -wcd136 -wcd201 -wcd367 -wcd368
CFLAGS += -w1 -wcd201 -wcd367 -wcd368
ifneq ($(HB_BUILD_MODE),cpp)
CFLAGS += -wcd124 -wcd136
endif
endif
ifneq ($(HB_BUILD_OPTIM),no)

View File

@@ -54,12 +54,12 @@ AR := xLib.exe
AR_RULE = $(AR) $(ARFLAGS) $(HB_AFLAGS) $(HB_USER_AFLAGS) -out:$(LIB_DIR)/$@ $(^F)
DY := $(LD)
DFLAGS += -nologo -dll $(LIBPATHS)
DFLAGS += -nologo -dll -noexpobj $(LIBPATHS)
DY_OUT := $(LD_OUT)
DLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT))
ifeq ($(HB_SHELL),sh)
DYNFIX = && mv $(DYN_DIR)/$(@:.dll=.LIB) $(LIB_DIR)/$(@:.dll=.lib) && $(RM) $(DYN_DIR)/$(@:.dll=.EXP)
DYNFIX = && mv $(DYN_DIR)/$(@:.dll=.LIB) $(LIB_DIR)/$(@:.dll=.lib)
else
DYNFIX :=
endif

View File

@@ -51,49 +51,57 @@
*/
#include "hbapi.h"
#include "hbapierr.h"
HB_FUNC( HB_BASE64ENCODE )
{
HB_SIZE len = hb_parclen( 1 );
if( len <= INT_MAX ) /* TOFIX */
if( len > 0 )
{
const char * s = hb_parcx( 1 );
char * t, * p;
HB_SIZE dst = ( 4 * ( ( len + 2 ) / 3 ) + 1 ) * sizeof( char );
t = p = ( char * ) hb_xgrab( ( 4 * ( ( len + 2 ) / 3 ) + 1 ) * sizeof( *t ) );
while( len-- > 0 )
if( dst > len )
{
static const char s_b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int x, y;
const char * s = hb_parcx( 1 );
char * t, * p;
x = *s++;
*p++ = s_b64chars[ ( x >> 2 ) & 0x3F ];
t = p = ( char * ) hb_xgrab( dst );
if( len-- == 0 )
while( len-- > 0 )
{
*p++ = s_b64chars[ ( x << 4 ) & 0x3F ];
*p++ = '=';
*p++ = '=';
break;
}
y = *s++;
*p++ = s_b64chars[ ( ( x << 4 ) | ( ( y >> 4 ) & 0x0F ) ) & 0x3F ];
static const char s_b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int x, y;
if( len-- == 0 )
{
*p++ = s_b64chars[ ( y << 2 ) & 0x3F ];
*p++ = '=';
break;
x = *s++;
*p++ = s_b64chars[ ( x >> 2 ) & 0x3F ];
if( len-- == 0 )
{
*p++ = s_b64chars[ ( x << 4 ) & 0x3F ];
*p++ = '=';
*p++ = '=';
break;
}
y = *s++;
*p++ = s_b64chars[ ( ( x << 4 ) | ( ( y >> 4 ) & 0x0F ) ) & 0x3F ];
if( len-- == 0 )
{
*p++ = s_b64chars[ ( y << 2 ) & 0x3F ];
*p++ = '=';
break;
}
x = *s++;
*p++ = s_b64chars[ ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 0x3F ];
*p++ = s_b64chars[ x & 0x3F ];
}
x = *s++;
*p++ = s_b64chars[ ( ( y << 2 ) | ( ( x >> 6 ) & 3 ) ) & 0x3F ];
*p++ = s_b64chars[ x & 0x3F ];
*p = '\0';
hb_retc_buffer( t );
}
*p = '\0';
hb_retc_buffer( t );
else
hb_errRT_BASE( EG_STROVERFLOW, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
else
hb_retc_null();

View File

@@ -54,11 +54,10 @@
*/
#include "hbapi.h"
#include "hbapierr.h"
/* Warning: this code works only on ASCII based machines */
static signed char base64_decode_value( char value_in )
static signed char base64_decode_value( int value_in )
{
static const signed char s_decoding[] =
{
@@ -69,10 +68,10 @@ static signed char base64_decode_value( char value_in )
};
value_in -= 43;
if( value_in < 0 || value_in >= ( char ) HB_SIZEOFARRAY( s_decoding ) )
if( value_in < 0 || value_in >= ( int ) HB_SIZEOFARRAY( s_decoding ) )
return -1;
return s_decoding[ ( int ) value_in ];
return s_decoding[ value_in ];
}
static HB_SIZE base64_decode_block( const char * code_in, const HB_SIZE length_in, char * pszPlainttextOut )
@@ -131,17 +130,10 @@ HB_FUNC( HB_BASE64DECODE )
if( nSrcLen > 0 )
{
HB_SIZE nDstLen = ( ( ( nSrcLen * 3 ) / 4 ) + 1 ) * sizeof( char );
char * code = ( char * ) hb_xgrab( nDstLen );
if( nDstLen <= HB_SIZE_MAX )
{
char * code = ( char * ) hb_xgrab( nDstLen );
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 );
nDstLen = base64_decode_block( hb_parcx( 1 ), nSrcLen, code );
hb_retclen_buffer( code, nDstLen );
}
else
hb_retc_null();

View File

@@ -3924,7 +3924,12 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel )
SWITCH hbmk[ _HBMK_nWARN ]
CASE _WARN_MAX ; AAdd( hbmk[ _HBMK_aOPTC ], "-wx" ) ; EXIT
CASE _WARN_YES ; AAdd( hbmk[ _HBMK_aOPTC ], "-w3" ) ; EXIT
CASE _WARN_LOW ; AAdd( hbmk[ _HBMK_aOPTC ], "-w1 -wcd124 -wcd136 -wcd201 -wcd367 -wcd368" ) ; EXIT
CASE _WARN_LOW
AAdd( hbmk[ _HBMK_aOPTC ], "-w1 -wcd201 -wcd367 -wcd368" )
IF hbmk[ _HBMK_lCPP ] != NIL .AND. ! hbmk[ _HBMK_lCPP ]
AAdd( hbmk[ _HBMK_aOPTC ], "-wcd124 -wcd136" )
ENDIF
EXIT
CASE _WARN_NO ; AAdd( hbmk[ _HBMK_aOPTC ], "-w0" ) ; EXIT
ENDSWITCH
DO CASE