diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index 717cba1bdb..c9f6c3f0c1 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,31 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-02-14 23:09 UTC+0100 Viktor Szakats (harbour syenar.net) + * contrib/xhb/hbxml.c + ! several memory leaks fixed in xhb XML support (TXml class) + ; Patch by Jose F. Gimenez. Thank you very much. + + * utils/hbmk2/hbmk2.prg + ! fixed -request= to work again for Harbour pcode dynlibs + regression from: 2010-07-31 13:44 UTC+0200 Viktor Szakats + https://github.com/vszakats/harbour/commit/8fb774ef80d2d89a25c65fe5bf824e134392318e + (sf.net's SVN web browser is effectively unusable anymore + for certain parts of Harbour, their server cannot handle + the history) + ! fixed missing detection for the proper bcc linker option + that disables warning for duplicate symbols in executables + + * extras/template/hbtpl.hbp + + added example to link dynlib against other Harbour (pcode) dynlib + Disclaimer: There is no "generic support" for this, + only a set of conventions used throughout Harbour + contrib .hbc files, contrib/make.hbs and + $hb_pkg_dynlib.hbm (aka utils/hbmk2/pkg_dynl.hbm) + + * extras/*/*.hbx + * refreshed + 2013-02-14 15:08 UTC+0100 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.*.po * utils/hbmk2/hbmk2.prg diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index d7662bd401..ff9dfdf3ab 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -431,6 +431,9 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL * ref, PHB_ITEM pDoc, PHB_ITE pDest->pName = hb_itemPutCL( pDest->pName, mxml_sgs_extract( buf_name ), iLenName ); pDest->pValue = hb_itemPutCL( pDest->pValue, mxml_sgs_extract( buf_attrib ), iLenAttrib ); + mxml_sgs_destroy( buf_name ); + mxml_sgs_destroy( buf_attrib ); + return MXML_STATUS_OK; } @@ -876,6 +879,7 @@ static void mxml_node_read_data( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, hb_itemPutCL( pItem, buf, iPos ); hb_objSendMsg( pNode, "_CDATA", 1, pItem ); hb_itemRelease( pItem ); + MXML_DELETOR( buf ); } static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) @@ -960,6 +964,7 @@ static MXML_STATUS mxml_node_read_name( MXML_REFIL * ref, PHB_ITEM pNode, PHB_IT pItem = hb_itemPutCL( NULL, buf, iPos ); hb_objSendMsg( pNode, "_CNAME", 1, pItem ); hb_itemRelease( pItem ); + MXML_DELETOR( buf ); return MXML_STATUS_OK; } @@ -1043,12 +1048,10 @@ static void mxml_node_read_directive( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM } else { - MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, ref->status, ref->error ); } } - else - MXML_DELETOR( buf ); + MXML_DELETOR( buf ); } static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) @@ -1124,9 +1127,9 @@ static void mxml_node_read_pi( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc ) } else { - MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, ref->status, ref->error ); } + MXML_DELETOR( buf ); } static void mxml_node_read_tag( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM doc, @@ -1239,10 +1242,10 @@ static void mxml_node_read_comment( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM d } else { - MXML_DELETOR( buf ); hbxml_set_doc_status( ref, doc, pNode, ref->status, ref->error ); } hb_itemRelease( pItem ); + MXML_DELETOR( buf ); } static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDoc ) @@ -1396,9 +1399,9 @@ static void mxml_node_read_cdata( MXML_REFIL * ref, PHB_ITEM pNode, PHB_ITEM pDo } else { - MXML_DELETOR( buf ); hbxml_set_doc_status( ref, pDoc, pNode, ref->status, ref->error ); } + MXML_DELETOR( buf ); } hb_itemRelease( pItem ); } @@ -2203,18 +2206,12 @@ static MXML_STATUS mxml_sgs_append_string( MXML_SGS * sgs, char * s ) static char * mxml_sgs_extract( MXML_SGS * sgs ) { - char * ret; - sgs->buffer[ sgs->length ] = 0; if( sgs->allocated > sgs->length + 1 ) - ret = ( char * ) MXML_REALLOCATOR( sgs->buffer, sgs->length + 1 ); - else - ret = sgs->buffer; + sgs->buffer = ( char * ) MXML_REALLOCATOR( sgs->buffer, sgs->length + 1 ); - MXML_DELETOR( sgs ); - - return ret; + return sgs->buffer; } /*********************************************************** @@ -2345,13 +2342,9 @@ HB_FUNC( HBXML_NODE_TO_STRING ) out.u.vPtr = ( void * ) sgs; if( mxml_node_write( &out, pNode, iStyle ) == MXML_STATUS_OK ) - { - HB_ISIZ iLen = sgs->length; - char * buffer = mxml_sgs_extract( sgs ); - hb_retclen_buffer( buffer, iLen ); - } - else - mxml_sgs_destroy( sgs ); + hb_retclen_buffer( mxml_sgs_extract( sgs ), sgs->length ); + + mxml_sgs_destroy( sgs ); } /** diff --git a/harbour/extras/gfspell/gfspell.hbx b/harbour/extras/gfspell/gfspell.hbx index fcee40c04c..4364fc7262 100644 --- a/harbour/extras/gfspell/gfspell.hbx +++ b/harbour/extras/gfspell/gfspell.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/gtwvw/gtwvw.hbx b/harbour/extras/gtwvw/gtwvw.hbx index a022a14ccb..6991e9317d 100644 --- a/harbour/extras/gtwvw/gtwvw.hbx +++ b/harbour/extras/gtwvw/gtwvw.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/hbdroid/hbdroid.hbx b/harbour/extras/hbdroid/hbdroid.hbx index 3a5f684753..f542c0b9ad 100644 --- a/harbour/extras/hbdroid/hbdroid.hbx +++ b/harbour/extras/hbdroid/hbdroid.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/hbusb/hbusb.hbx b/harbour/extras/hbusb/hbusb.hbx index 6dc89b6766..d54aa2a38e 100644 --- a/harbour/extras/hbusb/hbusb.hbx +++ b/harbour/extras/hbusb/hbusb.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/hbvpdf/hbvpdf.hbx b/harbour/extras/hbvpdf/hbvpdf.hbx index 798c52d32b..c9fc48826a 100644 --- a/harbour/extras/hbvpdf/hbvpdf.hbx +++ b/harbour/extras/hbvpdf/hbvpdf.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/hbxlsxml/hbxlsxml.hbx b/harbour/extras/hbxlsxml/hbxlsxml.hbx index 65a06898ab..81e36abf40 100644 --- a/harbour/extras/hbxlsxml/hbxlsxml.hbx +++ b/harbour/extras/hbxlsxml/hbxlsxml.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/rddado/rddado.hbx b/harbour/extras/rddado/rddado.hbx index a3e87c2748..2e9b02d80f 100644 --- a/harbour/extras/rddado/rddado.hbx +++ b/harbour/extras/rddado/rddado.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/extras/template/hbtpl.hbp b/harbour/extras/template/hbtpl.hbp index f8ef34d238..5fa1e01cbd 100644 --- a/harbour/extras/template/hbtpl.hbp +++ b/harbour/extras/template/hbtpl.hbp @@ -27,3 +27,10 @@ corec.c ${hb_name}.hbx $hb_pkg_dynlib.hbm $hb_pkg_install.hbm + +# NOTE: Uncomment if you want to link against a dynamic Harbour contrib lib +# (hbct in this example) +# {hbdyn&hb_dynsuffix}-env:_HB_DYNSUFF=${hb_dynsuffix} +# {hbdyn&!hb_dynsuffix}-env:_HB_DYNSUFF=_dll +# {hbdyn}-request=__HBEXTERN__HBCT__ +# {hbdyn}hbct.hbc diff --git a/harbour/extras/template/hbtpl.hbx b/harbour/extras/template/hbtpl.hbx index bbb546c2bc..e4e80056c0 100644 --- a/harbour/extras/template/hbtpl.hbx +++ b/harbour/extras/template/hbtpl.hbx @@ -6,7 +6,7 @@ */ /* -------------------------------------------------------------------- - * WARNING: Automatically generated code below. DO NOT EDIT! + * WARNING: Automatically generated code below. DO NOT EDIT! (except casing) * Regenerate using hbmk2 '-hbx=' option. */ diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index fb3afda57a..c666159bc2 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -5866,20 +5866,22 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel ) /* Create list of requested symbols */ array := {} - IF l_cMAIN != NIL - /* NOTE: Request this function to generate link error, rather - than starting with the wrong (default) function. */ - AAdd( array, Upper( iif( Left( l_cMAIN, 1 ) == "@", SubStr( l_cMAIN, 2 ), l_cMAIN ) ) ) - ENDIF - IF hbmk[ _HBMK_cGT ] != NIL - /* Always request default GT first */ - AAdd( array, "HB_GT_" + Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) ) - ENDIF - FOR EACH tmp IN hbmk[ _HBMK_aGT ] - IF hbmk[ _HBMK_cGT ] == NIL .OR. !( Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) == Upper( SubStr( tmp, 3 ) ) ) - AAdd( array, "HB_GT_" + Upper( SubStr( tmp, 3 ) ) ) + IF ! lHBMAINDLLP + IF l_cMAIN != NIL + /* NOTE: Request this function to generate link error, rather + than starting with the wrong (default) function. */ + AAdd( array, Upper( iif( Left( l_cMAIN, 1 ) == "@", SubStr( l_cMAIN, 2 ), l_cMAIN ) ) ) ENDIF - NEXT + IF hbmk[ _HBMK_cGT ] != NIL + /* Always request default GT first */ + AAdd( array, "HB_GT_" + Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) ) + ENDIF + FOR EACH tmp IN hbmk[ _HBMK_aGT ] + IF hbmk[ _HBMK_cGT ] == NIL .OR. !( Upper( SubStr( hbmk[ _HBMK_cGT ], 3 ) ) == Upper( SubStr( tmp, 3 ) ) ) + AAdd( array, "HB_GT_" + Upper( SubStr( tmp, 3 ) ) ) + ENDIF + NEXT + ENDIF AEval( hbmk[ _HBMK_aREQUEST ], {| tmp | AAdd( array, tmp ) } ) /* Build C stub */ @@ -5890,10 +5892,13 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel ) '#include "hbapi.h"' + Chr( 10 ) +; "" + Chr( 10 ) - IF ( ! Empty( array ) .OR. l_cCMAIN != NIL ) .AND. ! lHBMAINDLLP + IF ! Empty( array ) .OR. ( l_cCMAIN != NIL .AND. ! lHBMAINDLLP ) + AEval( array, {| tmp, i | array[ i ] := FuncNameEncode( tmp ) } ) + AEval( array, {| tmp | cFile += "HB_FUNC_EXTERN( " + tmp + " );" + Chr( 10 ) } ) - IF l_cCMAIN != NIL + + IF l_cCMAIN != NIL .AND. ! lHBMAINDLLP IF ! Empty( array ) cFile += "" + Chr( 10 ) ENDIF @@ -5905,7 +5910,7 @@ FUNCTION hbmk( aArgs, nArgTarget, /* @ */ lPause, nLevel ) cFile += "void _hb_lnk_ForceLink_hbmk( void )" + Chr( 10 ) cFile += "{" + Chr( 10 ) AEval( array, {| tmp | cFile += " HB_FUNC_EXEC( " + tmp + " );" + Chr( 10 ) } ) - IF l_cCMAIN != NIL + IF l_cCMAIN != NIL .AND. ! lHBMAINDLLP IF ! Empty( array ) cFile += "" + Chr( 10 ) ENDIF @@ -7336,7 +7341,8 @@ STATIC PROCEDURE AAddWithWarning( hbmk, aArray, cOption, aParam, lNew ) "-Wl,--allow-multiple-definition", ; /* gcc */ "muldefs", ; /* ld '-z muldefs' */ "force:multiple", ; /* msvc, pocc, watcom */ - "w-dpl" } /* bcc */ + "w-dup" , ; /* bcc */ + "w-dpl" } /* bcc (for libs) */ IF AScan( sc_aWarning, {| tmp | Lower( tmp ) $ Lower( cOption ) } ) > 0 _hbmk_OutErr( hbmk, hb_StrFormat( I_( "Warning: Dangerous low-level option not recommended: %1$s" ), ParamToString( aParam ) ) )