wok-next diff module-init-tools/stuff/patches/lzlib.u @ rev 20533

cairo-clock, grub4dos: fix CFLAGS
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 27 12:50:45 2018 +0200 (2018-03-27)
parents d2d594c8804d
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/module-init-tools/stuff/patches/lzlib.u	Tue Mar 27 12:50:45 2018 +0200
     1.3 @@ -0,0 +1,73 @@
     1.4 +--- module-init-tools-3.10/zlibsupport.c
     1.5 ++++ module-init-tools-3.10/zlibsupport.c
     1.6 +@@ -18,43 +18,23 @@
     1.7 + #include "testing.h"
     1.8 + 
     1.9 + #ifdef CONFIG_USE_ZLIB
    1.10 +-#include <zlib.h>
    1.11 +-
    1.12 +-void *grab_contents(gzFile *gzfd, unsigned long *size)
    1.13 +-{
    1.14 +-	unsigned int max = 16384;
    1.15 +-	void *buffer = NOFAIL(malloc(max));
    1.16 +-	int ret;
    1.17 +-
    1.18 +-	*size = 0;
    1.19 +-	while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
    1.20 +-		*size += ret;
    1.21 +-		if (*size == max)
    1.22 +-			buffer = NOFAIL(realloc(buffer, max *= 2));
    1.23 +-	}
    1.24 +-	if (ret < 0) {
    1.25 +-		free(buffer);
    1.26 +-		buffer = NULL;
    1.27 +-	}
    1.28 +-
    1.29 +-	return buffer;
    1.30 +-}
    1.31 ++#include <lzlib.h>
    1.32 + 
    1.33 + /* gzopen handles uncompressed files transparently. */
    1.34 + void *grab_file(const char *filename, unsigned long *size)
    1.35 + {
    1.36 +-	gzFile gzfd;
    1.37 ++	lzFile lzfd;
    1.38 + 	void *buffer;
    1.39 + 
    1.40 + 	errno = 0;
    1.41 +-	gzfd = gzopen(filename, "rb");
    1.42 +-	if (!gzfd) {
    1.43 ++	lzfd = lzopen(filename, "rb");
    1.44 ++	if (!lzfd) {
    1.45 + 		if (errno == ENOMEM)
    1.46 + 			fatal("Memory allocation failure in gzopen\n");
    1.47 + 		return NULL;
    1.48 + 	}
    1.49 +-	buffer = grab_contents(gzfd, size);
    1.50 +-	gzclose(gzfd);
    1.51 ++	buffer = lzgrab(lzfd, size);
    1.52 ++	lzclose(lzfd);
    1.53 + 	return buffer;
    1.54 + }
    1.55 + 
    1.56 +
    1.57 +--- module-init-tools-3.9/configure
    1.58 ++++ module-init-tools-3.9/configure
    1.59 +@@ -2590,7 +2590,7 @@
    1.60 + #define CONFIG_USE_ZLIB 1
    1.61 + _ACEOF
    1.62 + 
    1.63 +-  zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
    1.64 ++  zlib_flags="-Wl,-Bdynamic -lz -llz"
    1.65 + fi
    1.66 + fi
    1.67 + 
    1.68 +@@ -2602,7 +2602,7 @@
    1.69 + #define CONFIG_USE_ZLIB 1
    1.70 + _ACEOF
    1.71 + 
    1.72 +-  zlib_flags="-lz"
    1.73 ++  zlib_flags="-lz -llz"
    1.74 + fi
    1.75 + fi
    1.76 +