sal/osl/w32/module.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
New commits: commit 2fd019442e14e122884fff42b88de23fa150e4df Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Jan 6 01:12:31 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Jan 6 06:46:20 2022 +0100 Simplify osl_getModuleURLFromAddress a bit Change-Id: I71243c99d43b58329317baa250d5b60aa62db360 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128030 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index 201f2dd164ee..57eec8b70012 100644 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -26,6 +26,7 @@ #include <osl/diagnose.h> #include <osl/thread.h> #include <osl/file.h> +#include <rtl/ustring.hxx> #include <sal/log.hxx> #include <o3tl/char16_t2wchar_t.hxx> #include <vector> @@ -182,15 +183,11 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress( void *pv, rtl_uString **pustrURL return false; ::osl::LongPathBuffer<sal_Unicode> aBuffer(MAX_LONG_PATH); - rtl_uString* ustrSysPath = nullptr; - GetModuleFileNameW(hModule, o3tl::toW(aBuffer), aBuffer.getBufSizeInSymbols()); + DWORD nch = GetModuleFileNameW(hModule, o3tl::toW(aBuffer), aBuffer.getBufSizeInSymbols()); - rtl_uString_newFromStr(&ustrSysPath, aBuffer); - osl_getFileURLFromSystemPath(ustrSysPath, pustrURL); - rtl_uString_release(ustrSysPath); - - return true; + OUString ustrSysPath(aBuffer, nch); + return osl_getFileURLFromSystemPath(ustrSysPath.pData, pustrURL) == osl_File_E_None; } sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress( oslGenericFunction addr, rtl_uString ** ppLibraryUrl )