=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: cryptui: Avoid idempotent operation (Clang).

Alexandre Julliard julliard at winehq.org
Mon Oct 17 13:08:54 CDT 2011


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

Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date:   Fri Oct 14 23:11:32 2011 +0200

cryptui: Avoid idempotent operation (Clang).

---

 dlls/cryptui/main.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 9df9800..5f742d6 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -1966,23 +1966,19 @@ static struct OIDToString oidMap[] = {
 
 static struct OIDToString *findSupportedOID(LPCSTR oid)
 {
-    int indexHigh = sizeof(oidMap) / sizeof(oidMap[0]) - 1, indexLow = 0, i;
-    struct OIDToString *ret = NULL;
+    int indexHigh = sizeof(oidMap) / sizeof(oidMap[0]) - 1, indexLow = 0;
 
-    for (i = (indexLow + indexHigh) / 2; !ret && indexLow <= indexHigh;
-     i = (indexLow + indexHigh) / 2)
+    while (indexLow <= indexHigh)
     {
-        int cmp;
-
-        cmp = strcmp(oid, oidMap[i].oid);
-        if (!cmp)
-            ret = &oidMap[i];
-        else if (cmp > 0)
+        int cmp, i = (indexLow + indexHigh) / 2;
+        if (!(cmp = strcmp(oid, oidMap[i].oid)))
+            return &oidMap[i];
+        if (cmp > 0)
             indexLow = i + 1;
         else
             indexHigh = i - 1;
     }
-    return ret;
+    return NULL;
 }
 
 static void add_local_oid_text_to_control(HWND text, LPCSTR oid)




More information about the wine-cvs mailing list