[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: return error code in `PlaylistController::serialize()`

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Nov 19 05:10:47 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
93ad175b by Fatih Uzunoglu at 2024-11-19T04:39:36+00:00
qt: return error code in `PlaylistController::serialize()`

- - - - -
7fd98ed1 by Fatih Uzunoglu at 2024-11-19T04:39:36+00:00
qt: do not serialize model for recovery if it is empty

- - - - -
74c20000 by Fatih Uzunoglu at 2024-11-19T04:39:36+00:00
qt: do not convert rvalue into pointer in ModelRecoveryAgent

- - - - -


3 changed files:

- modules/gui/qt/playlist/playlist_controller.cpp
- modules/gui/qt/playlist/playlist_controller.hpp
- modules/gui/qt/util/model_recovery_agent.hpp


Changes:

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


=====================================
modules/gui/qt/playlist/playlist_controller.hpp
=====================================
@@ -142,7 +142,7 @@ public:
 
     Q_INVOKABLE void explore(const PlaylistItem& pItem);
 
-    void serialize(const QString& fileName);
+    int serialize(const QString& fileName);
 
 public:
     PlaylistController(vlc_playlist_t *playlist, QObject *parent = nullptr);


=====================================
modules/gui/qt/util/model_recovery_agent.hpp
=====================================
@@ -97,10 +97,17 @@ public:
 
             assert(!m_recoveryFileName.isEmpty());
 
-            const char* tmpFileName = (m_recoveryFileName + QStringLiteral(".part")).toLatin1();
-            const char* recoveryFileName = m_recoveryFileName.toLatin1();
+            const QByteArray tmpFileName = (m_recoveryFileName + QStringLiteral(".part")).toLatin1();
+            const QByteArray recoveryFileName = m_recoveryFileName.toLatin1();
 
-            model->serialize(tmpFileName);
+            if (model->isEmpty())
+            {
+                remove(recoveryFileName);
+                return;
+            }
+
+            if (model->serialize(tmpFileName) != VLC_SUCCESS)
+                return;
 
             remove(recoveryFileName);
             if (!rename(tmpFileName, recoveryFileName))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a374c46d0b85b87f0338beb2591c318cef085691...74c20000106849bb3b323a1078d6d89e7cd97cff

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a374c46d0b85b87f0338beb2591c318cef085691...74c20000106849bb3b323a1078d6d89e7cd97cff
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