wok-current diff module-init-tools/stuff/lzlib.u @ rev 1118
Add taglib (audio meta-data library)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Jul 20 16:39:26 2008 +0200 (2008-07-20) |
parents | |
children | f0a84dc0a7c2 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/module-init-tools/stuff/lzlib.u Sun Jul 20 16:39:26 2008 +0200 1.3 @@ -0,0 +1,83 @@ 1.4 +--- module-init-tools-3.2/zlibsupport.c 1.5 ++++ module-init-tools-3.2/zlibsupport.c 1.6 +@@ -16,58 +16,33 @@ 1.7 + #include "testing.h" 1.8 + 1.9 + #ifdef CONFIG_USE_ZLIB 1.10 +-#include <zlib.h> 1.11 ++#include <lzlib.h> 1.12 + 1.13 +-void *grab_contents(gzFile *gzfd, unsigned long *size) 1.14 +-{ 1.15 +- unsigned int max = 16384; 1.16 +- void *buffer = malloc(max); 1.17 +- int ret; 1.18 +- 1.19 +- if (!buffer) 1.20 +- return NULL; 1.21 +- 1.22 +- *size = 0; 1.23 +- while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) { 1.24 +- *size += ret; 1.25 +- if (*size == max) { 1.26 +- buffer = realloc(buffer, max *= 2); 1.27 +- if (!buffer) 1.28 +- return NULL; 1.29 +- } 1.30 +- } 1.31 +- if (ret < 0) { 1.32 +- free(buffer); 1.33 +- buffer = NULL; 1.34 +- } 1.35 +- return buffer; 1.36 +-} 1.37 +- 1.38 + void *grab_fd(int fd, unsigned long *size) 1.39 + { 1.40 +- gzFile gzfd; 1.41 ++ lzFile lzfd; 1.42 + 1.43 +- gzfd = gzdopen(fd, "rb"); 1.44 +- if (!gzfd) 1.45 ++ lzfd = lzdopen(fd, "rb"); 1.46 ++ if (!lzfd) 1.47 + return NULL; 1.48 + 1.49 +- /* gzclose(gzfd) would close fd, which would drop locks. 1.50 ++ /* lzclose(lzfd) would close fd, which would drop locks. 1.51 + Don't blame zlib: POSIX locking semantics are so horribly 1.52 + broken that they should be ripped out. */ 1.53 +- return grab_contents(gzfd, size); 1.54 ++ return lzgrab(lzfd, size); 1.55 + } 1.56 + 1.57 + /* gzopen handles uncompressed files transparently. */ 1.58 + void *grab_file(const char *filename, unsigned long *size) 1.59 + { 1.60 +- gzFile gzfd; 1.61 ++ lzFile lzfd; 1.62 + void *buffer; 1.63 + 1.64 +- gzfd = gzopen(filename, "rb"); 1.65 +- if (!gzfd) 1.66 ++ lzfd = lzopen(filename, "rb"); 1.67 ++ if (!lzfd) 1.68 + return NULL; 1.69 +- buffer = grab_contents(gzfd, size); 1.70 +- gzclose(gzfd); 1.71 ++ buffer = lzgrab(lzfd, size); 1.72 ++ lzclose(lzfd); 1.73 + return buffer; 1.74 + } 1.75 + 1.76 +--- module-init-tools-3.2/configure 1.77 ++++ module-init-tools-3.2/configure 1.78 +@@ -1741,7 +1741,7 @@ 1.79 + #define CONFIG_USE_ZLIB 1 1.80 + _ACEOF 1.81 + 1.82 +- zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic" 1.83 ++ zlib_flags="-Wl,-Bdynamic -lz -llz" 1.84 + fi 1.85 + fi; 1.86 +