From caeeac68d51574eb529d62beb7ede968e628f2f5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 12 Jun 2009 09:03:14 +0000 Subject: [PATCH] 2009-06-12 11:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/debug/dbgentry.c * contrib/xhb/hbxml.c * contrib/hbbtree/hb_btree.c % hb_itemRelease( hb_itemReturn() ) -> hb_itemReturnRelease() * contrib/xhb/hbxml.c ! Applied this fix from xhb: 2008-11-06 20:00 UTC+0100 Jose F. Gimenez ! 'Escape' characters, such & or " were not written correctly in node attribute values ! 'Escape' characters in the form &#NN; and &#xHH; were not allowed when reading --- harbour/ChangeLog | 12 +++++++ harbour/contrib/hbbtree/hb_btree.c | 51 ++++++++++-------------------- harbour/contrib/xhb/hbxml.c | 19 ++++++----- harbour/source/debug/dbgentry.c | 4 +-- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 00dd7a1384..545ab519f1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-12 11:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/debug/dbgentry.c + * contrib/xhb/hbxml.c + * contrib/hbbtree/hb_btree.c + % hb_itemRelease( hb_itemReturn() ) -> hb_itemReturnRelease() + + * contrib/xhb/hbxml.c + ! Applied this fix from xhb: + 2008-11-06 20:00 UTC+0100 Jose F. Gimenez + ! 'Escape' characters, such & or " were not written correctly in node attribute values + ! 'Escape' characters in the form &#NN; and &#xHH; were not allowed when reading + 2009-06-12 09:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * bin/hb-mkimp.bat * Renamed 'owatcom' to 'watcom'. (missed from prev) diff --git a/harbour/contrib/hbbtree/hb_btree.c b/harbour/contrib/hbbtree/hb_btree.c index 7de6532e92..1f07d51324 100644 --- a/harbour/contrib/hbbtree/hb_btree.c +++ b/harbour/contrib/hbbtree/hb_btree.c @@ -1848,7 +1848,7 @@ HB_FUNC( HB_BTREEINSERT ) /* hb_BTreeInsert( hb_BTree_Handle, CHAR cKey, LONG l else { hb_RaiseError( HB_BTreeArgError_EC, "Bad argument(s)", HB_ERR_FUNCNAME, hb_pcount() ); - hb_retl( 0 ); + hb_retl( FALSE ); } } @@ -1860,7 +1860,7 @@ HB_FUNC( HB_BTREEDELETE ) /* hb_BTreeDelete( hb_BTree_Handle, CHAR cKey, LONG l else { hb_RaiseError( HB_BTreeArgError_EC, "Bad argument(s)", HB_ERR_FUNCNAME, hb_pcount() ); - hb_retl( 0 ); + hb_retl( FALSE ); } } @@ -1920,7 +1920,7 @@ HB_FUNC( HB_BTREESEEK ) /* hb_BTreeSeek( hb_BTree_Handle, CHAR cKey, LONG lData else { hb_RaiseError( HB_BTreeArgError_EC, "Bad argument(s)", HB_ERR_FUNCNAME, hb_pcount() ); - hb_retl( 0 ); + hb_retl( FALSE ); } } @@ -1931,7 +1931,8 @@ HB_FUNC( HB_BTREEINFO ) /* hb_BTreeInfo( hb_BTree_Handle, [index] ) -> aResults HB_TRACE( HB_TR_DEBUG, ( SRCLINENO ) ); if ( pBTree ) - switch ( hb_parni( 2 ) ) { + switch ( hb_parni( 2 ) ) + { case HB_BTREEINFO_FILENAME: hb_retc( ( char * ) pBTree->szFileName ); break; case HB_BTREEINFO_PAGESIZE: hb_retni( pBTree->usPageSize ); break; case HB_BTREEINFO_KEYSIZE: hb_retni( pBTree->usKeySize ); break; @@ -1941,40 +1942,20 @@ HB_FUNC( HB_BTREEINFO ) /* hb_BTreeInfo( hb_BTree_Handle, [index] ) -> aResults case HB_BTREEINFO_KEYCOUNT: hb_retnl( pBTree->ulKeyCount ); break; case HB_BTREEINFO_ALL: default: /* build an array and store all elements from above into it */ - { - PHB_ITEM temp, info = hb_itemArrayNew( HB_BTREEINFO__SIZE ); + { + PHB_ITEM info = hb_itemArrayNew( HB_BTREEINFO__SIZE ); - temp = hb_itemPutC( NULL, ( char * ) pBTree->szFileName ); - hb_itemArrayPut( info, HB_BTREEINFO_FILENAME, temp ); - hb_itemRelease( temp ); + hb_arraySetC( info, HB_BTREEINFO_FILENAME, ( char * ) pBTree->szFileName ); + hb_arraySetNI( info, HB_BTREEINFO_PAGESIZE, pBTree->usPageSize ); + hb_arraySetNI( info, HB_BTREEINFO_KEYSIZE , pBTree->usKeySize ); + hb_arraySetNI( info, HB_BTREEINFO_MAXKEYS , pBTree->usMaxKeys ); + hb_arraySetNI( info, HB_BTREEINFO_MINKEYS , pBTree->usMinKeys ); + hb_arraySetNL( info, HB_BTREEINFO_FLAGS , pBTree->ulFlags ); + hb_arraySetNL( info, HB_BTREEINFO_KEYCOUNT, pBTree->ulKeyCount ); - temp = hb_itemPutNI( NULL, pBTree->usPageSize ); - hb_itemArrayPut( info, HB_BTREEINFO_PAGESIZE, temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNI( NULL, pBTree->usKeySize ); - hb_itemArrayPut( info, HB_BTREEINFO_KEYSIZE , temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNI( NULL, pBTree->usMaxKeys ); - hb_itemArrayPut( info, HB_BTREEINFO_MAXKEYS , temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNI( NULL, pBTree->usMinKeys ); - hb_itemArrayPut( info, HB_BTREEINFO_MINKEYS , temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, pBTree->ulFlags ); - hb_itemArrayPut( info, HB_BTREEINFO_FLAGS , temp ); - hb_itemRelease( temp ); - - temp = hb_itemPutNL( NULL, pBTree->ulKeyCount ); - hb_itemArrayPut( info, HB_BTREEINFO_KEYCOUNT, temp ); - hb_itemRelease( temp ); - - hb_itemRelease( hb_itemReturn( info ) ); + hb_itemReturnRelease( info ); + } } - } } #if 0 diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index 20d24d4624..413834b318 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -378,11 +378,18 @@ static MXML_STATUS mxml_attribute_read( MXML_REFIL *ref, PHB_ITEM pDoc, PHB_ITEM else if ( strncmp( bp, "gt", iAmpLen ) == 0 ) chr = '>'; else if ( strncmp( bp, "quot", iAmpLen ) == 0 ) chr = '"'; else if ( strncmp( bp, "apos", iAmpLen ) == 0 ) chr = '\''; + else if ( *bp == '#' ) + { + if ( *(++bp) == 'x' ) /* Hexadecimal */ + chr = ( ( *( bp + 1 ) - '0' ) << 4 ) + ( *( bp + 2 ) - '0' ); + else /* Decimal */ + chr = atoi( bp ); + } /** Reducing an SGS length is legal */ buf_attrib->length = iPosAmper; mxml_sgs_append_char( buf_attrib, ( char ) chr ); } - else if ( ! HB_ISALPHA( chr ) ) + else if ( ! ( HB_ISALPHA( chr ) || HB_ISDIGIT( chr ) || ( chr == '#' ) ) ) { /* error - we have something like & & */ hbxml_set_doc_status( ref, pDoc, pNode, MXML_STATUS_MALFORMED, MXML_ERROR_WRONGENTITY ); @@ -432,7 +439,7 @@ static MXML_STATUS mxml_attribute_write( MXML_OUTPUT *out, PHBXML_ATTRIBUTE pAtt mxml_output_char( out, '=' ); mxml_output_char( out, '"' ); - if ( style & MXML_STYLE_NOESCAPE ) + if ( ! ( style & MXML_STYLE_NOESCAPE ) ) { mxml_output_string_escape( out, hb_itemGetCPtr( pAttr->pValue ) ); } @@ -706,9 +713,7 @@ static PHB_ITEM mxml_node_clone( PHB_ITEM pTg ) HB_FUNC( HBXML_NODE_CLONE ) { - PHB_ITEM pClone = mxml_node_clone( hb_param( 1, HB_IT_OBJECT ) ); - - hb_itemRelease( hb_itemReturn( pClone ) ); + hb_itemReturnRelease( mxml_node_clone( hb_param( 1, HB_IT_OBJECT ) ) ); } /** @@ -747,9 +752,7 @@ static PHB_ITEM mxml_node_clone_tree( PHB_ITEM pTg ) HB_FUNC( HBXML_NODE_CLONE_TREE ) { - PHB_ITEM pClone = mxml_node_clone_tree( hb_param( 1, HB_IT_OBJECT ) ); - - hb_itemRelease( hb_itemReturn( pClone ) ); + hb_itemReturnRelease( mxml_node_clone_tree( hb_param( 1, HB_IT_OBJECT ) ) ); } /* reads a data node */ diff --git a/harbour/source/debug/dbgentry.c b/harbour/source/debug/dbgentry.c index 542810a211..4d24aefb4a 100644 --- a/harbour/source/debug/dbgentry.c +++ b/harbour/source/debug/dbgentry.c @@ -1673,7 +1673,7 @@ HB_FUNC( __DBGGETEXPRVALUE ) if( pItem ) { hb_storl( TRUE, 3 ); - hb_itemRelease( hb_itemReturn( pItem ) ); + hb_itemReturnRelease( pItem ); } else hb_storl( FALSE, 3 ); @@ -1684,7 +1684,7 @@ HB_FUNC( __DBGGETSOURCEFILES ) { void * ptr = hb_parptr( 1 ); if( ptr ) - hb_itemRelease( hb_itemReturn( hb_dbgGetSourceFiles( ptr ) ) ); + hb_itemReturnRelease( hb_dbgGetSourceFiles( ptr ) ); } HB_FUNC( __DBGISVALIDSTOPLINE )