Use osl_getEnvironment instead of getenv
Avoids conversion to OUString; and is Unicode-safe on Windows. Change-Id: If4f76f867f988d43ec4dae0a8e09f1390fee42e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183503 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <osl/module.hxx>
|
||||
#include <osl/process.h>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <rtl/uri.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
@@ -1826,10 +1827,10 @@ void cppuhelper::ServiceManager::preloadImplementations() {
|
||||
OUStringBuffer aMissingMsg;
|
||||
|
||||
/// Allow external callers & testers to disable certain components
|
||||
const char *pDisable = getenv("UNODISABLELIBRARY");
|
||||
if (pDisable)
|
||||
if (OUString aDisable;
|
||||
osl_getEnvironment(u"UNODISABLELIBRARY"_ustr.pData, &aDisable.pData) == osl_Process_E_None
|
||||
&& !aDisable.isEmpty())
|
||||
{
|
||||
OUString aDisable(pDisable, strlen(pDisable), RTL_TEXTENCODING_UTF8);
|
||||
for (sal_Int32 i = 0; i >= 0; )
|
||||
{
|
||||
OUString tok( aDisable.getToken(0, ' ', i) );
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <unotools/bootstrap.hxx>
|
||||
#include <unotools/configmgr.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <osl/process.h>
|
||||
#include <osl/security.hxx>
|
||||
#include <osl/thread.hxx>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
@@ -299,13 +300,13 @@ OUString SubstitutePathVariables::GetHomeVariableValue()
|
||||
OUString SubstitutePathVariables::GetPathVariableValue()
|
||||
{
|
||||
OUString aRetStr;
|
||||
const char* pEnv = getenv( "PATH" );
|
||||
OUString aPathList;
|
||||
|
||||
if ( pEnv )
|
||||
if (osl_getEnvironment(u"PATH"_ustr.pData, &aPathList.pData) == osl_Process_E_None
|
||||
&& !aPathList.isEmpty())
|
||||
{
|
||||
const int PATH_EXTEND_FACTOR = 200;
|
||||
OUString aTmp;
|
||||
OUString aPathList( pEnv, strlen( pEnv ), osl_getThreadTextEncoding() );
|
||||
OUStringBuffer aPathStrBuffer( aPathList.getLength() * PATH_EXTEND_FACTOR / 100 );
|
||||
|
||||
bool bAppendSep = false;
|
||||
|
||||
Reference in New Issue
Block a user