From 5f707f1d732934abd466d18ee77b76d87253f04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sat, 19 Aug 2017 17:12:21 +0200 Subject: Do not bind r-value to non-const l-value reference. --- src/Subtitles/SubtitleInputPin.cpp | 6 ++++-- src/thirdparty/VirtualDub/h/vd2/system/VDString.h | 12 ++++++++---- src/thirdparty/VirtualDub/h/vd2/system/vdstl.h | 12 ++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Subtitles/SubtitleInputPin.cpp b/src/Subtitles/SubtitleInputPin.cpp index 4ebc113b8..5a886be1c 100644 --- a/src/Subtitles/SubtitleInputPin.cpp +++ b/src/Subtitles/SubtitleInputPin.cpp @@ -426,7 +426,8 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptrdata.data(), (int)pSample->data.size()))); + CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())); + FastTrim(str); if (!str.IsEmpty()) { pRTS->Add(str, true, pSample->rtStart, pSample->rtStop); bInvalidate = true; @@ -434,7 +435,8 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptrdata.data(), (int)pSample->data.size()))); + CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())); + FastTrim(str); if (!str.IsEmpty()) { STSEntry stse; diff --git a/src/thirdparty/VirtualDub/h/vd2/system/VDString.h b/src/thirdparty/VirtualDub/h/vd2/system/VDString.h index 88d05706d..997b39642 100644 --- a/src/thirdparty/VirtualDub/h/vd2/system/VDString.h +++ b/src/thirdparty/VirtualDub/h/vd2/system/VDString.h @@ -1194,11 +1194,15 @@ public: } void swap(this_type& x) { - value_type *p; + std::swap(mpBegin, x.mpBegin); + std::swap(mpEnd, x.mpEnd); + std::swap(mpEOS, x.mpEOS); + } - p = mpBegin; mpBegin = x.mpBegin; x.mpBegin = p; - p = mpEnd; mpEnd = x.mpEnd; x.mpEnd = p; - p = mpEOS; mpEOS = x.mpEOS; x.mpEOS = p; + void swap(this_type&& x) { + std::swap(mpBegin, x.mpBegin); + std::swap(mpEnd, x.mpEnd); + std::swap(mpEOS, x.mpEOS); } // 21.3.6 string operations diff --git a/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h b/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h index 8084b60ee..8f564fb10 100644 --- a/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h +++ b/src/thirdparty/VirtualDub/h/vd2/system/vdstl.h @@ -1181,11 +1181,15 @@ public: } void swap(vdfastvector& x) { - T *p; + std::swap(mpBegin, x.mpBegin); + std::swap(mpEnd, x.mpEnd); + std::swap(m.eos, x.m.eos); + } - p = mpBegin; mpBegin = x.mpBegin; x.mpBegin = p; - p = mpEnd; mpEnd = x.mpEnd; x.mpEnd = p; - p = m.eos; m.eos = x.m.eos; x.m.eos = p; + void swap(vdfastvector&& x) { + std::swap(mpBegin, x.mpBegin); + std::swap(mpEnd, x.mpEnd); + std::swap(m.eos, x.m.eos); } }; -- cgit v1.2.3