summaryrefslogtreecommitdiff
path: root/lzotest
diff options
context:
space:
mode:
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-12-23 14:06:25 +0100
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-12-23 14:06:25 +0100
commit79a9578a33ecd3093970bd18df677edc9214fafb (patch)
tree8ae5c6780a1fcd2124e71f27ad9b4256acd24268 /lzotest
parent1bb1ce141783168d44a38cd1bb6b822eb13114fc (diff)
downloadlzo-79a9578a33ecd3093970bd18df677edc9214fafb.tar.gz
lzo-79a9578a33ecd3093970bd18df677edc9214fafb.tar.bz2
lzo-79a9578a33ecd3093970bd18df677edc9214fafb.zip
Imported Upstream version 2.08upstream/2.08sandbox/kevinthierry/upstream
Diffstat (limited to 'lzotest')
-rw-r--r--lzotest/Makefile.am15
-rw-r--r--lzotest/Makefile.in441
-rw-r--r--lzotest/asm.h19
-rw-r--r--lzotest/db.h20
-rw-r--r--lzotest/lzotest.c619
-rw-r--r--lzotest/mygetopt.ch698
-rw-r--r--lzotest/mygetopt.h102
-rw-r--r--lzotest/wrap.h38
-rw-r--r--lzotest/wrapmisc.h41
9 files changed, 337 insertions, 1656 deletions
diff --git a/lzotest/Makefile.am b/lzotest/Makefile.am
deleted file mode 100644
index 842ccfb..0000000
--- a/lzotest/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-## Process this file with automake to create Makefile.in
-#
-# Copyright (C) 1996-2008 Markus F.X.J. Oberhumer
-#
-
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)
-
-noinst_PROGRAMS = lzotest
-
-lzotest_SOURCES = lzotest.c
-lzotest_LDADD = ../src/liblzo2.la
-lzotest_DEPENDENCIES = ../src/liblzo2.la
-
-EXTRA_DIST = asm.h db.h wrap.h wrapmisc.h mygetopt.ch mygetopt.h
-
diff --git a/lzotest/Makefile.in b/lzotest/Makefile.in
deleted file mode 100644
index d2df902..0000000
--- a/lzotest/Makefile.in
+++ /dev/null
@@ -1,441 +0,0 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-#
-# Copyright (C) 1996-2008 Markus F.X.J. Oberhumer
-#
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ..
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-noinst_PROGRAMS = lzotest$(EXEEXT)
-subdir = lzotest
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-PROGRAMS = $(noinst_PROGRAMS)
-am_lzotest_OBJECTS = lzotest.$(OBJEXT)
-lzotest_OBJECTS = $(am_lzotest_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(lzotest_SOURCES)
-DIST_SOURCES = $(lzotest_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-LZO_ASM_VPATH = @LZO_ASM_VPATH@
-LZO_CFLAGS = @LZO_CFLAGS@
-LZO_CPPFLAGS = @LZO_CPPFLAGS@
-LZO_EXTRA_CFLAGS = @LZO_EXTRA_CFLAGS@
-LZO_EXTRA_CPPFLAGS = @LZO_EXTRA_CPPFLAGS@
-LZO_USE_ASM_FALSE = @LZO_USE_ASM_FALSE@
-LZO_USE_ASM_TRUE = @LZO_USE_ASM_TRUE@
-MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
-MAKEINFO = @MAKEINFO@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-configure_CFLAGS = @configure_CFLAGS@
-configure_CPPFLAGS = @configure_CPPFLAGS@
-datadir = @datadir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)
-lzotest_SOURCES = lzotest.c
-lzotest_LDADD = ../src/liblzo2.la
-lzotest_DEPENDENCIES = ../src/liblzo2.la
-EXTRA_DIST = asm.h db.h wrap.h wrapmisc.h mygetopt.ch mygetopt.h
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lzotest/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu lzotest/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstPROGRAMS:
- @list='$(noinst_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
-lzotest$(EXEEXT): $(lzotest_OBJECTS) $(lzotest_DEPENDENCIES)
- @rm -f lzotest$(EXEEXT)
- $(LINK) $(lzotest_LDFLAGS) $(lzotest_OBJECTS) $(lzotest_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzotest.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
- -rm -f libtool
-uninstall-info-am:
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
- list='$(DISTFILES)'; for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
- esac; \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test "$$dir" != "$$file" && test "$$dir" != "."; then \
- dir="/$$dir"; \
- $(mkdir_p) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
- if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-libtool distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-exec-am:
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-info-am
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstPROGRAMS ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-exec \
- install-exec-am install-info install-info-am install-man \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-info-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/lzotest/asm.h b/lzotest/asm.h
index e61f1fc..f0f99ca 100644
--- a/lzotest/asm.h
+++ b/lzotest/asm.h
@@ -2,19 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -76,7 +64,4 @@
#define lzo1f_decompress_asm_safe 0
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */
diff --git a/lzotest/db.h b/lzotest/db.h
index 1e6152d..6cade01 100644
--- a/lzotest/db.h
+++ b/lzotest/db.h
@@ -2,19 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -490,8 +478,4 @@
#endif
-
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */
diff --git a/lzotest/lzotest.c b/lzotest/lzotest.c
index 13f6e08..02d5787 100644
--- a/lzotest/lzotest.c
+++ b/lzotest/lzotest.c
@@ -2,19 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -49,7 +37,8 @@
#define WANT_LZO_MALLOC 1
#define WANT_LZO_FREAD 1
#define WANT_LZO_WILDARGV 1
-#define WANT_LZO_UCLOCK 1
+#define WANT_LZO_PCLOCK 1
+#define LZO_WANT_ACCLIB_GETOPT 1
#include "examples/portab.h"
#if defined(HAVE_STRNICMP) && !defined(HAVE_STRNCASECMP)
@@ -65,9 +54,6 @@
# define is_space(x) ((x)==' ' || (x)=='\t' || (x)=='\r' || (x)=='\n')
#endif
-#include "mygetopt.h"
-#include "mygetopt.ch"
-
/*************************************************************************
// compression include section
@@ -120,9 +106,15 @@
#endif
#if defined(HAVE_LZO1X_H)
# include "lzo/lzo1x.h"
+# if defined(__LZO_PROFESSIONAL__)
+# include "lzo/lzopro/lzo1x.h"
+# endif
#endif
#if defined(HAVE_LZO1Y_H)
# include "lzo/lzo1y.h"
+# if defined(__LZO_PROFESSIONAL__)
+# include "lzo/lzopro/lzo1y.h"
+# endif
#endif
#if defined(HAVE_LZO1Z_H)
# include "lzo/lzo1z.h"
@@ -133,18 +125,17 @@
#if defined(HAVE_LZO2B_H)
# include "lzo/lzo2b.h"
#endif
-
-/* other compressors */
#if defined(__LZO_PROFESSIONAL__)
# include "lzopro/t_config.ch"
#endif
+/* other compressors */
#if defined(HAVE_ZLIB_H)
# include <zlib.h>
-# define ALG_ZLIB
+# define ALG_ZLIB 1
#endif
#if defined(HAVE_BZLIB_H)
# include <bzlib.h>
-# define ALG_BZIP2
+# define ALG_BZIP2 1
#endif
@@ -216,6 +207,10 @@ enum {
M_Z_CRC32 = 6012,
#endif
+#if defined(__LZO_PROFESSIONAL__)
+# include "lzopro/m_enum.ch"
+#endif
+
M_UNUSED
};
@@ -224,13 +219,10 @@ enum {
// command line options
**************************************************************************/
-struct corpus_entry_t;
-
int opt_verbose = 2;
long opt_c_loops = 0;
long opt_d_loops = 0;
-const struct corpus_entry_t *opt_corpus = NULL;
const char *opt_corpus_path = NULL;
const char *opt_dump_compressed_data = NULL;
@@ -248,11 +240,11 @@ lzo_bool opt_read_from_stdin = 0;
/* set these to 1 to measure the speed impact of a checksum */
lzo_bool opt_compute_adler32 = 0;
lzo_bool opt_compute_crc32 = 0;
-static lzo_uint32 adler_in, adler_out;
-static lzo_uint32 crc_in, crc_out;
+static lzo_uint32_t adler_in, adler_out;
+static lzo_uint32_t crc_in, crc_out;
lzo_bool opt_execution_time = 0;
-int opt_uclock = -1;
+int opt_pclock = -1;
lzo_bool opt_clear_wrkmem = 0;
static const lzo_bool opt_try_to_compress_0_bytes = 1;
@@ -263,7 +255,7 @@ static const lzo_bool opt_try_to_compress_0_bytes = 1;
**************************************************************************/
static const char *progname = "";
-static lzo_uclock_handle_t uch;
+static lzo_pclock_handle_t pch;
/* for statistics and benchmark */
int opt_totals = 0;
@@ -346,22 +338,24 @@ static lzo_uint opt_max_data_len;
typedef struct {
lzo_bytep ptr;
lzo_uint len;
- lzo_uint32 adler;
- lzo_uint32 crc;
+ lzo_uint32_t adler;
+ lzo_uint32_t crc;
lzo_bytep alloc_ptr;
lzo_uint alloc_len;
lzo_uint saved_len;
} mblock_t;
-static mblock_t file_data;
-static mblock_t block1;
-static mblock_t block2;
-static mblock_t wrkmem;
+static mblock_t file_data; /* original uncompressed data */
+static mblock_t block_c; /* compressed data */
+static mblock_t block_d; /* decompressed data */
+static mblock_t block_w; /* wrkmem */
static mblock_t dict;
static void mb_alloc_extra(mblock_t *mb, lzo_uint len, lzo_uint extra_bottom, lzo_uint extra_top)
{
+ lzo_uint align = (lzo_uint) sizeof(lzo_align_t);
+
mb->alloc_ptr = mb->ptr = NULL;
mb->alloc_len = mb->len = 0;
@@ -373,6 +367,10 @@ static void mb_alloc_extra(mblock_t *mb, lzo_uint len, lzo_uint extra_bottom, lz
fprintf(stderr, "%s: out of memory (wanted %lu bytes)\n", progname, (unsigned long)mb->alloc_len);
exit(EXIT_MEM);
}
+ if (mb->alloc_len >= align && __lzo_align_gap(mb->alloc_ptr, align) != 0) {
+ fprintf(stderr, "%s: C library problem: malloc() returned misaligned pointer!\n", progname);
+ exit(EXIT_MEM);
+ }
mb->ptr = mb->alloc_ptr + extra_bottom;
mb->len = mb->saved_len = len;
@@ -460,11 +458,11 @@ static void dict_load(const char *file_name)
FILE *fp;
dict.len = 0;
- fp = fopen(file_name,"rb");
+ fp = fopen(file_name, "rb");
if (fp)
{
dict.len = (lzo_uint) lzo_fread(fp, dict.ptr, dict.alloc_len);
- fclose(fp);
+ (void) fclose(fp);
dict.adler = lzo_adler32(1, dict.ptr, dict.len);
}
}
@@ -478,8 +476,8 @@ typedef struct
{
const char * name;
int id;
- lzo_uint32 mem_compress;
- lzo_uint32 mem_decompress;
+ lzo_uint32_t mem_compress;
+ lzo_uint32_t mem_decompress;
lzo_compress_t compress;
lzo_optimize_t optimize;
lzo_decompress_t decompress;
@@ -495,14 +493,20 @@ compress_t;
#include "asm.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
#include "wrap.h"
#define M_PRIVATE LZO_PRIVATE
#define m_uint lzo_uint
-#define m_uint32 lzo_uint32
+#define m_uint32_t lzo_uint32_t
#define m_voidp lzo_voidp
#define m_bytep lzo_bytep
#define m_uintp lzo_uintp
#include "wrapmisc.h"
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
static const compress_t compress_database[] = {
#include "db.h"
@@ -510,11 +514,6 @@ static const compress_t compress_database[] = {
};
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/db.ch"
-#endif
-
-
/*************************************************************************
// method info
**************************************************************************/
@@ -575,10 +574,6 @@ const compress_t *find_method_by_id ( int method )
size_t size = sizeof(compress_database) / sizeof(*(compress_database));
size_t i;
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/find_id.ch"
-#endif
-
db = compress_database;
for (i = 0; i < size && db->name != NULL; i++, db++)
{
@@ -596,10 +591,6 @@ const compress_t *find_method_by_name ( const char *name )
size_t size = sizeof(compress_database) / sizeof(*(compress_database));
size_t i;
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/find_name.ch"
-#endif
-
db = compress_database;
for (i = 0; i < size && db->name != NULL; i++, db++)
{
@@ -628,7 +619,7 @@ lzo_bool is_compressor ( const compress_t *c )
// check that memory gets accessed within bounds
**************************************************************************/
-void memchecker_init ( mblock_t *mb, lzo_xint l, unsigned char random_byte )
+static void memchecker_init ( mblock_t *mb, lzo_uint l, unsigned char random_byte )
{
lzo_uint i;
lzo_uint len = (lzo_uint) l;
@@ -654,7 +645,7 @@ void memchecker_init ( mblock_t *mb, lzo_xint l, unsigned char random_byte )
}
-int memchecker_check ( mblock_t *mb, lzo_xint l, unsigned char random_byte )
+static int memchecker_check ( mblock_t *mb, lzo_uint l, unsigned char random_byte )
{
lzo_uint i;
lzo_uint len = (lzo_uint) l;
@@ -687,32 +678,32 @@ int call_compressor ( const compress_t *c,
{
int r = -100;
- if (c && c->compress && wrkmem.len >= c->mem_compress)
+ if (c && c->compress && block_w.len >= c->mem_compress)
{
unsigned char random_byte = (unsigned char) src_len;
- memchecker_init(&wrkmem, c->mem_compress, random_byte);
+ memchecker_init(&block_w, c->mem_compress, random_byte);
if (opt_clear_wrkmem)
- lzo_memset(wrkmem.ptr, 0, c->mem_compress);
+ lzo_memset(block_w.ptr, 0, c->mem_compress);
if (opt_dict && c->compress_dict)
- r = c->compress_dict(src,src_len,dst,dst_len,wrkmem.ptr,dict.ptr,dict.len);
+ r = c->compress_dict(src,src_len,dst,dst_len,block_w.ptr,dict.ptr,dict.len);
else
- r = c->compress(src,src_len,dst,dst_len,wrkmem.ptr);
+ r = c->compress(src,src_len,dst,dst_len,block_w.ptr);
- if (memchecker_check(&wrkmem, c->mem_compress, random_byte) != 0)
+ if (memchecker_check(&block_w, c->mem_compress, random_byte) != 0)
printf("WARNING: wrkmem overwrite error (compress) !!!\n");
}
if (r == 0 && opt_compute_adler32)
{
- lzo_uint32 adler;
+ lzo_uint32_t adler;
adler = lzo_adler32(0, NULL, 0);
adler = lzo_adler32(adler, src, src_len);
adler_in = adler;
}
if (r == 0 && opt_compute_crc32)
{
- lzo_uint32 crc;
+ lzo_uint32_t crc;
crc = lzo_crc32(0, NULL, 0);
crc = lzo_crc32(crc, src, src_len);
crc_in = crc;
@@ -733,19 +724,19 @@ int call_decompressor ( const compress_t *c, lzo_decompress_t d,
{
int r = -100;
- if (c && d && wrkmem.len >= c->mem_decompress)
+ if (c && d && block_w.len >= c->mem_decompress)
{
unsigned char random_byte = (unsigned char) src_len;
- memchecker_init(&wrkmem, c->mem_decompress, random_byte);
+ memchecker_init(&block_w, c->mem_decompress, random_byte);
if (opt_clear_wrkmem)
- lzo_memset(wrkmem.ptr, 0, c->mem_decompress);
+ lzo_memset(block_w.ptr, 0, c->mem_decompress);
if (opt_dict && c->decompress_dict_safe)
- r = c->decompress_dict_safe(src,src_len,dst,dst_len,wrkmem.ptr,dict.ptr,dict.len);
+ r = c->decompress_dict_safe(src,src_len,dst,dst_len,block_w.ptr,dict.ptr,dict.len);
else
- r = d(src,src_len,dst,dst_len,wrkmem.ptr);
+ r = d(src,src_len,dst,dst_len,block_w.ptr);
- if (memchecker_check(&wrkmem, c->mem_decompress, random_byte) != 0)
+ if (memchecker_check(&block_w, c->mem_decompress, random_byte) != 0)
printf("WARNING: wrkmem overwrite error (decompress) !!!\n");
}
@@ -767,8 +758,8 @@ int call_optimizer ( const compress_t *c,
lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len )
{
- if (c && c->optimize && wrkmem.len >= c->mem_decompress)
- return c->optimize(src,src_len,dst,dst_len,wrkmem.ptr);
+ if (c && c->optimize && block_w.len >= c->mem_decompress)
+ return c->optimize(src,src_len,dst,dst_len,block_w.ptr);
return 0;
}
@@ -777,51 +768,71 @@ int call_optimizer ( const compress_t *c,
// read a file
************************************************************************/
-static int load_file(const char *file_name, lzo_uint max_len)
+static int load_file(const char *file_name, lzo_uint max_data_len)
{
FILE *fp;
+#if (HAVE_FTELLO)
+ off_t ll = -1;
+#else
long ll = -1;
+#endif
lzo_uint l;
int r;
mblock_t *mb = &file_data;
mb_free(mb);
- fp = fopen(file_name,"rb");
+ fp = fopen(file_name, "rb");
if (fp == NULL)
{
- fprintf(stderr,"%s: ",file_name);
- perror("fopen");
+ fflush(stdout); fflush(stderr);
+ fprintf(stderr, "%s: ", file_name);
fflush(stderr);
+ perror("fopen");
+ fflush(stdout); fflush(stderr);
return EXIT_FILE;
}
- r = fseek(fp,(long)max_len,SEEK_SET);
- if (r != 0)
- r = fseek(fp,0,SEEK_END);
+ r = fseek(fp, 0, SEEK_END);
if (r == 0)
{
+#if (HAVE_FTELLO)
+ ll = ftello(fp);
+#else
ll = ftell(fp);
- r = fseek(fp,0,SEEK_SET);
+#endif
+ r = fseek(fp, 0, SEEK_SET);
}
if (r != 0 || ll < 0)
{
- fprintf(stderr,"%s: ",file_name);
- perror("fseek");
+ fflush(stdout); fflush(stderr);
+ fprintf(stderr, "%s: ", file_name);
fflush(stderr);
+ perror("fseek");
+ fflush(stdout); fflush(stderr);
+ (void) fclose(fp);
return EXIT_FILE;
}
l = (lzo_uint) ll;
- if (max_len > 0 && l > max_len)
- l = max_len;
+ if (l > max_data_len) l = max_data_len;
+#if (HAVE_FTELLO)
+ if ((off_t) l != ll) l = max_data_len;
+#else
+ if ((long) l != ll) l = max_data_len;
+#endif
+
mb_alloc(mb, l);
mb->len = (lzo_uint) lzo_fread(fp, mb->ptr, mb->len);
- if (fclose(fp) != 0)
+
+ r = ferror(fp);
+ if (fclose(fp) != 0 || r != 0)
{
mb_free(mb);
- fprintf(stderr,"%s: ",file_name);
- perror("fclose");
+ fflush(stdout); fflush(stderr);
+ fprintf(stderr, "%s: ", file_name);
fflush(stderr);
+ perror("fclose");
+ fflush(stdout); fflush(stderr);
return EXIT_FILE;
}
@@ -840,7 +851,7 @@ static double t_div(double a, double b)
static double set_perc_d(double perc, char *s)
{
- if (perc <= 0) {
+ if (perc <= 0.0) {
strcpy(s, "0.0");
return 0;
}
@@ -887,7 +898,7 @@ void print_stats ( const char *method_name, const char *file_name,
d_bytes = x_len * d_loops * t_loops;
t_bytes = c_bytes + d_bytes;
- if (opt_uclock == 0)
+ if (opt_pclock == 0)
c_secs = d_secs = t_secs = 0.0;
/* speed in uncompressed megabytes per second (1 megabyte = 1.000.000 bytes) */
@@ -962,31 +973,27 @@ void print_totals ( void )
unsigned long n = total_n > 0 ? total_n : 1;
const char *t1 = "-------";
const char *t2 = total_method_names == 1 ? total_method_name : "";
-#if 1 && defined(__ACCLIB_PCLOCK_CH_INCLUDED)
- char uclock_mode[32+1];
- sprintf(uclock_mode, "[clock=%d]", uch.mode);
- t1 = uclock_mode;
- if (opt_uclock == 0) t1 = t2;
-#endif
-
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/print_totals.ch"
+#if 1 && defined(__LZOLIB_PCLOCK_CH_INCLUDED)
+ char pclock_mode[32+1];
+ sprintf(pclock_mode, "[clock=%d]", pch.mode);
+ t1 = pclock_mode;
+ if (opt_pclock == 0) t1 = t2;
#endif
#if 1
set_perc_d(total_perc / n, perc_str);
printf("%-13s %-12s %10lu %4.1f %9lu %4s %8.3f %8.3f\n",
- t1, "***AVG***",
- total_d_len / n, total_blocks * 1.0 / n, total_c_len / n, perc_str,
- t_div(total_c_mbs_n, total_c_mbs_harmonic),
- t_div(total_d_mbs_n, total_d_mbs_harmonic));
+ t1, "***AVG***",
+ total_d_len / n, total_blocks * 1.0 / n, total_c_len / n, perc_str,
+ t_div((double)total_c_mbs_n, total_c_mbs_harmonic),
+ t_div((double)total_d_mbs_n, total_d_mbs_harmonic));
#endif
set_perc(total_c_len, total_d_len, perc_str);
printf("%-13s %-12s %10lu %4lu %9lu %4s %s%8.3f %8.3f\n",
- t2, "***TOTALS***",
- total_d_len, total_blocks, total_c_len, perc_str, "",
- t_div(total_c_mbs_n, total_c_mbs_harmonic),
- t_div(total_d_mbs_n, total_d_mbs_harmonic));
+ t2, "***TOTALS***",
+ total_d_len, total_blocks, total_c_len, perc_str, "",
+ t_div((double)total_c_mbs_n, total_c_mbs_harmonic),
+ t_div((double)total_d_mbs_n, total_d_mbs_harmonic));
}
}
@@ -995,7 +1002,7 @@ void print_totals ( void )
// compress and decompress a file
**************************************************************************/
-static
+static __lzo_noinline
int process_file ( const compress_t *c, lzo_decompress_t decompress,
const char *method_name,
const char *file_name,
@@ -1005,7 +1012,7 @@ int process_file ( const compress_t *c, lzo_decompress_t decompress,
unsigned long blocks = 0;
unsigned long compressed_len = 0;
double t_time = 0, c_time = 0, d_time = 0;
- lzo_uclock_t t_start, t_stop, x_start, x_stop;
+ lzo_pclock_t t_start, t_stop, x_start, x_stop;
FILE *fp_dump = NULL;
if (opt_dump_compressed_data)
@@ -1013,8 +1020,8 @@ int process_file ( const compress_t *c, lzo_decompress_t decompress,
/* process the file */
- lzo_uclock_flush_cpu_cache(&uch, 0);
- lzo_uclock_read(&uch, &t_start);
+ lzo_pclock_flush_cpu_cache(&pch, 0);
+ lzo_pclock_read(&pch, &t_start);
for (t_i = 0; t_i < t_loops; t_i++)
{
lzo_uint len, c_len, c_len_max, d_len = 0;
@@ -1032,54 +1039,56 @@ int process_file ( const compress_t *c, lzo_decompress_t decompress,
int r;
unsigned char random_byte = (unsigned char) file_data.len;
#if 1 && defined(CLOCKS_PER_SEC)
- random_byte ^= (unsigned char) clock();
+ random_byte = (unsigned char) (random_byte ^ clock());
#endif
blocks++;
bl = len > opt_block_size ? opt_block_size : len;
/* update lengths for memchecker_xxx() */
- block1.len = bl + get_max_compression_expansion(c->id, bl);
- block2.len = bl + get_max_decompression_overrun(c->id, bl);
+ block_c.len = bl + get_max_compression_expansion(c->id, bl);
+ block_d.len = bl + get_max_decompression_overrun(c->id, bl);
#if defined(__LZO_CHECKER)
/* malloc a block of the exact size to detect any overrun */
- assert(block1.alloc_ptr == NULL);
- assert(block2.alloc_ptr == NULL);
- mb_alloc(&block1, block1.len);
- mb_alloc(&block2, block2.len);
+ assert(block_c.alloc_ptr == NULL);
+ assert(block_d.alloc_ptr == NULL);
+ mb_alloc(&block_c, block_c.len);
+ mb_alloc(&block_d, block_d.len);
#endif
- assert(block1.len <= block1.saved_len);
- assert(block2.len <= block2.saved_len);
+ assert(block_c.len <= block_c.saved_len);
+ assert(block_d.len <= block_d.saved_len);
- memchecker_init(&block1, block1.len, random_byte);
- memchecker_init(&block2, block2.len, random_byte);
+ memchecker_init(&block_c, block_c.len, random_byte);
+ memchecker_init(&block_d, block_d.len, random_byte);
/* compress the block */
c_len = c_len_max = 0;
- lzo_uclock_flush_cpu_cache(&uch, 0);
- lzo_uclock_read(&uch, &x_start);
- for (r = 0, c_i = 0; r == 0 && c_i < c_loops; c_i++)
+ lzo_pclock_flush_cpu_cache(&pch, 0);
+ lzo_pclock_read(&pch, &x_start);
+ for (r = 0, c_i = 0; c_i < c_loops; c_i++)
{
- c_len = block1.len;
- r = call_compressor(c, d, bl, block1.ptr, &c_len);
- if (r == 0 && c_len > c_len_max)
+ c_len = block_c.len;
+ r = call_compressor(c, d, bl, block_c.ptr, &c_len);
+ if (r != 0)
+ break;
+ if (c_len > c_len_max)
c_len_max = c_len;
- if (r == 0 && c_len > block1.len)
+ if (c_len > block_c.len)
goto compress_overrun;
}
- lzo_uclock_read(&uch, &x_stop);
- c_time += lzo_uclock_get_elapsed(&uch, &x_start, &x_stop);
+ lzo_pclock_read(&pch, &x_stop);
+ c_time += lzo_pclock_get_elapsed(&pch, &x_start, &x_stop);
if (r != 0)
{
- printf(" compression failed in block %ld (%d) (%lu %lu)\n",
- blocks, r, (long)c_len, (long)bl);
+ printf(" compression failed in block %lu (%d) (%lu %lu)\n",
+ blocks, r, (unsigned long)c_len, (unsigned long)bl);
return EXIT_LZO_ERROR;
}
- if (memchecker_check(&block1, block1.len, random_byte) != 0)
+ if (memchecker_check(&block_c, block_c.len, random_byte) != 0)
{
compress_overrun:
printf(" compression overwrite error in block %lu "
- "(%lu %lu %lu %lu)\n",
- blocks, (long)c_len, (long)d_len, (long)bl, (long)block1.len);
+ "(%lu %lu %lu %lu)\n",
+ blocks, (unsigned long)c_len, (unsigned long)d_len, (unsigned long)bl, (unsigned long)block_c.len);
return EXIT_LZO_ERROR;
}
@@ -1087,20 +1096,20 @@ compress_overrun:
if (c_len < bl && opt_optimize_compressed_data)
{
d_len = bl;
- r = call_optimizer(c, block1.ptr, c_len, block2.ptr, &d_len);
+ r = call_optimizer(c, block_c.ptr, c_len, block_d.ptr, &d_len);
if (r != 0 || d_len != bl)
{
printf(" optimization failed in block %lu (%d) "
- "(%lu %lu %lu)\n", blocks, r,
- (long)c_len, (long)d_len, (long)bl);
+ "(%lu %lu %lu)\n", blocks, r,
+ (unsigned long)c_len, (unsigned long)d_len, (unsigned long)bl);
return EXIT_LZO_ERROR;
}
- if (memchecker_check(&block1, block1.len, random_byte) != 0 ||
- memchecker_check(&block2, block2.len, random_byte) != 0)
+ if (memchecker_check(&block_c, block_c.len, random_byte) != 0 ||
+ memchecker_check(&block_d, block_d.len, random_byte) != 0)
{
printf(" optimize overwrite error in block %lu "
- "(%lu %lu %lu %lu)\n",
- blocks, (long)c_len, (long)d_len, (long)bl, (long)block1.len);
+ "(%lu %lu %lu %lu)\n",
+ blocks, (unsigned long)c_len, (unsigned long)d_len, (unsigned long)bl, (unsigned long)block_c.len);
return EXIT_LZO_ERROR;
}
}
@@ -1108,48 +1117,51 @@ compress_overrun:
/* dump compressed data to disk */
if (fp_dump)
{
- (void) lzo_fwrite(fp_dump, block1.ptr, c_len);
- fflush(fp_dump);
+ lzo_uint l = (lzo_uint) lzo_fwrite(fp_dump, block_c.ptr, c_len);
+ if (l != c_len || fflush(fp_dump) != 0) {
+ /* write error */
+ (void) fclose(fp_dump); fp_dump = NULL;
+ }
}
/* decompress the block and verify */
- lzo_uclock_flush_cpu_cache(&uch, 0);
- lzo_uclock_read(&uch, &x_start);
- for (r = 0, c_i = 0; r == 0 && c_i < d_loops; c_i++)
+ lzo_pclock_flush_cpu_cache(&pch, 0);
+ lzo_pclock_read(&pch, &x_start);
+ for (r = 0, c_i = 0; c_i < d_loops; c_i++)
{
d_len = bl;
- r = call_decompressor(c, decompress, block1.ptr, c_len, block2.ptr, &d_len);
- if (d_len != bl)
+ r = call_decompressor(c, decompress, block_c.ptr, c_len, block_d.ptr, &d_len);
+ if (r != 0 || d_len != bl)
break;
}
- lzo_uclock_read(&uch, &x_stop);
- d_time += lzo_uclock_get_elapsed(&uch, &x_start, &x_stop);
+ lzo_pclock_read(&pch, &x_stop);
+ d_time += lzo_pclock_get_elapsed(&pch, &x_start, &x_stop);
if (r != 0)
{
printf(" decompression failed in block %lu (%d) "
- "(%lu %lu %lu)\n", blocks, r,
- (long)c_len, (long)d_len, (long)bl);
+ "(%lu %lu %lu)\n", blocks, r,
+ (unsigned long)c_len, (unsigned long)d_len, (unsigned long)bl);
return EXIT_LZO_ERROR;
}
if (d_len != bl)
{
printf(" decompression size error in block %lu (%lu %lu %lu)\n",
- blocks, (long)c_len, (long)d_len, (long)bl);
+ blocks, (unsigned long)c_len, (unsigned long)d_len, (unsigned long)bl);
return EXIT_LZO_ERROR;
}
if (is_compressor(c))
{
- if (lzo_memcmp(d, block2.ptr, bl) != 0)
+ if (lzo_memcmp(d, block_d.ptr, bl) != 0)
{
lzo_uint x = 0;
- while (x < bl && block2.ptr[x] == d[x])
+ while (x < bl && block_d.ptr[x] == d[x])
x++;
printf(" decompression data error in block %lu at offset "
- "%lu (%lu %lu)\n", blocks, (long)x,
- (long)c_len, (long)d_len);
+ "%lu (%lu %lu)\n", blocks, (unsigned long)x,
+ (unsigned long)c_len, (unsigned long)d_len);
if (opt_compute_adler32)
printf(" checksum: 0x%08lx 0x%08lx\n",
- (long)adler_in, (long)adler_out);
+ (unsigned long)adler_in, (unsigned long)adler_out);
#if 0
printf("Orig: ");
r = (x >= 10) ? -10 : 0 - (int) x;
@@ -1157,7 +1169,7 @@ compress_overrun:
printf(" %02x", (int)d[x+j]);
printf("\nDecomp:");
for (j = r; j <= 10 && x + j < bl; j++)
- printf(" %02x", (int)block2.ptr[x+j]);
+ printf(" %02x", (int)block_d.ptr[x+j]);
printf("\n");
#endif
return EXIT_LZO_ERROR;
@@ -1166,27 +1178,28 @@ compress_overrun:
(opt_compute_crc32 && crc_in != crc_out))
{
printf(" checksum error in block %lu (%lu %lu)\n",
- blocks, (long)c_len, (long)d_len);
+ blocks, (unsigned long)c_len, (unsigned long)d_len);
printf(" adler32: 0x%08lx 0x%08lx\n",
- (long)adler_in, (long)adler_out);
+ (unsigned long)adler_in, (unsigned long)adler_out);
printf(" crc32: 0x%08lx 0x%08lx\n",
- (long)crc_in, (long)crc_out);
+ (unsigned long)crc_in, (unsigned long)crc_out);
return EXIT_LZO_ERROR;
}
}
- if (memchecker_check(&block2, block2.len, random_byte) != 0)
+ if (memchecker_check(&block_d, block_d.len, random_byte) != 0)
{
printf(" decompression overwrite error in block %lu "
- "(%lu %lu %lu %lu)\n",
- blocks, (long)c_len, (long)d_len, (long)bl, (long)block2.len);
+ "(%lu %lu %lu %lu)\n",
+ blocks, (unsigned long)c_len, (unsigned long)d_len,
+ (unsigned long)bl, (unsigned long)block_d.len);
return EXIT_LZO_ERROR;
}
#if defined(__LZO_CHECKER)
/* free in reverse order of allocations */
- mb_free(&block2);
- mb_free(&block1);
+ mb_free(&block_d);
+ mb_free(&block_c);
#endif
d += bl;
@@ -1195,11 +1208,12 @@ compress_overrun:
}
while (len > 0);
}
- lzo_uclock_read(&uch, &t_stop);
- t_time += lzo_uclock_get_elapsed(&uch, &t_start, &t_stop);
+ lzo_pclock_read(&pch, &t_stop);
+ t_time += lzo_pclock_get_elapsed(&pch, &t_start, &t_stop);
- if (fp_dump)
- fclose(fp_dump);
+ if (fp_dump) {
+ (void) fclose(fp_dump); fp_dump = NULL;
+ }
opt_dump_compressed_data = NULL; /* only dump the first file */
print_stats(method_name, file_name,
@@ -1219,12 +1233,12 @@ compress_overrun:
static
int do_file ( int method, const char *file_name,
long c_loops, long d_loops,
- lzo_uint32p p_adler, lzo_uint32p p_crc )
+ lzo_uint32_tp p_adler, lzo_uint32_tp p_crc )
{
int r;
const compress_t *c;
lzo_decompress_t decompress;
- lzo_uint32 adler, crc;
+ lzo_uint32_t adler, crc;
char method_name[256+1];
const char *n;
const long t_loops = 1;
@@ -1240,7 +1254,7 @@ int do_file ( int method, const char *file_name,
if (c == NULL || c->name == NULL || c->compress == NULL)
return EXIT_INTERNAL;
decompress = get_decomp_info(c,&n);
- if (!decompress || n == NULL || wrkmem.len < c->mem_decompress)
+ if (!decompress || n == NULL || block_w.len < c->mem_decompress)
return EXIT_INTERNAL;
strcpy(method_name,c->name);
strcat(method_name,n);
@@ -1268,9 +1282,9 @@ int do_file ( int method, const char *file_name,
if (opt_verbose >= 2)
{
printf("File %s: %lu bytes (0x%08lx, 0x%08lx)\n",
- file_name, (long) file_data.len, (long) adler, (long) crc);
+ file_name, (unsigned long) file_data.len, (unsigned long) adler, (unsigned long) crc);
printf(" compressing %lu bytes (%ld/%ld/%ld loops, %lu block-size)\n",
- (long) file_data.len, t_loops, c_loops, d_loops, (long) opt_block_size);
+ (unsigned long) file_data.len, t_loops, c_loops, d_loops, (unsigned long) opt_block_size);
printf(" %s\n", method_name);
}
@@ -1289,10 +1303,12 @@ struct corpus_entry_t
{
const char *name;
long loops;
- lzo_uint32 adler;
- lzo_uint32 crc;
+ lzo_uint32_t adler;
+ lzo_uint32_t crc;
};
+const struct corpus_entry_t *opt_corpus = NULL;
+
static const struct corpus_entry_t calgary_corpus[] =
{
{ "bib", 8, 0x4bd09e98L, 0xb856ebe8L },
@@ -1350,7 +1366,7 @@ int do_corpus ( const struct corpus_entry_t *corpus, int method, const char *pat
for (i = 0; corpus[i].name != NULL; i++)
{
- lzo_uint32 adler, crc;
+ lzo_uint32_t adler, crc;
long c = c_loops * corpus[i].loops;
long d = d_loops * corpus[i].loops;
int r;
@@ -1367,7 +1383,7 @@ int do_corpus ( const struct corpus_entry_t *corpus, int method, const char *pat
if (corpus[i].crc && crc != corpus[i].crc)
{
printf(" internal checksum error !! (0x%08lx 0x%08lx)\n",
- (long) crc, (long) corpus[i].crc);
+ (unsigned long) crc, (unsigned long) corpus[i].crc);
return EXIT_INTERNAL;
}
}
@@ -1382,46 +1398,46 @@ int do_corpus ( const struct corpus_entry_t *corpus, int method, const char *pat
static
void usage ( const char *name, int exit_code, lzo_bool show_methods )
{
- FILE *f;
+ FILE *fp;
int i;
- f = stdout;
+ fp = stdout;
fflush(stdout); fflush(stderr);
- fprintf(f,"Usage: %s [option..] file...\n", name);
- fprintf(f,"\n");
- fprintf(f,"Options:\n");
- fprintf(f," -m# compression method\n");
- fprintf(f," -b# set input block size (default %ld, max %ld)\n",
- (long) opt_block_size, (long) opt_max_data_len);
- fprintf(f," -n# number of compression/decompression runs\n");
- fprintf(f," -c# number of compression runs\n");
- fprintf(f," -d# number of decompression runs\n");
- fprintf(f," -S use safe decompressor (if available)\n");
- fprintf(f," -A use assembler decompressor (if available)\n");
- fprintf(f," -F use fast assembler decompressor (if available)\n");
- fprintf(f," -O optimize compressed data (if available)\n");
- fprintf(f," -s DIR process Calgary Corpus test suite in directory `DIR'\n");
- fprintf(f," -@ read list of files to compress from stdin\n");
- fprintf(f," -q be quiet\n");
- fprintf(f," -Q be very quiet\n");
- fprintf(f," -v be verbose\n");
- fprintf(f," -L display software license\n");
+ fprintf(fp,"Usage: %s [option..] file...\n", name);
+ fprintf(fp,"\n");
+ fprintf(fp,"Options:\n");
+ fprintf(fp," -m# compression method\n");
+ fprintf(fp," -b# set input block size (default %lu, max %lu)\n",
+ (unsigned long) opt_block_size, (unsigned long) opt_max_data_len);
+ fprintf(fp," -n# number of compression/decompression runs\n");
+ fprintf(fp," -c# number of compression runs\n");
+ fprintf(fp," -d# number of decompression runs\n");
+ fprintf(fp," -S use safe decompressor (if available)\n");
+ fprintf(fp," -A use assembler decompressor (if available)\n");
+ fprintf(fp," -F use fast assembler decompressor (if available)\n");
+ fprintf(fp," -O optimize compressed data (if available)\n");
+ fprintf(fp," -s DIR process Calgary Corpus test suite in directory `DIR'\n");
+ fprintf(fp," -@ read list of files to compress from stdin\n");
+ fprintf(fp," -q be quiet\n");
+ fprintf(fp," -Q be very quiet\n");
+ fprintf(fp," -v be verbose\n");
+ fprintf(fp," -L display software license\n");
if (show_methods)
{
-#if defined(__ACCLIB_PCLOCK_CH_INCLUDED)
- lzo_uclock_t t_dummy;
- lzo_uclock_read(&uch, &t_dummy);
- (void) lzo_uclock_get_elapsed(&uch, &t_dummy, &t_dummy);
- fprintf(f,"\nAll timings are recorded using uclock mode %d %s.\n", uch.mode, uch.name);
+#if defined(__LZOLIB_PCLOCK_CH_INCLUDED)
+ lzo_pclock_t t_dummy;
+ lzo_pclock_read(&pch, &t_dummy);
+ (void) lzo_pclock_get_elapsed(&pch, &t_dummy, &t_dummy);
+ fprintf(fp,"\nAll timings are recorded using pclock mode %d %s.\n", pch.mode, pch.name);
#endif
- fprintf(f,"\n\n");
- fprintf(f,"The following compression methods are available:\n");
- fprintf(f,"\n");
- fprintf(f," usage name memory available extras\n");
- fprintf(f," ----- ---- ------ ----------------\n");
+ fprintf(fp,"\n\n");
+ fprintf(fp,"The following compression methods are available:\n");
+ fprintf(fp,"\n");
+ fprintf(fp," usage name memory available extras\n");
+ fprintf(fp," ----- ---- ------ ----------------\n");
for (i = 0; i <= M_LAST_COMPRESSOR; i++)
{
@@ -1430,44 +1446,41 @@ void usage ( const char *name, int exit_code, lzo_bool show_methods )
if (c)
{
char n[16];
- static const char * const s[3] = {" ", ", ", ""};
- int j = 0;
+ const char *sep = " ";
unsigned long m = c->mem_compress;
sprintf(n,"-m%d",i);
- fprintf(f," %-6s %-13s",n,c->name);
+ fprintf(fp," %-6s %-13s",n,c->name);
#if 1
- fprintf(f,"%9ld", m);
+ fprintf(fp,"%9lu", m);
#else
m = (m + 1023) / 1024;
- fprintf(f,"%6ld kB", m);
+ fprintf(fp,"%6lu KiB", m);
#endif
if (c->decompress_safe)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "safe");
+ { fprintf(fp, "%s%s", sep, "safe"); sep = ", "; }
if (c->decompress_asm)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "asm");
+ { fprintf(fp, "%s%s", sep, "asm"); sep = ", "; }
if (c->decompress_asm_safe)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "asm+safe");
+ { fprintf(fp, "%s%s", sep, "asm+safe"); sep = ", "; }
if (c->decompress_asm_fast)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "fastasm");
+ { fprintf(fp, "%s%s", sep, "fastasm"); sep = ", "; }
if (c->decompress_asm_fast_safe)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "fastasm+safe");
+ { fprintf(fp, "%s%s", sep, "fastasm+safe"); sep = ", "; }
if (c->optimize)
- fprintf(f, "%s%s", j++ == 0 ? s[0] : s[1], "optimize");
- if (j > 0)
- fprintf(f, s[2]);
- fprintf(f,"\n");
+ { fprintf(fp, "%s%s", sep, "optimize"); sep = ", "; }
+ fprintf(fp, "\n");
}
}
}
else
{
- fprintf(f,"\n");
- fprintf(f,"Type '%s -m' to list all available methods.\n", name);
+ fprintf(fp,"\n");
+ fprintf(fp,"Type '%s -m' to list all available methods.\n", name);
}
- fflush(f);
+ fflush(fp);
if (exit_code < 0)
exit_code = EXIT_USAGE;
exit(exit_code);
@@ -1477,16 +1490,15 @@ void usage ( const char *name, int exit_code, lzo_bool show_methods )
static
void license(void)
{
- FILE *f;
-
- f = stdout;
+ FILE *fp;
+ fp = stdout;
fflush(stdout); fflush(stderr);
#if defined(__LZO_PROFESSIONAL__)
# include "lzopro/license.ch"
#else
-fprintf(f,
+fprintf(fp,
" The LZO library is free software; you can redistribute it and/or\n"
" modify it under the terms of the GNU General Public License as\n"
" published by the Free Software Foundation; either version 2 of\n"
@@ -1497,7 +1509,7 @@ fprintf(f,
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n"
);
-fprintf(f,
+fprintf(fp,
"\n"
" You should have received a copy of the GNU General Public License\n"
" along with the LZO library; see the file COPYING.\n"
@@ -1511,7 +1523,7 @@ fprintf(f,
);
#endif
- fflush(f);
+ fflush(fp);
exit(EXIT_OK);
}
@@ -1588,8 +1600,9 @@ static lzo_bool m_strisdigit(const char *s)
return 0;
s++;
if (*s == 0 || *s == ',')
- return 1;
+ break;
}
+ return 1;
}
@@ -1670,14 +1683,11 @@ enum {
OPT_MAX_DATA_LEN,
OPT_MAX_DICT_LEN,
OPT_SILESIA_CORPUS,
- OPT_UCLOCK,
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/o_enum.ch"
-#endif
+ OPT_PCLOCK,
OPT_UNUSED
};
-static const struct mfx_option longopts[] =
+static const struct lzo_getopt_longopt_t longopts[] =
{
/* { name has_arg *flag val } */
{"help", 0, 0, 'h'+256}, /* give help */
@@ -1689,7 +1699,7 @@ static const struct mfx_option longopts[] =
{"adler32", 0, 0, OPT_ADLER32},
{"calgary-corpus", 1, 0, OPT_CALGARY_CORPUS},
{"clear-wrkmem", 0, 0, OPT_CLEAR_WRKMEM},
- {"clock", 1, 0, OPT_UCLOCK},
+ {"clock", 1, 0, OPT_PCLOCK},
{"corpus", 1, 0, OPT_CALGARY_CORPUS},
{"crc32", 0, 0, OPT_CRC32},
{"dict", 1, 0, OPT_DICT},
@@ -1698,19 +1708,17 @@ static const struct mfx_option longopts[] =
{"max-data-length", 1, 0, OPT_MAX_DATA_LEN},
{"max-dict-length", 1, 0, OPT_MAX_DICT_LEN},
{"silesia-corpus", 1, 0, OPT_SILESIA_CORPUS},
- {"uclock", 1, 0, OPT_UCLOCK},
+ {"uclock", 1, 0, OPT_PCLOCK},
{"methods", 1, 0, 'm'},
{"totals", 0, 0, 'T'},
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/o_longopts.ch"
-#endif
{ 0, 0, 0, 0 }
};
-static int do_option(int optc)
+static int do_option(lzo_getopt_p g, int optc)
{
+#define mfx_optarg g->optarg
switch (optc)
{
case 'A':
@@ -1799,11 +1807,13 @@ static int do_option(int optc)
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
/* this is a dirty hack... */
- parse_methods(nextchar-1);
- if (nextchar[0])
- {
- nextchar = NULL;
- mfx_optind++;
+ if (g->shortpos == 0) {
+ char m[2]; m[0] = (char) optc; m[1] = 0;
+ parse_methods(m);
+ } else {
+ const char *m = &g->argv[g->optind][g->shortpos-1];
+ parse_methods(m);
+ ++g->optind; g->shortpos = 0;
}
break;
@@ -1836,20 +1846,16 @@ static int do_option(int optc)
return optc;
opt_max_dict_len = atol(mfx_optarg);
break;
- case OPT_UCLOCK:
+ case OPT_PCLOCK:
if (!mfx_optarg || !is_digit(mfx_optarg[0]))
return optc;
- opt_uclock = atoi(mfx_optarg);
-#if defined(__ACCLIB_PCLOCK_CH_INCLUDED)
- if (opt_uclock > 0)
- uch.mode = opt_uclock;
+ opt_pclock = atoi(mfx_optarg);
+#if defined(__LZOLIB_PCLOCK_CH_INCLUDED)
+ if (opt_pclock > 0)
+ pch.mode = opt_pclock;
#endif
break;
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/o_do_option.ch"
-#endif
-
case '\0':
return -1;
case ':':
@@ -1859,27 +1865,40 @@ static int do_option(int optc)
return -3;
}
return 0;
+#undef mfx_optarg
+}
+
+
+static void handle_opterr(lzo_getopt_p g, const char *f, void *v)
+{
+ struct A { va_list ap; };
+ struct A *a = (struct A *) v;
+ fprintf( stderr, "%s: ", g->progname);
+ if (a)
+ vfprintf(stderr, f, a->ap);
+ else
+ fprintf( stderr, "UNKNOWN GETOPT ERROR");
+ fprintf( stderr, "\n");
}
static int get_options(int argc, char **argv)
{
+ lzo_getopt_t mfx_getopt;
int optc;
+ static const char shortopts[] =
+ "Ab::c:C:d:D:FhHLm::n:OqQs:STvV@123456789";
- mfx_optind = 0;
- mfx_opterr = 1;
- while ((optc = mfx_getopt_long (argc, argv,
- "Ab::c:C:d:D:FhHLm::n:OqQs:STvV@123456789"
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/o_shortopts.ch"
-#endif
- , longopts, (int *)0)) >= 0)
+ lzo_getopt_init(&mfx_getopt, 1, argc, argv);
+ mfx_getopt.progname = progname;
+ mfx_getopt.opterr = handle_opterr;
+ while ((optc = lzo_getopt(&mfx_getopt, shortopts, longopts, NULL)) >= 0)
{
- if (do_option(optc) != 0)
+ if (do_option(&mfx_getopt, optc) != 0)
exit(EXIT_USAGE);
}
- return mfx_optind;
+ return mfx_getopt.optind;
}
@@ -1896,7 +1915,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
const char *s;
lzo_wildargv(&argc, &argv);
- lzo_uclock_open(&uch);
+ lzo_pclock_open_default(&pch);
progname = argv[0];
for (s = progname; *s; s++)
@@ -1906,13 +1925,11 @@ int __lzo_cdecl_main main(int argc, char *argv[])
#if defined(__LZO_PROFESSIONAL__)
printf("\nLZO Professional real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
-#elif defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/init.ch"
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
#else
printf("\nLZO real-time data compression library (v%s, %s).\n",
lzo_version_string(), lzo_version_date());
- printf("Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+ printf("Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
#endif
@@ -1935,17 +1952,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
opt_max_data_len = 64 * 1024L * 1024L;
opt_block_size = 256 * 1024L;
-#if defined(LZO_ARCH_I086) && defined(ACC_MM_AHSHIFT)
-# if 1 && defined(LZO_ARCH_I086PM) && defined(BLX286)
- opt_max_data_len = 32 * 1024L * 1024L;
-# else
- opt_max_data_len = 14 * 1024L * 1024L;
-# endif
- /* reduce memory requirements for ancient 16-bit DOS 640kB real-mode */
- if (ACC_MM_AHSHIFT != 3) {
- opt_max_data_len = 16 * 1024L;
- }
-#elif defined(LZO_OS_TOS)
+#if (LZO_ARCH_M68K && LZO_OS_TOS)
/* reduce memory requirements for 14 MB machines */
opt_max_data_len = 8 * 1024L * 1024L;
#endif
@@ -1983,21 +1990,22 @@ int __lzo_cdecl_main main(int argc, char *argv[])
* Step 4: start work
*/
- wrkmem.len = 0;
+ block_w.len = 0;
for (ii = 0; ii < methods_n; ii++) {
const compress_t *c = find_method_by_id(methods[ii]);
assert(c != NULL);
- if (c->mem_compress > wrkmem.len)
- wrkmem.len = c->mem_compress;
- if (c->mem_decompress > wrkmem.len)
- wrkmem.len = c->mem_decompress;
+ if (c->mem_compress > block_w.len)
+ block_w.len = c->mem_compress;
+ if (c->mem_decompress > block_w.len)
+ block_w.len = c->mem_decompress;
}
- mb_alloc(&wrkmem, wrkmem.len);
+ mb_alloc(&block_w, block_w.len);
+ lzo_memset(block_w.ptr, 0, block_w.len);
#if !defined(__LZO_CHECKER)
- mb_alloc_extra(&block1, opt_block_size + get_max_compression_expansion(-1, opt_block_size), 16, 16);
- mb_alloc_extra(&block2, opt_block_size + get_max_decompression_overrun(-1, opt_block_size), 16, 16);
+ mb_alloc_extra(&block_c, opt_block_size + get_max_compression_expansion(-1, opt_block_size), 16, 16);
+ mb_alloc_extra(&block_d, opt_block_size + get_max_decompression_overrun(-1, opt_block_size), 16, 16);
#endif
if (opt_dict)
@@ -2008,15 +2016,15 @@ int __lzo_cdecl_main main(int argc, char *argv[])
{
dict_load(opt_dictionary_file);
if (dict.len > 0)
- printf("Using dictionary '%s', %ld bytes, ID 0x%08lx.\n",
- opt_dictionary_file,
- (long) dict.len, (long) dict.adler);
+ printf("Using dictionary '%s', %lu bytes, ID 0x%08lx.\n",
+ opt_dictionary_file,
+ (unsigned long) dict.len, (unsigned long) dict.adler);
}
if (dict.len == 0)
{
dict_set_default();
- printf("Using default dictionary, %ld bytes, ID 0x%08lx.\n",
- (long) dict.len, (long) dict.adler);
+ printf("Using default dictionary, %lu bytes, ID 0x%08lx.\n",
+ (unsigned long) dict.len, (unsigned long) dict.adler);
}
}
@@ -2030,7 +2038,7 @@ int __lzo_cdecl_main main(int argc, char *argv[])
if (i >= argc && opt_corpus_path == NULL && !opt_read_from_stdin)
usage(progname,-1,0);
if (m == 0 && opt_verbose >= 1)
- printf("%lu block-size\n\n", (long) opt_block_size);
+ printf("%lu block-size\n\n", (unsigned long) opt_block_size);
assert(find_method_by_id(method) != NULL);
@@ -2067,25 +2075,18 @@ int __lzo_cdecl_main main(int argc, char *argv[])
}
}
}
-
-#if defined(LZOTEST_USE_DYNLOAD)
-# include "dynload/exit.ch"
-#endif
t_total = time(NULL) - t_total;
if (opt_totals)
print_totals();
if (opt_execution_time || (methods_n > 1 && opt_verbose >= 1))
- printf("\n%s: execution time: %lu seconds\n", progname, (long) t_total);
+ printf("\n%s: execution time: %lu seconds\n", progname, (unsigned long) t_total);
if (r != EXIT_OK)
printf("\n%s: exit code: %d\n", progname, r);
- lzo_uclock_close(&uch);
+ lzo_pclock_close(&pch);
return r;
}
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */
diff --git a/lzotest/mygetopt.ch b/lzotest/mygetopt.ch
deleted file mode 100644
index af4d282..0000000
--- a/lzotest/mygetopt.ch
+++ /dev/null
@@ -1,698 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
- before changing it!
-
- Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
- Free Software Foundation, Inc.
-
- 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, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#ifndef EOF
-#include <stdio.h>
-#include <string.h>
-#endif
-
-
-#undef PROGNAME
-#define PROGNAME(x) (x)
-
-
-/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
- long-named option. Because this is not POSIX.2 compliant, it is
- being phased out. */
-/* #define GETOPT_COMPAT */
-#undef GETOPT_COMPAT
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "mygetopt.h"
-#define option mfx_option
-#define optarg mfx_optarg
-#define optind mfx_optind
-#define opterr mfx_opterr
-#define optopt mfx_optopt
-#undef BAD_OPTION
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg = NULL;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* XXX 1003.2 says this must be 1 before any call. */
-int optind = 0;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-#define BAD_OPTION '\0'
-int optopt = BAD_OPTION;
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return EOF with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved.
-
- To perform the swap, we first reverse the order of all elements. So
- all options now come before all non options, but they are in the
- wrong order. So we put back the options and non options in original
- order by reversing them again. For example:
- original input: a b c -x -y
- reverse all: -y -x c b a
- reverse options: -x -y c b a
- reverse non options: -x -y a b c
-*/
-
-
-static void exchange (char **argv)
-{
- char *temp; char **first, **last;
-
- /* Reverse all the elements [first_nonopt, optind) */
- first = &argv[first_nonopt];
- last = &argv[optind-1];
- while (first < last) {
- temp = *first; *first = *last; *last = temp; first++; last--;
- }
- /* Put back the options in order */
- first = &argv[first_nonopt];
- first_nonopt += (optind - last_nonopt);
- last = &argv[first_nonopt - 1];
- while (first < last) {
- temp = *first; *first = *last; *last = temp; first++; last--;
- }
-
- /* Put back the non options in order */
- first = &argv[first_nonopt];
- last_nonopt = optind;
- last = &argv[last_nonopt-1];
- while (first < last) {
- temp = *first; *first = *last; *last = temp; first++; last--;
- }
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns `EOF'.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return BAD_OPTION after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return BAD_OPTION.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-static int _getopt_internal (int argc, char **argv, const char *optstring,
- const struct option *longopts, int *longind,
- int long_only)
-{
- static char empty_string[1];
- int option_index;
-
- if (longind != NULL)
- *longind = -1;
-
- optarg = 0;
-
- /* Initialize the internal data when the first call is made.
- Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- if (optind == 0)
- {
- first_nonopt = last_nonopt = optind = 1;
-
- nextchar = NULL;
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
-#if 0
- else if (getenv ("POSIXLY_CORRECT") != NULL)
- ordering = REQUIRE_ORDER;
-#endif
- else
- ordering = PERMUTE;
- }
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange (argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Now skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc
- && (argv[optind][0] != '-' || argv[optind][1] == '\0')
-#ifdef GETOPT_COMPAT
- && (longopts == NULL
- || argv[optind][0] != '+' || argv[optind][1] == '\0')
-#endif /* GETOPT_COMPAT */
- )
- optind++;
- last_nonopt = optind;
- }
-
- /* Special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange (argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return EOF;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
-#ifdef GETOPT_COMPAT
- && (longopts == NULL
- || argv[optind][0] != '+' || argv[optind][1] == '\0')
-#endif /* GETOPT_COMPAT */
- )
- {
- if (ordering == REQUIRE_ORDER)
- return EOF;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Start decoding its characters. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- if (longopts != NULL
- && ((argv[optind][0] == '-'
- && (argv[optind][1] == '-' || long_only))
-#ifdef GETOPT_COMPAT
- || argv[optind][0] == '+'
-#endif /* GETOPT_COMPAT */
- ))
- {
- const struct option *p;
- char *s = nextchar;
- int exact = 0;
- int ambig = 0;
- const struct option *pfound = NULL;
- int indfound = 0;
- int needexact = 0;
-
- /* allow `--option#value' because you cannout assign a '='
- to an environment variable under DOS command.com */
- while (*s && *s != '=' && * s != '#')
- s++;
-
- /* Test all options for either exact match or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name;
- p++, option_index++)
- if (!strncmp (p->name, nextchar, (unsigned) (s - nextchar)))
- {
- if (p->has_arg & 0x10)
- needexact = 1;
- if ((unsigned) (s - nextchar) == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second nonexact match found. */
- ambig = 1;
- }
-
- /* don't allow nonexact longoptions */
- if (needexact && !exact)
- {
- if (opterr)
- fprintf (stderr, "%s: unrecognized option `%s'\n",
- PROGNAME(argv[0]), argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return BAD_OPTION;
- }
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, "%s: option `%s' is ambiguous\n",
- PROGNAME(argv[0]), argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return BAD_OPTION;
- }
-
- if (pfound != NULL)
- {
- int have_arg = (s[0] != '\0');
- if (have_arg && (pfound->has_arg & 0xf))
- have_arg = (s[1] != '\0');
- option_index = indfound;
- optind++;
- if (have_arg)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg & 0xf)
- optarg = s + 1;
- else
- {
- if (opterr)
- {
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- "%s: option `--%s' doesn't allow an argument\n",
- PROGNAME(argv[0]), pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- "%s: option `%c%s' doesn't allow an argument\n",
- PROGNAME(argv[0]), argv[optind - 1][0], pfound->name);
- }
- nextchar += strlen (nextchar);
- return BAD_OPTION;
- }
- }
- else if ((pfound->has_arg & 0xf) == 1)
- {
-#if 0
- if (optind < argc)
-#else
- if (optind < argc && (pfound->has_arg & 0x20) == 0)
-#endif
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
- PROGNAME(argv[0]), pfound->name,
- (pfound->has_arg & 0x20) ? "=" : "");
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : BAD_OPTION;
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
-#ifdef GETOPT_COMPAT
- || argv[optind][0] == '+'
-#endif /* GETOPT_COMPAT */
- || strchr (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, "%s: unrecognized option `--%s'\n",
- PROGNAME(argv[0]), nextchar);
- else
- /* +option or -option */
- fprintf (stderr, "%s: unrecognized option `%c%s'\n",
- PROGNAME(argv[0]), argv[optind][0], nextchar);
- }
- nextchar = empty_string;
- optind++;
- return BAD_OPTION;
- }
- (void) &ambig; /* UNUSED */
- }
-
- /* Look at and handle the next option-character. */
-
- {
- char c = *nextchar++;
- const char *temp = strchr (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
-#if 0
- if (c < 040 || c >= 0177)
- fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
- PROGNAME(argv[0]), c);
- else
- fprintf (stderr, "%s: unrecognized option `-%c'\n", PROGNAME(argv[0]), c);
-#else
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: illegal option -- %c\n", PROGNAME(argv[0]), c);
-#endif
- }
- optopt = c;
- return BAD_OPTION;
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = 0;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
-#if 0
- fprintf (stderr, "%s: option `-%c' requires an argument\n",
- PROGNAME(argv[0]), c);
-#else
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, "%s: option requires an argument -- %c\n",
- PROGNAME(argv[0]), c);
-#endif
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = BAD_OPTION;
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int mfx_getopt(int argc, char **argv, const char *optstring)
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-int mfx_getopt_long(int argc, char **argv, const char *options,
- const struct option *long_options, int *opt_index)
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == EOF)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case BAD_OPTION:
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
-
-
-/*
-vi:ts=4:et:nowrap
-*/
-
diff --git a/lzotest/mygetopt.h b/lzotest/mygetopt.h
deleted file mode 100644
index a0de9af..0000000
--- a/lzotest/mygetopt.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Declarations for getopt.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-
- 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, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef __MFX_GETOPT_H
-#define __MFX_GETOPT_H 1
-
-#ifdef __cplusplus
-/* extern "C" { */
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern char *mfx_optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern int mfx_optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern int mfx_opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern int mfx_optopt;
-
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct mfx_option
-{
- const char *name;
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-#define mfx_no_argument 0
-#define mfx_required_argument 1
-#define mfx_optional_argument 2
-#define mfx_exact_argument 0x10 /* no abbrev. */
-
-int mfx_getopt(int argc, char **argv, const char *shortopts);
-int mfx_getopt_long(int argc, char **argv, const char *shortopts,
- const struct mfx_option *longopts, int *longind);
-
-#ifdef __cplusplus
-/* } */
-#endif
-
-#endif /* __MFX_GETOPT_H */
diff --git a/lzotest/wrap.h b/lzotest/wrap.h
index e883605..772dbe0 100644
--- a/lzotest/wrap.h
+++ b/lzotest/wrap.h
@@ -2,19 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -223,9 +211,9 @@ memcpy_x_compress ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem )
{
- lzo_memcpy(dst,src,src_len);
+ lzo_memcpy(dst, src, src_len);
*dst_len = src_len;
- if (wrkmem) wrkmem = 0; /* avoid warning */
+ LZO_UNUSED(wrkmem);
return 0;
}
@@ -235,10 +223,9 @@ memset_x_compress ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem )
{
- lzo_memset(dst,0,src_len);
+ lzo_memset(dst, 0, src_len);
*dst_len = src_len;
- if (src) src = 0; /* avoid warning */
- if (wrkmem) wrkmem = 0; /* avoid warning */
+ LZO_UNUSED(src); LZO_UNUSED(wrkmem);
return 0;
}
@@ -248,12 +235,11 @@ adler32_x_compress ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem )
{
- lzo_uint32 adler;
+ lzo_uint32_t adler;
adler = lzo_adler32(0, NULL, 0);
adler = lzo_adler32(adler, dst, src_len);
*dst_len = src_len;
- if (src) src = 0; /* avoid warning */
- if (wrkmem) wrkmem = 0; /* avoid warning */
+ LZO_UNUSED(src); LZO_UNUSED(wrkmem);
return 0;
}
@@ -263,12 +249,11 @@ crc32_x_compress ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem )
{
- lzo_uint32 crc;
+ lzo_uint32_t crc;
crc = lzo_crc32(0, NULL, 0);
crc = lzo_crc32(crc, dst, src_len);
*dst_len = src_len;
- if (src) src = 0; /* avoid warning */
- if (wrkmem) wrkmem = 0; /* avoid warning */
+ LZO_UNUSED(src); LZO_UNUSED(wrkmem);
return 0;
}
@@ -278,7 +263,4 @@ crc32_x_compress ( const lzo_bytep src, lzo_uint src_len,
#endif
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */
diff --git a/lzotest/wrapmisc.h b/lzotest/wrapmisc.h
index 3fad078..8fb65b6 100644
--- a/lzotest/wrapmisc.h
+++ b/lzotest/wrapmisc.h
@@ -2,19 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -51,14 +39,14 @@ static
int zlib_compress ( const m_bytep src, m_uint src_len,
m_bytep dst, m_uintp dst_len,
m_voidp wrkmem,
- int method, int level )
+ int method, int compression_level )
{
int err;
uLong destLen;
assert(method == Z_DEFLATED);
- destLen = *dst_len;
- err = compress2(dst, &destLen, src, src_len, level);
+ destLen = (uLong) *dst_len;
+ err = compress2(dst, &destLen, src, (uLong) src_len, compression_level);
*dst_len = destLen;
LZO_UNUSED(method);
LZO_UNUSED(wrkmem);
@@ -74,8 +62,8 @@ zlib_decompress ( const m_bytep src, m_uint src_len,
int err;
uLong destLen;
- destLen = *dst_len;
- err = uncompress(dst, &destLen, src, src_len);
+ destLen = (uLong) *dst_len;
+ err = uncompress(dst, &destLen, src, (uLong) src_len);
*dst_len = destLen;
LZO_UNUSED(wrkmem);
return err;
@@ -153,15 +141,15 @@ static
int bzip2_compress ( const m_bytep src, m_uint src_len,
m_bytep dst, m_uintp dst_len,
m_voidp wrkmem,
- int level )
+ int compression_level )
{
int err;
unsigned destLen;
- union { const m_bytep csrc; char* src; } u;
+ union { const m_bytep csrc; char *src; } u;
u.csrc = src; /* UNCONST */
destLen = *dst_len;
- err = BZ2_bzBuffToBuffCompress((char*)dst, &destLen, u.src, src_len, level, 0, 0);
+ err = BZ2_bzBuffToBuffCompress((char*)dst, &destLen, u.src, src_len, compression_level, 0, 0);
*dst_len = destLen;
LZO_UNUSED(wrkmem);
return err;
@@ -175,7 +163,7 @@ bzip2_decompress ( const m_bytep src, m_uint src_len,
{
int err;
unsigned destLen;
- union { const m_bytep csrc; char* src; } u;
+ union { const m_bytep csrc; char *src; } u;
u.csrc = src; /* UNCONST */
destLen = *dst_len;
@@ -256,7 +244,7 @@ zlib_adler32_x_compress ( const m_bytep src, m_uint src_len,
m_voidp wrkmem )
{
uLong adler;
- adler = adler32(1L, src, src_len);
+ adler = adler32(1L, src, (uInt) src_len);
*dst_len = src_len;
LZO_UNUSED(adler);
LZO_UNUSED(dst);
@@ -271,7 +259,7 @@ zlib_crc32_x_compress ( const m_bytep src, m_uint src_len,
m_voidp wrkmem )
{
uLong crc;
- crc = crc32(0L, src, src_len);
+ crc = crc32(0L, src, (uInt) src_len);
*dst_len = src_len;
LZO_UNUSED(crc);
LZO_UNUSED(dst);
@@ -282,7 +270,4 @@ zlib_crc32_x_compress ( const m_bytep src, m_uint src_len,
#endif /* ALG_ZLIB */
-/*
-vi:ts=4:et
-*/
-
+/* vim:set ts=4 sw=4 et: */