Commit 4413d750 authored by Clément Stenac's avatar Clément Stenac

Don't use %f in HTTP interface (Closes:#584)

parent e68d9e1a
......@@ -687,6 +687,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
int i;
float f;
char *psz;
lldiv_t div;
if( *m->param1 == '\0' )
{
......@@ -701,7 +702,9 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
break;
case MVLC_FLOAT:
f = config_GetFloat( p_intf, m->param1 );
sprintf( value, "%f", f );
div = lldiv( f * 1000000 , 1000000 );
sprintf( value, I64Fd".%06u", div.quot,
(unsigned int)div.rem );
break;
case MVLC_STRING:
psz = config_GetPsz( p_intf, m->param1 );
......
......@@ -694,7 +694,9 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
case VLC_VAR_FLOAT:
{
char psz_value[20];
snprintf( psz_value, sizeof(psz_value), "%f", val.f_float );
lldiv_t value = lldiv( val.f_float * 1000000, 1000000 );
snprintf( psz_value, sizeof(psz_value), I64Fd".%06u",
value.quot, (unsigned int)value.rem );
E_(SSPush)( st, psz_value );
break;
}
......@@ -788,8 +790,10 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
case VLC_VAR_FLOAT:
{
char psz_string[20];
snprintf( psz_string, sizeof(psz_string), "%f",
config_GetFloat( p_intf, psz_variable ) );
lldiv_t value = lldiv( config_GetFloat( p_intf, psz_variable )
* 1000000, 1000000 );
snprintf( psz_string, sizeof(psz_string), I64Fd".%06u",
value.quot, (unsigned int)value.rem );
E_(SSPush)( st, psz_string );
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment