[PATCH] shdocvw: rewrite code to make more understandable (Coverity)
Marcus Meissner
meissner at suse.de
Tue Mar 1 11:16:34 CST 2011
Hi,
CID1801
assigments in the middle of an if () is ugly, and badly
understandable. Also Coverity thought it is probably wrong
and I was confused.
Fixed that if by splitting and adjusted another illformatted
if() some lines down.
Ciao, Marcus
---
dlls/shdocvw/shlinstobj.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/shdocvw/shlinstobj.c b/dlls/shdocvw/shlinstobj.c
index d272c91..63bf0e6 100644
--- a/dlls/shdocvw/shlinstobj.c
+++ b/dlls/shdocvw/shlinstobj.c
@@ -375,16 +375,15 @@ HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, REFIID riid,
ppvClassObj);
/* Figure if there is an 'Instance' subkey for the given CLSID and acquire a handle. */
- if (!StringFromGUID2(rclsid, wszInstanceKey + 6, CHARS_IN_GUID) ||
- !(wszInstanceKey[5+CHARS_IN_GUID]='\\') || /* Repair the null-termination. */
- ERROR_SUCCESS != RegOpenKeyExW(HKEY_CLASSES_ROOT, wszInstanceKey, 0, KEY_READ, &hInstanceKey))
- {
+ if (!StringFromGUID2(rclsid, wszInstanceKey + 6, CHARS_IN_GUID))
+ return CLASS_E_CLASSNOTAVAILABLE;
+ wszInstanceKey[5+CHARS_IN_GUID] = '\\'; /* Repair the null-termination. */
+ if (ERROR_SUCCESS != RegOpenKeyExW(HKEY_CLASSES_ROOT, wszInstanceKey, 0, KEY_READ, &hInstanceKey))
/* If there is no 'Instance' subkey, then it's not a Shell Instance Object. */
return CLASS_E_CLASSNOTAVAILABLE;
- }
- if (RegQueryValueExW(hInstanceKey, wszCLSID, NULL, &dwType, (LPBYTE)wszCLSIDInstance, &cbBytes)
- != ERROR_SUCCESS || FAILED(CLSIDFromString(wszCLSIDInstance, &clsidInstance)))
+ if (ERROR_SUCCESS != RegQueryValueExW(hInstanceKey, wszCLSID, NULL, &dwType, (LPBYTE)wszCLSIDInstance, &cbBytes) ||
+ FAILED(CLSIDFromString(wszCLSIDInstance, &clsidInstance)))
{
/* 'Instance' should have a 'CLSID' value with a well-formed clsid-string. */
FIXME("Failed to infer instance CLSID! %s\n", debugstr_w(wszCLSIDInstance));
--
1.7.1
More information about the wine-patches
mailing list