diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-09-25 08:59:28 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-09-27 06:24:24 +0200 |
commit | d32506e9f4ea604532bf5f4ba8a302b652aeaaa1 (patch) | |
tree | 2bd33f7917bd76d18f998eea531e4bdaa7d7eb54 /include/cppuhelper | |
parent | 892c719fffa06de4c7aeab497326cad7bae9e5c6 (diff) |
cppuhelper_detail_findSofficePath: use Unicode on Windows
On Windows, UTF-8 is never current locale encoding; so using 8-bit
strings will always fail for paths containing characters outside
of current codepage.
Also fix leaks caused by failing to release its result: previously
it could return either result of getenv (that shouldn't get freed),
or an allocated string, but never got freed; now the result is
always allocated and properly freed.
Change-Id: I8b255dea20040eec0572de2b34280749fe8f071c
Reviewed-on: https://gerrit.libreoffice.org/42743
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/cppuhelper')
-rw-r--r-- | include/cppuhelper/findsofficepath.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/cppuhelper/findsofficepath.h b/include/cppuhelper/findsofficepath.h index 717f316a422b..d06cc32cbf1c 100644 --- a/include/cppuhelper/findsofficepath.h +++ b/include/cppuhelper/findsofficepath.h @@ -27,8 +27,14 @@ extern "C" { #endif /* Internal function to find an soffice installation. - Not to be called by client code */ -char const* cppuhelper_detail_findSofficePath(void); + Not to be called by client code. + Returned pointer must be released with free() */ +#if defined(_WIN32) +wchar_t* +#else +char* +#endif +cppuhelper_detail_findSofficePath(void); #if defined __cplusplus } |