diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 17:13:39 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-23 17:13:39 +0100 |
commit | 498887fd01f7793842430464508f39352b76d452 (patch) | |
tree | bba7cdbd7bf36d78a9100ae219b042836805e32a /desktop | |
parent | d4e88719d67c5cadb55c85cd372d412fd969c613 (diff) | |
parent | a16869e2ff8a85e877f4060995937835f03a2beb (diff) |
Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/libs-core
Diffstat (limited to 'desktop')
-rwxr-xr-x | desktop/scripts/soffice.sh | 2 | ||||
-rwxr-xr-x | desktop/source/pagein/makefile.mk | 9 | ||||
-rwxr-xr-x | desktop/source/pagein/pagein.c | 6 | ||||
-rw-r--r-- | desktop/unx/source/args.c | 12 | ||||
-rwxr-xr-x | desktop/unx/source/makefile.mk | 2 | ||||
-rwxr-xr-x | desktop/unx/source/splashx.c | 12 | ||||
-rwxr-xr-x | desktop/unx/source/start.c | 79 | ||||
-rwxr-xr-x | desktop/unx/splash/makefile.mk | 7 |
8 files changed, 94 insertions, 35 deletions
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index 76af9bc19a..21023a9f3d 100755 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -73,7 +73,7 @@ if [ -e $sd_prog/ooenv ] ; then fi if [ "$VALGRIND" != "" ]; then - VALGRINDCHECK="valgrind --tool=$VALGRIND --error-exitcode=101" + VALGRINDCHECK="valgrind --tool=$VALGRIND --trace-children=yes --error-exitcode=101" export VALGRINDCHECK G_SLICE=always-malloc export G_SLICE diff --git a/desktop/source/pagein/makefile.mk b/desktop/source/pagein/makefile.mk index 205e03c958..2b02a4d5a4 100755 --- a/desktop/source/pagein/makefile.mk +++ b/desktop/source/pagein/makefile.mk @@ -41,6 +41,13 @@ LIBSALCPPRT=$(0) .INCLUDE .IGNORE : icuversion.mk +.IF "$(OS)"=="MACOSX" + +dummy: + @echo "Pagein disabled for mac" + +.ELSE + # --- Files -------------------------------------------------------- OBJFILES= \ @@ -185,3 +192,5 @@ $(MISC)$/$(TARGET)-common : makefile.mk # stoc bits @-echo $(DLLPRE)sfx$(DFTDLLPOST) >> $@ @-echo $(DLLPRE)sofficeapp$(DLLPOST) >> $@ + +.ENDIF
\ No newline at end of file diff --git a/desktop/source/pagein/pagein.c b/desktop/source/pagein/pagein.c index 9e3b610a59..097b093fe3 100755 --- a/desktop/source/pagein/pagein.c +++ b/desktop/source/pagein/pagein.c @@ -44,7 +44,7 @@ static int do_pagein (const char * filename, size_t * size) if ((result = file_image_pagein (&image)) != 0) { - fprintf (stderr, "file_image_pagein: %s\n", strerror(result)); + fprintf (stderr, "file_image_pagein %s: %s\n", filename, strerror(result)); goto cleanup_and_leave; } @@ -94,7 +94,7 @@ int pagein_execute (int argc, char **argv) case 'L': /* search path */ if (chdir (&(argv[i][2])) == -1) - fprintf (stderr, "chdir: %s\n", strerror(errno)); + fprintf (stderr, "chdir %s: %s\n", &(argv[i][2]), strerror(errno)); break; default: /* ignored */ @@ -110,7 +110,7 @@ int pagein_execute (int argc, char **argv) char path[1024]; if ((fp = fopen (&(argv[i][1]), "r")) == 0) { - fprintf (stderr, "fopen: %s\n", strerror(errno)); + fprintf (stderr, "fopen %s: %s\n", &(argv[i][1]), strerror(errno)); continue; } while (fgets (path, sizeof(path), fp) != 0) diff --git a/desktop/unx/source/args.c b/desktop/unx/source/args.c index a438f76a7c..0f47f791d5 100644 --- a/desktop/unx/source/args.c +++ b/desktop/unx/source/args.c @@ -29,7 +29,7 @@ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable * instead of those above. */ -#include <malloc.h> +#include <stdlib.h> #include <string.h> #include <osl/process.h> @@ -77,7 +77,6 @@ Args *args_parse (void) { Args *args; sal_uInt32 nArgs, i, j; - sal_Bool skipNextArg; nArgs = osl_getCommandArgCount(); i = sizeof (Args) + sizeof (rtl_uString *) * nArgs; @@ -85,8 +84,10 @@ Args *args_parse (void) memset (args, 0, i); args->nArgsTotal = nArgs; + j = 0; + /* sort the -env: args to the front */ - for ( j = i = 0; i < nArgs; ++i ) + for ( i = 0; i < nArgs; ++i ) { rtl_uString *pTmp = NULL; osl_getCommandArg( i, &pTmp ); @@ -98,7 +99,7 @@ Args *args_parse (void) args->nArgsEnv = j; /* Then the other args */ - for ( j = i = 0; i < nArgs; ++i ) + for ( i = 0; i < nArgs; ++i ) { rtl_uString *pTmp = NULL; @@ -109,7 +110,6 @@ Args *args_parse (void) rtl_uString_release (pTmp); } - skipNextArg = sal_False; for ( i = args->nArgsEnv; i < args->nArgsTotal; i++ ) { sal_uInt32 j; @@ -134,8 +134,6 @@ Args *args_parse (void) args->bInhibitJavaLdx |= pArgDescr[j].bInhibitJavaLdx; if (pArgDescr[j].pPageinType) args->pPageinType = pArgDescr[j].pPageinType; - - skipNextArg = pArgDescr[j].bTwoArgs; } } } diff --git a/desktop/unx/source/makefile.mk b/desktop/unx/source/makefile.mk index f7400867ca..5c5c8f3e9e 100755 --- a/desktop/unx/source/makefile.mk +++ b/desktop/unx/source/makefile.mk @@ -44,9 +44,11 @@ OBJFILES= \ $(OBJ)$/start.obj \ $(OBJ)$/args.obj +.IF "$(OS)"!="MACOSX" PAGEIN_OBJS= \ $(OBJ)$/pagein.obj \ $(OBJ)$/file_image_unx.obj +.ENDIF APP1TARGET = $(TARGET) APP1RPATH = BRAND diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c index 9e0d237dec..d7d8b1df46 100755 --- a/desktop/unx/source/splashx.c +++ b/desktop/unx/source/splashx.c @@ -115,11 +115,12 @@ static unsigned char **bitmap_rows = NULL; # define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 #endif +png_structp png_ptr = NULL; +png_infop info_ptr = NULL; + int splash_load_bmp( const char *filename ) { FILE *file; - png_structp png_ptr; - png_infop info_ptr; if ( !(file = fopen( filename, "r" ) ) ) return 0; @@ -618,8 +619,11 @@ void splash_draw_progress( int progress ) void splash_close_window() { XCloseDisplay( display ); - - // leak it is faster +#ifdef USE_LIBPNG + png_destroy_read_struct( &png_ptr, &info_ptr, NULL ); +#else + free( bitmap_rows ); +#endif bitmap_rows = NULL; } diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index 3b5f480802..988c1c3ab4 100755 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -38,6 +38,7 @@ #include <fcntl.h> #include <stdio.h> #include <libgen.h> +#include <string.h> #include <osl/nlsupport.h> #include <osl/process.h> @@ -138,8 +139,8 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus ) rtl_uString_newConcat( &pApp, pApp, args->pAppPath ); rtl_uString_newFromAscii( &pTmp, "/soffice.bin" ); rtl_uString_newConcat( &pApp, pApp, pTmp ); - - rtl_uString_new( &pTmp ); + rtl_uString_release( pTmp ); + pTmp = NULL; /* copy args */ nArgs = bAllArgs ? args->nArgsTotal : args->nArgsEnv; @@ -151,8 +152,8 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus ) { /* add the pipe arg */ snprintf (buffer, 63, "--splash-pipe=%d", status_pipe[1]); - ppArgs[nArgs] = NULL; - rtl_uString_newFromAscii( &ppArgs[nArgs], buffer ); + rtl_uString_newFromAscii( &pTmp, buffer ); + ppArgs[nArgs] = pTmp; ++nArgs; } @@ -164,13 +165,19 @@ child_spawn ( Args *args, sal_Bool bAllArgs, sal_Bool bWithStatus ) NULL, 0, &info->child ); + if (pTmp) + rtl_uString_release( pTmp ); + free (ppArgs); + if ( nError != osl_Process_E_None ) { fprintf( stderr, "ERROR %d forking process", nError ); ustr_debug( "", pApp ); + rtl_uString_release( pApp ); _exit (1); } + rtl_uString_release( pApp ); close( status_pipe[1] ); return info; @@ -326,6 +333,7 @@ get_pipe_path( rtl_uString *pAppPath ) ustr_debug( "result", pResult ); /* cleanup */ + rtl_uString_release( pMd5hash ); rtl_uString_release( pPath ); rtl_uString_release( pTmp ); rtl_uString_release( pBasePath ); @@ -537,10 +545,14 @@ load_splash_image( rtl_uString *pUAppPath ) strcat (pLocale, "_"); strcat (pLocale, pCountry->buffer); + rtl_string_release( pCountry ); + rtl_string_release( pLang ); + pAppPath = ustr_to_str (pUAppPath); pBuffer = malloc (pAppPath->length + nLocSize + 256); strcpy (pBuffer, pAppPath->buffer); pSuffix = pBuffer + pAppPath->length; + rtl_string_release( pAppPath ); strcpy (pSuffix, "/edition/intro"); strcat (pSuffix, pLocale); @@ -719,41 +731,61 @@ extern int pagein_execute (int argc, char **argv); void exec_pagein (Args *args) { +// no pagein for the while on OSX +#ifdef MACOSX + (void)args; +#else char *argv[5]; + rtl_String *app_path; + + app_path = ustr_to_str (args->pAppPath); argv[0] = "dummy-pagein"; - argv[1] = "-L../basis-link/program"; + argv[1] = malloc (app_path->length + sizeof ("-L/../basis-link/program") + 2); + strcpy (argv[1], "-L"); + strcat (argv[1], app_path->buffer); + strcat (argv[1], "/../basis-link/program"); argv[2] = "@pagein-common"; argv[3] = (char *)args->pPageinType; argv[4] = NULL; + rtl_string_release( app_path ); + pagein_execute (args->pPageinType ? 4 : 3, argv); + + free (argv[1]); +#endif } static void extend_library_path (const char *new_element) { + rtl_uString *pEnvName=NULL, *pOrigEnvVar=NULL, *pNewEnvVar=NULL; const char *pathname; #ifdef AIX pathname = "LIBPATH"; #else pathname = "LD_LIBRARY_PATH"; #endif - char *buffer; - char *oldpath; - - oldpath = getenv (pathname); - buffer = malloc (strlen (new_element) + strlen (pathname) + - (oldpath ? strlen (oldpath) : 0)+ 4); - strcpy (buffer, pathname); - strcpy (buffer, "="); - strcpy (buffer, new_element); - if (oldpath) { - strcat (buffer, ":"); - strcat (buffer, oldpath); + + rtl_uString_newFromAscii( &pEnvName, pathname ); + + osl_getEnvironment( pEnvName, &pOrigEnvVar ); + + rtl_uString_newFromAscii( &pNewEnvVar, new_element ); + if (pOrigEnvVar->length) + { + rtl_uString *pDelim = NULL; + rtl_uString_newFromAscii( &pDelim, ":" ); + rtl_uString_newConcat( &pNewEnvVar, pNewEnvVar, pDelim ); + rtl_uString_newConcat( &pNewEnvVar, pNewEnvVar, pOrigEnvVar ); + rtl_uString_release( pDelim ); } - /* deliberately leak buffer - many OS' don't dup at this point */ - putenv (buffer); + osl_setEnvironment( pEnvName, pNewEnvVar ); + + rtl_uString_release( pNewEnvVar ); + rtl_uString_release( pOrigEnvVar ); + rtl_uString_release( pEnvName ); } static void @@ -793,6 +825,7 @@ exec_javaldx (Args *args) pTmp = NULL; rtl_uString_newFromAscii( &pTmp, "/../ure/bin/javaldx" ); rtl_uString_newConcat( &pApp, pApp, pTmp ); + rtl_uString_release( pTmp ); /* unset to avoid bogus console output */ rtl_uString_newFromAscii( &pEnvironment[0], "G_SLICE" ); @@ -807,6 +840,11 @@ exec_javaldx (Args *args) &fileOut, NULL); + rtl_uString_release( pEnvironment[0] ); + rtl_uString_release( ppArgs[nArgs-1] ); + rtl_uString_release( pApp ); + free( ppArgs ); + if( err != osl_Process_E_None) { fprintf (stderr, "Warning: failed to launch javaldx - java may not fuction correctly\n"); @@ -868,12 +906,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) osl_getProcessWorkingDir( &pCwdPath ); bSentArgs = send_args( fd, pCwdPath ); + + close( fd ); } #if OSL_DEBUG_LEVEL > 0 else ustr_debug( "Failed to connect to pipe", pPipePath ); #endif - close( fd ); if ( !bSentArgs ) { diff --git a/desktop/unx/splash/makefile.mk b/desktop/unx/splash/makefile.mk index 23a9d98ae5..e338cfe36b 100755 --- a/desktop/unx/splash/makefile.mk +++ b/desktop/unx/splash/makefile.mk @@ -36,6 +36,11 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(OS)"=="MACOSX" +dummy: + @echo "Unix quickstarter disabled for mac" +.ELSE + # --- Files -------------------------------------------------------- SLOFILES = $(SLO)$/unxsplash.obj @@ -67,3 +72,5 @@ $(MISC)/splash.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ $(XSLTPROC) --nonet --stringparam uri \ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ $(SOLARENV)/bin/createcomponent.xslt splash.component + +.ENDIF
\ No newline at end of file |