diff options
author | Norbert Preining <preining@logic.at> | 2008-01-06 16:15:58 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-06 16:15:58 +0000 |
commit | 671de1e35391acc8a31f65bae5fb6f0bba7e3260 (patch) | |
tree | 8f980781577e09a249357527889151367ad0214c /Build/source/utils/lzma-utils/src/liblzmadec | |
parent | c41ad86162841be21f43c07708a59c4978338327 (diff) |
remove old lzma-utils
git-svn-id: svn://tug.org/texlive/trunk@6052 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/lzma-utils/src/liblzmadec')
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/Makefile.am | 6 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/Makefile.in | 494 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/buffer.c | 83 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/io.c | 334 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/lzmadec.h | 305 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/main.c | 733 | ||||
-rw-r--r-- | Build/source/utils/lzma-utils/src/liblzmadec/private.h | 173 |
7 files changed, 0 insertions, 2128 deletions
diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.am b/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.am deleted file mode 100644 index f8e89ffdbe8..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -lib_LTLIBRARIES = liblzmadec.la -liblzmadec_la_SOURCES = private.h main.c buffer.c io.c -liblzmadec_la_LDFLAGS = -version-info 0:0:0 - -lzmadecincludedir = $(includedir) -lzmadecinclude_HEADERS = lzmadec.h diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.in b/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.in deleted file mode 100644 index 2eb4277a1fe..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/Makefile.in +++ /dev/null @@ -1,494 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 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@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -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@ -subdir = src/liblzmadec -DIST_COMMON = $(lzmadecinclude_HEADERS) $(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 = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(lzmadecincludedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -liblzmadec_la_LIBADD = -am_liblzmadec_la_OBJECTS = main.lo buffer.lo io.lo -liblzmadec_la_OBJECTS = $(am_liblzmadec_la_OBJECTS) -liblzmadec_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(liblzmadec_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(liblzmadec_la_SOURCES) -DIST_SOURCES = $(liblzmadec_la_SOURCES) -lzmadecincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(lzmadecinclude_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -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@ -GREP = @GREP@ -INSTALL = @INSTALL@ -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@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -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@ -SDK_CFLAGS = @SDK_CFLAGS@ -SDK_CXXFLAGS = @SDK_CXXFLAGS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -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@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -lib_LTLIBRARIES = liblzmadec.la -liblzmadec_la_SOURCES = private.h main.c buffer.c io.c -liblzmadec_la_LDFLAGS = -version-info 0:0:0 -lzmadecincludedir = $(includedir) -lzmadecinclude_HEADERS = lzmadec.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(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 src/liblzmadec/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/liblzmadec/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: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -liblzmadec.la: $(liblzmadec_la_OBJECTS) $(liblzmadec_la_DEPENDENCIES) - $(liblzmadec_la_LINK) -rpath $(libdir) $(liblzmadec_la_OBJECTS) $(liblzmadec_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@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 -install-lzmadecincludeHEADERS: $(lzmadecinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(lzmadecincludedir)" || $(MKDIR_P) "$(DESTDIR)$(lzmadecincludedir)" - @list='$(lzmadecinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(lzmadecincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(lzmadecincludedir)/$$f'"; \ - $(lzmadecincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(lzmadecincludedir)/$$f"; \ - done - -uninstall-lzmadecincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(lzmadecinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(lzmadecincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(lzmadecincludedir)/$$f"; \ - done - -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)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - 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 $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(lzmadecincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -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-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-lzmadecincludeHEADERS - -install-dvi: install-dvi-am - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -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-libLTLIBRARIES uninstall-lzmadecincludeHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool 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-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-lzmadecincludeHEADERS \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am 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-libLTLIBRARIES \ - uninstall-lzmadecincludeHEADERS - -# 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/Build/source/utils/lzma-utils/src/liblzmadec/buffer.c b/Build/source/utils/lzma-utils/src/liblzmadec/buffer.c deleted file mode 100644 index 0b268bcd1ea..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/buffer.c +++ /dev/null @@ -1,83 +0,0 @@ -/****************************************************************************** - - Decode the whole source buffer at once - - Copyright (C) 2005 Lasse Collin <lasse.collin@tukaani.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <assert.h> -#include "lzmadec.h" -#include "private.h" - -extern int_fast8_t -lzmadec_buffer (uint8_t *dest, size_t *dest_len, - uint8_t *source, const size_t source_len) -{ - lzmadec_stream strm; - int8_t ret; - - /* Initialize the decoder */ - strm.next_in = source; - strm.avail_in = source_len; - strm.next_out = dest; - strm.avail_out = *dest_len; - strm.lzma_alloc = NULL; - strm.lzma_free = NULL; - strm.opaque = NULL; - ret = lzmadec_init (&strm); - if (ret != LZMADEC_OK) - return ret; - - /* Check that the destination buffer is big enough. With streamed - LZMA data we can only hope it is big enough before starting - the decoding process; if it is too small, we will return - LZMADEC_BUF_ERROR after decoding dest_len bytes. */ - if (strm.avail_out - < ((lzmadec_state*)(strm.state))->uncompressed_size) - return LZMADEC_BUF_ERROR; /* Too small destination buffer */ - - /* Call the decoder. One pass is enough if everything is OK. */ - ret = lzmadec_decode (&strm, 1); - - /* Set *dest_len to amount of bytes actually decoded. */ - assert (*dest_len >= strm.avail_out); - *dest_len -= strm.avail_out; - - /* Free the allocated memory no matter did the decoding - go well or not. */ - lzmadec_end (&strm); - - /* Check the return value of lzmadec_decode() and return appropriate - return value */ - switch (ret) { - case LZMADEC_STREAM_END: - /* Everything has been decoded and put to - the destination buffer. */ - return LZMADEC_OK; - case LZMADEC_OK: - /* Decoding went fine so far but not all of the - uncompressed data did fit to the destination - buffer. This should happen only with streamed LZMA - data (otherwise liblzmadec might have a bug). */ - assert (((lzmadec_state*)(strm.state))->streamed == 1); - return LZMADEC_BUF_ERROR; - default: - assert (ret == LZMADEC_DATA_ERROR); - return LZMADEC_DATA_ERROR; - } -} diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/io.c b/Build/source/utils/lzma-utils/src/liblzmadec/io.c deleted file mode 100644 index 32a234e977e..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/io.c +++ /dev/null @@ -1,334 +0,0 @@ -/****************************************************************************** - - LZMA decoder library with a zlib like API - lzma_FILE I/O functions - - Copyright (C) 1999-2005 Igor Pavlov (http://7-zip.org/) - Copyright (C) 2005 Lasse Collin <lasse.collin@tukaani.org> - Based on zlib.h and bzlib.h. FIXME - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - -******************************************************************************/ - -#ifndef LZMADEC_NO_STDIO - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#ifdef HAVE_ERRNO_H -#include <errno.h> -#else -extern int errno -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#define LZMADEC_NO_STDIO -#include "lzmadec.h" -#undef LZMADEC_NO_STDIO - -#include "private.h" - -#define LZMADEC_BUFSIZE (LZMA_IN_BUFFER_SIZE - LZMA_REQUIRED_IN_BUFFER_SIZE) - -#define LZMADEC_IO_STATUS_OK 0 -#define LZMADEC_IO_STATUS_EOF 1 -#define LZMADEC_IO_STATUS_ERROR 2 - -typedef struct { - lzmadec_stream strm; - FILE *file; - uint8_t buffer[LZMADEC_BUFSIZE]; - int_fast8_t status; -} lzmadec_FILE; - - -/**************************** - Opening and closing a file - ****************************/ - -/* This is used by lzmadec_open() and lzmadec_dopen(). */ -static lzmadec_FILE * -lzmadec_open_init (lzmadec_FILE *lfile) -{ - /* Check if the file was opened successfully */ - if (lfile->file == NULL) { - int saved_errno = errno; - free (lfile); - errno = saved_errno; - return NULL; /* Caller can read errno */ - } - /* Initialize the decoder */ - lfile->strm.lzma_alloc = NULL; - lfile->strm.lzma_free = NULL; - lfile->strm.opaque = NULL; - lfile->strm.avail_in = 0; - lfile->strm.avail_out = 0; - if (lzmadec_init (&lfile->strm) != LZMADEC_OK) { - fclose (lfile->file); - free (lfile); - /* Set errno like fopen(2) (and malloc(3)) would set it: */ - errno = ENOMEM; - return NULL; /* Caller can see faked malloc()'s errno */ - } - /* Not yet at the end of the stream. */ - lfile->status = LZMADEC_IO_STATUS_OK; - return lfile; -} - -extern lzmadec_FILE * -lzmadec_open (const char *path) -{ - /* Allocate memory for the lzmadec_FILE */ - lzmadec_FILE *lfile = malloc (sizeof (lzmadec_FILE)); - if (lfile == NULL) - return NULL; - /* Open the file */ - lfile->file = fopen (path, "rb"); - /* The rest is shared with lzmadec_open() */ - return lzmadec_open_init (lfile); -} - -extern lzmadec_FILE * -lzmadec_dopen (int fd) -{ - /* Allocate memory for the lzmadec_FILE */ - lzmadec_FILE *lfile = malloc (sizeof (lzmadec_FILE)); - if (lfile == NULL) - return NULL; - /* Open the file */ - lfile->file = fdopen (fd, "rb"); - /* The rest is shared with lzmadec_open() */ - return lzmadec_open_init (lfile); -} - -extern int_fast8_t -lzmadec_close (lzmadec_FILE *lfile) -{ - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - lzmadec_end (&lfile->strm); - fclose (lfile->file); - lfile->file = NULL; - free (lfile); - return 0; -} - - -/**************** - Reading a file - ****************/ - -extern ssize_t -lzmadec_read (lzmadec_FILE *lfile, uint8_t *buf, const size_t len) -{ - int_fast8_t ret; - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - /* Check status */ - if (lfile->status == LZMADEC_IO_STATUS_ERROR) - return -1; - if (lfile->status == LZMADEC_IO_STATUS_EOF) - return 0; - /* The return value is ssize_t so we limit the maximum read size. */ - lfile->strm.avail_out = MIN (len, SIZE_MAX / 2 - 1); - lfile->strm.next_out = buf; - do { - if (lfile->strm.avail_in == 0) { - lfile->strm.next_in = lfile->buffer; - lfile->strm.avail_in = fread (lfile->buffer, - sizeof (uint8_t), LZMADEC_BUFSIZE, - lfile->file); - } - ret = lzmadec_decode (&lfile->strm, lfile->strm.avail_in == 0); - } while (lfile->strm.avail_out != 0 && ret == LZMADEC_OK); - if (ret == LZMADEC_STREAM_END) - lfile->status = LZMADEC_IO_STATUS_EOF; - if (ret < 0) - return -1; /* FIXME: errno? */ - return (len - lfile->strm.avail_out); -} - -/* Read until '\n' or '\0' or at maximum of len bytes. - Slow implementation, similar to what is in zlib. */ -extern uint8_t * -lzmadec_gets (lzmadec_FILE *lfile, uint8_t *buf, size_t len) -{ - int_fast8_t ret; - uint8_t *buf_start = buf; - /* Sanity checks */ - if (buf == NULL || len < 1) - return NULL; - if (lfile == NULL || lfile->strm.state == NULL) - return NULL; - /* Read byte by byte (sloooow) and stop when 1) buf is full - 2) end of file 3) '\n' or '\0' is found. */ - while (--len > 0) { - ret = lzmadec_read (lfile, buf, 1); - if (ret != 1) { - /* Error checking: 1) decoding error or 2) end of file - and no characters were read. */ - if (ret < 0 || buf == buf_start) - return NULL; - break; - } - if (*buf == '\0') - return buf_start; - if (*buf++ == '\n') - break; - } - *buf = '\0'; - return buf_start; -} - -extern int -lzmadec_getc (lzmadec_FILE *lfile) -{ - uint8_t c; - if (lzmadec_read (lfile, &c, 1) == 0) - return -1; - return (int)(c); -} - - -/******* - Other - *******/ - -extern off_t -lzmadec_tell (lzmadec_FILE *lfile) -{ - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - return (off_t)(lfile->strm.total_out); -} - -extern int_fast8_t -lzmadec_eof (lzmadec_FILE *lfile) -{ - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - return lfile->status == LZMADEC_IO_STATUS_EOF; -} - -extern int_fast8_t -lzmadec_rewind (lzmadec_FILE *lfile) -{ - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - /* Rewinding is done by closing the old lzmadec_stream - and reinitializing it. */ - if (lzmadec_end (&lfile->strm) != LZMADEC_OK) { - lfile->status = LZMADEC_IO_STATUS_ERROR; - return -1; - } - rewind (lfile->file); - if (lzmadec_init (&lfile->strm) != LZMADEC_OK) { - lfile->status = LZMADEC_IO_STATUS_ERROR; - return -1; - } - lfile->status = LZMADEC_IO_STATUS_OK; - return 0; -} - -extern off_t -lzmadec_seek (lzmadec_FILE *lfile, off_t offset, int whence) -{ - off_t oldpos = (off_t)(lfile->strm.total_out); - off_t newpos; - /* Simple check that lfile looks like a valid lzmadec_FILE. */ - if (lfile == NULL || lfile->strm.state == NULL) - return -1; - /* Get the new absolute position. */ - switch (whence) { - case SEEK_SET: - /* Absolute position must be >= 0. */ - if (offset < 0) - return -1; - newpos = offset; - break; - case SEEK_CUR: - /* Need to be careful to avoid integer overflows. */ - if ((offset < 0 && (off_t)(-1 * offset) > oldpos) - || - (offset > 0 && (off_t)(offset) + oldpos - < oldpos)) - return (off_t)(-1); - newpos = (off_t)(lfile->strm.total_out) + offset; - break; - case SEEK_END: - /* zlib doesn't support SEEK_END. However, liblzmadec - provides this as a way to find out uncompressed - size of a streamed file (streamed files don't have - uncompressed size in their header). */ - newpos = -1; - break; - default: - /* Invalid whence */ - errno = EINVAL; - return -1; - } - /* Seeking with a valid whence value always clears - the end of file indicator. */ - lfile->status = LZMADEC_IO_STATUS_OK; - /* If the new absolute position is backward from current position, - we need to rewind and uncompress from the beginning of the file. - This is usually slow and thus not recommended. */ - if (whence != SEEK_END && newpos < oldpos) { - if (lzmadec_rewind (lfile)) - return -1; - oldpos = 0; - assert (lfile->strm.total_out == 0); - } - /* Maybe we are lucky and don't need to seek at all. ;-) */ - if (newpos == oldpos) - return oldpos; - assert (newpos > oldpos || newpos == -1); - /* Read as many bytes as needed to reach the requested position. */ - { - /* strm.next_out cannot be NULL so use a temporary buffer. */ - uint8_t buf[LZMADEC_BUFSIZE]; - size_t req_size; - ssize_t got_size; - while (newpos > oldpos || newpos == -1) { - req_size = MIN (LZMADEC_BUFSIZE, newpos - oldpos); - got_size = lzmadec_read (lfile, buf, req_size); - if (got_size != (ssize_t)(req_size)) { - if (got_size < 0) { - return -1; /* Stream error */ - } else { - /* End of stream */ - newpos = oldpos + got_size; - break; - } - } - oldpos += got_size; - }; - } - assert (newpos == oldpos); - assert ((off_t)(lfile->strm.total_out) == newpos); - return newpos; -} - -#endif /* ifndef LZMADEC_NO_STDIO */ diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/lzmadec.h b/Build/source/utils/lzma-utils/src/liblzmadec/lzmadec.h deleted file mode 100644 index 146d832630f..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/lzmadec.h +++ /dev/null @@ -1,305 +0,0 @@ -/****************************************************************************** - - LZMA decoder library with a zlib like API - - * WARNING WARNING WARNING WARNING WARNING WARNING * - * * - * This library hasn't been maintained since 2005. * - * This will be replaced by liblzma once it is * - * finished. liblzma will provide all the features * - * of liblzmadec and a lot more. * - * * - * WARNING WARNING WARNING WARNING WARNING WARNING * - - Copyright (C) 1999-2005 Igor Pavlov (http://7-zip.org/) - Copyright (C) 2005 Lasse Collin <lasse.collin@tukaani.org> - Based on zlib.h and bzlib.h. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - -******************************************************************************/ - - -/************************* - WARNING WARNING WARNING - Comments about return - codes etc. are not up - to date. - *************************/ - - -#ifndef LZMADEC_H -#define LZMADEC_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********** - Includes - **********/ - -#include <sys/types.h> -#include <inttypes.h> - -/* Define LZMADEC_NO_STDIO to not include stdio.h and lzmadec_FILE functions. */ -#ifndef LZMADEC_NO_STDIO -#include <stdio.h> -#endif - - -/******************* - Defines/Constants - *******************/ - -/* Size in bytes of the smallest possible LZMA encoded file */ -#define LZMADEC_MINIMUM_SIZE 18 - -/* Return values */ -#define LZMADEC_OK 0 -#define LZMADEC_STREAM_END 1 -#define LZMADEC_HEADER_ERROR (-2) -#define LZMADEC_DATA_ERROR (-3) -#define LZMADEC_MEM_ERROR (-4) -#define LZMADEC_BUF_ERROR (-5) -#define LZMADEC_SEQUENCE_ERROR (-6) -/* - LZMADEC_OK - Operation succeeded or some progress has been made. - - LZMADEC_STREAM_END - The end of the encoded data has been reached. Note that this is - a possible return value even when finish_decoding == LZMADEC_RUN. - - LZMADEC_DATA_ERROR - Something wrong with the input data. - - LZMADEC_MEM_ERROR - The memory allocation function returned a NULL pointer. The same - function can be called again with the same arguments to try again. - - LZMADEC_BUF_ERROR - You should provide more input in next_in and set avail_in accordingly. - The first call to lzmadec_decode() must provide at least 18 bytes of - input data. Subsequent calls can any amount of data (or no data at all). - Note that LZMADEC_BUF_ERROR is not fatal and decoding can continue by - supplying more input data. -*/ - - -/********** - typedefs - **********/ - -typedef struct { - uint8_t *next_in; - size_t avail_in; - uint_fast64_t total_in; - - uint8_t *next_out; - size_t avail_out; - uint_fast64_t total_out; - - void *state; /* Internal state, not visible outside the library */ - - void *(*lzma_alloc)(void *, size_t, size_t); - void (*lzma_free)(void *, void *); - void *opaque; -} lzmadec_stream; - -typedef struct { - uint_fast64_t uncompressed_size; - uint_fast32_t dictionary_size; - uint_fast32_t internal_data_size; - uint_fast8_t is_streamed; - uint_fast8_t pb; - uint_fast8_t lp; - uint_fast8_t lc; -} lzmadec_info; - -#ifndef LZMADEC_NO_STDIO -typedef void lzmadec_FILE; -#endif - - -/********************* - Single call decoding - *********************/ - -extern int_fast8_t lzmadec_buffer ( - uint8_t *dest, size_t *dest_len, - uint8_t *source, const size_t source_len); -/* - Decode the data from source buffer to destination buffer with - a single pass. - - Return values: - LZMADEC_OK Decoding successful - LZMADEC_HEADER_ERROR Invalid header - LZMADEC_MEM_ERROR Not enough memory - LZMADEC_DATA_ERROR Corrupted source data - LZMADEC_BUF_ERROR Destination buffer too small - - Equivalent in zlib: uncompress() -*/ - - -/********************* - Multi call decoding - *********************/ - -extern int_fast8_t lzmadec_init (lzmadec_stream *strm); -/* - Initialize the decoder. - - Return values: - LZMADEC_OK - LZMADEC_HEADER_ERROR - LZMADEC_MEM_ERROR - - Equivalent in zlib: inflateInit() -*/ - -extern int_fast8_t -lzmadec_decode (lzmadec_stream *strm, const int_fast8_t finish_decoding); -/* - The finish_decoding flag - - In contrast to zlib and bzlib, liblzmadec can detect the end of the - compressed stream only with streamed LZMA data. Non-streamed data - does not contain any end of stream marker and thus needs the - finish_decoding flag to be set to decode the last bytes of the data. - - When the finish_decoding is zero, - This is a sign to the decoder that even if avail_in == 0 happened to - be true, there can still be more input data not passed to the library - yet. It is safe to call lzmadec_decode with LZMADEC_RUN even if all - the data has been passed to the library already; in that case there - there will usually be bytes left in the internal output buffer. - - Set the finish_decoding to non-zero to sign the decoder that all - the input has been given to it via next_in buffer. Once called with - non-zero finish_decoding flag, it should not be unset or an error - will be returned. - - If you can assure that (avail_in > 0) on every lzmadec_decode() call - before all the data has been passed to the decoder library, the - simplest way is to use (strm.avail_in == 0) as the finish_decoding - value. - - Return values: - LZMADEC_OK - LZMADEC_STREAM_END - LZMADEC_DATA_ERROR - LZMADEC_HEADER_ERROR (only right after initialization) - LZMADEC_MEM_ERROR (only right after initialization) - - Equivalent in zlib: inflate() -*/ - -int_fast8_t lzmadec_end (lzmadec_stream *strm); -/* - Return values: - LZMADEC_OK - LZMADEC_STREAM_ERROR FIXME - - Equivalent in zlib: inflateEnd() -*/ - - -/************* - Information - *************/ - -extern int_fast8_t lzmadec_buffer_info ( - lzmadec_info *info, const uint8_t *buffer, const size_t len); -/* - Parse the header of a LZMA stream. The header size is - 13 bytes; make sure there is at least 13 bytes available - in the buffer. Information about parsed header will be stored - to *info. - - Most common uses for this function are checking - - the uncompressed size of the file (if availabe) - - how much RAM is needed to decompress the data. - - uncompressed_size Uncompressed size of the data as bytes - - dictionary_size Dictionary size as bytes; depends only on - settings used when compressing the data. - - internal_data_size The amount of memory needed by liblzmadec - to decode the data excluding the dictionary - size. Note that this value depends not only - about the used compression settings but - also the implementation and/or compile time - settings; specifically sizeof(uint_fast16_t). - - is_streamed Zero if the data is non-streamed LZMA, and - non-zero for streamed. This flag is set - simply by checking the size field. - - pb Number of pos bits; can be from 0 to 4. - - lp Number of literal pos bits; from 0 to 4. - - lc Number of literal context bits; from 0 to 8. - - To know how much memory is needed to compress a specific stream, - add up dictionary_size and internal_data_size. Note that if the - dictionary is extremely huge, the result might not fit in - uint_fast32_t. ;-) - - WARNING: LZMA streams have no magic first bytes. All data - that has 0x00 - 0xE1 as the first byte in the buffer will - return LZMADEC_OK. - - Return values: - LZMADEC_OK All OK, the information was stored to *info. - LZMADEC_BUF_ERROR len is too small. - LZMADEC_HEADER_ERROR Invalid header data. -*/ - -extern const uint8_t *lzmadec_version (void); -/* - Return a pointer to a statically allocated string containing the version - number of the liblzmadec. The version number format is x.yy.z where - x.yy is the version of LZMA SDK from http://7-zip.org/sdk.html, and x - is - - Equivalent in zlib: zlibVersion() -*/ - - -/********** - File I/O - **********/ -#ifndef LZMADEC_NO_STDIO - -extern lzmadec_FILE *lzmadec_open (const char *path); -extern lzmadec_FILE *lzmadec_dopen (int fd); -extern ssize_t lzmadec_read (lzmadec_FILE *file, uint8_t *buf, size_t len); -extern uint8_t *lzmadec_gets (lzmadec_FILE *file, uint8_t *buf, size_t len); -extern int lzmadec_getc (lzmadec_FILE *file); -extern int_fast8_t lzmadec_seek (lzmadec_FILE *file, off_t offset, int whence); -extern off_t lzmadec_tell (lzmadec_FILE *file); -extern int_fast8_t lzmadec_rewind (lzmadec_FILE *file); -extern int_fast8_t lzmadec_eof (lzmadec_FILE *file); -extern int_fast8_t lzmadec_close (lzmadec_FILE *file); -/* extern const char *lzmadec_error (lzmadec_FILE *file, int *errnum) */ - -#endif /* ifndef LZMADEC_NO_STDIO */ - -#ifdef __cplusplus -} -#endif - -#endif /* ifndef LZMADEC_H */ diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/main.c b/Build/source/utils/lzma-utils/src/liblzmadec/main.c deleted file mode 100644 index 9ce4458f12a..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/main.c +++ /dev/null @@ -1,733 +0,0 @@ -/****************************************************************************** - - LZMA decoder library with a zlib like API - - Copyright (C) 1999-2005 Igor Pavlov (http://7-zip.org/) - Copyright (C) 2005 Lasse Collin <lasse.collin@tukaani.org> - Based on zlib.h and bzlib.h. FIXME - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -/* FIXME DEBUG */ -#include <stdio.h> - -#include <stdlib.h> -#include <inttypes.h> -#include <string.h> -#include <assert.h> -#include "lzmadec.h" -#include "private.h" - -#ifndef UINT64_MAX -#define UINT64_MAX (~(uint64_t)0) -#endif - -/* Cleaner way to refer to strm->state */ -#define STATE ((lzmadec_state*)(strm->state)) - -static void *lzmadec_alloc (void *opaque, size_t nmemb, size_t size); -static void lzmadec_free (void *opaque, void *addr); -static int_fast8_t lzmadec_internal_init (lzmadec_stream *strm); -static inline int_fast8_t lzmadec_decode_main ( - lzmadec_stream *strm, - const int_fast8_t finish_decoding); -static int_fast8_t lzmadec_header_properties ( - uint_fast8_t *pb, - uint_fast8_t *lp, - uint_fast8_t *lc, - const uint8_t c); -static int_fast8_t lzmadec_header_dictionary ( - uint_fast32_t *size, - const uint8_t *buffer); -static void lzmadec_header_uncompressed ( - uint_fast64_t *size, - int_fast8_t *is_streamed, - const uint8_t *buffer); - - -/****************** - extern functions - ******************/ - -/* This function doesn't do much but it's here to be as close to zlib - as possible. See lzmadec_internal_init for actual initialization. */ -extern int_fast8_t -lzmadec_init (lzmadec_stream *strm) -{ - /* Set the functions */ - if (strm->lzma_alloc == NULL) - strm->lzma_alloc = lzmadec_alloc; - if (strm->lzma_free == NULL) - strm->lzma_free = lzmadec_free; - strm->total_in = 0; - strm->total_out = 0; - - /* Allocate memory for internal state structure */ - strm->state = (lzmadec_state*)((strm->lzma_alloc)(strm->opaque, 1, - sizeof (lzmadec_state))); - if (strm->state == NULL) - return LZMADEC_MEM_ERROR; - /* We will allocate memory and put the pointers in probs and - dictionary later. Before that, make it clear that they contain - no valid pointer yet. */ - STATE->probs = NULL; - STATE->dictionary = NULL; - - /* Mark that the decoding engine is not yet initialized. */ - STATE->status = LZMADEC_STATUS_UNINITIALIZED; - - /* Initialize the internal data if there is enough input available */ - if (strm->avail_in >= LZMA_MINIMUM_COMPRESSED_FILE_SIZE) { - return (lzmadec_internal_init (strm)); - } - - return LZMADEC_OK; -} - -extern int_fast8_t -lzmadec_decode (lzmadec_stream *strm, const int_fast8_t finish_decoding) -{ - switch (STATE->status) { - case LZMADEC_STATUS_UNINITIALIZED: - if (strm->avail_in < LZMA_MINIMUM_COMPRESSED_FILE_SIZE) - return LZMADEC_BUF_ERROR; - if (lzmadec_internal_init (strm) != LZMADEC_OK) - return LZMADEC_HEADER_ERROR; - /* Fall through */ - case LZMADEC_STATUS_RUNNING: - /* */ - if (strm->total_out < STATE->uncompressed_size) - break; - if (strm->total_out > STATE->uncompressed_size) - return LZMADEC_DATA_ERROR; - STATE->status = LZMADEC_STATUS_STREAM_END; - /* Fall through */ - case LZMADEC_STATUS_FINISHING: - /* Sanity check */ - if (!finish_decoding) - return LZMADEC_SEQUENCE_ERROR; - if (strm->total_out > STATE->uncompressed_size) - return LZMADEC_DATA_ERROR; - if (strm->total_out < STATE->uncompressed_size) - break; - /* Fall through */ - case LZMADEC_STATUS_STREAM_END: - return LZMADEC_STREAM_END; - case LZMADEC_STATUS_ERROR: - default: - return LZMADEC_SEQUENCE_ERROR; - } - /* Let's decode! */ - return (lzmadec_decode_main(strm, finish_decoding)); -} - -extern int_fast8_t -lzmadec_end (lzmadec_stream *strm) -{ - (strm->lzma_free)(strm->opaque, STATE->dictionary); - STATE->dictionary = NULL; - (strm->lzma_free)(strm->opaque, STATE->probs); - STATE->probs = NULL; - (strm->lzma_free)(strm->opaque, strm->state); - strm->state = NULL; - return LZMADEC_OK; -} - -extern int_fast8_t -lzmadec_buffer_info (lzmadec_info *info, const uint8_t *buffer, - const size_t len) -{ - /* LZMA header is 13 bytes long. */ - if (len < 13) - return LZMADEC_BUF_ERROR; - if (lzmadec_header_properties (&info->pb, &info->lp, &info->lc, - buffer[0]) != LZMADEC_OK) - return LZMADEC_HEADER_ERROR; - if (LZMADEC_OK != lzmadec_header_dictionary ( - &info->dictionary_size, buffer + 1)) - return LZMADEC_HEADER_ERROR; - lzmadec_header_uncompressed (&info->uncompressed_size, - &info->is_streamed, buffer + 5); - return LZMADEC_OK; -} - - -/******************* - Memory allocation - *******************/ - -/* Default function for allocating memory */ -static void * -lzmadec_alloc (void *opaque, - size_t nmemb, size_t size) -{ - return (malloc (nmemb * size)); /* No need to zero the memory. */ -} - -/* Default function for freeing memory */ -static void -lzmadec_free (void *opaque, void *addr) -{ - free (addr); -} - - -/**************** - Header parsing - ****************/ - -/* Parse the properties byte */ -static int_fast8_t -lzmadec_header_properties ( - uint_fast8_t *pb, uint_fast8_t *lp, uint_fast8_t *lc, const uint8_t c) -{ - /* pb, lp and lc are encoded into a single byte. */ - if (c > (9 * 5 * 5)) - return LZMADEC_HEADER_ERROR; - *pb = c / (9 * 5); /* 0 <= pb <= 4 */ - *lp = (c % (9 * 5)) / 9; /* 0 <= lp <= 4 */ - *lc = c % 9; /* 0 <= lc <= 8 */ - assert (*pb < 5 && *lp < 5 && *lc < 9); - return LZMADEC_OK; -} - -/* Parse the dictionary size (4 bytes, little endian) */ -static int_fast8_t -lzmadec_header_dictionary (uint_fast32_t *size, const uint8_t *buffer) -{ - uint_fast32_t i; - *size = 0; - for (i = 0; i < 4; i++) - *size += (uint_fast32_t)(*buffer++) << (i * 8); - /* The dictionary size is limited to 256 MiB (checked from - LZMA SDK 4.30) */ - if (*size > (1 << 28)) - return LZMADEC_HEADER_ERROR; - return LZMADEC_OK; -} - -/* Parse the uncompressed size field (8 bytes, little endian) */ -static void -lzmadec_header_uncompressed (uint_fast64_t *size, int_fast8_t *is_streamed, - const uint8_t *buffer) -{ - /* Streamed files have all 64 bits set in the size field. - We don't know the uncompressed size beforehand. */ - *is_streamed = 1; /* Assume streamed. */ - *size = 0; - uint_fast32_t i; - for (i = 0; i < 8; i++) { - *size += (uint_fast64_t)buffer[i] << (i * 8); - if (buffer[i] != 255) - *is_streamed = 0; - } - assert ((*is_streamed == 1 && *size == UINT64_MAX) - || (*is_streamed == 0 && *size < UINT64_MAX)); -} - -/* Because the LZMA decoder cannot be initialized in practice by - lzmadec_decode_init(), lzmadec_internal_init() - is run when lzmadec_decompress() is called the first time. - lzmadec_decompress() provides the FIXME FIXME FIXME - is because initialization needs to know how much to allocate memory. - This function reads the first 18 (LZMA_MINIMUM_COMPRESSED_FILE_SIZE) - bytes of an LZMA stream, parses it, allocates the required memory and - initializes the internal variables to a good values. 18 bytes is also - the size of the smallest possible LZMA encoded stream. */ -static int_fast8_t -lzmadec_internal_init (lzmadec_stream *strm) -{ - uint_fast32_t i; - uint32_t num_probs; - - /* Make sure we have been called sanely */ - if (STATE->probs != NULL || STATE->dictionary != NULL - || STATE->status != LZMADEC_STATUS_UNINITIALIZED) - return LZMADEC_SEQUENCE_ERROR; - - /* Check that we have enough input */ - if (strm->avail_in < LZMA_MINIMUM_COMPRESSED_FILE_SIZE) - return LZMADEC_BUF_ERROR; - - /* Parse the header (13 bytes) */ - /* - Properties (the first byte) */ - if (lzmadec_header_properties (&STATE->pb, &STATE->lp, &STATE->lc, - *strm->next_in) != LZMADEC_OK) - return LZMADEC_HEADER_ERROR; - - strm->next_in++; - strm->avail_in--; - /* - Calculate these right away: */ - STATE->pos_state_mask = (1 << STATE->pb) - 1; - STATE->literal_pos_mask = (1 << STATE->lp) - 1; - /* - Dictionary size */ - lzmadec_header_dictionary (&STATE->dictionary_size, strm->next_in); - strm->next_in += 4; - strm->avail_in -= 4; - /* - Uncompressed size */ - lzmadec_header_uncompressed (&STATE->uncompressed_size, - &STATE->streamed, strm->next_in); - strm->next_in += 8; - strm->avail_in -= 8; - - /* Allocate memory for internal data */ - const size_t lzmadec_num_probs = (LZMA_BASE_SIZE - + (LZMA_LIT_SIZE << (STATE->lc + STATE->lp))); - STATE->probs = (CProb *)((strm->lzma_alloc)(strm->opaque, 1, - lzmadec_num_probs * sizeof(CProb))); - if (STATE->probs == NULL) - return LZMADEC_MEM_ERROR; - - /* When dictionary_size == 0, it must be set to 1. */ - if (STATE->dictionary_size == 0) - STATE->dictionary_size = 1; - /* Allocate dictionary */ - STATE->dictionary = (unsigned char*)((strm->lzma_alloc)( - strm->opaque, 1, STATE->dictionary_size)); - if (STATE->dictionary == NULL) { - /* First free() the memory allocated for internal data */ - (strm->lzma_free)(strm->opaque, STATE->probs); - return LZMADEC_MEM_ERROR; - } - - /* Initialize the internal data */ - num_probs = LZMA_BASE_SIZE - + ((CProb)LZMA_LIT_SIZE << (STATE->lc + STATE->lp)); - for (i = 0; i < num_probs; i++) - STATE->probs[i] = 1024; /* LZMA_BIT_MODEL_TOTAL >> 1; */ - - /* Read the first five bytes of data and initialize STATE->code */ - STATE->code = 0; - for (i = 0; i < 5; i++) - STATE->code = (STATE->code << 8) | (uint32_t)(*strm->next_in++); - strm->avail_in -= 5; - - /* Zero the buffer[] */ - memset (STATE->buffer, 0, - LZMA_IN_BUFFER_SIZE + LZMA_REQUIRED_IN_BUFFER_SIZE); - - /* Set the initial static values */ - STATE->rep0 = 1; - STATE->rep1 = 1; - STATE->rep2 = 1; - STATE->rep3 = 1; - STATE->state = 0; - strm->total_out = 0; - STATE->distance_limit = 0; - STATE->dictionary_position = 0; - STATE->dictionary[STATE->dictionary_size - 1] = 0; - STATE->buffer_size = 0; - STATE->buffer_position = STATE->buffer; - STATE->len = 0; - STATE->range = 0xFFFFFFFF; - - /* Mark that initialization has been done */ - STATE->status = LZMADEC_STATUS_RUNNING; - - return LZMADEC_OK; -} - - -/********************* - LZMA decoder engine - *********************/ - -/* Have a nice day! */ - -#define RC_NORMALIZE \ - if (range < LZMA_TOP_VALUE) { \ - range <<= 8; \ - code = (code << 8) | *buffer++; \ - } - -#define IfBit0(p) \ - RC_NORMALIZE; \ - bound = (range >> LZMA_NUM_BIT_MODEL_TOTAL_BITS) * *(p); \ - if (code < bound) - -#define UpdateBit0(p) \ - range = bound; \ - *(p) += (LZMA_BIT_MODEL_TOTAL - *(p)) >> LZMA_NUM_MOVE_BITS; - -#define UpdateBit1(p) \ - range -= bound; \ - code -= bound; \ - *(p) -= (*(p)) >> LZMA_NUM_MOVE_BITS; - -#define RC_GET_BIT2(p, mi, A0, A1) \ - IfBit0(p) { \ - UpdateBit0(p); \ - mi <<= 1; \ - A0; \ - } else { \ - UpdateBit1(p); \ - mi = (mi + mi) + 1; \ - A1; \ - } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { \ - int i = numLevels; \ - res = 1; \ - do { \ - CProb *p = probs + res; \ - RC_GET_BIT(p, res) \ - } while(--i != 0); \ - res -= (1 << numLevels); \ - } - -static inline int_fast8_t -lzmadec_decode_main (lzmadec_stream *strm, const int_fast8_t finish_decoding) -{ - /* Split the *strm structure to separate _local_ variables. - This improves readability a little. The major reason to do - this is performance; at least with GCC 3.4.4 this makes - the code about 30% faster! */ - /* strm-> */ - unsigned char *next_out = strm->next_out; - unsigned char *next_in = strm->next_in; - size_t avail_in = strm->avail_in; - uint64_t total_out = strm->total_out; - /* strm->state-> */ - const int_fast8_t lc = STATE->lc; - const uint32_t pos_state_mask = STATE->pos_state_mask; - const uint32_t literal_pos_mask = STATE->literal_pos_mask; - const uint32_t dictionary_size = STATE->dictionary_size; - unsigned char *dictionary = STATE->dictionary; -/* int_fast8_t streamed;*/ /* boolean */ - CProb *p = STATE->probs; - uint32_t range = STATE->range; - uint32_t code = STATE->code; - uint32_t dictionary_position = STATE->dictionary_position; - uint32_t distance_limit = STATE->distance_limit; - uint32_t rep0 = STATE->rep0; - uint32_t rep1 = STATE->rep1; - uint32_t rep2 = STATE->rep2; - uint32_t rep3 = STATE->rep3; - int state = STATE->state; - int len = STATE->len; - unsigned char *buffer_start = STATE->buffer; - size_t buffer_size = STATE->buffer_size; - /* Other variable initializations */ - int_fast8_t i; /* Temporary variable for loop indexing */ - unsigned char *next_out_end = next_out + strm->avail_out; - unsigned char *buffer = STATE->buffer_position; - - /* This should have been verified in lzmadec_decode() already: */ - assert (STATE->uncompressed_size > total_out); - /* With non-streamed LZMA stream the output has to be limited. */ - if (STATE->uncompressed_size - total_out < strm->avail_out) { - next_out_end = next_out + (STATE->uncompressed_size - total_out); - } - - /* The main loop */ - while (1) { -assert (len >= 0); -assert (state >= 0); - /* Copy uncompressed data to next_out: */ - { - unsigned char *foo = next_out; - while (len != 0 && next_out != next_out_end) { - uint32_t pos = dictionary_position - rep0; - if (pos >= dictionary_size) - pos += dictionary_size; - *next_out++ = dictionary[dictionary_position] = dictionary[pos]; - if (++dictionary_position == dictionary_size) - dictionary_position = 0; - len--; - } - total_out += next_out - foo; - } - - /* Fill the internal input buffer: */ - { - size_t avail_buf; - /* Check for overflow (invalid input) */ - if (buffer > buffer_start + LZMA_IN_BUFFER_SIZE) - return LZMADEC_DATA_ERROR; - /* Calculate how much data is unread in the buffer: */ - avail_buf = buffer_size - (buffer - buffer_start); - - /* Copy more data to the buffer if needed: */ - if (avail_buf < LZMA_REQUIRED_IN_BUFFER_SIZE) { - const size_t copy_size = MIN (avail_in, - LZMA_IN_BUFFER_SIZE - avail_buf); - if (avail_buf > 0) - memmove (buffer_start, buffer, avail_buf); - memcpy (buffer_start + avail_buf, - next_in, copy_size); - buffer = buffer_start; - next_in += copy_size; - avail_in -= copy_size; - buffer_size = avail_buf + copy_size; - } - } - - /* Decoder cannot continue if there is - - no output space available - - less data in the input buffer than a single decoder pass - could consume; decoding is still continued if the callee - has marked that all available input data has been given. */ - if ((next_out == next_out_end) - || (!finish_decoding - && buffer_size < LZMA_REQUIRED_IN_BUFFER_SIZE)) - break; - - assert (STATE->status != LZMADEC_STATUS_FINISHING); - - /* The rest of the main loop can at maximum - - read at maximum of LZMA_REQUIRED_IN_BUFFER_SIZE bytes - from the buffer[] - - write one byte to next_out. */ - { - CProb *prob; - uint32_t bound; - int_fast32_t posState = (int_fast32_t)(total_out & pos_state_mask); - prob = p + LZMA_IS_MATCH + (state << LZMA_NUM_POS_BITS_MAX) + posState; - IfBit0(prob) { - int_fast32_t symbol = 1; - UpdateBit0(prob) - prob = p + LZMA_LITERAL + (LZMA_LIT_SIZE * - (((total_out & literal_pos_mask) << lc) - + ((dictionary_position != 0 - ? dictionary[dictionary_position - 1] - : dictionary[dictionary_size - 1]) - >> (8 - lc)))); - if (state >= LZMA_NUM_LIT_STATES) { - int_fast32_t matchByte; - uint32_t pos = dictionary_position - rep0; - if (pos >= dictionary_size) - pos += dictionary_size; - matchByte = dictionary[pos]; - do { - int_fast32_t bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, - if (bit != 0) break, - if (bit == 0) break) - } while (symbol < 0x100); - } - while (symbol < 0x100) { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - - if (distance_limit < dictionary_size) - distance_limit++; - - /* Eliminate? */ - *next_out++ = dictionary[dictionary_position] - = (char)symbol; - if (++dictionary_position == dictionary_size) - dictionary_position = 0; - total_out++; - - if (state < 4) - state = 0; - else if (state < 10) - state -= 3; - else - state -= 6; - - continue; - } - - UpdateBit1(prob); - prob = p + LZMA_IS_REP + state; - IfBit0(prob) { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < LZMA_NUM_LIT_STATES ? 0 : 3; - prob = p + LZMA_LEN_CODER; - } else { - UpdateBit1(prob); - prob = p + LZMA_IS_REP_G0 + state; - IfBit0(prob) { - UpdateBit0(prob); - prob = p + LZMA_IS_REP0_LONG + (state - << LZMA_NUM_POS_BITS_MAX) - + posState; - IfBit0(prob) { - UpdateBit0(prob); - if (distance_limit == 0) - return LZMADEC_DATA_ERROR; - if (distance_limit < dictionary_size) - distance_limit++; - state = state < LZMA_NUM_LIT_STATES ? 9 : 11; - len++; - continue; - } else { - UpdateBit1(prob); - } - } else { - uint32_t distance; - UpdateBit1(prob); - prob = p + LZMA_IS_REP_G1 + state; - IfBit0(prob) { - UpdateBit0(prob); - distance = rep1; - } else { - UpdateBit1(prob); - prob = p + LZMA_IS_REP_G2 + state; - IfBit0(prob) { - UpdateBit0(prob); - distance = rep2; - } else { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < LZMA_NUM_LIT_STATES ? 8 : 11; - prob = p + LZMA_REP_LEN_CODER; - } - - { - int_fast32_t numBits, offset; - CProb *probLen = prob + LZMA_LEN_CHOICE; - IfBit0(probLen) { - UpdateBit0(probLen); - probLen = prob + LZMA_LEN_LOW - + (posState - << LZMA_LEN_NUM_LOW_BITS); - offset = 0; - numBits = LZMA_LEN_NUM_LOW_BITS; - } else { - UpdateBit1(probLen); - probLen = prob + LZMA_LEN_CHOICE2; - IfBit0(probLen) { - UpdateBit0(probLen); - probLen = prob + LZMA_LEN_MID - + (posState - << LZMA_LEN_NUM_MID_BITS); - offset = LZMA_LEN_NUM_LOW_SYMBOLS; - numBits = LZMA_LEN_NUM_MID_BITS; - } else { - UpdateBit1(probLen); - probLen = prob + LZMA_LEN_HIGH; - offset = LZMA_LEN_NUM_LOW_SYMBOLS - + LZMA_LEN_NUM_MID_SYMBOLS; - numBits = LZMA_LEN_NUM_HIGH_BITS; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) { - int_fast32_t posSlot; - state += LZMA_NUM_LIT_STATES; - prob = p + LZMA_POS_SLOT + (MIN (len, - LZMA_NUM_LEN_TO_POS_STATES - 1) - << LZMA_NUM_POS_SLOT_BITS); - RangeDecoderBitTreeDecode(prob, LZMA_NUM_POS_SLOT_BITS, posSlot); - if (posSlot >= LZMA_START_POS_MODEL_INDEX) { - int_fast32_t numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((uint32_t)posSlot & 1)); - if (posSlot < LZMA_END_POS_MODEL_INDEX) { - rep0 <<= numDirectBits; - prob = p + LZMA_SPEC_POS + rep0 - posSlot - 1; - } else { - numDirectBits -= LZMA_NUM_ALIGN_BITS; - do { - RC_NORMALIZE - range >>= 1; - rep0 <<= 1; - if (code >= range) { - code -= range; - rep0 |= 1; - } - } while (--numDirectBits != 0); - prob = p + LZMA_ALIGN; - rep0 <<= LZMA_NUM_ALIGN_BITS; - numDirectBits = LZMA_NUM_ALIGN_BITS; - } - { - i = 1; - int_fast32_t mi = 1; - do { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } while(--numDirectBits != 0); - } - } else { - rep0 = posSlot; - } - if (++rep0 == (uint32_t)(0)) { - /* End of stream marker detected */ - STATE->status = LZMADEC_STATUS_STREAM_END; - break; - } - } - - if (rep0 > distance_limit) - return LZMADEC_DATA_ERROR; - - len += LZMA_MATCH_MIN_LEN; - if (dictionary_size - distance_limit > (uint32_t)(len)) - distance_limit += len; - else - distance_limit = dictionary_size; - } - } - RC_NORMALIZE; - - if (STATE->uncompressed_size < total_out) { - STATE->status = LZMADEC_STATUS_ERROR; - return LZMADEC_DATA_ERROR; - } - - /* Store the saved values back to the lzmadec_stream structure. */ - strm->total_in += (strm->avail_in - avail_in); - strm->total_out = total_out; - strm->avail_in = avail_in; - strm->avail_out -= (next_out - strm->next_out); - strm->next_in = next_in; - strm->next_out = next_out; - STATE->range = range; - STATE->code = code; - STATE->rep0 = rep0; - STATE->rep1 = rep1; - STATE->rep2 = rep2; - STATE->rep3 = rep3; - STATE->state = state; - STATE->len = len; - STATE->dictionary_position = dictionary_position; - STATE->distance_limit = distance_limit; - STATE->buffer_size = buffer_size; - STATE->buffer_position = buffer; - - if (STATE->status == LZMADEC_STATUS_STREAM_END - || STATE->uncompressed_size == total_out) { - STATE->status = LZMADEC_STATUS_STREAM_END; - if (len == 0) - return LZMADEC_STREAM_END; - } - return LZMADEC_OK; -} diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/private.h b/Build/source/utils/lzma-utils/src/liblzmadec/private.h deleted file mode 100644 index e328af129fc..00000000000 --- a/Build/source/utils/lzma-utils/src/liblzmadec/private.h +++ /dev/null @@ -1,173 +0,0 @@ -/****************************************************************************** - - Internal defines and typedefs for liblzmadec - - Copyright (C) 1999-2005 Igor Pavlov (http://7-zip.org/) - Copyright (C) 2005 Lasse Collin <lasse.collin@tukaani.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - -******************************************************************************/ - - -/*********** - Constants - ***********/ - -/* uint16_t would be enough for CProb. uint_fast16_t will give a little - extra speed but wastes memory. On 32-bit architechture the amount - of wasted memory is usually only a few kilobytes but the theoretical - maximum is about 1.5 megabytes (4.5 on 64-bit). */ -#define CProb uint_fast16_t - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 -#define LZMA_IN_BUFFER_SIZE 4096 - -#define LZMA_MINIMUM_COMPRESSED_FILE_SIZE 18 - -/* Decoder status */ -#define LZMADEC_STATUS_UNINITIALIZED 0 -#define LZMADEC_STATUS_RUNNING 1 -#define LZMADEC_STATUS_FINISHING 2 -#define LZMADEC_STATUS_STREAM_END 3 -#define LZMADEC_STATUS_ERROR (-1) - - -#define LZMA_NUM_TOP_BITS 24 -#define LZMA_TOP_VALUE ((uint32_t)1 << LZMA_NUM_TOP_BITS) - -#define LZMA_NUM_BIT_MODEL_TOTAL_BITS 11 -#define LZMA_BIT_MODEL_TOTAL (1 << LZMA_NUM_BIT_MODEL_TOTAL_BITS) -#define LZMA_NUM_MOVE_BITS 5 - -#define LZMA_NUM_POS_BITS_MAX 4 -#define LZMA_NUM_POS_STATES_MAX (1 << LZMA_NUM_POS_BITS_MAX) - -#define LZMA_LEN_NUM_LOW_BITS 3 -#define LZMA_LEN_NUM_LOW_SYMBOLS (1 << LZMA_LEN_NUM_LOW_BITS) -#define LZMA_LEN_NUM_MID_BITS 3 -#define LZMA_LEN_NUM_MID_SYMBOLS (1 << LZMA_LEN_NUM_MID_BITS) -#define LZMA_LEN_NUM_HIGH_BITS 8 -#define LZMA_LEN_NUM_HIGH_SYMBOLS (1 << LZMA_LEN_NUM_HIGH_BITS) - -#define LZMA_LEN_CHOICE 0 -#define LZMA_LEN_CHOICE2 (LZMA_LEN_CHOICE + 1) -#define LZMA_LEN_LOW (LZMA_LEN_CHOICE2 + 1) -#define LZMA_LEN_MID (LZMA_LEN_LOW + (LZMA_NUM_POS_STATES_MAX << LZMA_LEN_NUM_LOW_BITS)) -#define LZMA_LEN_HIGH (LZMA_LEN_MID + (LZMA_NUM_POS_STATES_MAX << LZMA_LEN_NUM_MID_BITS)) -#define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + LZMA_LEN_NUM_HIGH_SYMBOLS) - -#define LZMA_NUM_STATES 12 -#define LZMA_NUM_LIT_STATES 7 - -#define LZMA_START_POS_MODEL_INDEX 4 -#define LZMA_END_POS_MODEL_INDEX 14 -#define LZMA_NUM_FULL_DISTANCES (1 << (LZMA_END_POS_MODEL_INDEX >> 1)) - -#define LZMA_NUM_POS_SLOT_BITS 6 -#define LZMA_NUM_LEN_TO_POS_STATES 4 - -#define LZMA_NUM_ALIGN_BITS 4 -#define LZMA_ALIGN_TABLE_SIZE (1 << LZMA_NUM_ALIGN_BITS) - -#define LZMA_MATCH_MIN_LEN 2 -#define LZMA_IS_MATCH 0 -#define LZMA_IS_REP (LZMA_IS_MATCH + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -#define LZMA_IS_REP_G0 (LZMA_IS_REP + LZMA_NUM_STATES) -#define LZMA_IS_REP_G1 (LZMA_IS_REP_G0 + LZMA_NUM_STATES) -#define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) -#define LZMA_IS_REP0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) -#define LZMA_POS_SLOT (LZMA_IS_REP0_LONG + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) -#define LZMA_SPEC_POS (LZMA_POS_SLOT + (LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) -#define LZMA_ALIGN (LZMA_SPEC_POS + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) -#define LZMA_LEN_CODER (LZMA_ALIGN + LZMA_ALIGN_TABLE_SIZE) -#define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) -#define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) - -/* LZMA_REQUIRED_IN_BUFFER_SIZE = number of required input bytes for worst case: - longest match with longest distance. - kLzmaInBufferSize must be larger than LZMA_REQUIRED_IN_BUFFER_SIZE - 23 bits = 2 (match select) + 10 (len) + 6 (distance) + 4 (align) + 1 (RC_NORMALIZE) -*/ -#define LZMA_REQUIRED_IN_BUFFER_SIZE ((23 * (LZMA_NUM_BIT_MODEL_TOTAL_BITS \ - - LZMA_NUM_MOVE_BITS + 1) + 26 + 9) / 8) - - -/*************** - Sanity checks - ***************/ - -#if LZMA_LITERAL != LZMA_BASE_SIZE -#error BUG: LZMA_LITERAL != LZMA_BASE_SIZE -#endif - -#if LZMA_IN_BUFFER_SIZE <= LZMA_REQUIRED_IN_BUFFER_SIZE -#error LZMA_IN_BUFFER_SIZE <= LZMA_REQUIRED_IN_BUFFER_SIZE -#error Fix by increasing LZMA_IN_BUFFER_SIZE. -#endif - - - -/******** - Macros - ********/ - -#define MIN(x,y) ((x) < (y) ? (x) : (y)) - - -/********** - typedefs - **********/ - -typedef struct { - /* LZMA_REQUIRED_IN_BUFFER_SIZE is added to LZMA_IN_BUFFER_SIZE for - buffer overflow protection. I'm not 100% if it is really needed - (I haven't studied the details enough) but allocating a few extra - bytes shouldn't harm anyone. --Larhzu */ - unsigned char buffer[LZMA_IN_BUFFER_SIZE + LZMA_REQUIRED_IN_BUFFER_SIZE]; - - /* Pointer to the current position in buffer[] */ - unsigned char *buffer_position; - - /* In the original version from LZMA SDK buffer_size had - to be signed. In liblzmadec this should be unsigned. */ - size_t buffer_size; - - /* We don't know the properties of the stream we are going to - decode in lzmadec_decompressInit. The needed memory - will be allocated on first call to lzmadec_decode. - status is used to check if we have parsed the header and - allocated the memory needed by the LZMA decoder engine. */ - int_fast8_t status; - - uint_fast32_t dictionary_size; - uint8_t *dictionary; - - uint_fast64_t uncompressed_size; - int_fast8_t streamed; /* boolean */ - - uint32_t pos_state_mask; - uint32_t literal_pos_mask; - uint_fast8_t pb; - uint_fast8_t lp; - uint_fast8_t lc; - - CProb *probs; - - uint32_t range; - uint32_t code; - uint_fast32_t dictionary_position; - uint32_t distance_limit; - uint32_t rep0, rep1, rep2, rep3; - int state; - int len; -} lzmadec_state; |