[vlc-commits] [Git][videolan/vlc][master] qt: define QT_NO_CAST_FROM_BYTEARRAY

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 28 12:20:55 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
18f4f954 by Fatih Uzunoglu at 2024-11-28T11:47:05+00:00
qt: define QT_NO_CAST_FROM_BYTEARRAY

It is dangerous to have implicit casting between
QByteArray and pointer types.

- - - - -


6 changed files:

- modules/gui/qt/Makefile.am
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/meson.build
- modules/gui/qt/playlist/playlist_controller.cpp
- modules/gui/qt/util/effects_image_provider.cpp
- modules/gui/qt/util/model_recovery_agent.hpp


Changes:

=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -29,6 +29,7 @@ libqt_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_qt) \
 	-DQT_STRICT_ITERATORS \
 	-DQT_USE_QSTRINGBUILDER \
 	-DQT_NO_CAST_TO_ASCII \
+	-DQT_NO_CAST_FROM_BYTEARRAY \
 	-I$(srcdir) -I$(builddir) \
 	-I$(builddir)/dialogs/extended \
 	-I$(builddir)/dialogs/fingerprint \


=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -1208,10 +1208,10 @@ void SPrefsPanel::apply()
         QByteArray devicepath = m_inputCodecUI.DVDDeviceComboBox->currentText().toUtf8();
         if( devicepath.size() > 0 )
         {
-            config_PutPsz( "dvd", devicepath );
-            config_PutPsz( "vcd", devicepath );
+            config_PutPsz( "dvd", devicepath.constData() );
+            config_PutPsz( "vcd", devicepath.constData() );
             if( module_exists( "cdda" ) )
-                config_PutPsz( "cd-audio", devicepath );
+                config_PutPsz( "cd-audio", devicepath.constData() );
         }
 
 #define CaC( name, factor ) config_PutInt( name, i_comboValue * factor )


=====================================
modules/gui/qt/meson.build
=====================================
@@ -7,7 +7,7 @@ qt6 = import('qt6')
 qt_include_dir = include_directories('.')
 
 qt_extra_deps = []
-qt_extra_flags = ['-DQT_STRICT_ITERATORS','-DQT_USE_QSTRINGBUILDER','-DQT_NO_CAST_TO_ASCII']
+qt_extra_flags = ['-DQT_STRICT_ITERATORS','-DQT_USE_QSTRINGBUILDER','-DQT_NO_CAST_TO_ASCII','-DQT_NO_CAST_FROM_BYTEARRAY']
 qt_cppargs = []
 qt_link_args = []
 


=====================================
modules/gui/qt/playlist/playlist_controller.cpp
=====================================
@@ -580,7 +580,7 @@ int PlaylistController::serialize(const QString &fileName)
 {
     Q_D(PlaylistController);
     vlc_playlist_locker lock{d->m_playlist};
-    return vlc_playlist_Export(d->m_playlist, fileName.toUtf8(), "export-m3u8");
+    return vlc_playlist_Export(d->m_playlist, qtu(fileName), "export-m3u8");
 }
 
 int PlaylistController::currentIndex() const


=====================================
modules/gui/qt/util/effects_image_provider.cpp
=====================================
@@ -228,7 +228,7 @@ QImage EffectsImageProvider::requestImage(const QString &id, QSize *size, const
         const QUrlQuery query(url);
 
         std::unique_ptr<IEffect> effect;
-        switch (static_cast<EffectsImageProvider::Effect>(effectMetaEnum.keyToValue(url.path().toLatin1())))
+        switch (static_cast<EffectsImageProvider::Effect>(effectMetaEnum.keyToValue(url.path().toLatin1().constData())))
         {
         case EffectsImageProvider::RectDropShadow:
             effect = std::make_unique<RectDropShadowEffect>(queryToVariantMap(query));


=====================================
modules/gui/qt/util/model_recovery_agent.hpp
=====================================
@@ -102,15 +102,15 @@ public:
 
             if (model->isEmpty())
             {
-                remove(recoveryFileName);
+                remove(recoveryFileName.constData());
                 return;
             }
 
-            if (model->serialize(tmpFileName) != VLC_SUCCESS)
+            if (model->serialize(tmpFileName.constData()) != VLC_SUCCESS)
                 return;
 
-            remove(recoveryFileName);
-            if (!rename(tmpFileName, recoveryFileName))
+            remove(recoveryFileName.constData());
+            if (!rename(tmpFileName.constData(), recoveryFileName.constData()))
             {
                 assert(m_settings);
                 m_settings->sync();



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/18f4f954ae044089df4b95d37eb874e9a8629417

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/18f4f954ae044089df4b95d37eb874e9a8629417
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list