[vlc-commits] qt: info_panels: replace deprecated QString::sprintf

Alexandre Janniaux git at videolan.org
Wed Jan 22 10:08:50 CET 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sun Jan 19 16:39:05 2020 +0100| [50d57469219f82981856a18a2698cf349e9b951c] | committer: Thomas Guillem

qt: info_panels: replace deprecated QString::sprintf

QString::sprintf is deprecated in Qt 5.14, so use QString::setNum
instead. As we always use the same precision, width and format, enforce
it in the macro itself too.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/gui/qt/dialogs/mediainfo/info_panels.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/dialogs/mediainfo/info_panels.cpp b/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
index f5250362dd..662c8dd45d 100644
--- a/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
+++ b/modules/gui/qt/dialogs/mediainfo/info_panels.cpp
@@ -642,13 +642,13 @@ void InputStatsPanel::update( const input_stats_t& stats )
 #define UPDATE_INT( widget, calc... ) \
     { widget->setText( 1, QString::number( (qulonglong)calc ) ); }
 
-#define UPDATE_FLOAT( widget, format, calc... ) \
-    { QString str; widget->setText( 1 , str.sprintf( format, ## calc ) );  }
+#define UPDATE_FLOAT( widget, calc ) \
+    widget->setText( 1 , QString().setNum(calc, 'f', 0).leftJustified(6) )
 
     UPDATE_INT( read_media_stat, (stats.i_read_bytes / 1024 ) );
-    UPDATE_FLOAT( input_bitrate_stat,  "%6.0f", (float)(stats.f_input_bitrate *  8000 ));
+    UPDATE_FLOAT( input_bitrate_stat,  (float)(stats.f_input_bitrate *  8000 ));
     UPDATE_INT( demuxed_stat,    (stats.i_demux_read_bytes / 1024 ) );
-    UPDATE_FLOAT( stream_bitrate_stat, "%6.0f", (float)(stats.f_demux_bitrate *  8000 ));
+    UPDATE_FLOAT( stream_bitrate_stat, (float)(stats.f_demux_bitrate *  8000 ));
     UPDATE_INT( corrupted_stat,      stats.i_demux_corrupted );
     UPDATE_INT( discontinuity_stat,  stats.i_demux_discontinuity );
 



More information about the vlc-commits mailing list