diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-04-20 06:17:50 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-04-20 06:17:50 +0400 |
commit | 4f8e4a60a362334579435db89e08f00e78a5de48 (patch) | |
tree | 8aa488487d0984467be5789c0ed6bd226c8d9cbb /src/apps/mplayerc/FileVersionInfo.cpp | |
parent | 3c584d0200f48d4b29f783bec509a756f3579ff3 (diff) |
long sequences of "if" replaced by "switch" for better performance and simplifying debugging
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1802 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/FileVersionInfo.cpp')
-rw-r--r-- | src/apps/mplayerc/FileVersionInfo.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/apps/mplayerc/FileVersionInfo.cpp b/src/apps/mplayerc/FileVersionInfo.cpp index 9d37d8e05..3f86fc512 100644 --- a/src/apps/mplayerc/FileVersionInfo.cpp +++ b/src/apps/mplayerc/FileVersionInfo.cpp @@ -158,16 +158,19 @@ BOOL CFileVersionInfo::Create(LPCTSTR lpszFileName) WORD CFileVersionInfo::GetFileVersion(int nIndex) const
{
- if (nIndex == 0)
- return (WORD)(m_FileInfo.dwFileVersionLS & 0x0000FFFF);
- else if (nIndex == 1)
- return (WORD)((m_FileInfo.dwFileVersionLS & 0xFFFF0000) >> 16);
- else if (nIndex == 2)
- return (WORD)(m_FileInfo.dwFileVersionMS & 0x0000FFFF);
- else if (nIndex == 3)
+ switch(nIndex)
+ {
+ case 0:
+ return (WORD)(m_FileInfo.dwFileVersionLS & 0x0000FFFF);
+ case 1:
+ return (WORD)((m_FileInfo.dwFileVersionLS & 0xFFFF0000) >> 16);
+ case 2:
+ return (WORD)(m_FileInfo.dwFileVersionMS & 0x0000FFFF);
+ case 3:
return (WORD)((m_FileInfo.dwFileVersionMS & 0xFFFF0000) >> 16);
- else
+ default:
return 0;
+ }
}
CString CFileVersionInfo::GetFileVersionEx() const
@@ -185,16 +188,19 @@ CString CFileVersionInfo::GetFileVersionEx() const WORD CFileVersionInfo::GetProductVersion(int nIndex) const
{
- if (nIndex == 0)
- return (WORD)(m_FileInfo.dwProductVersionLS & 0x0000FFFF);
- else if (nIndex == 1)
- return (WORD)((m_FileInfo.dwProductVersionLS & 0xFFFF0000) >> 16);
- else if (nIndex == 2)
- return (WORD)(m_FileInfo.dwProductVersionMS & 0x0000FFFF);
- else if (nIndex == 3)
- return (WORD)((m_FileInfo.dwProductVersionMS & 0xFFFF0000) >> 16);
- else
- return 0;
+ switch(nIndex)
+ {
+ case 0:
+ return (WORD)(m_FileInfo.dwProductVersionLS & 0x0000FFFF);
+ case 1:
+ return (WORD)((m_FileInfo.dwProductVersionLS & 0xFFFF0000) >> 16);
+ case 2:
+ return (WORD)(m_FileInfo.dwProductVersionMS & 0x0000FFFF);
+ case 3:
+ return (WORD)((m_FileInfo.dwProductVersionMS & 0xFFFF0000) >> 16);
+ default:
+ return 0;
+ }
}
|