From fa33aba6325a51bf988887796ab5bd5d83b69bb9 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sun, 18 Mar 2007 16:31:43 +0000 Subject: [PATCH] updates (.) --- ChangeLog | 5 + Makefile.am | 3 + Makefile.in | 3 + configure | 242 ++++++++++++- configure.ac | 6 +- docs/Makefile.in | 6 +- m4/ac_compile_check_sizeof.m4 | 2 + m4/ac_set_default_paths_system.m4 | 4 +- m4/ac_sys_largefile_sensitive.m4 | 4 +- m4/acx_restrict.m4 | 18 +- m4/ax_cflags_gcc_option.m4 | 22 +- m4/ax_cflags_no_writable_strings.m4 | 21 +- m4/ax_cflags_strict_prototypes.m4 | 23 +- m4/ax_cflags_warn_all.m4 | 11 +- m4/ax_check_aligned_access_required.m4 | 2 + m4/ax_configure_args.m4 | 2 + m4/ax_create_pkgconfig_info.m4 | 6 +- m4/ax_enable_builddir_uname.m4 | 4 +- m4/ax_expand_prefix.m4 | 4 +- m4/ax_maintainer_mode_auto_silent.m4 | 4 +- m4/ax_not_enable_frame_pointer.m4 | 18 +- m4/ax_prefix_config_h.m4 | 23 +- m4/ax_set_version_info.m4 | 4 +- m4/ax_spec_file.m4 | 4 +- m4/ax_spec_package_version.m4 | 4 +- m4/ax_warning_default_aclocaldir.m4 | 4 +- m4/ax_warning_default_pkgconfig.m4 | 4 +- m4/patch_libtool_on_darwin_zsh_overquoting.m4 | 4 +- m4/patch_libtool_sys_lib_search_path_spec.m4 | 6 +- m4/patch_libtool_to_add_host_cc.m4 | 4 +- zzip/Makefile.am | 49 ++- zzip/Makefile.in | 48 ++- zzip/dir.c | 4 +- zzip/err.c | 317 +++++++++--------- zzip/fetch.c | 43 ++- zzip/file.c | 151 +++++---- zzip/mmapped.c | 4 +- zzip/plugin.c | 2 +- zzip/write.c | 10 +- zzip/zip.c | 55 +-- 40 files changed, 787 insertions(+), 363 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48483bb..72bd989 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-17 + * http://www.securitylab.ru/forum/read.php?FID=21&TID=40858&MID=326187 + zziplib vulnerability due to usage of strcpy + * add indent-check for enforcing some source code style. + 2007-02-01 * remake manpages.ar / htmpages.ar - redistribute zziplib-manpages.ar instead while the rebuild mechanics become a lot simpler diff --git a/Makefile.am b/Makefile.am index b61b5b9..0d8f8cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,9 @@ SUBDIRS = zzip zzipwrap bins test docs @SDL@ rpm2: dist-bzip2 $(PACKAGE).spec rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2 +indent-check: + (cd zzip && $(MAKE) `basename $@`) + doc docs docu clean-doc clean-docs clean-docu zzip.html zzip.xml zzip.pdf \ man mans manpages htmpages unpack clean-unpack changes.htm pdfs \ omf install-omf install-doc install-docs install-sf install-man3 install-mans : diff --git a/Makefile.in b/Makefile.in index 141170d..9447846 100644 --- a/Makefile.in +++ b/Makefile.in @@ -707,6 +707,9 @@ uninstall-info: uninstall-info-recursive rpm2: dist-bzip2 $(PACKAGE).spec rpmbuild -ta $(PACKAGE)-$(VERSION).tar.bz2 +indent-check: + (cd zzip && $(MAKE) `basename $@`) + doc docs docu clean-doc clean-docs clean-docu zzip.html zzip.xml zzip.pdf \ man mans manpages htmpages unpack clean-unpack changes.htm pdfs \ omf install-omf install-doc install-docs install-sf install-man3 install-mans : diff --git a/configure b/configure index 91e5288..a40d017 100755 --- a/configure +++ b/configure @@ -20777,10 +20777,8 @@ test -d zzip || mkdir zzip sed -f $srcdir/zzip/_msvc.sed $srcdir/config.h.in >zzip/_msvc.in ac_config_headers="$ac_config_headers config.h" - ac_config_commands="$ac_config_commands zzip/_config.h" - ac_config_commands="$ac_config_commands zzip/_msvc.h" { echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -24637,7 +24635,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # puts them into .rodata, but they are copied later. # need to be "-G0 -rdatashared" for strictmode but # I am not sure what effect that has really. - guidod -for ac_arg in "-Wall % -fno-writable-strings -Wwrite-strings" "-v -Xc % -xstrconst" "+w1 -Aa % +ESlit" "-w0 -std1 % -readonly_strings" "-fullwarn -use_readonly_const %% ok, its the default" # +for ac_arg in "-pedantic % -fno-writable-strings -Wwrite-strings" "-pedantic % -fconst-strings -Wwrite-strings" "-v -Xc % -xstrconst" "+w1 -Aa % +ESlit" "-w0 -std1 % -readonly_strings" "-fullwarn -use_readonly_const %% ok, its the default" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -24688,7 +24686,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_cflags_no_writable_strings=`echo $ac_arg | sed -e 's,.*% *,,'` ; break + ac_cv_cflags_no_writable_strings=`echo $ac_arg | -e 's,.*% *,,'` ; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -24812,7 +24810,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-Wall % -fstrict-prototypes -Wstrict-prototypes" "-Wall % -Wstrict-prototypes" # +for ac_arg in "-pedantic % -fstrict-prototypes -Wstrict-prototypes" "-pedantic % -Wstrict-prototypes" "-pedantic % -Wmissing-prototypes" "-pedantic % -Werror-implicit-function-declaration" "-pedantic % -Wimplicit-function-declaration" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -24988,7 +24986,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic % -Wpointer-arith" # +for ac_arg in "-pedantic -Werror % -Wpointer-arith" "-pedantic % -Wpointer-arith %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25094,7 +25092,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic % -Wsign-compare" # +for ac_arg in "-pedantic -Werror % -Wsign-compare" "-pedantic % -Wsign-compare %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25200,7 +25198,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" -for ac_arg in "-pedantic % -Wmissing-declarations" # +for ac_arg in "-pedantic -Werror % -Wmissing-declarations" "-pedantic % -Wmissing-declarations %% no, obsolete" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25292,6 +25290,218 @@ case ".$ac_cv_cflags_gcc_option__Wmissing_declarations" in ;; esac +{ echo "$as_me:$LINENO: checking CFLAGS for gcc -Wdeclaration-after-statement" >&5 +echo $ECHO_N "checking CFLAGS for gcc -Wdeclaration-after-statement... $ECHO_C" >&6; } +if test "${ac_cv_cflags_gcc_option__Wdeclaration_after_statement+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_cflags_gcc_option__Wdeclaration_after_statement="no, unknown" + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_save_CFLAGS="$CFLAGS" +for ac_arg in "-pedantic -Werror % -Wdeclaration-after-statement" "-pedantic % -Wdeclaration-after-statement %% no, obsolete" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_cflags_gcc_option__Wdeclaration_after_statement=`echo $ac_arg | sed -e 's,.*% *,,'` ; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done + CFLAGS="$ac_save_CFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&5 +echo "${ECHO_T}$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&6; } +case ".$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wdeclaration_after_statement " 2>&1 >/dev/null + then { (echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wdeclaration_after_statement) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + else { (echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" + fi + ;; +esac + +{ echo "$as_me:$LINENO: checking CFLAGS for gcc -Werror-implicit-function-declaration" >&5 +echo $ECHO_N "checking CFLAGS for gcc -Werror-implicit-function-declaration... $ECHO_C" >&6; } +if test "${ac_cv_cflags_gcc_option__Werror_implicit_function_declaration+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_cflags_gcc_option__Werror_implicit_function_declaration="no, unknown" + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_save_CFLAGS="$CFLAGS" +for ac_arg in "-pedantic -Werror % -Werror-implicit-function-declaration" "-pedantic % -Werror-implicit-function-declaration %% no, obsolete" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_cflags_gcc_option__Werror_implicit_function_declaration=`echo $ac_arg | sed -e 's,.*% *,,'` ; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done + CFLAGS="$ac_save_CFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&5 +echo "${ECHO_T}$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" >&6; } +case ".$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" in + .ok|.ok,*) ;; + .|.no|.no,*) ;; + *) + if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration " 2>&1 >/dev/null + then { (echo "$as_me:$LINENO: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") >&5 + (: CFLAGS does contain $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + else { (echo "$as_me:$LINENO: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Werror_implicit_function_declaration\"") >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Werror_implicit_function_declaration" + fi + ;; +esac + # --------------------------------------------------------------- # The prefix default can be set in configure.ac (otherwise it is /usr/local) test "x$prefix" = xNONE && prefix=$ac_default_prefix @@ -27213,12 +27423,12 @@ else { echo "$as_me:$LINENO: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&5 echo "$as_me: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&6;} if test -f $ac_prefix_conf_INP ; then - echo "s/#undef *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix - echo "s/#undef *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix - echo "s/#define *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1 \\" >> conftest.prefix + echo "s/^#undef *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix + echo "s/^#undef *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix + echo "s/^#define *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1 \\" >> conftest.prefix echo "#define $ac_prefix_conf_UPP""_\\1 \\2 \\" >> conftest.prefix echo "#endif/" >>conftest.prefix - echo "s/#define *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1 \\" >> conftest.prefix + echo "s/^#define *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1 \\" >> conftest.prefix echo "#define $ac_prefix_conf_LOW""_\\1 \\2 \\" >> conftest.prefix echo "#endif/" >> conftest.prefix # now executing _script on _DEF input to create _OUT output file @@ -27347,12 +27557,12 @@ else { echo "$as_me:$LINENO: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&5 echo "$as_me: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&6;} if test -f $ac_prefix_conf_INP ; then - echo "s/#undef *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix - echo "s/#undef *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix - echo "s/#define *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1 \\" >> conftest.prefix + echo "s/^#undef *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix + echo "s/^#undef *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix + echo "s/^#define *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1 \\" >> conftest.prefix echo "#define $ac_prefix_conf_UPP""_\\1 \\2 \\" >> conftest.prefix echo "#endif/" >>conftest.prefix - echo "s/#define *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1 \\" >> conftest.prefix + echo "s/^#define *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1 \\" >> conftest.prefix echo "#define $ac_prefix_conf_LOW""_\\1 \\2 \\" >> conftest.prefix echo "#endif/" >> conftest.prefix # now executing _script on _DEF input to create _OUT output file diff --git a/configure.ac b/configure.ac index 60dad54..1e9521f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT(zziplib.spec) AC_PREREQ(2.49) AC_COPYRIGHT([Guido Draheim for ZZipLib.SF.net]) -AC_REVISION($Revision: 1.8 $) +AC_REVISION($Revision: 1.9 $) AC_CONFIG_AUX_DIR(uses) # ======================================================================= AC_CANONICAL_SYSTEM @@ -75,7 +75,7 @@ AX_SET_VERSION_INFO AC_MSG_RESULT([creating zzip/_msvc.in via zzip/_msvc.sed of config.h.in]) test -d zzip || mkdir zzip sed -f $srcdir/zzip/_msvc.sed $srcdir/config.h.in >zzip/_msvc.in -AC_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS([config.h]) AX_PREFIX_CONFIG_H([zzip/_config.h],[zzip],[config.h]) AX_PREFIX_CONFIG_H([zzip/_msvc.h],[zzip],[zzip/_msvc.in]) AM_MAINTAINER_MODE @@ -297,6 +297,8 @@ AX_CFLAGS_STRICT_PROTOTYPES AX_CFLAGS_GCC_OPTION(-Wpointer-arith) AX_CFLAGS_GCC_OPTION(-Wsign-compare) AX_CFLAGS_GCC_OPTION(-Wmissing-declarations) +AX_CFLAGS_GCC_OPTION(-Wdeclaration-after-statement) +AX_CFLAGS_GCC_OPTION(-Werror-implicit-function-declaration) # --------------------------------------------------------------- AX_ENABLE_DEFAULT_PKGCONFIGDIR AX_ENABLE_DEFAULT_ACLOCALDIR diff --git a/docs/Makefile.in b/docs/Makefile.in index e6bd421..5e9ef72 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -494,7 +494,7 @@ install-sf: rm -r /tmp/zziplib-htdocs-$$USER/ # ------------------------------------------------------------ package manpages -mans : man3 +mans : manpages install-mans : install-man3 man3 man manpages : manpages.ar @@ -516,8 +516,8 @@ manpages.ar : zziplib.xml zzipmmapped.xml zzipfseeko.xml ; $(XMLTO) -o man3 man zzipfseeko.xml \ ; echo 'ar qc "$@" man3/*.3' \ ; ar qc "$@" man3/*.3 \ - ; echo '$(DELETE); rm man/*.3 ; rmdir man' \ - ; $(DELETE); rm man/*.3 ; rmdir man \ + ; echo '$(DELETE); rm man3/*.3 ; rmdir man3' \ + ; $(DELETE); rm man3/*.3 ; rmdir man3 \ ; fi ; true @ if test -s $@ \ ; then echo cp $@ zziplib-$@ "(saved)"; cp $@ zziplib-$@ \ diff --git a/m4/ac_compile_check_sizeof.m4 b/m4/ac_compile_check_sizeof.m4 index fbdb534..a1cdb40 100644 --- a/m4/ac_compile_check_sizeof.m4 +++ b/m4/ac_compile_check_sizeof.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/ac-archive-cvs/ac_compile_check_sizeof.m4 dnl @synopsis AC_COMPILE_CHECK_SIZEOF(TYPE [, HEADERS [, EXTRA_SIZES...]]) dnl dnl This macro checks for the size of TYPE using compile checks, not @@ -76,3 +77,4 @@ AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) undefine([AC_TYPE_NAME])dnl undefine([AC_CV_NAME])dnl ]) + diff --git a/m4/ac_set_default_paths_system.m4 b/m4/ac_set_default_paths_system.m4 index 6c20148..e2cc5aa 100644 --- a/m4/ac_set_default_paths_system.m4 +++ b/m4/ac_set_default_paths_system.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ac_set_default_paths_system.m4 dnl @synopsis AC_SET_DEFAULT_PATHS_SYSTEM dnl dnl the most interesting changes go about windows-targets - where the @@ -10,7 +11,7 @@ dnl which is either defined as being prefix or datadir. not SUBSTed dnl here. dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2001-08-25 dnl @license GPLWithACException @@ -102,3 +103,4 @@ esac AC_MSG_RESULT($result) # -------------------------------------------------------- ]) + diff --git a/m4/ac_sys_largefile_sensitive.m4 b/m4/ac_sys_largefile_sensitive.m4 index 6116b82..403c5a5 100644 --- a/m4/ac_sys_largefile_sensitive.m4 +++ b/m4/ac_sys_largefile_sensitive.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ac_sys_largefile_sensitive.m4 dnl @synopsis AC_SYS_LARGEFILE_SENSITIVE dnl dnl checker whether the current system is sensitive to -Ddefines making @@ -28,7 +29,7 @@ dnl macro, otherwise you want to export a renamed LARGEFILE_SENSITIVE dnl in an installed header file. -> see AX_PREFIX_CONFIG_H dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2003-02-02 dnl @license GPLWithACException @@ -44,3 +45,4 @@ then ac_cv_sys_largefile_sensitive="yes" fi AC_MSG_RESULT([$ac_cv_sys_largefile_sensitive]) ]) + diff --git a/m4/acx_restrict.m4 b/m4/acx_restrict.m4 index 959c250..d5a9562 100644 --- a/m4/acx_restrict.m4 +++ b/m4/acx_restrict.m4 @@ -1,13 +1,18 @@ +dnl /usr/share/aclocal/ac-archive-cvs/acx_restrict.m4 dnl @synopsis ACX_C_RESTRICT dnl -dnl This macro determines whether the C compiler supports the "restrict" -dnl keyword introduced in ANSI C99, or an equivalent. Does nothing if -dnl the compiler accepts the keyword. Otherwise, if the compiler supports -dnl an equivalent (like gcc's __restrict__) defines "restrict" to be that. -dnl Otherwise, defines "restrict" to be empty. +dnl @obsoleted Replaced by AC_C_RESTRICT in Autoconf 2.58 dnl -dnl @version $Id: acx_restrict.m4,v 1.1 2005-12-09 07:47:34 guidod Exp $ +dnl This macro determines whether the C compiler supports the +dnl "restrict" keyword introduced in ANSI C99, or an equivalent. Does +dnl nothing if the compiler accepts the keyword. Otherwise, if the +dnl compiler supports an equivalent (like gcc's __restrict__) defines +dnl "restrict" to be that. Otherwise, defines "restrict" to be empty. +dnl +dnl @category Obsolete dnl @author Steven G. Johnson +dnl @version 2005-05-31 +dnl @license GPLWithACException AC_DEFUN([ACX_C_RESTRICT], [AC_CACHE_CHECK([for C restrict keyword], acx_cv_c_restrict, @@ -30,3 +35,4 @@ AC_DEFUN([ACX_C_RESTRICT], AC_DEFINE_UNQUOTED(restrict, $acx_kw, [Define to equivalent of C99 restrict keyword, or to nothing if this is not supported. Do not define if restrict is supported directly.]) fi ]) + diff --git a/m4/ax_cflags_gcc_option.m4 b/m4/ax_cflags_gcc_option.m4 index dcd8579..c8a6411 100644 --- a/m4/ax_cflags_gcc_option.m4 +++ b/m4/ax_cflags_gcc_option.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_cflags_gcc_option.m4 dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]]) dnl dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like @@ -40,8 +41,8 @@ dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION dnl dnl @category C -dnl @author Guido Draheim -dnl @version 2003-11-04 +dnl @author Guido U. Draheim +dnl @version 2006-12-12 dnl @license GPLWithACException AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl @@ -53,7 +54,8 @@ VAR,[VAR="no, unknown" AC_LANG_C ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC +in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC + "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -85,10 +87,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE - AC_LANG_CXX + AC_LANG_CPLUSPLUS ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC +in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC + "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -122,7 +125,8 @@ VAR,[VAR="no, unknown" AC_LANG_C ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC +in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC + "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -154,10 +158,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE - AC_LANG_CXX + AC_LANG_CPLUSPLUS ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC +in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC + "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -185,3 +190,4 @@ AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, [AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])]) + diff --git a/m4/ax_cflags_no_writable_strings.m4 b/m4/ax_cflags_no_writable_strings.m4 index e13ec09..d39d58a 100644 --- a/m4/ax_cflags_no_writable_strings.m4 +++ b/m4/ax_cflags_no_writable_strings.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_cflags_no_writable_strings.m4 dnl @synopsis AX_CFLAGS_NO_WRITABLE_STRINGS [(shellvar [,default, [A/NA]])] dnl dnl Try to find a compiler option that makes all stringliteral @@ -19,8 +20,8 @@ dnl - $3 action-if-found : add value to shellvariable dnl - $4 action-if-not-found : nothing dnl dnl @category C -dnl @author Guido Draheim -dnl @version 2003-05-21 +dnl @author Guido U. Draheim +dnl @version 2006-12-12 dnl @license GPLWithACException AC_DEFUN([AX_CFLAGS_NO_WRITABLE_STRINGS],[dnl @@ -37,7 +38,8 @@ VAR,[VAR="no, unknown" # need to be "-G0 -rdatashared" for strictmode but # I am not sure what effect that has really. - guidod for ac_arg dnl -in "-Wall % -fno-writable-strings -Wwrite-strings" dnl GCC +in "-pedantic % -fno-writable-strings -Wwrite-strings" dnl GCC + "-pedantic % -fconst-strings -Wwrite-strings" dnl newer GCC "-v -Xc % -xstrconst" dnl Solaris C - strings go into readonly segment "+w1 -Aa % +ESlit" dnl HP-UX C - strings go into readonly segment "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment @@ -45,7 +47,7 @@ in "-Wall % -fno-writable-strings -Wwrite-strings" dnl GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) + [VAR=`echo $ac_arg | -e 's,.*% *,,'` ; break]) done case ".$VAR" in .|.no|.no,*) ;; @@ -88,7 +90,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_no_writable_strings])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) making strings readonly], VAR,[VAR="no, unknown" AC_LANG_SAVE - AC_LANG_CXX + AC_LANG_CPLUSPLUS ac_save_[]FLAGS="$[]FLAGS" # IRIX C compiler: # -use_readonly_const is the default for IRIX C, @@ -96,7 +98,9 @@ VAR,[VAR="no, unknown" # need to be "-G0 -rdatashared" for strictmode but # I am not sure what effect that has really. - guidod for ac_arg dnl -in "-Wall % -fno-writable-strings -Wwrite-strings" dnl GCC +in "-pedantic -Werror % -fno-writable-strings -Wwrite-strings" dnl GCC + "-pedantic -Werror % -fconst-strings -Wwrite-strings" dnl newer GCC + "-pedantic % -fconst-strings %% no, const-strings is default" dnl newer GCC "-v -Xc % -xstrconst" dnl Solaris C - strings go into readonly segment "+w1 -Aa % +ESlit" dnl HP-UX C - strings go into readonly segment "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment @@ -110,9 +114,9 @@ case ".$VAR" in .|.no|.no,*) ;; *) # sanity check - testing strcpy() from string.h cp config.log config.tmp - AC_TRY_COMPILE([#include ],[[ + AC_TRY_COMPILE([#include ],[ char test[16]; - if (strcpy (test, "test")) return 1;]], + if (strcpy (test, "test")) return 1;], dnl the original did use test -n `$CC testprogram.c` [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0 then VAR="no, suppressed, string.h," ; fi], @@ -138,3 +142,4 @@ esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) + diff --git a/m4/ax_cflags_strict_prototypes.m4 b/m4/ax_cflags_strict_prototypes.m4 index 518c247..bd19c17 100644 --- a/m4/ax_cflags_strict_prototypes.m4 +++ b/m4/ax_cflags_strict_prototypes.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_cflags_strict_prototypes.m4 dnl @synopsis AX_CFLAGS_STRICT_PROTOTYPES [(shellvar [,default, [A/NA]] dnl dnl Try to find a compiler option that requires strict prototypes. @@ -20,8 +21,8 @@ dnl - $3 action-if-found : add value to shellvariable dnl - $4 action-if-not-found : nothing dnl dnl @category C -dnl @author Guido Draheim -dnl @version 2003-05-21 +dnl @author Guido U. Draheim +dnl @version 2006-12-12 dnl @license GPLWithACException AC_DEFUN([AX_CFLAGS_STRICT_PROTOTYPES],[dnl @@ -33,8 +34,11 @@ VAR,[VAR="no, unknown" AC_LANG_C ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-Wall % -fstrict-prototypes -Wstrict-prototypes" dnl GCC - "-Wall % -Wstrict-prototypes" dnl try to warn atleast +in "-pedantic % -fstrict-prototypes -Wstrict-prototypes" dnl GCC + "-pedantic % -Wstrict-prototypes" dnl try to warn atleast + "-pedantic % -Wmissing-prototypes" dnl or another warning + "-pedantic % -Werror-implicit-function-declaration" dnl + "-pedantic % -Wimplicit-function-declaration" dnl # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -82,11 +86,15 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_strict_prototypes])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for strict prototypes], VAR,[VAR="no, unknown" AC_LANG_SAVE - AC_LANG_CXX + AC_LANG_CPLUSPLUS ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl -in "-Wall % -fstrict-prototypes -Wstrict-prototypes" dnl GCC - "-Wall % -Wstrict-prototypes" dnl try to warn atleast +in "-pedantic -Werror % -fstrict-prototypes -Wstrict-prototypes" dnl GCC + "-pedantic -Werror % -Wstrict-prototypes" dnl try to warn atleast + "-pedantic -Werror % -Wmissing-prototypes" dnl try to warn atleast + "-pedantic -Werror % -Werror-implicit-function-declaration" dnl + "-pedantic -Werror % -Wimplicit-function-declaration" dnl + "-pedantic % -Wstrict-prototypes %% no, unsupported in C++" dnl oops # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_TRY_COMPILE([],[return 0;], @@ -125,3 +133,4 @@ esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) + diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4 index fa9bf30..15b3f39 100644 --- a/m4/ax_cflags_warn_all.m4 +++ b/m4/ax_cflags_warn_all.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_cflags_warn_all.m4 dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] dnl dnl Try to find a compiler option that enables most reasonable @@ -19,8 +20,8 @@ dnl - $3 action-if-found : add value to shellvariable dnl - $4 action-if-not-found : nothing dnl dnl @category C -dnl @author Guido Draheim -dnl @version 2003-01-06 +dnl @author Guido U. Draheim +dnl @version 2006-12-12 dnl @license GPLWithACException AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl @@ -72,7 +73,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" AC_LANG_SAVE - AC_LANG_CXX + AC_LANG_CPLUSPLUS ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % -Wall" dnl GCC @@ -115,4 +116,6 @@ dnl compilers will fail about it. That was needed since a lot of dnl compilers will give false positives for some option-syntax dnl like -Woption or -Xoption as they think of it is a pass-through dnl to later compile stages or something. The "%" is used as a -dnl delimimiter. A non-option comment can be given after "%%" marks. +dnl delimimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. + diff --git a/m4/ax_check_aligned_access_required.m4 b/m4/ax_check_aligned_access_required.m4 index 18b4056..28a9730 100644 --- a/m4/ax_check_aligned_access_required.m4 +++ b/m4/ax_check_aligned_access_required.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_check_aligned_access_required.m4 dnl @synopsis AC_CHECK_ALIGNED_ACCESS_REQUIRED dnl dnl While the x86 CPUs allow access to memory objects to be unaligned @@ -47,3 +48,4 @@ if test "$ax_cv_have_aligned_access_required" = yes ; then [Define if pointers to integers require aligned access]) fi ]) + diff --git a/m4/ax_configure_args.m4 b/m4/ax_configure_args.m4 index 6c2dc42..597b6b0 100644 --- a/m4/ax_configure_args.m4 +++ b/m4/ax_configure_args.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_configure_args.m4 dnl @synopsis AX_CONFIGURE_ARGS dnl dnl Helper macro for AX_ENABLE_BUILDDIR and AX_ENABLE_BUILDDIR_UNAME @@ -32,3 +33,4 @@ AC_DEFUN([AX_CONFIGURE_ARGS],[ done fi ]) + diff --git a/m4/ax_create_pkgconfig_info.m4 b/m4/ax_create_pkgconfig_info.m4 index 7cf6c2c..4347bd5 100644 --- a/m4/ax_create_pkgconfig_info.m4 +++ b/m4/ax_create_pkgconfig_info.m4 @@ -1,3 +1,5 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_create_pkgconfig_info.m4 +dnl ______ /usr/share/aclocal/guidod-cvs/ax_create_pkgconfig_info.m4 ______ dnl @synopsis AX_CREATE_PKGCONFIG_INFO [(outputfile, [requires [,libs [,summary [,cflags [, ldflags]]]]])] dnl dnl defaults: @@ -22,7 +24,7 @@ dnl whole project. dnl dnl @category InstalledPackages dnl @author Sven Verdoolaege -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2003-10-19 dnl @license GPLWithACException @@ -310,3 +312,5 @@ AS_VAR_POPDEF([PKGCONFIG_generate])dnl AS_VAR_POPDEF([PKGCONFIG_src_libdir])dnl AS_VAR_POPDEF([PKGCONFIG_src_headers])dnl ]) + + diff --git a/m4/ax_enable_builddir_uname.m4 b/m4/ax_enable_builddir_uname.m4 index eca3904..df5e263 100644 --- a/m4/ax_enable_builddir_uname.m4 +++ b/m4/ax_enable_builddir_uname.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_enable_builddir_uname.m4 dnl @synopsis AX_ENABLE_BUILDDIR_UNAME [(dirstring-or-command [,Makefile.mk])] dnl dnl if the current configure was run within the srcdir then we move all @@ -40,7 +41,7 @@ dnl reason of convenience. dnl dnl @category Misc dnl @author Guido U. Draheim -dnl @version 2007-02-01 +dnl @version 2005-12-03 dnl @license GPLWithACException AC_DEFUN([AX_ENABLE_BUILDDIR_UNAME],[ @@ -160,3 +161,4 @@ ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED ax_enable_builddir="$ax_enable_builddir" # $SUB ])dnl ]) + diff --git a/m4/ax_expand_prefix.m4 b/m4/ax_expand_prefix.m4 index 95407ce..2d6b39d 100644 --- a/m4/ax_expand_prefix.m4 +++ b/m4/ax_expand_prefix.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_expand_prefix.m4 dnl @synopsis AX_EXPAND_PREFIX dnl dnl when $prefix and $exec_prefix are still set to NONE then set them @@ -21,7 +22,7 @@ dnl explicit instead. Probably, any command to compute installation dnl directories should be run _after_ AM_INIT_AUTOMAKE dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -31,3 +32,4 @@ AC_DEFUN([AX_EXPAND_PREFIX],[dnl # Let make expand exec_prefix. Allows to override the makevar 'prefix' later test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ]) + diff --git a/m4/ax_maintainer_mode_auto_silent.m4 b/m4/ax_maintainer_mode_auto_silent.m4 index de6c41e..3f4123b 100644 --- a/m4/ax_maintainer_mode_auto_silent.m4 +++ b/m4/ax_maintainer_mode_auto_silent.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_maintainer_mode_auto_silent.m4 dnl @synopsis AX_MAINTAINER_MODE_AUTO_SILENT dnl dnl Set autotools to error/sleep settings so that they are not run when @@ -14,7 +15,7 @@ dnl I did not put an AC-REQUIRE(MAINTAINER_MODE) in here - should I? dnl dnl @category Misc dnl @category Automake -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -36,3 +37,4 @@ else AC_MSG_RESULT([no]) fi ]) + diff --git a/m4/ax_not_enable_frame_pointer.m4 b/m4/ax_not_enable_frame_pointer.m4 index 94be736..7499962 100644 --- a/m4/ax_not_enable_frame_pointer.m4 +++ b/m4/ax_not_enable_frame_pointer.m4 @@ -1,14 +1,15 @@ - -dnl ______ /usr/share/aclocal/guidod/ax_not_enable_frame_pointer.m4 ______ +dnl /usr/share/aclocal/guidod-cvs/ax_not_enable_frame_pointer.m4 dnl @synopsis AX_NOT_ENABLE_FRAME_POINTER ([shellvar]) dnl dnl add --enable-frame-pointer option, the default will add the gcc dnl --fomit-frame-pointer option to the shellvar (per default CFLAGS) -dnl and remove the " -g " debuginfo option from it. In other words, -dnl the default is "--disable-frame-pointer" +dnl and remove the " -g " debuginfo option from it. In other words, the +dnl default is "--disable-frame-pointer" dnl -dnl @author guidod@gmx.de -dnl @version 2004-11-30 +dnl @category C +dnl @author Guido U. Draheim +dnl @version 2005-01-22 +dnl @license GPLWithACException AC_DEFUN([AX_NOT_ENABLE_FRAME_POINTER],[dnl AS_VAR_PUSHDEF([VAR],[enable_frame_pointer])dnl @@ -20,8 +21,8 @@ case ".$VAR" in m4_ifval($1,$1,CFLAGS)=`echo dnl " $m4_ifval($1,$1,CFLAGS) " | sed -e 's/ -g / /'` if test ".$GCC" = ".yes" ; then - m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) -fomit-frame-pointer" - AC_MSG_RESULT([$VAR, -fomit-frame-pointer added]) + m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) -fomit-frame-pointer" + AC_MSG_RESULT([$VAR, -fomit-frame-pointer added]) else AC_MSG_RESULT([$VAR, -g removed]) fi ;; @@ -29,3 +30,4 @@ case ".$VAR" in esac AS_VAR_POPDEF([VAR])dnl ]) + diff --git a/m4/ax_prefix_config_h.m4 b/m4/ax_prefix_config_h.m4 index efd8bad..732cbd5 100644 --- a/m4/ax_prefix_config_h.m4 +++ b/m4/ax_prefix_config_h.m4 @@ -82,10 +82,11 @@ dnl #define _testpkg_const const dnl #endif dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2003-07-03 dnl @license GPLWithACException -AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER]) +AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl +AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl @@ -128,12 +129,12 @@ else fi fi AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines) if test -f $_INP ; then - echo "s/@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script - echo "s/@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script - echo "s/@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script + echo "s/^@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script + echo "s/^@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script + echo "s/^@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script echo "@%:@endif/" >>_script - echo "s/@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script + echo "s/^@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script echo "@%:@endif/" >> _script # now executing _script on _DEF input to create _OUT output file @@ -169,3 +170,13 @@ AS_VAR_POPDEF([_PKG])dnl AS_VAR_POPDEF([_DEF])dnl AS_VAR_POPDEF([_OUT])dnl ],[PACKAGE="$PACKAGE"])]) + +dnl implementation note: a bug report (31.5.2005) from Marten Svantesson points +dnl out a problem where `echo "\1"` results in a Control-A. The unix standard +dnl http://www.opengroup.org/onlinepubs/000095399/utilities/echo.html +dnl defines all backslash-sequences to be inherently non-portable asking +dnl for replacement mit printf. Some old systems had problems with that +dnl one either. However, the latest libtool (!) release does export an $ECHO +dnl (and $echo) that does the right thing - just one question is left: what +dnl was the first version to have it? Is it greater 2.58 ? + diff --git a/m4/ax_set_version_info.m4 b/m4/ax_set_version_info.m4 index 742b6c1..83c5fa7 100644 --- a/m4/ax_set_version_info.m4 +++ b/m4/ax_set_version_info.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_set_version_info.m4 dnl @synopsis AX_SET_VERSION_INFO [(VERSION [,PREFIX])] dnl @synopsis default $1 = $PACKAGE_VERSION dnl @synopsis default $2 = @@ -60,7 +61,7 @@ dnl TEST_MAJOR_VERSION=2... and of course $TEST_RELEASE_INFO etc. (for dnl the moment, it needs to be a literal prefix *sigh*) dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -176,3 +177,4 @@ AS_VAR_POPDEF([MICRO])dnl AS_VAR_POPDEF([MINOR])dnl AS_VAR_POPDEF([MAJOR])dnl ]) + diff --git a/m4/ax_spec_file.m4 b/m4/ax_spec_file.m4 index a12955d..c80a75a 100644 --- a/m4/ax_spec_file.m4 +++ b/m4/ax_spec_file.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_spec_file.m4 dnl @synopsis AX_SPEC_FILE [(rpmspecfile [,subdirpath])] dnl dnl set the specfile - if no argument has been given then check whether @@ -11,7 +12,7 @@ dnl dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]]) dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -96,3 +97,4 @@ AC_DEFUN([AX_SPEC_EXTRACT], m4_ifval([$3],[test ".$[]$1" = "." && $1="$3"]) fi # test ".$[]$1" = "." ]) + diff --git a/m4/ax_spec_package_version.m4 b/m4/ax_spec_package_version.m4 index 39766d9..f13b247 100644 --- a/m4/ax_spec_package_version.m4 +++ b/m4/ax_spec_package_version.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_spec_package_version.m4 dnl @synopsis AX_SPEC_PACKAGE_AND_VERSION ([specfile]) dnl @synopsis AX_SPEC_PACKAGE_NAME ([shellvar],[defaultvalue]) dnl @synopsis AX_SPEC_PACKAGE_VERSION ([shellvar],[defaultvalue]) @@ -47,7 +48,7 @@ dnl the final AX_SPEC_INIT(specfile) will initialize all variables to dnl its defaults according to the spec file given. dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -225,3 +226,4 @@ AC_DEFUN([AX_SPEC_DEFAULTS],[ AX_SPEC_PACKAGE_CATEGORY AX_SPEC_PACKAGE_ICON ]) + diff --git a/m4/ax_warning_default_aclocaldir.m4 b/m4/ax_warning_default_aclocaldir.m4 index c53576f..c4cb4aa 100644 --- a/m4/ax_warning_default_aclocaldir.m4 +++ b/m4/ax_warning_default_aclocaldir.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_warning_default_aclocaldir.m4 dnl @synopsis AX_WARNING_DEFAULT_ACLOCALDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])] dnl @synopsis AX_ENABLE_DEFAULT_ACLOCALDIR [(dirvariable [,defsetting])] dnl @@ -28,7 +29,7 @@ dnl user may also override the default on the command line. dnl dnl @category Misc dnl @category Automake -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -111,3 +112,4 @@ AS_VAR_POPDEF([DEF])dnl AS_VAR_POPDEF([DIR])dnl AS_VAR_POPDEF([BIN])dnl ]) + diff --git a/m4/ax_warning_default_pkgconfig.m4 b/m4/ax_warning_default_pkgconfig.m4 index 557588e..f5cdfb3 100644 --- a/m4/ax_warning_default_pkgconfig.m4 +++ b/m4/ax_warning_default_pkgconfig.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/ax_warning_default_pkgconfig.m4 dnl @synopsis AX_WARNING_DEFAULT_PKGCONFIGDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])] dnl @synopsis AX_ENABLE_DEFAULT_PKGCONFIGDIR [(dirvariable [,defsetting])] dnl @@ -27,7 +28,7 @@ dnl default is set to the primary path where `pkg-config` looks for .pc dnl files. The user may also override the default on the command line. dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -125,3 +126,4 @@ AS_VAR_POPDEF([DEF])dnl AS_VAR_POPDEF([DIR])dnl AS_VAR_POPDEF([BIN])dnl ]) + diff --git a/m4/patch_libtool_on_darwin_zsh_overquoting.m4 b/m4/patch_libtool_on_darwin_zsh_overquoting.m4 index 9910014..ecbfc5e 100644 --- a/m4/patch_libtool_on_darwin_zsh_overquoting.m4 +++ b/m4/patch_libtool_on_darwin_zsh_overquoting.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/patch_libtool_on_darwin_zsh_overquoting.m4 dnl @synopsis PATCH_LIBTOOL_ON_DARWIN_ZSH_OVERQUOTING dnl dnl libtool 1.4.x has a bug on darwin where the "zsh" is installed as @@ -15,7 +16,7 @@ dnl replace a sequence of triple-backslash-and-doublequote with dnl single-backslash-and-doublequote. dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2003-03-23 dnl @license GPLWithACException @@ -34,3 +35,4 @@ AC_MSG_RESULT(patching libtool on .so-sharedlib creation (zsh overquoting)) ;; esac ]) + diff --git a/m4/patch_libtool_sys_lib_search_path_spec.m4 b/m4/patch_libtool_sys_lib_search_path_spec.m4 index 1310373..1eadedf 100644 --- a/m4/patch_libtool_sys_lib_search_path_spec.m4 +++ b/m4/patch_libtool_sys_lib_search_path_spec.m4 @@ -1,3 +1,5 @@ +dnl /usr/share/aclocal/guidod-cvs/patch_libtool_sys_lib_search_path_spec.m4 +dnl ______ /usr/share/aclocal/guidod-cvs/patch_libtool_sys_lib_search_path_spec.m4 ______ dnl @synopsis PATCH_LIBTOOL_SYS_LIB_SEARCH_PATH_SPEC dnl dnl Cross-compiling to win32 from a unix system reveals a bug - the @@ -18,7 +20,7 @@ dnl $PATH_SEPARATOR in the first place as the original path delimiter dnl that will be scanned for and replaced into spaces. dnl dnl @category Misc -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -35,3 +37,5 @@ AC_MSG_RESULT(patching libtool to fix sys_lib_search_path_spec) fi fi ]) + + diff --git a/m4/patch_libtool_to_add_host_cc.m4 b/m4/patch_libtool_to_add_host_cc.m4 index 22b45ca..04c06e3 100644 --- a/m4/patch_libtool_to_add_host_cc.m4 +++ b/m4/patch_libtool_to_add_host_cc.m4 @@ -1,3 +1,4 @@ +dnl /usr/share/aclocal/guidod-cvs/patch_libtool_to_add_host_cc.m4 dnl @synopsis PATCH_LIBTOOL_TO_ADD_HOST_CC dnl dnl The libtool 1.4.x processing (and patched 1.3.5) uses a little @@ -38,7 +39,7 @@ dnl for maximum compatibility and portability. dnl dnl @category Misc dnl @category C -dnl @author Guido Draheim +dnl @author Guido U. Draheim dnl @version 2005-01-21 dnl @license GPLWithACException @@ -62,3 +63,4 @@ HOST_CC=$HOST_CC" libtool >libtool.new fi fi ]) + diff --git a/zzip/Makefile.am b/zzip/Makefile.am index 3ec2c7b..6e1fe89 100644 --- a/zzip/Makefile.am +++ b/zzip/Makefile.am @@ -62,7 +62,7 @@ WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt EXTRA_DIST = $(WCC10_DIST) _msvc.sed CONFIG_CLEAN_FILES = _config.h MAINTAINERCLEANFILES = _msvc.h -CLEANFILES = $(WCC10_CLEAN) *.pc *.omf +CLEANFILES = $(WCC10_CLEAN) *.pc *.omf *~ *.tmp *.tmp.* # here is some backward compatibility with version 0.10.* of zziplib install-data-local : install-zzipHEADERS @@ -97,6 +97,53 @@ uninstall-local : (cd $(DESTDIR)$(includedir) && rm zziplib.h zzip.h zzip-io.h) +INDENT = indent +INDENTFLAGS = \ +--blank-lines-after-declarations \ +--blank-lines-after-procedures \ +--blank-lines-before-block-comments \ +--brace-indent0 \ +--braces-after-if-line \ +--case-indentation0 \ +--cuddle-else \ +--space-after-cast \ +--honour-newlines \ +--indent-level4 \ +--line-length80 \ +--continue-at-parentheses \ +--leave-preprocessor-space \ +--dont-break-function-decl-args \ +--dont-cuddle-do-while \ +--dont-format-first-column-comments \ +--no-space-after-function-call-names \ +--no-space-after-parentheses \ +--no-tabs \ +--ignore-profile \ +--procnames-start-lines \ +--space-after-for \ +--space-after-if \ +--space-after-while \ +--space-special-semicolon + +DIFF_U0 = diff -U0 +indent-check: + for file in $(srcdir)/*.c ; do f=`basename "$$file"` \ + ; sed \ + -e "s|\\(if[^{};]*\\)\\(return[^{};];\\)|\\1 { \\2 }|" \ + -e "s|{\\([^{}]\\)*}|(' & ');|" \ + -e "s|___;.*|//&|" $$file > $$f.tmp.2 \ + ; $(INDENT) $(INDENTFLAGS) $(INDENTOPTS) -st "$$f.tmp.2" \ + | sed \ + -e "s|!\\([^ !=)]\\)|! \\1|g" $(INDENTSED) \ + -e "s|(' \\({[^{}]*}\\) ');|\\1|" \ + -e "s|//\\(___;.*\\)|\\1|" $$f.tmp.2 > $$f.tmp \ + ; $(DIFF_U0) -s "$$file" "$$f.tmp" ; rm $$f.tmp.* ; done + +i: + @ f=`basename $(file) .tmp` \ + ; echo cp $(file) $(srcdir)/$$f ; sleep 2 \ + ; cp $(file) $(srcdir)/$$f + # ---------------------------------------------------------------------- pkgconfigdir=$(libdir)/pkgconfig pkgconfig_HEADERS= zzip-zlib-config.pc zziplib.pc \ diff --git a/zzip/Makefile.in b/zzip/Makefile.in index 52e1720..959b4b8 100644 --- a/zzip/Makefile.in +++ b/zzip/Makefile.in @@ -306,7 +306,36 @@ WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt EXTRA_DIST = $(WCC10_DIST) _msvc.sed CONFIG_CLEAN_FILES = _config.h MAINTAINERCLEANFILES = _msvc.h -CLEANFILES = $(WCC10_CLEAN) *.pc *.omf +CLEANFILES = $(WCC10_CLEAN) *.pc *.omf *~ *.tmp *.tmp.* +INDENT = indent +INDENTFLAGS = \ +--blank-lines-after-declarations \ +--blank-lines-after-procedures \ +--blank-lines-before-block-comments \ +--brace-indent0 \ +--braces-after-if-line \ +--case-indentation0 \ +--cuddle-else \ +--space-after-cast \ +--honour-newlines \ +--indent-level4 \ +--line-length80 \ +--continue-at-parentheses \ +--leave-preprocessor-space \ +--dont-break-function-decl-args \ +--dont-cuddle-do-while \ +--dont-format-first-column-comments \ +--no-space-after-function-call-names \ +--no-space-after-parentheses \ +--no-tabs \ +--ignore-profile \ +--procnames-start-lines \ +--space-after-for \ +--space-after-if \ +--space-after-while \ +--space-special-semicolon + +DIFF_U0 = diff -U0 pkgconfig_HEADERS = zzip-zlib-config.pc zziplib.pc \ zzipmmapped.pc zzipfseeko.pc @@ -671,6 +700,23 @@ install-exec-local: uninstall-local : (cd $(DESTDIR)$(includedir) && rm zziplib.h zzip.h zzip-io.h) +indent-check: + for file in $(srcdir)/*.c ; do f=`basename "$$file"` \ + ; sed \ + -e "s|\\(if[^{};]*\\)\\(return[^{};];\\)|\\1 { \\2 }|" \ + -e "s|{\\([^{}]\\)*}|(' & ');|" \ + -e "s|___;.*|//&|" $$file > $$f.tmp.2 \ + ; $(INDENT) $(INDENTFLAGS) $(INDENTOPTS) -st "$$f.tmp.2" \ + | sed \ + -e "s|!\\([^ !=)]\\)|! \\1|g" $(INDENTSED) \ + -e "s|(' \\({[^{}]*}\\) ');|\\1|" \ + -e "s|//\\(___;.*\\)|\\1|" $$f.tmp.2 > $$f.tmp \ + ; $(DIFF_U0) -s "$$file" "$$f.tmp" ; rm $$f.tmp.* ; done + +i: + @ f=`basename $(file) .tmp` \ + ; echo cp $(file) $(srcdir)/$$f ; sleep 2 \ + ; cp $(file) $(srcdir)/$$f zziplib.pc : Makefile (cd .. && sh config.status zzip/zziplib.pc) diff --git a/zzip/dir.c b/zzip/dir.c index a84a130..9d6e0ef 100644 --- a/zzip/dir.c +++ b/zzip/dir.c @@ -32,10 +32,10 @@ #ifdef ZZIP_HAVE_SYS_STAT_H /* MSVC does have IFbitmask but not the corresponding IStests */ -# if !defined S_ISDIR && defined S_IFDIR +# if ! defined S_ISDIR && defined S_IFDIR # define S_ISDIR(_X_) ((_X_) & S_IFDIR) # endif -# if !defined S_ISREG && defined S_IFREG +# if ! defined S_ISREG && defined S_IFREG # define S_ISREG(_X_) ((_X_) & S_IFREG) # endif #endif diff --git a/zzip/err.c b/zzip/err.c index 2b6140b..5d0ec26 100644 --- a/zzip/err.c +++ b/zzip/err.c @@ -1,156 +1,161 @@ -/* - * Author: - * Guido Draheim - * Tomi Ollila - * - * Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim - * All rights reserved, - * use under the restrictions of the - * Lesser GNU General Public License - * or alternatively the restrictions - * of the Mozilla Public License 1.1 - */ - -#include /* exported... */ -#include - -#include -#include - -#include - -static struct errlistentry { int code; const char* mesg; } -errlist[] = -{ - { ZZIP_NO_ERROR, "No error" }, - { ZZIP_OUTOFMEM, - "could not get temporary memory for internal structures" }, - { ZZIP_DIR_OPEN, "Failed to open zip-file %s" }, - { ZZIP_DIR_STAT, "Failed to fstat zip-file %s" }, - { ZZIP_DIR_SEEK, "Failed to lseek zip-file %s" }, - { ZZIP_DIR_READ, "Failed to read zip-file %s"}, - { ZZIP_DIR_TOO_SHORT, "zip-file %s too short" }, - { ZZIP_DIR_EDH_MISSING, "zip-file central directory not found" }, - { ZZIP_DIRSIZE, "Directory size too big..." }, - { ZZIP_ENOENT, "No such file found in zip-file %s" }, - { ZZIP_UNSUPP_COMPR, "Unsupported compression format" }, - { ZZIP_CORRUPTED, "Zipfile corrupted" }, - { ZZIP_UNDEF, "Some undefined error occurred" }, - { ZZIP_DIR_LARGEFILE, "Directory is largefile variant" }, - { 0, 0 }, -}; - -#define errlistSIZE (sizeof(errlist)/sizeof(*errlist)) - -/** - * returns the static string for the given error code. The - * error code can be either a normal system error (a - * positive error code will flag this), it can be => libz - * error code (a small negative error code will flag this) - * or it can be an error code from => libzzip, which is an - * negative value lower than => ZZIP_ERROR - */ -zzip_char_t* -zzip_strerror(int errcode) -{ - if (errcode < ZZIP_ERROR && errcode > ZZIP_ERROR-32) - { - struct errlistentry* err = errlist; - for (; err->mesg ; err++) - { - if (err->code == errcode) - return err->mesg; - } - errcode = EINVAL; - } - - if (errcode < 0) - { - if (errcode == -1) - return strerror(errcode); - else - return zError(errcode); - } - - return strerror (errcode); -} - -/** => zzip_strerror - * This function fetches the errorcode from the => DIR-handle and - * runs it through => zzip_strerror to obtain the static string - * describing the error. - */ -zzip_char_t* -zzip_strerror_of(ZZIP_DIR* dir) -{ - if (! dir) return strerror (errno); - return zzip_strerror(dir->errcode); -} - -static struct errnolistentry { int code; int e_no; } -errnolist[] = -{ - { Z_STREAM_ERROR, EPIPE }, - { Z_DATA_ERROR, ESPIPE }, - { Z_MEM_ERROR, ENOMEM }, - { Z_BUF_ERROR, EMFILE }, - { Z_VERSION_ERROR, ENOEXEC }, - - { ZZIP_DIR_OPEN, ENOTDIR }, - { ZZIP_DIR_STAT, EREMOTE }, - { ZZIP_DIR_SEEK, ESPIPE }, -# ifdef ESTRPIPE - { ZZIP_DIR_READ, ESTRPIPE}, -# else - { ZZIP_DIR_READ, EPIPE}, -# endif - { ZZIP_DIR_TOO_SHORT, ENOEXEC }, -# ifdef ENOMEDIUM - { ZZIP_DIR_EDH_MISSING, ENOMEDIUM }, -# else - { ZZIP_DIR_EDH_MISSING, EIO }, -# endif - { ZZIP_DIRSIZE, EFBIG }, - { ZZIP_OUTOFMEM, ENOMEM }, - { ZZIP_ENOENT, ENOENT }, -# ifdef EPFNOSUPPORT - { ZZIP_UNSUPP_COMPR, EPFNOSUPPORT }, -# else - { ZZIP_UNSUPP_COMPR, EACCES }, -# endif -# ifdef EILSEQ - { ZZIP_CORRUPTED, EILSEQ }, -# else - { ZZIP_CORRUPTED, ELOOP }, -# endif - { ZZIP_UNDEF, EINVAL }, - { 0, 0 }, -}; - -/** - * map the error code to a system error code. This is used - * for the drop-in replacement functions to return a value - * that can be interpreted correctly by code sections that - * are unaware of the fact they their => open(2) call had been - * diverted to a file inside a zip-archive. - */ -int -zzip_errno(int errcode) -{ - if (errcode >= -1) return errno; - - { struct errnolistentry* err = errnolist; - for (; err->code ; err++) - { - if (err->code == errcode) - return err->e_no; - } - } - return EINVAL; -} - -/* - * Local variables: - * c-file-style: "stroustrup" - * End: - */ +/* + * Author: + * Guido Draheim + * Tomi Ollila + * + * Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim + * All rights reserved, + * use under the restrictions of the + * Lesser GNU General Public License + * or alternatively the restrictions + * of the Mozilla Public License 1.1 + */ + +#include /* exported... */ +#include + +#include +#include + +#include + +/* *INDENT-OFF* */ +static struct errlistentry { int code; const char* mesg; } +errlist[] = +{ + { ZZIP_NO_ERROR, "No error" }, + { ZZIP_OUTOFMEM, + "could not get temporary memory for internal structures" }, + { ZZIP_DIR_OPEN, "Failed to open zip-file %s" }, + { ZZIP_DIR_STAT, "Failed to fstat zip-file %s" }, + { ZZIP_DIR_SEEK, "Failed to lseek zip-file %s" }, + { ZZIP_DIR_READ, "Failed to read zip-file %s"}, + { ZZIP_DIR_TOO_SHORT, "zip-file %s too short" }, + { ZZIP_DIR_EDH_MISSING, "zip-file central directory not found" }, + { ZZIP_DIRSIZE, "Directory size too big..." }, + { ZZIP_ENOENT, "No such file found in zip-file %s" }, + { ZZIP_UNSUPP_COMPR, "Unsupported compression format" }, + { ZZIP_CORRUPTED, "Zipfile corrupted" }, + { ZZIP_UNDEF, "Some undefined error occurred" }, + { ZZIP_DIR_LARGEFILE, "Directory is largefile variant" }, + { 0, 0 }, +}; +/* *INDENT-ON* */ + + +#define errlistSIZE (sizeof(errlist)/sizeof(*errlist)) + +/** + * returns the static string for the given error code. The + * error code can be either a normal system error (a + * positive error code will flag this), it can be => libz + * error code (a small negative error code will flag this) + * or it can be an error code from => libzzip, which is an + * negative value lower than => ZZIP_ERROR + */ +zzip_char_t* +zzip_strerror(int errcode) +{ + if (errcode < ZZIP_ERROR && errcode > ZZIP_ERROR-32) + { + struct errlistentry* err = errlist; + for (; err->mesg ; err++) + { + if (err->code == errcode) + return err->mesg; + } + errcode = EINVAL; + } + + if (errcode < 0) + { + if (errcode == -1) + return strerror(errcode); + else + return zError(errcode); + } + + return strerror (errcode); +} + +/** => zzip_strerror + * This function fetches the errorcode from the => DIR-handle and + * runs it through => zzip_strerror to obtain the static string + * describing the error. + */ +zzip_char_t* +zzip_strerror_of(ZZIP_DIR* dir) +{ + if (! dir) return strerror (errno); + return zzip_strerror(dir->errcode); +} + +/* *INDENT-OFF* */ +static struct errnolistentry { int code; int e_no; } +errnolist[] = +{ + { Z_STREAM_ERROR, EPIPE }, + { Z_DATA_ERROR, ESPIPE }, + { Z_MEM_ERROR, ENOMEM }, + { Z_BUF_ERROR, EMFILE }, + { Z_VERSION_ERROR, ENOEXEC }, + + { ZZIP_DIR_OPEN, ENOTDIR }, + { ZZIP_DIR_STAT, EREMOTE }, + { ZZIP_DIR_SEEK, ESPIPE }, +# ifdef ESTRPIPE + { ZZIP_DIR_READ, ESTRPIPE}, +# else + { ZZIP_DIR_READ, EPIPE}, +# endif + { ZZIP_DIR_TOO_SHORT, ENOEXEC }, +# ifdef ENOMEDIUM + { ZZIP_DIR_EDH_MISSING, ENOMEDIUM }, +# else + { ZZIP_DIR_EDH_MISSING, EIO }, +# endif + { ZZIP_DIRSIZE, EFBIG }, + { ZZIP_OUTOFMEM, ENOMEM }, + { ZZIP_ENOENT, ENOENT }, +# ifdef EPFNOSUPPORT + { ZZIP_UNSUPP_COMPR, EPFNOSUPPORT }, +# else + { ZZIP_UNSUPP_COMPR, EACCES }, +# endif +# ifdef EILSEQ + { ZZIP_CORRUPTED, EILSEQ }, +# else + { ZZIP_CORRUPTED, ELOOP }, +# endif + { ZZIP_UNDEF, EINVAL }, + { 0, 0 }, +}; +/* *INDENT-ON* */ + +/** + * map the error code to a system error code. This is used + * for the drop-in replacement functions to return a value + * that can be interpreted correctly by code sections that + * are unaware of the fact they their => open(2) call had been + * diverted to a file inside a zip-archive. + */ +int +zzip_errno(int errcode) +{ + if (errcode >= -1) return errno; + + { struct errnolistentry* err = errnolist; + for (; err->code ; err++) + { + if (err->code == errcode) + return err->e_no; + } + } + return EINVAL; +} + +/* + * Local variables: + * c-file-style: "stroustrup" + * End: + */ diff --git a/zzip/fetch.c b/zzip/fetch.c index 8b7a7a8..4ae24cc 100644 --- a/zzip/fetch.c +++ b/zzip/fetch.c @@ -61,8 +61,9 @@ uint16_t __zzip_get16(unsigned char * s) uint64_t __zzip_get64(unsigned char * s) { #ifdef __GNUC__ + /* *INDENT-OFF* */ register uint64_t v - = s[7]; v <<= 8; + = s[7]; v <<= 8; v |= s[6]; v <<= 8; v |= s[5]; v <<= 8; v |= s[4]; v <<= 8; @@ -70,6 +71,7 @@ uint64_t __zzip_get64(unsigned char * s) v |= s[2]; v <<= 8; v |= s[1]; v <<= 8; v |= s[0]; return v; + /* *INDENT-ON* */ #else return ((uint64_t)s[7] << 56) | ((uint64_t)s[6] << 48) | ((uint64_t)s[5] << 40) | ((uint64_t)s[4] << 32) @@ -86,13 +88,12 @@ void __zzip_set32(unsigned char * s, uint32_t v) #if defined __ZZIP_SET32 return __ZZIP_SET32(s, v); #else - s[0] = (unsigned char) (v); - v >>= 8; - s[1] = (unsigned char) (v); - v >>= 8; - s[2] = (unsigned char) (v); - v >>= 8; + /* *INDENT-OFF* */ + s[0] = (unsigned char) (v); v >>= 8; + s[1] = (unsigned char) (v); v >>= 8; + s[2] = (unsigned char) (v); v >>= 8; s[3] = (unsigned char) (v); + /* *INDENT-ON* */ #endif } @@ -104,9 +105,10 @@ void __zzip_set16(unsigned char * s, uint16_t v) #if defined __ZZIP_SET16 return __ZZIP_SET16(s, v); #else - s[0] = (unsigned char) (v); - v >>= 8; + /* *INDENT-OFF* */ + s[0] = (unsigned char) (v); v >>= 8; s[1] = (unsigned char) (v); + /* *INDENT-ON* */ #endif } @@ -115,19 +117,14 @@ void __zzip_set16(unsigned char * s, uint16_t v) */ void __zzip_set64(unsigned char * s, uint64_t v) { - s[0] = (unsigned char) (v); - v >>= 8; - s[1] = (unsigned char) (v); - v >>= 8; - s[2] = (unsigned char) (v); - v >>= 8; - s[3] = (unsigned char) (v); - v >>= 8; - s[4] = (unsigned char) (v); - v >>= 8; - s[5] = (unsigned char) (v); - v >>= 8; - s[6] = (unsigned char) (v); - v >>= 8; + /* *INDENT-OFF* */ + s[0] = (unsigned char) (v); v >>= 8; + s[1] = (unsigned char) (v); v >>= 8; + s[2] = (unsigned char) (v); v >>= 8; + s[3] = (unsigned char) (v); v >>= 8; + s[4] = (unsigned char) (v); v >>= 8; + s[5] = (unsigned char) (v); v >>= 8; + s[6] = (unsigned char) (v); v >>= 8; s[7] = (unsigned char) (v); + /* *INDENT-ON* */ } diff --git a/zzip/file.c b/zzip/file.c index 9aa93fd..acdd8c3 100644 --- a/zzip/file.c +++ b/zzip/file.c @@ -99,7 +99,7 @@ zzip_file_saveoffset(ZZIP_FILE * fp) # define ZZIP_CHECK_BACKSLASH_DIRSEPARATOR 0 /* to "NO" on win32 ! */ # endif -# if !defined strcasecmp && !defined ZZIP_HAVE_STRCASECMP +# if ! defined strcasecmp && ! defined ZZIP_HAVE_STRCASECMP # define ZZIP_CHECK_BACKSLASH_DIRSEPARATOR 1 # endif @@ -147,6 +147,8 @@ static int zzip_inflate_init(ZZIP_FILE *, struct zzip_dir_hdr *); * * Note: the zlib supports 2..15 bit windowsize, hence we provide a 32k * memchunk here... just to be safe. + * + * On error it returns null and sets errcode in the ZZIP_DIR. */ ZZIP_FILE * zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode) @@ -159,7 +161,9 @@ zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode) cmp = (o_mode & ZZIP_CASELESS)? dirsep_casecmp: strcmp; - if (! dir || !dir->fd || dir->fd == -1 ) return 0; + if (! dir) return NULL; + if (! dir->fd || dir->fd == -1) { dir->errcode = EBADF; return NULL; } + if (! hdr) { dir->errcode = ENOENT; return NULL; } if (o_mode & ZZIP_NOPATHS) { @@ -167,7 +171,6 @@ zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode) if (n) name = n + 1; } - if (hdr) while (1) { register zzip_char_t* hdr_name = hdr->d_name; @@ -180,7 +183,7 @@ zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode) HINT4("name='%s', compr=%d, size=%d\n", hdr->d_name, hdr->d_compr, hdr->d_usize); - if (!cmp(hdr_name, name)) + if (! cmp(hdr_name, name)) { switch (hdr->d_compr) { @@ -267,11 +270,11 @@ zzip_file_open(ZZIP_DIR * dir, zzip_char_t* name, int o_mode) hdr = (struct zzip_dir_hdr *)((char *)hdr + hdr->d_reclen); }/*cmp name*/ }/*forever*/ - dir->errcode = ZZIP_ENOENT; zzip_errno(ZZIP_ENOENT); + dir->errcode = ZZIP_ENOENT; return NULL; error: if (fp) zzip_file_close(fp); - dir->errcode = err; zzip_errno(err); + dir->errcode = err; return NULL; } @@ -356,65 +359,65 @@ zzip_file_read(ZZIP_FILE * fp, void * buf, zzip_size_t len) * If this is other handle than previous, save current seek pointer * and read the file position of `this' handle. */ - if (dir->currentfp != fp) - { - if (zzip_file_saveoffset(dir->currentfp) < 0 - || fp->io->fd.seeks(dir->fd, fp->offset, SEEK_SET) < 0) - { dir->errcode = ZZIP_DIR_SEEK; return -1; } - else - { dir->currentfp = fp; } - } - - /* if more methods is to be supported, change this to `switch ()' */ - if (fp->method) /* method != 0 == 8, inflate */ - { - fp->d_stream.avail_out = l; - fp->d_stream.next_out = (unsigned char *)buf; - - do { - int err; - zzip_size_t startlen; - - if (fp->crestlen > 0 && fp->d_stream.avail_in == 0) - { - zzip_size_t cl = ( fp->crestlen < ZZIP_32K ? + if (dir->currentfp != fp) + { + if (zzip_file_saveoffset(dir->currentfp) < 0 + || fp->io->fd.seeks(dir->fd, fp->offset, SEEK_SET) < 0) + { dir->errcode = ZZIP_DIR_SEEK; return -1; } + else + { dir->currentfp = fp; } + } + + /* if more methods is to be supported, change this to `switch ()' */ + if (fp->method) /* method != 0 == 8, inflate */ + { + fp->d_stream.avail_out = l; + fp->d_stream.next_out = (unsigned char *)buf; + + do { + int err; + zzip_size_t startlen; + + if (fp->crestlen > 0 && fp->d_stream.avail_in == 0) + { + zzip_size_t cl = ( fp->crestlen < ZZIP_32K ? fp->crestlen : ZZIP_32K ); - /* zzip_size_t cl = fp->crestlen > 128 ? 128 : fp->crestlen; */ - - zzip_ssize_t i = fp->io->fd.read(dir->fd, fp->buf32k, cl); - if (i <= 0) - { - dir->errcode = ZZIP_DIR_READ; /* or ZZIP_DIR_READ_EOF ? */ - return -1; - } - fp->crestlen -= i; - fp->d_stream.avail_in = i; - fp->d_stream.next_in = (unsigned char *)fp->buf32k; - } - - startlen = fp->d_stream.total_out; - err = inflate(&fp->d_stream, Z_NO_FLUSH); - - if (err == Z_STREAM_END) - { fp->restlen = 0; } - else - if (err == Z_OK) - { fp->restlen -= (fp->d_stream.total_out - startlen); } - else - { dir->errcode = err; return -1; } - } while (fp->restlen && fp->d_stream.avail_out); - - return l - fp->d_stream.avail_out; - }else - { /* method == 0 -- unstore */ - rv = fp->io->fd.read(dir->fd, buf, l); - if (rv > 0) - { fp->restlen-= rv; } - else - if (rv < 0) - { dir->errcode = ZZIP_DIR_READ; } - return rv; - } + /* zzip_size_t cl = fp->crestlen > 128 ? 128 : fp->crestlen; */ + + zzip_ssize_t i = fp->io->fd.read(dir->fd, fp->buf32k, cl); + if (i <= 0) + { + dir->errcode = ZZIP_DIR_READ; /* or ZZIP_DIR_READ_EOF ? */ + return -1; + } + fp->crestlen -= i; + fp->d_stream.avail_in = i; + fp->d_stream.next_in = (unsigned char *)fp->buf32k; + } + + startlen = fp->d_stream.total_out; + err = inflate(&fp->d_stream, Z_NO_FLUSH); + + if (err == Z_STREAM_END) + { fp->restlen = 0; } + else + if (err == Z_OK) + { fp->restlen -= (fp->d_stream.total_out - startlen); } + else + { dir->errcode = err; return -1; } + } while (fp->restlen && fp->d_stream.avail_out); + + return l - fp->d_stream.avail_out; + }else + { /* method == 0 -- unstore */ + rv = fp->io->fd.read(dir->fd, buf, l); + if (rv > 0) + { fp->restlen-= rv; } + else + if (rv < 0) + { dir->errcode = ZZIP_DIR_READ; } + return rv; + } } /** @@ -514,6 +517,9 @@ zzip_fread(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE *file) * is ignored since the lib can not yet write zip files, otherwise * it would be the initialisation value for the zlib deflateInit * where 0 = no-compression, 1 = best-speed, 9 = best-compression. + * + * This function returns a new zzip-handle (use => zzip_close to return + * it). On error this function will return null setting => errno(3). */ ZZIP_FILE* zzip_fopen(zzip_char_t* filename, zzip_char_t* mode) @@ -539,13 +545,16 @@ zzip_fopen(zzip_char_t* filename, zzip_char_t* mode) * left untouched, instead it is only given as a hint that a new * file handle may share/copy the zip arch structures of the old file * handle if that is possible, i.e when they are in the same zip arch. + * + * This function returns a new zzip-handle (use => zzip_close to return + * it). On error this function will return null setting => errno(3). */ ZZIP_FILE* zzip_freopen(zzip_char_t* filename, zzip_char_t* mode, ZZIP_FILE* stream) { int o_flags = 0; int o_modes = 0664; - if (!mode) mode = "rb"; + if (! mode) mode = "rb"; # ifndef O_BINARY # define O_BINARY 0 @@ -654,6 +663,9 @@ zzip_open(zzip_char_t* filename, int o_flags) * carry the zzip_flags and possibly accessmodes for unix filesystems. * Since this version of zziplib can not write zipfiles, it is not * yet used for anything else than zzip-specific modeflags. + * + * This function returns a new zzip-handle (use => zzip_close to return + * it). On error this function will return null setting => errno(3). */ ZZIP_FILE* zzip_open_ext_io(zzip_char_t* filename, int o_flags, int o_modes, @@ -679,6 +691,9 @@ zzip_open_ext_io(zzip_char_t* filename, int o_flags, int o_modes, * * Note that this function is also used by => zzip_freopen that * will unshare the old handle, thereby possibly closing the handle. + * + * This function returns a new zzip-handle (use => zzip_close to return + * it). On error this function will return null setting => errno(3). */ ZZIP_FILE* zzip_open_shared_io (ZZIP_FILE* stream, @@ -702,7 +717,7 @@ zzip_open_shared_io (ZZIP_FILE* stream, if (fd != -1) { ZZIP_FILE* fp = calloc (1, sizeof(ZZIP_FILE)); - if (!fp) { os->fd.close(fd); return 0; } /* io->fd.close */ + if (! fp) { os->fd.close(fd); return 0; } /* io->fd.close */ fp->fd = fd; fp->io = os; @@ -725,7 +740,9 @@ zzip_open_shared_io (ZZIP_FILE* stream, /* see if we can open a file that is a zip file */ { char basename[PATH_MAX]; char* p; - strcpy (basename, filename); + int filename_len = strlen (filename); + if (filename_len >= PATH_MAX) { errno = ENAMETOOLONG; return 0; } + memcpy (basename, filename, filename_len+1); /* see if we can share the same zip directory */ if (stream && stream->dir && stream->dir->realname) diff --git a/zzip/mmapped.c b/zzip/mmapped.c index dfde71b..daaf433 100644 --- a/zzip/mmapped.c +++ b/zzip/mmapped.c @@ -100,7 +100,7 @@ zzip__new__ ZZIP_DISK* zzip_disk_mmap(int fd) { struct stat st; - if (fstat (fd, &st) || !st.st_size) return 0; + if (fstat (fd, &st) || ! st.st_size) return 0; ___ ZZIP_DISK* disk = zzip_disk_new (); if (! disk) return 0; disk->buffer = _zzip_mmap (& disk->mapped, fd, 0, st.st_size); if (disk->buffer == MAP_FAILED) { free (disk); return 0; } @@ -136,7 +136,7 @@ zzip_disk_open(char* filename) # define O_BINARY 0 # endif struct stat st; - if (stat (filename, &st) || !st.st_size) return 0; + if (stat (filename, &st) || ! st.st_size) return 0; ___ int fd = open (filename, O_RDONLY|O_BINARY); if (fd <= 0) return 0; ___ ZZIP_DISK* disk = zzip_disk_mmap (fd); diff --git a/zzip/plugin.c b/zzip/plugin.c index ad17adb..cb057b7 100644 --- a/zzip/plugin.c +++ b/zzip/plugin.c @@ -69,7 +69,7 @@ zzip_get_default_io() */ int zzip_init_io(zzip_plugin_io_handlers_t io, int flags) { - if (!io) { + if (! io) { return ZZIP_ERROR; } memcpy(io, &default_io, sizeof(default_io)); diff --git a/zzip/write.c b/zzip/write.c index 2f6ab0c..1c49254 100644 --- a/zzip/write.c +++ b/zzip/write.c @@ -133,7 +133,7 @@ zzip_dir_creat_ext_io(zzip_char_t* name, int o_mode, } - if (!_ZZIP_TRY) + if (! _ZZIP_TRY) { /* not implemented - however, we respect that a null argument to * zzip_mkdir and zzip_creat works, so we silently still do the mkdir */ @@ -156,7 +156,7 @@ zzip_dir_creat_ext_io(zzip_char_t* name, int o_mode, for (; *exx ; exx++) { if ((exx_len = strlen (*exx)+1) <= name_len && - !memcmp (dir->realname+(name_len-exx_len), *exx, exx_len)) + ! memcmp (dir->realname+(name_len-exx_len), *exx, exx_len)) break; /* keep unmodified */ exx++; if (*exx) continue; @@ -253,7 +253,7 @@ zzip_file_mkdir(ZZIP_DIR* dir, zzip_char_t* name, int o_mode) if (! dir) return _mkdir(name, o_mode); - if (!_ZZIP_TRY) + if (! _ZZIP_TRY) {/* not implemented */ errno = EROFS; return -1; @@ -285,7 +285,7 @@ zzip_file_creat(ZZIP_DIR* dir, zzip_char_t* name, int o_mode) if (! dir) return zzip_open (name, o_mode); - if (!_ZZIP_TRY) + if (! _ZZIP_TRY) {/* not implemented */ errno = EROFS; return 0; @@ -325,7 +325,7 @@ zzip_write(ZZIP_FILE* file, const void* ptr, zzip_size_t len) zzip_ssize_t zzip_file_write(ZZIP_FILE* file, const void* ptr, zzip_size_t len) { - if (!_ZZIP_TRY) + if (! _ZZIP_TRY) {/* not implemented */ errno = EROFS; return -1; diff --git a/zzip/zip.c b/zzip/zip.c index 5133a11..5318ffc 100644 --- a/zzip/zip.c +++ b/zzip/zip.c @@ -189,13 +189,13 @@ __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, zzip_ssize_t maplen = 0; /* mmap(),read(),getpagesize() use size_t !! */ char* fd_map = 0; - if (!trailer) + if (! trailer) { return(EINVAL); } if (filesize < __sizeof(struct zzip_disk_trailer)) { return(ZZIP_DIR_TOO_SHORT); } - if (!buf) + if (! buf) { return(ZZIP_OUTOFMEM); } offset = filesize; /* a.k.a. old offset */ @@ -376,7 +376,7 @@ __zzip_parse_root_directory(int fd, __correct_rootseek (zz_rootseek, zz_rootsize, trailer); hdr0 = (struct zzip_dir_hdr*) malloc(zz_rootsize); - if (!hdr0) + if (! hdr0) return ZZIP_DIRSIZE; hdr = hdr0; __debug_dir_hdr (hdr); @@ -501,11 +501,13 @@ static zzip_strings_t* zzip_get_default_ext(void) { static zzip_strings_t ext [] = { + /* *INDENT-OFF* */ ".zip", ".ZIP", /* common extension */ -# ifdef ZZIP_USE_ZIPLIKES +# ifdef ZZIP_USE_ZIPLIKES ".pk3", ".PK3", /* ID Software's Quake3 zipfiles */ ".jar", ".JAR", /* Java zipfiles */ -# endif +# endif + /* *INDENT-OFF* */ 0 }; @@ -661,9 +663,13 @@ __zzip_dir_parse (ZZIP_DIR* dir) } /** - * will attach a .zip extension and tries to open it - * the with => open(2). This is a helper function for - * => zzip_dir_open, => zzip_opendir and => zzip_open. + * This function will attach any of the .zip extensions then + * trying to open it the with => open(2). This is a helper + * function for => zzip_dir_open, => zzip_opendir and => zzip_open. + * + * This function returns a new system file handle or -1 on error. + * On error this function leaves the errno(3) of the underlying + * open(2) call on the last file. */ int __zzip_try_open(zzip_char_t* filename, int filemode, @@ -673,11 +679,11 @@ __zzip_try_open(zzip_char_t* filename, int filemode, int fd; zzip_size_t len = strlen (filename); - if (len+4 >= PATH_MAX) return -1; + if (len+4 >= PATH_MAX) { errno = ENAMETOOLONG; return -1; } memcpy(file, filename, len+1); - if (!io) io = zzip_get_default_io(); - if (!ext) ext = zzip_get_default_ext(); + if (! io) io = zzip_get_default_io(); + if (! ext) ext = zzip_get_default_ext(); for ( ; *ext ; ++ext) { @@ -709,18 +715,18 @@ zzip_dir_open_ext_io(zzip_char_t* filename, zzip_error_t* e, { int fd; - if (!io) io = zzip_get_default_io(); - if (!ext) ext = zzip_get_default_ext(); + if (! io) io = zzip_get_default_io(); + if (! ext) ext = zzip_get_default_ext(); fd = io->fd.open(filename, O_RDONLY|O_BINARY); - if (fd != -1) - { return zzip_dir_fdopen_ext_io(fd, e, ext, io); } - else + if (fd != -1) { + return zzip_dir_fdopen_ext_io(fd, e, ext, io); + } else { fd = __zzip_try_open(filename, O_RDONLY|O_BINARY, ext, io); - if (fd != -1) - { return zzip_dir_fdopen_ext_io(fd, e, ext, io); } - else + if (fd != -1) { + return zzip_dir_fdopen_ext_io(fd, e, ext, io); + } else { if (e) { *e = ZZIP_DIR_OPEN; } return 0; @@ -744,10 +750,13 @@ zzip_dir_read(ZZIP_DIR * dir, ZZIP_DIRENT * d ) d->st_size = dir->hdr->d_usize; d->d_name = dir->hdr->d_name; - if (! dir->hdr->d_reclen) - { dir->hdr = 0; } - else - { dir->hdr = (struct zzip_dir_hdr *)((char *)dir->hdr + dir->hdr->d_reclen); } + if (! dir->hdr->d_reclen) { + dir->hdr = 0; + } else + { + dir->hdr = (struct zzip_dir_hdr *) + ((char *)dir->hdr + dir->hdr->d_reclen); + } return 1; } -- 2.40.0