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.
This commit is contained in:
Viktor Szakats
2012-11-17 18:59:04 +00:00
parent 23dbce640c
commit e9ca3f1b80
2 changed files with 13 additions and 2 deletions

View File

@@ -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

View File

@@ -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;