diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f6752f5ed4..32e338ee44 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-11-17 19:55 UTC+0100 Viktor Szakats (harbour syenar.net) + * src/rtl/hbjson.c + ! applied patch supplied by Oscar Hernandez Suarez + in sf.net #3587899. Test code at + https://groups.google.com/d/topic/harbour-devel/CyLxxmmJZRY/discussion + ! fixed formatting + ; Mindaugas, please review it. + 2012-11-17 18:50 UTC+0100 Viktor Szakats (harbour syenar.net) + website/css/shCore.css + website/css/shThemeDefault.css diff --git a/harbour/src/rtl/hbjson.c b/harbour/src/rtl/hbjson.c index d75afd5b37..df7674a381 100644 --- a/harbour/src/rtl/hbjson.c +++ b/harbour/src/rtl/hbjson.c @@ -481,6 +481,7 @@ static const char * _hb_jsonDecode( const char * szSource, PHB_ITEM pValue ) HB_MAXINT nValue = 0; double dblValue = 0; HB_BOOL fNeg, fDbl = HB_FALSE; + int iDec = 0; fNeg = *szSource == '-'; if( fNeg ) @@ -503,6 +504,7 @@ static const char * _hb_jsonDecode( const char * szSource, PHB_ITEM pValue ) mult /= 10; dblValue += ( ( double ) ( *szSource - '0' ) ) * mult; szSource++; + iDec++; } } if( *szSource == 'e' || *szSource == 'E' ) @@ -515,7 +517,6 @@ static const char * _hb_jsonDecode( const char * szSource, PHB_ITEM pValue ) if( fNegExp ) szSource++; - szSource++; while( *szSource >= '0' && *szSource <= '9' ) { iExp = iExp * 10 + *szSource - '0'; @@ -527,10 +528,12 @@ static const char * _hb_jsonDecode( const char * szSource, PHB_ITEM pValue ) fDbl = HB_TRUE; } dblValue *= pow( 10.0, ( double ) ( fNegExp ? -iExp : iExp ) ); + if( fNegExp ) + iDec += iExp; } if( fDbl ) - hb_itemPutND( pValue, fNeg ? -dblValue : dblValue ); + hb_itemPutNDDec( pValue, fNeg ? -dblValue : dblValue, iDec ); else hb_itemPutNInt( pValue, fNeg ? -nValue : nValue ); return szSource;