summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-05-11 16:50:46 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-11 18:08:51 +0000
commitf17108b41927661ff215a3ec8989b6921d7b09e5 (patch)
treeb4daaee401012703d80614a5bccdb10ea43ecb5d
parentd90207f88b64082fc87e6cb355f30b58fc17c444 (diff)
QtMultimedia: replace qSwap with std::swap/member-swap where possible
qSwap() is a monster that looks for ADL overloads of swap() and also detects the noexcept of the wrapped swap() function, so it should only be used when the argument type is unknown. In the vast majority of cases, the type is known to be efficiently std::swap()able or to have a member-swap. Call either of these. Task-number: QTBUG-97601 Change-Id: Ida8402522bc980e871455d8fb21dddcf5b2dd384 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 583b991120596a5fbfdfd726ec228c23e819107e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/audio/qaudiobuffer.h2
-rw-r--r--src/multimedia/audio/qaudiodevice.h2
-rw-r--r--src/multimedia/qmediaformat.h8
-rw-r--r--src/multimedia/qmediatimerange.h2
-rw-r--r--src/multimedia/video/qvideoframe.h2
-rw-r--r--src/multimedia/video/qvideoframeformat.h2
6 files changed, 9 insertions, 9 deletions
diff --git a/src/multimedia/audio/qaudiobuffer.h b/src/multimedia/audio/qaudiobuffer.h
index dad011750..624c8aabe 100644
--- a/src/multimedia/audio/qaudiobuffer.h
+++ b/src/multimedia/audio/qaudiobuffer.h
@@ -161,7 +161,7 @@ public:
QAudioBuffer(QAudioBuffer &&other) noexcept = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QAudioBuffer)
void swap(QAudioBuffer &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
bool isValid() const noexcept { return d != nullptr; };
diff --git a/src/multimedia/audio/qaudiodevice.h b/src/multimedia/audio/qaudiodevice.h
index f414af88f..f83b9375d 100644
--- a/src/multimedia/audio/qaudiodevice.h
+++ b/src/multimedia/audio/qaudiodevice.h
@@ -79,7 +79,7 @@ public:
QAudioDevice(QAudioDevice &&other) noexcept = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QAudioDevice)
void swap(QAudioDevice &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
QAudioDevice& operator=(const QAudioDevice& other);
diff --git a/src/multimedia/qmediaformat.h b/src/multimedia/qmediaformat.h
index f72dcb597..cff960514 100644
--- a/src/multimedia/qmediaformat.h
+++ b/src/multimedia/qmediaformat.h
@@ -135,10 +135,10 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMediaFormat)
void swap(QMediaFormat &other) noexcept
{
- qSwap(fmt, other.fmt);
- qSwap(audio, other.audio);
- qSwap(video, other.video);
- qSwap(d, other.d);
+ std::swap(fmt, other.fmt);
+ std::swap(audio, other.audio);
+ std::swap(video, other.video);
+ d.swap(other.d);
}
FileFormat fileFormat() const { return fmt; }
diff --git a/src/multimedia/qmediatimerange.h b/src/multimedia/qmediatimerange.h
index 2a8e948c3..8fcef3be8 100644
--- a/src/multimedia/qmediatimerange.h
+++ b/src/multimedia/qmediatimerange.h
@@ -107,7 +107,7 @@ public:
QMediaTimeRange(QMediaTimeRange &&other) noexcept = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMediaTimeRange)
void swap(QMediaTimeRange &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
void detach();
QMediaTimeRange &operator=(const Interval&);
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index d87331d89..454496353 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -92,7 +92,7 @@ public:
QVideoFrame(QVideoFrame &&other) noexcept = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrame)
void swap(QVideoFrame &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
QVideoFrame &operator =(const QVideoFrame &other);
diff --git a/src/multimedia/video/qvideoframeformat.h b/src/multimedia/video/qvideoframeformat.h
index 6983b6581..f92d8e614 100644
--- a/src/multimedia/video/qvideoframeformat.h
+++ b/src/multimedia/video/qvideoframeformat.h
@@ -128,7 +128,7 @@ public:
QVideoFrameFormat(QVideoFrameFormat &&other) noexcept = default;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QVideoFrameFormat);
void swap(QVideoFrameFormat &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
void detach();