1 --- misc/libmspack/mspack/makefile.mk Mon Mar 31 11:34:58 2008
2 +++ misc/build/libmspack/mspack/makefile.mk Mon Mar 31 11:34:31 2008
5 +#*************************************************************************
7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 +# Copyright 2008 by Sun Microsystems, Inc.
11 +# OpenOffice.org - a multi-platform office productivity suite
13 +# $RCSfile: msfontextract.patch,v $
17 +# This file is part of OpenOffice.org.
19 +# OpenOffice.org is free software: you can redistribute it and/or modify
20 +# it under the terms of the GNU Lesser General Public License version 3
21 +# only, as published by the Free Software Foundation.
23 +# OpenOffice.org is distributed in the hope that it will be useful,
24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 +# GNU Lesser General Public License version 3 for more details
27 +# (a copy is included in the LICENSE file that accompanied this code).
29 +# You should have received a copy of the GNU Lesser General Public License
30 +# version 3 along with OpenOffice.org. If not, see
31 +# <http://www.openoffice.org/license.html>
32 +# for a copy of the LGPLv3 License.
34 +#*************************************************************************
36 +PRJ=..$/..$/..$/..$/..$/
38 +PRJNAME=msfontextract
44 +EXTERNAL_WARNINGS_NOT_ERRORS=TRUE
46 +# --- Settings -----------------------------------------------------
49 +.INCLUDE : settings.mk
51 +# --- Files --------------------------------------------------------
56 +.IF "$(SYSTEM_MSPACK)" != "YES"
65 + $(OBJ)$/msfontextract.obj
67 +.IF "$(SYSTEM_MSPACK)" != "YES"
69 + $(OBJ)$/system.obj \
72 + $(OBJ)$/ministub.obj
75 +APP1TARGET= $(TARGET)
76 +APP1OBJS= $(OBJFILES)
80 +.IF "$(SYSTEM_MSPACK)" == "YES"
81 +APP1STDLIBS+= -lmspack
84 +# --- Targets ------------------------------------------------------
87 --- misc/libmspack/mspack/ministub.c Mon Mar 31 11:34:58 2008
88 +++ misc/build/libmspack/mspack/ministub.c Mon Mar 31 11:34:02 2008
93 +/* other expansion types not needed */
94 +int mszipd_init() {return MSPACK_ERR_DECRUNCH;}
95 +int mszipd_decompress() {return MSPACK_ERR_DECRUNCH;}
96 +void mszipd_free() {}
98 +int qtmd_init() {return MSPACK_ERR_DECRUNCH;}
99 +int qtmd_decompress() {return MSPACK_ERR_DECRUNCH;}
102 --- misc/libmspack/mspack/msfontextract.c Mon Mar 31 11:34:58 2008
103 +++ misc/build/libmspack/mspack/msfontextract.c Mon Mar 31 11:34:02 2008
107 +* Portions (almost all!) (C) 2003 Stuart Caie.
108 +* you can redistribute it and/or modify it under
109 +* the terms of the GNU Lesser General Public License (LGPL) version 2.1
119 +char *error_msg(int error) {
121 + case MSPACK_ERR_OK: return "no error";
122 + case MSPACK_ERR_ARGS: return "bad arguments to library function";
123 + case MSPACK_ERR_OPEN: return "error opening file";
124 + case MSPACK_ERR_READ: return "read error";
125 + case MSPACK_ERR_WRITE: return "write error";
126 + case MSPACK_ERR_SEEK: return "seek error";
127 + case MSPACK_ERR_NOMEMORY: return "out of memory";
128 + case MSPACK_ERR_SIGNATURE: return "bad signature";
129 + case MSPACK_ERR_DATAFORMAT: return "error in data format";
130 + case MSPACK_ERR_CHECKSUM: return "checksum error";
131 + case MSPACK_ERR_CRUNCH: return "compression error";
132 + case MSPACK_ERR_DECRUNCH: return "decompression error";
134 + return "unknown error";
138 +/* creates name of output file */
139 +char *create_output_name(const char *fname, char *dir) {
141 + if (!(name = malloc(strlen(fname) + (dir ? strlen(dir) : 0) + 2))) {
142 + fprintf(stderr, "out of memory!\n");
145 + /* start with blank name */
147 + /* add output directory if needed */
152 + p = &name[strlen(name)];
155 + *p++ = tolower((unsigned char) c);
163 +main(int argc, char** argv)
166 + struct mscab_decompressor *cabd;
167 + struct mscabd_cabinet *cab;
168 + struct mscabd_file *file;
169 + char * ename = NULL;
172 + /* argv[1] is the cabinet to extract */
173 + /* argv[2] is the path to extract to */
174 + if ((!(argv[1])) || (!(argv[2]))) {
175 + fprintf(stderr,"Usage: %s <cabinet> <destpath>\n",argv[0]);
179 + /* initialize libmspack and create a CAB decompressor */
180 + MSPACK_SYS_SELFTEST(err);
182 + fprintf(stderr,"Cannot initialize libmspack\n");
185 + if (!(cabd = mspack_create_cab_decompressor(NULL))) {
186 + fprintf(stderr, "can't make decompressor: %s\n",
187 + error_msg(cabd->last_error(cabd)));
192 + /* look for an embedded cabinet */
193 + if ((cab = cabd->search(cabd, argv[1]))) {
194 + /* for all files in the cabinet */
195 + for (file = cab->files; file; file = file->next) {
196 + if (!(ename = create_output_name(file->filename, argv[2]))) continue;
197 + if ((cabd->extract(cabd, file, ename))) {
198 + fprintf(stderr,"%s: extract error on \"%s\": %s\n",argv[1],
199 + ename, error_msg(cabd->last_error(cabd)));
204 + cabd->close(cabd, cab);
207 + fprintf(stderr, "%s: no embedded cabinet found\n", argv[1] );
209 + mspack_destroy_cab_decompressor(cabd);
213 --- misc/libmspack/mspack/mspack.h Fri Dec 12 18:06:15 2003
214 +++ misc/build/libmspack/mspack/mspack.h Mon Mar 31 11:34:02 2008
216 #include <sys/types.h>
219 +/* MS Compiler defines size_t in stddef.h */
220 +#if defined(_MSC_VER) || defined(__MINGW32__)
225 * System self-test function, to ensure both library and calling program
226 * can use one another.
227 --- misc/libmspack/mspack/system.h Thu Sep 11 16:06:52 2003
228 +++ misc/build/libmspack/mspack/system.h Mon Mar 31 11:34:02 2008
233 -# define D(x) do { printf("%s:%d (%s) ",__FILE__, __LINE__, __FUNCTION__); \
234 +# define D(x) do { printf("%s:%d ",__FILE__, __LINE__); \
235 printf x ; fputc('\n', stdout); fflush(stdout);} while (0);
240 +/* Brutal hack to make it compile with MS .NET Compiler that doesn't
241 + know what inline means. */
244 /* endian-neutral reading of little-endian data */
245 #define __egi32(a,n) ( (((a)[n+3]) << 24) | (((a)[n+2]) << 16) | \
246 (((a)[n+1]) << 8) | ((a)[n+0]) )
248 /* validates a system structure */
249 extern int mspack_valid_system(struct mspack_system *sys);
252 /* inline memcmp() */
253 static inline int memcmp(const void *s1, const void *s2, size_t n) {
254 unsigned char *c1 = (unsigned char *) s1;