From 37bfb36fc3b9ac9e42d2103bb6782ce2eae1905a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 10 Mar 2011 16:12:35 +0000 Subject: [PATCH] 2011-03-10 17:12 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbpp.h * harbour/include/hbvmpub.h * harbour/include/hbapi.h * harbour/include/hbcomp.h * harbour/include/hbcompdf.h * harbour/include/hbexpra.c * harbour/include/hbexprop.h * harbour/include/hbhash.h * harbour/src/compiler/harbour.yyc * harbour/src/compiler/harbour.y * simplified function type declarations * harbour/src/common/hbstr.c ! fixed potential GPF in hb_strnicmp() HB_TR_DEBUG message --- harbour/ChangeLog | 16 ++++++++++++++++ harbour/include/hbapi.h | 3 +-- harbour/include/hbcomp.h | 7 +++---- harbour/include/hbcompdf.h | 10 ++++------ harbour/include/hbexpra.c | 4 ++-- harbour/include/hbexprop.h | 3 +-- harbour/include/hbhash.h | 3 +-- harbour/include/hbpp.h | 24 ++++++++---------------- harbour/include/hbvmpub.h | 5 ++++- harbour/src/common/hbstr.c | 2 +- harbour/src/compiler/harbour.y | 4 ++-- harbour/src/compiler/harbour.yyc | 4 ++-- 12 files changed, 45 insertions(+), 40 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c4032c03a0..15253c69f3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2011-03-10 17:12 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbpp.h + * harbour/include/hbvmpub.h + * harbour/include/hbapi.h + * harbour/include/hbcomp.h + * harbour/include/hbcompdf.h + * harbour/include/hbexpra.c + * harbour/include/hbexprop.h + * harbour/include/hbhash.h + * harbour/src/compiler/harbour.yyc + * harbour/src/compiler/harbour.y + * simplified function type declarations + + * harbour/src/common/hbstr.c + ! fixed potential GPF in hb_strnicmp() HB_TR_DEBUG message + 2011-03-10 11:13 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbmk2_qt.hbs * Do not include source filenames in doc. diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 0ba2946225..950371d269 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -569,8 +569,7 @@ extern HB_EXPORT void hb_xvheapunlock( HB_VMHANDLE h, HB_SIZE nOffset ); /* garbage collector */ #define HB_GARBAGE_FUNC( hbfunc ) void hbfunc( void * Cargo ) /* callback function for cleaning garbage memory pointer */ -typedef HB_GARBAGE_FUNC( HB_GARBAGE_FUNC_ ); -typedef HB_GARBAGE_FUNC_ * HB_GARBAGE_FUNC_PTR; +typedef HB_GARBAGE_FUNC( ( * HB_GARBAGE_FUNC_PTR ) ); typedef struct { diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index f9f50e2971..6aab01fa31 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -72,8 +72,7 @@ HB_EXTERN_BEGIN /* definitions for hb_compPCodeEval() support */ typedef void * HB_VOID_PTR; #define HB_PCODE_FUNC( func, type ) HB_SIZE func( PFUNCTION pFunc, HB_SIZE nPCodePos, type cargo ) -typedef HB_PCODE_FUNC( HB_PCODE_FUNC_, HB_VOID_PTR ); -typedef HB_PCODE_FUNC_ * HB_PCODE_FUNC_PTR; +typedef HB_PCODE_FUNC( ( * HB_PCODE_FUNC_PTR ), HB_VOID_PTR ); extern HB_ISIZ hb_compPCodeSize( PFUNCTION, HB_SIZE ); extern void hb_compPCodeEval( PFUNCTION, const HB_PCODE_FUNC_PTR *, void * ); @@ -301,8 +300,8 @@ extern void hb_compCodeBlockRewind( HB_COMP_DECL ); /* restart #endif /* HB_MACRO_SUPPORT */ -extern HB_SIZE hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ); -extern HB_SIZE hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ); +extern HB_SIZE hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_COMP_CARGO_FUNC_PTR pEval ); +extern HB_SIZE hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_COMP_CARGO2_FUNC_PTR pEval ); extern void hb_compChkCompilerSwitch( HB_COMP_DECL, int iArg, const char * const args[] ); extern void hb_compChkPaths( HB_COMP_DECL ); diff --git a/harbour/include/hbcompdf.h b/harbour/include/hbcompdf.h index 5250dafa25..3ac0e37821 100644 --- a/harbour/include/hbcompdf.h +++ b/harbour/include/hbcompdf.h @@ -877,13 +877,11 @@ typedef struct _HB_COMP_FUNCS /* Support for traversing of linked list */ -#define HB_CARGO_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo ) -typedef HB_CARGO_FUNC( HB_CARGO_FUNC_ ); -typedef HB_CARGO_FUNC_ *HB_CARGO_FUNC_PTR; +#define HB_COMP_CARGO_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo ) +typedef HB_COMP_CARGO_FUNC( ( * HB_COMP_CARGO_FUNC_PTR ) ); -#define HB_CARGO2_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo, void *dummy ) -typedef HB_CARGO2_FUNC( HB_CARGO2_FUNC_ ); -typedef HB_CARGO2_FUNC_ *HB_CARGO2_FUNC_PTR; +#define HB_COMP_CARGO2_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo, void *dummy ) +typedef HB_COMP_CARGO2_FUNC( ( * HB_COMP_CARGO2_FUNC_PTR ) ); /* pcode chunks bytes size */ #define HB_PCODE_CHUNK 100 diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index 4d95e24b58..efc9094bf0 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -56,7 +56,7 @@ /* ************************************************************************ */ #ifndef HB_MACRO_SUPPORT -HB_SIZE hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ) +HB_SIZE hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_COMP_CARGO_FUNC_PTR pEval ) { HB_SIZE nLen = 0; @@ -74,7 +74,7 @@ HB_SIZE hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR return nLen; } -HB_SIZE hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ) +HB_SIZE hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_COMP_CARGO2_FUNC_PTR pEval ) { HB_SIZE nLen = 0; diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index dd4d9cd7e8..776e680489 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -61,8 +61,7 @@ HB_EXTERN_BEGIN * handling */ #define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, HB_EXPR_MESSAGE iMessage, HB_COMP_DECL ) -typedef HB_EXPR_FUNC( HB_EXPR_FUNC_ ); -typedef HB_EXPR_FUNC_ *HB_EXPR_FUNC_PTR; +typedef HB_EXPR_FUNC( ( * HB_EXPR_FUNC_PTR ) ); #if defined( HB_MACRO_SUPPORT ) #define hb_comp_ExprTable hb_macro_ExprTable diff --git a/harbour/include/hbhash.h b/harbour/include/hbhash.h index c40b184848..19d9eb0709 100644 --- a/harbour/include/hbhash.h +++ b/harbour/include/hbhash.h @@ -60,8 +60,7 @@ HB_EXTERN_BEGIN struct HB_HASH_TABLE_; #define HB_HASH_FUNC( hbfunc ) HB_SIZE hbfunc( struct HB_HASH_TABLE_ * HashPtr, const void * Value, const void * Cargo ) -typedef HB_HASH_FUNC( HB_HASH_FUNC_ ); -typedef HB_HASH_FUNC_ * HB_HASH_FUNC_PTR; +typedef HB_HASH_FUNC( ( * HB_HASH_FUNC_PTR ) ); typedef struct HB_HASH_ITEM_ { diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index 6ad1242dab..ba2957f07b 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -90,43 +90,35 @@ HB_EXTERN_BEGIN /* function to open included files */ #define HB_PP_OPEN_FUNC_( func ) int func( void *, char *, HB_BOOL, HB_BOOL, HB_BOOL, HB_PATHNAMES *, HB_BOOL *, FILE **, const char **, HB_SIZE *, HB_BOOL * ) -typedef HB_PP_OPEN_FUNC_( HB_PP_OPEN_FUNC ); -typedef HB_PP_OPEN_FUNC * PHB_PP_OPEN_FUNC; +typedef HB_PP_OPEN_FUNC_( ( * PHB_PP_OPEN_FUNC ) ); /* function to close included files */ #define HB_PP_CLOSE_FUNC_( func ) void func( void *, FILE * ) -typedef HB_PP_CLOSE_FUNC_( HB_PP_CLOSE_FUNC ); -typedef HB_PP_CLOSE_FUNC * PHB_PP_CLOSE_FUNC; +typedef HB_PP_CLOSE_FUNC_( ( * PHB_PP_CLOSE_FUNC ) ); /* function to generate errors */ #define HB_PP_ERROR_FUNC_( func ) void func( void *, const char * const *, char, int, const char *, const char * ) -typedef HB_PP_ERROR_FUNC_( HB_PP_ERROR_FUNC ); -typedef HB_PP_ERROR_FUNC * PHB_PP_ERROR_FUNC; +typedef HB_PP_ERROR_FUNC_( ( * PHB_PP_ERROR_FUNC ) ); /* function to redirect stdout messages */ #define HB_PP_DISP_FUNC_( func ) void func( void *, const char * ) -typedef HB_PP_DISP_FUNC_( HB_PP_DISP_FUNC ); -typedef HB_PP_DISP_FUNC * PHB_PP_DISP_FUNC; +typedef HB_PP_DISP_FUNC_( ( * PHB_PP_DISP_FUNC ) ); /* function for catching #pragma dump data */ #define HB_PP_DUMP_FUNC_( func ) void func( void *, char *, HB_SIZE, int ) -typedef HB_PP_DUMP_FUNC_( HB_PP_DUMP_FUNC ); -typedef HB_PP_DUMP_FUNC * PHB_PP_DUMP_FUNC; +typedef HB_PP_DUMP_FUNC_( ( * PHB_PP_DUMP_FUNC ) ); /* function for catching HB_INLINE(...){...} data */ #define HB_PP_INLINE_FUNC_( func ) void func( void *, char *, char *, HB_SIZE, int ) -typedef HB_PP_INLINE_FUNC_( HB_PP_INLINE_FUNC ); -typedef HB_PP_INLINE_FUNC * PHB_PP_INLINE_FUNC; +typedef HB_PP_INLINE_FUNC_( ( * PHB_PP_INLINE_FUNC ) ); /* function for catching #pragma dump data */ #define HB_PP_SWITCH_FUNC_( func ) HB_BOOL func( void *, const char *, int *, HB_BOOL ) -typedef HB_PP_SWITCH_FUNC_( HB_PP_SWITCH_FUNC ); -typedef HB_PP_SWITCH_FUNC * PHB_PP_SWITCH_FUNC; +typedef HB_PP_SWITCH_FUNC_( ( * PHB_PP_SWITCH_FUNC ) ); /* function to register included files */ #define HB_PP_INC_FUNC_( func ) void func( void *, const char * ) -typedef HB_PP_INC_FUNC_( HB_PP_INC_FUNC ); -typedef HB_PP_INC_FUNC * PHB_PP_INC_FUNC; +typedef HB_PP_INC_FUNC_( ( * PHB_PP_INC_FUNC ) ); /* preprocessor tokens */ diff --git a/harbour/include/hbvmpub.h b/harbour/include/hbvmpub.h index a7d40c562a..5161ad142e 100644 --- a/harbour/include/hbvmpub.h +++ b/harbour/include/hbvmpub.h @@ -217,7 +217,10 @@ typedef struct _HB_SYMB } HB_SYMB, * PHB_SYMB; #define HB_DYNS_FUNC( hbfunc ) HB_BOOL hbfunc( PHB_DYNS pDynSymbol, void * Cargo ) -typedef HB_DYNS_FUNC( PHB_DYNS_FUNC ); +typedef HB_DYNS_FUNC( ( * PHB_DYNS_FUNC ) ); + +#define HB_CARGO_FUNC( func ) void func( void *cargo ) +typedef HB_CARGO_FUNC( ( * PHB_CARGO_FUNC ) ); typedef void * ( * PHB_ALLOCUPDT_FUNC )( void *, int ); diff --git a/harbour/src/common/hbstr.c b/harbour/src/common/hbstr.c index 6df4bc7433..5cf5778b71 100644 --- a/harbour/src/common/hbstr.c +++ b/harbour/src/common/hbstr.c @@ -269,7 +269,7 @@ int hb_strnicmp( const char * s1, const char * s2, HB_SIZE count ) HB_SIZE nCount; int rc = 0; - HB_TRACE(HB_TR_DEBUG, ("hb_strnicmp(%.*s, %s, %" HB_PFS "u)", ( int ) count, s1, s2, count)); + HB_TRACE(HB_TR_DEBUG, ("hb_strnicmp(%.*s, %.*s, %" HB_PFS "u)", ( int ) count, s1, ( int ) count, s2, count)); for( nCount = 0; nCount < count; nCount++ ) { diff --git a/harbour/src/compiler/harbour.y b/harbour/src/compiler/harbour.y index 187060e06f..1da7aa48b5 100644 --- a/harbour/src/compiler/harbour.y +++ b/harbour/src/compiler/harbour.y @@ -2491,7 +2491,7 @@ static void hb_compForEnd( HB_COMP_DECL, const char *szVar ) } } -static HB_CARGO2_FUNC( hb_compEnumEvalStart ) +static HB_COMP_CARGO2_FUNC( hb_compEnumEvalStart ) { const char * szName = hb_compExprAsSymbol( ( HB_EXPR_PTR ) cargo ); if( szName ) @@ -2535,7 +2535,7 @@ static void hb_compEnumNext( HB_COMP_DECL, HB_EXPR_PTR pExpr, int descend ) } } -static HB_CARGO_FUNC( hb_compEnumEvalEnd ) +static HB_COMP_CARGO_FUNC( hb_compEnumEvalEnd ) { const char * szName = hb_compExprAsSymbol( ( HB_EXPR_PTR ) cargo ); if( szName ) diff --git a/harbour/src/compiler/harbour.yyc b/harbour/src/compiler/harbour.yyc index 5438c4bbcf..407076c883 100644 --- a/harbour/src/compiler/harbour.yyc +++ b/harbour/src/compiler/harbour.yyc @@ -7634,7 +7634,7 @@ static void hb_compForEnd( HB_COMP_DECL, const char *szVar ) } } -static HB_CARGO2_FUNC( hb_compEnumEvalStart ) +static HB_COMP_CARGO2_FUNC( hb_compEnumEvalStart ) { const char * szName = hb_compExprAsSymbol( ( HB_EXPR_PTR ) cargo ); if( szName ) @@ -7678,7 +7678,7 @@ static void hb_compEnumNext( HB_COMP_DECL, HB_EXPR_PTR pExpr, int descend ) } } -static HB_CARGO_FUNC( hb_compEnumEvalEnd ) +static HB_COMP_CARGO_FUNC( hb_compEnumEvalEnd ) { const char * szName = hb_compExprAsSymbol( ( HB_EXPR_PTR ) cargo ); if( szName )