include/systools/win32/comtools.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 28de720bc088a4afd3b2f28c5136a3478af5d22a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Mar 21 21:10:09 2022 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Mar 21 22:54:37 2022 +0100 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.kagan...@collabora.com> 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; }