Nikolay Sivov : shell32: Remove redundant loop to count already known value .

Alexandre Julliard julliard at winehq.org
Mon Jan 9 14:24:30 CST 2012


Module: wine
Branch: master
Commit: 1e864366284065ffcb0fae7a10512c6059f95a33
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e864366284065ffcb0fae7a10512c6059f95a33

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jan  8 03:14:36 2012 +0300

shell32: Remove redundant loop to count already known value.

---

 dlls/shell32/shv_item_cmenu.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/dlls/shell32/shv_item_cmenu.c b/dlls/shell32/shv_item_cmenu.c
index 8a97a6e..f1a96cf 100644
--- a/dlls/shell32/shv_item_cmenu.c
+++ b/dlls/shell32/shv_item_cmenu.c
@@ -73,20 +73,17 @@ static inline ItemCmImpl *impl_from_IContextMenu2(IContextMenu2 *iface)
 * ISvItemCm_CanRenameItems()
 */
 static BOOL ISvItemCm_CanRenameItems(ItemCmImpl *This)
-{	UINT  i;
-	DWORD dwAttributes;
+{
+    DWORD attr;
 
-	TRACE("(%p)->()\n",This);
+    TRACE("(%p)\n", This);
 
-	if(This->apidl)
-	{
-	  for(i = 0; i < This->cidl; i++){}
-	  if(i > 1) return FALSE;		/* can't rename more than one item at a time*/
-	  dwAttributes = SFGAO_CANRENAME;
-	  IShellFolder_GetAttributesOf(This->menu.parent, 1, (LPCITEMIDLIST*)This->apidl, &dwAttributes);
-	  return dwAttributes & SFGAO_CANRENAME;
-	}
-	return FALSE;
+    /* can't rename more than one item at a time*/
+    if (!This->apidl || This->cidl > 1) return FALSE;
+
+    attr = SFGAO_CANRENAME;
+    IShellFolder_GetAttributesOf(This->menu.parent, 1, (LPCITEMIDLIST*)This->apidl, &attr);
+    return attr & SFGAO_CANRENAME;
 }
 
 /**************************************************************************




More information about the wine-cvs mailing list