Patch to compile xz-5.2.0 using gcc-2.95
$Keywords: compile xz utils, gcc-2.95, source patch, old gcc, ancient gcc, g++, lzma $
Source code of XZ Utils
heavily relies on newer C extensions, such as
C++ style comments,
copy-by-value of structs,
variable declaration in middle of a block,
labelled struct initializer,
expect declared type to overflow lexical scope,
++ on enum.
You can't even ./configure
on
ancient environment
such as NetBSD 1.6 (with bundled gcc-2.95.3).
The patch below made it successfully compile and
pass make check
with gcc-2.95.3 .
./configure
options
env ACCEPT_INFERIOR_RM_PROGRAM=yes env ac_cv_prog_cc_c99= \
CC="gcc -x c++" CCAS="gcc" CCLD="gcc" \
CPPFLAGS='-Drestrict=__restrict__ -Dlzma_nothrow=' \
CCASFLAGS="" \
./configure --prefix=/usr/local \
--enable-symbol-versions --disable-threads \
--mandir=/usr/local/man --docdir=/usr/local/doc/xz \
--disable-nls --enable-shared
Arcane options for configure
:
- Needs
ACCEPT_INFERIOR_RM_PROGRAM
when
plain "rm -f" (without files) emits error, which is the classical behavior.
POSIX does not treat this as error, and newer
autoconf is beginning to expect this.
ac_cv_prog_cc_c99=
to skip C99 compiler detection (fails on missing stdbool.h)
- compile things as C++, but to avoid autolinking against libstdc++,
use
gcc -x c++
.
- patch
configure
and Makefile.in
s to
accept CCLD
config parameter.
Otherwise, Makefile tries hard to compile *.o as C++.
-Drestrict=__restrict__
to use gcc extension
-Dlzma_nothrow=
to ignore exception throwing
The hardest part was the magically disappearing lzma_crc64_table[][]
symbol,
which was caused by the compiler nicely optimizing out the
seems-to-be unreferenced table to nothing.
Fortunate was the gcc-2.95 was ready for copying struct
s
which xz code uses all over.
This patch patches ./configure
, so it will not survive
re-autoconf
.
Patch for xz-5.0.3 is also available.
*** xz-5.2.0/configure.dist Mon Dec 22 03:50:04 2014
--- xz-5.2.0/configure Fri Jan 9 17:29:27 2015
*************** PTHREAD_CFLAGS
*** 691,702 ****
--- 691,703 ----
PTHREAD_LIBS
PTHREAD_CC
ax_pthread_config
EGREP
GREP
CPP
+ CCLD
am__fastdepCCAS_FALSE
am__fastdepCCAS_TRUE
CCASDEPMODE
CCASFLAGS
CCAS
am__fastdepCC_FALSE
*************** if test x$ac_cv_prog_cc_c99 = xno ; then
*** 5989,6000 ****
--- 5990,6002 ----
as_fn_error $? "No C99 compiler was found." "$LINENO" 5
fi
# By default we simply use the C compiler to build assembly code.
+ test "${CCLD+set}" = set || CCLD=$CC
test "${CCAS+set}" = set || CCAS=$CC
test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
depcc="$CCAS" am_compiler_list=
*************** _LT_EOF
*** 11994,12006 ****
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
--- 11996,12008 ----
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
*************** _LT_EOF
*** 12028,12056 ****
always_export_symbols=no
enable_shared_with_static_runtimes=yes
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file, use it as
# is; otherwise, prepend EXPORTS...
archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
! $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
ld_shlibs=no
fi
;;
haiku*)
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
link_all_deplibs=yes
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
--- 12030,12058 ----
always_export_symbols=no
enable_shared_with_static_runtimes=yes
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file, use it as
# is; otherwise, prepend EXPORTS...
archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
! ${CCLD-$CC} -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
ld_shlibs=no
fi
;;
haiku*)
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
link_all_deplibs=yes
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
*************** _LT_EOF
*** 12087,12100 ****
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
! archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
! archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
tmp_diet=no
if test linux-dietlibc = "$host_os"; then
case $cc_basename in
--- 12089,12102 ----
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
! archive_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
! archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
tmp_diet=no
if test linux-dietlibc = "$host_os"; then
case $cc_basename in
*************** _LT_EOF
*** 12131,12157 ****
tmp_addflag= ;;
nvcc*) # Cuda Compiler Driver 2.2
whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
compiler_needs_object=yes
;;
esac
! case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
compiler_needs_object=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
! archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
if test yes = "$supports_anon_versioning"; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
! $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
tcc*)
export_dynamic_flag_spec='-rdynamic'
;;
--- 12133,12159 ----
tmp_addflag= ;;
nvcc*) # Cuda Compiler Driver 2.2
whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
compiler_needs_object=yes
;;
esac
! case `${CCLD-$CC} -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
compiler_needs_object=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
! archive_cmds='${CCLD-$CC} '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
if test yes = "$supports_anon_versioning"; then
archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
! ${CCLD-$CC} '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
tcc*)
export_dynamic_flag_spec='-rdynamic'
;;
*************** _LT_EOF
*** 12175,12188 ****
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
! archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
--- 12177,12190 ----
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
! archive_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
*************** _LT_EOF
*** 12194,12207 ****
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
! archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
--- 12196,12209 ----
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
! archive_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
*************** _LT_EOF
*** 12223,12236 ****
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
;;
--- 12225,12238 ----
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
;;
*************** _LT_EOF
*** 12241,12254 ****
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
! archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
--- 12243,12256 ----
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
! archive_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
! archive_expsym_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
;;
esac
*************** rm -f core conftest.err conftest.$ac_obj
*** 12454,12471 ****
fi
aix_libpath=$lt_cv_aix_libpath_
fi
hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
! archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
else
if test ia64 = "$host_cpu"; then
hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
allow_undefined_flag="-z nodefs"
! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
if test set = "${lt_cv_aix_libpath+set}"; then
aix_libpath=$lt_cv_aix_libpath
else
--- 12456,12473 ----
fi
aix_libpath=$lt_cv_aix_libpath_
fi
hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
! archive_expsym_cmds='${CCLD-$CC} -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
else
if test ia64 = "$host_cpu"; then
hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
allow_undefined_flag="-z nodefs"
! archive_expsym_cmds="\${CCLD-\$CC} $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
if test set = "${lt_cv_aix_libpath+set}"; then
aix_libpath=$lt_cv_aix_libpath
else
*************** fi
*** 12524,12539 ****
archive_cmds_need_lc=yes
archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
# -brtl affects multiple linker settings, -berok does not and is overridden later
compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
if test svr4 != "$with_aix_soname"; then
# This is similar to how AIX traditionally builds its shared libraries.
! archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
fi
if test aix != "$with_aix_soname"; then
! archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
else
# used by -dlpreopen to get the symbols
archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
fi
archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
fi
--- 12526,12541 ----
archive_cmds_need_lc=yes
archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
# -brtl affects multiple linker settings, -berok does not and is overridden later
compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
if test svr4 != "$with_aix_soname"; then
# This is similar to how AIX traditionally builds its shared libraries.
! archive_expsym_cmds="$archive_expsym_cmds"'~${CCLD-$CC} '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
fi
if test aix != "$with_aix_soname"; then
! archive_expsym_cmds="$archive_expsym_cmds"'~${CCLD-$CC} '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
else
# used by -dlpreopen to get the symbols
archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir'
fi
archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
fi
*************** fi
*** 12541,12553 ****
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
--- 12543,12555 ----
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
archive_expsym_cmds=''
;;
m68k)
archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
*************** fi
*** 12573,12592 ****
file_list_spec='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
! archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
cp "$export_symbols" "$output_objdir/$soname.def";
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
else
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
fi~
! $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
enable_shared_with_static_runtimes=yes
exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
--- 12575,12594 ----
file_list_spec='@'
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
! archive_cmds='${CCLD-$CC} -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then
cp "$export_symbols" "$output_objdir/$soname.def";
echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
else
$SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
fi~
! ${CCLD-$CC} -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
linknames='
# The linker will not automatically build a static lib if we build a DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
enable_shared_with_static_runtimes=yes
exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
*************** fi
*** 12612,12624 ****
allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
! archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
enable_shared_with_static_runtimes=yes
;;
--- 12614,12626 ----
allow_undefined_flag=unsupported
# Tell ltmain to make .lib files, not .a files.
libext=lib
# Tell ltmain to make .dll files, not .so files.
shrext_cmds=.dll
# FIXME: Setting linknames here is a bad hack.
! archive_cmds='${CCLD-$CC} -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
# The linker will automatically build a .lib file if we build a DLL.
old_archive_from_new_cmds='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
enable_shared_with_static_runtimes=yes
;;
*************** fi
*** 12643,12658 ****
case $cc_basename in
ifort*|nagfor*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test yes = "$_lt_dar_can_shared"; then
output_verbose_link_cmd=func_echo_all
! archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
! module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
! archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
! module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
else
ld_shlibs=no
fi
;;
--- 12645,12660 ----
case $cc_basename in
ifort*|nagfor*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test yes = "$_lt_dar_can_shared"; then
output_verbose_link_cmd=func_echo_all
! archive_cmds="\${CCLD-\$CC} -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
! module_cmds="\${CCLD-\$CC} \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
! archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\${CCLD-\$CC} -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
! module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\${CCLD-\$CC} \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
else
ld_shlibs=no
fi
;;
*************** fi
*** 12681,12701 ****
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
! archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9*)
if test yes = "$GCC"; then
! archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
else
archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
fi
hardcode_libdir_flag_spec='$wl+b $wl$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
--- 12683,12703 ----
hardcode_minus_L=yes
hardcode_shlibpath_var=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
! archive_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
hpux9*)
if test yes = "$GCC"; then
! archive_cmds='$RM $output_objdir/$soname~${CCLD-$CC} -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
else
archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
fi
hardcode_libdir_flag_spec='$wl+b $wl$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
*************** fi
*** 12705,12717 ****
hardcode_minus_L=yes
export_dynamic_flag_spec='$wl-E'
;;
hpux10*)
if test yes,no = "$GCC,$with_gnu_ld"; then
! archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test no = "$with_gnu_ld"; then
hardcode_libdir_flag_spec='$wl+b $wl$libdir'
hardcode_libdir_separator=:
--- 12707,12719 ----
hardcode_minus_L=yes
export_dynamic_flag_spec='$wl-E'
;;
hpux10*)
if test yes,no = "$GCC,$with_gnu_ld"; then
! archive_cmds='${CCLD-$CC} -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test no = "$with_gnu_ld"; then
hardcode_libdir_flag_spec='$wl+b $wl$libdir'
hardcode_libdir_separator=:
*************** fi
*** 12725,12752 ****
;;
hpux11*)
if test yes,no = "$GCC,$with_gnu_ld"; then
case $host_cpu in
hppa*64*)
! archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
! archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
! archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
! archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
! archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
# Older versions of the 11.00 compiler do not understand -b yet
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
--- 12727,12754 ----
;;
hpux11*)
if test yes,no = "$GCC,$with_gnu_ld"; then
case $host_cpu in
hppa*64*)
! archive_cmds='${CCLD-$CC} -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
! archive_cmds='${CCLD-$CC} -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
! archive_cmds='${CCLD-$CC} -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
! archive_cmds='${CCLD-$CC} -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
! archive_cmds='${CCLD-$CC} -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
# Older versions of the 11.00 compiler do not understand -b yet
# (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
*************** else
*** 12778,12790 ****
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
$as_echo "$lt_cv_prog_compiler__b" >&6; }
if test yes = "$lt_cv_prog_compiler__b"; then
! archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
;;
esac
--- 12780,12792 ----
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
$as_echo "$lt_cv_prog_compiler__b" >&6; }
if test yes = "$lt_cv_prog_compiler__b"; then
! archive_cmds='${CCLD-$CC} -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
;;
esac
*************** fi
*** 12810,12822 ****
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test yes = "$GCC"; then
! archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
# This should be the same for all languages, so no per-tag cache variable.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
--- 12812,12824 ----
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test yes = "$GCC"; then
! archive_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
# This should be the same for all languages, so no per-tag cache variable.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
*************** rm -f core conftest.err conftest.$ac_obj
*** 12838,12854 ****
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
$as_echo "$lt_cv_irix_exported_symbol" >&6; }
if test yes = "$lt_cv_irix_exported_symbol"; then
! archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
else
! archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
! archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
hardcode_libdir_separator=:
inherit_rpath=yes
link_all_deplibs=yes
--- 12840,12856 ----
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
$as_echo "$lt_cv_irix_exported_symbol" >&6; }
if test yes = "$lt_cv_irix_exported_symbol"; then
! archive_expsym_cmds='${CCLD-$CC} -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
else
! archive_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
! archive_expsym_cmds='${CCLD-$CC} -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
hardcode_libdir_separator=:
inherit_rpath=yes
link_all_deplibs=yes
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 12856,12868 ****
linux*)
case $cc_basename in
tcc*)
# Fabrice Bellard et al's Tiny C Compiler
ld_shlibs=yes
! archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
--- 12858,12870 ----
linux*)
case $cc_basename in
tcc*)
# Fabrice Bellard et al's Tiny C Compiler
ld_shlibs=yes
! archive_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 12889,12906 ****
openbsd* | bitrig*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
hardcode_shlibpath_var=no
hardcode_direct_absolute=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
! archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec='$wl-rpath,$libdir'
export_dynamic_flag_spec='$wl-E'
else
! archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='$wl-rpath,$libdir'
fi
else
ld_shlibs=no
fi
;;
--- 12891,12908 ----
openbsd* | bitrig*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
hardcode_shlibpath_var=no
hardcode_direct_absolute=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
! archive_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec='$wl-rpath,$libdir'
export_dynamic_flag_spec='$wl-E'
else
! archive_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='$wl-rpath,$libdir'
fi
else
ld_shlibs=no
fi
;;
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 12933,12992 ****
enable_shared_with_static_runtimes=yes
;;
osf3*)
if test yes = "$GCC"; then
allow_undefined_flag=' $wl-expect_unresolved $wl\*'
! archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
! archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test yes = "$GCC"; then
allow_undefined_flag=' $wl-expect_unresolved $wl\*'
! archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
else
allow_undefined_flag=' -expect_unresolved \*'
! archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
! $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
archive_cmds_need_lc='no'
hardcode_libdir_separator=:
;;
solaris*)
no_undefined_flag=' -z defs'
if test yes = "$GCC"; then
wlarc='$wl'
! archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
! $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
! case `$CC -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='$wl'
! archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
! $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case $host_os in
--- 12935,12994 ----
enable_shared_with_static_runtimes=yes
;;
osf3*)
if test yes = "$GCC"; then
allow_undefined_flag=' $wl-expect_unresolved $wl\*'
! archive_cmds='${CCLD-$CC} -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
! archive_cmds='${CCLD-$CC} -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
fi
archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test yes = "$GCC"; then
allow_undefined_flag=' $wl-expect_unresolved $wl\*'
! archive_cmds='${CCLD-$CC} -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
else
allow_undefined_flag=' -expect_unresolved \*'
! archive_cmds='${CCLD-$CC} -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
! ${CCLD-$CC} -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
archive_cmds_need_lc='no'
hardcode_libdir_separator=:
;;
solaris*)
no_undefined_flag=' -z defs'
if test yes = "$GCC"; then
wlarc='$wl'
! archive_cmds='${CCLD-$CC} -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
! ${CCLD-$CC} -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
! case `${CCLD-$CC} -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='$wl'
! archive_cmds='${CCLD-$CC} -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
! ${CCLD-$CC} -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
case $host_os in
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 13007,13019 ****
;;
sunos4*)
if test sequent = "$host_vendor"; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
! archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
--- 13009,13021 ----
;;
sunos4*)
if test sequent = "$host_vendor"; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
! archive_cmds='${CCLD-$CC} -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 13062,13078 ****
no_undefined_flag='$wl-z,text'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
! archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
! archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We CANNOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
--- 13064,13080 ----
no_undefined_flag='$wl-z,text'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
! archive_cmds='${CCLD-$CC} -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='${CCLD-$CC} -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
! archive_cmds='${CCLD-$CC} -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='${CCLD-$CC} -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We CANNOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
*************** $as_echo "$lt_cv_irix_exported_symbol" >
*** 13088,13104 ****
hardcode_libdir_separator=':'
link_all_deplibs=yes
export_dynamic_flag_spec='$wl-Bexport'
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
! archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
! archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
--- 13090,13106 ----
hardcode_libdir_separator=':'
link_all_deplibs=yes
export_dynamic_flag_spec='$wl-Bexport'
runpath_var='LD_RUN_PATH'
if test yes = "$GCC"; then
! archive_cmds='${CCLD-$CC} -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='${CCLD-$CC} -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
! archive_cmds='${CCLD-$CC} -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
! archive_expsym_cmds='${CCLD-$CC} -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
hardcode_libdir_flag_spec='-L$libdir'
*************** if test yes = "$GCC"; then
*** 13368,13380 ****
*) lt_awk_arg='/^libraries:/' ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
*) lt_sed_strip_eq='s|=/|/|g' ;;
esac
! lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
case $lt_search_path_spec in
*\;*)
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
--- 13370,13382 ----
*) lt_awk_arg='/^libraries:/' ;;
esac
case $host_os in
mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
*) lt_sed_strip_eq='s|=/|/|g' ;;
esac
! lt_search_path_spec=`${CCLD-$CC} -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
case $lt_search_path_spec in
*\;*)
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
*************** lt_NL2SP \
*** 20306,20317 ****
--- 20308,20320 ----
reload_flag \
deplibs_check_method \
file_magic_cmd \
file_magic_glob \
want_nocaseglob \
sharedlib_from_linklib_cmd \
+ CCLD \
AR \
AR_FLAGS \
archiver_list_spec \
STRIP \
RANLIB \
CC \
*************** dlopen_self_static=$enable_dlopen_self_s
*** 21485,21496 ****
--- 21488,21500 ----
old_striplib=$lt_old_striplib
striplib=$lt_striplib
# The linker used to build libraries.
LD=$lt_LD
+ CCLD=$lt_CCLD
# How to create reloadable object files.
reload_flag=$lt_reload_flag
reload_cmds=$lt_reload_cmds
# Commands used to build an old-style archive.
*** xz-5.2.0/debug/Makefile.in.dist Mon Dec 22 03:50:06 2014
--- xz-5.2.0/debug/Makefile.in Fri Jan 9 15:11:35 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 172,184 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 172,184 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/lib/Makefile.in.dist Mon Dec 22 03:50:06 2014
--- xz-5.2.0/lib/Makefile.in Fri Jan 9 15:12:01 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 140,152 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 140,152 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/src/common/sysdefs.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/common/sysdefs.h Fri Jan 9 14:42:01 2015
***************
*** 119,132 ****
# elif SIZEOF_SIZE_T == 8
# define SIZE_MAX UINT64_MAX
# else
# error size_t is not 32-bit or 64-bit
# endif
#endif
! #if SIZE_MAX != UINT32_MAX && SIZE_MAX != UINT64_MAX
# error size_t is not 32-bit or 64-bit
#endif
#include
#include
// Pre-C99 systems lack stdbool.h. All the code in LZMA Utils must be written
--- 119,134 ----
# elif SIZEOF_SIZE_T == 8
# define SIZE_MAX UINT64_MAX
# else
# error size_t is not 32-bit or 64-bit
# endif
#endif
! #if SIZE_MAX != UINT32_MAX
! # if SIZE_MAX != UINT64_MAX
# error size_t is not 32-bit or 64-bit
+ # endif
#endif
#include
#include
// Pre-C99 systems lack stdbool.h. All the code in LZMA Utils must be written
***************
*** 139,151 ****
//
// bool baz = (flags & 0x100);
//
#ifdef HAVE_STDBOOL_H
# include
#else
! # if ! HAVE__BOOL
typedef unsigned char _Bool;
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
--- 141,153 ----
//
// bool baz = (flags & 0x100);
//
#ifdef HAVE_STDBOOL_H
# include
#else
! # if ! defined(HAVE__BOOL) || ! HAVE__BOOL
typedef unsigned char _Bool;
# endif
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
*** xz-5.2.0/src/liblzma/Makefile.in.dist Mon Dec 22 03:50:07 2014
--- xz-5.2.0/src/liblzma/Makefile.in Fri Jan 9 15:15:44 2015
*************** am__v_at_1 =
*** 452,464 ****
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
! LTCPPASCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CCASFLAGS) $(CCASFLAGS)
AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
am__v_CPPAS_0 = @echo " CPPAS " $@;
--- 452,464 ----
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
! LTCPPASCOMPILE = $(LIBTOOL) --tag=CC $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CCASFLAGS) $(CCASFLAGS)
AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
am__v_CPPAS_0 = @echo " CPPAS " $@;
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 470,482 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 470,482 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*************** distclean-compile:
*** 920,943 ****
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LTCPPASCOMPILE) -c -o $@ $<
liblzma_la-crc32_x86.lo: check/crc32_x86.S
! @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -MT liblzma_la-crc32_x86.lo -MD -MP -MF $(DEPDIR)/liblzma_la-crc32_x86.Tpo -c -o liblzma_la-crc32_x86.lo `test -f 'check/crc32_x86.S' || echo '$(srcdir)/'`check/crc32_x86.S
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblzma_la-crc32_x86.Tpo $(DEPDIR)/liblzma_la-crc32_x86.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='check/crc32_x86.S' object='liblzma_la-crc32_x86.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
! @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o liblzma_la-crc32_x86.lo `test -f 'check/crc32_x86.S' || echo '$(srcdir)/'`check/crc32_x86.S
liblzma_la-crc64_x86.lo: check/crc64_x86.S
! @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -MT liblzma_la-crc64_x86.lo -MD -MP -MF $(DEPDIR)/liblzma_la-crc64_x86.Tpo -c -o liblzma_la-crc64_x86.lo `test -f 'check/crc64_x86.S' || echo '$(srcdir)/'`check/crc64_x86.S
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblzma_la-crc64_x86.Tpo $(DEPDIR)/liblzma_la-crc64_x86.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='check/crc64_x86.S' object='liblzma_la-crc64_x86.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
! @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o liblzma_la-crc64_x86.lo `test -f 'check/crc64_x86.S' || echo '$(srcdir)/'`check/crc64_x86.S
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
--- 920,943 ----
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LTCPPASCOMPILE) -c -o $@ $<
liblzma_la-crc32_x86.lo: check/crc32_x86.S
! @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(LIBTOOL) --tag=CC $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -MT liblzma_la-crc32_x86.lo -MD -MP -MF $(DEPDIR)/liblzma_la-crc32_x86.Tpo -c -o liblzma_la-crc32_x86.lo `test -f 'check/crc32_x86.S' || echo '$(srcdir)/'`check/crc32_x86.S
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblzma_la-crc32_x86.Tpo $(DEPDIR)/liblzma_la-crc32_x86.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='check/crc32_x86.S' object='liblzma_la-crc32_x86.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
! @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LIBTOOL) --tag=CC $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o liblzma_la-crc32_x86.lo `test -f 'check/crc32_x86.S' || echo '$(srcdir)/'`check/crc32_x86.S
liblzma_la-crc64_x86.lo: check/crc64_x86.S
! @am__fastdepCCAS_TRUE@ $(AM_V_CPPAS)$(LIBTOOL) --tag=CC $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -MT liblzma_la-crc64_x86.lo -MD -MP -MF $(DEPDIR)/liblzma_la-crc64_x86.Tpo -c -o liblzma_la-crc64_x86.lo `test -f 'check/crc64_x86.S' || echo '$(srcdir)/'`check/crc64_x86.S
@am__fastdepCCAS_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblzma_la-crc64_x86.Tpo $(DEPDIR)/liblzma_la-crc64_x86.Plo
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ $(AM_V_CPPAS)source='check/crc64_x86.S' object='liblzma_la-crc64_x86.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@
! @am__fastdepCCAS_FALSE@ $(AM_V_CPPAS@am__nodep@)$(LIBTOOL) --tag=CC $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(liblzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -c -o liblzma_la-crc64_x86.lo `test -f 'check/crc64_x86.S' || echo '$(srcdir)/'`check/crc64_x86.S
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
*** xz-5.2.0/src/liblzma/check/crc32_table_be.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc32_table_be.h Fri Jan 9 14:42:01 2015
***************
*** 1,9 ****
/* This file has been automatically generated by crc32_tablegen.c. */
! const uint32_t lzma_crc32_table[8][256] = {
{
0x00000000, 0x96300777, 0x2C610EEE, 0xBA510999,
0x19C46D07, 0x8FF46A70, 0x35A563E9, 0xA395649E,
0x3288DB0E, 0xA4B8DC79, 0x1EE9D5E0, 0x88D9D297,
0x2B4CB609, 0xBD7CB17E, 0x072DB8E7, 0x911DBF90,
0x6410B71D, 0xF220B06A, 0x4871B9F3, 0xDE41BE84,
--- 1,9 ----
/* This file has been automatically generated by crc32_tablegen.c. */
! extern const uint32_t lzma_crc32_table[8][256] = {
{
0x00000000, 0x96300777, 0x2C610EEE, 0xBA510999,
0x19C46D07, 0x8FF46A70, 0x35A563E9, 0xA395649E,
0x3288DB0E, 0xA4B8DC79, 0x1EE9D5E0, 0x88D9D297,
0x2B4CB609, 0xBD7CB17E, 0x072DB8E7, 0x911DBF90,
0x6410B71D, 0xF220B06A, 0x4871B9F3, 0xDE41BE84,
*** xz-5.2.0/src/liblzma/check/crc32_table_le.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc32_table_le.h Fri Jan 9 14:42:02 2015
***************
*** 1,9 ****
/* This file has been automatically generated by crc32_tablegen.c. */
! const uint32_t lzma_crc32_table[8][256] = {
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
--- 1,9 ----
/* This file has been automatically generated by crc32_tablegen.c. */
! extern const uint32_t lzma_crc32_table[8][256] = {
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
*** xz-5.2.0/src/liblzma/check/crc32_tablegen.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc32_tablegen.c Fri Jan 9 14:42:02 2015
*************** init_crc32_table(void)
*** 53,65 ****
static void
print_crc32_table(void)
{
printf("/* This file has been automatically generated by "
"crc32_tablegen.c. */\n\n"
! "const uint32_t lzma_crc32_table[8][256] = {\n\t{");
for (size_t s = 0; s < 8; ++s) {
for (size_t b = 0; b < 256; ++b) {
if ((b % 4) == 0)
printf("\n\t\t");
--- 53,65 ----
static void
print_crc32_table(void)
{
printf("/* This file has been automatically generated by "
"crc32_tablegen.c. */\n\n"
! "extern const uint32_t lzma_crc32_table[8][256] = {\n\t{");
for (size_t s = 0; s < 8; ++s) {
for (size_t b = 0; b < 256; ++b) {
if ((b % 4) == 0)
printf("\n\t\t");
*** xz-5.2.0/src/liblzma/check/crc64_table_be.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc64_table_be.h Fri Jan 9 14:42:02 2015
***************
*** 1,9 ****
/* This file has been automatically generated by crc64_tablegen.c. */
! const uint64_t lzma_crc64_table[4][256] = {
{
UINT64_C(0x0000000000000000), UINT64_C(0x6F5FA703BE4C2EB3),
UINT64_C(0x5BA040A8573684F4), UINT64_C(0x34FFE7ABE97AAA47),
UINT64_C(0x335E8FFF84C3D07B), UINT64_C(0x5C0128FC3A8FFEC8),
UINT64_C(0x68FECF57D3F5548F), UINT64_C(0x07A168546DB97A3C),
UINT64_C(0x66BC1EFF0987A1F7), UINT64_C(0x09E3B9FCB7CB8F44),
--- 1,9 ----
/* This file has been automatically generated by crc64_tablegen.c. */
! extern const uint64_t lzma_crc64_table[4][256] = {
{
UINT64_C(0x0000000000000000), UINT64_C(0x6F5FA703BE4C2EB3),
UINT64_C(0x5BA040A8573684F4), UINT64_C(0x34FFE7ABE97AAA47),
UINT64_C(0x335E8FFF84C3D07B), UINT64_C(0x5C0128FC3A8FFEC8),
UINT64_C(0x68FECF57D3F5548F), UINT64_C(0x07A168546DB97A3C),
UINT64_C(0x66BC1EFF0987A1F7), UINT64_C(0x09E3B9FCB7CB8F44),
*** xz-5.2.0/src/liblzma/check/crc64_table_le.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc64_table_le.h Fri Jan 9 14:42:02 2015
***************
*** 1,9 ****
/* This file has been automatically generated by crc64_tablegen.c. */
! const uint64_t lzma_crc64_table[4][256] = {
{
UINT64_C(0x0000000000000000), UINT64_C(0xB32E4CBE03A75F6F),
UINT64_C(0xF4843657A840A05B), UINT64_C(0x47AA7AE9ABE7FF34),
UINT64_C(0x7BD0C384FF8F5E33), UINT64_C(0xC8FE8F3AFC28015C),
UINT64_C(0x8F54F5D357CFFE68), UINT64_C(0x3C7AB96D5468A107),
UINT64_C(0xF7A18709FF1EBC66), UINT64_C(0x448FCBB7FCB9E309),
--- 1,9 ----
/* This file has been automatically generated by crc64_tablegen.c. */
! extern const uint64_t lzma_crc64_table[4][256] = {
{
UINT64_C(0x0000000000000000), UINT64_C(0xB32E4CBE03A75F6F),
UINT64_C(0xF4843657A840A05B), UINT64_C(0x47AA7AE9ABE7FF34),
UINT64_C(0x7BD0C384FF8F5E33), UINT64_C(0xC8FE8F3AFC28015C),
UINT64_C(0x8F54F5D357CFFE68), UINT64_C(0x3C7AB96D5468A107),
UINT64_C(0xF7A18709FF1EBC66), UINT64_C(0x448FCBB7FCB9E309),
*** xz-5.2.0/src/liblzma/check/crc64_tablegen.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/check/crc64_tablegen.c Fri Jan 9 14:42:03 2015
*************** init_crc64_table(void)
*** 52,64 ****
static void
print_crc64_table(void)
{
printf("/* This file has been automatically generated by "
"crc64_tablegen.c. */\n\n"
! "const uint64_t lzma_crc64_table[4][256] = {\n\t{");
for (size_t s = 0; s < 4; ++s) {
for (size_t b = 0; b < 256; ++b) {
if ((b % 2) == 0)
printf("\n\t\t");
--- 52,64 ----
static void
print_crc64_table(void)
{
printf("/* This file has been automatically generated by "
"crc64_tablegen.c. */\n\n"
! "extern const uint64_t lzma_crc64_table[4][256] = {\n\t{");
for (size_t s = 0; s < 4; ++s) {
for (size_t b = 0; b < 256; ++b) {
if ((b % 2) == 0)
printf("\n\t\t");
*** xz-5.2.0/src/liblzma/common/alone_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/alone_decoder.c Fri Jan 9 16:44:01 2015
***************
*** 12,33 ****
#include "alone_decoder.h"
#include "lzma_decoder.h"
#include "lz_decoder.h"
struct lzma_coder_s {
lzma_next_coder next;
! enum {
! SEQ_PROPERTIES,
! SEQ_DICTIONARY_SIZE,
! SEQ_UNCOMPRESSED_SIZE,
! SEQ_CODER_INIT,
! SEQ_CODE,
! } sequence;
/// If true, reject files that are unlikely to be .lzma files.
/// If false, more non-.lzma files get accepted and will give
/// LZMA_DATA_ERROR either immediately or after a few output bytes.
bool picky;
--- 12,34 ----
#include "alone_decoder.h"
#include "lzma_decoder.h"
#include "lz_decoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_PROPERTIES,
+ SEQ_DICTIONARY_SIZE,
+ SEQ_UNCOMPRESSED_SIZE,
+ SEQ_CODER_INIT,
+ SEQ_CODE,
+ };
struct lzma_coder_s {
lzma_next_coder next;
! enum lzma_coder_sequence_e sequence;
/// If true, reject files that are unlikely to be .lzma files.
/// If false, more non-.lzma files get accepted and will give
/// LZMA_DATA_ERROR either immediately or after a few output bytes.
bool picky;
*************** alone_decode(lzma_coder *coder,
*** 126,145 ****
// Fall through
case SEQ_CODER_INIT: {
if (coder->memusage > coder->memlimit)
return LZMA_MEMLIMIT_ERROR;
! lzma_filter_info filters[2] = {
! {
! .init = &lzma_lzma_decoder_init,
! .options = &coder->options,
! }, {
! .init = NULL,
! }
! };
const lzma_ret ret = lzma_next_filter_init(&coder->next,
allocator, filters);
if (ret != LZMA_OK)
return ret;
--- 127,142 ----
// Fall through
case SEQ_CODER_INIT: {
if (coder->memusage > coder->memlimit)
return LZMA_MEMLIMIT_ERROR;
! lzma_filter_info filters[2];
! filters[0].init = &lzma_lzma_decoder_init;
! filters[0].options = &coder->options;
! filters[1].init = NULL;
const lzma_ret ret = lzma_next_filter_init(&coder->next,
allocator, filters);
if (ret != LZMA_OK)
return ret;
*************** lzma_alone_decoder_init(lzma_next_coder
*** 199,211 ****
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
if (memlimit == 0)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &alone_decode;
next->end = &alone_decoder_end;
next->memconfig = &alone_decoder_memconfig;
--- 196,208 ----
lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
if (memlimit == 0)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &alone_decode;
next->end = &alone_decoder_end;
next->memconfig = &alone_decoder_memconfig;
*************** lzma_alone_decoder_init(lzma_next_coder
*** 226,238 ****
}
extern LZMA_API(lzma_ret)
lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
{
! lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 223,235 ----
}
extern LZMA_API(lzma_ret)
lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
{
! lzma_next_strm_init2(lzma_alone_decoder_init, strm, memlimit, false);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/alone_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/alone_encoder.c Fri Jan 9 14:42:07 2015
***************
*** 14,32 ****
#include "lzma_encoder.h"
#define ALONE_HEADER_SIZE (1 + 4 + 8)
struct lzma_coder_s {
lzma_next_coder next;
! enum {
! SEQ_HEADER,
! SEQ_CODE,
! } sequence;
size_t header_pos;
uint8_t header[ALONE_HEADER_SIZE];
};
--- 14,33 ----
#include "lzma_encoder.h"
#define ALONE_HEADER_SIZE (1 + 4 + 8)
+ enum lzma_coder_sequence_e {
+ SEQ_HEADER,
+ SEQ_CODE,
+ };
struct lzma_coder_s {
lzma_next_coder next;
! enum lzma_coder_sequence_e sequence;
size_t header_pos;
uint8_t header[ALONE_HEADER_SIZE];
};
*************** static lzma_ret
*** 78,90 ****
alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_options_lzma *options)
{
lzma_next_coder_init(&alone_encoder_init, next, allocator);
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &alone_encode;
next->end = &alone_encoder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
--- 79,91 ----
alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_options_lzma *options)
{
lzma_next_coder_init(&alone_encoder_init, next, allocator);
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &alone_encode;
next->end = &alone_encoder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
*************** alone_encoder_init(lzma_next_coder *next
*** 121,136 ****
// - Uncompressed size (always unknown and using EOPM)
memset(next->coder->header + 1 + 4, 0xFF, 8);
// Initialize the LZMA encoder.
const lzma_filter_info filters[2] = {
{
! .init = &lzma_lzma_encoder_init,
! .options = (void *)(options),
}, {
! .init = NULL,
}
};
return lzma_next_filter_init(&next->coder->next, allocator, filters);
}
--- 122,139 ----
// - Uncompressed size (always unknown and using EOPM)
memset(next->coder->header + 1 + 4, 0xFF, 8);
// Initialize the LZMA encoder.
const lzma_filter_info filters[2] = {
{
! /*.id =*/0,
! /*.init =*/ (lzma_init_function)&lzma_lzma_encoder_init,
! /*.options =*/ (void *)(options),
}, {
! /*.id =*/0,
! /*.init =*/ NULL,
}
};
return lzma_next_filter_init(&next->coder->next, allocator, filters);
}
*************** lzma_alone_encoder_init(lzma_next_coder
*** 145,157 ****
*/
extern LZMA_API(lzma_ret)
lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options)
{
! lzma_next_strm_init(alone_encoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 148,160 ----
*/
extern LZMA_API(lzma_ret)
lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options)
{
! lzma_next_strm_init1(alone_encoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/auto_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/auto_decoder.c Fri Jan 9 14:42:07 2015
***************
*** 11,34 ****
///////////////////////////////////////////////////////////////////////////////
#include "stream_decoder.h"
#include "alone_decoder.h"
struct lzma_coder_s {
/// Stream decoder or LZMA_Alone decoder
lzma_next_coder next;
uint64_t memlimit;
uint32_t flags;
! enum {
! SEQ_INIT,
! SEQ_CODE,
! SEQ_FINISH,
! } sequence;
};
static lzma_ret
auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
const uint8_t *restrict in, size_t *restrict in_pos,
--- 11,35 ----
///////////////////////////////////////////////////////////////////////////////
#include "stream_decoder.h"
#include "alone_decoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_INIT,
+ SEQ_CODE,
+ SEQ_FINISH,
+ };
struct lzma_coder_s {
/// Stream decoder or LZMA_Alone decoder
lzma_next_coder next;
uint64_t memlimit;
uint32_t flags;
! enum lzma_coder_sequence_e sequence;
};
static lzma_ret
auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
const uint8_t *restrict in, size_t *restrict in_pos,
*************** auto_decoder_init(lzma_next_coder *next,
*** 152,164 ****
return LZMA_PROG_ERROR;
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &auto_decode;
next->end = &auto_decoder_end;
next->get_check = &auto_decoder_get_check;
--- 153,165 ----
return LZMA_PROG_ERROR;
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &auto_decode;
next->end = &auto_decoder_end;
next->get_check = &auto_decoder_get_check;
*************** auto_decoder_init(lzma_next_coder *next,
*** 174,186 ****
}
extern LZMA_API(lzma_ret)
lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
! lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 175,187 ----
}
extern LZMA_API(lzma_ret)
lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
! lzma_next_strm_init2(auto_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/block_buffer_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/block_buffer_encoder.c Fri Jan 9 14:42:07 2015
*************** block_encode_uncompressed(lzma_block *bl
*** 90,102 ****
uint8_t *out, size_t *out_pos, size_t out_size)
{
// Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at
// all, but LZMA2 always requires a dictionary, so use the minimum
// value to minimize memory usage of the decoder.
lzma_options_lzma lzma2 = {
! .dict_size = LZMA_DICT_SIZE_MIN,
};
lzma_filter filters[2];
filters[0].id = LZMA_FILTER_LZMA2;
filters[0].options = &lzma2;
filters[1].id = LZMA_VLI_UNKNOWN;
--- 90,102 ----
uint8_t *out, size_t *out_pos, size_t out_size)
{
// Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at
// all, but LZMA2 always requires a dictionary, so use the minimum
// value to minimize memory usage of the decoder.
lzma_options_lzma lzma2 = {
! /*.dict_size =*/ LZMA_DICT_SIZE_MIN,
};
lzma_filter filters[2];
filters[0].id = LZMA_FILTER_LZMA2;
filters[0].options = &lzma2;
filters[1].id = LZMA_VLI_UNKNOWN;
*** xz-5.2.0/src/liblzma/common/block_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/block_decoder.c Fri Jan 9 14:42:08 2015
***************
*** 12,29 ****
#include "block_decoder.h"
#include "filter_decoder.h"
#include "check.h"
struct lzma_coder_s {
! enum {
! SEQ_CODE,
! SEQ_PADDING,
! SEQ_CHECK,
! } sequence;
/// The filters in the chain; initialized with lzma_raw_decoder_init().
lzma_next_coder next;
/// Decoding options; we also write Compressed Size and Uncompressed
/// Size back to this structure when the decoding has been finished.
--- 12,30 ----
#include "block_decoder.h"
#include "filter_decoder.h"
#include "check.h"
+ enum lzma_coder_sequence_e {
+ SEQ_CODE,
+ SEQ_PADDING,
+ SEQ_CHECK,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// The filters in the chain; initialized with lzma_raw_decoder_init().
lzma_next_coder next;
/// Decoding options; we also write Compressed Size and Uncompressed
/// Size back to this structure when the decoding has been finished.
*************** lzma_block_decoder_init(lzma_next_coder
*** 197,209 ****
if (lzma_block_unpadded_size(block) == 0
|| !lzma_vli_is_valid(block->uncompressed_size))
return LZMA_PROG_ERROR;
// Allocate and initialize *next->coder if needed.
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &block_decode;
next->end = &block_decoder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
--- 198,210 ----
if (lzma_block_unpadded_size(block) == 0
|| !lzma_vli_is_valid(block->uncompressed_size))
return LZMA_PROG_ERROR;
// Allocate and initialize *next->coder if needed.
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &block_decode;
next->end = &block_decoder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
*************** lzma_block_decoder_init(lzma_next_coder
*** 240,252 ****
}
extern LZMA_API(lzma_ret)
lzma_block_decoder(lzma_stream *strm, lzma_block *block)
{
! lzma_next_strm_init(lzma_block_decoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 241,253 ----
}
extern LZMA_API(lzma_ret)
lzma_block_decoder(lzma_stream *strm, lzma_block *block)
{
! lzma_next_strm_init1(lzma_block_decoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/block_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/block_encoder.c Fri Jan 9 14:42:08 2015
***************
*** 12,37 ****
#include "block_encoder.h"
#include "filter_encoder.h"
#include "check.h"
struct lzma_coder_s {
/// The filters in the chain; initialized with lzma_raw_decoder_init().
lzma_next_coder next;
/// Encoding options; we also write Unpadded Size, Compressed Size,
/// and Uncompressed Size back to this structure when the encoding
/// has been finished.
lzma_block *block;
! enum {
! SEQ_CODE,
! SEQ_PADDING,
! SEQ_CHECK,
! } sequence;
/// Compressed Size calculated while encoding
lzma_vli compressed_size;
/// Uncompressed Size calculated while encoding
lzma_vli uncompressed_size;
--- 12,38 ----
#include "block_encoder.h"
#include "filter_encoder.h"
#include "check.h"
+ enum lzma_coder_sequence_e {
+ SEQ_CODE,
+ SEQ_PADDING,
+ SEQ_CHECK,
+ };
struct lzma_coder_s {
/// The filters in the chain; initialized with lzma_raw_decoder_init().
lzma_next_coder next;
/// Encoding options; we also write Unpadded Size, Compressed Size,
/// and Uncompressed Size back to this structure when the encoding
/// has been finished.
lzma_block *block;
! enum lzma_coder_sequence_e sequence;
/// Compressed Size calculated while encoding
lzma_vli compressed_size;
/// Uncompressed Size calculated while encoding
lzma_vli uncompressed_size;
*************** lzma_block_encoder_init(lzma_next_coder
*** 176,188 ****
if (!lzma_check_is_supported(block->check))
return LZMA_UNSUPPORTED_CHECK;
// Allocate and initialize *next->coder if needed.
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &block_encode;
next->end = &block_encoder_end;
next->update = &block_encoder_update;
--- 177,189 ----
if (!lzma_check_is_supported(block->check))
return LZMA_UNSUPPORTED_CHECK;
// Allocate and initialize *next->coder if needed.
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &block_encode;
next->end = &block_encoder_end;
next->update = &block_encoder_update;
*************** lzma_block_encoder_init(lzma_next_coder
*** 205,217 ****
}
extern LZMA_API(lzma_ret)
lzma_block_encoder(lzma_stream *strm, lzma_block *block)
{
! lzma_next_strm_init(lzma_block_encoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 206,218 ----
}
extern LZMA_API(lzma_ret)
lzma_block_encoder(lzma_stream *strm, lzma_block *block)
{
! lzma_next_strm_init1(lzma_block_encoder_init, strm, block);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/common.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/common.c Fri Jan 9 17:42:03 2015
*************** lzma_bufcpy(const uint8_t *restrict in,
*** 104,115 ****
--- 104,134 ----
*in_pos += copy_size;
*out_pos += copy_size;
return copy_size;
}
+ #if __GNUC__ >= 3
+ #else
+ extern inline lzma_next_coder
+ _lzma_next_coder_init_func()
+ {
+ static const lzma_next_coder ret = {
+ /*.coder =*/ NULL,
+ /*.id =*/ LZMA_VLI_UNKNOWN,
+ /*.init =*/ (uintptr_t)(NULL),
+ /*.code =*/ NULL,
+ /*.end =*/ NULL,
+ /*.get_progress =*/ NULL,
+ /*.get_check =*/ NULL,
+ /*.memconfig =*/ NULL,
+ /*.update =*/ NULL,
+ };
+ return ret;
+ }
+ #endif
extern lzma_ret
lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
lzma_next_coder_init(filters[0].init, next, allocator);
*************** extern lzma_ret
*** 166,178 ****
lzma_strm_init(lzma_stream *strm)
{
if (strm == NULL)
return LZMA_PROG_ERROR;
if (strm->internal == NULL) {
! strm->internal = lzma_alloc(sizeof(lzma_internal),
strm->allocator);
if (strm->internal == NULL)
return LZMA_MEM_ERROR;
strm->internal->next = LZMA_NEXT_CODER_INIT;
}
--- 185,197 ----
lzma_strm_init(lzma_stream *strm)
{
if (strm == NULL)
return LZMA_PROG_ERROR;
if (strm->internal == NULL) {
! strm->internal = (lzma_internal *)lzma_alloc(sizeof(lzma_internal),
strm->allocator);
if (strm->internal == NULL)
return LZMA_MEM_ERROR;
strm->internal->next = LZMA_NEXT_CODER_INIT;
}
*** xz-5.2.0/src/liblzma/common/common.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/common.h Fri Jan 9 16:16:32 2015
***************
*** 33,45 ****
#define LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL
#include "lzma.h"
// These allow helping the compiler in some often-executed branches, whose
// result is almost always the same.
! #ifdef __GNUC__
# define likely(expr) __builtin_expect(expr, true)
# define unlikely(expr) __builtin_expect(expr, false)
#else
# define likely(expr) (expr)
# define unlikely(expr) (expr)
#endif
--- 33,45 ----
#define LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL
#include "lzma.h"
// These allow helping the compiler in some often-executed branches, whose
// result is almost always the same.
! #if __GNUC__ >= 3
# define likely(expr) __builtin_expect(expr, true)
# define unlikely(expr) __builtin_expect(expr, false)
#else
# define likely(expr) (expr)
# define unlikely(expr) (expr)
#endif
*************** struct lzma_next_coder_s {
*** 178,222 ****
const lzma_filter *filters,
const lzma_filter *reversed_filters);
};
/// Macro to initialize lzma_next_coder structure
#define LZMA_NEXT_CODER_INIT \
(lzma_next_coder){ \
.coder = NULL, \
.init = (uintptr_t)(NULL), \
.id = LZMA_VLI_UNKNOWN, \
.code = NULL, \
.end = NULL, \
.get_progress = NULL, \
.get_check = NULL, \
.memconfig = NULL, \
.update = NULL, \
}
/// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to
/// this is stored in lzma_stream.
struct lzma_internal_s {
/// The actual coder that should do something useful
lzma_next_coder next;
/// Track the state of the coder. This is used to validate arguments
/// so that the actual coders can rely on e.g. that LZMA_SYNC_FLUSH
/// is used on every call to lzma_code until next.code has returned
/// LZMA_STREAM_END.
! enum {
! ISEQ_RUN,
! ISEQ_SYNC_FLUSH,
! ISEQ_FULL_FLUSH,
! ISEQ_FINISH,
! ISEQ_FULL_BARRIER,
! ISEQ_END,
! ISEQ_ERROR,
! } sequence;
/// A copy of lzma_stream avail_in. This is used to verify that the
/// amount of input doesn't change once e.g. LZMA_FINISH has been
/// used.
size_t avail_in;
--- 178,230 ----
const lzma_filter *filters,
const lzma_filter *reversed_filters);
};
/// Macro to initialize lzma_next_coder structure
+ #if __GNUC__ >= 3
#define LZMA_NEXT_CODER_INIT \
(lzma_next_coder){ \
.coder = NULL, \
.init = (uintptr_t)(NULL), \
.id = LZMA_VLI_UNKNOWN, \
.code = NULL, \
.end = NULL, \
.get_progress = NULL, \
.get_check = NULL, \
.memconfig = NULL, \
.update = NULL, \
}
+ #else
+ /* older GCC */
+ #define LZMA_NEXT_CODER_INIT \
+ _lzma_next_coder_init_func()
+ extern lzma_next_coder _lzma_next_coder_init_func(void);
+ #endif
/// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to
/// this is stored in lzma_stream.
+ enum lzma_internal_sequence_e {
+ ISEQ_RUN,
+ ISEQ_SYNC_FLUSH,
+ ISEQ_FULL_FLUSH,
+ ISEQ_FINISH,
+ ISEQ_FULL_BARRIER,
+ ISEQ_END,
+ ISEQ_ERROR,
+ };
struct lzma_internal_s {
/// The actual coder that should do something useful
lzma_next_coder next;
/// Track the state of the coder. This is used to validate arguments
/// so that the actual coders can rely on e.g. that LZMA_SYNC_FLUSH
/// is used on every call to lzma_code until next.code has returned
/// LZMA_STREAM_END.
! enum lzma_internal_sequence_e sequence;
/// A copy of lzma_stream avail_in. This is used to verify that the
/// amount of input doesn't change once e.g. LZMA_FINISH has been
/// used.
size_t avail_in;
*************** do { \
*** 301,317 ****
/// Initializes lzma_strm and calls func() to initialize strm->internal->next.
/// (The function being called will use lzma_next_coder_init()). If
/// initialization fails, memory that wasn't freed by func() is freed
/// along strm->internal.
! #define lzma_next_strm_init(func, strm, ...) \
do { \
return_if_error(lzma_strm_init(strm)); \
const lzma_ret ret_ = func(&(strm)->internal->next, \
! (strm)->allocator, __VA_ARGS__); \
if (ret_ != LZMA_OK) { \
lzma_end(strm); \
return ret_; \
} \
} while (0)
--- 309,345 ----
/// Initializes lzma_strm and calls func() to initialize strm->internal->next.
/// (The function being called will use lzma_next_coder_init()). If
/// initialization fails, memory that wasn't freed by func() is freed
/// along strm->internal.
! #define lzma_next_strm_init1(func, strm, p1) \
! do { \
! return_if_error(lzma_strm_init(strm)); \
! const lzma_ret ret_ = func(&(strm)->internal->next, \
! (strm)->allocator, (p1)); \
! if (ret_ != LZMA_OK) { \
! lzma_end(strm); \
! return ret_; \
! } \
! } while (0)
! #define lzma_next_strm_init2(func, strm, p1,p2) \
! do { \
! return_if_error(lzma_strm_init(strm)); \
! const lzma_ret ret_ = func(&(strm)->internal->next, \
! (strm)->allocator, (p1),(p2)); \
! if (ret_ != LZMA_OK) { \
! lzma_end(strm); \
! return ret_; \
! } \
! } while (0)
! #define lzma_next_strm_init3(func, strm, p1,p2,p3) \
do { \
return_if_error(lzma_strm_init(strm)); \
const lzma_ret ret_ = func(&(strm)->internal->next, \
! (strm)->allocator, (p1),(p2),(p3)); \
if (ret_ != LZMA_OK) { \
lzma_end(strm); \
return ret_; \
} \
} while (0)
*** xz-5.2.0/src/liblzma/common/filter_common.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/filter_common.c Fri Jan 9 14:42:09 2015
*************** static const struct {
*** 33,125 ****
/// uncompressed input).
bool changes_size;
} features[] = {
#if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
{
! .id = LZMA_FILTER_LZMA1,
! .options_size = sizeof(lzma_options_lzma),
! .non_last_ok = false,
! .last_ok = true,
! .changes_size = true,
},
#endif
#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
{
! .id = LZMA_FILTER_LZMA2,
! .options_size = sizeof(lzma_options_lzma),
! .non_last_ok = false,
! .last_ok = true,
! .changes_size = true,
},
#endif
#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
{
! .id = LZMA_FILTER_X86,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
{
! .id = LZMA_FILTER_POWERPC,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
{
! .id = LZMA_FILTER_IA64,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM)
{
! .id = LZMA_FILTER_ARM,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB)
{
! .id = LZMA_FILTER_ARMTHUMB,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC)
{
! .id = LZMA_FILTER_SPARC,
! .options_size = sizeof(lzma_options_bcj),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
{
! .id = LZMA_FILTER_DELTA,
! .options_size = sizeof(lzma_options_delta),
! .non_last_ok = true,
! .last_ok = false,
! .changes_size = false,
},
#endif
{
! .id = LZMA_VLI_UNKNOWN
}
};
extern LZMA_API(lzma_ret)
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
--- 33,125 ----
/// uncompressed input).
bool changes_size;
} features[] = {
#if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
{
! /*.id =*/ LZMA_FILTER_LZMA1,
! /*.options_size =*/ sizeof(lzma_options_lzma),
! /*.non_last_ok =*/ false,
! /*.last_ok =*/ true,
! /*.changes_size =*/ true,
},
#endif
#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
{
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.options_size =*/ sizeof(lzma_options_lzma),
! /*.non_last_ok =*/ false,
! /*.last_ok =*/ true,
! /*.changes_size =*/ true,
},
#endif
#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
{
! /*.id =*/ LZMA_FILTER_X86,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
{
! /*.id =*/ LZMA_FILTER_POWERPC,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
{
! /*.id =*/ LZMA_FILTER_IA64,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM)
{
! /*.id =*/ LZMA_FILTER_ARM,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB)
{
! /*.id =*/ LZMA_FILTER_ARMTHUMB,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC)
{
! /*.id =*/ LZMA_FILTER_SPARC,
! /*.options_size =*/ sizeof(lzma_options_bcj),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
{
! /*.id =*/ LZMA_FILTER_DELTA,
! /*.options_size =*/ sizeof(lzma_options_delta),
! /*.non_last_ok =*/ true,
! /*.last_ok =*/ false,
! /*.changes_size =*/ false,
},
#endif
{
! /*.id =*/ LZMA_VLI_UNKNOWN
}
};
extern LZMA_API(lzma_ret)
lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
*** xz-5.2.0/src/liblzma/common/filter_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/filter_decoder.c Fri Jan 9 14:42:09 2015
*************** typedef struct {
*** 42,121 ****
} lzma_filter_decoder;
static const lzma_filter_decoder decoders[] = {
#ifdef HAVE_DECODER_LZMA1
{
! .id = LZMA_FILTER_LZMA1,
! .init = &lzma_lzma_decoder_init,
! .memusage = &lzma_lzma_decoder_memusage,
! .props_decode = &lzma_lzma_props_decode,
},
#endif
#ifdef HAVE_DECODER_LZMA2
{
! .id = LZMA_FILTER_LZMA2,
! .init = &lzma_lzma2_decoder_init,
! .memusage = &lzma_lzma2_decoder_memusage,
! .props_decode = &lzma_lzma2_props_decode,
},
#endif
#ifdef HAVE_DECODER_X86
{
! .id = LZMA_FILTER_X86,
! .init = &lzma_simple_x86_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_POWERPC
{
! .id = LZMA_FILTER_POWERPC,
! .init = &lzma_simple_powerpc_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_IA64
{
! .id = LZMA_FILTER_IA64,
! .init = &lzma_simple_ia64_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARM
{
! .id = LZMA_FILTER_ARM,
! .init = &lzma_simple_arm_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARMTHUMB
{
! .id = LZMA_FILTER_ARMTHUMB,
! .init = &lzma_simple_armthumb_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_SPARC
{
! .id = LZMA_FILTER_SPARC,
! .init = &lzma_simple_sparc_decoder_init,
! .memusage = NULL,
! .props_decode = &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_DELTA
{
! .id = LZMA_FILTER_DELTA,
! .init = &lzma_delta_decoder_init,
! .memusage = &lzma_delta_coder_memusage,
! .props_decode = &lzma_delta_props_decode,
},
#endif
};
static const lzma_filter_decoder *
--- 42,121 ----
} lzma_filter_decoder;
static const lzma_filter_decoder decoders[] = {
#ifdef HAVE_DECODER_LZMA1
{
! /*.id =*/ LZMA_FILTER_LZMA1,
! /*.init =*/ &lzma_lzma_decoder_init,
! /*.memusage =*/ &lzma_lzma_decoder_memusage,
! /*.props_decode =*/ &lzma_lzma_props_decode,
},
#endif
#ifdef HAVE_DECODER_LZMA2
{
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.init =*/ &lzma_lzma2_decoder_init,
! /*.memusage =*/ &lzma_lzma2_decoder_memusage,
! /*.props_decode =*/ &lzma_lzma2_props_decode,
},
#endif
#ifdef HAVE_DECODER_X86
{
! /*.id =*/ LZMA_FILTER_X86,
! /*.init =*/ &lzma_simple_x86_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_POWERPC
{
! /*.id =*/ LZMA_FILTER_POWERPC,
! /*.init =*/ &lzma_simple_powerpc_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_IA64
{
! /*.id =*/ LZMA_FILTER_IA64,
! /*.init =*/ &lzma_simple_ia64_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARM
{
! /*.id =*/ LZMA_FILTER_ARM,
! /*.init =*/ &lzma_simple_arm_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_ARMTHUMB
{
! /*.id =*/ LZMA_FILTER_ARMTHUMB,
! /*.init =*/ &lzma_simple_armthumb_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_SPARC
{
! /*.id =*/ LZMA_FILTER_SPARC,
! /*.init =*/ &lzma_simple_sparc_decoder_init,
! /*.memusage =*/ NULL,
! /*.props_decode =*/ &lzma_simple_props_decode,
},
#endif
#ifdef HAVE_DECODER_DELTA
{
! /*.id =*/ LZMA_FILTER_DELTA,
! /*.init =*/ &lzma_delta_decoder_init,
! /*.memusage =*/ &lzma_delta_coder_memusage,
! /*.props_decode =*/ &lzma_delta_props_decode,
},
#endif
};
static const lzma_filter_decoder *
*************** lzma_raw_decoder_init(lzma_next_coder *n
*** 145,157 ****
}
extern LZMA_API(lzma_ret)
lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options)
{
! lzma_next_strm_init(lzma_raw_decoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 145,157 ----
}
extern LZMA_API(lzma_ret)
lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options)
{
! lzma_next_strm_init1(lzma_raw_decoder_init, strm, options);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/filter_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/filter_encoder.c Fri Jan 9 16:35:35 2015
*************** typedef struct {
*** 53,153 ****
} lzma_filter_encoder;
static const lzma_filter_encoder encoders[] = {
#ifdef HAVE_ENCODER_LZMA1
{
! .id = LZMA_FILTER_LZMA1,
! .init = &lzma_lzma_encoder_init,
! .memusage = &lzma_lzma_encoder_memusage,
! .block_size = NULL, // FIXME
! .props_size_get = NULL,
! .props_size_fixed = 5,
! .props_encode = &lzma_lzma_props_encode,
},
#endif
#ifdef HAVE_ENCODER_LZMA2
{
! .id = LZMA_FILTER_LZMA2,
! .init = &lzma_lzma2_encoder_init,
! .memusage = &lzma_lzma2_encoder_memusage,
! .block_size = &lzma_lzma2_block_size, // FIXME
! .props_size_get = NULL,
! .props_size_fixed = 1,
! .props_encode = &lzma_lzma2_props_encode,
},
#endif
#ifdef HAVE_ENCODER_X86
{
! .id = LZMA_FILTER_X86,
! .init = &lzma_simple_x86_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_POWERPC
{
! .id = LZMA_FILTER_POWERPC,
! .init = &lzma_simple_powerpc_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_IA64
{
! .id = LZMA_FILTER_IA64,
! .init = &lzma_simple_ia64_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARM
{
! .id = LZMA_FILTER_ARM,
! .init = &lzma_simple_arm_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARMTHUMB
{
! .id = LZMA_FILTER_ARMTHUMB,
! .init = &lzma_simple_armthumb_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_SPARC
{
! .id = LZMA_FILTER_SPARC,
! .init = &lzma_simple_sparc_encoder_init,
! .memusage = NULL,
! .block_size = NULL,
! .props_size_get = &lzma_simple_props_size,
! .props_encode = &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_DELTA
{
! .id = LZMA_FILTER_DELTA,
! .init = &lzma_delta_encoder_init,
! .memusage = &lzma_delta_coder_memusage,
! .block_size = NULL,
! .props_size_get = NULL,
! .props_size_fixed = 1,
! .props_encode = &lzma_delta_props_encode,
},
#endif
};
static const lzma_filter_encoder *
--- 53,159 ----
} lzma_filter_encoder;
static const lzma_filter_encoder encoders[] = {
#ifdef HAVE_ENCODER_LZMA1
{
! /*.id =*/ LZMA_FILTER_LZMA1,
! /*.init =*/ &lzma_lzma_encoder_init,
! /*.memusage =*/ &lzma_lzma_encoder_memusage,
! /*.block_size =*/ NULL, // FIXME
! /*.props_size_get =*/ NULL,
! /*.props_size_fixed =*/ 5,
! /*.props_encode =*/ &lzma_lzma_props_encode,
},
#endif
#ifdef HAVE_ENCODER_LZMA2
{
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.init =*/ &lzma_lzma2_encoder_init,
! /*.memusage =*/ &lzma_lzma2_encoder_memusage,
! /*.block_size =*/ &lzma_lzma2_block_size, // FIXME
! /*.props_size_get =*/ NULL,
! /*.props_size_fixed =*/ 1,
! /*.props_encode =*/ &lzma_lzma2_props_encode,
},
#endif
#ifdef HAVE_ENCODER_X86
{
! /*.id =*/ LZMA_FILTER_X86,
! /*.init =*/ &lzma_simple_x86_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_POWERPC
{
! /*.id =*/ LZMA_FILTER_POWERPC,
! /*.init =*/ &lzma_simple_powerpc_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_IA64
{
! /*.id =*/ LZMA_FILTER_IA64,
! /*.init =*/ &lzma_simple_ia64_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARM
{
! /*.id =*/ LZMA_FILTER_ARM,
! /*.init =*/ &lzma_simple_arm_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_ARMTHUMB
{
! /*.id =*/ LZMA_FILTER_ARMTHUMB,
! /*.init =*/ &lzma_simple_armthumb_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_SPARC
{
! /*.id =*/ LZMA_FILTER_SPARC,
! /*.init =*/ &lzma_simple_sparc_encoder_init,
! /*.memusage =*/ NULL,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ &lzma_simple_props_size,
! 0,
! /*.props_encode =*/ &lzma_simple_props_encode,
},
#endif
#ifdef HAVE_ENCODER_DELTA
{
! /*.id =*/ LZMA_FILTER_DELTA,
! /*.init =*/ &lzma_delta_encoder_init,
! /*.memusage =*/ &lzma_delta_coder_memusage,
! /*.block_size =*/ NULL,
! /*.props_size_get =*/ NULL,
! /*.props_size_fixed =*/ 1,
! /*.props_encode =*/ &lzma_delta_props_encode,
},
#endif
};
static const lzma_filter_encoder *
*************** lzma_raw_encoder_init(lzma_next_coder *n
*** 204,216 ****
}
extern LZMA_API(lzma_ret)
lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options)
{
! lzma_next_strm_init(lzma_raw_coder_init, strm, options,
(lzma_filter_find)(&encoder_find), true);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
--- 210,222 ----
}
extern LZMA_API(lzma_ret)
lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options)
{
! lzma_next_strm_init3(lzma_raw_coder_init, strm, options,
(lzma_filter_find)(&encoder_find), true);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
*** xz-5.2.0/src/liblzma/common/index.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/index.c Fri Jan 9 17:45:23 2015
*************** index_tree_locate(const index_tree *tree
*** 339,351 ****
/// Allocate and initialize a new Stream using the given base offsets.
static index_stream *
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
lzma_vli stream_number, lzma_vli block_number_base,
const lzma_allocator *allocator)
{
! index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
if (s == NULL)
return NULL;
s->node.uncompressed_base = uncompressed_base;
s->node.compressed_base = compressed_base;
s->node.parent = NULL;
--- 339,351 ----
/// Allocate and initialize a new Stream using the given base offsets.
static index_stream *
index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
lzma_vli stream_number, lzma_vli block_number_base,
const lzma_allocator *allocator)
{
! index_stream *s = (index_stream *)lzma_alloc(sizeof(index_stream), allocator);
if (s == NULL)
return NULL;
s->node.uncompressed_base = uncompressed_base;
s->node.compressed_base = compressed_base;
s->node.parent = NULL;
*************** index_stream_init(lzma_vli compressed_ba
*** 367,388 ****
/// Free the memory allocated for a Stream and its Record groups.
static void
index_stream_end(void *node, const lzma_allocator *allocator)
{
! index_stream *s = node;
index_tree_end(&s->groups, allocator, NULL);
return;
}
static lzma_index *
index_init_plain(const lzma_allocator *allocator)
{
! lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
if (i != NULL) {
index_tree_init(&i->streams);
i->uncompressed_size = 0;
i->total_size = 0;
i->record_count = 0;
i->index_list_size = 0;
--- 367,388 ----
/// Free the memory allocated for a Stream and its Record groups.
static void
index_stream_end(void *node, const lzma_allocator *allocator)
{
! index_stream *s = (index_stream *)node;
index_tree_end(&s->groups, allocator, NULL);
return;
}
static lzma_index *
index_init_plain(const lzma_allocator *allocator)
{
! lzma_index *i = (lzma_index *)lzma_alloc(sizeof(lzma_index), allocator);
if (i != NULL) {
index_tree_init(&i->streams);
i->uncompressed_size = 0;
i->total_size = 0;
i->record_count = 0;
i->index_list_size = 0;
*************** lzma_index_append(lzma_index *i, const l
*** 672,684 ****
if (g != NULL && g->last + 1 < g->allocated) {
// There is space in the last group at least for one Record.
++g->last;
} else {
// We need to allocate a new group.
! g = lzma_alloc(sizeof(index_group)
+ i->prealloc * sizeof(index_record),
allocator);
if (g == NULL)
return LZMA_MEM_ERROR;
g->last = 0;
--- 672,684 ----
if (g != NULL && g->last + 1 < g->allocated) {
// There is space in the last group at least for one Record.
++g->last;
} else {
// We need to allocate a new group.
! g = (index_group *)lzma_alloc(sizeof(index_group)
+ i->prealloc * sizeof(index_record),
allocator);
if (g == NULL)
return LZMA_MEM_ERROR;
g->last = 0;
*************** typedef struct {
*** 739,763 ****
/// Add the Stream nodes from the source index to dest using recursion.
/// Simplest iterative traversal of the source tree wouldn't work, because
/// we update the pointers in nodes when moving them to the destination tree.
static void
! index_cat_helper(const index_cat_info *info, index_stream *this)
{
! index_stream *left = (index_stream *)(this->node.left);
! index_stream *right = (index_stream *)(this->node.right);
if (left != NULL)
index_cat_helper(info, left);
! this->node.uncompressed_base += info->uncompressed_size;
! this->node.compressed_base += info->file_size;
! this->number += info->stream_number_add;
! this->block_number_base += info->block_number_add;
! index_tree_append(info->streams, &this->node);
if (right != NULL)
index_cat_helper(info, right);
return;
}
--- 739,763 ----
/// Add the Stream nodes from the source index to dest using recursion.
/// Simplest iterative traversal of the source tree wouldn't work, because
/// we update the pointers in nodes when moving them to the destination tree.
static void
! index_cat_helper(const index_cat_info *info, index_stream *_this)
{
! index_stream *left = (index_stream *)(_this->node.left);
! index_stream *right = (index_stream *)(_this->node.right);
if (left != NULL)
index_cat_helper(info, left);
! _this->node.uncompressed_base += info->uncompressed_size;
! _this->node.compressed_base += info->file_size;
! _this->number += info->stream_number_add;
! _this->block_number_base += info->block_number_add;
! index_tree_append(info->streams, &_this->node);
if (right != NULL)
index_cat_helper(info, right);
return;
}
*************** lzma_index_cat(lzma_index *restrict dest
*** 796,808 ****
index_stream *s = (index_stream *)(dest->streams.rightmost);
index_group *g = (index_group *)(s->groups.rightmost);
if (g != NULL && g->last + 1 < g->allocated) {
assert(g->node.left == NULL);
assert(g->node.right == NULL);
! index_group *newg = lzma_alloc(sizeof(index_group)
+ (g->last + 1)
* sizeof(index_record),
allocator);
if (newg == NULL)
return LZMA_MEM_ERROR;
--- 796,808 ----
index_stream *s = (index_stream *)(dest->streams.rightmost);
index_group *g = (index_group *)(s->groups.rightmost);
if (g != NULL && g->last + 1 < g->allocated) {
assert(g->node.left == NULL);
assert(g->node.right == NULL);
! index_group *newg = (index_group *)lzma_alloc(sizeof(index_group)
+ (g->last + 1)
* sizeof(index_record),
allocator);
if (newg == NULL)
return LZMA_MEM_ERROR;
*************** lzma_index_cat(lzma_index *restrict dest
*** 832,848 ****
}
}
// Add all the Streams from src to dest. Update the base offsets
// of each Stream from src.
const index_cat_info info = {
! .uncompressed_size = dest->uncompressed_size,
! .file_size = dest_file_size,
! .stream_number_add = dest->streams.count,
! .block_number_add = dest->record_count,
! .streams = &dest->streams,
};
index_cat_helper(&info, (index_stream *)(src->streams.root));
// Update info about all the combined Streams.
dest->uncompressed_size += src->uncompressed_size;
dest->total_size += src->total_size;
--- 832,848 ----
}
}
// Add all the Streams from src to dest. Update the base offsets
// of each Stream from src.
const index_cat_info info = {
! /*.uncompressed_size =*/ dest->uncompressed_size,
! /*.file_size =*/ dest_file_size,
! /*.block_number_add =*/ dest->record_count,
! /*.stream_number_add =*/ dest->streams.count,
! /*.streams =*/ &dest->streams,
};
index_cat_helper(&info, (index_stream *)(src->streams.root));
// Update info about all the combined Streams.
dest->uncompressed_size += src->uncompressed_size;
dest->total_size += src->total_size;
*************** index_dup_stream(const index_stream *src
*** 881,893 ****
dest->stream_flags = src->stream_flags;
dest->stream_padding = src->stream_padding;
// Allocate memory for the Records. We put all the Records into
// a single group. It's simplest and also tends to make
// lzma_index_locate() a little bit faster with very big Indexes.
! index_group *destg = lzma_alloc(sizeof(index_group)
+ src->record_count * sizeof(index_record),
allocator);
if (destg == NULL) {
index_stream_end(dest, allocator);
return NULL;
}
--- 881,893 ----
dest->stream_flags = src->stream_flags;
dest->stream_padding = src->stream_padding;
// Allocate memory for the Records. We put all the Records into
// a single group. It's simplest and also tends to make
// lzma_index_locate() a little bit faster with very big Indexes.
! index_group *destg = (index_group *)lzma_alloc(sizeof(index_group)
+ src->record_count * sizeof(index_record),
allocator);
if (destg == NULL) {
index_stream_end(dest, allocator);
return NULL;
}
*************** index_dup_stream(const index_stream *src
*** 903,915 ****
const index_group *srcg = (const index_group *)(src->groups.leftmost);
size_t i = 0;
do {
memcpy(destg->records + i, srcg->records,
(srcg->last + 1) * sizeof(index_record));
i += srcg->last + 1;
! srcg = index_tree_next(&srcg->node);
} while (srcg != NULL);
assert(i == destg->allocated);
// Add the group to the new Stream.
index_tree_append(&dest->groups, &destg->node);
--- 903,915 ----
const index_group *srcg = (const index_group *)(src->groups.leftmost);
size_t i = 0;
do {
memcpy(destg->records + i, srcg->records,
(srcg->last + 1) * sizeof(index_record));
i += srcg->last + 1;
! srcg = (index_group *)index_tree_next(&srcg->node);
} while (srcg != NULL);
assert(i == destg->allocated);
// Add the group to the new Stream.
index_tree_append(&dest->groups, &destg->node);
*************** lzma_index_dup(const lzma_index *src, co
*** 942,954 ****
lzma_index_end(dest, allocator);
return NULL;
}
index_tree_append(&dest->streams, &deststream->node);
! srcstream = index_tree_next(&srcstream->node);
} while (srcstream != NULL);
return dest;
}
--- 942,954 ----
lzma_index_end(dest, allocator);
return NULL;
}
index_tree_append(&dest->streams, &deststream->node);
! srcstream = (index_stream *)index_tree_next(&srcstream->node);
} while (srcstream != NULL);
return dest;
}
*************** enum {
*** 970,984 ****
};
static void
iter_set_info(lzma_index_iter *iter)
{
! const lzma_index *i = iter->internal[ITER_INDEX].p;
! const index_stream *stream = iter->internal[ITER_STREAM].p;
! const index_group *group = iter->internal[ITER_GROUP].p;
const size_t record = iter->internal[ITER_RECORD].s;
// lzma_index_iter.internal must not contain a pointer to the last
// group in the index, because that may be reallocated by
// lzma_index_cat().
if (group == NULL) {
--- 970,984 ----
};
static void
iter_set_info(lzma_index_iter *iter)
{
! const lzma_index *i = (lzma_index *)iter->internal[ITER_INDEX].p;
! const index_stream *stream = (index_stream *)iter->internal[ITER_STREAM].p;
! const index_group *group = (index_group *)iter->internal[ITER_GROUP].p;
const size_t record = iter->internal[ITER_RECORD].s;
// lzma_index_iter.internal must not contain a pointer to the last
// group in the index, because that may be reallocated by
// lzma_index_cat().
if (group == NULL) {
*************** extern LZMA_API(lzma_bool)
*** 1097,1126 ****
lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode)
{
// Catch unsupported mode values.
if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK)
return true;
! const lzma_index *i = iter->internal[ITER_INDEX].p;
! const index_stream *stream = iter->internal[ITER_STREAM].p;
const index_group *group = NULL;
size_t record = iter->internal[ITER_RECORD].s;
// If we are being asked for the next Stream, leave group to NULL
// so that the rest of the this function thinks that this Stream
// has no groups and will thus go to the next Stream.
if (mode != LZMA_INDEX_ITER_STREAM) {
// Get the pointer to the current group. See iter_set_inf()
// for explanation.
switch (iter->internal[ITER_METHOD].s) {
case ITER_METHOD_NORMAL:
! group = iter->internal[ITER_GROUP].p;
break;
case ITER_METHOD_NEXT:
! group = index_tree_next(iter->internal[ITER_GROUP].p);
break;
case ITER_METHOD_LEFTMOST:
group = (const index_group *)(
stream->groups.leftmost);
break;
--- 1097,1126 ----
lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode)
{
// Catch unsupported mode values.
if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK)
return true;
! const lzma_index *i = (lzma_index *)iter->internal[ITER_INDEX].p;
! const index_stream *stream = (index_stream *)iter->internal[ITER_STREAM].p;
const index_group *group = NULL;
size_t record = iter->internal[ITER_RECORD].s;
// If we are being asked for the next Stream, leave group to NULL
// so that the rest of the this function thinks that this Stream
// has no groups and will thus go to the next Stream.
if (mode != LZMA_INDEX_ITER_STREAM) {
// Get the pointer to the current group. See iter_set_inf()
// for explanation.
switch (iter->internal[ITER_METHOD].s) {
case ITER_METHOD_NORMAL:
! group = (index_group *)iter->internal[ITER_GROUP].p;
break;
case ITER_METHOD_NEXT:
! group = (index_group *)index_tree_next((index_tree_node *)iter->internal[ITER_GROUP].p);
break;
case ITER_METHOD_LEFTMOST:
group = (const index_group *)(
stream->groups.leftmost);
break;
*************** again:
*** 1134,1146 ****
stream = (const index_stream *)(i->streams.leftmost);
if (mode >= LZMA_INDEX_ITER_BLOCK) {
// Since we are being asked to return information
// about the first a Block, skip Streams that have
// no Blocks.
while (stream->groups.leftmost == NULL) {
! stream = index_tree_next(&stream->node);
if (stream == NULL)
return true;
}
}
// Start from the first Record in the Stream.
--- 1134,1146 ----
stream = (const index_stream *)(i->streams.leftmost);
if (mode >= LZMA_INDEX_ITER_BLOCK) {
// Since we are being asked to return information
// about the first a Block, skip Streams that have
// no Blocks.
while (stream->groups.leftmost == NULL) {
! stream = (index_stream *)index_tree_next(&stream->node);
if (stream == NULL)
return true;
}
}
// Start from the first Record in the Stream.
*************** again:
*** 1156,1175 ****
// no Blocks at all.
record = 0;
// If group is not NULL, this Stream has at least one Block
// and thus at least one group. Find the next group.
if (group != NULL)
! group = index_tree_next(&group->node);
if (group == NULL) {
// This Stream has no more Records. Find the next
// Stream. If we are being asked to return information
// about a Block, we skip empty Streams.
do {
! stream = index_tree_next(&stream->node);
if (stream == NULL)
return true;
} while (mode >= LZMA_INDEX_ITER_BLOCK
&& stream->groups.leftmost == NULL);
group = (const index_group *)(
--- 1156,1175 ----
// no Blocks at all.
record = 0;
// If group is not NULL, this Stream has at least one Block
// and thus at least one group. Find the next group.
if (group != NULL)
! group = (index_group *)index_tree_next(&group->node);
if (group == NULL) {
// This Stream has no more Records. Find the next
// Stream. If we are being asked to return information
// about a Block, we skip empty Streams.
do {
! stream = (index_stream *)index_tree_next(&stream->node);
if (stream == NULL)
return true;
} while (mode >= LZMA_INDEX_ITER_BLOCK
&& stream->groups.leftmost == NULL);
group = (const index_group *)(
*************** again:
*** 1200,1224 ****
}
extern LZMA_API(lzma_bool)
lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
{
! const lzma_index *i = iter->internal[ITER_INDEX].p;
// If the target is past the end of the file, return immediately.
if (i->uncompressed_size <= target)
return true;
// Locate the Stream containing the target offset.
! const index_stream *stream = index_tree_locate(&i->streams, target);
assert(stream != NULL);
target -= stream->node.uncompressed_base;
// Locate the group containing the target offset.
! const index_group *group = index_tree_locate(&stream->groups, target);
assert(group != NULL);
// Use binary search to locate the exact Record. It is the first
// Record whose uncompressed_sum is greater than target.
// This is because we want the rightmost Record that fullfills the
// search criterion. It is possible that there are empty Blocks;
--- 1200,1224 ----
}
extern LZMA_API(lzma_bool)
lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
{
! const lzma_index *i = (lzma_index *)iter->internal[ITER_INDEX].p;
// If the target is past the end of the file, return immediately.
if (i->uncompressed_size <= target)
return true;
// Locate the Stream containing the target offset.
! const index_stream *stream = (index_stream *)index_tree_locate(&i->streams, target);
assert(stream != NULL);
target -= stream->node.uncompressed_base;
// Locate the group containing the target offset.
! const index_group *group = (index_group *)index_tree_locate(&stream->groups, target);
assert(group != NULL);
// Use binary search to locate the exact Record. It is the first
// Record whose uncompressed_sum is greater than target.
// This is because we want the rightmost Record that fullfills the
// search criterion. It is possible that there are empty Blocks;
*** xz-5.2.0/src/liblzma/common/index_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/index_decoder.c Fri Jan 9 14:42:10 2015
***************
*** 11,33 ****
///////////////////////////////////////////////////////////////////////////////
#include "index.h"
#include "check.h"
struct lzma_coder_s {
! enum {
! SEQ_INDICATOR,
! SEQ_COUNT,
! SEQ_MEMUSAGE,
! SEQ_UNPADDED,
! SEQ_UNCOMPRESSED,
! SEQ_PADDING_INIT,
! SEQ_PADDING,
! SEQ_CRC32,
! } sequence;
/// Memory usage limit
uint64_t memlimit;
/// Target Index
lzma_index *index;
--- 11,34 ----
///////////////////////////////////////////////////////////////////////////////
#include "index.h"
#include "check.h"
+ enum lzma_coder_sequence_e {
+ SEQ_INDICATOR,
+ SEQ_COUNT,
+ SEQ_MEMUSAGE,
+ SEQ_UNPADDED,
+ SEQ_UNCOMPRESSED,
+ SEQ_PADDING_INIT,
+ SEQ_PADDING,
+ SEQ_CRC32,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// Memory usage limit
uint64_t memlimit;
/// Target Index
lzma_index *index;
*************** index_decoder_init(lzma_next_coder *next
*** 267,279 ****
lzma_next_coder_init(&index_decoder_init, next, allocator);
if (i == NULL || memlimit == 0)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &index_decode;
next->end = &index_decoder_end;
next->memconfig = &index_decoder_memconfig;
--- 268,280 ----
lzma_next_coder_init(&index_decoder_init, next, allocator);
if (i == NULL || memlimit == 0)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &index_decode;
next->end = &index_decoder_end;
next->memconfig = &index_decoder_memconfig;
*************** index_decoder_init(lzma_next_coder *next
*** 286,298 ****
}
extern LZMA_API(lzma_ret)
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
{
! lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 287,299 ----
}
extern LZMA_API(lzma_ret)
lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
{
! lzma_next_strm_init2(index_decoder_init, strm, i, memlimit);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/index_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/index_encoder.c Fri Jan 9 17:53:16 2015
***************
*** 12,33 ****
#include "index_encoder.h"
#include "index.h"
#include "check.h"
struct lzma_coder_s {
! enum {
! SEQ_INDICATOR,
! SEQ_COUNT,
! SEQ_UNPADDED,
! SEQ_UNCOMPRESSED,
! SEQ_NEXT,
! SEQ_PADDING,
! SEQ_CRC32,
! } sequence;
/// Index being encoded
const lzma_index *index;
/// Iterator for the Index being encoded
lzma_index_iter iter;
--- 12,34 ----
#include "index_encoder.h"
#include "index.h"
#include "check.h"
+ enum lzma_coder_sequence_e {
+ SEQ_INDICATOR,
+ SEQ_COUNT,
+ SEQ_UNPADDED,
+ SEQ_UNCOMPRESSED,
+ SEQ_NEXT,
+ SEQ_PADDING,
+ SEQ_CRC32,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// Index being encoded
const lzma_index *index;
/// Iterator for the Index being encoded
lzma_index_iter iter;
*************** index_encode(lzma_coder *coder,
*** 107,119 ****
goto out;
ret = LZMA_OK;
coder->pos = 0;
// Advance to SEQ_UNCOMPRESSED or SEQ_NEXT.
! ++coder->sequence;
break;
}
case SEQ_PADDING:
if (coder->pos > 0) {
--coder->pos;
--- 108,120 ----
goto out;
ret = LZMA_OK;
coder->pos = 0;
// Advance to SEQ_UNCOMPRESSED or SEQ_NEXT.
! coder->sequence = (enum lzma_coder_sequence_e)(coder->sequence + 1);
break;
}
case SEQ_PADDING:
if (coder->pos > 0) {
--coder->pos;
*************** lzma_index_encoder_init(lzma_next_coder
*** 187,199 ****
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
if (i == NULL)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &index_encode;
next->end = &index_encoder_end;
}
--- 188,200 ----
lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
if (i == NULL)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &index_encode;
next->end = &index_encoder_end;
}
*************** lzma_index_encoder_init(lzma_next_coder
*** 204,216 ****
}
extern LZMA_API(lzma_ret)
lzma_index_encoder(lzma_stream *strm, const lzma_index *i)
{
! lzma_next_strm_init(lzma_index_encoder_init, strm, i);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 205,217 ----
}
extern LZMA_API(lzma_ret)
lzma_index_encoder(lzma_stream *strm, const lzma_index *i)
{
! lzma_next_strm_init1(lzma_index_encoder_init, strm, i);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/index_hash.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/index_hash.c Fri Jan 9 15:23:25 2015
*************** typedef struct {
*** 31,52 ****
/// Check calculated from Unpadded Sizes and Uncompressed Sizes.
lzma_check_state check;
} lzma_index_hash_info;
struct lzma_index_hash_s {
! enum {
! SEQ_BLOCK,
! SEQ_COUNT,
! SEQ_UNPADDED,
! SEQ_UNCOMPRESSED,
! SEQ_PADDING_INIT,
! SEQ_PADDING,
! SEQ_CRC32,
! } sequence;
/// Information collected while decoding the actual Blocks.
lzma_index_hash_info blocks;
/// Information collected from the Index field.
lzma_index_hash_info records;
--- 31,53 ----
/// Check calculated from Unpadded Sizes and Uncompressed Sizes.
lzma_check_state check;
} lzma_index_hash_info;
+ enum lzma_index_hash_sequence_e {
+ SEQ_BLOCK,
+ SEQ_COUNT,
+ SEQ_UNPADDED,
+ SEQ_UNCOMPRESSED,
+ SEQ_PADDING_INIT,
+ SEQ_PADDING,
+ SEQ_CRC32,
+ };
struct lzma_index_hash_s {
! enum lzma_index_hash_sequence_e sequence;
/// Information collected while decoding the actual Blocks.
lzma_index_hash_info blocks;
/// Information collected from the Index field.
lzma_index_hash_info records;
*************** struct lzma_index_hash_s {
*** 71,83 ****
extern LZMA_API(lzma_index_hash *)
lzma_index_hash_init(lzma_index_hash *index_hash,
const lzma_allocator *allocator)
{
if (index_hash == NULL) {
! index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator);
if (index_hash == NULL)
return NULL;
}
index_hash->sequence = SEQ_BLOCK;
index_hash->blocks.blocks_size = 0;
--- 72,84 ----
extern LZMA_API(lzma_index_hash *)
lzma_index_hash_init(lzma_index_hash *index_hash,
const lzma_allocator *allocator)
{
if (index_hash == NULL) {
! index_hash = (lzma_index_hash *)lzma_alloc(sizeof(lzma_index_hash), allocator);
if (index_hash == NULL)
return NULL;
}
index_hash->sequence = SEQ_BLOCK;
index_hash->blocks.blocks_size = 0;
*** xz-5.2.0/src/liblzma/common/stream_buffer_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/stream_buffer_encoder.c Fri Jan 9 14:42:11 2015
*************** lzma_stream_buffer_encode(lzma_filter *f
*** 71,98 ****
// Reserve space for Stream Footer so we don't need to check for
// available space again before encoding Stream Footer.
out_size -= LZMA_STREAM_HEADER_SIZE;
// Encode the Stream Header.
! lzma_stream_flags stream_flags = {
! .version = 0,
! .check = check,
};
if (lzma_stream_header_encode(&stream_flags, out + out_pos)
!= LZMA_OK)
return LZMA_PROG_ERROR;
out_pos += LZMA_STREAM_HEADER_SIZE;
// Encode a Block but only if there is at least one byte of input.
! lzma_block block = {
! .version = 0,
! .check = check,
! .filters = filters,
};
if (in_size > 0)
return_if_error(lzma_block_buffer_encode(&block, allocator,
in, in_size, out, &out_pos, out_size));
--- 71,100 ----
// Reserve space for Stream Footer so we don't need to check for
// available space again before encoding Stream Footer.
out_size -= LZMA_STREAM_HEADER_SIZE;
// Encode the Stream Header.
! lzma_stream_flags stream_flags;
! {
! stream_flags.version = 0;
! stream_flags.check = check;
};
if (lzma_stream_header_encode(&stream_flags, out + out_pos)
!= LZMA_OK)
return LZMA_PROG_ERROR;
out_pos += LZMA_STREAM_HEADER_SIZE;
// Encode a Block but only if there is at least one byte of input.
! lzma_block block;
! {
! block.version = 0;
! block.check = check;
! block.filters = filters;
};
if (in_size > 0)
return_if_error(lzma_block_buffer_encode(&block, allocator,
in, in_size, out, &out_pos, out_size));
*** xz-5.2.0/src/liblzma/common/stream_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/stream_decoder.c Fri Jan 9 14:42:11 2015
***************
*** 11,31 ****
///////////////////////////////////////////////////////////////////////////////
#include "stream_decoder.h"
#include "block_decoder.h"
struct lzma_coder_s {
! enum {
! SEQ_STREAM_HEADER,
! SEQ_BLOCK_HEADER,
! SEQ_BLOCK,
! SEQ_INDEX,
! SEQ_STREAM_FOOTER,
! SEQ_STREAM_PADDING,
! } sequence;
/// Block or Metadata decoder. This takes little memory and the same
/// data structure can be used to decode every Block Header, so it's
/// a good idea to have a separate lzma_next_coder structure for it.
lzma_next_coder block_decoder;
--- 11,32 ----
///////////////////////////////////////////////////////////////////////////////
#include "stream_decoder.h"
#include "block_decoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_STREAM_HEADER,
+ SEQ_BLOCK_HEADER,
+ SEQ_BLOCK,
+ SEQ_INDEX,
+ SEQ_STREAM_FOOTER,
+ SEQ_STREAM_PADDING,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// Block or Metadata decoder. This takes little memory and the same
/// data structure can be used to decode every Block Header, so it's
/// a good idea to have a separate lzma_next_coder structure for it.
lzma_next_coder block_decoder;
*************** lzma_stream_decoder_init(
*** 420,432 ****
return LZMA_PROG_ERROR;
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &stream_decode;
next->end = &stream_decoder_end;
next->get_check = &stream_decoder_get_check;
--- 421,433 ----
return LZMA_PROG_ERROR;
if (flags & ~LZMA_SUPPORTED_FLAGS)
return LZMA_OPTIONS_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &stream_decode;
next->end = &stream_decoder_end;
next->get_check = &stream_decoder_get_check;
*************** lzma_stream_decoder_init(
*** 450,462 ****
}
extern LZMA_API(lzma_ret)
lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
! lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
--- 451,463 ----
}
extern LZMA_API(lzma_ret)
lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
{
! lzma_next_strm_init2(lzma_stream_decoder_init, strm, memlimit, flags);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/common/stream_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/stream_encoder.c Fri Jan 9 17:58:20 2015
***************
*** 11,31 ****
///////////////////////////////////////////////////////////////////////////////
#include "block_encoder.h"
#include "index_encoder.h"
struct lzma_coder_s {
! enum {
! SEQ_STREAM_HEADER,
! SEQ_BLOCK_INIT,
! SEQ_BLOCK_HEADER,
! SEQ_BLOCK_ENCODE,
! SEQ_INDEX_ENCODE,
! SEQ_STREAM_FOOTER,
! } sequence;
/// True if Block encoder has been initialized by
/// stream_encoder_init() or stream_encoder_update()
/// and thus doesn't need to be initialized in stream_encode().
bool block_encoder_is_initialized;
--- 11,32 ----
///////////////////////////////////////////////////////////////////////////////
#include "block_encoder.h"
#include "index_encoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_STREAM_HEADER,
+ SEQ_BLOCK_INIT,
+ SEQ_BLOCK_HEADER,
+ SEQ_BLOCK_ENCODE,
+ SEQ_INDEX_ENCODE,
+ SEQ_STREAM_FOOTER,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// True if Block encoder has been initialized by
/// stream_encoder_init() or stream_encoder_update()
/// and thus doesn't need to be initialized in stream_encode().
bool block_encoder_is_initialized;
*************** stream_encode(lzma_coder *coder, const l
*** 95,107 ****
return LZMA_OK;
if (coder->sequence == SEQ_STREAM_FOOTER)
return LZMA_STREAM_END;
coder->buffer_pos = 0;
! ++coder->sequence;
break;
case SEQ_BLOCK_INIT: {
if (*in_pos == in_size) {
// If we are requested to flush or finish the current
// Block, return LZMA_STREAM_END immediately since
--- 96,108 ----
return LZMA_OK;
if (coder->sequence == SEQ_STREAM_FOOTER)
return LZMA_STREAM_END;
coder->buffer_pos = 0;
! coder->sequence = (enum lzma_coder_sequence_e)(coder->sequence + 1);
break;
case SEQ_BLOCK_INIT: {
if (*in_pos == in_size) {
// If we are requested to flush or finish the current
// Block, return LZMA_STREAM_END immediately since
*************** stream_encode(lzma_coder *coder, const l
*** 182,196 ****
out, out_pos, out_size, LZMA_RUN);
if (ret != LZMA_STREAM_END)
return ret;
// Encode the Stream Footer into coder->buffer.
const lzma_stream_flags stream_flags = {
! .version = 0,
! .backward_size = lzma_index_size(coder->index),
! .check = coder->block_options.check,
};
if (lzma_stream_footer_encode(&stream_flags, coder->buffer)
!= LZMA_OK)
return LZMA_PROG_ERROR;
--- 183,197 ----
out, out_pos, out_size, LZMA_RUN);
if (ret != LZMA_STREAM_END)
return ret;
// Encode the Stream Footer into coder->buffer.
const lzma_stream_flags stream_flags = {
! /*.version =*/ 0,
! /*.backward_size =*/ lzma_index_size(coder->index),
! /*.check =*/ coder->block_options.check,
};
if (lzma_stream_footer_encode(&stream_flags, coder->buffer)
!= LZMA_OK)
return LZMA_PROG_ERROR;
*************** stream_encoder_init(lzma_next_coder *nex
*** 269,281 ****
lzma_next_coder_init(&stream_encoder_init, next, allocator);
if (filters == NULL)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &stream_encode;
next->end = &stream_encoder_end;
next->update = &stream_encoder_update;
--- 270,282 ----
lzma_next_coder_init(&stream_encoder_init, next, allocator);
if (filters == NULL)
return LZMA_PROG_ERROR;
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &stream_encode;
next->end = &stream_encoder_end;
next->update = &stream_encoder_update;
*************** stream_encoder_init(lzma_next_coder *nex
*** 295,309 ****
lzma_index_end(next->coder->index, allocator);
next->coder->index = lzma_index_init(allocator);
if (next->coder->index == NULL)
return LZMA_MEM_ERROR;
// Encode the Stream Header
! lzma_stream_flags stream_flags = {
! .version = 0,
! .check = check,
};
return_if_error(lzma_stream_header_encode(
&stream_flags, next->coder->buffer));
next->coder->buffer_pos = 0;
next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
--- 296,311 ----
lzma_index_end(next->coder->index, allocator);
next->coder->index = lzma_index_init(allocator);
if (next->coder->index == NULL)
return LZMA_MEM_ERROR;
// Encode the Stream Header
! lzma_stream_flags stream_flags;
! {
! stream_flags.version = 0,
! stream_flags.check = check;
};
return_if_error(lzma_stream_header_encode(
&stream_flags, next->coder->buffer));
next->coder->buffer_pos = 0;
next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
*************** stream_encoder_init(lzma_next_coder *nex
*** 317,329 ****
extern LZMA_API(lzma_ret)
lzma_stream_encoder(lzma_stream *strm,
const lzma_filter *filters, lzma_check check)
{
! lzma_next_strm_init(stream_encoder_init, strm, filters, check);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
--- 319,331 ----
extern LZMA_API(lzma_ret)
lzma_stream_encoder(lzma_stream *strm,
const lzma_filter *filters, lzma_check check)
{
! lzma_next_strm_init2(stream_encoder_init, strm, filters, check);
strm->internal->supported_actions[LZMA_RUN] = true;
strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
strm->internal->supported_actions[LZMA_FINISH] = true;
*** xz-5.2.0/src/liblzma/common/stream_flags_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/common/stream_flags_decoder.c Fri Jan 9 18:01:01 2015
*************** stream_flags_decode(lzma_stream_flags *o
*** 18,30 ****
{
// Reserved bits must be unset.
if (in[0] != 0x00 || (in[1] & 0xF0))
return true;
options->version = 0;
! options->check = in[1] & 0x0F;
return false;
}
extern LZMA_API(lzma_ret)
--- 18,30 ----
{
// Reserved bits must be unset.
if (in[0] != 0x00 || (in[1] & 0xF0))
return true;
options->version = 0;
! options->check = (enum lzma_check)(in[1] & 0x0F);
return false;
}
extern LZMA_API(lzma_ret)
*** xz-5.2.0/src/liblzma/delta/delta_common.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/delta/delta_common.c Fri Jan 9 14:42:12 2015
*************** delta_coder_end(lzma_coder *coder, const
*** 26,38 ****
extern lzma_ret
lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
// Allocate memory for the decoder if needed.
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
// End function is the same for encoder and decoder.
next->end = &delta_coder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
--- 26,38 ----
extern lzma_ret
lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
{
// Allocate memory for the decoder if needed.
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
// End function is the same for encoder and decoder.
next->end = &delta_coder_end;
next->coder->next = LZMA_NEXT_CODER_INIT;
*************** lzma_delta_coder_init(lzma_next_coder *n
*** 40,52 ****
// Validate the options.
if (lzma_delta_coder_memusage(filters[0].options) == UINT64_MAX)
return LZMA_OPTIONS_ERROR;
// Set the delta distance.
! const lzma_options_delta *opt = filters[0].options;
next->coder->distance = opt->dist;
// Initialize the rest of the variables.
next->coder->pos = 0;
memzero(next->coder->history, LZMA_DELTA_DIST_MAX);
--- 40,52 ----
// Validate the options.
if (lzma_delta_coder_memusage(filters[0].options) == UINT64_MAX)
return LZMA_OPTIONS_ERROR;
// Set the delta distance.
! const lzma_options_delta *opt = (lzma_options_delta *)filters[0].options;
next->coder->distance = opt->dist;
// Initialize the rest of the variables.
next->coder->pos = 0;
memzero(next->coder->history, LZMA_DELTA_DIST_MAX);
*************** lzma_delta_coder_init(lzma_next_coder *n
*** 56,68 ****
}
extern uint64_t
lzma_delta_coder_memusage(const void *options)
{
! const lzma_options_delta *opt = options;
if (opt == NULL || opt->type != LZMA_DELTA_TYPE_BYTE
|| opt->dist < LZMA_DELTA_DIST_MIN
|| opt->dist > LZMA_DELTA_DIST_MAX)
return UINT64_MAX;
--- 56,68 ----
}
extern uint64_t
lzma_delta_coder_memusage(const void *options)
{
! const lzma_options_delta *opt = (lzma_options_delta *)options;
if (opt == NULL || opt->type != LZMA_DELTA_TYPE_BYTE
|| opt->dist < LZMA_DELTA_DIST_MIN
|| opt->dist > LZMA_DELTA_DIST_MAX)
return UINT64_MAX;
*** xz-5.2.0/src/liblzma/delta/delta_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/delta/delta_decoder.c Fri Jan 9 14:42:12 2015
*************** lzma_delta_props_decode(void **options,
*** 60,72 ****
const uint8_t *props, size_t props_size)
{
if (props_size != 1)
return LZMA_OPTIONS_ERROR;
lzma_options_delta *opt
! = lzma_alloc(sizeof(lzma_options_delta), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
opt->type = LZMA_DELTA_TYPE_BYTE;
opt->dist = props[0] + 1;
--- 60,72 ----
const uint8_t *props, size_t props_size)
{
if (props_size != 1)
return LZMA_OPTIONS_ERROR;
lzma_options_delta *opt
! = (lzma_options_delta *)lzma_alloc(sizeof(lzma_options_delta), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
opt->type = LZMA_DELTA_TYPE_BYTE;
opt->dist = props[0] + 1;
*** xz-5.2.0/src/liblzma/delta/delta_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/delta/delta_encoder.c Fri Jan 9 14:42:12 2015
*************** lzma_delta_props_encode(const void *opti
*** 111,121 ****
{
// The caller must have already validated the options, so it's
// LZMA_PROG_ERROR if they are invalid.
if (lzma_delta_coder_memusage(options) == UINT64_MAX)
return LZMA_PROG_ERROR;
! const lzma_options_delta *opt = options;
out[0] = opt->dist - LZMA_DELTA_DIST_MIN;
return LZMA_OK;
}
--- 111,121 ----
{
// The caller must have already validated the options, so it's
// LZMA_PROG_ERROR if they are invalid.
if (lzma_delta_coder_memusage(options) == UINT64_MAX)
return LZMA_PROG_ERROR;
! const lzma_options_delta *opt = (lzma_options_delta *)options;
out[0] = opt->dist - LZMA_DELTA_DIST_MIN;
return LZMA_OK;
}
*** xz-5.2.0/src/liblzma/lz/lz_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lz/lz_decoder.c Fri Jan 9 16:13:05 2015
*************** lz_decoder_end(lzma_coder *coder, const
*** 196,217 ****
lzma_free(coder, allocator);
return;
}
extern lzma_ret
lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options))
{
// Allocate the base structure if it isn't already allocated.
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &lz_decode;
next->end = &lz_decoder_end;
--- 196,233 ----
lzma_free(coder, allocator);
return;
}
+ #if __GNUC__ >= 3
+ #else
+ extern inline lzma_lz_decoder
+ _lzma_lz_decoder_init_func(void)
+ {
+ static lzma_lz_decoder ret = {
+ /*.coder =*/ NULL,
+ /*.code =*/ NULL,
+ /*.reset =*/ NULL,
+ /*.set_uncompressed =*/ NULL,
+ /*.end =*/ NULL,
+ };
+ return ret;
+ }
+ #endif
+
extern lzma_ret
lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
const lzma_allocator *allocator, const void *options,
lzma_lz_options *lz_options))
{
// Allocate the base structure if it isn't already allocated.
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &lz_decode;
next->end = &lz_decoder_end;
*************** lzma_lz_decoder_init(lzma_next_coder *ne
*** 248,260 ****
lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15));
// Allocate and initialize the dictionary.
if (next->coder->dict.size != lz_options.dict_size) {
lzma_free(next->coder->dict.buf, allocator);
next->coder->dict.buf
! = lzma_alloc(lz_options.dict_size, allocator);
if (next->coder->dict.buf == NULL)
return LZMA_MEM_ERROR;
next->coder->dict.size = lz_options.dict_size;
}
--- 264,276 ----
lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15));
// Allocate and initialize the dictionary.
if (next->coder->dict.size != lz_options.dict_size) {
lzma_free(next->coder->dict.buf, allocator);
next->coder->dict.buf
! = (uint8_t *)lzma_alloc(lz_options.dict_size, allocator);
if (next->coder->dict.buf == NULL)
return LZMA_MEM_ERROR;
next->coder->dict.size = lz_options.dict_size;
}
*** xz-5.2.0/src/liblzma/lz/lz_decoder.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lz/lz_decoder.h Fri Jan 9 16:11:05 2015
*************** typedef struct {
*** 69,88 ****
--- 69,94 ----
/// Free allocated resources
void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
} lzma_lz_decoder;
+ #if __GNUC__ >= 3
#define LZMA_LZ_DECODER_INIT \
(lzma_lz_decoder){ \
.coder = NULL, \
.code = NULL, \
.reset = NULL, \
.set_uncompressed = NULL, \
.end = NULL, \
}
+ #else
+ #define LZMA_LZ_DECODER_INIT \
+ _lzma_lz_decoder_init_func()
+ extern inline lzma_lz_decoder _lzma_lz_decoder_init_func(void);
+ #endif
extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
const lzma_allocator *allocator,
const lzma_filter_info *filters,
lzma_ret (*lz_init)(lzma_lz_decoder *lz,
*** xz-5.2.0/src/liblzma/lz/lz_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lz/lz_encoder.c Fri Jan 9 16:49:47 2015
*************** lz_encoder_init(lzma_mf *mf, const lzma_
*** 365,377 ****
{
// Allocate the history buffer.
if (mf->buffer == NULL) {
// lzma_memcmplen() is used for the dictionary buffer
// so we need to allocate a few extra bytes to prevent
// it from reading past the end of the buffer.
! mf->buffer = lzma_alloc(mf->size + LZMA_MEMCMPLEN_EXTRA,
allocator);
if (mf->buffer == NULL)
return true;
// Keep Valgrind happy with lzma_memcmplen() and initialize
// the extra bytes whose value may get read but which will
--- 365,377 ----
{
// Allocate the history buffer.
if (mf->buffer == NULL) {
// lzma_memcmplen() is used for the dictionary buffer
// so we need to allocate a few extra bytes to prevent
// it from reading past the end of the buffer.
! mf->buffer = (uint8_t *)lzma_alloc(mf->size + LZMA_MEMCMPLEN_EXTRA,
allocator);
if (mf->buffer == NULL)
return true;
// Keep Valgrind happy with lzma_memcmplen() and initialize
// the extra bytes whose value may get read but which will
*************** lz_encoder_init(lzma_mf *mf, const lzma_
*** 406,420 ****
// lz_encoder_mf.c). Skipping the initialization is *very* good
// when big dictionary is used but only small amount of data gets
// actually compressed: most of the mf->son won't get actually
// allocated by the kernel, so we avoid wasting RAM and improve
// initialization speed a lot.
if (mf->hash == NULL) {
! mf->hash = lzma_alloc_zero(mf->hash_count * sizeof(uint32_t),
allocator);
! mf->son = lzma_alloc(mf->sons_count * sizeof(uint32_t),
allocator);
if (mf->hash == NULL || mf->son == NULL) {
lzma_free(mf->hash, allocator);
mf->hash = NULL;
--- 406,420 ----
// lz_encoder_mf.c). Skipping the initialization is *very* good
// when big dictionary is used but only small amount of data gets
// actually compressed: most of the mf->son won't get actually
// allocated by the kernel, so we avoid wasting RAM and improve
// initialization speed a lot.
if (mf->hash == NULL) {
! mf->hash = (uint32_t *)lzma_alloc_zero(mf->hash_count * sizeof(uint32_t),
allocator);
! mf->son = (uint32_t *)lzma_alloc(mf->sons_count * sizeof(uint32_t),
allocator);
if (mf->hash == NULL || mf->son == NULL) {
lzma_free(mf->hash, allocator);
mf->hash = NULL;
*************** lz_encoder_init(lzma_mf *mf, const lzma_
*** 453,470 ****
extern uint64_t
lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
{
// Old buffers must not exist when calling lz_encoder_prepare().
! lzma_mf mf = {
! .buffer = NULL,
! .hash = NULL,
! .son = NULL,
! .hash_count = 0,
! .sons_count = 0,
};
// Setup the size information into mf.
if (lz_encoder_prepare(&mf, NULL, lz_options))
return UINT64_MAX;
--- 453,471 ----
extern uint64_t
lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
{
// Old buffers must not exist when calling lz_encoder_prepare().
! lzma_mf mf;
! {
! mf.buffer = NULL,
! mf.hash = NULL,
! mf.son = NULL,
! mf.hash_count = 0,
! mf.sons_count = 0;
};
// Setup the size information into mf.
if (lz_encoder_prepare(&mf, NULL, lz_options))
return UINT64_MAX;
*************** lzma_lz_encoder_init(lzma_next_coder *ne
*** 520,532 ****
// We need that the CRC32 table has been initialized.
lzma_crc32_init();
#endif
// Allocate and initialize the base data structure.
if (next->coder == NULL) {
! next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &lz_encode;
next->end = &lz_encoder_end;
next->update = &lz_encoder_update;
--- 521,533 ----
// We need that the CRC32 table has been initialized.
lzma_crc32_init();
#endif
// Allocate and initialize the base data structure.
if (next->coder == NULL) {
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &lz_encode;
next->end = &lz_encoder_end;
next->update = &lz_encoder_update;
*** xz-5.2.0/src/liblzma/lzma/lzma2_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lzma/lzma2_decoder.c Fri Jan 9 15:28:37 2015
***************
*** 13,38 ****
#include "lzma2_decoder.h"
#include "lz_decoder.h"
#include "lzma_decoder.h"
struct lzma_coder_s {
! enum sequence {
! SEQ_CONTROL,
! SEQ_UNCOMPRESSED_1,
! SEQ_UNCOMPRESSED_2,
! SEQ_COMPRESSED_0,
! SEQ_COMPRESSED_1,
! SEQ_PROPERTIES,
! SEQ_LZMA,
! SEQ_COPY,
! } sequence;
/// Sequence after the size fields have been decoded.
! enum sequence next_sequence;
/// LZMA decoder
lzma_lz_decoder lzma;
/// Uncompressed size of LZMA chunk
size_t uncompressed_size;
--- 13,39 ----
#include "lzma2_decoder.h"
#include "lz_decoder.h"
#include "lzma_decoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_CONTROL,
+ SEQ_UNCOMPRESSED_1,
+ SEQ_UNCOMPRESSED_2,
+ SEQ_COMPRESSED_0,
+ SEQ_COMPRESSED_1,
+ SEQ_PROPERTIES,
+ SEQ_LZMA,
+ SEQ_COPY,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// Sequence after the size fields have been decoded.
! enum lzma_coder_sequence_e next_sequence;
/// LZMA decoder
lzma_lz_decoder lzma;
/// Uncompressed size of LZMA chunk
size_t uncompressed_size;
*************** lzma2_decoder_end(lzma_coder *coder, con
*** 222,244 ****
static lzma_ret
lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
if (lz->coder == NULL) {
! lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma2_decode;
lz->end = &lzma2_decoder_end;
lz->coder->lzma = LZMA_LZ_DECODER_INIT;
}
! const lzma_options_lzma *options = opt;
lz->coder->sequence = SEQ_CONTROL;
lz->coder->need_properties = true;
lz->coder->need_dictionary_reset = options->preset_dict == NULL
|| options->preset_dict_size == 0;
--- 223,245 ----
static lzma_ret
lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
if (lz->coder == NULL) {
! lz->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma2_decode;
lz->end = &lzma2_decoder_end;
lz->coder->lzma = LZMA_LZ_DECODER_INIT;
}
! const lzma_options_lzma *options = (lzma_options_lzma *)opt;
lz->coder->sequence = SEQ_CONTROL;
lz->coder->need_properties = true;
lz->coder->need_dictionary_reset = options->preset_dict == NULL
|| options->preset_dict_size == 0;
*************** lzma_lzma2_props_decode(void **options,
*** 280,292 ****
return LZMA_OPTIONS_ERROR;
// Decode the dictionary size.
if (props[0] > 40)
return LZMA_OPTIONS_ERROR;
! lzma_options_lzma *opt = lzma_alloc(
sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
if (props[0] == 40) {
opt->dict_size = UINT32_MAX;
--- 281,293 ----
return LZMA_OPTIONS_ERROR;
// Decode the dictionary size.
if (props[0] > 40)
return LZMA_OPTIONS_ERROR;
! lzma_options_lzma *opt = (lzma_options_lzma *)lzma_alloc(
sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
if (props[0] == 40) {
opt->dict_size = UINT32_MAX;
*** xz-5.2.0/src/liblzma/lzma/lzma2_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lzma/lzma2_encoder.c Fri Jan 9 17:06:31 2015
***************
*** 14,33 ****
#include "lz_encoder.h"
#include "lzma_encoder.h"
#include "fastpos.h"
#include "lzma2_encoder.h"
struct lzma_coder_s {
! enum {
! SEQ_INIT,
! SEQ_LZMA_ENCODE,
! SEQ_LZMA_COPY,
! SEQ_UNCOMPRESSED_HEADER,
! SEQ_UNCOMPRESSED_COPY,
! } sequence;
/// LZMA encoder
lzma_coder *lzma;
/// LZMA options currently in use.
lzma_options_lzma opt_cur;
--- 14,34 ----
#include "lz_encoder.h"
#include "lzma_encoder.h"
#include "fastpos.h"
#include "lzma2_encoder.h"
+ enum lzma_coder_sequence_e {
+ SEQ_INIT,
+ SEQ_LZMA_ENCODE,
+ SEQ_LZMA_COPY,
+ SEQ_UNCOMPRESSED_HEADER,
+ SEQ_UNCOMPRESSED_COPY,
+ };
struct lzma_coder_s {
! enum lzma_coder_sequence_e sequence;
/// LZMA encoder
lzma_coder *lzma;
/// LZMA options currently in use.
lzma_options_lzma opt_cur;
*************** lzma2_encoder_options_update(lzma_coder
*** 278,290 ****
// after LZMA_SYNC_FLUSH.
if (filter->options == NULL || coder->sequence != SEQ_INIT)
return LZMA_PROG_ERROR;
// Look if there are new options. At least for now,
// only lc/lp/pb can be changed.
! const lzma_options_lzma *opt = filter->options;
if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp
|| coder->opt_cur.pb != opt->pb) {
// Validate the options.
if (opt->lc > LZMA_LCLP_MAX || opt->lp > LZMA_LCLP_MAX
|| opt->lc + opt->lp > LZMA_LCLP_MAX
|| opt->pb > LZMA_PB_MAX)
--- 279,291 ----
// after LZMA_SYNC_FLUSH.
if (filter->options == NULL || coder->sequence != SEQ_INIT)
return LZMA_PROG_ERROR;
// Look if there are new options. At least for now,
// only lc/lp/pb can be changed.
! const lzma_options_lzma *opt = (lzma_options_lzma *)filter->options;
if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp
|| coder->opt_cur.pb != opt->pb) {
// Validate the options.
if (opt->lc > LZMA_LCLP_MAX || opt->lp > LZMA_LCLP_MAX
|| opt->lc + opt->lp > LZMA_LCLP_MAX
|| opt->pb > LZMA_PB_MAX)
*************** lzma2_encoder_init(lzma_lz_encoder *lz,
*** 308,320 ****
const void *options, lzma_lz_options *lz_options)
{
if (options == NULL)
return LZMA_PROG_ERROR;
if (lz->coder == NULL) {
! lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma2_encode;
lz->end = &lzma2_encoder_end;
lz->options_update = &lzma2_encoder_options_update;
--- 309,321 ----
const void *options, lzma_lz_options *lz_options)
{
if (options == NULL)
return LZMA_PROG_ERROR;
if (lz->coder == NULL) {
! lz->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma2_encode;
lz->end = &lzma2_encoder_end;
lz->options_update = &lzma2_encoder_options_update;
*************** lzma_lzma2_encoder_memusage(const void *
*** 368,380 ****
}
extern lzma_ret
lzma_lzma2_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_lzma *const opt = options;
uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN);
// Round up to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending
// on which one is the next:
--d;
d |= d >> 2;
--- 369,381 ----
}
extern lzma_ret
lzma_lzma2_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_lzma *const opt = (lzma_options_lzma *)options;
uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN);
// Round up to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending
// on which one is the next:
--d;
d |= d >> 2;
*************** lzma_lzma2_props_encode(const void *opti
*** 393,403 ****
}
extern uint64_t
lzma_lzma2_block_size(const void *options)
{
! const lzma_options_lzma *const opt = options;
// Use at least 1 MiB to keep compression ratio better.
return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20);
}
--- 394,404 ----
}
extern uint64_t
lzma_lzma2_block_size(const void *options)
{
! const lzma_options_lzma *const opt = (lzma_options_lzma *)options;
// Use at least 1 MiB to keep compression ratio better.
return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20);
}
*** xz-5.2.0/src/liblzma/lzma/lzma_common.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lzma/lzma_common.h Fri Jan 9 18:13:29 2015
*************** typedef enum {
*** 75,87 ****
/// The lowest 7 states indicate that the previous state was a literal.
#define LIT_STATES 7
/// Indicate that the latest state was a literal.
#define update_literal(state) \
! state = ((state) <= STATE_SHORTREP_LIT_LIT \
? STATE_LIT_LIT \
: ((state) <= STATE_LIT_SHORTREP \
? (state) - 3 \
: (state) - 6))
/// Indicate that the latest state was a match.
--- 75,87 ----
/// The lowest 7 states indicate that the previous state was a literal.
#define LIT_STATES 7
/// Indicate that the latest state was a literal.
#define update_literal(state) \
! state = (enum lzma_lzma_state)((state) <= STATE_SHORTREP_LIT_LIT \
? STATE_LIT_LIT \
: ((state) <= STATE_LIT_SHORTREP \
? (state) - 3 \
: (state) - 6))
/// Indicate that the latest state was a match.
*** xz-5.2.0/src/liblzma/lzma/lzma_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lzma/lzma_decoder.c Fri Jan 9 18:16:33 2015
*************** typedef struct {
*** 158,169 ****
--- 158,190 ----
probability low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
probability mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
probability high[LEN_HIGH_SYMBOLS];
} lzma_length_decoder;
+ enum lzma_coder_sequence_e {
+ SEQ_NORMALIZE,
+ SEQ_IS_MATCH,
+ seq_8(SEQ_LITERAL),
+ seq_8(SEQ_LITERAL_MATCHED),
+ SEQ_LITERAL_WRITE,
+ SEQ_IS_REP,
+ seq_len(SEQ_MATCH_LEN),
+ seq_6(SEQ_DIST_SLOT),
+ SEQ_DIST_MODEL,
+ SEQ_DIRECT,
+ seq_4(SEQ_ALIGN),
+ SEQ_EOPM,
+ SEQ_IS_REP0,
+ SEQ_SHORTREP,
+ SEQ_IS_REP0_LONG,
+ SEQ_IS_REP1,
+ SEQ_IS_REP2,
+ seq_len(SEQ_REP_LEN),
+ SEQ_COPY,
+ };
struct lzma_coder_s {
///////////////////
// Probabilities //
///////////////////
/// Literals; see comments in lzma_common.h.
*************** struct lzma_coder_s {
*** 234,266 ****
////////////////////////////////
// State of incomplete symbol //
////////////////////////////////
/// Position where to continue the decoder loop
! enum {
! SEQ_NORMALIZE,
! SEQ_IS_MATCH,
! seq_8(SEQ_LITERAL),
! seq_8(SEQ_LITERAL_MATCHED),
! SEQ_LITERAL_WRITE,
! SEQ_IS_REP,
! seq_len(SEQ_MATCH_LEN),
! seq_6(SEQ_DIST_SLOT),
! SEQ_DIST_MODEL,
! SEQ_DIRECT,
! seq_4(SEQ_ALIGN),
! SEQ_EOPM,
! SEQ_IS_REP0,
! SEQ_SHORTREP,
! SEQ_IS_REP0_LONG,
! SEQ_IS_REP1,
! SEQ_IS_REP2,
! seq_len(SEQ_REP_LEN),
! SEQ_COPY,
! } sequence;
/// Base of the current probability tree
probability *probs;
/// Symbol being decoded. This is also used as an index variable in
/// bittree decoders: probs[symbol]
--- 255,267 ----
////////////////////////////////
// State of incomplete symbol //
////////////////////////////////
/// Position where to continue the decoder loop
! enum lzma_coder_sequence_e sequence;
/// Base of the current probability tree
probability *probs;
/// Symbol being decoded. This is also used as an index variable in
/// bittree decoders: probs[symbol]
*************** lzma_decode(lzma_coder *restrict coder,
*** 454,465 ****
--- 455,467 ----
}
//update_literal(state);
// Use a lookup table to update to literal state,
// since compared to other state updates, this would
// need two branches.
+ {
static const lzma_lzma_state next_state[] = {
STATE_LIT_LIT,
STATE_LIT_LIT,
STATE_LIT_LIT,
STATE_LIT_LIT,
STATE_MATCH_LIT_LIT,
*************** lzma_decode(lzma_coder *restrict coder,
*** 469,480 ****
--- 471,483 ----
STATE_REP_LIT,
STATE_SHORTREP_LIT,
STATE_MATCH_LIT,
STATE_REP_LIT
};
state = next_state[state];
+ }
case SEQ_LITERAL_WRITE:
if (unlikely(dict_put(&dict, symbol))) {
coder->sequence = SEQ_LITERAL_WRITE;
goto out;
}
*************** out:
*** 794,806 ****
// NOTE: Must not copy dict.limit.
dictptr->pos = dict.pos;
dictptr->full = dict.full;
rc_from_local(coder->rc, *in_pos);
! coder->state = state;
coder->rep0 = rep0;
coder->rep1 = rep1;
coder->rep2 = rep2;
coder->rep3 = rep3;
coder->probs = probs;
--- 797,809 ----
// NOTE: Must not copy dict.limit.
dictptr->pos = dict.pos;
dictptr->full = dict.full;
rc_from_local(coder->rc, *in_pos);
! coder->state = (enum lzma_lzma_state)state;
coder->rep0 = rep0;
coder->rep1 = rep1;
coder->rep2 = rep2;
coder->rep3 = rep3;
coder->probs = probs;
*************** lzma_lzma_decoder_uncompressed(void *cod
*** 854,866 ****
}
*/
static void
lzma_decoder_reset(lzma_coder *coder, const void *opt)
{
! const lzma_options_lzma *options = opt;
// NOTE: We assume that lc/lp/pb are valid since they were
// successfully decoded with lzma_lzma_decode_properties().
// Calculate pos_mask. We don't need pos_bits as is for anything.
coder->pos_mask = (1U << options->pb) - 1;
--- 857,869 ----
}
*/
static void
lzma_decoder_reset(lzma_coder *coder, const void *opt)
{
! const lzma_options_lzma *options = (lzma_options_lzma *)opt;
// NOTE: We assume that lc/lp/pb are valid since they were
// successfully decoded with lzma_lzma_decode_properties().
// Calculate pos_mask. We don't need pos_bits as is for anything.
coder->pos_mask = (1U << options->pb) - 1;
*************** lzma_decoder_reset(lzma_coder *coder, co
*** 938,961 ****
extern lzma_ret
lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
if (lz->coder == NULL) {
! lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma_decode;
lz->reset = &lzma_decoder_reset;
lz->set_uncompressed = &lzma_decoder_uncompressed;
}
// All dictionary sizes are OK here. LZ decoder will take care of
// the special cases.
! const lzma_options_lzma *options = opt;
lz_options->dict_size = options->dict_size;
lz_options->preset_dict = options->preset_dict;
lz_options->preset_dict_size = options->preset_dict_size;
return LZMA_OK;
}
--- 941,964 ----
extern lzma_ret
lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *opt, lzma_lz_options *lz_options)
{
if (lz->coder == NULL) {
! lz->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (lz->coder == NULL)
return LZMA_MEM_ERROR;
lz->code = &lzma_decode;
lz->reset = &lzma_decoder_reset;
lz->set_uncompressed = &lzma_decoder_uncompressed;
}
// All dictionary sizes are OK here. LZ decoder will take care of
// the special cases.
! const lzma_options_lzma *options = (lzma_options_lzma *)opt;
lz_options->dict_size = options->dict_size;
lz_options->preset_dict = options->preset_dict;
lz_options->preset_dict_size = options->preset_dict_size;
return LZMA_OK;
}
*************** lzma_lzma_decoder_create(lzma_lz_decoder
*** 965,977 ****
/// initialization (lzma_lzma_decoder_init() passes function pointer to
/// the LZ initialization).
static lzma_ret
lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
! if (!is_lclppb_valid(options))
return LZMA_PROG_ERROR;
return_if_error(lzma_lzma_decoder_create(
lz, allocator, options, lz_options));
lzma_decoder_reset(lz->coder, options);
--- 968,980 ----
/// initialization (lzma_lzma_decoder_init() passes function pointer to
/// the LZ initialization).
static lzma_ret
lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
! if (!is_lclppb_valid((lzma_options_lzma *)options))
return LZMA_PROG_ERROR;
return_if_error(lzma_lzma_decoder_create(
lz, allocator, options, lz_options));
lzma_decoder_reset(lz->coder, options);
*************** lzma_lzma_lclppb_decode(lzma_options_lzm
*** 1010,1030 ****
}
extern uint64_t
lzma_lzma_decoder_memusage_nocheck(const void *options)
{
! const lzma_options_lzma *const opt = options;
return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
}
extern uint64_t
lzma_lzma_decoder_memusage(const void *options)
{
! if (!is_lclppb_valid(options))
return UINT64_MAX;
return lzma_lzma_decoder_memusage_nocheck(options);
}
--- 1013,1033 ----
}
extern uint64_t
lzma_lzma_decoder_memusage_nocheck(const void *options)
{
! const lzma_options_lzma *const opt = (lzma_options_lzma *)options;
return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
}
extern uint64_t
lzma_lzma_decoder_memusage(const void *options)
{
! if (!is_lclppb_valid((lzma_options_lzma *)options))
return UINT64_MAX;
return lzma_lzma_decoder_memusage_nocheck(options);
}
*************** lzma_lzma_props_decode(void **options, c
*** 1033,1045 ****
const uint8_t *props, size_t props_size)
{
if (props_size != 5)
return LZMA_OPTIONS_ERROR;
lzma_options_lzma *opt
! = lzma_alloc(sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
if (lzma_lzma_lclppb_decode(opt, props[0]))
goto error;
--- 1036,1048 ----
const uint8_t *props, size_t props_size)
{
if (props_size != 5)
return LZMA_OPTIONS_ERROR;
lzma_options_lzma *opt
! = (lzma_options_lzma *)lzma_alloc(sizeof(lzma_options_lzma), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
if (lzma_lzma_lclppb_decode(opt, props[0]))
goto error;
*** xz-5.2.0/src/liblzma/lzma/lzma_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/lzma/lzma_encoder.c Fri Jan 9 18:13:52 2015
*************** extern lzma_ret
*** 548,560 ****
lzma_lzma_encoder_create(lzma_coder **coder_ptr,
const lzma_allocator *allocator,
const lzma_options_lzma *options, lzma_lz_options *lz_options)
{
// Allocate lzma_coder if it wasn't already allocated.
if (*coder_ptr == NULL) {
! *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator);
if (*coder_ptr == NULL)
return LZMA_MEM_ERROR;
}
lzma_coder *coder = *coder_ptr;
--- 548,560 ----
lzma_lzma_encoder_create(lzma_coder **coder_ptr,
const lzma_allocator *allocator,
const lzma_options_lzma *options, lzma_lz_options *lz_options)
{
// Allocate lzma_coder if it wasn't already allocated.
if (*coder_ptr == NULL) {
! *coder_ptr = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator);
if (*coder_ptr == NULL)
return LZMA_MEM_ERROR;
}
lzma_coder *coder = *coder_ptr;
*************** lzma_lzma_encoder_create(lzma_coder **co
*** 607,619 ****
static lzma_ret
lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
lz->code = &lzma_encode;
return lzma_lzma_encoder_create(
! &lz->coder, allocator, options, lz_options);
}
extern lzma_ret
lzma_lzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
--- 607,619 ----
static lzma_ret
lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
const void *options, lzma_lz_options *lz_options)
{
lz->code = &lzma_encode;
return lzma_lzma_encoder_create(
! (lzma_coder **)&lz->coder, allocator, (lzma_options_lzma *)options, lz_options);
}
extern lzma_ret
lzma_lzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_filter_info *filters)
*************** lzma_lzma_encoder_init(lzma_next_coder *
*** 623,639 ****
}
extern uint64_t
lzma_lzma_encoder_memusage(const void *options)
{
! if (!is_options_valid(options))
return UINT64_MAX;
lzma_lz_options lz_options;
! set_lz_options(&lz_options, options);
const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options);
if (lz_memusage == UINT64_MAX)
return UINT64_MAX;
return (uint64_t)(sizeof(lzma_coder)) + lz_memusage;
--- 623,639 ----
}
extern uint64_t
lzma_lzma_encoder_memusage(const void *options)
{
! if (!is_options_valid((lzma_options_lzma *)options))
return UINT64_MAX;
lzma_lz_options lz_options;
! set_lz_options(&lz_options, (lzma_options_lzma *)options);
const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options);
if (lz_memusage == UINT64_MAX)
return UINT64_MAX;
return (uint64_t)(sizeof(lzma_coder)) + lz_memusage;
*************** lzma_lzma_lclppb_encode(const lzma_optio
*** 654,666 ****
#ifdef HAVE_ENCODER_LZMA1
extern lzma_ret
lzma_lzma_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_lzma *const opt = options;
if (lzma_lzma_lclppb_encode(opt, out))
return LZMA_PROG_ERROR;
unaligned_write32le(out + 1, opt->dict_size);
--- 654,666 ----
#ifdef HAVE_ENCODER_LZMA1
extern lzma_ret
lzma_lzma_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_lzma *const opt = (lzma_options_lzma *)options;
if (lzma_lzma_lclppb_encode(opt, out))
return LZMA_PROG_ERROR;
unaligned_write32le(out + 1, opt->dict_size);
*** xz-5.2.0/src/liblzma/rangecoder/range_encoder.h.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/rangecoder/range_encoder.h Fri Jan 9 18:25:49 2015
***************
*** 21,32 ****
--- 21,39 ----
/// Maximum number of symbols that can be put pending into lzma_range_encoder
/// structure between calls to lzma_rc_encode(). For LZMA, 52+5 is enough
/// (match with big distance and length followed by range encoder flush).
#define RC_SYMBOLS_MAX 58
+ enum lzma_range_encoder_symbols_e {
+ RC_BIT_0,
+ RC_BIT_1,
+ RC_DIRECT_0,
+ RC_DIRECT_1,
+ RC_FLUSH,
+ };
typedef struct {
uint64_t low;
uint64_t cache_size;
uint32_t range;
uint8_t cache;
*************** typedef struct {
*** 34,52 ****
size_t count;
/// rc_encode()'s position in the tables
size_t pos;
/// Symbols to encode
! enum {
! RC_BIT_0,
! RC_BIT_1,
! RC_DIRECT_0,
! RC_DIRECT_1,
! RC_FLUSH,
! } symbols[RC_SYMBOLS_MAX];
/// Probabilities associated with RC_BIT_0 or RC_BIT_1
probability *probs[RC_SYMBOLS_MAX];
} lzma_range_encoder;
--- 41,53 ----
size_t count;
/// rc_encode()'s position in the tables
size_t pos;
/// Symbols to encode
! lzma_range_encoder_symbols_e symbols[RC_SYMBOLS_MAX];
/// Probabilities associated with RC_BIT_0 or RC_BIT_1
probability *probs[RC_SYMBOLS_MAX];
} lzma_range_encoder;
*************** rc_reset(lzma_range_encoder *rc)
*** 63,75 ****
}
static inline void
rc_bit(lzma_range_encoder *rc, probability *prob, uint32_t bit)
{
! rc->symbols[rc->count] = bit;
rc->probs[rc->count] = prob;
++rc->count;
}
static inline void
--- 64,76 ----
}
static inline void
rc_bit(lzma_range_encoder *rc, probability *prob, uint32_t bit)
{
! rc->symbols[rc->count] = (enum lzma_range_encoder_symbols_e)bit;
rc->probs[rc->count] = prob;
++rc->count;
}
static inline void
*************** rc_bittree_reverse(lzma_range_encoder *r
*** 104,116 ****
static inline void
rc_direct(lzma_range_encoder *rc,
uint32_t value, uint32_t bit_count)
{
do {
rc->symbols[rc->count++]
! = RC_DIRECT_0 + ((value >> --bit_count) & 1);
} while (bit_count != 0);
}
static inline void
rc_flush(lzma_range_encoder *rc)
--- 105,117 ----
static inline void
rc_direct(lzma_range_encoder *rc,
uint32_t value, uint32_t bit_count)
{
do {
rc->symbols[rc->count++]
! = (enum lzma_range_encoder_symbols_e)(RC_DIRECT_0 + ((value >> --bit_count) & 1));
} while (bit_count != 0);
}
static inline void
rc_flush(lzma_range_encoder *rc)
*** xz-5.2.0/src/liblzma/simple/simple_coder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/simple/simple_coder.c Fri Jan 9 14:42:16 2015
*************** lzma_simple_coder_init(lzma_next_coder *
*** 229,241 ****
// Allocate memory for the lzma_coder structure if needed.
if (next->coder == NULL) {
// Here we allocate space also for the temporary buffer. We
// need twice the size of unfiltered_max, because then it
// is always possible to filter at least unfiltered_max bytes
// more data in coder->buffer[] if it can be filled completely.
! next->coder = lzma_alloc(sizeof(lzma_coder)
+ 2 * unfiltered_max, allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &simple_code;
next->end = &simple_coder_end;
--- 229,241 ----
// Allocate memory for the lzma_coder structure if needed.
if (next->coder == NULL) {
// Here we allocate space also for the temporary buffer. We
// need twice the size of unfiltered_max, because then it
// is always possible to filter at least unfiltered_max bytes
// more data in coder->buffer[] if it can be filled completely.
! next->coder = (lzma_coder *)lzma_alloc(sizeof(lzma_coder)
+ 2 * unfiltered_max, allocator);
if (next->coder == NULL)
return LZMA_MEM_ERROR;
next->code = &simple_code;
next->end = &simple_coder_end;
*************** lzma_simple_coder_init(lzma_next_coder *
*** 244,266 ****
next->coder->next = LZMA_NEXT_CODER_INIT;
next->coder->filter = filter;
next->coder->allocated = 2 * unfiltered_max;
// Allocate memory for filter-specific data structure.
if (simple_size > 0) {
! next->coder->simple = lzma_alloc(
simple_size, allocator);
if (next->coder->simple == NULL)
return LZMA_MEM_ERROR;
} else {
next->coder->simple = NULL;
}
}
if (filters[0].options != NULL) {
! const lzma_options_bcj *simple = filters[0].options;
next->coder->now_pos = simple->start_offset;
if (next->coder->now_pos & (alignment - 1))
return LZMA_OPTIONS_ERROR;
} else {
next->coder->now_pos = 0;
}
--- 244,266 ----
next->coder->next = LZMA_NEXT_CODER_INIT;
next->coder->filter = filter;
next->coder->allocated = 2 * unfiltered_max;
// Allocate memory for filter-specific data structure.
if (simple_size > 0) {
! next->coder->simple = (lzma_simple *)lzma_alloc(
simple_size, allocator);
if (next->coder->simple == NULL)
return LZMA_MEM_ERROR;
} else {
next->coder->simple = NULL;
}
}
if (filters[0].options != NULL) {
! const lzma_options_bcj *simple = (lzma_options_bcj *)filters[0].options;
next->coder->now_pos = simple->start_offset;
if (next->coder->now_pos & (alignment - 1))
return LZMA_OPTIONS_ERROR;
} else {
next->coder->now_pos = 0;
}
*** xz-5.2.0/src/liblzma/simple/simple_decoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/simple/simple_decoder.c Fri Jan 9 14:42:16 2015
*************** lzma_simple_props_decode(void **options,
*** 20,32 ****
if (props_size == 0)
return LZMA_OK;
if (props_size != 4)
return LZMA_OPTIONS_ERROR;
! lzma_options_bcj *opt = lzma_alloc(
sizeof(lzma_options_bcj), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
opt->start_offset = unaligned_read32le(props);
--- 20,32 ----
if (props_size == 0)
return LZMA_OK;
if (props_size != 4)
return LZMA_OPTIONS_ERROR;
! lzma_options_bcj *opt = (lzma_options_bcj *)lzma_alloc(
sizeof(lzma_options_bcj), allocator);
if (opt == NULL)
return LZMA_MEM_ERROR;
opt->start_offset = unaligned_read32le(props);
*** xz-5.2.0/src/liblzma/simple/simple_encoder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/liblzma/simple/simple_encoder.c Fri Jan 9 14:42:16 2015
***************
*** 13,34 ****
#include "simple_encoder.h"
extern lzma_ret
lzma_simple_props_size(uint32_t *size, const void *options)
{
! const lzma_options_bcj *const opt = options;
*size = (opt == NULL || opt->start_offset == 0) ? 0 : 4;
return LZMA_OK;
}
extern lzma_ret
lzma_simple_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_bcj *const opt = options;
// The default start offset is zero, so we don't need to store any
// options unless the start offset is non-zero.
if (opt == NULL || opt->start_offset == 0)
return LZMA_OK;
--- 13,34 ----
#include "simple_encoder.h"
extern lzma_ret
lzma_simple_props_size(uint32_t *size, const void *options)
{
! const lzma_options_bcj *const opt = (lzma_options_bcj *)options;
*size = (opt == NULL || opt->start_offset == 0) ? 0 : 4;
return LZMA_OK;
}
extern lzma_ret
lzma_simple_props_encode(const void *options, uint8_t *out)
{
! const lzma_options_bcj *const opt = (lzma_options_bcj *)options;
// The default start offset is zero, so we don't need to store any
// options unless the start offset is non-zero.
if (opt == NULL || opt->start_offset == 0)
return LZMA_OK;
*** xz-5.2.0/src/lzmainfo/Makefile.in.dist Mon Dec 22 03:50:07 2014
--- xz-5.2.0/src/lzmainfo/Makefile.in Fri Jan 9 15:31:55 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 146,158 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 146,158 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/src/lzmainfo/lzmainfo.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/lzmainfo/lzmainfo.c Fri Jan 9 14:42:17 2015
*************** lzmainfo(const char *name, FILE *f)
*** 106,118 ****
fprintf(stderr, "%s: %s: %s\n", progname, name,
ferror(f) ? strerror(errno)
: _("File is too small to be a .lzma file"));
return true;
}
! lzma_filter filter = { .id = LZMA_FILTER_LZMA1 };
// Parse the first five bytes.
switch (lzma_properties_decode(&filter, NULL, buf, 5)) {
case LZMA_OK:
break;
--- 106,118 ----
fprintf(stderr, "%s: %s: %s\n", progname, name,
ferror(f) ? strerror(errno)
: _("File is too small to be a .lzma file"));
return true;
}
! lzma_filter filter = { /*.id =*/ LZMA_FILTER_LZMA1 };
// Parse the first five bytes.
switch (lzma_properties_decode(&filter, NULL, buf, 5)) {
case LZMA_OK:
break;
*************** lzmainfo(const char *name, FILE *f)
*** 149,161 ****
else
printf("%" PRIu64 " MB (%" PRIu64 " bytes)",
(uncompressed_size + 512 * 1024)
/ (1024 * 1024),
uncompressed_size);
! lzma_options_lzma *opt = filter.options;
printf("\nDictionary size: "
"%" PRIu32 " MB (2^%" PRIu32 " bytes)\n"
"Literal context bits (lc): %" PRIu32 "\n"
"Literal pos bits (lp): %" PRIu32 "\n"
"Number of pos bits (pb): %" PRIu32 "\n",
--- 149,161 ----
else
printf("%" PRIu64 " MB (%" PRIu64 " bytes)",
(uncompressed_size + 512 * 1024)
/ (1024 * 1024),
uncompressed_size);
! lzma_options_lzma *opt = (lzma_options_lzma *)filter.options;
printf("\nDictionary size: "
"%" PRIu32 " MB (2^%" PRIu32 " bytes)\n"
"Literal context bits (lc): %" PRIu32 "\n"
"Literal pos bits (lp): %" PRIu32 "\n"
"Number of pos bits (pb): %" PRIu32 "\n",
*** xz-5.2.0/src/xz/Makefile.in.dist Mon Dec 22 03:50:07 2014
--- xz-5.2.0/src/xz/Makefile.in Fri Jan 9 15:32:27 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 157,169 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 157,169 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/src/xz/args.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/args.c Fri Jan 9 17:08:57 2015
*************** parse_block_list(char *str)
*** 73,85 ****
message_fatal(_("%s: Too many arguments to --block-list"),
str);
// Allocate memory to hold all the sizes specified.
// If --block-list was specified already, its value is forgotten.
free(opt_block_list);
! opt_block_list = xmalloc((count + 1) * sizeof(uint64_t));
for (size_t i = 0; i < count; ++i) {
// Locate the next comma and replace it with \0.
char *p = strchr(str, ',');
if (p != NULL)
*p = '\0';
--- 73,85 ----
message_fatal(_("%s: Too many arguments to --block-list"),
str);
// Allocate memory to hold all the sizes specified.
// If --block-list was specified already, its value is forgotten.
free(opt_block_list);
! opt_block_list = (uint64_t *)xmalloc((count + 1) * sizeof(uint64_t));
for (size_t i = 0; i < count; ++i) {
// Locate the next comma and replace it with \0.
char *p = strchr(str, ',');
if (p != NULL)
*p = '\0';
*************** parse_environment(args_info *args, char
*** 543,555 ****
"arguments"), varname);
}
}
// Allocate memory to hold pointers to the arguments. Add one to get
// space for the terminating NULL (if some systems happen to need it).
! char **argv = xmalloc(((size_t)(argc) + 1) * sizeof(char *));
argv[0] = argv0;
argv[argc] = NULL;
// Go through the string again. Split the arguments using '\0'
// characters and add pointers to the resulting strings to argv.
argc = 1;
--- 543,555 ----
"arguments"), varname);
}
}
// Allocate memory to hold pointers to the arguments. Add one to get
// space for the terminating NULL (if some systems happen to need it).
! char **argv = (char**)xmalloc(((size_t)(argc) + 1) * sizeof(char *));
argv[0] = argv0;
argv[argc] = NULL;
// Go through the string again. Split the arguments using '\0'
// characters and add pointers to the resulting strings to argv.
argc = 1;
*** xz-5.2.0/src/xz/coder.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/coder.c Fri Jan 9 15:34:02 2015
*************** coder_set_compression_settings(void)
*** 310,322 ****
++i;
}
// Decrease the dictionary size until we meet the memory
// usage limit. First round down to full mebibytes.
! lzma_options_lzma *opt = filters[i].options;
const uint32_t orig_dict_size = opt->dict_size;
opt->dict_size &= ~((UINT32_C(1) << 20) - 1);
while (true) {
// If it is below 1 MiB, auto-adjusting failed. We could be
// more sophisticated and scale it down even more, but let's
// see if many complain about this version.
--- 310,322 ----
++i;
}
// Decrease the dictionary size until we meet the memory
// usage limit. First round down to full mebibytes.
! lzma_options_lzma *opt = (lzma_options_lzma *)filters[i].options;
const uint32_t orig_dict_size = opt->dict_size;
opt->dict_size &= ~((UINT32_C(1) << 20) - 1);
while (true) {
// If it is below 1 MiB, auto-adjusting failed. We could be
// more sophisticated and scale it down even more, but let's
// see if many complain about this version.
*************** is_format_lzma(void)
*** 371,391 ****
{
// The .lzma header is 13 bytes.
if (strm.avail_in < 13)
return false;
// Decode the LZMA1 properties.
! lzma_filter filter = { .id = LZMA_FILTER_LZMA1 };
if (lzma_properties_decode(&filter, NULL, in_buf.u8, 5) != LZMA_OK)
return false;
// A hack to ditch tons of false positives: We allow only dictionary
// sizes that are 2^n or 2^n + 2^(n-1) or UINT32_MAX. LZMA_Alone
// created only files with 2^n, but accepts any dictionary size.
// If someone complains, this will be reconsidered.
! lzma_options_lzma *opt = filter.options;
const uint32_t dict_size = opt->dict_size;
free(opt);
if (dict_size != UINT32_MAX) {
uint32_t d = dict_size - 1;
d |= d >> 2;
--- 371,391 ----
{
// The .lzma header is 13 bytes.
if (strm.avail_in < 13)
return false;
// Decode the LZMA1 properties.
! lzma_filter filter = { /*.id =*/ LZMA_FILTER_LZMA1, NULL };
if (lzma_properties_decode(&filter, NULL, in_buf.u8, 5) != LZMA_OK)
return false;
// A hack to ditch tons of false positives: We allow only dictionary
// sizes that are 2^n or 2^n + 2^(n-1) or UINT32_MAX. LZMA_Alone
// created only files with 2^n, but accepts any dictionary size.
// If someone complains, this will be reconsidered.
! lzma_options_lzma *opt = (lzma_options_lzma *)filter.options;
const uint32_t dict_size = opt->dict_size;
free(opt);
if (dict_size != UINT32_MAX) {
uint32_t d = dict_size - 1;
d |= d >> 2;
*************** coder_init(file_pair *pair)
*** 439,451 ****
#endif
ret = lzma_stream_encoder(
&strm, filters, check);
break;
case FORMAT_LZMA:
! ret = lzma_alone_encoder(&strm, filters[0].options);
break;
case FORMAT_RAW:
ret = lzma_raw_encoder(&strm, filters);
break;
}
--- 439,451 ----
#endif
ret = lzma_stream_encoder(
&strm, filters, check);
break;
case FORMAT_LZMA:
! ret = lzma_alone_encoder(&strm, (lzma_options_lzma *)filters[0].options);
break;
case FORMAT_RAW:
ret = lzma_raw_encoder(&strm, filters);
break;
}
*** xz-5.2.0/src/xz/file_io.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/file_io.c Fri Jan 9 14:42:18 2015
*************** io_open_src(const char *src_name)
*** 628,646 ****
// Since we have only one file open at a time, we can use
// a statically allocated structure.
static file_pair pair;
pair = (file_pair){
! .src_name = src_name,
! .dest_name = NULL,
! .src_fd = -1,
! .dest_fd = -1,
! .src_eof = false,
! .dest_try_sparse = false,
! .dest_pending_sparse = 0,
};
// Block the signals, for which we have a custom signal handler, so
// that we don't need to worry about EINTR.
signals_block();
const bool error = io_open_src_real(&pair);
--- 628,648 ----
// Since we have only one file open at a time, we can use
// a statically allocated structure.
static file_pair pair;
pair = (file_pair){
! /*.src_name =*/ src_name,
! /*.dest_name =*/ NULL,
! /*.src_fd =*/ -1,
! /*.dest_fd =*/ -1,
! /*.src_eof =*/ false,
! /*.dest_try_sparse =*/ false,
! /*.dest_pending_sparse =*/ 0,
! /*struct stat src_st;*/
! /*struct stat dest_st;*/
};
// Block the signals, for which we have a custom signal handler, so
// that we don't need to worry about EINTR.
signals_block();
const bool error = io_open_src_real(&pair);
*** xz-5.2.0/src/xz/main.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/main.c Fri Jan 9 14:42:19 2015
*************** read_name(const args_info *args)
*** 68,80 ****
// Allocate the initial buffer. This is never freed, since after it
// is no longer needed, the program exits very soon. It is safe to
// use xmalloc() and xrealloc() in this function, because while
// executing this function, no files are open for writing, and thus
// there's no need to cleanup anything before exiting.
if (name == NULL)
! name = xmalloc(size);
// Write position in name
size_t pos = 0;
// Read one character at a time into name.
while (!user_abort) {
--- 68,80 ----
// Allocate the initial buffer. This is never freed, since after it
// is no longer needed, the program exits very soon. It is safe to
// use xmalloc() and xrealloc() in this function, because while
// executing this function, no files are open for writing, and thus
// there's no need to cleanup anything before exiting.
if (name == NULL)
! name = (char *)xmalloc(size);
// Write position in name
size_t pos = 0;
// Read one character at a time into name.
while (!user_abort) {
*************** read_name(const args_info *args)
*** 128,140 ****
// Allocate more memory if needed. There must always be space
// at least for one character to allow terminating the string
// with '\0'.
if (pos == size) {
size *= 2;
! name = xrealloc(name, size);
}
}
return NULL;
}
--- 128,140 ----
// Allocate more memory if needed. There must always be space
// at least for one character to allow terminating the string
// with '\0'.
if (pos == size) {
size *= 2;
! name = (char *)xrealloc(name, size);
}
}
return NULL;
}
*** xz-5.2.0/src/xz/message.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/message.c Fri Jan 9 18:30:58 2015
*************** message_init(void)
*** 153,175 ****
extern void
message_verbosity_increase(void)
{
if (verbosity < V_DEBUG)
! ++verbosity;
return;
}
extern void
message_verbosity_decrease(void)
{
if (verbosity > V_SILENT)
! --verbosity;
return;
}
extern enum message_verbosity
--- 153,175 ----
extern void
message_verbosity_increase(void)
{
if (verbosity < V_DEBUG)
! verbosity = (enum message_verbosity)(verbosity + 1);
return;
}
extern void
message_verbosity_decrease(void)
{
if (verbosity > V_SILENT)
! verbosity = (enum message_verbosity)(verbosity - 1);
return;
}
extern enum message_verbosity
*************** message_filters_to_str(char buf[FILTERS_
*** 910,922 ****
// needed after the first and later filters.
my_snprintf(&pos, &left, "%s", i == 0 ? "--" : " --");
switch (filters[i].id) {
case LZMA_FILTER_LZMA1:
case LZMA_FILTER_LZMA2: {
! const lzma_options_lzma *opt = filters[i].options;
const char *mode = NULL;
const char *mf = NULL;
if (all_known) {
switch (opt->mode) {
case LZMA_MODE_FAST:
--- 910,922 ----
// needed after the first and later filters.
my_snprintf(&pos, &left, "%s", i == 0 ? "--" : " --");
switch (filters[i].id) {
case LZMA_FILTER_LZMA1:
case LZMA_FILTER_LZMA2: {
! const lzma_options_lzma *opt = (lzma_options_lzma *)filters[i].options;
const char *mode = NULL;
const char *mf = NULL;
if (all_known) {
switch (opt->mode) {
case LZMA_MODE_FAST:
*************** message_filters_to_str(char buf[FILTERS_
*** 997,1022 ****
"ia64",
"arm",
"armthumb",
"sparc",
};
! const lzma_options_bcj *opt = filters[i].options;
my_snprintf(&pos, &left, "%s", bcj_names[filters[i].id
- LZMA_FILTER_X86]);
// Show the start offset only when really needed.
if (opt != NULL && opt->start_offset != 0)
my_snprintf(&pos, &left, "=start=%" PRIu32,
opt->start_offset);
break;
}
case LZMA_FILTER_DELTA: {
! const lzma_options_delta *opt = filters[i].options;
my_snprintf(&pos, &left, "delta=dist=%" PRIu32,
opt->dist);
break;
}
default:
--- 997,1022 ----
"ia64",
"arm",
"armthumb",
"sparc",
};
! const lzma_options_bcj *opt = (lzma_options_bcj *)filters[i].options;
my_snprintf(&pos, &left, "%s", bcj_names[filters[i].id
- LZMA_FILTER_X86]);
// Show the start offset only when really needed.
if (opt != NULL && opt->start_offset != 0)
my_snprintf(&pos, &left, "=start=%" PRIu32,
opt->start_offset);
break;
}
case LZMA_FILTER_DELTA: {
! const lzma_options_delta *opt = (lzma_options_delta *)filters[i].options;
my_snprintf(&pos, &left, "delta=dist=%" PRIu32,
opt->dist);
break;
}
default:
*** xz-5.2.0/src/xz/options.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/options.c Fri Jan 9 14:42:19 2015
*************** enum {
*** 149,161 ****
static void
set_delta(void *options, uint32_t key, uint64_t value,
const char *valuestr lzma_attribute((__unused__)))
{
! lzma_options_delta *opt = options;
switch (key) {
case OPT_DIST:
opt->dist = value;
break;
}
}
--- 149,161 ----
static void
set_delta(void *options, uint32_t key, uint64_t value,
const char *valuestr lzma_attribute((__unused__)))
{
! lzma_options_delta *opt = (lzma_options_delta *)options;
switch (key) {
case OPT_DIST:
opt->dist = value;
break;
}
}
*************** options_delta(const char *str)
*** 167,183 ****
static const option_map opts[] = {
{ "dist", NULL, LZMA_DELTA_DIST_MIN,
LZMA_DELTA_DIST_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_delta *options = xmalloc(sizeof(lzma_options_delta));
*options = (lzma_options_delta){
// It's hard to give a useful default for this.
! .type = LZMA_DELTA_TYPE_BYTE,
! .dist = LZMA_DELTA_DIST_MIN,
};
parse_options(str, opts, &set_delta, options);
return options;
}
--- 167,183 ----
static const option_map opts[] = {
{ "dist", NULL, LZMA_DELTA_DIST_MIN,
LZMA_DELTA_DIST_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_delta *options = (lzma_options_delta *)xmalloc(sizeof(lzma_options_delta));
*options = (lzma_options_delta){
// It's hard to give a useful default for this.
! /*.type =*/ LZMA_DELTA_TYPE_BYTE,
! /*.dist =*/ LZMA_DELTA_DIST_MIN,
};
parse_options(str, opts, &set_delta, options);
return options;
}
*************** enum {
*** 193,205 ****
static void
set_bcj(void *options, uint32_t key, uint64_t value,
const char *valuestr lzma_attribute((__unused__)))
{
! lzma_options_bcj *opt = options;
switch (key) {
case OPT_START_OFFSET:
opt->start_offset = value;
break;
}
}
--- 193,205 ----
static void
set_bcj(void *options, uint32_t key, uint64_t value,
const char *valuestr lzma_attribute((__unused__)))
{
! lzma_options_bcj *opt = (lzma_options_bcj *)options;
switch (key) {
case OPT_START_OFFSET:
opt->start_offset = value;
break;
}
}
*************** options_bcj(const char *str)
*** 210,224 ****
{
static const option_map opts[] = {
{ "start", NULL, 0, UINT32_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_bcj *options = xmalloc(sizeof(lzma_options_bcj));
*options = (lzma_options_bcj){
! .start_offset = 0,
};
parse_options(str, opts, &set_bcj, options);
return options;
}
--- 210,224 ----
{
static const option_map opts[] = {
{ "start", NULL, 0, UINT32_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_bcj *options = (lzma_options_bcj *)xmalloc(sizeof(lzma_options_bcj));
*options = (lzma_options_bcj){
! /*.start_offset =*/ 0,
};
parse_options(str, opts, &set_bcj, options);
return options;
}
*************** error_lzma_preset(const char *valuestr)
*** 248,260 ****
}
static void
set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr)
{
! lzma_options_lzma *opt = options;
switch (key) {
case OPT_PRESET: {
if (valuestr[0] < '0' || valuestr[0] > '9')
error_lzma_preset(valuestr);
--- 248,260 ----
}
static void
set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr)
{
! lzma_options_lzma *opt = (lzma_options_lzma *)options;
switch (key) {
case OPT_PRESET: {
if (valuestr[0] < '0' || valuestr[0] > '9')
error_lzma_preset(valuestr);
*************** set_lzma(void *options, uint32_t key, ui
*** 269,281 ****
error_lzma_preset(valuestr);
if (valuestr[2] != '\0')
error_lzma_preset(valuestr);
}
! if (lzma_lzma_preset(options, preset))
error_lzma_preset(valuestr);
break;
}
case OPT_DICT:
--- 269,281 ----
error_lzma_preset(valuestr);
if (valuestr[2] != '\0')
error_lzma_preset(valuestr);
}
! if (lzma_lzma_preset((lzma_options_lzma *)options, preset))
error_lzma_preset(valuestr);
break;
}
case OPT_DICT:
*************** set_lzma(void *options, uint32_t key, ui
*** 292,312 ****
case OPT_PB:
opt->pb = value;
break;
case OPT_MODE:
! opt->mode = value;
break;
case OPT_NICE:
opt->nice_len = value;
break;
case OPT_MF:
! opt->mf = value;
break;
case OPT_DEPTH:
opt->depth = value;
break;
}
--- 292,312 ----
case OPT_PB:
opt->pb = value;
break;
case OPT_MODE:
! opt->mode = (enum lzma_mode)value;
break;
case OPT_NICE:
opt->nice_len = value;
break;
case OPT_MF:
! opt->mf = (enum lzma_match_finder)value;
break;
case OPT_DEPTH:
opt->depth = value;
break;
}
*************** options_lzma(const char *str)
*** 342,354 ****
{ "nice", NULL, 2, 273 },
{ "mf", mfs, 0, 0 },
{ "depth", NULL, 0, UINT32_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_lzma *options = xmalloc(sizeof(lzma_options_lzma));
if (lzma_lzma_preset(options, LZMA_PRESET_DEFAULT))
message_bug();
parse_options(str, opts, &set_lzma, options);
if (options->lc + options->lp > LZMA_LCLP_MAX)
--- 342,354 ----
{ "nice", NULL, 2, 273 },
{ "mf", mfs, 0, 0 },
{ "depth", NULL, 0, UINT32_MAX },
{ NULL, NULL, 0, 0 }
};
! lzma_options_lzma *options = (lzma_options_lzma *)xmalloc(sizeof(lzma_options_lzma));
if (lzma_lzma_preset(options, LZMA_PRESET_DEFAULT))
message_bug();
parse_options(str, opts, &set_lzma, options);
if (options->lc + options->lp > LZMA_LCLP_MAX)
*** xz-5.2.0/src/xz/suffix.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/suffix.c Fri Jan 9 15:34:37 2015
*************** uncompressed_name(const char *src_name,
*** 164,176 ****
message_warning(_("%s: Filename has an unknown suffix, "
"skipping"), src_name);
return NULL;
}
const size_t new_suffix_len = strlen(new_suffix);
! char *dest_name = xmalloc(new_len + new_suffix_len + 1);
memcpy(dest_name, src_name, new_len);
memcpy(dest_name + new_len, new_suffix, new_suffix_len);
dest_name[new_len + new_suffix_len] = '\0';
return dest_name;
--- 164,176 ----
message_warning(_("%s: Filename has an unknown suffix, "
"skipping"), src_name);
return NULL;
}
const size_t new_suffix_len = strlen(new_suffix);
! char *dest_name = (char *)xmalloc(new_len + new_suffix_len + 1);
memcpy(dest_name, src_name, new_len);
memcpy(dest_name + new_len, new_suffix, new_suffix_len);
dest_name[new_len + new_suffix_len] = '\0';
return dest_name;
*************** compressed_name(const char *src_name, si
*** 356,368 ****
+ 4 - suffix_len;
}
}
}
#endif
! char *dest_name = xmalloc(src_len + suffix_len + 1);
memcpy(dest_name, src_name, src_len);
memcpy(dest_name + src_len, suffix, suffix_len);
dest_name[src_len + suffix_len] = '\0';
return dest_name;
--- 356,368 ----
+ 4 - suffix_len;
}
}
}
#endif
! char *dest_name = (char *)xmalloc(src_len + suffix_len + 1);
memcpy(dest_name, src_name, src_len);
memcpy(dest_name + src_len, suffix, suffix_len);
dest_name[src_len + suffix_len] = '\0';
return dest_name;
*** xz-5.2.0/src/xz/util.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/src/xz/util.c Fri Jan 9 18:38:39 2015
*************** xrealloc(void *ptr, size_t size)
*** 46,59 ****
extern char *
xstrdup(const char *src)
{
assert(src != NULL);
const size_t size = strlen(src) + 1;
! char *dest = xmalloc(size);
! return memcpy(dest, src, size);
}
extern uint64_t
str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max)
{
--- 46,59 ----
extern char *
xstrdup(const char *src)
{
assert(src != NULL);
const size_t size = strlen(src) + 1;
! char *dest = (char *)xmalloc(size);
! return (char *)memcpy(dest, src, size);
}
extern uint64_t
str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max)
{
*************** uint64_to_nicestr(uint64_t value, enum n
*** 199,211 ****
// Scale the value to a nicer unit. Unless unit_min and
// unit_max limit us, we will show at most five significant
// digits with one decimal place.
double d = (double)(value);
do {
d /= 1024.0;
! ++unit;
} while (unit < unit_min || (d > 9999.9 && unit < unit_max));
if (thousand == WORKS)
my_snprintf(&pos, &left, "%'.1f", d);
else
my_snprintf(&pos, &left, "%.1f", d);
--- 199,211 ----
// Scale the value to a nicer unit. Unless unit_min and
// unit_max limit us, we will show at most five significant
// digits with one decimal place.
double d = (double)(value);
do {
d /= 1024.0;
! unit = (enum nicestr_unit)(unit + 1);
} while (unit < unit_min || (d > 9999.9 && unit < unit_max));
if (thousand == WORKS)
my_snprintf(&pos, &left, "%'.1f", d);
else
my_snprintf(&pos, &left, "%.1f", d);
*** xz-5.2.0/src/xzdec/Makefile.in.dist Mon Dec 22 03:50:07 2014
--- xz-5.2.0/src/xzdec/Makefile.in Fri Jan 9 15:34:56 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 164,176 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 164,176 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/tests/Makefile.in.dist Mon Dec 22 03:50:07 2014
--- xz-5.2.0/tests/Makefile.in Fri Jan 9 15:35:10 2015
*************** LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=
*** 181,193 ****
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
--- 181,193 ----
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
! CCLD = @CCLD@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
*** xz-5.2.0/tests/test_bcj_exact_size.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_bcj_exact_size.c Fri Jan 9 17:13:21 2015
***************
*** 13,25 ****
///////////////////////////////////////////////////////////////////////////////
#include "tests.h"
/// Something to be compressed
! static const uint8_t in[16] = "0123456789ABCDEF";
/// in[] after compression
static uint8_t compressed[1024];
static size_t compressed_size = 0;
/// Output buffer for decompressing compressed[]
--- 13,26 ----
///////////////////////////////////////////////////////////////////////////////
#include "tests.h"
/// Something to be compressed
! static const uint8_t in[16] = //"0123456789ABCDEF";
! { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
/// in[] after compression
static uint8_t compressed[1024];
static size_t compressed_size = 0;
/// Output buffer for decompressing compressed[]
*************** compress(void)
*** 32,48 ****
// Compress with PowerPC BCJ and LZMA2. PowerPC BCJ is used because
// it has fixed 4-byte alignment which makes triggering the potential
// bug easy.
lzma_options_lzma opt_lzma2;
succeed(lzma_lzma_preset(&opt_lzma2, 0));
! lzma_filter filters[3] = {
! { .id = LZMA_FILTER_POWERPC, .options = NULL },
! { .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
! { .id = LZMA_VLI_UNKNOWN, .options = NULL },
! };
expect(lzma_stream_buffer_encode(filters, LZMA_CHECK_CRC32, NULL,
in, sizeof(in),
compressed, &compressed_size, sizeof(compressed))
== LZMA_OK);
}
--- 33,48 ----
// Compress with PowerPC BCJ and LZMA2. PowerPC BCJ is used because
// it has fixed 4-byte alignment which makes triggering the potential
// bug easy.
lzma_options_lzma opt_lzma2;
succeed(lzma_lzma_preset(&opt_lzma2, 0));
! lzma_filter filters[3];
! filters[0].id = LZMA_FILTER_POWERPC, filters[0].options = NULL;
! filters[1].id = LZMA_FILTER_LZMA2, filters[1].options = &opt_lzma2;
! filters[2].id = LZMA_VLI_UNKNOWN, filters[2].options = NULL;
expect(lzma_stream_buffer_encode(filters, LZMA_CHECK_CRC32, NULL,
in, sizeof(in),
compressed, &compressed_size, sizeof(compressed))
== LZMA_OK);
}
*** xz-5.2.0/tests/test_block_header.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_block_header.c Fri Jan 9 18:47:56 2015
*************** static lzma_block known_options;
*** 18,81 ****
static lzma_block decoded_options;
static lzma_options_lzma opt_lzma;
static lzma_filter filters_none[1] = {
{
! .id = LZMA_VLI_UNKNOWN,
},
};
static lzma_filter filters_one[2] = {
{
! .id = LZMA_FILTER_LZMA2,
! .options = &opt_lzma,
}, {
! .id = LZMA_VLI_UNKNOWN,
}
};
static lzma_filter filters_four[5] = {
{
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_LZMA2,
! .options = &opt_lzma,
}, {
! .id = LZMA_VLI_UNKNOWN,
}
};
static lzma_filter filters_five[6] = {
{
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_X86,
! .options = NULL,
}, {
! .id = LZMA_FILTER_LZMA2,
! .options = &opt_lzma,
}, {
! .id = LZMA_VLI_UNKNOWN,
}
};
static void
code(void)
--- 18,81 ----
static lzma_block decoded_options;
static lzma_options_lzma opt_lzma;
static lzma_filter filters_none[1] = {
{
! /*.id =*/ LZMA_VLI_UNKNOWN,
},
};
static lzma_filter filters_one[2] = {
{
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.options =*/ &opt_lzma,
}, {
! /*.id =*/ LZMA_VLI_UNKNOWN,
}
};
static lzma_filter filters_four[5] = {
{
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.options =*/ &opt_lzma,
}, {
! /*.id =*/ LZMA_VLI_UNKNOWN,
}
};
static lzma_filter filters_five[6] = {
{
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_X86,
! /*.options =*/ NULL,
}, {
! /*.id =*/ LZMA_FILTER_LZMA2,
! /*.options =*/ &opt_lzma,
}, {
! /*.id =*/ LZMA_VLI_UNKNOWN,
}
};
static void
code(void)
*************** code(void)
*** 106,136 ****
}
static void
test1(void)
{
! known_options = (lzma_block){
! .check = LZMA_CHECK_NONE,
! .compressed_size = LZMA_VLI_UNKNOWN,
! .uncompressed_size = LZMA_VLI_UNKNOWN,
! .filters = NULL,
! };
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_none;
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_five;
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_one;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
! known_options.check = 999; // Some invalid value, which gets ignored.
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.compressed_size = 5;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.compressed_size = 0; // Cannot be zero.
--- 106,134 ----
}
static void
test1(void)
{
! known_options.check = LZMA_CHECK_NONE,
! known_options.compressed_size = LZMA_VLI_UNKNOWN,
! known_options.uncompressed_size = LZMA_VLI_UNKNOWN,
! known_options.filters = NULL;
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_none;
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_five;
expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
known_options.filters = filters_one;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
! known_options.check = (enum lzma_check)999; // Some invalid value, which gets ignored.
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.compressed_size = 5;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.compressed_size = 0; // Cannot be zero.
*************** test1(void)
*** 151,168 ****
}
static void
test2(void)
{
! known_options = (lzma_block){
! .check = LZMA_CHECK_CRC32,
! .compressed_size = LZMA_VLI_UNKNOWN,
! .uncompressed_size = LZMA_VLI_UNKNOWN,
! .filters = filters_four,
! };
expect(lzma_block_header_size(&known_options) == LZMA_OK);
code();
known_options.compressed_size = 123456;
known_options.uncompressed_size = 234567;
--- 149,164 ----
}
static void
test2(void)
{
! known_options.check = LZMA_CHECK_CRC32,
! known_options.compressed_size = LZMA_VLI_UNKNOWN,
! known_options.uncompressed_size = LZMA_VLI_UNKNOWN,
! known_options.filters = filters_four;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
code();
known_options.compressed_size = 123456;
known_options.uncompressed_size = 234567;
*************** test2(void)
*** 177,194 ****
}
static void
test3(void)
{
! known_options = (lzma_block){
! .check = LZMA_CHECK_CRC32,
! .compressed_size = LZMA_VLI_UNKNOWN,
! .uncompressed_size = LZMA_VLI_UNKNOWN,
! .filters = filters_one,
! };
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.header_size += 4;
expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
lzma_filter filters[LZMA_FILTERS_MAX + 1];
--- 173,188 ----
}
static void
test3(void)
{
! known_options.check = LZMA_CHECK_CRC32,
! known_options.compressed_size = LZMA_VLI_UNKNOWN,
! known_options.uncompressed_size = LZMA_VLI_UNKNOWN,
! known_options.filters = filters_one;
expect(lzma_block_header_size(&known_options) == LZMA_OK);
known_options.header_size += 4;
expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
lzma_filter filters[LZMA_FILTERS_MAX + 1];
*** xz-5.2.0/tests/test_check.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_check.c Fri Jan 9 14:42:22 2015
***************
*** 12,25 ****
//
///////////////////////////////////////////////////////////////////////////////
#include "tests.h"
! static const uint8_t test_string[9] = "123456789";
! static const uint8_t test_unaligned[12] = "xxx123456789";
static bool
test_crc32(void)
{
static const uint32_t test_vector = 0xCBF43926;
--- 12,29 ----
//
///////////////////////////////////////////////////////////////////////////////
#include "tests.h"
! static const uint8_t test_string[9] = //"123456789";
! { '1', '2', '3', '4', '5', '6', '7', '8', '9', };
!
! static const uint8_t test_unaligned[12] = //"xxx123456789";
! { 'x', 'x', 'x', '1', '2', '3', '4', '5', '6', '7', '8', '9', };
!
static bool
test_crc32(void)
{
static const uint32_t test_vector = 0xCBF43926;
*************** test_crc32(void)
*** 45,57 ****
}
static bool
test_crc64(void)
{
! static const uint64_t test_vector = 0x995DC9BBDF1939FA;
// Test 1
uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0);
if (crc != test_vector)
return true;
--- 49,61 ----
}
static bool
test_crc64(void)
{
! static const uint64_t test_vector = 0x995DC9BBDF1939FAULL;
// Test 1
uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0);
if (crc != test_vector)
return true;
*** xz-5.2.0/tests/test_filter_flags.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_filter_flags.c Fri Jan 9 14:42:22 2015
*************** test_bcj(void)
*** 95,107 ****
options.start_offset = 123456;
known_flags.options = &options;
expect(!encode(6));
expect(!decode(6));
expect(decoded_flags.options != NULL);
! lzma_options_bcj *decoded = decoded_flags.options;
expect(decoded->start_offset == options.start_offset);
free(decoded);
}
#endif
--- 95,107 ----
options.start_offset = 123456;
known_flags.options = &options;
expect(!encode(6));
expect(!decode(6));
expect(decoded_flags.options != NULL);
! lzma_options_bcj *decoded = (lzma_options_bcj *)decoded_flags.options;
expect(decoded->start_offset == options.start_offset);
free(decoded);
}
#endif
*************** test_delta(void)
*** 114,127 ****
known_flags.id = LZMA_FILTER_DELTA;
known_flags.options = NULL;
expect(encode(99));
// Test 2
lzma_options_delta options = {
! .type = LZMA_DELTA_TYPE_BYTE,
! .dist = 0
};
known_flags.options = &options;
expect(encode(99));
// Test 3
options.dist = LZMA_DELTA_DIST_MIN;
--- 114,127 ----
known_flags.id = LZMA_FILTER_DELTA;
known_flags.options = NULL;
expect(encode(99));
// Test 2
lzma_options_delta options = {
! /*.type =*/ LZMA_DELTA_TYPE_BYTE,
! /*.dist =*/ 0
};
known_flags.options = &options;
expect(encode(99));
// Test 3
options.dist = LZMA_DELTA_DIST_MIN;
*** xz-5.2.0/tests/test_index.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_index.c Fri Jan 9 14:42:22 2015
*************** test_read(lzma_index *i)
*** 209,221 ****
static void
test_code(lzma_index *i)
{
const size_t alloc_size = 128 * 1024;
! uint8_t *buf = malloc(alloc_size);
expect(buf != NULL);
// Encode
lzma_stream strm = LZMA_STREAM_INIT;
expect(lzma_index_encoder(&strm, i) == LZMA_OK);
const lzma_vli index_size = lzma_index_size(i);
--- 209,221 ----
static void
test_code(lzma_index *i)
{
const size_t alloc_size = 128 * 1024;
! uint8_t *buf = (uint8_t *)malloc(alloc_size);
expect(buf != NULL);
// Encode
lzma_stream strm = LZMA_STREAM_INIT;
expect(lzma_index_encoder(&strm, i) == LZMA_OK);
const lzma_vli index_size = lzma_index_size(i);
*************** test_locate(void)
*** 590,602 ****
static void
test_corrupt(void)
{
const size_t alloc_size = 128 * 1024;
! uint8_t *buf = malloc(alloc_size);
expect(buf != NULL);
lzma_stream strm = LZMA_STREAM_INIT;
lzma_index *i = create_empty();
expect(lzma_index_append(i, NULL, 0, 1) == LZMA_PROG_ERROR);
lzma_index_end(i, NULL);
--- 590,602 ----
static void
test_corrupt(void)
{
const size_t alloc_size = 128 * 1024;
! uint8_t *buf = (uint8_t *)malloc(alloc_size);
expect(buf != NULL);
lzma_stream strm = LZMA_STREAM_INIT;
lzma_index *i = create_empty();
expect(lzma_index_append(i, NULL, 0, 1) == LZMA_PROG_ERROR);
lzma_index_end(i, NULL);
*** xz-5.2.0/tests/test_stream_flags.c.dist Mon Dec 22 03:49:36 2014
--- xz-5.2.0/tests/test_stream_flags.c Fri Jan 9 14:42:23 2015
*************** test_footer(void)
*** 80,92 ****
}
static void
test_encode_invalid(void)
{
! known_flags.check = LZMA_CHECK_ID_MAX + 1;
known_flags.backward_size = 1024;
expect(lzma_stream_header_encode(&known_flags, buffer)
== LZMA_PROG_ERROR);
expect(lzma_stream_footer_encode(&known_flags, buffer)
--- 80,92 ----
}
static void
test_encode_invalid(void)
{
! known_flags.check = (enum lzma_check)(LZMA_CHECK_ID_MAX + 1);
known_flags.backward_size = 1024;
expect(lzma_stream_header_encode(&known_flags, buffer)
== LZMA_PROG_ERROR);
expect(lzma_stream_footer_encode(&known_flags, buffer)
*************** test_decode_invalid(void)
*** 164,176 ****
int
main(void)
{
// Valid headers
known_flags.backward_size = 1024;
for (lzma_check check = LZMA_CHECK_NONE;
! check <= LZMA_CHECK_ID_MAX; ++check) {
test_header();
test_footer();
}
// Invalid headers
test_encode_invalid();
--- 164,176 ----
int
main(void)
{
// Valid headers
known_flags.backward_size = 1024;
for (lzma_check check = LZMA_CHECK_NONE;
! check <= LZMA_CHECK_ID_MAX; check=(lzma_check)(check+1)) {
test_header();
test_footer();
}
// Invalid headers
test_encode_invalid();