diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2017-08-13 15:01:28 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2017-08-13 23:24:42 +0300 |
commit | fa051343815bb72df9505b893ccdde2e828a6e2e (patch) | |
tree | 127b3d0267a4cf5e6a5f9fe4dab434ece8b53af0 | |
parent | 701ceec81e37de1d9f89ce82ced9bab7735a2eae (diff) |
Subtitles: Use FastTrim in hot paths.
-rw-r--r-- | src/Subtitles/RTS.cpp | 6 | ||||
-rw-r--r-- | src/Subtitles/SubtitleInputPin.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index c61f4ad58..b062e16e4 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -1868,7 +1868,7 @@ bool CRenderedTextSubtitle::ParseSSATag(SSATagsList& tagsList, const CStringW& s ;
}
CStringW cmd = str.Mid(jOld, j - jOld);
- cmd.Trim();
+ FastTrim(cmd);
if (cmd.IsEmpty()) {
continue;
}
@@ -1902,7 +1902,7 @@ bool CRenderedTextSubtitle::ParseSSATag(SSATagsList& tagsList, const CStringW& s }
}
CStringW param = str.Mid(jOld, j - jOld);
- param.Trim();
+ FastTrim(param);
while (!param.IsEmpty()) {
int k = param.Find(L','), l = param.Find(L'\\');
@@ -1914,7 +1914,7 @@ bool CRenderedTextSubtitle::ParseSSATag(SSATagsList& tagsList, const CStringW& s }
param = k + 1 < param.GetLength() ? param.Mid(k + 1) : L"";
} else {
- param.Trim();
+ FastTrim(param);
if (!param.IsEmpty()) {
tag.params.Add(param);
}
diff --git a/src/Subtitles/SubtitleInputPin.cpp b/src/Subtitles/SubtitleInputPin.cpp index b5df02cac..4ebc113b8 100644 --- a/src/Subtitles/SubtitleInputPin.cpp +++ b/src/Subtitles/SubtitleInputPin.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2016 see Authors.txt
+ * (C) 2006-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -415,7 +415,7 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam CStringA str(pData, (int)pSample->data.size());
str.Replace("\r\n", "\n");
- str.Trim();
+ FastTrim(str);
if (!str.IsEmpty()) {
pRTS->Add(AToW(str), false, pSample->rtStart, pSample->rtStop);
@@ -426,7 +426,7 @@ REFERENCE_TIME CSubtitleInputPin::DecodeSample(const std::unique_ptr<SubtitleSam if (m_mt.subtype == MEDIASUBTYPE_UTF8) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
- CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())).Trim();
+ CStringW str = FastTrim(UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())));
if (!str.IsEmpty()) {
pRTS->Add(str, true, pSample->rtStart, pSample->rtStop);
bInvalidate = true;
@@ -434,7 +434,7 @@ 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 = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())).Trim();
+ CStringW str = FastTrim(UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())));
if (!str.IsEmpty()) {
STSEntry stse;
|