Permalink
Browse files

fixes for issues found by the Visual Studio Code Analysis tool

  • Loading branch information...
1 parent 639950e commit 0b12daefb24df88fc759eb3b29b81d87c1a45012 @CrystalP committed Aug 28, 2011
@@ -94,6 +94,8 @@
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
+ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+ <RunCodeAnalysis Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">
<ClCompile>
@@ -162,6 +164,7 @@
<ForcedIncludeFiles>pch.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<ShowIncludes>false</ShowIncludes>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<AdditionalOptions>/MACHINE:I386 /IGNORE:4089 /ignore:4254 %(AdditionalOptions)</AdditionalOptions>
@@ -72,7 +72,7 @@ class CDVDOverlaySpu : public CDVDOverlay
memcpy(alpha , src.alpha , sizeof(alpha));
memcpy(color , src.color , sizeof(color));
memcpy(highlight_alpha, src.highlight_alpha, sizeof(highlight_alpha));
- memcpy(highlight_color, src.highlight_alpha, sizeof(highlight_color));
+ memcpy(highlight_color, src.highlight_color, sizeof(highlight_color));
}
BYTE result[2*65536 + 20]; // rle data
@@ -1175,7 +1175,7 @@ void CDVDDemuxFFmpeg::AddStream(int iId)
std::string CDVDDemuxFFmpeg::GetFileName()
{
- if(m_pInput && m_pInput)
+ if(m_pInput)
return m_pInput->GetFileName();
else
return "";
@@ -392,7 +392,7 @@ int CGUITextureManager::Load(const CStdString& strTextureName, bool checkBundleO
int width = 0, height = 0;
if (bundle >= 0)
{
- if (FAILED(m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height)))
+ if (!m_TexBundle[bundle].LoadTexture(strTextureName, &pTexture, width, height))
{
CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());
return 0;
@@ -181,7 +181,7 @@ int CFlacTag::ReadFlacHeader(void)
m_file->Seek(iPos + 14, SEEK_SET); // seek to the frequency and duration data
m_file->Read(buffer, 8); // read 64 bits of data
int iFreq = (buffer[0] << 12) | (buffer[1] << 4) | (buffer[2] >> 4);
- int64_t iNumSamples = ( (int64_t) (buffer[3] & 0x0F) << 32) | ( (int64_t) buffer[4] << 24) | (buffer[5] << 16) | (buffer[6] << 8) | buffer[7];
+ int64_t iNumSamples = ( (int64_t) (buffer[3] & 0x0F) << 32) | ( (int64_t) buffer[4] << 24) | ( (int64_t) buffer[5] << 16) | ( (int64_t) buffer[6] << 8) | buffer[7];
m_musicInfoTag.SetDuration((int)((iNumSamples) / iFreq));
return iPos + 38;
}
@@ -99,7 +99,8 @@ bool CEventPacket::Parse(int datasize, const void *data)
memcpy(m_pPayload, buf, (size_t)m_iPayloadSize);
}
- return (m_bValid = true);
+ m_bValid = true;
+ return (m_bValid);
}
#endif // HAS_EVENT_SERVER
@@ -604,7 +604,7 @@ bool CRenderSystemDX::BeginRender()
if (!m_bRenderCreated)
return false;
- DWORD oldStatus = m_nDeviceStatus;
+ HRESULT oldStatus = m_nDeviceStatus;
if (m_useD3D9Ex)
{
m_nDeviceStatus = ((IDirect3DDevice9Ex*)m_pD3DDevice)->CheckDeviceState(m_hDeviceWnd);
View
@@ -482,7 +482,6 @@ void CWIN32Util::ExtendDllPath()
HRESULT CWIN32Util::ToggleTray(const char cDriveLetter)
{
BOOL bRet= FALSE;
- DWORD dwReq;
char cDL = cDriveLetter;
if( !cDL )
{
@@ -502,16 +501,17 @@ HRESULT CWIN32Util::ToggleTray(const char cDriveLetter)
( GetDriveType( strRootFormat ) == DRIVE_CDROM ) )
{
DWORD dwDummy;
- dwReq = (GetDriveStatus(strVolFormat) == 1) ? IOCTL_STORAGE_LOAD_MEDIA : IOCTL_STORAGE_EJECT_MEDIA;
+ DWORD dwReq = (GetDriveStatus(strVolFormat) == 1) ? IOCTL_STORAGE_LOAD_MEDIA : IOCTL_STORAGE_EJECT_MEDIA;
bRet = DeviceIoControl( hDrive, dwReq, NULL, 0, NULL, 0, &dwDummy, NULL);
CloseHandle( hDrive );
- }
- // Windows doesn't seem to send always DBT_DEVICEREMOVECOMPLETE
- // unmount it here too as it won't hurt
- if(dwReq == IOCTL_STORAGE_EJECT_MEDIA && bRet == 1)
- {
- strRootFormat.Format( _T("%c:"), cDL);
- g_application.getApplicationMessenger().OpticalUnMount(strRootFormat);
+
+ // Windows doesn't seem to send always DBT_DEVICEREMOVECOMPLETE
+ // unmount it here too as it won't hurt
+ if(dwReq == IOCTL_STORAGE_EJECT_MEDIA && bRet == 1)
+ {
+ strRootFormat.Format( _T("%c:"), cDL);
+ g_application.getApplicationMessenger().OpticalUnMount(strRootFormat);
+ }
}
return bRet? S_OK : S_FALSE;
}

0 comments on commit 0b12dae

Please sign in to comment.