summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-10-13 15:10:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2010-10-13 20:30:55 +0100
commit3317f535d107643e88209ae6925ebfd8da09893f (patch)
treecd045f25050a626a21f66c98b8fa87f11ee47e85 /shell
parent5d78ff3bca5091d044d848f64f9f07959497c3e1 (diff)
AIX tweaks
Diffstat (limited to 'shell')
-rw-r--r--shell/source/backends/localebe/localebackend.cxx142
-rw-r--r--shell/source/tools/lngconvex/lngconvex.cxx4
-rw-r--r--shell/source/unix/misc/senddoc.sh13
3 files changed, 83 insertions, 76 deletions
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx
index f2c929ff1273..808aab8d1440 100644
--- a/shell/source/backends/localebe/localebackend.cxx
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -35,54 +35,37 @@
#include <stdio.h>
-#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
+#ifdef WNT
-#include <rtl/ustrbuf.hxx>
-#include <locale.h>
-#include <string.h>
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
-/*
- * Note: setlocale is not at all thread safe, so is this code. It could
- * especially interfere with the stuff VCL is doing, so make sure this
- * is called from the main thread only.
- */
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
-static rtl::OUString ImplGetLocale(int category)
+rtl::OUString ImplGetLocale(LCID lcid)
{
- const char *locale = setlocale(category, "");
-
- // Return "en-US" for C locales
- if( (locale == NULL) || ( locale[0] == 'C' && locale[1] == '\0' ) )
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
-
-
- const char *cp;
- const char *uscore = NULL;
+ TCHAR buffer[8];
+ LPTSTR cp = buffer;
- // locale string have the format lang[_ctry][.encoding][@modifier]
- // we are only interested in the first two items, so we handle
- // '.' and '@' as string end.
- for (cp = locale; *cp; cp++)
+ cp += GetLocaleInfo( lcid, LOCALE_SISO639LANGNAME , buffer, 4 );
+ if( cp > buffer )
{
- if (*cp == '_')
- uscore = cp;
- if (*cp == '.' || *cp == '@')
- break;
- }
+ if( 0 < GetLocaleInfo( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
+ // #i50822# minus character must be written before cp
+ *(cp - 1) = '-';
- rtl::OUStringBuffer aLocaleBuffer;
- if( uscore != NULL )
- {
- aLocaleBuffer.appendAscii(locale, uscore++ - locale);
- aLocaleBuffer.appendAscii("-");
- aLocaleBuffer.appendAscii(uscore, cp - uscore);
- }
- else
- {
- aLocaleBuffer.appendAscii(locale, cp - locale);
+ return rtl::OUString::createFromAscii(buffer);
}
- return aLocaleBuffer.makeStringAndClear();
+ return rtl::OUString();
}
#elif defined(MACOSX)
@@ -184,44 +167,57 @@ namespace /* private */
} // namespace /* private */
-#endif
+#else
-// -------------------------------------------------------------------------------
+#include <rtl/ustrbuf.hxx>
+#include <locale.h>
+#include <string.h>
-#ifdef WNT
+/*
+ * Note: setlocale is not at all thread safe, so is this code. It could
+ * especially interfere with the stuff VCL is doing, so make sure this
+ * is called from the main thread only.
+ */
-#ifdef WINVER
-#undef WINVER
-#endif
-#define WINVER 0x0501
+static rtl::OUString ImplGetLocale(int category)
+{
+ const char *locale = setlocale(category, "");
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
+ // Return "en-US" for C locales
+ if( (locale == NULL) || ( locale[0] == 'C' && locale[1] == '\0' ) )
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
-rtl::OUString ImplGetLocale(LCID lcid)
-{
- TCHAR buffer[8];
- LPTSTR cp = buffer;
- cp += GetLocaleInfo( lcid, LOCALE_SISO639LANGNAME , buffer, 4 );
- if( cp > buffer )
+ const char *cp;
+ const char *uscore = NULL;
+
+ // locale string have the format lang[_ctry][.encoding][@modifier]
+ // we are only interested in the first two items, so we handle
+ // '.' and '@' as string end.
+ for (cp = locale; *cp; cp++)
{
- if( 0 < GetLocaleInfo( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
- // #i50822# minus character must be written before cp
- *(cp - 1) = '-';
+ if (*cp == '_')
+ uscore = cp;
+ if (*cp == '.' || *cp == '@')
+ break;
+ }
- return rtl::OUString::createFromAscii(buffer);
+ rtl::OUStringBuffer aLocaleBuffer;
+ if( uscore != NULL )
+ {
+ aLocaleBuffer.appendAscii(locale, uscore++ - locale);
+ aLocaleBuffer.appendAscii("-");
+ aLocaleBuffer.appendAscii(uscore, cp - uscore);
+ }
+ else
+ {
+ aLocaleBuffer.appendAscii(locale, cp - locale);
}
- return rtl::OUString();
+ return aLocaleBuffer.makeStringAndClear();
}
-#endif // WNT
+#endif
// -------------------------------------------------------------------------------
@@ -246,12 +242,12 @@ LocaleBackend* LocaleBackend::createInstance()
rtl::OUString LocaleBackend::getLocale(void)
{
-#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
- return ImplGetLocale(LC_CTYPE);
+#if defined WNT
+ return ImplGetLocale( GetUserDefaultLCID() );
#elif defined (MACOSX)
return ImplGetLocale("AppleLocale");
-#elif defined WNT
- return ImplGetLocale( GetUserDefaultLCID() );
+#else
+ return ImplGetLocale(LC_CTYPE);
#endif
}
@@ -259,12 +255,12 @@ rtl::OUString LocaleBackend::getLocale(void)
rtl::OUString LocaleBackend::getUILocale(void)
{
-#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
- return ImplGetLocale(LC_MESSAGES);
+#if defined WNT
+ return ImplGetLocale( MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT) );
#elif defined(MACOSX)
return ImplGetLocale("AppleLanguages");
-#elif defined WNT
- return ImplGetLocale( MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT) );
+#else
+ return ImplGetLocale(LC_MESSAGES);
#endif
}
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx
index ded55a6a4c45..ada243f1edd4 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -26,6 +26,10 @@
*
************************************************************************/
+#ifdef AIX
+# undef _THREAD_SAFE
+#endif
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_shell.hxx"
diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh
index 3d2690379134..9d63ae3df63b 100644
--- a/shell/source/unix/misc/senddoc.sh
+++ b/shell/source/unix/misc/senddoc.sh
@@ -1,15 +1,22 @@
#!/bin/sh
URI_ENCODE="`dirname $0`/uri-encode"
FOPTS=""
+sd_platform=`uname -s`
# linux file utility needs -L option to resolve symlinks
-if [ "`uname -s`" = "Linux" ]
-then
+if [ "$sd_platform" = "Linux" ] ; then
FOPTS="-L"
fi
# do not confuse the system mail clients with OOo and Java libraries
-unset LD_LIBRARY_PATH
+case $sd_platform in
+ AIX)
+ unset LIBPATH
+ ;;
+ *)
+ unset LD_LIBRARY_PATH
+ ;;
+esac
# tries to locate the executable specified
# as first parameter in the user's path.