diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-15 16:13:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-15 20:57:51 +0100 |
commit | 47834895ee8284b3e42c1436c1bb59c36fab5051 (patch) | |
tree | 8549245f1b5e2f204499df495acaff102d64230d /sal/osl | |
parent | dc0d3a3757e3ad617b8b9f0908662bac3d405228 (diff) |
Use C++ OString/OUString classes here
...instead of underlying C structs
Change-Id: I25f1de9a902e5d8ed459c9b1bfc8a8c855eefb2d
Reviewed-on: https://gerrit.libreoffice.org/66394
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/security.cxx | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 3ea5c96b7bdd..c440de1bf3e1 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -32,7 +32,7 @@ #include "system.hxx" #include <osl/security.h> -#include <rtl/bootstrap.h> +#include <rtl/bootstrap.hxx> #include <sal/log.hxx> #include <osl/thread.h> @@ -267,28 +267,18 @@ static bool osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirectory, sal #ifdef ANDROID { sal_Bool bRet = sal_False; - rtl_uString *pName = 0, *pValue = 0; + OUString pValue; - rtl_uString_newFromAscii(&pName, "HOME"); - - if (rtl_bootstrap_get(pName, &pValue, NULL)) + if (rtl::Bootstrap::get("HOME", pValue)) { - rtl_String *pStrValue = 0; - if (pValue && pValue->length > 0) + auto const pStrValue = OUStringToOString(pValue, RTL_TEXTENCODING_UTF8); + if (!pStrValue.isEmpty()) { - rtl_uString2String(&pStrValue, pValue->buffer, - pValue->length, RTL_TEXTENCODING_UTF8, - OUSTRING_TO_OSTRING_CVTFLAGS); - if (pStrValue && pStrValue->length > 0) - { - sal_Int32 nCopy = (sal_Int32)std::min<sal_uInt32>(nMax-1, pStrValue->length) ; - strncpy (pszDirectory, pStrValue->buffer, nCopy); - pszDirectory[nCopy] = '\0'; - bRet = (std::size_t)pStrValue->length < nMax; - } - rtl_string_release(pStrValue); + sal_Int32 nCopy = (sal_Int32)std::min<sal_uInt32>(nMax-1, pStrValue.getLength()) ; + strncpy (pszDirectory, pStrValue.getStr(), nCopy); + pszDirectory[nCopy] = '\0'; + bRet = (std::size_t)pStrValue.getLength() < nMax; } - rtl_uString_release(pName); } if (bRet) return bRet; |