1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-04 02:28:03 +00:00

(trunk libT) #3462 "minor json formatting optimization: omit unnecessary floating-point precision" -- done.

This commit is contained in:
Charles Kerr 2010-07-31 14:45:07 +00:00
parent 52922f89f1
commit 6d445f29eb

View file

@ -1349,8 +1349,8 @@ jsonRealFunc( const tr_benc * val, void * vdata )
struct jsonWalk * data = vdata;
char locale[128];
if( fabs( val->val.d ) < 0.00001 )
evbuffer_add( data->out, "0", 1 );
if( fabs( val->val.d - (int)val->val.d ) < 0.00001 )
evbuffer_add_printf( data->out, "%d", (int)val->val.d );
else {
/* json requires a '.' decimal point regardless of locale */
tr_strlcpy( locale, setlocale( LC_NUMERIC, NULL ), sizeof( locale ) );