diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-16 23:28:57 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-16 23:28:57 +0400 |
commit | e9e09d64fbc9c884e7e00f22bfa9de18b8748bb9 (patch) | |
tree | 1a147ec652bb6baef603d72fc6bb9129c416b38b /src/apps/mplayerc/RealMediaGraph.cpp | |
parent | 3a990e7f323a3f68c286ad8b3395c681368ff46b (diff) |
Some warnings fixed (uninitialized local variable, unused local variable, comparison signed/unsigned type, assignment in if)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1886 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/RealMediaGraph.cpp')
-rw-r--r-- | src/apps/mplayerc/RealMediaGraph.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/apps/mplayerc/RealMediaGraph.cpp b/src/apps/mplayerc/RealMediaGraph.cpp index 355fc35b8..d609ed0f3 100644 --- a/src/apps/mplayerc/RealMediaGraph.cpp +++ b/src/apps/mplayerc/RealMediaGraph.cpp @@ -71,7 +71,8 @@ bool CRealMediaPlayer::Init() key.Close();
- if(!(m_hRealMediaCore = LoadLibrary(CString(buff) + _T("pnen3260.dll"))))
+ m_hRealMediaCore = LoadLibrary(CString(buff) + _T("pnen3260.dll"));
+ if(!m_hRealMediaCore)
return(false);
m_fpCreateEngine = (FPRMCREATEENGINE)GetProcAddress(m_hRealMediaCore, "CreateEngine");
@@ -221,6 +222,19 @@ STDMETHODIMP CRealMediaPlayer::NonDelegatingQueryInterface(REFIID riid, void** p __super::NonDelegatingQueryInterface(riid, ppv);
}
+char* AllocateErrorMessage(const char* msg)
+{
+ char* errmsg = NULL;
+ int len = strlen(msg);
+ if(len > 0)
+ {
+ errmsg = (char*)CoTaskMemAlloc(len+1);
+ if (errmsg)
+ strcpy(errmsg, msg);
+ }
+ return errmsg;
+}
+
// IRMAErrorSink
STDMETHODIMP CRealMediaPlayer::ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL)
{
@@ -233,16 +247,14 @@ STDMETHODIMP CRealMediaPlayer::ErrorOccurred(const UINT8 unSeverity, const UINT3 CComPtr<IRMABuffer> pBuffer = pErrorMessages->GetErrorText(ulRMACode);
if(pBuffer)
{
- char* buff = (char*)pBuffer->GetBuffer();
- int len = strlen(buff);
- if(len > 0 && (errmsg = (char*)CoTaskMemAlloc(len+1)))
- strcpy(errmsg, buff);
+ char* buff = (char*)pBuffer->GetBuffer();
+ errmsg = AllocateErrorMessage(buff);
}
}
- if(!errmsg && (errmsg = (char*)CoTaskMemAlloc(strlen("RealMedia error")+1)))
+ if(!errmsg)
{
- strcpy(errmsg, "RealMedia error");
+ errmsg = AllocateErrorMessage("RealMedia error");
TRACE("RealMedia error\n");
}
@@ -492,7 +504,8 @@ bool CRealMediaPlayerWindowed::CreateSite(IRMASite** ppSite) if(PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style))
return(false);
- return !!(*ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowed).Detach());
+ *ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowed).Detach();
+ return !!(*ppSite);
}
void CRealMediaPlayerWindowed::DestroySite(IRMASite* pSite)
@@ -553,7 +566,8 @@ bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite) pWMWlS->SetBltService(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface>(m_pRMAP));
- return !!(*ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowless).Detach());
+ *ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowless).Detach();
+ return !!(*ppSite);
}
void CRealMediaPlayerWindowless::DestroySite(IRMASite* pSite)
|