mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
(trunk libT) prevent potential rounding errors when sending floating-point numbers across the wire in json form
This commit is contained in:
parent
87a7bf043a
commit
723cabb542
1 changed files with 1 additions and 1 deletions
|
@ -1301,7 +1301,7 @@ jsonRealFunc( const tr_benc * val, void * vdata )
|
|||
/* json requires a '.' decimal point regardless of locale */
|
||||
tr_strlcpy( locale, setlocale( LC_NUMERIC, NULL ), sizeof( locale ) );
|
||||
setlocale( LC_NUMERIC, "POSIX" );
|
||||
evbuffer_add_printf( data->out, "%.4f", val->val.d );
|
||||
evbuffer_add_printf( data->out, "%.4f", tr_truncd( val->val.d, 4 ) );
|
||||
setlocale( LC_NUMERIC, locale );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue