Commit 6d0ff11d authored by JP Dinger's avatar JP Dinger

A few sprintf()+n in text/strings.c

parent 745dbe97
......@@ -792,14 +792,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
if( p_item )
{
mtime_t i_duration = input_item_GetDuration( p_item );
sprintf( buf, "%02d:%02d:%02d",
snprintf( buf, 10, "%02d:%02d:%02d",
(int)(i_duration/(3600000000)),
(int)((i_duration/(60000000))%60),
(int)((i_duration/1000000)%60) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
}
INSERT_STRING_NO_FREE( buf );
break;
......@@ -826,14 +826,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
{
mtime_t i_duration = input_item_GetDuration( p_item );
int64_t i_time = var_GetInteger( p_input, "time" );
sprintf( buf, "%02d:%02d:%02d",
snprintf( buf, 10, "%02d:%02d:%02d",
(int)( ( i_duration - i_time ) / 3600000000 ),
(int)( ( ( i_duration - i_time ) / 60000000 ) % 60 ),
(int)( ( ( i_duration - i_time ) / 1000000 ) % 60 ) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
}
INSERT_STRING_NO_FREE( buf );
break;
......@@ -862,7 +862,7 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--.-%%" );
snprintf( buf, 10, b_empty_if_na ? "" : "--.-%%" );
}
INSERT_STRING_NO_FREE( buf );
break;
......@@ -894,14 +894,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
if( p_input )
{
int64_t i_time = var_GetInteger( p_input, "time" );
sprintf( buf, "%02d:%02d:%02d",
snprintf( buf, 10, "%02d:%02d:%02d",
(int)( i_time / ( 3600000000 ) ),
(int)( ( i_time / ( 60000000 ) ) % 60 ),
(int)( ( i_time / 1000000 ) % 60 ) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
}
INSERT_STRING_NO_FREE( buf );
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