2008-07-02 15:34 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/hbziparch/hbziparc.c
    - removed HB_FUNC_EXIT( HBZIPCLEANUP )
  * harbour/contrib/hbziparch/hbzipnew.cpp
    + added automatic callback destructor registered by hb_vmAtExit()
      at 1-st callback set
This commit is contained in:
Przemyslaw Czerpak
2008-07-02 13:34:52 +00:00
parent d85a6a6d53
commit 02f2287452
3 changed files with 23 additions and 33 deletions

View File

@@ -8,6 +8,13 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-07-02 15:34 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbziparch/hbziparc.c
- removed HB_FUNC_EXIT( HBZIPCLEANUP )
* harbour/contrib/hbziparch/hbzipnew.cpp
+ added automatic callback destructor registered by hb_vmAtExit()
at 1-st callback set
2008-07-02 14:09 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbtpathy/tpos2.c
* moved INCL_* definitions before harbour header files

View File

@@ -1661,34 +1661,3 @@ HB_FUNC(HB_UNZIPALLFILE)
hb_itemRelease( pProgress );
}
}
HB_FUNC_EXIT( HBZIPCLEANUP )
{
if( hbza_ChangeDiskBlock )
{
hb_itemRelease( hbza_ChangeDiskBlock );
hbza_ChangeDiskBlock = NULL;
}
}
#define __PRG_SOURCE__ (char*) "hbziparc.c"
#ifdef HB_PCODE_VER
# undef HB_PRG_PCODE_VER
# define HB_PRG_PCODE_VER HB_PCODE_VER
#endif
HB_INIT_SYMBOLS_BEGIN( hbziparch_CLEANUP )
{ (char*) "HBZIPCLEANUP$", {HB_FS_EXIT | HB_FS_LOCAL}, {HB_EXIT_FUNCNAME( HBZIPCLEANUP )}, NULL }
HB_INIT_SYMBOLS_END( hbziparch_CLEANUP )
#if defined(HB_PRAGMA_STARTUP)
#pragma startup hbziparch_CLEANUP
#elif defined(HB_MSC_STARTUP)
#if _MSC_VER >= 1010
#pragma data_seg( ".CRT$XIY" )
#pragma comment( linker, "/Merge:.CRT=.data" )
#else
#pragma data_seg( "XIY" )
#endif
static HB_$INITSYM hb_vm_auto_SymbolInit_INIT = hbziparch_CLEANUP;
#pragma data_seg()
#endif

View File

@@ -619,15 +619,29 @@ int hb___GetNumberofFilestoUnzip( char * szFile )
return iNumberOfFiles;
}
int hb___SetCallbackFunc( PHB_ITEM pFunc )
static void hb___CallbackFuncFree( void * cargo )
{
HB_SYMBOL_UNUSED( cargo );
if( hbza_ChangeDiskBlock )
{
hb_itemRelease( hbza_ChangeDiskBlock );
hbza_ChangeDiskBlock = NULL;
}
}
hbza_ChangeDiskBlock = hb_itemNew( NULL );
int hb___SetCallbackFunc( PHB_ITEM pFunc )
{
if( hbza_ChangeDiskBlock )
{
hb_itemClear( hbza_ChangeDiskBlock );
}
else
{
/* register cleanup function, it's executed only once */
hb_vmAtExit( hb___CallbackFuncFree, NULL );
hbza_ChangeDiskBlock = hb_itemNew( NULL );
}
if( pFunc )
hb_itemCopy( hbza_ChangeDiskBlock, pFunc );