[vlc-devel] [PATCH 2/2] Qt: sprintf is deprecated

Francois Cartegnie fcvlcdev at free.fr
Thu Mar 11 17:06:53 CET 2010


---
 modules/gui/qt4/components/interface_widgets.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 8e1dae3..e86f25c 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -620,9 +620,10 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
                                                            : time );
 
-    QString timestr;
-    timestr.sprintf( " %s%s/%s ", (b_remainingTime && length) ? "-" : "",
-                     psz_time, ( !length && time ) ? "--:--" : psz_length );
+    QString timestr = QString( " %1%2/%3 " )
+            .arg( QString( (b_remainingTime && length) ? "-" : "" ) )
+            .arg( QString( psz_time ) )
+            .arg( QString( ( !length && time ) ? "--:--" : psz_length ) );
 
     setText( timestr );
 
@@ -641,9 +642,10 @@ void TimeLabel::setDisplayPosition( float pos )
     secstotimestr( psz_time,
                    ( b_remainingTime && cachedLength ?
                    cachedLength - time : time ) );
-    QString timestr;
-    timestr.sprintf( " %s%s/%s ", (b_remainingTime && cachedLength) ? "-" : "",
-                     psz_time, ( !cachedLength && time ) ? "--:--" : psz_length );
+    QString timestr = QString( " %1%2/%3 " )
+        .arg( QString( (b_remainingTime && cachedLength) ? "-" : "" ) )
+        .arg( QString( psz_time ) )
+        .arg( QString( ( !cachedLength && time ) ? "--:--" : psz_length ) );
 
     setText( timestr );
 }
-- 
1.6.4.4




More information about the vlc-devel mailing list