Misha Koshelev : msi: automation: Condense a few loops.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed May 16 09:10:27 CDT 2007
Module: wine
Branch: master
Commit: 187f856e46bd0bb675355de907e2502257b8f846
URL: http://source.winehq.org/git/wine.git/?a=commit;h=187f856e46bd0bb675355de907e2502257b8f846
Author: Misha Koshelev <mk144210 at bcm.edu>
Date: Tue May 15 19:29:04 2007 -0500
msi: automation: Condense a few loops.
---
dlls/msi/automation.c | 38 ++++++++++++++++----------------------
1 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index 1030f96..762f20c 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -575,24 +575,21 @@ static HRESULT WINAPI RecordImpl_Invoke(
break;
case DISPID_RECORD_STRINGDATA:
- if (wFlags & DISPATCH_PROPERTYGET) {
+ if (wFlags & DISPATCH_PROPERTYGET) {
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = NULL;
- ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen);
- if (ret == ERROR_SUCCESS)
+ if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
{
- szString = msi_alloc((++dwLen)*sizeof(WCHAR));
- if (szString)
- {
- if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
- V_BSTR(pVarResult) = SysAllocString(szString);
- msi_free(szString);
- }
+ if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
+ ERR("Out of memory\n");
+ else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
+ V_BSTR(pVarResult) = SysAllocString(szString);
+ msi_free(szString);
}
if (ret != ERROR_SUCCESS)
- ERR("MsiRecordGetString returned %d\n", ret);
+ ERR("MsiRecordGetString returned %d\n", ret);
} else if (wFlags & DISPATCH_PROPERTYPUT) {
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
@@ -886,24 +883,21 @@ static HRESULT WINAPI SessionImpl_Invoke(
break;
case DISPID_SESSION_PROPERTY:
- if (wFlags & DISPATCH_PROPERTYGET) {
+ if (wFlags & DISPATCH_PROPERTYGET) {
hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr);
if (FAILED(hr)) return hr;
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = NULL;
- ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen);
- if (ret == ERROR_SUCCESS)
+ if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
{
- szString = msi_alloc((++dwLen)*sizeof(WCHAR));
- if (szString)
- {
- if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
- V_BSTR(pVarResult) = SysAllocString(szString);
- msi_free(szString);
- }
+ if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
+ ERR("Out of memory\n");
+ else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
+ V_BSTR(pVarResult) = SysAllocString(szString);
+ msi_free(szString);
}
if (ret != ERROR_SUCCESS)
- ERR("MsiGetProperty returned %d\n", ret);
+ ERR("MsiGetProperty returned %d\n", ret);
} else if (wFlags & DISPATCH_PROPERTYPUT) {
hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr);
if (FAILED(hr)) return hr;
More information about the wine-cvs
mailing list