summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-22 13:43:20 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-22 13:43:20 +0100
commit6a3cfd330550ee558a546fb0808577b56ae04400 (patch)
treef7f74a795f68d3a009d0f8831c9d3f19c51bf556 /sal
parent19c4103fa5731a7fecc9657a83c5c917c0f8e162 (diff)
Don't actually change OS-level locale with (unused) osl_setSystemLocale
osl_setSystemLocale was introduced with af2938348bb539ccb27c92fe286b768d4143f662 "#88460# added osl_getProcessLocale and osl_setProcessLocale" but never actually used. So mark it as deprecated and, in the sal/osl/unx/ case, don't make it set the OS-level locale via imp_setProcessLocale (calling setlocale or setting the LC_ALL/LC_CTYPE/LANG env vars), same as in the sal/osl/w32/ case. Change-Id: I33348dba5de8ca80ca6fca210043286c0cfa9145
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/nlsupport.cxx57
-rw-r--r--sal/osl/unx/nlsupport.hxx1
-rw-r--r--sal/osl/unx/process_impl.cxx10
3 files changed, 2 insertions, 66 deletions
diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx
index b9cd621b8a6b..589439fffe94 100644
--- a/sal/osl/unx/nlsupport.cxx
+++ b/sal/osl/unx/nlsupport.cxx
@@ -28,7 +28,6 @@
#if defined(LINUX) || defined(__sun) || defined(NETBSD) || \
defined(FREEBSD) || defined(MACOSX) || defined(IOS) || defined(OPENBSD) || \
defined(DRAGONFLY)
-#include <pthread.h>
#if !defined(MACOSX) && !defined(IOS)
#include <locale.h>
#include <langinfo.h>
@@ -555,8 +554,6 @@ static const Pair nl_language_list[] = {
#endif /* ifdef __sun LINUX FREEBSD NETBSD OPENBSD */
-static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER;
-
/*****************************************************************************
return the text encoding corresponding to the given locale
*****************************************************************************/
@@ -640,29 +637,6 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale )
*ppLocale = parse_locale(locale);
}
-/*****************************************************************************
- set the current process locale
- *****************************************************************************/
-
-int imp_setProcessLocale( rtl_Locale * pLocale )
-{
- char locale_buf[64] = "";
- int ret = 0;
-
- /* convert rtl_Locale to locale string */
- compose_locale( pLocale, locale_buf, 64 );
-
- /* basic thread safeness */
- pthread_mutex_lock( &aLocalMutex );
-
- /* try to set LC_ALL locale */
- if( nullptr == setlocale( LC_ALL, locale_buf ) )
- ret = -1;
-
- pthread_mutex_unlock( &aLocalMutex );
- return ret;
-}
-
#else /* ifdef LINUX || __sun || MACOSX || NETBSD */
/*
@@ -891,37 +865,6 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale )
}
#endif
-/*****************************************************************************
- set the current process locale
- *****************************************************************************/
-
-static int
-imp_setenv (const char* name, const char* value)
-{
- return setenv (name, value, 1);
-}
-
-int imp_setProcessLocale( rtl_Locale * pLocale )
-{
- char locale_buf[64];
-
- /* convert rtl_Locale to locale string */
- if( nullptr != compose_locale( pLocale, locale_buf, 64 ) )
- {
- /* only change env vars that exist already */
- if( getenv( "LC_ALL" ) )
- imp_setenv( "LC_ALL", locale_buf );
-
- if( getenv( "LC_CTYPE" ) )
- imp_setenv("LC_CTYPE", locale_buf );
-
- if( getenv( "LANG" ) )
- imp_setenv( "LANG", locale_buf );
- }
-
- return 0;
-}
-
#endif /* ifdef LINUX || __sun || MACOSX || NETBSD || AIX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/nlsupport.hxx b/sal/osl/unx/nlsupport.hxx
index abcf42498fa7..53a132487c82 100644
--- a/sal/osl/unx/nlsupport.hxx
+++ b/sal/osl/unx/nlsupport.hxx
@@ -27,7 +27,6 @@
namespace rtl { class OUString; }
void imp_getProcessLocale( rtl_Locale ** );
-int imp_setProcessLocale( rtl_Locale * );
#if defined IOS || defined MACOSX
rtl::OUString macosx_getLocale();
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 2e27154668a0..9a3663298b76 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -460,19 +460,13 @@ oslProcessError SAL_CALL osl_getProcessLocale( rtl_Locale ** ppLocale )
*********************************************/
oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale )
{
- oslProcessError result = osl_Process_E_Unknown;
-
OSL_PRECOND(pLocale, "osl_setProcessLocale(): Invalid parameter.");
pthread_mutex_lock(&(g_process_locale.m_mutex));
- if (imp_setProcessLocale (pLocale) == 0)
- {
- g_process_locale.m_pLocale = pLocale;
- result = osl_Process_E_None;
- }
+ g_process_locale.m_pLocale = pLocale;
pthread_mutex_unlock (&(g_process_locale.m_mutex));
- return result;
+ return osl_Process_E_None;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */