Hello community, here is the log from the commit of package libzio checked in at Wed Dec 20 20:33:58 CET 2006. -------- --- libzio/libzio.changes 2006-12-15 10:46:10.000000000 +0100 +++ /mounts/work_src_done/STABLE/libzio/libzio.changes 2006-12-20 14:09:31.000000000 +0100 @@ -1,0 +2,5 @@ +Wed Dec 20 14:08:59 CET 2006 - werner@suse.de + +- Better weak symbol handling even for -ansi -pedantic + +------------------------------------------------------------------- Old: ---- libzio-0.3.dif libzio-0.3.tar.bz2 New: ---- libzio-0.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzio.spec ++++++ --- /var/tmp/diff_new_pack.MmW0L5/_old 2006-12-20 20:33:52.000000000 +0100 +++ /var/tmp/diff_new_pack.MmW0L5/_new 2006-12-20 20:33:52.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package libzio (Version 0.3) +# spec file for package libzio (Version 0.4) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -14,8 +14,8 @@ License: GNU General Public License (GPL) Group: System/Libraries Autoreqprov: on -Version: 0.3 -Release: 3 +Version: 0.4 +Release: 1 Summary: A Library for Accessing Compressed Text Files BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: libzio-%{version}.tar.bz2 @@ -37,6 +37,11 @@ %build make +make testt +for comp in gzip bzip2; do + $comp -c < fzopen.3.in > fzopen.test + ./testt fzopen.test | cmp fzopen.3.in - +done %install make DESTDIR=$RPM_BUILD_ROOT install libdir=%{_libdir} mandir=%{_mandir} @@ -53,11 +58,13 @@ %{_libdir}/libzio.a %{_libdir}/libzio.so %{_libdir}/libzio.so.0 -%{_libdir}/libzio.so.0.3 +%{_libdir}/libzio.so.0.4 %{_mandir}/man3/fzopen.3* /usr/include/zio.h %changelog -n libzio +* Wed Dec 20 2006 - werner@suse.de +- Better weak symbol handling even for -ansi -pedantic * Fri Dec 15 2006 - werner@suse.de - Can not use sigmask() macro in ia64 because its definition is for sigset_t array only but not for single ulong ++++++ libzio-0.3.tar.bz2 -> libzio-0.4.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/Makefile new/libzio-0.4/Makefile --- old/libzio-0.3/Makefile 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/Makefile 2006-12-20 19:06:56.000000000 +0100 @@ -8,7 +8,7 @@ CFLAGS = $(RPM_OPT_FLAGS) -pipe -Wall -D_GNU_SOURCE -D_REENTRANT $(LARGE) CC = gcc MAJOR = 0 -MINOR = 3 +MINOR = 4 VERSION = $(MAJOR).$(MINOR) libdir = /usr/lib @@ -37,7 +37,7 @@ obj/unlzw.o: unlzw.c lzw.h test -d obj/ || mkdir obj/ - $(CC) $(CFLAGS) -o $@ -c $< + $(CC) $(CFLAGS) -funroll-loops -o $@ -c $< obs/unlzw.o: unlzw.c lzw.h test -d obs/ || mkdir obs/ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/README new/libzio-0.4/README --- old/libzio-0.3/README 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/README 2006-12-20 19:06:56.000000000 +0100 @@ -2,8 +2,12 @@ =============================================== This small lib provides with the help of the fopencookie(3) -of the glibc and the libz and libbz2 a simple interface for -reading or writing gzip/bzip2 files. +interface of the glibc together with the zlib and libbzip2 +an simple interface for reading or writing gzip/bzip2 files +with streams. Beside handling gzip files and bzip2 files, +the libzio provides support for reading ``.Z'' compressed +files. By using the GNUC compiler weak facility one or both +libraries, zlib or libbzip2, can be skipped at linkage time. To use this e.g. an @@ -13,28 +17,28 @@ FILE * file = fzopen("myfile.gz", "r"); -together with linking the resulting program with -lzio -_and_ -lz. For bzip2 files clearly the libbz2 with -lbz2 -has to used at linking time. - -The libz and/or libbz2 librares are required because the -libzio is not linked with -lz nor with -lbz2. If the -appropiate library functions of libz or libbz2 are not -found the fzopen(3) function returns NULL and the errno -is set to ENOSYS. - -As the libbz2 does not provide a function for seeking -within a bzip2 file, any call of fseek(3) on the open -stream will fail and set the errno to ESPIPE. - -For writing gzip/bzip2 files, fzopen(3) only supports -the suffixes ``.z'' and ``.gz'' for gzipped files and -``.bz2'' for bzip2ed files. - -On reading first the appropiate suffixes are checked -if not provided. If no file is found the magic byte -sequence at the beginning of the file is checked to detect -a gzip or bzip2 file. +together with linking the resulting program with -lzio _and_ +`-lz'. For bzip2 files clearly the libbz2 with `-lbz2' has +to used at linkage time. + +The zlib and/or libbzip2 librares are required because the +libzio is not linked with `-lz' nor with `-lbz2'. If the +appropiate library functions of libz or libbz2 are not found +the fzopen(3) function returns NULL and the errno is set to +the value ENOSYS for not implemented. + +As the libbzip2 does not provide a function for seeking in +a bzip2 file, any call of fseek(3) on the open stream will +fail and set the errno to ESPIPE. + +For writing gzip/bzip2 files, fzopen(3) only supports the +suffixes ``.z'' and ``.gz'' for gzipped files and ``.bz2'' +for bzip2ed files. + +On reading first the appropiate suffixes are checked if not +provided. If no file is found the magic byte sequence at the +beginning of the file is checked to detect which type of +compressing is used for the file. Happy (un)compressing, diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/fzopen.3.in new/libzio-0.4/fzopen.3.in --- old/libzio-0.3/fzopen.3.in 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/fzopen.3.in 2006-12-20 19:06:57.000000000 +0100 @@ -1,12 +1,13 @@ .\" .\" Copyright 2004 Werner Fink, 2004 SuSE LINUX AG, Germany. +.\" Copyright 2006 Werner Fink, 2006 SuSE Products GmbH, Germany. .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" -.TH fzopen 3 "Apr 20, 2004" "Version @@VERSION@@" " Linux Programmer's Manual" +.TH fzopen 3 "Apr 20, 2006" "Version @@VERSION@@" " Linux Programmer's Manual" .UC 3 .OS SuSE Linux .SH NAME @@ -105,6 +106,16 @@ .B -lbz2 for bzip2ed files.) .TP +.B ENOTSUP +The program using +.B fzopen +has specified a wrong mode for a +.B .bz2 +files +or has opened a +.B .Z +file for writing. +.TP .B ENOMEM The call of the library functions of the .B libz @@ -130,6 +141,13 @@ .I libz does with .BR gzseek . +.B .Z +copressed file will be opend by +.B Fzopen +only for reading. Also a seek +is not possible for +.B .Z +files. .SH FILES .\" .BR /usr/include/zio.h @@ -147,5 +165,8 @@ .SH COPYRIGHT 2004 Werner Fink, 2004 SuSE LINUX AG Nuernberg, Germany. +.br +2006 Werner Fink, +2006 SuSE Products GmbH, Germany. .SH AUTHOR Werner Fink <werner@suse.de> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/lzw.h new/libzio-0.4/lzw.h --- old/libzio-0.3/lzw.h 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/lzw.h 2006-12-20 19:06:57.000000000 +0100 @@ -45,33 +45,35 @@ #include <stdint.h> #include <ucontext.h> +#include "zioP.h" #if defined _REENTRANT || defined _THREAD_SAFE # include <pthread.h> -extern int pthread_sigmask(int, const sigset_t*, sigset_t*) __attribute__((weak)); -static inline int sigucmask(int how, const sigset_t * set, sigset_t * oset) +weak_symbol(pthread_sigmask); +#endif + +__extension__ +static __inline__ int sigucmask(int how, const sigset_t * __restrict set, sigset_t * __restrict oset) { +#if defined _REENTRANT || defined _THREAD_SAFE if (&pthread_sigmask) return pthread_sigmask(how, set, oset); else - return sigprocmask(how, set, oset); -} -#else -static inline int sigucmask(int how, const sigset_t * set, sigset_t * oset) -{ +#endif return sigprocmask(how, set, oset); } -#endif -#if defined(__ia64__) /* Broken header sys/ucontext.h -> bits/sigcontext.h */ -static inline unsigned long int sig_ia64_mask(const sigset_t set) +#if defined(__ia64__) && defined(uc_sigmask) /* Broken header sys/ucontext.h -> bits/sigcontext.h */ +__extension__ +static __inline__ unsigned long int sig_ia64_mask(const sigset_t set) { unsigned long int mask = 0; - int cnt = sizeof(unsigned long int); + int cnt = (8 * sizeof(unsigned long int)); + if (cnt > NSIG) cnt = NSIG; while (--cnt >= 0) { if (!sigismember(&set, cnt)) continue; - mask |= sigmask(cnt); + mask |= (1 << (cnt - 1)); /* sigmask() macro is is not usable for BSD way */ } return mask; } @@ -115,6 +117,6 @@ uint8_t *stack; } LZW_t; -extern LZW_t *openlzw(const char*, const char*); -extern ssize_t readlzw(LZW_t*, char*, const size_t); -extern void closelzw(LZW_t*); +extern LZW_t *openlzw(const char * __restrict, const char * __restrict); +extern ssize_t readlzw(LZW_t * __restrict, char * __restrict, const size_t); +extern void closelzw(LZW_t * __restrict); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/testt.c new/libzio-0.4/testt.c --- old/libzio-0.3/testt.c 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/testt.c 2006-12-20 19:06:57.000000000 +0100 @@ -9,6 +9,7 @@ while (argc > 1) { FILE *file; char line[1024]; + size_t len; argv++; argc--; @@ -18,9 +19,15 @@ continue; } - while (fgets (line, sizeof (line), file)) - printf("%s", line); + while ((len = fread(line, sizeof(char), sizeof (line), file))) { + size_t ret = fwrite(line, sizeof(char), len, stdout); + if ((ret != len) && ferror(stdout)) { + clearerr(stdout); + } + } + fclose(file); } + return 0; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/unlzw.c new/libzio-0.4/unlzw.c --- old/libzio-0.3/unlzw.c 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/unlzw.c 2006-12-20 19:06:57.000000000 +0100 @@ -39,7 +39,8 @@ * Fill the input buffer. This is called only when the buffer is empty. * Adopted from gzip version 1.3.7 util.c */ -static inline int fill_inbuf(LZW_t *in) +__extension__ +static __inline__ int fill_inbuf(LZW_t *in) { /* Read as much as possible */ in->insize = 0; @@ -70,7 +71,8 @@ * Adopted from gzip version 1.3.7 util.c * Note that this version uses context switching, switch back to old context. */ -static inline void write_buf(LZW_t *in, const unsigned char* buf, size_t cnt) +__extension__ +static __inline__ void write_buf(LZW_t *in, const unsigned char* buf, size_t cnt) { do { if ((in->tsize = (in->tcount > cnt) ? cnt : in->tcount)) { @@ -192,7 +194,7 @@ goto err; if (sigaddset(&sigmask, SIGQUIT) < 0) goto err; -#if defined(__ia64__) /* On ia64 the type of uc_sigmask is ulong not sigset_t */ +#if defined(__ia64__) && defined(uc_sigmask) /* On ia64 the type of uc_sigmask is ulong not sigset_t */ in->uc[1].uc_sigmask = sig_ia64_mask(sigmask); #else in->uc[1].uc_sigmask = sigmask; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/zio.c new/libzio-0.4/zio.c --- old/libzio-0.3/zio.c 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/zio.c 2006-12-20 19:06:56.000000000 +0100 @@ -2,6 +2,7 @@ * zio.c Provide an streamable interface to gziped/bzip2ed files * * Copyright 2004 Werner Fink, 2004 SuSE LINUX AG, Germany. + * Copyright 2006 Werner Fink, 2006 SuSE Products GmbH, Germany. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -11,7 +12,9 @@ * Author: Werner Fink <werner@suse.de> */ -#define USE_PIPE_4LZW 0 +#if ! defined USE_PIPE_4LZW +# define USE_PIPE_4LZW 0 +#endif #include "zioP.h" #include "zio.h" @@ -48,11 +51,12 @@ return (status >= 0) ? 0 : EOF; } +__extension__ static cookie_io_functions_t ioz = { - .read = (cookie_read_function_t*) zread, - .seek = (cookie_seek_function_t*) zseek, - .write = (cookie_write_function_t*)zwrite, - .close = (cookie_close_function_t*)zclose, + .read = (cookie_read_function_t*) &zread, + .seek = (cookie_seek_function_t*) &zseek, + .write = (cookie_write_function_t*)&zwrite, + .close = (cookie_close_function_t*)&zclose, }; static ssize_t bzread(void *cookie, char *buf, size_t count) @@ -78,11 +82,12 @@ return (status >= 0) ? 0 : EOF; } +__extension__ static cookie_io_functions_t iobz = { - .read = (cookie_read_function_t*) bzread, - .seek = (cookie_seek_function_t*) bzseek, - .write = (cookie_write_function_t*)bzwrite, - .close = (cookie_close_function_t*)bzclose, + .read = (cookie_read_function_t*) &bzread, + .seek = (cookie_seek_function_t*) &bzseek, + .write = (cookie_write_function_t*)&bzwrite, + .close = (cookie_close_function_t*)&bzclose, }; static ssize_t lzwread(void *cookie, char *buf, size_t count) @@ -128,14 +133,15 @@ #endif } +__extension__ static cookie_io_functions_t iolzw = { - .read = (cookie_read_function_t*) lzwread, - .seek = (cookie_seek_function_t*) lzwseek, - .write = (cookie_write_function_t*)lzwwrite, - .close = (cookie_close_function_t*)lzwclose, + .read = (cookie_read_function_t*) &lzwread, + .seek = (cookie_seek_function_t*) &lzwseek, + .write = (cookie_write_function_t*)&lzwwrite, + .close = (cookie_close_function_t*)&lzwclose, }; -FILE * fzopen(const char *path, const char *mode) +FILE * fzopen(const char * path, const char * mode) { FILE * ret = (FILE *)0; char * check = (char*)0, * ext = (char*)0; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/zio.h.in new/libzio-0.4/zio.h.in --- old/libzio-0.3/zio.h.in 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/zio.h.in 2006-12-20 19:06:57.000000000 +0100 @@ -23,7 +23,7 @@ * This function can open a gziped file for reading OR writing, but * NOT both (not `+' possible) NOR can it open for appending (no `a'). */ -extern FILE *fzopen __P((const char *path, const char *mode)); +extern FILE *fzopen __P((__const char *__restrict path, __const char *__restrict mode)); #ifdef __cplusplus } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libzio-0.3/zioP.h new/libzio-0.4/zioP.h --- old/libzio-0.3/zioP.h 2006-12-13 18:26:42.000000000 +0100 +++ new/libzio-0.4/zioP.h 2006-12-20 19:06:57.000000000 +0100 @@ -4,6 +4,7 @@ * Making the used libz and bzlib functions weak symbols. * * Copyright 2004 Werner Fink, 2004 SuSE LINUX AG, Germany. + * Copyright 2006 Werner Fink, 2006 SuSE Products GmbH, Germany. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,25 +29,6 @@ #include <unistd.h> #include <stdlib.h> #include <errno.h> -#include <zlib.h> - -extern gzFile gzopen __P ((const char*, const char*)) __attribute__((weak)); -extern int gzread __P ((gzFile, voidp, unsigned)) __attribute__((weak)); -#ifdef ZLIB_VERNUM -extern int gzwrite __P ((gzFile, voidpc, unsigned)) __attribute__((weak)); -#else -extern int gzwrite __P ((gzFile, const voidp, unsigned)) __attribute__((weak)); -#endif -extern z_off_t gzseek __P ((gzFile, z_off_t, int)) __attribute__((weak)); -extern int gzclose __P ((gzFile)) __attribute__((weak)); - -#include <bzlib.h> - -extern BZFILE* BZ2_bzopen __P ((const char *path, const char *mode)) __attribute__((weak)); -extern int BZ2_bzread __P ((BZFILE*, void*, int)) __attribute__((weak)); -extern int BZ2_bzwrite __P ((BZFILE*, void*, int)) __attribute__((weak)); -extern int BZ2_bzflush __P ((BZFILE*)) __attribute__((weak)); -extern void BZ2_bzclose __P ((BZFILE*)) __attribute__((weak)); #if defined __GLIBC__ && __GLIBC__ > 1 # undef LIBIO_IS_FIXED @@ -54,15 +36,44 @@ # define LIBIO_IS_FIXED # endif #else -# error libzio requires glibc +# error The libzio requires the GLIBC #endif +#if defined __GNUC__ +# if defined __USE_ISOC99 +# define _cat_pragma(exp) _Pragma(#exp) +# define _weak_pragma(exp) _cat_pragma(weak name) +# else +# define _weak_pragma(exp) +# endif +# define _declare(name) __extension__ extern __typeof__(name) name +# define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak)) +#else +# error The libzio requires the GCC +#endif + +#include <zlib.h> + +weak_symbol(gzopen); +weak_symbol(gzread); +weak_symbol(gzwrite); +weak_symbol(gzseek); +weak_symbol(gzclose); + +#include <bzlib.h> + +weak_symbol(BZ2_bzopen); +weak_symbol(BZ2_bzread); +weak_symbol(BZ2_bzwrite); +weak_symbol(BZ2_bzflush); +weak_symbol(BZ2_bzclose); + #ifndef LIBIO_IS_FIXED -typedef _IO_cookie_io_functions_t cookie_io_functions_t; -typedef ssize_t cookie_read_function_t __P ((void *, char *, size_t)); -typedef ssize_t cookie_write_function_t __P ((void *, const char *, size_t)); -typedef int cookie_seek_function_t __P ((void *, off_t, int)); -typedef int cookie_close_function_t __P ((void *)); +__extension__ typedef _IO_cookie_io_functions_t cookie_io_functions_t; +__extension__ typedef ssize_t cookie_read_function_t __P ((void *, char *, size_t)); +__extension__ typedef ssize_t cookie_write_function_t __P ((void *, const char *, size_t)); +__extension__ typedef int cookie_seek_function_t __P ((void *, off_t, int)); +__extension__ typedef int cookie_close_function_t __P ((void *)); #endif #endif /* _ZIO_P_H */ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@suse.de