diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-03-21 21:10:09 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-03-21 22:54:37 +0100 |
commit | 28de720bc088a4afd3b2f28c5136a3478af5d22a (patch) | |
tree | d2ba0a8948c4f08d4bd583337f2bcfdf8e44d270 /include/systools | |
parent | b73e4660af577609621461c33693b629e9b5a603 (diff) |
Use IID_PPV_ARGS to have less explicit casting
Change-Id: Id8839a68320d7d0e2453b3d584dc5708c653cdf2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131863
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/systools')
-rw-r--r-- | include/systools/win32/comtools.hxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/systools/win32/comtools.hxx b/include/systools/win32/comtools.hxx index 0e614e0e7ea3..ebaed567fcf3 100644 --- a/include/systools/win32/comtools.hxx +++ b/include/systools/win32/comtools.hxx @@ -173,10 +173,10 @@ namespace sal::systools HRESULT TryCoCreateInstance(REFCLSID clsid, IUnknown* pOuter = nullptr, DWORD nCtx = CLSCTX_ALL) { - void* ip; - HRESULT hr = ::CoCreateInstance(clsid, pOuter, nCtx, __uuidof(T), &ip); + T* ip; + HRESULT hr = ::CoCreateInstance(clsid, pOuter, nCtx, IID_PPV_ARGS(&ip)); if (SUCCEEDED(hr)) - release(std::exchange(com_ptr_, static_cast<T*>(ip))); + release(std::exchange(com_ptr_, ip)); return hr; } @@ -189,10 +189,10 @@ namespace sal::systools HRESULT TryCoGetClassObject(REFCLSID clsid, DWORD nCtx = CLSCTX_ALL) { - void* ip; - HRESULT hr = ::CoGetClassObject(clsid, nCtx, nullptr, __uuidof(T), &ip); + T* ip; + HRESULT hr = ::CoGetClassObject(clsid, nCtx, nullptr, IID_PPV_ARGS(&ip)); if (SUCCEEDED(hr)) - release(std::exchange(com_ptr_, static_cast<T*>(ip))); + release(std::exchange(com_ptr_, ip)); return hr; } |