From d09ab089b85d4fd43aa424ba26307019440a3b86 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 18 Jan 2010 18:58:02 +0000 Subject: [PATCH] 2010-01-18 19:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/common/hbwince.c - Deleted definition of FreeResource(). It's noe used anywhere in Harbour, and its declaration was also missing. * contrib/hbqt/hbqt.h * contrib/hbqt/hbqt_destruct.cpp - Deleted no longer used macros: hbqt_ret_*(). + Added TOFIX to hbqt_par_*() where essentially the GC pointer type checking is completely worked around, which makes it easy to create GPFs by passing wrong pointer type to functions. Probably its unavoidable to introduce parameter validation to HBQT wrappers. Such validation could decide which types are accepted (f.e. objects and parent objects, whether NULL is accepted or rejected). If not accepted a proper RTE should be thrown instead of letting the app GPF. + Added two TOFIXes where low-level parameter retrieving function returns NULL. --- harbour/ChangeLog | 26 +++++++++++++++++++++++--- harbour/contrib/hbqt/hbqt.h | 7 ++----- harbour/contrib/hbqt/hbqt_destruct.cpp | 4 ++-- harbour/src/common/hbwince.c | 6 ------ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 48863f38d3..a4c50e1c67 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,26 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-18 19:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/common/hbwince.c + - Deleted definition of FreeResource(). It's noe used anywhere + in Harbour, and its declaration was also missing. + + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_destruct.cpp + - Deleted no longer used macros: hbqt_ret_*(). + + Added TOFIX to hbqt_par_*() where essentially the GC + pointer type checking is completely worked around, which + makes it easy to create GPFs by passing wrong pointer + type to functions. Probably its unavoidable to introduce + parameter validation to HBQT wrappers. Such validation + could decide which types are accepted (f.e. objects and + parent objects, whether NULL is accepted or rejected). + If not accepted a proper RTE should be thrown instead + of letting the app GPF. + + Added two TOFIXes where low-level parameter + retrieving function returns NULL. + 2010-01-18 09:55 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideactions.prg @@ -33,7 +53,7 @@ + Prepared: to allow extended book-"Mark" feature. + Prepared: to handle extended syntax highlighting. ! More artifacts I must be missing. - + 2010-01-18 09:14 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt.h * contrib/hbqt/hbqt_base.cpp @@ -61,12 +81,12 @@ + contrib/hbqt/qth/HBEvents.qth + contrib/hbqt/qth/HBSlots.qth + Prepared to bring Events/Slots management on OO level. - Stll not activated as I have some technical issues on + Stll not activated as I have some technical issues on c++ level. Just a matter of time... * contrib/hbqt/generator/hbqtgen.prg * contrib/hbqt/generator/qt45.qtp - + + This commit is generally towards separation of static/auto generated parts of classes which has been hanging in for manual updates to the structures indivisually if changes diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 0dc0f870b5..c327d6c85c 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -86,6 +86,8 @@ extern void * hbqt_pPtrFromItem( PHB_ITEM pObj ); #include "hbqt_garbage.h" +/* TOFIX: Here basically we're using GC pointers without pointer type identification, + which means that it's very easy to cause a GPF by passing wrong type. */ #define hbqt_par_ExtensionOption( n ) ( ( ExtensionOption * ) hbqt_gcpointer( n ) ) #define hbqt_par_IUnknown( n ) ( ( IUnknown * ) hbqt_gcpointer( n ) ) #define hbqt_par_QAbstractButton( n ) ( ( QAbstractButton * ) hbqt_gcpointer( n ) ) @@ -398,9 +400,4 @@ extern void * hbqt_pPtrFromItem( PHB_ITEM pObj ); #define hbqt_par_Bool( n ) ( hb_parl( n ) ) #define hbqt_par_char( n ) ( hb_parcx( n ) ) -#define hbqt_ret_QWidget( p ) ( hb_retptr( ( QWidget* ) p ) ) -#define hbqt_ret_QAbstractItemDelegate( p ) ( hb_retptr( ( QAbstractItemDelegate* ) p ) ) -#define hbqt_ret_QAbstractItemModel( p ) ( hb_retptr( ( QAbstractItemModel* ) p ) ) -#define hbqt_ret_QPrinter( p ) ( hb_retptr( ( QPrinter* ) p ) ) - #endif /* __HBQT_H */ diff --git a/harbour/contrib/hbqt/hbqt_destruct.cpp b/harbour/contrib/hbqt/hbqt_destruct.cpp index d0c7629faa..fdc3da1a60 100644 --- a/harbour/contrib/hbqt/hbqt_destruct.cpp +++ b/harbour/contrib/hbqt/hbqt_destruct.cpp @@ -119,7 +119,7 @@ void * hbqt_pPtrFromItem( PHB_ITEM pObj ) else if( hb_itemType( pObj ) == HB_IT_POINTER ) return hbqt_gcpointerFromItem( pObj ); else - return NULL; + return NULL; /* TODO: Still better if RTE. */ } void * hbqt_pPtrFromObj( int iParam ) @@ -137,7 +137,7 @@ void * hbqt_pPtrFromObj( int iParam ) else if( hb_itemType( pObj ) == HB_IT_POINTER ) return hbqt_gcpointer( iParam ); else - return NULL; + return NULL; /* TODO: Still better if RTE. */ } HB_FUNC( HBQT_SETCODECFORCSTRINGS ) diff --git a/harbour/src/common/hbwince.c b/harbour/src/common/hbwince.c index 9ef711d457..38869f4e04 100644 --- a/harbour/src/common/hbwince.c +++ b/harbour/src/common/hbwince.c @@ -333,12 +333,6 @@ int WINAPI MulDiv( int nNumber, int nNumerator, int nDenominator ) } #endif /* __MINGW32CE__ */ -BOOL WINAPI FreeResource( HGLOBAL h ) -{ - HB_SYMBOL_UNUSED( h ); - return FALSE; -} - BOOL WINAPI Arc( HDC h, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8 ) { HB_SYMBOL_UNUSED( h );