diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 06f3fa2612..43642b2bbd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-09 16:05 UTC+0200 Petr Chornyj (myorg63 at mail.ru) + * contrib/hbmxml/tests/custom.prg + * Minor changes + * contrib/hbmxml/hbmxml.c + ! Fixed mxmlEntityGet[Name|Value]() + 2011-01-09 13:00 UTC+0200 Petr Chornyj (myorg63 at mail.ru) * contrib/hbmxml/tests/test.prg * contrib/hbmxml/hbmxml.c diff --git a/harbour/contrib/hbmxml/hbmxml.c b/harbour/contrib/hbmxml/hbmxml.c index 5395beb489..6ba522b4ae 100644 --- a/harbour/contrib/hbmxml/hbmxml.c +++ b/harbour/contrib/hbmxml/hbmxml.c @@ -136,7 +136,6 @@ static HB_GARBAGE_FUNC( hbmxml_nodeDestructor ) if( pHbnode->flags == 1 ) { mxmlDelete( pHbnode->node ); - pHbnode->node = NULL; } } @@ -261,15 +260,15 @@ HB_FUNC( MXMLADD ) mxml_node_t * parent = mxml_node_param( 1 ); int where = hb_parnidef( 2, MXML_ADD_BEFORE ); mxml_node_t * child = mxml_node_param( 3 ); - mxml_node_t * node = mxml_node_param( 4 ); - - where = ( ( where == MXML_ADD_BEFORE ) ? MXML_ADD_BEFORE : MXML_ADD_AFTER ); - - if( parent && node ) + HBMXML_NODE * pNode = ( HBMXML_NODE * ) hb_parptrGC( &s_gc_mxml_nodeFuncs, 4 ); + + if( parent && pNode && pNode->node ) { - int TODO; + where = ( where == MXML_ADD_BEFORE ) ? MXML_ADD_BEFORE : MXML_ADD_AFTER; - mxmlAdd( parent, where, ( child != NULL ) ? child : MXML_ADD_TO_PARENT, node ); + mxmlAdd( parent, where, ( child != NULL ) ? child : MXML_ADD_TO_PARENT, pNode->node ); + + pNode->flags = 0; } else MXML_ERR_ARGS; @@ -357,7 +356,7 @@ HB_FUNC( MXMLELEMENTSETATTR ) HB_FUNC( MXMLENTITYGETNAME ) { - hb_retstr_utf8( mxmlEntityGetName( hb_parni( 1 ) - 1 ) ); /* ?? */ + hb_retstr_utf8( mxmlEntityGetName( hb_parni( 1 ) ) ); } /* int mxmlEntityGetValue( const char * name ) */ @@ -365,9 +364,8 @@ HB_FUNC( MXMLENTITYGETNAME ) HB_FUNC( MXMLENTITYGETVALUE ) { void * hName; - int i = mxmlEntityGetValue( hb_parstr_utf8( 1, &hName, NULL ) ); - hb_retni( i < 0 ? -1 : i + 1 ); /* ?? */ + hb_retni( mxmlEntityGetValue( hb_parstr_utf8( 1, &hName, NULL ) ) ); hb_strfree( hName ); } @@ -1113,13 +1111,13 @@ HB_FUNC( MXMLRELEASE ) HB_FUNC( MXMLREMOVE ) { - mxml_node_t * node = mxml_node_param( 1 ); - - if( node ) + HBMXML_NODE * pNode = ( HBMXML_NODE * ) hb_parptrGC( &s_gc_mxml_nodeFuncs, 1 ); + + if( pNode && pNode->node ) { - int TODO; + mxmlRemove( pNode->node ); - mxmlRemove( node ); + pNode->flags = 1; } else MXML_ERR_ARGS; diff --git a/harbour/contrib/hbmxml/tests/custom.prg b/harbour/contrib/hbmxml/tests/custom.prg index 9e7379588d..162b0892e6 100644 --- a/harbour/contrib/hbmxml/tests/custom.prg +++ b/harbour/contrib/hbmxml/tests/custom.prg @@ -7,7 +7,7 @@ #include "hbmxml.ch" #include "hbinkey.ch" -FUNCTION main( ) +PROCEDURE main() LOCAL tree, node LOCAL xData @@ -26,14 +26,16 @@ FUNCTION main( ) OutErr( "Unable to find element in XML tree!" ) mxmlDelete( tree ) - RETURN -1 + ErrorLevel( -1 ) + RETURN ENDIF IF hb_md5( _ENCODE( node ) ) != mxmlElementGetAttr( node, "checksum" ) OutErr( "Custom data of element is corrupted!" ) mxmlDelete( tree ) - RETURN -1 + ErrorLevel( -1 ) + RETURN ENDIF xData := mxmlGetCustom( node ) @@ -44,7 +46,8 @@ FUNCTION main( ) mxmlSetErrorCallback( NIL ) mxmlSetCustomHandlers( NIL, NIL ) - RETURN 0 + ErrorLevel( 0 ) + RETURN STATIC PROCEDURE create_cust()