2011-01-17 00:05 UTC+0200 Petr Chornyj (myorg63 at mail.ru)

* contrib/hbmxml/hbmxml.c
    ! Fixed warning reported by bcc55 in mxmlNewCustom() 
  * contrib/hbmxml/tests/testmxml.prg
    * Changed whitespace_cb() to respect official mxml test result
      f.e. hb_eol() -> e"\n"
This commit is contained in:
Petr Chornyj
2011-01-16 22:07:42 +00:00
parent 784f6c6564
commit a26fe95871
3 changed files with 38 additions and 39 deletions

View File

@@ -16,6 +16,13 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-01-17 00:05 UTC+0200 Petr Chornyj (myorg63 at mail.ru)
* contrib/hbmxml/hbmxml.c
! Fixed warning reported by bcc55 in mxmlNewCustom()
* contrib/hbmxml/tests/testmxml.prg
* Changed whitespace_cb() to respect official mxml test result
f.e. hb_eol() -> e"\n"
2011-01-16 17:06 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbmxml/hbmxml.c
% optimized user callback calls

View File

@@ -1743,41 +1743,31 @@ static void custom_destroy_cb( void * Cargo )
HB_FUNC( MXMLNEWCUSTOM )
{
mxml_node_t * node = MXML_NO_PARENT;
if( hb_pcount() > 1 )
{
PHB_ITEM pItem = hb_itemClone( hb_param( 2, HB_IT_ANY ) );
mxml_node_t * parent = NULL;
mxml_node_t * node = NULL;
if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) )
{
PHB_ITEM pItem = hb_itemClone( hb_param( 2, HB_IT_ANY ) );
node = mxmlNewCustom( MXML_NO_PARENT, pItem, custom_destroy_cb );
if( node )
mxml_node_ret( node, 1 );
else
hb_itemRelease( pItem );
}
node = mxmlNewCustom( MXML_NO_PARENT, pItem, custom_destroy_cb );
else
{
mxml_node_t * node_parent = mxml_node_param( 1 );
parent = mxml_node_param( 1 );
if( node_parent )
{
PHB_ITEM pItem = hb_itemClone( hb_param( 2, HB_IT_ANY ) );
node = mxmlNewCustom( node_parent, pItem, custom_destroy_cb );
if( node )
mxml_node_ret( node, 0 );
else
hb_itemRelease( pItem );
}
else
MXML_ERR_ARGS;
if( parent != NULL )
node = mxmlNewCustom( parent, pItem, custom_destroy_cb );
}
}
else
MXML_ERR_ARGS;
if( node != NULL )
{
mxml_node_ret( node, ( parent != NULL ) ? 0 : 1 );
return;
}
hb_itemRelease( pItem );
}
MXML_ERR_ARGS;
}
/*
@@ -1932,8 +1922,9 @@ HB_FUNC( HB_MXMLGETATTRSARRAY )
int i;
mxml_attr_t * attr;
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs ;
i > 0; i --, attr++ )
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs;
i > 0;
i--, attr++ )
{
PHB_ITEM pAttr = hb_itemArrayNew( 2 );
@@ -1963,8 +1954,9 @@ HB_FUNC( HB_MXMLGETATTRS )
hb_hashSetFlags( pAttrs, HB_HASH_KEEPORDER );
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs ;
i > 0; i --, attr++ )
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs;
i > 0;
i--, attr++ )
{
PHB_ITEM pKey = hb_itemPutStrUTF8( NULL, attr->name );
PHB_ITEM pValue = hb_itemPutStrUTF8( NULL, attr->value );

View File

@@ -658,7 +658,7 @@ FUNCTION whitespace_cb( hNode, nWhere ) /* O - Whitespace string or nil */
*/
IF nWhere == MXML_WS_BEFORE_OPEN .OR. nWhere == MXML_WS_AFTER_CLOSE
RETURN hb_eol()
RETURN e"\n"
ENDIF
ELSEIF cName == "dl" .OR. cName == "ol" .OR. cName == "ul"
@@ -666,7 +666,7 @@ FUNCTION whitespace_cb( hNode, nWhere ) /* O - Whitespace string or nil */
* Put a newline before and after list elements...
*/
RETURN hb_eol()
RETURN e"\n"
ELSEIF cName == "dd" .OR. cName == "dd" .OR. cName == "li"
/*
@@ -674,13 +674,13 @@ FUNCTION whitespace_cb( hNode, nWhere ) /* O - Whitespace string or nil */
*/
IF nWhere == MXML_WS_BEFORE_OPEN
RETURN Space( 8 )
RETURN e"\t"
ELSEIF nWhere == MXML_WS_AFTER_CLOSE
RETURN hb_eol()
RETURN e"\n"
ENDIF
ELSEIF Left( cName, 4 ) == "?xml"
IF nWhere == MXML_WS_AFTER_OPEN
RETURN hb_eol()
RETURN e"\n"
ELSE
RETURN nil
ENDIF
@@ -699,14 +699,14 @@ FUNCTION whitespace_cb( hNode, nWhere ) /* O - Whitespace string or nil */
nLevel := 0
ENDIF
RETURN Replicate( Chr( 9 ), nLevel )
RETURN Replicate( e"\t", nLevel )
ELSEIF nWhere == MXML_WS_AFTER_CLOSE .OR. ;
( ( cName == "group" .OR. cName == "option" .OR. cName == "choice" ) .AND. ;
nWhere == MXML_WS_AFTER_OPEN )
RETURN hb_eol()
RETURN e"\n"
ELSEIF nWhere == MXML_WS_AFTER_OPEN .AND. Empty( mxmlGetFirstChild( hNode ) )
RETURN hb_eol()
RETURN e"\n"
ENDIF
/*