[Libreoffice-commits] core.git: 2 commits - desktop/Pagein_common.mk desktop/unx

Stephan Bergmann sbergman at redhat.com
Fri Nov 28 08:17:40 PST 2014


 desktop/Pagein_common.mk    |    8 +-
 desktop/unx/source/pagein.c |  127 ++++++++------------------------------------
 desktop/unx/source/pagein.h |    2 
 desktop/unx/source/start.c  |   37 +-----------
 4 files changed, 34 insertions(+), 140 deletions(-)

New commits:
commit c4224377cae5490122011157c4586144f9b188d5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Nov 28 17:16:40 2014 +0100

    Clean up
    
    Change-Id: Idc8aa334dd784b7d55f092b0a0e353bb2f9b38d1

diff --git a/desktop/unx/source/pagein.c b/desktop/unx/source/pagein.c
index 6ffa07b..67ca367 100644
--- a/desktop/unx/source/pagein.c
+++ b/desktop/unx/source/pagein.c
@@ -26,128 +26,49 @@
 #include <string.h>
 
 /* do_pagein */
-static int do_pagein (const char * filename, size_t * size)
+static void do_pagein (const char * filename)
 {
     int result;
     file_image image = FILE_IMAGE_INITIALIZER;
 
-    if ((result = file_image_open (&image, filename)) != 0)
-        return (result);
+    if (file_image_open (&image, filename) != 0)
+        return;
 
     if ((result = file_image_pagein (&image)) != 0)
     {
         fprintf (stderr, "file_image_pagein %s: %s\n", filename, strerror(result));
-        goto cleanup_and_leave;
     }
 
-    if (size)
-    {
-        *size = image.m_size;
-    }
-
-cleanup_and_leave:
     file_image_close (&image);
-    return (result);
 }
 
-/* main */
-int pagein_execute (int argc, char **argv)
+void pagein_execute(char const * path, char const * file)
 {
-    int    i, v = 0;
-    size_t nfiles = 0, nbytes = 0;
-
-    if (argc < 2)
+    char fullpath[4096];
+    char *p = NULL;
+    FILE   * fp = 0;
+    memset(fullpath, 0, sizeof(fullpath));
+    strncpy (fullpath, path, 3000);
+    if (!(p = strrchr (fullpath, '/')))
+        p = fullpath;
+    else
+        p++;
+    strncpy(p, file, 1024);
+    p[strlen(p)] = '\0';
+    if ((fp = fopen (fullpath, "r")) == 0)
     {
-        fprintf (
-            stderr,
-            "%s: Usage: pagein [-v[v]] [-L<path>] [@]<filename> ...\n",
-            argv[0]);
-        return (1);
-    }
 
-    for (i = 1; i < argc; i++)
+        fprintf (stderr, "fopen %s: %s\n", fullpath, strerror(errno));
+        return;
+    }
+    while (fgets (p, 1024, fp) != 0)
     {
-        FILE   * fp = 0;
-        size_t   k  = 0;
-
-        if (argv[i][0] == '-')
-        {
-            /* option */
-            int j = 1;
-            switch (argv[i][j])
-            {
-                case 'v':
-                    /* verbosity level */
-                    for (v += 1, j += 1; argv[i][j]; j++)
-                        v += (argv[i][j] == 'v');
-                    break;
-                case 'L':
-                    /* search path */
-                    if (chdir (&(argv[i][2])) == -1)
-                        fprintf (stderr, "chdir %s: %s\n", &(argv[i][2]), strerror(errno));
-                    break;
-                default:
-                    /* ignored */
-                    break;
-            }
+        p[strlen(p) - 1] = '\0';
 
-            /* next argv */
-            continue;
-        }
-
-        if ((argv[i][0] == '@') && ((fp = fopen (argv[i], "r")) == 0))
-        {
-            char fullpath[4096];
-            char *path = NULL;
-            memset(fullpath, 0, sizeof(fullpath));
-            strncpy (fullpath, argv[i] + 1, 3000);
-            if (!(path = strrchr (fullpath, '/')))
-                path = fullpath;
-            else
-                path++;
-
-            if ((fp = fopen (&(argv[i][1]), "r")) == 0)
-            {
-                fprintf (stderr, "fopen %s: %s\n", &(argv[i][1]), strerror(errno));
-                continue;
-            }
-            while (fgets (path, 1024, fp) != 0)
-            {
-                path[strlen(path) - 1] = '\0', k = 0;
-
-                /* paths relative to the location of the pagein file */
-                if (do_pagein (fullpath, &k) == 0)
-                {
-                    /* accumulate total size */
-                    nbytes += k;
-                }
-
-                if (v >= 2)
-                    fprintf (stderr, "pagein(\"%s\") = %d bytes\n", path, (int) k);
-                nfiles += 1;
-            }
-            fclose (fp);
-        }
-        else
-        {
-            if (fp != 0)
-                fclose (fp);
-
-            if (do_pagein (argv[i], &k) == 0)
-            {
-                /* accumulate total size */
-                nbytes += k;
-            }
-
-            if (v >= 2)
-                fprintf (stderr, "pagein(\"%s\") = %d bytes\n", argv[i], (int) k);
-            nfiles += 1;
-        }
+        /* paths relative to the location of the pagein file */
+        do_pagein (fullpath);
     }
-
-    if (v >= 1)
-        fprintf (stderr, "Total: %d files (%d bytes)\n", (int) nfiles, (int) nbytes);
-    return (0);
+    fclose (fp);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/unx/source/pagein.h b/desktop/unx/source/pagein.h
index 929bab8..c31922b 100644
--- a/desktop/unx/source/pagein.h
+++ b/desktop/unx/source/pagein.h
@@ -22,7 +22,7 @@
 
 #include <sal/config.h>
 
-int pagein_execute(int argc, char **argv);
+void pagein_execute(char const * path, char const * file);
 
 #endif
 
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index 9e5f7f1..3732737 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -599,42 +599,15 @@ system_checks( void )
 #endif
 }
 
-static char *build_pagein_path (Args *args, const char *pagein_name)
-{
-    char *path;
-    rtl_String *app_path;
-
-    app_path = ustr_to_str (args->pAppPath);
-    path = malloc (
-        RTL_CONSTASCII_LENGTH("@") + app_path->length + strlen (pagein_name) +
-        1);
-    strcpy (path, "@");
-    strcpy (path + 1, rtl_string_getStr (app_path));
-    strcat (path, pagein_name);
-
-    rtl_string_release( app_path );
-
-    return path;
-}
-
 void
 exec_pagein (Args *args)
 {
-    char *argv[3];
-
-    /* don't use -L - since that does a chdir that breaks relative paths */
-    argv[0] = "dummy-pagein";
-    argv[1] = build_pagein_path (args, "pagein-common");
+    rtl_String * path = ustr_to_str(args->pAppPath);
+    pagein_execute(rtl_string_getStr(path), "pagein-common");
     if (args->pPageinType) {
-        argv[2] = build_pagein_path (args, args->pPageinType);
-    } else
-        argv[2] = NULL;
-
-    pagein_execute (args->pPageinType ? 3 : 2, argv);
-
-    if (argv[2])
-        free (argv[2]);
-    free (argv[1]);
+        pagein_execute(rtl_string_getStr(path), args->pPageinType);
+    }
+    rtl_string_release(path);
 }
 
 #if HAVE_FEATURE_JAVA
commit ac28e1c7f2d7a06b92af098f9e1c494bcb74d6d5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Nov 28 17:15:22 2014 +0100

    Fix pagein-common list
    
    Change-Id: I1bb067e138585099e96cbe3dd2ef4ed8c4870718

diff --git a/desktop/Pagein_common.mk b/desktop/Pagein_common.mk
index cabd4f5..6314c4d 100644
--- a/desktop/Pagein_common.mk
+++ b/desktop/Pagein_common.mk
@@ -15,8 +15,8 @@ $(eval $(call gb_Pagein_add_objects,common,\
     $(if $(URELIBS),urelibs) \
     i18nlangtag \
     $(if $(SYSTEM_ICU),,\
-        icui18n \
-        icuuc \
+        libicui18n$(gb_Library_DLLEXT).$(ICU_MAJOR) \
+        libicuuc$(gb_Library_DLLEXT).$(ICU_MAJOR) \
     ) \
     lng \
     xo \
@@ -52,8 +52,8 @@ $(eval $(call gb_Pagein_add_objects,common,\
     vcl \
     tk \
     ../ure-link/share/misc/types.rdb \
-    services.rdb \
-    oovbaapi.rdb \
+    services/services.rdb \
+    types/oovbaapi.rdb \
     deployment \
     deploymentmisc \
     xstor \


More information about the Libreoffice-commits mailing list