wok annotate module-init-tools/stuff/lzlib.u @ rev 22561

updated boxbackup-client and boxbackup-server (0.11.1 -> 0.12)
author Hans-G?nter Theisgen
date Sun Jan 05 11:14:45 2020 +0100 (2020-01-05)
parents 71c7aacfbbb2
children
rev   line source
rcx@3742 1 --- module-init-tools-3.10/zlibsupport.c
rcx@3742 2 +++ module-init-tools-3.10/zlibsupport.c
gokhlayeh@7897 3 @@ -18,43 +18,23 @@
pascal@897 4 #include "testing.h"
pascal@897 5
pascal@897 6 #ifdef CONFIG_USE_ZLIB
pascal@897 7 -#include <zlib.h>
pascal@3320 8 -
pascal@897 9 -void *grab_contents(gzFile *gzfd, unsigned long *size)
pascal@897 10 -{
pascal@897 11 - unsigned int max = 16384;
pascal@3320 12 - void *buffer = NOFAIL(malloc(max));
pascal@897 13 - int ret;
pascal@897 14 -
pascal@897 15 - *size = 0;
pascal@897 16 - while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
pascal@897 17 - *size += ret;
pascal@3320 18 - if (*size == max)
pascal@3320 19 - buffer = NOFAIL(realloc(buffer, max *= 2));
pascal@897 20 - }
pascal@897 21 - if (ret < 0) {
pascal@897 22 - free(buffer);
pascal@897 23 - buffer = NULL;
pascal@897 24 - }
pascal@3320 25 -
pascal@897 26 - return buffer;
pascal@897 27 -}
pascal@3320 28 +#include <lzlib.h>
pascal@3320 29
pascal@897 30 /* gzopen handles uncompressed files transparently. */
pascal@897 31 void *grab_file(const char *filename, unsigned long *size)
pascal@897 32 {
pascal@897 33 - gzFile gzfd;
pascal@897 34 + lzFile lzfd;
pascal@897 35 void *buffer;
pascal@897 36
pascal@3320 37 errno = 0;
pascal@897 38 - gzfd = gzopen(filename, "rb");
pascal@3320 39 - if (!gzfd) {
pascal@897 40 + lzfd = lzopen(filename, "rb");
pascal@3320 41 + if (!lzfd) {
pascal@3320 42 if (errno == ENOMEM)
pascal@3320 43 fatal("Memory allocation failure in gzopen\n");
pascal@897 44 return NULL;
pascal@3320 45 }
pascal@897 46 - buffer = grab_contents(gzfd, size);
pascal@897 47 - gzclose(gzfd);
pascal@897 48 + buffer = lzgrab(lzfd, size);
pascal@897 49 + lzclose(lzfd);
pascal@897 50 return buffer;
pascal@897 51 }
pascal@897 52
pascal@3320 53
pascal@3320 54 --- module-init-tools-3.9/configure
pascal@3320 55 +++ module-init-tools-3.9/configure
pascal@3320 56 @@ -2590,7 +2590,7 @@
pascal@897 57 #define CONFIG_USE_ZLIB 1
pascal@897 58 _ACEOF
pascal@897 59
pascal@897 60 - zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
pascal@897 61 + zlib_flags="-Wl,-Bdynamic -lz -llz"
pascal@897 62 fi
pascal@3320 63 fi
pascal@897 64
pascal@3320 65 @@ -2602,7 +2602,7 @@
pascal@3320 66 #define CONFIG_USE_ZLIB 1
pascal@3320 67 _ACEOF
pascal@3320 68
pascal@3320 69 - zlib_flags="-lz"
pascal@3320 70 + zlib_flags="-lz -llz"
pascal@3320 71 fi
pascal@3320 72 fi
pascal@3320 73