nlsupport.c (647f063d) nlsupport.c (ca3b41fa)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 818 unchanged lines hidden (view full) ---

827 return the current process locale
828 *****************************************************************************/
829
830int macosx_getLocale(char *locale, sal_uInt32 bufferLen);
831
832void _imp_getProcessLocale( rtl_Locale ** ppLocale )
833{
834 static char *locale = NULL;
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 818 unchanged lines hidden (view full) ---

827 return the current process locale
828 *****************************************************************************/
829
830int macosx_getLocale(char *locale, sal_uInt32 bufferLen);
831
832void _imp_getProcessLocale( rtl_Locale ** ppLocale )
833{
834 static char *locale = NULL;
835 char *npath, *opath;
836 int slen;
835
836 /* basic thread safeness */
837// pthread_mutex_lock( &aLocalMutex );
838
839 /* Only fetch the locale once and cache it */
840 if ( NULL == locale )
841 {
842

--- 22 unchanged lines hidden (view full) ---

865
866 /* return the locale */
867 *ppLocale = _parse_locale( locale );
868
869 setenv( "LC_ALL", locale, 1);
870 setenv("LC_CTYPE", locale, 1 );
871 setenv("LANG", locale, 1 );
872
837
838 /* basic thread safeness */
839// pthread_mutex_lock( &aLocalMutex );
840
841 /* Only fetch the locale once and cache it */
842 if ( NULL == locale )
843 {
844

--- 22 unchanged lines hidden (view full) ---

867
868 /* return the locale */
869 *ppLocale = _parse_locale( locale );
870
871 setenv( "LC_ALL", locale, 1);
872 setenv("LC_CTYPE", locale, 1 );
873 setenv("LANG", locale, 1 );
874
875 /*
876 * This is a hack. We know that we are setting some envvars here
877 * and due to https://bz.apache.org/ooo/show_bug.cgi?id=127965
878 * we need to update PATH on macOS. Doing it here ensures
879 * that it's done but it's not the right location to be doing
880 * this.
881 */
882 opath = getenv ( "PATH" );
883 slen = strlen( "/usr/local/bin" ) + 1;
884 if ( opath != NULL )
885 slen += strlen( ":" ) + strlen( opath );
886 npath = malloc( slen );
887 if ( opath != NULL ) {
888 strcat( npath, opath );
889 strcat( npath, ":" );
890 }
891 strcat( npath, "/usr/local/bin" ); /* We are adding at the end */
892 setenv("PATH", npath, 1 );
893 free(npath);
894
873#ifdef DEBUG
874 fprintf( stderr, "nlsupport.c: _imp_getProcessLocale() returning %s as current locale.\n", locale );
875#endif
876
877// pthread_mutex_unlock( &aLocalMutex );
878
879}
880#else

--- 65 unchanged lines hidden ---
895#ifdef DEBUG
896 fprintf( stderr, "nlsupport.c: _imp_getProcessLocale() returning %s as current locale.\n", locale );
897#endif
898
899// pthread_mutex_unlock( &aLocalMutex );
900
901}
902#else

--- 65 unchanged lines hidden ---