diff options
-rw-r--r-- | include/osl/process.h | 8 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.cxx | 57 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.hxx | 1 | ||||
-rw-r--r-- | sal/osl/unx/process_impl.cxx | 10 |
4 files changed, 5 insertions, 71 deletions
diff --git a/include/osl/process.h b/include/osl/process.h index ee7b401703fa..49fe59264059 100644 --- a/include/osl/process.h +++ b/include/osl/process.h @@ -396,11 +396,7 @@ SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessWorkingDir( /** Get the locale the process is currently running in. - The unix implementation caches the value it returns, so if you have to change the locale - your are running in, you will have to use osl_setProcessLocale - @param ppLocale [out] a pointer that receives the currently selected locale structure - @see osl_setProcessLocale */ SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale( @@ -409,7 +405,9 @@ SAL_DLLPUBLIC oslProcessError SAL_CALL osl_getProcessLocale( /** Change the locale of the process. @param pLocale [in] a pointer to the locale to be set - @see osl_getProcessLocale + + @deprecated LibreOffice itself does not use this, and client code should + not have good use for it either. It may eventually be removed. */ SAL_DLLPUBLIC oslProcessError SAL_CALL osl_setProcessLocale( 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: */ |