diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2017-08-19 18:12:21 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2017-08-28 00:13:37 +0300 |
commit | 5f707f1d732934abd466d18ee77b76d87253f04c (patch) | |
tree | 5fd0031a2adc728f9e0a3748d2ade3d54b4a0080 | |
parent | 4f15a764d474352b73a6364c6f59cd90f5d2f8b3 (diff) |
Do not bind r-value to non-const l-value reference.
-rw-r--r-- | src/Subtitles/SubtitleInputPin.cpp | 6 | ||||
-rw-r--r-- | src/thirdparty/VirtualDub/h/vd2/system/VDString.h | 12 | ||||
-rw-r--r-- | 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_ptr<SubtitleSam if (m_mt.subtype == MEDIASUBTYPE_UTF8) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
- CStringW str = FastTrim(UTF8To16(CStringA((LPCSTR)pSample->data.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_ptr<SubtitleSam } else if (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
- CStringW str = FastTrim(UTF8To16(CStringA((LPCSTR)pSample->data.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);
}
};
|