msi: Use VARIANT_BOOL values consistently for VT_BOOL type (PVS-Studio).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-10-21 14:59:49 +03:00 committed by Alexandre Julliard
parent 5c170dc9bd
commit 2257928a7a
2 changed files with 12 additions and 12 deletions

View File

@ -1437,7 +1437,7 @@ static HRESULT session_invoke(
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = MsiGetMode(This->msiHandle, V_I4(&varg0));
V_BOOL(pVarResult) = MsiGetMode(This->msiHandle, V_I4(&varg0)) ? VARIANT_TRUE : VARIANT_FALSE;
} else if (wFlags & DISPATCH_PROPERTYPUT) {
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
@ -2053,7 +2053,7 @@ static HRESULT InstallerImpl_RegistryValue(WORD wFlags,
/* Return VT_BOOL clarifying whether registry key exists or not. */
case VT_EMPTY:
V_VT(pVarResult) = VT_BOOL;
V_BOOL(pVarResult) = (ret == ERROR_SUCCESS);
V_BOOL(pVarResult) = (ret == ERROR_SUCCESS) ? VARIANT_TRUE : VARIANT_FALSE;
break;
/* Return the value of specified key if it exists. */

View File

@ -1204,7 +1204,7 @@ static HRESULT Session_LanguageGet(IDispatch *pSession, UINT *pLangId)
return hr;
}
static HRESULT Session_ModeGet(IDispatch *pSession, int iFlag, BOOL *pMode)
static HRESULT Session_ModeGet(IDispatch *pSession, int iFlag, VARIANT_BOOL *mode)
{
VARIANT varresult;
VARIANTARG vararg[1];
@ -1216,12 +1216,12 @@ static HRESULT Session_ModeGet(IDispatch *pSession, int iFlag, BOOL *pMode)
V_I4(&vararg[0]) = iFlag;
hr = invoke(pSession, "Mode", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BOOL);
*pMode = V_BOOL(&varresult);
*mode = V_BOOL(&varresult);
VariantClear(&varresult);
return hr;
}
static HRESULT Session_ModePut(IDispatch *pSession, int iFlag, BOOL bMode)
static HRESULT Session_ModePut(IDispatch *pSession, int iFlag, VARIANT_BOOL mode)
{
VARIANT varresult;
VARIANTARG vararg[2];
@ -1233,7 +1233,7 @@ static HRESULT Session_ModePut(IDispatch *pSession, int iFlag, BOOL bMode)
V_I4(&vararg[1]) = iFlag;
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_BOOL;
V_BOOL(&vararg[0]) = bMode;
V_BOOL(&vararg[0]) = mode;
return invoke(pSession, "Mode", DISPATCH_PROPERTYPUT, &dispparams, &varresult, VT_EMPTY);
}
@ -1876,7 +1876,7 @@ static void test_Session(IDispatch *pSession)
WCHAR stringw[MAX_PATH];
CHAR string[MAX_PATH];
UINT len;
BOOL bool;
VARIANT_BOOL bool;
int myint;
IDispatch *pDatabase = NULL, *pInst = NULL, *record = NULL;
ULONG refs_before, refs_after;
@ -1944,15 +1944,15 @@ static void test_Session(IDispatch *pSession)
ok(!bool, "Maintenance mode is %d\n", bool);
/* Session::Mode, put */
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, TRUE);
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, VARIANT_TRUE);
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
hr = Session_ModeGet(pSession, MSIRUNMODE_REBOOTATEND, &bool);
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
ok(bool, "Reboot at end session mode is %d, expected 1\n", bool);
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, FALSE); /* set it again so we don't reboot */
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTATEND, VARIANT_FALSE); /* set it again so we don't reboot */
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, TRUE);
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_TRUE);
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
ok_exception(hr, szModeFlag);
@ -1960,11 +1960,11 @@ static void test_Session(IDispatch *pSession)
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
ok(bool, "Reboot now mode is %d, expected 1\n", bool);
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, FALSE); /* set it again so we don't reboot */
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_FALSE); /* set it again so we don't reboot */
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
ok_exception(hr, szModeFlag);
hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, TRUE);
hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, VARIANT_TRUE);
ok(hr == DISP_E_EXCEPTION, "Session_ModePut failed, hresult 0x%08x\n", hr);
ok_exception(hr, szModeFlag);