I'm trying to apply the attached patch, but I can't, and don't understand why. The swslots.src part has been done "by hand" (using diff) in this file. Please help. -- Jérôme Warnier <jwarnier@beeznest.net>
--- ooo_cvs/unzip/source/makefile.mk +++ ooo_cvs/unzip/source/makefile.mk @@ -77,52 +77,10 @@ # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/envargs.obj \ - $(SLO)$/explode.obj \ - $(SLO)$/extract.obj \ - $(SLO)$/file_io.obj \ - $(SLO)$/inflate.obj \ - $(SLO)$/mapname.obj \ - $(SLO)$/match.obj \ - $(SLO)$/misc.obj \ - $(SLO)$/unzip.obj \ - $(SLO)$/svunzip.obj +CFLAGS+=-g `pkg-config --cflags glib-2.0` -# $(SLO)$/unreduce.obj \ -# $(SLO)$/unshrink.obj \ - - -.IF "$(GUI)"=="MAC" -SLOFILES += $(SLO)$/macfile.obj \ - $(SLO)$/macstat.obj -.ENDIF - -.IF "$(GUI)"=="OS2" -SLOFILES += $(SLO)$/os2unzip.obj -.ENDIF - -OBJFILES= $(OBJ)$/envargs.obj \ - $(OBJ)$/explode.obj \ - $(OBJ)$/extract.obj \ - $(OBJ)$/file_io.obj \ - $(OBJ)$/inflate.obj \ - $(OBJ)$/mapname.obj \ - $(OBJ)$/match.obj \ - $(OBJ)$/misc.obj \ - $(OBJ)$/unzip.obj \ - $(OBJ)$/svunzip.obj - -# $(OBJ)$/unreduce.obj \ -# $(OBJ)$/unshrink.obj \ - - -.IF "$(GUI)"=="MAC" -OBJFILES += $(OBJ)$/macfile.obj \ - $(OBJ)$/macstat.obj -.ENDIF -.IF "$(GUI)"=="OS2" -OBJFILES += $(OBJ)$/os2unzip.obj -.ENDIF +SLOFILES= $(SLO)$/svunzip.obj +OBJFILES= $(OBJ)$/svunzip.obj # --- Targets ------------------------------------------------------ --- ooo_cvs/unzip/util/makefile.mk +++ ooo_cvs/unzip/util/makefile.mk @@ -88,6 +88,7 @@ SHL1TARGET=zip$(UPD)$(DLLPOSTFIX) SHL1IMPLIB= i$(TARGET) SHL1LIBS=$(LIB2TARGET) +SHL1STDLIBS+=`pkg-config --libs glib-2.0` SHL1DEF= $(MISC)$/$(SHL1TARGET).def .ENDIF --- ooo_cvs/unzip/source/svunzip.c +++ ooo_cvs/unzip/source/svunzip.c @@ -1,3 +1,135 @@ +/* + * This module sucks rocks, but not as much + * as defining global symbols such as 'statbuf' + * 'inflate' etc. + */ +#include <glib.h> +#include <stdio.h> +#include <svunzip.h> + +static char * +fiddle_with_path (const char *orig_path) +{ + char *path; + + if (!g_file_test (orig_path, G_FILE_TEST_EXISTS) || + g_file_test (orig_path, G_FILE_TEST_IS_DIR)) { + path = g_strconcat (orig_path, ".zip", NULL); + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { + g_free (path); + path = NULL; + } + } else + path = g_strdup (orig_path); + + return path; +} + +unsigned long +getCRC32 (const char* pZipFilePath) +{ + g_warning ("Hit unused getCRC32 '%s'", pZipFilePath); + return 0; +} + +static int +exec_command (const char *pZipFilePath, + const char *pDestPath, + const char *pFlags, + char **stdout_str) +{ + int ret = 0; + char *zip_path; + char *stderr_str = NULL; + int exit_status; + char *command; + GError *err = NULL; + + if (!(zip_path = fiddle_with_path (pZipFilePath))) + return 1001; /* not found */ + + if (!pDestPath || !*pDestPath) + pDestPath = "*.*"; + + command = g_strdup_printf ("unzip -qq%s '%s' '%s'", + pFlags, zip_path, pDestPath); + + if (!g_spawn_command_line_sync (command, stdout_str, + &stderr_str, &exit_status, &err)) { + g_warning ("Failed to exec '%s' '%s'", + command, err ? err->message : "No msg"); + ret = 1111; + } + + if (stderr_str && stderr_str [0] != '\0') { + g_warning ("Error execing '%s': %s", command, stderr_str); + ret = 1111; + } + + g_free (zip_path); + g_free (command); + g_free (stderr_str); + + return ret; +} + +int +SVUnzip (const char* pZipFilePath, const char* pDestPath, + const char* pFlags, UnzipCallBack *pCallBackFunc) +{ + /* pDestPath has nothing to do with the destination path */ +// fprintf (stderr, "Unpack '%s' '%s' '%s'\n", pZipFilePath, pDestPath, pFlags); + return exec_command (pZipFilePath, pDestPath, pFlags, NULL); +} + +int +SVUnzipEnumFiles (const char *pZipFilePath, + const char *pPattern, + UnzipEnumFilesCallBack *pCallBack, + void *pExtraData) +{ + int ret, i; + char **lines; + char *stdout_str = NULL; + + if ((ret = exec_command (pZipFilePath, pPattern, + "v", &stdout_str))) + return ret; + + if (!stdout_str || stdout_str [0] == '\0') { + fprintf (stderr, "Odd: empty stdout on exec for file '%s' ('%s')\n", + pZipFilePath, pPattern); + return 1111; + } + + lines = g_strsplit (stdout_str, "\n", -1); + for (i = 0; lines && lines [i]; i++) { + int j; + long len; + char *p; + + p = lines [i]; + if (!p || p[0] == '\0') + continue; + + for (; *p && (*p == ' ' || *p == '\t'); p++); /* skip white */ + len = strtol (p, NULL, 10); + + p+= strlen (p); /* end */ + for (; p >= lines [i] && *p != ' ' && *p != '\t'; p--); /* seek name */ + p++; + +// g_warning ("File '%s' len %ld", p, len); + + if (pCallBack) + pCallBack (p, len, pExtraData); + } + g_strfreev (lines); +} + +/* Nastiness to make patching work nicely for some odd reason */ + +#ifdef THIS_IS_TOTALLY_BROKEN /************************************************************************* * * $RCSfile: unzip-rewrite.diff,v $ @@ -180,3 +312,4 @@ pEnumFilesExtraData = pExtraData; return SVUnzip(pZipFilePath, pPattern , "v", NULL); } +#endif Index: setup2/mow/source/loader/makefile.mk =================================================================== RCS file: /cvs/installation/setup2/mow/source/loader/makefile.mk,v retrieving revision 1.12.22.2 diff -u -p -u -r1.12.22.2 makefile.mk --- ooo_cvs/setup2/mow/source/loader/makefile.mk 15 Jul 2003 16:48:21 -0000 1.12.22.2 +++ ooo_cvs/setup2/mow/source/loader/makefile.mk 18 Jul 2003 13:46:25 -0000 @@ -101,7 +101,7 @@ APP1STDLIBS=$(SVUNZIPLIB) $(LOADERLIB) - .IF "$(OS)"=="MACOSX" APP1STDLIBS=$(LOADERLIB) -ldl $(SVUNZIPLIB) -lX11 .ELSE -APP1STDLIBS=$(LOADERLIB) -ldl $(SVUNZIPLIB) +APP1STDLIBS=$(LOADERLIB) -ldl $(SVUNZIPLIB) `pkg-config --libs glib-2.0` .ENDIF .ENDIF
Attachment:
signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=