mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
wrc: Add support for zlib-compressed resources.
This commit is contained in:
parent
100645ac4d
commit
ca8f80641d
6 changed files with 42 additions and 2 deletions
10
configure.ac
10
configure.ac
|
@ -84,6 +84,7 @@ AC_ARG_WITH(xshm, AS_HELP_STRING([--without-xshm],[do not use XShm (shared
|
|||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_XShm_h=no; fi])
|
||||
AC_ARG_WITH(xxf86vm, AS_HELP_STRING([--without-xxf86vm],[do not use XFree video mode extension]),
|
||||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_xf86vmode_h=no; ac_cv_header_X11_extensions_xf86vmproto_h=no; fi])
|
||||
AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],[do not use zlib]))
|
||||
|
||||
AC_ARG_WITH(system-dllpath,AS_HELP_STRING([--with-system-dllpath=PATH],[load external PE dependencies from colon-separated path PATH]),
|
||||
AC_SUBST(system_dllpath,[$withval]))
|
||||
|
@ -1522,6 +1523,15 @@ WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes"],
|
|||
WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_port_gp_port_info_list_new" != "yes"],
|
||||
[libgphoto2_port ${notice_platform}development files not found, digital cameras won't be auto-detected.])
|
||||
|
||||
dnl **** Check for zlib ****
|
||||
if test "x$with_zlib" != "xno"
|
||||
then
|
||||
WINE_PACKAGE_FLAGS(ZLIB,[zlib],,,,
|
||||
[AC_CHECK_HEADERS([zlib.h])
|
||||
AC_CHECK_LIB(z,compress,[:],[ZLIB_LIBS=""],[$ZLIB_LIBS])])
|
||||
fi
|
||||
WINE_NOTICE_WITH(zlib,[test "$ac_cv_header_zlib_h" != "yes"],
|
||||
[libz ${notice_platform}development files not found (or too old), wrc compressed resources won't be supported.])
|
||||
|
||||
dnl **** Check for resolver library ***
|
||||
if test "$ac_cv_header_resolv_h" = "yes"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PROGRAMS = wrc
|
||||
UNIX_LIBS = $(GETTEXTPO_LIBS)
|
||||
UNIX_LIBS = $(GETTEXTPO_LIBS) $(ZLIB_LIBS)
|
||||
|
||||
SOURCES = \
|
||||
genres.c \
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
# include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "../tools.h"
|
||||
#include "wrc.h"
|
||||
#include "utils.h"
|
||||
|
@ -959,6 +963,21 @@ static void user2res(name_id_t *name, user_t *usr)
|
|||
put_dword(4); /* ResSize overwritten later*/
|
||||
}
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
if (compress_data)
|
||||
{
|
||||
uLongf size = compressBound(usr->data->size);
|
||||
Bytef *compressed = xmalloc(size);
|
||||
compress(compressed, &size, (Bytef *)usr->data->data, usr->data->size);
|
||||
put_dword(0);
|
||||
put_dword(usr->data->size);
|
||||
put_data(compressed, size);
|
||||
free(compressed);
|
||||
set_res_size(tag);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
put_data(usr->data->data, usr->data->size);
|
||||
set_res_size(tag);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ static const char usage[] =
|
|||
" -v, --verbose Enable verbose mode\n"
|
||||
" --verify-translations Check the status of the various translations\n"
|
||||
" --version Print version and exit\n"
|
||||
" -z Compress the resource with zlib\n"
|
||||
"Input is taken from stdin if no sourcefile specified.\n"
|
||||
"Debug level 'n' is a bitmask with following meaning:\n"
|
||||
" * 0x01 Tell which resource is parsed (verbose mode)\n"
|
||||
|
@ -127,6 +128,8 @@ int utf8_input = 0;
|
|||
|
||||
int check_utf8 = 1; /* whether to check for valid utf8 */
|
||||
|
||||
int compress_data = 0;
|
||||
|
||||
static char *output_name; /* The name given by the -o option */
|
||||
const char *input_name = NULL; /* The name given on the command-line */
|
||||
static struct strarray input_files;
|
||||
|
@ -165,7 +168,7 @@ enum long_options_values
|
|||
};
|
||||
|
||||
static const char short_options[] =
|
||||
"b:D:Ef:F:hi:I:J:l:m:o:O:ruU:v";
|
||||
"b:D:Ef:F:hi:I:J:l:m:o:O:ruU:vz";
|
||||
static const struct long_option long_options[] = {
|
||||
{ "debug", 1, LONG_OPT_DEBUG },
|
||||
{ "define", 1, 'D' },
|
||||
|
@ -376,6 +379,9 @@ static void option_callback( int optc, char *optarg )
|
|||
case 'v':
|
||||
debuglevel = DEBUGLEVEL_CHAT;
|
||||
break;
|
||||
case 'z':
|
||||
compress_data = 1;
|
||||
break;
|
||||
case '?':
|
||||
fprintf(stderr, "wrc: %s\n\n%s", optarg, usage);
|
||||
exit(1);
|
||||
|
|
|
@ -40,6 +40,7 @@ extern int preprocess_only;
|
|||
extern int no_preprocess;
|
||||
extern int utf8_input;
|
||||
extern int check_utf8;
|
||||
extern int compress_data;
|
||||
|
||||
extern const char *input_name;
|
||||
extern const char *nlsdirs[];
|
||||
|
|
|
@ -135,6 +135,10 @@ Turns on verbose mode (equivalent to \fB-d 1\fR).
|
|||
.TP
|
||||
.I \fB\-\-version\fR
|
||||
Print version and exit.
|
||||
.TP
|
||||
.I \fB\-z\fR
|
||||
Compress the resource data, prepending a 32bit zero value followed by the
|
||||
decompressed size as a 32bit integer.
|
||||
.SH PREPROCESSOR
|
||||
The preprocessor is ANSI\-C compatible with some of the extensions of
|
||||
the gcc preprocessor.
|
||||
|
|
Loading…
Reference in a new issue