File: 0121-qt-use-QString-setNum-rather-than-QString-sprintf.patch

package info (click to toggle)
vlc 3.0.21-10
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 212,728 kB
  • sloc: ansic: 441,379; cpp: 110,628; objc: 36,394; sh: 6,947; makefile: 6,592; javascript: 4,902; xml: 1,611; asm: 1,355; yacc: 640; python: 555; lex: 88; perl: 77; sed: 16
file content (26 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Wed, 18 Dec 2024 11:57:05 +0100
Subject: qt: use QString::setNum() rather than QString::sprintf()

It's deprecated and one of the replacement suggested in the doc [^1].
QString::asprint() might be the more logical choice, but it's also not recommended [^2].

[^1] https://doc.qt.io/qt-5/qstring-obsolete.html#sprintf
[^2] https://doc.qt.io/qt-5/qstring.html#asprintf
---
 modules/gui/qt/menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 70a475f..a689b4c 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -1438,7 +1438,7 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
             case VLC_VAR_FLOAT:
                 var_Get( p_object, psz_var, &val );
                 if( CURTEXT ) menutext = qfue( CURTEXT );
-                else menutext.sprintf( "%.2f", CURVAL.f_float );
+                else menutext.setNum(CURVAL.f_float, 'f', 2);
                 CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
                         p_object, CURVAL, i_type,
                         CURVAL.f_float == val.f_float );