From 5afc7f78ad49631908bc727d6a8c9ae4556a77ee Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 25 Oct 2010 15:20:28 +0000 Subject: [PATCH] 2010-10-25 17:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/hbjson.c * modified the if() condition to pacify some compiler warnings --- harbour/ChangeLog | 4 ++++ harbour/src/rtl/hbjson.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d2a2186236..2608d6fb10 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-25 17:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/hbjson.c + * modified the if() condition to pacify some compiler warnings + 2010-10-25 15:21 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/hbstrfmt.c + added support for 'x' and 'X' specifiers in hb_strFormat() function diff --git a/harbour/src/rtl/hbjson.c b/harbour/src/rtl/hbjson.c index 5fad3e9db7..9755a62eff 100644 --- a/harbour/src/rtl/hbjson.c +++ b/harbour/src/rtl/hbjson.c @@ -286,12 +286,12 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n if( nLen ) { HB_SIZE nIndex; - + if( pCtx->fHuman ) _hb_jsonCtxAddIndent( pCtx, nLevel * INDENT_SIZE ); _hb_jsonCtxAdd( pCtx, "[", 1 ); - + for( nIndex = 1; nIndex <= nLen; nIndex++ ) { PHB_ITEM pItem = hb_arrayGetItemPtr( pValue, nIndex ); @@ -302,8 +302,9 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n if( pCtx->fHuman ) _hb_jsonCtxAdd( pCtx, s_szEol, s_iEolLen ); - if( pCtx->fHuman && ( ! HB_IS_ARRAY( pItem ) && ! HB_IS_HASH( pItem ) || - hb_itemSize( pItem ) == 0 ) ) + if( pCtx->fHuman && + !( ( HB_IS_ARRAY( pItem ) || HB_IS_HASH( pItem ) ) && + hb_itemSize( pItem ) > 0 ) ) _hb_jsonCtxAddIndent( pCtx, ( nLevel + 1 ) * INDENT_SIZE ); _hb_jsonEncode( pItem, pCtx, nLevel + 1 ); @@ -334,13 +335,13 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n for( nIndex = 1; nIndex <= nLen; nIndex++ ) { PHB_ITEM pKey = hb_hashGetKeyAt( pValue, nIndex ); - + if( HB_IS_STRING( pKey ) ) { PHB_ITEM pItem = hb_hashGetValueAt( pValue, nIndex ); if( nIndex > 1 ) _hb_jsonCtxAdd( pCtx, ",", 1 ); - + if( pCtx->fHuman ) { _hb_jsonCtxAdd( pCtx, s_szEol, s_iEolLen ); @@ -351,7 +352,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n if( pCtx->fHuman ) { _hb_jsonCtxAdd( pCtx, " : ", 3 ); - if( ( HB_IS_ARRAY( pItem ) || HB_IS_HASH( pItem ) ) && hb_itemSize( pItem ) > 0 ) + if( ( HB_IS_ARRAY( pItem ) || HB_IS_HASH( pItem ) ) && hb_itemSize( pItem ) > 0 ) _hb_jsonCtxAdd( pCtx, s_szEol, s_iEolLen ); } else