cryptui: Avoid idempotent operation (Clang).

This commit is contained in:
Frédéric Delanoy 2011-10-14 23:11:32 +02:00 committed by Alexandre Julliard
parent 85051917fe
commit 61c6212672
1 changed files with 7 additions and 11 deletions

View File

@ -1966,23 +1966,19 @@ static struct OIDToString oidMap[] = {
static struct OIDToString *findSupportedOID(LPCSTR oid) static struct OIDToString *findSupportedOID(LPCSTR oid)
{ {
int indexHigh = sizeof(oidMap) / sizeof(oidMap[0]) - 1, indexLow = 0, i; int indexHigh = sizeof(oidMap) / sizeof(oidMap[0]) - 1, indexLow = 0;
struct OIDToString *ret = NULL;
for (i = (indexLow + indexHigh) / 2; !ret && indexLow <= indexHigh; while (indexLow <= indexHigh)
i = (indexLow + indexHigh) / 2)
{ {
int cmp; int cmp, i = (indexLow + indexHigh) / 2;
if (!(cmp = strcmp(oid, oidMap[i].oid)))
cmp = strcmp(oid, oidMap[i].oid); return &oidMap[i];
if (!cmp) if (cmp > 0)
ret = &oidMap[i];
else if (cmp > 0)
indexLow = i + 1; indexLow = i + 1;
else else
indexHigh = i - 1; indexHigh = i - 1;
} }
return ret; return NULL;
} }
static void add_local_oid_text_to_control(HWND text, LPCSTR oid) static void add_local_oid_text_to_control(HWND text, LPCSTR oid)