Hans Leidekker : msi: Avoid casts in IWineMsiRemotePackage methods.

Alexandre Julliard julliard at winehq.org
Mon May 2 14:16:16 CDT 2011


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon May  2 16:02:55 2011 +0200

msi: Avoid casts in IWineMsiRemotePackage methods.

---

 dlls/msi/install.c     |   12 ++++--------
 dlls/msi/msiserver.idl |    6 +++---
 dlls/msi/package.c     |   20 ++++++++------------
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 30a63e6..5879df4 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -246,8 +246,7 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
         }
 
         len = 0;
-        hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder,
-                                                  NULL, &len );
+        hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, NULL, &len );
         if (FAILED(hr))
             goto done;
 
@@ -259,8 +258,7 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
             goto done;
         }
 
-        hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder,
-                                                  (BSTR *)value, &len);
+        hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, value, &len );
         if (FAILED(hr))
             goto done;
 
@@ -371,8 +369,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
         }
 
         len = 0;
-        hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder,
-                                                  NULL, &len );
+        hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, NULL, &len );
         if (FAILED(hr))
             goto done;
 
@@ -384,8 +381,7 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
             goto done;
         }
 
-        hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder,
-                                                  (BSTR *)value, &len);
+        hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, value, &len );
         if (FAILED(hr))
             goto done;
 
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index aa81498..669d7f2 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -54,14 +54,14 @@ interface IWineMsiRemotePackage : IUnknown
 {
     HRESULT SetMsiHandle( [in] MSIHANDLE handle );
     HRESULT GetActiveDatabase( [out] MSIHANDLE *handle );
-    HRESULT GetProperty( [in] BSTR property, [out] BSTR *value, [out] DWORD *size );
+    HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
     HRESULT SetProperty( [in] BSTR property, [in] BSTR value );
     HRESULT ProcessMessage( [in] INSTALLMESSAGE message, [in] MSIHANDLE record );
     HRESULT DoAction( [in] BSTR action );
     HRESULT Sequence( [in] BSTR table, [in] int sequence );
-    HRESULT GetTargetPath( [in] BSTR folder, [out] BSTR *value, [out] DWORD *size );
+    HRESULT GetTargetPath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
     HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value );
-    HRESULT GetSourcePath( [in] BSTR folder, [out] BSTR *value, [out] DWORD *size );
+    HRESULT GetSourcePath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
     HRESULT GetMode( [in] MSIRUNMODE mode, [out] BOOL *ret );
     HRESULT SetMode( [in] MSIRUNMODE mode, [in] BOOL state );
     HRESULT GetFeatureState( [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 2a82ca5..7355b3d 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -2231,7 +2231,7 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
             goto done;
         }
 
-        hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, (BSTR *)value, &len );
+        hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, value, &len );
         if (FAILED(hr))
             goto done;
 
@@ -2383,15 +2383,11 @@ static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHA
     return S_OK;
 }
 
-static HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR *value, DWORD *size )
+static HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value, DWORD *size )
 {
     msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
-    UINT r;
-
-    r = MsiGetPropertyW(This->package, (LPWSTR)property, (LPWSTR)value, size);
-    if (r != ERROR_SUCCESS)
-        return HRESULT_FROM_WIN32(r);
-
+    UINT r = MsiGetPropertyW(This->package, property, value, size);
+    if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r);
     return S_OK;
 }
 
@@ -2423,10 +2419,10 @@ static HRESULT WINAPI mrp_Sequence( IWineMsiRemotePackage *iface, BSTR table, in
     return HRESULT_FROM_WIN32(r);
 }
 
-static HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR *value, DWORD *size )
+static HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size )
 {
     msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
-    UINT r = MsiGetTargetPathW(This->package, (LPWSTR)folder, (LPWSTR)value, size);
+    UINT r = MsiGetTargetPathW(This->package, folder, value, size);
     return HRESULT_FROM_WIN32(r);
 }
 
@@ -2437,10 +2433,10 @@ static HRESULT WINAPI mrp_SetTargetPath( IWineMsiRemotePackage *iface, BSTR fold
     return HRESULT_FROM_WIN32(r);
 }
 
-static HRESULT WINAPI mrp_GetSourcePath( IWineMsiRemotePackage *iface, BSTR folder, BSTR *value, DWORD *size )
+static HRESULT WINAPI mrp_GetSourcePath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size )
 {
     msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
-    UINT r = MsiGetSourcePathW(This->package, (LPWSTR)folder, (LPWSTR)value, size);
+    UINT r = MsiGetSourcePathW(This->package, folder, value, size);
     return HRESULT_FROM_WIN32(r);
 }
 




More information about the wine-cvs mailing list