[SHELL32]
authorDavid Quintana <gigaherz@gmail.com>
Fri, 2 May 2014 17:27:28 +0000 (17:27 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Fri, 2 May 2014 17:27:28 +0000 (17:27 +0000)
* Fix redundant clauses by converting the code to a switch block. Adapted from a patch by Victor Martinez.
CORE-8161 #resolve #comment Fixed in the shell-experiments branch. Thanks.

svn path=/branches/shell-experiments/; revision=63115

dll/win32/shell32/shellitem.cpp

index ce767e0..49ae0ca 100644 (file)
@@ -122,20 +122,24 @@ HRESULT WINAPI CShellItem::GetDisplayName(SIGDN sigdnName, LPWSTR *ppszName)
     hr = get_parent_shellfolder(&parent_folder);
     if (SUCCEEDED(hr))
     {
-        if (sigdnName == SIGDN_PARENTRELATIVEEDITING)
-            uFlags = SHGDN_FOREDITING | SHGDN_INFOLDER;
-        else if (sigdnName == SIGDN_DESKTOPABSOLUTEEDITING)
-            uFlags = SHGDN_FOREDITING;
-        else if (sigdnName == SIGDN_PARENTRELATIVEEDITING)
+        switch (sigdnName)
+        {
+        case SIGDN_PARENTRELATIVEEDITING:
             uFlags = SHGDN_FOREDITING | SHGDN_INFOLDER;
-        else if (sigdnName == SIGDN_DESKTOPABSOLUTEEDITING)
+            break;
+        case SIGDN_DESKTOPABSOLUTEEDITING:
             uFlags = SHGDN_FOREDITING;
-        else if (sigdnName == SIGDN_PARENTRELATIVEPARSING)
+            break;
+        case SIGDN_PARENTRELATIVEPARSING:
             uFlags = SHGDN_FORPARSING | SHGDN_INFOLDER;
-        else if (sigdnName == SIGDN_DESKTOPABSOLUTEPARSING)
+            break;
+        case SIGDN_DESKTOPABSOLUTEPARSING:
             uFlags = SHGDN_FORPARSING;
-        else
+            break;
+        default:
             uFlags = SHGDN_NORMAL;
+            break;
+        }
 
         hr = parent_folder->GetDisplayNameOf(m_pidl, uFlags, &name);
         if (SUCCEEDED(hr))