summaryrefslogtreecommitdiff
path: root/vcl/unx/source/app/i18n_im.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/source/app/i18n_im.cxx')
-rw-r--r--vcl/unx/source/app/i18n_im.cxx30
1 files changed, 10 insertions, 20 deletions
diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx
index 9f1ffee3d1c4..c797da34e76c 100644
--- a/vcl/unx/source/app/i18n_im.cxx
+++ b/vcl/unx/source/app/i18n_im.cxx
@@ -36,10 +36,6 @@
# endif
#endif
#include <poll.h>
-#ifdef SOLARIS
-// for SetSystemEnvironment()
-#include <sal/alloca.h>
-#endif
#include <tools/prex.h>
#include <X11/Xlocale.h>
@@ -53,6 +49,7 @@
#include <i18n_status.hxx>
#include <osl/thread.h>
+#include <osl/process.h>
using namespace vcl;
#include "i18n_cb.hxx"
@@ -179,21 +176,13 @@ SetSystemLocale( const char* p_inlocale )
#ifdef SOLARIS
static void
-SetSystemEnvironment( const char* p_locale )
+SetSystemEnvironment( const rtl::OUString& rLocale )
{
- const char *lc_all = "LC_ALL=%s";
- const char *lang = "LANG=%s";
-
- char *p_buffer;
+ rtl::OUString LC_ALL_Var(RTL_CONSTASCII_USTRINGPARAM("LC_ALL"));
+ osl_setEnvironment(LC_ALL_Var.pData, rLocale.pData);
- if (p_locale != NULL)
- {
- p_buffer = (char*)alloca(10 + strlen(p_locale));
- sprintf(p_buffer, lc_all, p_locale);
- putenv(strdup(p_buffer));
- sprintf(p_buffer, lang, p_locale);
- putenv(strdup(p_buffer));
- }
+ rtl::OUString LANG_Var(RTL_CONSTASCII_USTRINGPARAM("LANG"));
+ osl_setEnvironment(LANG_Var.pData, rLocale.pData);
}
#endif
@@ -249,13 +238,13 @@ SalI18N_InputMethod::SetLocale( const char* pLocale )
osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1);
locale = SetSystemLocale( "en_US" );
#ifdef SOLARIS
- SetSystemEnvironment( "en_US" );
+ SetSystemEnvironment( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en_US")) );
#endif
if (! IsXWindowCompatibleLocale(locale))
{
locale = SetSystemLocale( "C" );
#ifdef SOLARIS
- SetSystemEnvironment( "C" );
+ SetSystemEnvironment( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("C")) );
#endif
if (! IsXWindowCompatibleLocale(locale))
mbUseable = False;
@@ -440,7 +429,8 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
if ((maMethod == (XIM)NULL) && (getenv("XMODIFIERS") != NULL))
{
- putenv (strdup("XMODIFIERS"));
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("XMODIFIERS"));
+ osl_clearEnvironment(envVar.pData);
XSetLocaleModifiers("");
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL);
mbMultiLingual = False;