[vlc-devel] commit: A few sprintf()+n in text/strings.c (JP Dinger )

git version control git at videolan.org
Sat May 30 22:36:17 CEST 2009


vlc | branch: master | JP Dinger <jpd at videolan.org> | Sat May 30 22:35:45 2009 +0200| [6d0ff11dec49ae7f335ceed15c6a2e46cddd880d] | committer: JP Dinger 

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d0ff11dec49ae7f335ceed15c6a2e46cddd880d
---

 src/text/strings.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/text/strings.c b/src/text/strings.c
index 736bb87..c73dec6 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -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;




More information about the vlc-devel mailing list