Use osl_getEnvironment instead of getenv
Avoids conversion to OUString; and is Unicode-safe on Windows. Change-Id: Idd82f589ae9bf692ce2e73f84cb664a68156915a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183507 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
parent
c16c8b78fa
commit
9147a19d24
@ -29,6 +29,7 @@
|
||||
#include <rtl/bootstrap.hxx>
|
||||
#include <rtl/string.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <osl/process.h>
|
||||
#include <osl/thread.h>
|
||||
#include <sal/log.hxx>
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
@ -176,13 +177,13 @@ const OUString & ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer
|
||||
m_bIsNSSinitialized = true;
|
||||
|
||||
// first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
|
||||
const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
|
||||
if (pEnv)
|
||||
if (OUString pEnv; osl_getEnvironment(u"MOZILLA_CERTIFICATE_FOLDER"_ustr.pData, &pEnv.pData) == osl_Process_E_None
|
||||
&& !pEnv.isEmpty())
|
||||
{
|
||||
SAL_INFO(
|
||||
"xmlsecurity.xmlsec",
|
||||
"Using Mozilla profile from MOZILLA_CERTIFICATE_FOLDER=" << pEnv);
|
||||
m_sNSSPath = OStringToOUString(pEnv, osl_getThreadTextEncoding());
|
||||
m_sNSSPath = pEnv;
|
||||
}
|
||||
|
||||
// second, try to get saved user-preference
|
||||
@ -284,9 +285,10 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS
|
||||
}
|
||||
aProfileList.push_back({u"MANUAL"_ustr, sUserSelect, mozilla::MozillaProductType_Default});
|
||||
|
||||
const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
|
||||
OUString pEnv;
|
||||
osl_getEnvironment(u"MOZILLA_CERTIFICATE_FOLDER"_ustr.pData, &pEnv.pData);
|
||||
aProfileList.push_back({u"MOZILLA_CERTIFICATE_FOLDER"_ustr,
|
||||
pEnv ? OStringToOUString(pEnv, osl_getThreadTextEncoding()) : OUString(),
|
||||
pEnv,
|
||||
mozilla::MozillaProductType_Default});
|
||||
|
||||
return comphelper::containerToSequence(aProfileList);
|
||||
|
Loading…
x
Reference in New Issue
Block a user