summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-01-06 01:12:31 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-01-06 06:46:20 +0100
commit2fd019442e14e122884fff42b88de23fa150e4df (patch)
tree6ca7877fc137767b9444e373742f2f700ef5cea0 /sal
parent86b0753ca3a02d247b13f0a6654ae315ce3a044b (diff)
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.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/module.cxx11
1 files changed, 4 insertions, 7 deletions
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 )