diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2017-08-22 02:33:15 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2017-08-28 00:14:48 +0300 |
commit | 7c77ba9afcea150c1b8cd01386f82ef36b512456 (patch) | |
tree | f01048b9dec2cce63263713e41b7407d51f66fd5 /src/Subtitles | |
parent | dcd43a430ca2782c4ae166e89139c730bffc5d88 (diff) |
Do not pass incompatible object to variadic functions.
Diffstat (limited to 'src/Subtitles')
-rw-r--r-- | src/Subtitles/RTS.cpp | 4 | ||||
-rw-r--r-- | src/Subtitles/STS.cpp | 36 | ||||
-rw-r--r-- | src/Subtitles/SubtitleHelpers.cpp | 4 | ||||
-rw-r--r-- | src/Subtitles/VobSubFile.cpp | 24 | ||||
-rw-r--r-- | src/Subtitles/VobSubFileRipper.cpp | 2 |
5 files changed, 35 insertions, 35 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp index 7d653593b..f9911ab13 100644 --- a/src/Subtitles/RTS.cpp +++ b/src/Subtitles/RTS.cpp @@ -3263,9 +3263,9 @@ STDMETHODIMP CRenderedTextSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, L }
CStringW strName;
if (!m_provider.IsEmpty()) {
- strName.Format(L"[%s] %s\t%s", m_provider, m_name, strLanguage);
+ strName.Format(L"[%s] %s\t%s", m_provider.GetString(), m_name.GetString(), strLanguage.GetString());
} else {
- strName.Format(L"%s\t%s", m_name, strLanguage);
+ strName.Format(L"%s\t%s", m_name.GetString(), strLanguage.GetString());
}
*ppName = (WCHAR*)CoTaskMemAlloc((strName.GetLength() + 1) * sizeof(WCHAR));
diff --git a/src/Subtitles/STS.cpp b/src/Subtitles/STS.cpp index 68c46c86b..ec4d67e7c 100644 --- a/src/Subtitles/STS.cpp +++ b/src/Subtitles/STS.cpp @@ -798,7 +798,7 @@ static CStringW MicroDVD2SSA(CStringW str, bool fUnicode, int CharSet) } else if (!_wcsnicmp(code, L"{f:", 3)) {
fRestore[FONTNAME] = (iswupper(code[1]) == 0);
- code.Format(L"{\\fn%s}", code.Mid(3));
+ code.Format(L"{\\fn%s}", code.Mid(3).GetString());
ret += code;
} else if (!_wcsnicmp(code, L"{s:", 3)) {
fRestore[FONTSIZE] = (iswupper(code[1]) == 0);
@@ -2097,7 +2097,7 @@ void CSimpleTextSubtitle::ChangeUnknownStylesToDefault() if (!unknown.Lookup(stse.style, val)) {
if (fReport) {
CString msg;
- msg.Format(_T("Unknown style found: \"%s\", changed to \"Default\"!\n\nPress Cancel to ignore further warnings."), stse.style);
+ msg.Format(_T("Unknown style found: \"%s\", changed to \"Default\"!\n\nPress Cancel to ignore further warnings."), stse.style.GetString());
if (MessageBox(nullptr, msg, _T("Warning"), MB_OKCANCEL | MB_ICONWARNING) != IDOK) {
fReport = false;
}
@@ -2143,7 +2143,7 @@ void CSimpleTextSubtitle::AddStyle(CString name, STSStyle* style) CString name3;
do {
- name3.Format(_T("%s%d"), name2, idx);
+ name3.Format(_T("%s%d"), name2.GetString(), idx);
idx++;
} while (m_styles.Lookup(name3));
@@ -2644,7 +2644,7 @@ bool CSimpleTextSubtitle::Open(CTextFile* f, int CharSet, CString name) CString lastLine;
size_t n = CountLines(f, pos, f->GetPosition(), lastLine);
CString msg;
- msg.Format(_T("Unable to parse the subtitle file. Syntax error at line %Iu:\n\"%s\""), n + 1, lastLine);
+ msg.Format(_T("Unable to parse the subtitle file. Syntax error at line %Iu:\n\"%s\""), n + 1, lastLine.GetString());
AfxMessageBox(msg, MB_OK | MB_ICONERROR);
Empty();
break;
@@ -2798,8 +2798,8 @@ bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type, if (type == Subtitle::SSA) {
CString str2;
- str2.Format(str, key,
- s->fontName, (int)s->fontSize,
+ str2.Format(str, key.GetString(),
+ s->fontName.GetString(), (int)s->fontSize,
s->colors[0] & 0xffffff,
s->colors[1] & 0xffffff,
s->colors[2] & 0xffffff,
@@ -2814,8 +2814,8 @@ bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type, f.WriteString(str2);
} else {
CString str2;
- str2.Format(str, key,
- s->fontName, (int)s->fontSize,
+ str2.Format(str, key.GetString(),
+ s->fontName.GetString(), (int)s->fontSize,
(s->colors[0] & 0xffffff) | (s->alpha[0] << 24),
(s->colors[1] & 0xffffff) | (s->alpha[1] << 24),
(s->colors[2] & 0xffffff) | (s->alpha[2] << 24),
@@ -2884,33 +2884,33 @@ bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type, CStringW str2;
if (type == Subtitle::SRT) {
- str2.Format(fmt, i - k + 1, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, str);
+ str2.Format(fmt, i - k + 1, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, str.GetString());
} else if (type == Subtitle::SUB) {
str.Replace('\n', '|');
- str2.Format(fmt, int(t1 * fps / 1000), int(t2 * fps / 1000), str);
+ str2.Format(fmt, int(t1 * fps / 1000), int(t2 * fps / 1000), str.GetString());
} else if (type == Subtitle::SMI) {
str.Replace(L"\n", L"<br>");
- str2.Format(fmt, t1, str, t2);
+ str2.Format(fmt, t1, str.GetString(), t2);
} else if (type == Subtitle::PSB) {
str.Replace('\n', '|');
- str2.Format(fmt, hh1, mm1, ss1, hh2, mm2, ss2, str);
+ str2.Format(fmt, hh1, mm1, ss1, hh2, mm2, ss2, str.GetString());
} else if (type == Subtitle::SSA) {
str.Replace(L"\n", L"\\N");
str2.Format(fmt,
hh1, mm1, ss1, ms1 / 10,
hh2, mm2, ss2, ms2 / 10,
- TToW(stse.style), TToW(stse.actor),
+ TToW(stse.style).GetString(), TToW(stse.actor).GetString(),
stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top + stse.marginRect.bottom) / 2,
- TToW(stse.effect), str);
+ TToW(stse.effect).GetString(), str.GetString());
} else if (type == Subtitle::ASS) {
str.Replace(L"\n", L"\\N");
str2.Format(fmt,
stse.layer,
hh1, mm1, ss1, ms1 / 10,
hh2, mm2, ss2, ms2 / 10,
- TToW(stse.style), TToW(stse.actor),
+ TToW(stse.style).GetString(), TToW(stse.actor).GetString(),
stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top + stse.marginRect.bottom) / 2,
- TToW(stse.effect), str);
+ TToW(stse.effect).GetString(), str.GetString());
}
f.WriteString(str2);
@@ -2941,7 +2941,7 @@ bool CSimpleTextSubtitle::SaveAs(CString fn, Subtitle::SubType type, str = _T("Style: Default,%s,%d,&H%08x,&H%08x,&H%08x,&H%08x,%d,%d,%d,%d,%.2f,%.2f,%.2f,%.2f,%d,%.2f,%.2f,%d,%d,%d,%d,%d\n");
str2.Format(str,
- s->fontName, (int)s->fontSize,
+ s->fontName.GetString(), (int)s->fontSize,
(s->colors[0] & 0xffffff) | (s->alpha[0] << 24),
(s->colors[1] & 0xffffff) | (s->alpha[1] << 24),
(s->colors[2] & 0xffffff) | (s->alpha[2] << 24),
@@ -3088,7 +3088,7 @@ CString& operator <<= (CString& style, const STSStyle& s) s.colors[0], s.colors[1], s.colors[2], s.colors[3],
s.alpha[0], s.alpha[1], s.alpha[2], s.alpha[3],
s.charSet,
- s.fontName, s.fontSize,
+ s.fontName.GetString(), s.fontSize,
s.fontScaleX, s.fontScaleY,
s.fontSpacing, s.fontWeight,
s.fItalic, s.fUnderline, s.fStrikeOut, s.fBlur, s.fGaussianBlur,
diff --git a/src/Subtitles/SubtitleHelpers.cpp b/src/Subtitles/SubtitleHelpers.cpp index 4aea67ad9..c09dbf6a2 100644 --- a/src/Subtitles/SubtitleHelpers.cpp +++ b/src/Subtitles/SubtitleHelpers.cpp @@ -88,7 +88,7 @@ void Subtitle::GetSubFileNames(CString fn, const CAtlArray<CString>& paths, CAtl extListSub.AppendChar(_T('|')); } } - regExpSub.Format(_T("([%s]+.+)?\\.(%s)$"), separators, extListSub); + regExpSub.Format(_T("([%s]+.+)?\\.(%s)$"), separators, extListSub.GetString()); regExpVid.Format(_T(".+\\.(%s)$"), extListVid); const std::wregex::flag_type reFlags = std::wregex::icase | std::wregex::optimize; @@ -264,7 +264,7 @@ CString Subtitle::GuessSubtitleName(const CString& fn, CString videoName, LCID& name = fn.Mid(fn.ReverseFind('\\') + 1); if (name.GetLength() > 100) { // Cut some part of the filename if it's too long - name.Format(_T("%s...%s"), name.Left(50).TrimRight(_T(".-_ ")), name.Right(50).TrimLeft(_T(".-_ "))); + name.Format(_T("%s...%s"), name.Left(50).TrimRight(_T(".-_ ")).GetString(), name.Right(50).TrimLeft(_T(".-_ ")).GetString()); } return name; diff --git a/src/Subtitles/VobSubFile.cpp b/src/Subtitles/VobSubFile.cpp index c8045ae28..cd2ba19e9 100644 --- a/src/Subtitles/VobSubFile.cpp +++ b/src/Subtitles/VobSubFile.cpp @@ -1056,7 +1056,7 @@ bool CVobSubFile::WriteIdx(CString fn, int delay) continue;
}
- str.Format(_T("# %s\n"), sl.name);
+ str.Format(_T("# %s\n"), sl.name.GetString());
f.WriteString(str);
ASSERT(sl.id);
@@ -1068,7 +1068,7 @@ bool CVobSubFile::WriteIdx(CString fn, int delay) str = _T("# Uncomment next line to activate alternative name in VSFilter / Windows Media Player 6.x\n");
f.WriteString(str);
- str.Format(_T("alt: %s\n"), sl.alt);
+ str.Format(_T("alt: %s\n"), sl.alt.GetString());
if (sl.name == sl.alt) {
str = _T("# ") + str;
}
@@ -1824,11 +1824,11 @@ bool CVobSubFile::SaveWinSubMux(CString fn, int delay) }
CString bmpfn;
- bmpfn.Format(_T("%s_%06Iu.bmp"), fn, i + 1);
+ bmpfn.Format(_T("%s_%06Iu.bmp"), fn.GetString(), i + 1);
CString str;
str.Format(_T("%s\t%02d:%02d:%02d:%02d %02d:%02d:%02d:%02d\t%03d %03d %03d %03d %d %d %d %d\n"),
- bmpfn,
+ bmpfn.GetString(),
t1 / 1000 / 60 / 60, (t1 / 1000 / 60) % 60, (t1 / 1000) % 60, (t1 % 1000) / 10,
t2 / 1000 / 60 / 60, (t2 / 1000 / 60) % 60, (t2 / 1000) % 60, (t2 % 1000) / 10,
m_img.rect.Width(), m_img.rect.Height(), m_img.rect.left, m_img.rect.top,
@@ -1911,8 +1911,8 @@ bool CVobSubFile::SaveScenarist(CString fn, int delay) !m_bOnlyShowForcedSubs ? _T("non_forced") : _T("forced"),
m_size.cy == 480 ? _T("NTSC") : _T("PAL"),
m_size.cy - 3,
- fullpath,
- title,
+ fullpath.GetString(),
+ title.GetString(),
m_size.cy == 480 ? 479 : 574);
f.WriteString(str2);
@@ -2018,7 +2018,7 @@ bool CVobSubFile::SaveScenarist(CString fn, int delay) }
CString bmpfn;
- bmpfn.Format(_T("%s_%04Iu.bmp"), fn, i + 1);
+ bmpfn.Format(_T("%s_%04Iu.bmp"), fn.GetString(), i + 1);
title = bmpfn.Mid(bmpfn.ReverseFind('/') + 1);
// E1, E2, P, Bg
@@ -2104,7 +2104,7 @@ bool CVobSubFile::SaveScenarist(CString fn, int delay) ++k,
h1, m1, s1, f1,
h2, m2, s2, f2,
- title);
+ title.GetString());
f.WriteString(str);
CFile bmp;
@@ -2166,8 +2166,8 @@ bool CVobSubFile::SaveMaestro(CString fn, int delay) !m_bOnlyShowForcedSubs ? _T("non_forced") : _T("forced"),
m_size.cy == 480 ? _T("NTSC") : _T("PAL"),
m_size.cy - 3,
- fullpath,
- title,
+ fullpath.GetString(),
+ title.GetString(),
m_size.cy == 480 ? 479 : 574);
f.WriteString(str2);
@@ -2248,7 +2248,7 @@ bool CVobSubFile::SaveMaestro(CString fn, int delay) }
CString bmpfn;
- bmpfn.Format(_T("%s_%04Iu.bmp"), fn, i + 1);
+ bmpfn.Format(_T("%s_%04Iu.bmp"), fn.GetString(), i + 1);
title = bmpfn.Mid(bmpfn.ReverseFind('/') + 1);
// E1, E2, P, Bg
@@ -2332,7 +2332,7 @@ bool CVobSubFile::SaveMaestro(CString fn, int delay) ++k,
h1, m1, s1, f1,
h2, m2, s2, f2,
- title);
+ title.GetString());
f.WriteString(str);
CFile bmp;
diff --git a/src/Subtitles/VobSubFileRipper.cpp b/src/Subtitles/VobSubFileRipper.cpp index c58566823..160670b3c 100644 --- a/src/Subtitles/VobSubFileRipper.cpp +++ b/src/Subtitles/VobSubFileRipper.cpp @@ -378,7 +378,7 @@ bool CVobSubFileRipper::LoadVob(CString fn) }
if (vobs.GetCount() <= 0) {
- Log(LOG_ERROR, _T("Nothing found! (%s*.vob)"), fn);
+ Log(LOG_ERROR, _T("Nothing found! (%s*.vob)"), fn.GetString());
return false;
}
|