Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUnderground78 <underground78@users.sourceforge.net>2013-09-04 21:54:51 +0400
committerUnderground78 <underground78@users.sourceforge.net>2013-09-04 22:04:12 +0400
commit390ea8f109bcf9e6ee59df1b8cc657599b34ccdb (patch)
tree7c96e5363d176884c0ebad49d8f766de89286e8e /src
parentc262e3a25ee58d9dbfc8f5dfac9afc8d0ff40330 (diff)
Fix auto-loading subtitles for video filenames containing special characters.
After 8c16873c8e6af244bed48e0ca446ec51e033c01f, auto-loading subtitles could fail or give wrong results for video filenames containing the following characters: !-.^+{}[]()$. This commit fixes #3433.
Diffstat (limited to 'src')
-rw-r--r--src/Subtitles/GFN.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Subtitles/GFN.cpp b/src/Subtitles/GFN.cpp
index 47dca5649..aaa0ddb03 100644
--- a/src/Subtitles/GFN.cpp
+++ b/src/Subtitles/GFN.cpp
@@ -63,6 +63,7 @@ void GetSubFileNames(CString fn, const CAtlArray<CString>& paths, CAtlArray<SubF
CString orgpath = fn.Left(l);
CString title = fn.Mid(l, l2 - l);
+ int titleLength = title.GetLength();
//CString filename = title + _T(".nooneexpectsthespanishinquisition");
if (!fWeb) {
@@ -76,8 +77,8 @@ void GetSubFileNames(CString fn, const CAtlArray<CString>& paths, CAtlArray<SubF
extListSub.AppendChar(_T('|'));
}
}
- regExpSub.Format(_T("%s([%s]+.+)?\\.(%s)$"), title, separators, extListSub);
- regExpVid.Format(_T("%s.+\\.(%s)$"), title, extListVid);
+ regExpSub.Format(_T("([%s]+.+)?\\.(%s)$"), separators, extListSub);
+ regExpVid.Format(_T(".+\\.(%s)$"), extListVid);
CAtlRegExp<CAtlRECharTraits> reSub, reVid;
CAtlREMatchContext<CAtlRECharTraits> mc;
@@ -105,9 +106,9 @@ void GetSubFileNames(CString fn, const CAtlArray<CString>& paths, CAtlArray<SubF
if ((hFile = FindFirstFile(path + title + _T("*"), &wfd)) != INVALID_HANDLE_VALUE) {
do {
CString fn = path + wfd.cFileName;
- if (reSub.Match(wfd.cFileName, &mc)) {
+ if (reSub.Match(&wfd.cFileName[titleLength], &mc)) {
subs.AddTail(fn);
- } else if (reVid.Match(wfd.cFileName, &mc)) {
+ } else if (reVid.Match(&wfd.cFileName[titleLength], &mc)) {
// Convert to lower-case and cut the extension for easier matching
vids.AddTail(fn.Left(fn.ReverseFind(_T('.'))).MakeLower());
}