2010-01-12 19:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbsqlit3/hbsqlit3.c
  * contrib/hbfimage/fi_wrp.c
    ! Fixed to use hb_vmRequest*() in callbacks.

  * contrib/hbfimage/fi_wrp.c
    % Optimized FreeImageErrorHandler().
    % FreeImageErrorHandler() made static.
    * Formatting.

  ; Please test and review. I didn't test these modifications at all.
This commit is contained in:
Viktor Szakats
2010-01-12 18:40:54 +00:00
parent 86a3a2056a
commit f28e124cab
3 changed files with 54 additions and 38 deletions

View File

@@ -17,6 +17,18 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-01-12 19:39 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbsqlit3/hbsqlit3.c
* contrib/hbfimage/fi_wrp.c
! Fixed to use hb_vmRequest*() in callbacks.
* contrib/hbfimage/fi_wrp.c
% Optimized FreeImageErrorHandler().
% FreeImageErrorHandler() made static.
* Formatting.
; Please test and review. I didn't test these modifications at all.
2010-01-11 10:21 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt_destruct.cpp
+ HBQT_SETCODECFORTR()
@@ -35,7 +47,7 @@
* contrib/hbqt/hbqt_hbqmainwindow.cpp
* contrib/hbqt/qtgui/QMainWindow.cpp
* contrib/hbqt/qth/QMainWindow.qth
% Moved hbqt_QMainWindow_save(rest)Settings() from
% Moved hbqt_QMainWindow_save(rest)Settings() from
hbqt_destruct.cpp to QMainWindow.cpp.
2010-01-12 16:44 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

View File

@@ -70,7 +70,7 @@
/* ************************* WRAPPED FUNCTIONS ****************************** */
/* static for error handler (see below FI_SETOUTPUTMESSAGE ) */
static void *pErrorHandler = NULL;
static void * s_pErrorHandler = NULL;
/* -------------------------------------------------------------------------- */
/* Init / Error routines ---------------------------------------------------- */
@@ -133,42 +133,34 @@ FreeImage error handler
@param fif Format / Plugin responsible for the error
@param message Error message
*/
void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message)
static void FreeImageErrorHandler( FREE_IMAGE_FORMAT fif, const char * message )
{
const char * format;
PHB_SYMB pSymbol;
if( ! pErrorHandler )
if( s_pErrorHandler )
{
/* Do nothing */
return;
/*TraceLog( NULL, "ErrorHandle %p\n\r", s_pErrorHandler );*/
if( hb_vmRequestReenter() )
{
const char * format = FreeImage_GetFormatFromFIF( fif );
/* launch error function at prg level */
hb_vmPushSymbol( ( PHB_SYMB ) s_pErrorHandler );
hb_vmPushNil();
hb_vmPushString( format, strlen( format ) );
hb_vmPushString( message, strlen( message ) );
hb_vmDo( 2 );
hb_vmRequestRestore();
}
else
hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, "FreeImageErrorHandler", 1, hb_paramError( 1 ) );
}
pSymbol = (PHB_SYMB) pErrorHandler;
/*TraceLog( NULL, "ErrorHandle %p\n\r", pErrorHandler );*/
if( ! pSymbol )
{
hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, "FreeImageErrorHandler", 1, hb_paramError( 1 ) );
return;
}
format = FreeImage_GetFormatFromFIF(fif);
/* launch error function at prg level */
hb_vmPushSymbol( pSymbol );
hb_vmPushNil();
hb_vmPushString( format, strlen( format ) );
hb_vmPushString( message, strlen( message ) );
hb_vmDo( 2 );
}
HB_FUNC( FI_SETOUTPUTMESSAGE )
{
pErrorHandler = NULL;
FreeImage_SetOutputMessage(FreeImageErrorHandler);
s_pErrorHandler = NULL;
FreeImage_SetOutputMessage( FreeImageErrorHandler );
/* TraceLog( NULL, "PCount = %i\n\r", hb_pcount() ); */
@@ -177,7 +169,7 @@ HB_FUNC( FI_SETOUTPUTMESSAGE )
if( HB_ISPOINTER( 1 ) )
{
/* Set the pointer */
pErrorHandler = hb_parptr( 1 );
s_pErrorHandler = hb_parptr( 1 );
}
else if( HB_ISNIL( 1 ) )
{

View File

@@ -253,7 +253,7 @@ static int callback( void *Cargo, int argc, char **argv, char **azColName )
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
PHB_ITEM pArrayValue = hb_itemArrayNew( argc );
PHB_ITEM pArrayColName = hb_itemArrayNew( argc );
@@ -277,6 +277,8 @@ static int callback( void *Cargo, int argc, char **argv, char **azColName )
hb_itemRelease( pArrayValue );
hb_itemRelease( pArrayColName );
hb_vmRequestRestore();
return iRes;
}
@@ -287,7 +289,7 @@ static int authorizer( void *Cargo, int iAction, const char *sName1, const char
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
int iRes;
PHB_ITEM pItem1 = hb_itemPutCConst( NULL, sName1 );
@@ -311,6 +313,8 @@ static int authorizer( void *Cargo, int iAction, const char *sName1, const char
hb_itemRelease( pItem3 );
hb_itemRelease( pItem4 );
hb_vmRequestRestore();
return iRes;
}
@@ -321,7 +325,7 @@ static int busy_handler( void *Cargo, int iNumberOfTimes )
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
int iRes;
@@ -332,6 +336,8 @@ static int busy_handler( void *Cargo, int iNumberOfTimes )
iRes = hb_parni( -1 );
hb_vmRequestRestore();
return iRes;
}
@@ -342,7 +348,7 @@ static int progress_handler( void *Cargo )
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
int iRes;
@@ -352,6 +358,8 @@ static int progress_handler( void *Cargo )
iRes = hb_parni( -1 );
hb_vmRequestRestore();
return iRes;
}
@@ -362,7 +370,7 @@ static int hook_commit( void *Cargo )
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
int iRes;
@@ -372,6 +380,8 @@ static int hook_commit( void *Cargo )
iRes = hb_parni( -1 );
hb_vmRequestRestore();
return iRes;
}
@@ -382,11 +392,13 @@ static void hook_rollback( void *Cargo )
{
PHB_DYNS pSym = ( PHB_DYNS ) Cargo;
if( pSym )
if( pSym && hb_vmRequestReenter() )
{
hb_vmPushDynSym( pSym );
hb_vmPushNil();
hb_vmDo( 0 );
hb_vmRequestRestore();
}
}