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
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2017-08-20 02:18:12 +0300
committerKacper Michajłow <kasper93@gmail.com>2017-08-28 00:13:38 +0300
commit2c2967974502a1b19cc3ec370d3302cd0fca3738 (patch)
treea6b4e046b03039934fc785f448cd79e47a385b12
parentaffc0126a21c144aa995c84112844a10d1502b0e (diff)
Fix ambiguous ternary operators.
-rw-r--r--src/DSUtil/DSUtil.cpp2
-rw-r--r--src/DSUtil/PathUtils.cpp4
-rw-r--r--src/DSUtil/text.cpp14
-rw-r--r--src/Subtitles/PGSSub.cpp4
-rw-r--r--src/Subtitles/RTS.cpp2
-rw-r--r--src/Subtitles/STS.cpp6
-rw-r--r--src/filters/reader/CDDAReader/CDDAReader.cpp20
-rw-r--r--src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp9
-rw-r--r--src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp4
-rw-r--r--src/filters/transform/VSFilter/DirectVobSubFilter.cpp2
-rw-r--r--src/filters/transform/VSFilter/plugins.cpp6
-rw-r--r--src/mpc-hc/EditListEditor.cpp4
-rw-r--r--src/mpc-hc/MainFrm.cpp61
-rw-r--r--src/mpc-hc/MouseTouch.cpp2
-rw-r--r--src/mpc-hc/PPageMisc.cpp26
-rw-r--r--src/mpc-hc/PPageOutput.cpp6
-rw-r--r--src/mpc-hc/PlayerPlaylistBar.cpp5
-rw-r--r--src/mpc-hc/SubtitleDlDlg.cpp2
-rw-r--r--src/mpc-hc/SubtitlesProvider.cpp4
-rw-r--r--src/mpc-hc/WebClientSocket.cpp8
-rw-r--r--src/mpc-hc/mplayerc.cpp2
21 files changed, 118 insertions, 75 deletions
diff --git a/src/DSUtil/DSUtil.cpp b/src/DSUtil/DSUtil.cpp
index b7501b94b..161fdeb2b 100644
--- a/src/DSUtil/DSUtil.cpp
+++ b/src/DSUtil/DSUtil.cpp
@@ -1326,7 +1326,7 @@ CString MakeFullPath(LPCTSTR path)
CString GetMediaTypeName(const GUID& guid)
{
CString ret = guid == GUID_NULL
- ? _T("Any type")
+ ? CString(_T("Any type"))
: CString(GuidNames[guid]);
if (ret == _T("FOURCC GUID")) {
diff --git a/src/DSUtil/PathUtils.cpp b/src/DSUtil/PathUtils.cpp
index b46341a87..780ca6aea 100644
--- a/src/DSUtil/PathUtils.cpp
+++ b/src/DSUtil/PathUtils.cpp
@@ -1,5 +1,5 @@
/*
- * (C) 2013-2015 see Authors.txt
+ * (C) 2013-2015, 2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -139,7 +139,7 @@ namespace PathUtils
p.Replace('\\', '/');
p.TrimRight('/');
p = p.Mid(p.ReverseFind('/') + 1);
- return (p.IsEmpty() ? path : p);
+ return p.IsEmpty() ? CString(path) : p;
}
bool IsInDir(LPCTSTR path, LPCTSTR dir)
diff --git a/src/DSUtil/text.cpp b/src/DSUtil/text.cpp
index e3be087bc..19a7d24a5 100644
--- a/src/DSUtil/text.cpp
+++ b/src/DSUtil/text.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2014, 2016 see Authors.txt
+ * (C) 2006-2014, 2016-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -143,7 +143,11 @@ CString ExtractTag(CString tag, CMapStringToString& attribs, bool& fClosing)
for (i = 0; i < tag.GetLength() && _istspace(tag[i]); i++) {
;
}
- tag = i < tag.GetLength() ? tag.Mid(i) : _T("");
+ if (i < tag.GetLength()) {
+ tag = tag.Mid(i);
+ } else {
+ tag.Empty();
+ }
if (!tag.IsEmpty() && tag[0] == '\"') {
tag = tag.Mid(1);
i = tag.Find('\"');
@@ -157,7 +161,11 @@ CString ExtractTag(CString tag, CMapStringToString& attribs, bool& fClosing)
if (!param.IsEmpty()) {
attribs[attrib] = param;
}
- tag = i + 1 < tag.GetLength() ? tag.Mid(i + 1) : _T("");
+ if (i + 1 < tag.GetLength()) {
+ tag = tag.Mid(i + 1);
+ } else {
+ tag.Empty();
+ }
}
return type;
diff --git a/src/Subtitles/PGSSub.cpp b/src/Subtitles/PGSSub.cpp
index 047030aaa..e22888624 100644
--- a/src/Subtitles/PGSSub.cpp
+++ b/src/Subtitles/PGSSub.cpp
@@ -1,5 +1,5 @@
/*
- * (C) 2006-2016 see Authors.txt
+ * (C) 2006-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -251,7 +251,7 @@ HRESULT CPGSSub::Render(SubPicDesc& spd, REFERENCE_TIME rt, RECT& bbox, bool bRe
TRACE_PGSSUB(_T("CPGSSub:Render Presentation segment %d --> %s - %s\n"), pPresentationSegment->composition_descriptor.nNumber,
ReftimeToString(pPresentationSegment->rtStart),
- (pPresentationSegment->rtStop == UNKNOWN_TIME) ? _T("?") : ReftimeToString(pPresentationSegment->rtStop));
+ pPresentationSegment->rtStop == UNKNOWN_TIME ? _T("?") : ReftimeToString(pPresentationSegment->rtStop).GetString());
bbox.left = bbox.top = LONG_MAX;
bbox.right = bbox.bottom = 0;
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp
index 790e8ef53..7d653593b 100644
--- a/src/Subtitles/RTS.cpp
+++ b/src/Subtitles/RTS.cpp
@@ -1908,7 +1908,7 @@ bool CRenderedTextSubtitle::ParseSSATag(SSATagsList& tagsList, const CStringW& s
if (!s.IsEmpty()) {
tag.params.Add(s);
}
- param = k + 1 < param.GetLength() ? param.Mid(k + 1) : L"";
+ param = k + 1 < param.GetLength() ? param.Mid(k + 1).GetString() : L"";
} else {
FastTrim(param);
if (!param.IsEmpty()) {
diff --git a/src/Subtitles/STS.cpp b/src/Subtitles/STS.cpp
index cd72c9888..68c46c86b 100644
--- a/src/Subtitles/STS.cpp
+++ b/src/Subtitles/STS.cpp
@@ -607,11 +607,11 @@ static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet
i = j;
if (tag == L"font") {
- font = def.fontName.CompareNoCase(WToT(param)) ? param : L"";
+ font = def.fontName.CompareNoCase(WToT(param)) ? param.GetString() : L"";
} else if (tag == L"colf") {
- color = def.colors[0] != (DWORD)wcstol(((LPCWSTR)param) + 2, 0, 16) ? param : L"";
+ color = def.colors[0] != (DWORD)wcstol(((LPCWSTR)param) + 2, 0, 16) ? param.GetString() : L"";
} else if (tag == L"size") {
- size = def.fontSize != (double)wcstol(param, 0, 10) ? param : L"";
+ size = def.fontSize != (double)wcstol(param, 0, 10) ? param.GetString() : L"";
} else if (tag == L"style") {
if (param.Find(L"no") >= 0) {
fBold = fItalic = fStriked = fUnderline = false;
diff --git a/src/filters/reader/CDDAReader/CDDAReader.cpp b/src/filters/reader/CDDAReader/CDDAReader.cpp
index e7da9c946..ca3844129 100644
--- a/src/filters/reader/CDDAReader/CDDAReader.cpp
+++ b/src/filters/reader/CDDAReader/CDDAReader.cpp
@@ -420,15 +420,8 @@ bool CCDDAStream::Load(const WCHAR* fnw)
const int lenW = _countof(pDesc->WText);
CString text = !pDesc->Unicode
- ? CString(CStringA((CHAR*)pDesc->Text, lenU))
- : CString(CStringW((WCHAR*)pDesc->WText, lenW));
-
- int tlen = text.GetLength();
- CString tmp = (tlen < 12 - 1)
- ? (!pDesc->Unicode
- ? CString(CStringA((CHAR*)pDesc->Text + tlen + 1, lenU - (tlen + 1)))
- : CString(CStringW((WCHAR*)pDesc->WText + tlen + 1, lenW - (tlen + 1))))
- : _T("");
+ ? CString(reinterpret_cast<CStringA::PCXSTR>(pDesc->Text), lenU)
+ : CString(pDesc->WText, lenW);
if (pDesc->PackType < 0x80 || pDesc->PackType >= 0x80 + 0x10) {
continue;
@@ -445,7 +438,14 @@ bool CCDDAStream::Load(const WCHAR* fnw)
}
}
- last = tmp;
+ const int tlen = text.GetLength();
+ if (tlen < 12 - 1) {
+ last = !pDesc->Unicode
+ ? CString(reinterpret_cast<CStringA::PCXSTR>(pDesc->Text) + tlen + 1, lenU - (tlen + 1))
+ : CString(static_cast<CStringW::PCXSTR>(pDesc->WText) + tlen + 1, lenW - (tlen + 1));
+ } else {
+ last.Empty();
+ }
}
m_discTitle = str[0][0];
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
index df3ecaa70..80c148aa6 100644
--- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
+++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp
@@ -718,7 +718,12 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString& _Error)
&pp, &DisplayMode, &m_pD3DDevEx);
}
- m_D3DDevExError = FAILED(hr) ? GetWindowsErrorMessage(hr, m_hD3D9) : _T("");
+ if (FAILED(hr)) {
+ m_D3DDevExError = GetWindowsErrorMessage(hr, m_hD3D9);
+ } else {
+ m_D3DDevExError.Empty();
+ }
+
if (m_pD3DDevEx) {
m_pD3DDev = m_pD3DDevEx;
m_BackbufferType = pp.BackBufferFormat;
@@ -1939,7 +1944,7 @@ void CDX9AllocatorPresenter::DrawStats()
strText.Format(L"Formats : Surface %s Backbuffer %s Display %s Device %s %s",
GetD3DFormatStr(m_SurfaceType), GetD3DFormatStr(m_BackbufferType),
GetD3DFormatStr(m_DisplayType), m_pD3DDevEx ? L"D3DDevEx" : L"D3DDev",
- m_D3DDevExError.IsEmpty() ? _T("") : _T("D3DExError: ") + m_D3DDevExError);
+ m_D3DDevExError.IsEmpty() ? _T("") : (_T("D3DExError: ") + m_D3DDevExError).GetString());
drawText(rc, strText);
if (m_bIsEVR) {
diff --git a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
index caa2ed171..c7c982865 100644
--- a/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
+++ b/src/filters/switcher/AudioSwitcher/StreamSwitcher.cpp
@@ -742,7 +742,7 @@ STDMETHODIMP CStreamSwitcherInputPin::BeginFlush()
return hr;
}
- return IsActive() ? pSSF->DeliverBeginFlush() : Block(false), S_OK;
+ return IsActive() ? pSSF->DeliverBeginFlush() : (Block(false), S_OK);
}
STDMETHODIMP CStreamSwitcherInputPin::EndFlush()
@@ -762,7 +762,7 @@ STDMETHODIMP CStreamSwitcherInputPin::EndFlush()
return hr;
}
- return IsActive() ? pSSF->DeliverEndFlush() : Block(true), S_OK;
+ return IsActive() ? pSSF->DeliverEndFlush() : (Block(true), S_OK);
}
STDMETHODIMP CStreamSwitcherInputPin::EndOfStream()
diff --git a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
index 6ad1966af..44f8e405d 100644
--- a/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
+++ b/src/filters/transform/VSFilter/DirectVobSubFilter.cpp
@@ -518,7 +518,7 @@ HRESULT CDirectVobSubFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tS
REFERENCE_TIME CDirectVobSubFilter::CalcCurrentTime()
{
- REFERENCE_TIME rt = m_pSubClock ? m_pSubClock->GetTime() : m_tPrev;
+ REFERENCE_TIME rt = m_pSubClock ? m_pSubClock->GetTime() : static_cast<REFERENCE_TIME>(m_tPrev);
return (rt - 10000i64 * m_SubtitleDelay) * m_SubtitleSpeedNormalizedMul / m_SubtitleSpeedNormalizedDiv; // no, it won't overflow if we use normal parameters (__int64 is enough for about 2000 hours if we multiply it by the max: 65536 as m_SubtitleSpeedMul)
}
diff --git a/src/filters/transform/VSFilter/plugins.cpp b/src/filters/transform/VSFilter/plugins.cpp
index e2ba144e0..1f1acd989 100644
--- a/src/filters/transform/VSFilter/plugins.cpp
+++ b/src/filters/transform/VSFilter/plugins.cpp
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2014, 2016 see Authors.txt
+ * (C) 2006-2014, 2016-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -298,7 +298,7 @@ namespace Plugin
}
void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str) {
- sprintf_s(str, STRING_PROC_BUFFER_SIZE, " (%s)", GetFileName().IsEmpty() ? " (empty)" : CStringA(GetFileName()));
+ sprintf_s(str, STRING_PROC_BUFFER_SIZE, " (%s)", GetFileName().IsEmpty() ? " (empty)" : CStringA(GetFileName()).GetString());
}
bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen) {
@@ -565,7 +565,7 @@ namespace Plugin
}
void StringProc(const VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* str) {
- sprintf_s(str, STRING_PROC_BUFFER_SIZE, " (%s)", GetFileName().IsEmpty() ? " (empty)" : CStringA(GetFileName()));
+ sprintf_s(str, STRING_PROC_BUFFER_SIZE, " (%s)", GetFileName().IsEmpty() ? " (empty)" : CStringA(GetFileName()).GetString());
}
bool FssProc(VDXFilterActivation* fa, const VDXFilterFunctions* ff, char* buf, int buflen) {
diff --git a/src/mpc-hc/EditListEditor.cpp b/src/mpc-hc/EditListEditor.cpp
index 3043d274b..6a3cf5751 100644
--- a/src/mpc-hc/EditListEditor.cpp
+++ b/src/mpc-hc/EditListEditor.cpp
@@ -62,12 +62,12 @@ void CClip::SetOut(REFERENCE_TIME rtVal)
CString CClip::GetIn() const
{
- return (m_rtIn == _I64_MIN) ? _T("") : ReftimeToString(m_rtIn);
+ return m_rtIn == _I64_MIN ? CString() : ReftimeToString(m_rtIn);
}
CString CClip::GetOut() const
{
- return (m_rtOut == _I64_MIN) ? _T("") : ReftimeToString(m_rtOut);
+ return m_rtOut == _I64_MIN ? CString() : ReftimeToString(m_rtOut);
}
IMPLEMENT_DYNAMIC(CEditListEditor, CPlayerBar)
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp
index 7794ed904..d207ead9f 100644
--- a/src/mpc-hc/MainFrm.cpp
+++ b/src/mpc-hc/MainFrm.cpp
@@ -2702,7 +2702,7 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
case EC_BG_ERROR:
if (m_fCustomGraph) {
SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
- m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
+ m_closingmsg = !str.IsEmpty() ? str : CString(_T("Unspecified graph error"));
m_wndPlaylistBar.SetCurValid(false);
return hr;
}
@@ -3206,17 +3206,31 @@ void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI)
}
}
- OAFilterState fs = GetMediaState();
- CString UI_Text =
- !msg.IsEmpty() ? msg :
- fs == State_Stopped ? StrRes(IDS_CONTROLS_STOPPED) :
- (fs == State_Paused || m_fFrameSteppingActive) ? StrRes(IDS_CONTROLS_PAUSED) :
- fs == State_Running ? StrRes(IDS_CONTROLS_PLAYING) :
- _T("");
- if (m_bUsingDXVA && (UI_Text == ResStr(IDS_CONTROLS_PAUSED) || UI_Text == ResStr(IDS_CONTROLS_PLAYING))) {
- UI_Text.AppendFormat(_T(" %s"), ResStr(IDS_HW_INDICATOR));
- }
- m_wndStatusBar.SetStatusMessage(UI_Text);
+ if (msg.IsEmpty()) {
+ int msg_id = 0;
+ switch (GetMediaState()) {
+ case State_Stopped:
+ msg_id = IDS_CONTROLS_STOPPED;
+ break;
+ case State_Paused:
+ msg_id = IDS_CONTROLS_PAUSED;
+ break;
+ case State_Running:
+ msg_id = IDS_CONTROLS_PLAYING;
+ break;
+ }
+ if (m_fFrameSteppingActive) {
+ msg_id = IDS_CONTROLS_PAUSED;
+ }
+ if (msg_id) {
+ msg.LoadString(msg_id);
+ }
+ }
+
+ if (m_bUsingDXVA && (msg == ResStr(IDS_CONTROLS_PAUSED) || msg == ResStr(IDS_CONTROLS_PLAYING))) {
+ msg.AppendFormat(_T(" %s"), ResStr(IDS_HW_INDICATOR));
+ }
+ m_wndStatusBar.SetStatusMessage(msg);
} else if (GetLoadState() == MLS::CLOSING) {
m_wndStatusBar.SetStatusMessage(StrRes(IDS_CONTROLS_CLOSING));
if (AfxGetAppSettings().bUseEnhancedTaskBar && m_pTaskbarList) {
@@ -3657,7 +3671,9 @@ void CMainFrame::OnDvdAudio(UINT nID)
AATR.bQuantization,
AATR.bNumberOfChannels,
ResStr(AATR.bNumberOfChannels > 1 ? IDS_MAINFRM_13 : IDS_MAINFRM_12));
- str += FAILED(hr) ? _T(" [") + ResStr(IDS_AG_ERROR) + _T("] ") : _T("");
+ if (FAILED(hr)) {
+ str += _T(" [") + ResStr(IDS_AG_ERROR) + _T("] ");
+ }
strMessage.Format(IDS_AUDIO_STREAM, str);
m_OSD.DisplayMessage(OSD_TOPLEFT, strMessage);
}
@@ -3701,7 +3717,9 @@ void CMainFrame::OnDvdSub(UINT nID)
CString strMessage;
int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
lang.ReleaseBufferSetLength(std::max(len - 1, 0));
- lang += FAILED(hr) ? _T(" [") + ResStr(IDS_AG_ERROR) + _T("] ") : _T("");
+ if (FAILED(hr)) {
+ lang += _T(" [") + ResStr(IDS_AG_ERROR) + _T("] ");
+ }
strMessage.Format(IDS_SUBTITLE_STREAM, lang);
m_OSD.DisplayMessage(OSD_TOPLEFT, strMessage);
}
@@ -7992,7 +8010,7 @@ void CMainFrame::OnPlayColor(UINT nID)
case ID_COLOR_BRIGHTNESS_DEC:
brightness -= 1;
SetColorControl(ProcAmp_Brightness, brightness, contrast, hue, saturation);
- brightness ? tmp.Format(_T("%+d"), brightness) : tmp = _T("0");
+ tmp.Format(brightness ? _T("%+d") : _T("%d"), brightness);
str.Format(IDS_OSD_BRIGHTNESS, tmp);
break;
@@ -8002,7 +8020,7 @@ void CMainFrame::OnPlayColor(UINT nID)
case ID_COLOR_CONTRAST_DEC:
contrast -= 1;
SetColorControl(ProcAmp_Contrast, brightness, contrast, hue, saturation);
- contrast ? tmp.Format(_T("%+d"), contrast) : tmp = _T("0");
+ tmp.Format(contrast ? _T("%+d") : _T("%d"), contrast);
str.Format(IDS_OSD_CONTRAST, tmp);
break;
@@ -8012,7 +8030,7 @@ void CMainFrame::OnPlayColor(UINT nID)
case ID_COLOR_HUE_DEC:
hue -= 1;
SetColorControl(ProcAmp_Hue, brightness, contrast, hue, saturation);
- hue ? tmp.Format(_T("%+d"), hue) : tmp = _T("0");
+ tmp.Format(hue ? _T("%+d") : _T("%d"), hue);
str.Format(IDS_OSD_HUE, tmp);
break;
@@ -8022,7 +8040,7 @@ void CMainFrame::OnPlayColor(UINT nID)
case ID_COLOR_SATURATION_DEC:
saturation -= 1;
SetColorControl(ProcAmp_Saturation, brightness, contrast, hue, saturation);
- saturation ? tmp.Format(_T("%+d"), saturation) : tmp = _T("0");
+ tmp.Format(saturation ? _T("%+d") : _T("%d"), saturation);
str.Format(IDS_OSD_SATURATION, tmp);
break;
@@ -11555,7 +11573,7 @@ int CMainFrame::SetupAudioStreams()
// If the splitter is the internal LAV Splitter and no language preferences
// have been set at splitter level, we can override its choice safely
- CComQIPtr<IBaseFilter> pBF = bIsSplitter ? (IUnknown*)pSS : pObject;
+ CComQIPtr<IBaseFilter> pBF = bIsSplitter ? pSS : pObject;
if (pBF && CFGFilterLAV::IsInternalInstance(pBF)) {
bSkipTrack = false;
if (CComQIPtr<ILAVFSettings> pLAVFSettings = pBF) {
@@ -13611,7 +13629,10 @@ bool CMainFrame::LoadSubtitle(CString fn, SubtitleInput* pSubInput /*= nullptr*/
AddTextPassThruFilter();
}
- CString videoName = GetPlaybackMode() == PM_FILE ? m_wndPlaylistBar.GetCurFileName() : _T("");
+ CString videoName;
+ if (GetPlaybackMode() == PM_FILE) {
+ videoName = m_wndPlaylistBar.GetCurFileName();
+ }
if (!pSubStream) {
CAutoPtr<CVobSubFile> pVSF(DEBUG_NEW CVobSubFile(&m_csSubLock));
diff --git a/src/mpc-hc/MouseTouch.cpp b/src/mpc-hc/MouseTouch.cpp
index 96960dfa4..c3a5f7a9d 100644
--- a/src/mpc-hc/MouseTouch.cpp
+++ b/src/mpc-hc/MouseTouch.cpp
@@ -173,7 +173,7 @@ void CMouse::StopMouseLeaveTracker()
CPoint CMouse::GetVideoPoint(const CPoint& point) const
{
- return m_bD3DFS ? point : point - m_pMainFrame->m_wndView.GetVideoRect().TopLeft();
+ return m_bD3DFS ? point : CPoint(point - m_pMainFrame->m_wndView.GetVideoRect().TopLeft());
}
bool CMouse::IsOnFullscreenWindow() const
diff --git a/src/mpc-hc/PPageMisc.cpp b/src/mpc-hc/PPageMisc.cpp
index 8f66be237..3b0c359b5 100644
--- a/src/mpc-hc/PPageMisc.cpp
+++ b/src/mpc-hc/PPageMisc.cpp
@@ -1,5 +1,5 @@
/*
- * (C) 2006-2014, 2016 see Authors.txt
+ * (C) 2006-2014, 2016-2017 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -125,10 +125,10 @@ BOOL CPPageMisc::OnInitDialog()
m_ExportKeys.EnableWindow(FALSE);
}
- m_iBrightness ? m_sBrightness.Format(_T("%+d"), m_iBrightness) : m_sBrightness = _T("0");
- m_iContrast ? m_sContrast.Format(_T("%+d"), m_iContrast) : m_sContrast = _T("0");
- m_iHue ? m_sHue.Format(_T("%+d"), m_iHue) : m_sHue = _T("0");
- m_iSaturation ? m_sSaturation.Format(_T("%+d"), m_iSaturation) : m_sSaturation = _T("0");
+ m_sBrightness.Format(m_iBrightness ? _T("%+d") : _T("%d"), m_iBrightness);
+ m_sContrast.Format(m_iContrast ? _T("%+d") : _T("%d"), m_iContrast);
+ m_sHue.Format(m_iHue ? _T("%+d") : _T("%d"), m_iHue);
+ m_sSaturation.Format(m_iSaturation ? _T("%+d") : _T("%d"), m_iSaturation);
m_nUpdaterAutoCheck = s.nUpdaterAutoCheck;
m_nUpdaterDelay = s.nUpdaterDelay;
@@ -162,19 +162,19 @@ void CPPageMisc::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
if (*pScrollBar == m_SliBrightness) {
m_iBrightness = m_SliBrightness.GetPos();
((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetColorControl(ProcAmp_Brightness, m_iBrightness, m_iContrast, m_iHue, m_iSaturation);
- m_iBrightness ? m_sBrightness.Format(_T("%+d"), m_iBrightness) : m_sBrightness = _T("0");
+ m_sBrightness.Format(m_iBrightness ? _T("%+d") : _T("%d"), m_iBrightness);
} else if (*pScrollBar == m_SliContrast) {
m_iContrast = m_SliContrast.GetPos();
((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetColorControl(ProcAmp_Contrast, m_iBrightness, m_iContrast, m_iHue, m_iSaturation);
- m_iContrast ? m_sContrast.Format(_T("%+d"), m_iContrast) : m_sContrast = _T("0");
+ m_sContrast.Format(m_iContrast ? _T("%+d") : _T("%d"), m_iContrast);
} else if (*pScrollBar == m_SliHue) {
m_iHue = m_SliHue.GetPos();
((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetColorControl(ProcAmp_Hue, m_iBrightness, m_iContrast, m_iHue, m_iSaturation);
- m_iHue ? m_sHue.Format(_T("%+d"), m_iHue) : m_sHue = _T("0");
+ m_sHue.Format(m_iHue ? _T("%+d") : _T("%d"), m_iHue);
} else if (*pScrollBar == m_SliSaturation) {
m_iSaturation = m_SliSaturation.GetPos();
((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetColorControl(ProcAmp_Saturation, m_iBrightness, m_iContrast, m_iHue, m_iSaturation);
- m_iSaturation ? m_sSaturation.Format(_T("%+d"), m_iSaturation) : m_sSaturation = _T("0");
+ m_sSaturation.Format(m_iSaturation ? _T("%+d") : _T("%d"), m_iSaturation);
}
UpdateData(FALSE);
@@ -196,10 +196,10 @@ void CPPageMisc::OnBnClickedReset()
m_SliHue.SetPos(m_iHue);
m_SliSaturation.SetPos(m_iSaturation);
- m_iBrightness ? m_sBrightness.Format(_T("%+d"), m_iBrightness) : m_sBrightness = _T("0");
- m_iContrast ? m_sContrast.Format(_T("%+d"), m_iContrast) : m_sContrast = _T("0");
- m_iHue ? m_sHue.Format(_T("%+d"), m_iHue) : m_sHue = _T("0");
- m_iSaturation ? m_sSaturation.Format(_T("%+d"), m_iSaturation) : m_sSaturation = _T("0");
+ m_sBrightness.Format(m_iBrightness ? _T("%+d") : _T("%d"), m_iBrightness);
+ m_sContrast.Format(m_iContrast ? _T("%+d") : _T("%d"), m_iContrast);
+ m_sHue.Format(m_iHue ? _T("%+d") : _T("%d"), m_iHue);
+ m_sSaturation.Format(m_iSaturation ? _T("%+d") : _T("%d"), m_iSaturation);
((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetColorControl(ProcAmp_All, m_iBrightness, m_iContrast, m_iHue, m_iSaturation);
diff --git a/src/mpc-hc/PPageOutput.cpp b/src/mpc-hc/PPageOutput.cpp
index 2661f134b..ec559f69f 100644
--- a/src/mpc-hc/PPageOutput.cpp
+++ b/src/mpc-hc/PPageOutput.cpp
@@ -452,7 +452,11 @@ BOOL CPPageOutput::OnApply()
r.iEvrBuffers = 5;
}
- r.D3D9RenderDevice = m_fD3D9RenderDevice ? m_D3D9GUIDNames[m_iD3D9RenderDevice] : _T("");
+ if (m_fD3D9RenderDevice) {
+ r.D3D9RenderDevice = m_D3D9GUIDNames[m_iD3D9RenderDevice];
+ } else {
+ r.D3D9RenderDevice.Empty();
+ }
return __super::OnApply();
}
diff --git a/src/mpc-hc/PlayerPlaylistBar.cpp b/src/mpc-hc/PlayerPlaylistBar.cpp
index bd38393ca..49771ed08 100644
--- a/src/mpc-hc/PlayerPlaylistBar.cpp
+++ b/src/mpc-hc/PlayerPlaylistBar.cpp
@@ -1126,11 +1126,10 @@ void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruc
textcolor |= 0xA0A0A0;
}
- CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : _T("Invalid");
- CSize timesize(0, 0);
+ CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : CString(_T("Invalid"));
CPoint timept(rcItem.right, 0);
if (!time.IsEmpty()) {
- timesize = pDC->GetTextExtent(time);
+ CSize timesize = pDC->GetTextExtent(time);
if ((3 + timesize.cx + 3) < rcItem.Width() / 2) {
timept = CPoint(rcItem.right - (3 + timesize.cx + 3), (rcItem.top + rcItem.bottom - timesize.cy) / 2);
diff --git a/src/mpc-hc/SubtitleDlDlg.cpp b/src/mpc-hc/SubtitleDlDlg.cpp
index f4470b6e5..b3e55853a 100644
--- a/src/mpc-hc/SubtitleDlDlg.cpp
+++ b/src/mpc-hc/SubtitleDlDlg.cpp
@@ -628,7 +628,7 @@ afx_msg LRESULT CSubtitleDlDlg::OnCompleted(WPARAM wParam, LPARAM lParam)
CString disc;
disc.Format(_T("%d/%d"), subInfo.discNumber, subInfo.discCount);
m_list.SetItemText(iItem, COL_DISC, disc);
- m_list.SetItemText(iItem, COL_HEARINGIMPAIRED, subInfo.hearingImpaired == -1 ? _T("-") : subInfo.hearingImpaired > 0 ? ResStr(IDS_YES) : ResStr(IDS_NO));
+ m_list.SetItemText(iItem, COL_HEARINGIMPAIRED, subInfo.hearingImpaired == -1 ? _T("-") : subInfo.hearingImpaired > 0 ? ResStr(IDS_YES).GetString() : ResStr(IDS_NO).GetString());
CString downloads(_T("-"));
if (subInfo.downloadCount != -1) {
downloads.Format(_T("%d"), subInfo.downloadCount);
diff --git a/src/mpc-hc/SubtitlesProvider.cpp b/src/mpc-hc/SubtitlesProvider.cpp
index aca6da55b..03dd73e7d 100644
--- a/src/mpc-hc/SubtitlesProvider.cpp
+++ b/src/mpc-hc/SubtitlesProvider.cpp
@@ -612,7 +612,9 @@ SRESULT podnapisi::Search(const SubtitlesInfo& pFileInfo)
std::string url(Url() + "/ppodnapisi/search");
url += "?sXML=1";
url += "&sAKA=1";
- url += (!search.empty() ? "&sK=" + UrlEncode(search.c_str()) : "");
+ if (!search.empty()) {
+ url += "&sK=" + UrlEncode(search.c_str());
+ }
url += (pFileInfo.year != -1 ? "&sY=" + std::to_string(pFileInfo.year) : "");
url += (pFileInfo.seasonNumber != -1 ? "&sTS=" + std::to_string(pFileInfo.seasonNumber) : "");
url += (pFileInfo.episodeNumber != -1 ? "&sTE=" + std::to_string(pFileInfo.episodeNumber) : "");
diff --git a/src/mpc-hc/WebClientSocket.cpp b/src/mpc-hc/WebClientSocket.cpp
index 38a1253b7..4871ddb98 100644
--- a/src/mpc-hc/WebClientSocket.cpp
+++ b/src/mpc-hc/WebClientSocket.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.
*
@@ -108,7 +108,11 @@ void CWebClientSocket::HandleRequest()
while (pos) {
CAtlList<CStringA> sl2;
Explode(sl.GetNext(pos), sl2, '=', 2);
- m_cookie[sl2.GetHead()] = sl2.GetCount() == 2 ? UTF8To16(sl2.GetTail()) : _T("");
+ if (sl2.GetCount() == 2) {
+ m_cookie[sl2.GetHead()] = UTF8To16(sl2.GetTail());
+ } else {
+ m_cookie[sl2.GetHead()].Empty();
+ }
}
}
diff --git a/src/mpc-hc/mplayerc.cpp b/src/mpc-hc/mplayerc.cpp
index 72388115e..24d5891df 100644
--- a/src/mpc-hc/mplayerc.cpp
+++ b/src/mpc-hc/mplayerc.cpp
@@ -376,7 +376,7 @@ CStringA GetContentType(CString fn, CAtlList<CString>* redir)
CSocket s;
s.Create();
if (s.Connect(
- ProxyEnable ? ProxyServer : url.GetHostName(),
+ ProxyEnable ? ProxyServer.GetString() : url.GetHostName(),
ProxyEnable ? ProxyPort : url.GetPortNumber())) {
CStringA host = url.GetHostName();
CStringA path = url.GetUrlPath();