Patch to compile xz-5.0.3 on 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, variable declaration in middle of a block, labelled struct initializer, ++ 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 ac_cv_prog_cc_c99= \
	CC="gcc -x c++" CCAS="gcc" CCLD="gcc" \
	CFLAGS="-Wno-long-long" \
	CPPFLAGS="-Drestrict=__restrict__ -Dlzma_nothrow=" \
	CCASFLAGS="" \
	./configure --prefix=/usr/local \
	--mandir=/usr/local/man --docdir=/usr/local/doc/xz --disable-nls --enable-shared

The hardest part was the 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 structs which xz code uses all over.

The patch patches ./configure, so it will not survive re-autoconf.

Shorter patch was possible by using CC=g++, but that leaves unneeded libstdc++.so dependency in the executable.


--- xz-5.0.3-g2++/configure.dist Sat May 21 22:59:51 2011 +++ xz-5.0.3-g2++/configure Fri Dec 19 14:05:39 2014 @@ -665,12 +665,13 @@ PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config EGREP GREP CPP +CCLD am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE CCASFLAGS CCAS am__fastdepCC_FALSE @@ -2840,14 +2841,14 @@ fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compile='${CC} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='${CCLD-$CC} -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do @@ -5800,12 +5801,14 @@ if test "$am_t" != yes; then # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi +test "${CCLD+set}" = set || CCLD=$CC + # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS @@ -11308,13 +11311,13 @@ _LT_EOF ;; 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_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 @@ -11373,14 +11376,14 @@ _LT_EOF # 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' + 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 "$host_os" = linux-dietlibc; then case $cc_basename in @@ -11423,13 +11426,13 @@ _LT_EOF 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' + archive_cmds='${CCLD-$CC} '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; 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' @@ -11457,14 +11460,14 @@ _LT_EOF 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' + 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 @@ -11476,14 +11479,14 @@ _LT_EOF *** 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' + 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*) @@ -11505,14 +11508,14 @@ _LT_EOF # 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' + 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 ;; @@ -11523,14 +11526,14 @@ _LT_EOF 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' + 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 @@ -11773,13 +11776,13 @@ fi ;; 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_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 @@ -11914,21 +11917,21 @@ fi 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' + 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 "$GCC" = yes; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + 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 $output_objdir/$soname = $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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes @@ -11938,13 +11941,13 @@ fi hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -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' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' @@ -11959,28 +11962,28 @@ fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='${CCLD-$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='${CCLD-$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' + 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='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='${CCLD-$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' + 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 @@ -12044,13 +12047,13 @@ fi esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; 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' + 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; } @@ -12072,17 +12075,17 @@ rm -f core conftest.err conftest.$ac_obj 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 "$lt_cv_irix_exported_symbol" = yes; 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' + 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='$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' + 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 @@ -12113,24 +12116,24 @@ $as_echo "$lt_cv_irix_exported_symbol" > openbsd*) 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__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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' + 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 case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='${CCLD-$CC} -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no @@ -12145,47 +12148,47 @@ $as_echo "$lt_cv_irix_exported_symbol" > old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; 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' + 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='$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' + 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 "$GCC" = yes; 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' + 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='$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_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~ - $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' + ${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 "$GCC" = yes; then wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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~ - $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' + ${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 `$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~ @@ -12274,14 +12277,14 @@ $as_echo "$lt_cv_irix_exported_symbol" > no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; 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' + 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='$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 ;; @@ -12300,14 +12303,14 @@ $as_echo "$lt_cv_irix_exported_symbol" > hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; 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' + 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='$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 ;; @@ -18750,12 +18753,13 @@ lt_NL2SP \ 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 \ @@ -19924,12 +19928,13 @@ dlopen_self_static=$enable_dlopen_self_s 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.0.3-g2++/debug/Makefile.in.dist Sat May 21 22:59:53 2011 +++ xz-5.0.3-g2++/debug/Makefile.in Thu Dec 18 20:16:54 2014 @@ -105,13 +105,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = crc32.c full_flush.c hex2bin.c known_sizes.c memusage.c \ repeat.c sync_flush.c DIST_SOURCES = crc32.c full_flush.c hex2bin.c known_sizes.c memusage.c \ --- xz-5.0.3-g2++/lib/Makefile.in.dist Sat May 21 22:59:53 2011 +++ xz-5.0.3-g2++/lib/Makefile.in Thu Dec 18 20:18:27 2014 @@ -70,13 +70,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libgnu_a_SOURCES) DIST_SOURCES = $(libgnu_a_SOURCES) ETAGS = etags --- xz-5.0.3-g2++/src/common/sysdefs.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/common/sysdefs.h Thu Dec 18 18:23:58 2014 @@ -116,14 +116,16 @@ # 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 +#if SIZE_MAX != UINT32_MAX +# if SIZE_MAX != UINT64_MAX # error size_t is not 32-bit or 64-bit +# endif #endif #include <stdlib.h> #include <assert.h> // Pre-C99 systems lack stdbool.h. All the code in LZMA Utils must be written @@ -136,13 +138,13 @@ // // bool baz = (flags & 0x100); // #ifdef HAVE_STDBOOL_H # include <stdbool.h> #else -# if ! HAVE__BOOL +# 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.0.3-g2++/src/liblzma/Makefile.in.dist Sat May 21 22:59:53 2011 +++ xz-5.0.3-g2++/src/liblzma/Makefile.in Fri Dec 19 11:27:41 2014 @@ -368,21 +368,21 @@ liblzma_la_LINK = $(LIBTOOL) --tag=CC $( 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_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ +LTCPPASCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(liblzma_la_SOURCES) DIST_SOURCES = $(am__liblzma_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -782,24 +782,24 @@ distclean-compile: @am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< liblzma_la-crc32_x86.lo: check/crc32_x86.S -@am__fastdepCCAS_TRUE@ $(LIBTOOL) $(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@ $(LIBTOOL) --tag=CC $(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__mv) $(DEPDIR)/liblzma_la-crc32_x86.Tpo $(DEPDIR)/liblzma_la-crc32_x86.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ 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@ $(LIBTOOL) $(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 +@am__fastdepCCAS_FALSE@ $(LIBTOOL) --tag=CC $(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@ $(LIBTOOL) $(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@ $(LIBTOOL) --tag=CC $(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__mv) $(DEPDIR)/liblzma_la-crc64_x86.Tpo $(DEPDIR)/liblzma_la-crc64_x86.Plo @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ 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@ $(LIBTOOL) $(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 +@am__fastdepCCAS_FALSE@ $(LIBTOOL) --tag=CC $(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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ --- xz-5.0.3-g2++/src/liblzma/check/crc32_table_be.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/crc32_table_be.h Fri Dec 12 14:32:40 2014 @@ -1,9 +1,9 @@ /* This file has been automatically generated by crc32_tablegen.c. */ -const uint32_t lzma_crc32_table[8][256] = { +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.0.3-g2++/src/liblzma/check/crc32_table_le.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/crc32_table_le.h Fri Dec 12 14:32:51 2014 @@ -1,9 +1,9 @@ /* This file has been automatically generated by crc32_tablegen.c. */ -const uint32_t lzma_crc32_table[8][256] = { +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.0.3-g2++/src/liblzma/check/crc32_tablegen.c.dist Fri Dec 12 14:33:06 2014 +++ xz-5.0.3-g2++/src/liblzma/check/crc32_tablegen.c Fri Dec 12 14:33:13 2014 @@ -53,13 +53,13 @@ init_crc32_table(void) 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{"); + "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.0.3-g2++/src/liblzma/check/crc64_table_be.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/crc64_table_be.h Fri Dec 12 14:31:19 2014 @@ -1,9 +1,9 @@ /* This file has been automatically generated by crc64_tablegen.c. */ -const uint64_t lzma_crc64_table[4][256] = { +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.0.3-g2++/src/liblzma/check/crc64_table_le.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/crc64_table_le.h Fri Dec 12 14:29:44 2014 @@ -1,9 +1,9 @@ /* This file has been automatically generated by crc64_tablegen.c. */ -const uint64_t lzma_crc64_table[4][256] = { +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.0.3-g2++/src/liblzma/check/crc64_tablegen.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/crc64_tablegen.c Fri Dec 12 14:32:01 2014 @@ -52,13 +52,13 @@ init_crc64_table(void) 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{"); + "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.0.3-g2++/src/liblzma/check/sha256.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/check/sha256.c Thu Oct 4 01:58:21 2012 @@ -78,13 +78,13 @@ static const uint32_t SHA256_K[64] = { 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2, }; static void -transform(uint32_t state[static 8], const uint32_t data[static 16]) +transform(uint32_t state[8], const uint32_t data[16]) { uint32_t W[16]; uint32_t T[8]; // Copy state[] to working vars. memcpy(T, state, sizeof(T)); --- xz-5.0.3-g2++/src/liblzma/common/alone_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/alone_decoder.c Fri Dec 12 17:14:01 2014 @@ -12,22 +12,23 @@ #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 { - SEQ_PROPERTIES, - SEQ_DICTIONARY_SIZE, - SEQ_UNCOMPRESSED_SIZE, - SEQ_CODER_INIT, - SEQ_CODE, - } sequence; + enum lzma_coder_sequence_e sequence; /// Position in the header fields size_t pos; /// Uncompressed size decoded from the header lzma_vli uncompressed_size; @@ -121,20 +122,16 @@ alone_decode(lzma_coder *coder, // 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, - } - }; + 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; @@ -194,13 +191,13 @@ lzma_alone_decoder_init(lzma_next_coder 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); + 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; @@ -220,13 +217,13 @@ lzma_alone_decoder_init(lzma_next_coder } extern LZMA_API(lzma_ret) lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit) { - lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit); + lzma_next_strm_init1(lzma_alone_decoder_init, strm, memlimit); strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; return LZMA_OK; } --- xz-5.0.3-g2++/src/liblzma/common/alone_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/alone_encoder.c Thu Oct 4 00:23:38 2012 @@ -14,19 +14,20 @@ #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 { - SEQ_HEADER, - SEQ_CODE, - } sequence; + enum lzma_coder_sequence_e sequence; size_t header_pos; uint8_t header[ALONE_HEADER_SIZE]; }; @@ -78,13 +79,13 @@ static lzma_ret alone_encoder_init(lzma_next_coder *next, 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); + 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; @@ -121,16 +122,18 @@ alone_encoder_init(lzma_next_coder *next // - 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), + /*.id =*/0, + /*.init =*/ (lzma_init_function)&lzma_lzma_encoder_init, + /*.options =*/ (void *)(options), }, { - .init = NULL, + /*.id =*/0, + /*.init =*/ NULL, } }; return lzma_next_filter_init(&next->coder->next, allocator, filters); } @@ -145,13 +148,13 @@ lzma_alone_encoder_init(lzma_next_coder */ 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); + 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.0.3-g2++/src/liblzma/common/auto_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/auto_decoder.c Thu Oct 4 01:29:29 2012 @@ -11,24 +11,25 @@ /////////////////////////////////////////////////////////////////////////////// #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 { - SEQ_INIT, - SEQ_CODE, - SEQ_FINISH, - } sequence; + enum lzma_coder_sequence_e sequence; }; static lzma_ret auto_decode(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, @@ -152,13 +153,13 @@ auto_decoder_init(lzma_next_coder *next, 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); + 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; @@ -174,13 +175,13 @@ auto_decoder_init(lzma_next_coder *next, } 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); + 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.0.3-g2++/src/liblzma/common/block_buffer_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/block_buffer_encoder.c Thu Oct 4 00:26:47 2012 @@ -86,13 +86,13 @@ block_encode_uncompressed(lzma_block *bl // that filter to encode the uncompressed chunks. // 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, + /*.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.0.3-g2++/src/liblzma/common/block_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/block_decoder.c Thu Oct 4 01:31:31 2012 @@ -12,18 +12,19 @@ #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 { - SEQ_CODE, - SEQ_PADDING, - SEQ_CHECK, - } sequence; + 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. @@ -190,13 +191,13 @@ lzma_block_decoder_init(lzma_next_coder 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); + 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; @@ -230,13 +231,13 @@ lzma_block_decoder_init(lzma_next_coder } extern LZMA_API(lzma_ret) lzma_block_decoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_decoder_init, strm, 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.0.3-g2++/src/liblzma/common/block_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/block_encoder.c Thu Oct 4 00:29:47 2012 @@ -12,26 +12,27 @@ #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 { - SEQ_CODE, - SEQ_PADDING, - SEQ_CHECK, - } sequence; + enum lzma_coder_sequence_e sequence; /// Compressed Size calculated while encoding lzma_vli compressed_size; /// Uncompressed Size calculated while encoding lzma_vli uncompressed_size; @@ -176,13 +177,13 @@ lzma_block_encoder_init(lzma_next_coder 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); + 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; @@ -205,13 +206,13 @@ lzma_block_encoder_init(lzma_next_coder } extern LZMA_API(lzma_ret) lzma_block_encoder(lzma_stream *strm, lzma_block *block) { - lzma_next_strm_init(lzma_block_encoder_init, strm, 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.0.3-g2++/src/liblzma/common/common.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/common.c Wed Oct 3 23:43:53 2012 @@ -83,12 +83,27 @@ lzma_bufcpy(const uint8_t *restrict in, *in_pos += copy_size; *out_pos += copy_size; return copy_size; } +extern 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_check =*/ NULL, + /*.memconfig =*/ NULL, + /*.update =*/ NULL, + }; + return ret; +} extern lzma_ret lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) { lzma_next_coder_init(filters[0].init, next, allocator); @@ -145,13 +160,13 @@ extern lzma_ret 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->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.0.3-g2++/src/liblzma/common/common.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/common.h Thu Dec 18 17:31:11 2014 @@ -33,13 +33,13 @@ #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__ +#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 @@ -154,43 +154,37 @@ struct lzma_next_coder_s { const lzma_filter *filters, const lzma_filter *reversed_filters); }; /// Macro to initialize lzma_next_coder structure +/// converted to func for __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_check = NULL, \ - .memconfig = NULL, \ - .update = NULL, \ - } + _lzma_next_coder_init_func() +extern lzma_next_coder _lzma_next_coder_init_func(void); /// 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_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 { - ISEQ_RUN, - ISEQ_SYNC_FLUSH, - ISEQ_FULL_FLUSH, - ISEQ_FINISH, - ISEQ_END, - ISEQ_ERROR, - } sequence; + 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; @@ -267,17 +261,37 @@ do { \ /// 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, ...) \ +#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, __VA_ARGS__); \ + (strm)->allocator, (p1),(p2),(p3)); \ if (ret_ != LZMA_OK) { \ lzma_end(strm); \ return ret_; \ } \ } while (0) --- xz-5.0.3-g2++/src/liblzma/common/filter_common.c.dist Tue Oct 2 13:49:11 2012 +++ xz-5.0.3-g2++/src/liblzma/common/filter_common.c Wed Oct 3 23:55:11 2012 @@ -33,93 +33,93 @@ static const struct { /// 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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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 + /*.id =*/ LZMA_VLI_UNKNOWN } }; extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, lzma_filter *dest, --- xz-5.0.3-g2++/src/liblzma/common/filter_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/filter_decoder.c Thu Oct 4 01:33:47 2012 @@ -41,80 +41,80 @@ typedef struct { } 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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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, + /*.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 * @@ -144,13 +144,13 @@ lzma_raw_decoder_init(lzma_next_coder *n } 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); + 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.0.3-g2++/src/liblzma/common/filter_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/filter_encoder.c Thu Oct 4 00:40:40 2012 @@ -53,101 +53,107 @@ typedef struct { } 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, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 5, - .props_encode = &lzma_lzma_props_encode, + /*.id =*/ LZMA_FILTER_LZMA1, + /*.init =*/ &lzma_lzma_encoder_init, + /*.memusage =*/ &lzma_lzma_encoder_memusage, + /*.chunk_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, - .chunk_size = NULL, // FIXME - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_lzma2_props_encode, + /*.id =*/ LZMA_FILTER_LZMA2, + /*.init =*/ &lzma_lzma2_encoder_init, + /*.memusage =*/ &lzma_lzma2_encoder_memusage, + /*.chunk_size =*/ NULL, // 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, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_X86, + /*.init =*/ &lzma_simple_x86_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 0, /*?*/ + /*.props_encode =*/ &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_POWERPC { - .id = LZMA_FILTER_POWERPC, - .init = &lzma_simple_powerpc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_POWERPC, + /*.init =*/ &lzma_simple_powerpc_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 0, /*?*/ + /*.props_encode =*/ &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_IA64 { - .id = LZMA_FILTER_IA64, - .init = &lzma_simple_ia64_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_IA64, + /*.init =*/ &lzma_simple_ia64_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 0, /*?*/ + /*.props_encode =*/ &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARM { - .id = LZMA_FILTER_ARM, - .init = &lzma_simple_arm_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_ARM, + /*.init =*/ &lzma_simple_arm_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 0, /*?*/ + /*.props_encode =*/ &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_ARMTHUMB { - .id = LZMA_FILTER_ARMTHUMB, - .init = &lzma_simple_armthumb_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_ARMTHUMB, + /*.init =*/ &lzma_simple_armthumb_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 0, /*?*/ + /*.props_encode =*/ &lzma_simple_props_encode, }, #endif #ifdef HAVE_ENCODER_SPARC { - .id = LZMA_FILTER_SPARC, - .init = &lzma_simple_sparc_encoder_init, - .memusage = NULL, - .chunk_size = NULL, - .props_size_get = &lzma_simple_props_size, - .props_encode = &lzma_simple_props_encode, + /*.id =*/ LZMA_FILTER_SPARC, + /*.init =*/ &lzma_simple_sparc_encoder_init, + /*.memusage =*/ NULL, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ &lzma_simple_props_size, + /*.props_size_fixed =*/ 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, - .chunk_size = NULL, - .props_size_get = NULL, - .props_size_fixed = 1, - .props_encode = &lzma_delta_props_encode, + /*.id =*/ LZMA_FILTER_DELTA, + /*.init =*/ &lzma_delta_encoder_init, + /*.memusage =*/ &lzma_delta_coder_memusage, + /*.chunk_size =*/ NULL, + /*.props_size_get =*/ NULL, + /*.props_size_fixed =*/ 1, + /*.props_encode =*/ &lzma_delta_props_encode, }, #endif }; static const lzma_filter_encoder * @@ -204,13 +210,13 @@ lzma_raw_encoder_init(lzma_next_coder *n } 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_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.0.3-g2++/src/liblzma/common/index.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/index.c Fri Dec 12 17:34:30 2014 @@ -339,13 +339,13 @@ index_tree_locate(const index_tree *tree /// 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, lzma_allocator *allocator) { - index_stream *s = lzma_alloc(sizeof(index_stream), 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; @@ -367,22 +367,22 @@ index_stream_init(lzma_vli compressed_ba /// Free the memory allocated for a Stream and its Record groups. static void index_stream_end(void *node, lzma_allocator *allocator) { - index_stream *s = node; + index_stream *s = (index_stream *)node; index_tree_end(&s->groups, allocator, NULL); return; } static lzma_index * index_init_plain(lzma_allocator *allocator) { - lzma_index *i = lzma_alloc(sizeof(lzma_index), 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; @@ -669,13 +669,13 @@ lzma_index_append(lzma_index *i, lzma_al 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) + g = (index_group *)lzma_alloc(sizeof(index_group) + i->prealloc * sizeof(index_record), allocator); if (g == NULL) return LZMA_MEM_ERROR; g->last = 0; @@ -736,25 +736,25 @@ typedef struct { /// 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_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); + 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); + 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; } @@ -793,13 +793,13 @@ lzma_index_cat(lzma_index *restrict dest 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) + index_group *newg = (index_group *)lzma_alloc(sizeof(index_group) + (g->last + 1) * sizeof(index_record), allocator); if (newg == NULL) return LZMA_MEM_ERROR; @@ -829,17 +829,17 @@ lzma_index_cat(lzma_index *restrict dest } } // 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, + /*.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; @@ -878,13 +878,13 @@ index_dup_stream(const index_stream *src 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) + 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; } @@ -900,13 +900,13 @@ index_dup_stream(const index_stream *src 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); + 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); @@ -939,13 +939,13 @@ lzma_index_dup(const lzma_index *src, lz lzma_index_end(dest, allocator); return NULL; } index_tree_append(&dest->streams, &deststream->node); - srcstream = index_tree_next(&srcstream->node); + srcstream = (index_stream *)index_tree_next(&srcstream->node); } while (srcstream != NULL); return dest; } @@ -967,15 +967,15 @@ enum { }; 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 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) { @@ -1094,30 +1094,30 @@ extern LZMA_API(lzma_bool) 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 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 = iter->internal[ITER_GROUP].p; + group = (index_group *)iter->internal[ITER_GROUP].p; break; case ITER_METHOD_NEXT: - group = index_tree_next(iter->internal[ITER_GROUP].p); + 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; @@ -1131,13 +1131,13 @@ again: 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); + stream = (index_stream *)index_tree_next(&stream->node); if (stream == NULL) return true; } } // Start from the first Record in the Stream. @@ -1153,20 +1153,20 @@ again: // 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); + 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_tree_next(&stream->node); + 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 *)( @@ -1197,25 +1197,25 @@ again: } 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; + 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_tree_locate(&i->streams, target); + 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_tree_locate(&stream->groups, target); + 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.0.3-g2++/src/liblzma/common/index_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/index_decoder.c Thu Oct 4 01:35:58 2012 @@ -11,23 +11,24 @@ /////////////////////////////////////////////////////////////////////////////// #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 { - SEQ_INDICATOR, - SEQ_COUNT, - SEQ_MEMUSAGE, - SEQ_UNPADDED, - SEQ_UNCOMPRESSED, - SEQ_PADDING_INIT, - SEQ_PADDING, - SEQ_CRC32, - } sequence; + enum lzma_coder_sequence_e sequence; /// Memory usage limit uint64_t memlimit; /// Target Index lzma_index *index; @@ -267,13 +268,13 @@ index_decoder_init(lzma_next_coder *next 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); + 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; @@ -286,13 +287,13 @@ index_decoder_init(lzma_next_coder *next } 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); + 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.0.3-g2++/src/liblzma/common/index_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/index_encoder.c Fri Dec 12 17:38:53 2014 @@ -12,22 +12,23 @@ #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 { - SEQ_INDICATOR, - SEQ_COUNT, - SEQ_UNPADDED, - SEQ_UNCOMPRESSED, - SEQ_NEXT, - SEQ_PADDING, - SEQ_CRC32, - } sequence; + enum lzma_coder_sequence_e sequence; /// Index being encoded const lzma_index *index; /// Iterator for the Index being encoded lzma_index_iter iter; @@ -107,13 +108,14 @@ index_encode(lzma_coder *coder, goto out; ret = LZMA_OK; coder->pos = 0; // Advance to SEQ_UNCOMPRESSED or SEQ_NEXT. - ++coder->sequence; + /*++coder->sequence;*/ + coder->sequence = (coder->sequence == SEQ_UNPADDED)?SEQ_UNCOMPRESSED:SEQ_NEXT; break; } case SEQ_PADDING: if (coder->pos > 0) { --coder->pos; @@ -187,13 +189,13 @@ lzma_index_encoder_init(lzma_next_coder 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); + 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; } @@ -204,13 +206,13 @@ lzma_index_encoder_init(lzma_next_coder } 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); + 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.0.3-g2++/src/liblzma/common/index_hash.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/index_hash.c Thu Oct 4 01:38:34 2012 @@ -31,22 +31,23 @@ typedef struct { /// 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 { - SEQ_BLOCK, - SEQ_COUNT, - SEQ_UNPADDED, - SEQ_UNCOMPRESSED, - SEQ_PADDING_INIT, - SEQ_PADDING, - SEQ_CRC32, - } sequence; + 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; @@ -70,13 +71,13 @@ struct lzma_index_hash_s { extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(lzma_index_hash *index_hash, lzma_allocator *allocator) { if (index_hash == NULL) { - index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator); + 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.0.3-g2++/src/liblzma/common/stream_buffer_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/stream_buffer_encoder.c Fri Dec 12 17:41:13 2014 @@ -70,28 +70,30 @@ lzma_stream_buffer_encode(lzma_filter *f // 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, + 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 = { - .version = 0, - .check = check, - .filters = filters, + 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.0.3-g2++/src/liblzma/common/stream_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/stream_decoder.c Thu Oct 4 01:40:15 2012 @@ -11,21 +11,22 @@ /////////////////////////////////////////////////////////////////////////////// #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 { - SEQ_STREAM_HEADER, - SEQ_BLOCK_HEADER, - SEQ_BLOCK, - SEQ_INDEX, - SEQ_STREAM_FOOTER, - SEQ_STREAM_PADDING, - } sequence; + 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; @@ -410,13 +411,13 @@ lzma_stream_decoder_init(lzma_next_coder 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); + 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; @@ -439,13 +440,13 @@ lzma_stream_decoder_init(lzma_next_coder } 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); + 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.0.3-g2++/src/liblzma/common/stream_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/stream_encoder.c Fri Dec 12 17:43:27 2014 @@ -12,21 +12,23 @@ #include "stream_encoder.h" #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, + SEQ_STREAM_INVALID, +}; struct lzma_coder_s { - enum { - SEQ_STREAM_HEADER, - SEQ_BLOCK_INIT, - SEQ_BLOCK_HEADER, - SEQ_BLOCK_ENCODE, - SEQ_INDEX_ENCODE, - SEQ_STREAM_FOOTER, - } sequence; + enum lzma_coder_sequence_e sequence; /// True if Block encoder has been initialized by /// lzma_stream_encoder_init() or stream_encoder_update() /// and thus doesn't need to be initialized in stream_encode(). bool block_encoder_is_initialized; @@ -96,13 +98,19 @@ stream_encode(lzma_coder *coder, lzma_al return LZMA_OK; if (coder->sequence == SEQ_STREAM_FOOTER) return LZMA_STREAM_END; coder->buffer_pos = 0; - ++coder->sequence; + /*++coder->sequence;*/ + switch (coder->sequence) { + case SEQ_STREAM_HEADER: coder->sequence=SEQ_BLOCK_INIT; break; + case SEQ_BLOCK_HEADER: coder->sequence=SEQ_BLOCK_ENCODE; break; + case SEQ_STREAM_FOOTER: coder->sequence=SEQ_STREAM_INVALID; break; + default: assert(0); return LZMA_PROG_ERROR; + } 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 @@ -182,15 +190,15 @@ stream_encode(lzma_coder *coder, lzma_al 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, + /*.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; @@ -269,13 +277,13 @@ lzma_stream_encoder_init(lzma_next_coder lzma_next_coder_init(&lzma_stream_encoder_init, next, allocator); if (filters == NULL) return LZMA_PROG_ERROR; if (next->coder == NULL) { - next->coder = lzma_alloc(sizeof(lzma_coder), allocator); + 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; @@ -296,14 +304,15 @@ lzma_stream_encoder_init(lzma_next_coder 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, + /*.version =*/ 0, + /*.backward_size =*/ 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; @@ -317,13 +326,13 @@ lzma_stream_encoder_init(lzma_next_coder extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm, const lzma_filter *filters, lzma_check check) { - lzma_next_strm_init(lzma_stream_encoder_init, strm, filters, check); + lzma_next_strm_init2(lzma_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_FINISH] = true; --- xz-5.0.3-g2++/src/liblzma/common/stream_flags_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/common/stream_flags_decoder.c Thu Oct 4 01:56:45 2012 @@ -18,13 +18,20 @@ stream_flags_decode(lzma_stream_flags *o { // Reserved bits must be unset. if (in[0] != 0x00 || (in[1] & 0xF0)) return true; options->version = 0; - options->check = in[1] & 0x0F; + /*options->check = in[1] & 0x0F;*/ + switch (in[1] & 0x0F) { + case 0: options->check = LZMA_CHECK_NONE; break; + case 1: options->check = LZMA_CHECK_CRC32; break; + case 4: options->check = LZMA_CHECK_CRC64; break; + case 10: options->check = LZMA_CHECK_SHA256; break; + default: options->check = LZMA_CHECK_NONE; break; + } return false; } extern LZMA_API(lzma_ret) --- xz-5.0.3-g2++/src/liblzma/delta/delta_common.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/delta/delta_common.c Thu Oct 4 03:28:32 2012 @@ -26,13 +26,13 @@ delta_coder_end(lzma_coder *coder, lzma_ extern lzma_ret lzma_delta_coder_init(lzma_next_coder *next, 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); + 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; @@ -40,13 +40,13 @@ lzma_delta_coder_init(lzma_next_coder *n // 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; + 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); @@ -56,13 +56,13 @@ lzma_delta_coder_init(lzma_next_coder *n } extern uint64_t lzma_delta_coder_memusage(const void *options) { - const lzma_options_delta *opt = 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.0.3-g2++/src/liblzma/delta/delta_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/delta/delta_decoder.c Thu Oct 4 03:30:22 2012 @@ -60,13 +60,13 @@ lzma_delta_props_decode(void **options, 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); + = (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.0.3-g2++/src/liblzma/delta/delta_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/delta/delta_encoder.c Thu Oct 4 03:29:32 2012 @@ -111,11 +111,11 @@ lzma_delta_props_encode(const void *opti { // 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; + const lzma_options_delta *opt = (lzma_options_delta *)options; out[0] = opt->dist - LZMA_DELTA_DIST_MIN; return LZMA_OK; } --- xz-5.0.3-g2++/src/liblzma/lz/lz_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lz/lz_decoder.c Thu Oct 4 02:14:31 2012 @@ -196,22 +196,35 @@ lz_decoder_end(lzma_coder *coder, lzma_a lzma_free(coder, allocator); return; } +/* functionize LZMA_LZ_DECODER_INIT */ +extern 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; +} extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret (*lz_init)(lzma_lz_decoder *lz, 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); + 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; @@ -248,13 +261,13 @@ lzma_lz_decoder_init(lzma_next_coder *ne 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); + = (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.0.3-g2++/src/liblzma/lz/lz_decoder.h.dist Tue Oct 2 14:58:43 2012 +++ xz-5.0.3-g2++/src/liblzma/lz/lz_decoder.h Thu Oct 4 02:13:18 2012 @@ -69,21 +69,15 @@ typedef struct { /// Free allocated resources void (*end)(lzma_coder *coder, lzma_allocator *allocator); } lzma_lz_decoder; -#define LZMA_LZ_DECODER_INIT \ - (lzma_lz_decoder){ \ - .coder = NULL, \ - .code = NULL, \ - .reset = NULL, \ - .set_uncompressed = NULL, \ - .end = NULL, \ - } - +extern lzma_lz_decoder +_lzma_lz_decoder_init_func(void); +#define LZMA_LZ_DECODER_INIT _lzma_lz_decoder_init_func() extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret (*lz_init)(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)); @@ -151,16 +145,16 @@ dict_repeat(lzma_dict *dict, uint32_t di dict->pos += left; } else { // The bigger the dictionary, the more rare this // case occurs. We need to "wrap" the dict, thus // we might need two memcpy() to copy all the data. - uint32_t copy_pos,copy_size; assert(dict->full == dict->size); - copy_pos = dict->pos - distance - 1 + dict->size; - copy_size = dict->size - copy_pos; + const uint32_t copy_pos + = dict->pos - distance - 1 + dict->size; + uint32_t copy_size = dict->size - copy_pos; if (copy_size < left) { memmove(dict->buf + dict->pos, dict->buf + copy_pos, copy_size); dict->pos += copy_size; copy_size = left - copy_size; --- xz-5.0.3-g2++/src/liblzma/lz/lz_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lz/lz_encoder.c Thu Oct 4 02:04:26 2012 @@ -362,13 +362,13 @@ lz_encoder_prepare(lzma_mf *mf, lzma_all static bool lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options) { // Allocate the history buffer. if (mf->buffer == NULL) { - mf->buffer = lzma_alloc(mf->size, allocator); + mf->buffer = (uint8_t *)lzma_alloc(mf->size, allocator); if (mf->buffer == NULL) return true; } // Use cyclic_size as initial mf->offset. This allows // avoiding a few branches in the match finders. The downside is @@ -389,13 +389,13 @@ lz_encoder_init(lzma_mf *mf, lzma_alloca // possible on 32-bit CPU.) if (alloc_count > SIZE_MAX / sizeof(uint32_t)) return true; #endif if (mf->hash == NULL) { - mf->hash = lzma_alloc(alloc_count * sizeof(uint32_t), + mf->hash = (uint32_t *)lzma_alloc(alloc_count * sizeof(uint32_t), allocator); if (mf->hash == NULL) return true; } mf->son = mf->hash + mf->hash_size_sum; @@ -439,18 +439,19 @@ lz_encoder_init(lzma_mf *mf, lzma_alloca 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, - .hash_size_sum = 0, - .sons_count = 0, - }; + lzma_mf mf; + { + mf.buffer = NULL, + mf.hash = NULL, + mf.hash_size_sum = 0, + mf.sons_count = 0; + } // Setup the size information into mf. if (lz_encoder_prepare(&mf, NULL, lz_options)) return UINT64_MAX; // Calculate the memory usage. @@ -505,13 +506,13 @@ lzma_lz_encoder_init(lzma_next_coder *ne // 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); + 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.0.3-g2++/src/liblzma/lzma/lzma2_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma2_decoder.c Thu Oct 4 03:26:20 2012 @@ -13,26 +13,27 @@ #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 sequence { - SEQ_CONTROL, - SEQ_UNCOMPRESSED_1, - SEQ_UNCOMPRESSED_2, - SEQ_COMPRESSED_0, - SEQ_COMPRESSED_1, - SEQ_PROPERTIES, - SEQ_LZMA, - SEQ_COPY, - } sequence; + enum lzma_coder_sequence_e sequence; /// Sequence after the size fields have been decoded. - enum sequence next_sequence; + enum lzma_coder_sequence_e next_sequence; /// LZMA decoder lzma_lz_decoder lzma; /// Uncompressed size of LZMA chunk size_t uncompressed_size; @@ -222,23 +223,23 @@ lzma2_decoder_end(lzma_coder *coder, lzm static lzma_ret lzma2_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { if (lz->coder == NULL) { - lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); + 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 = opt; + 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; @@ -280,13 +281,13 @@ lzma_lzma2_props_decode(void **options, return LZMA_OPTIONS_ERROR; // Decode the dictionary size. if (props[0] > 40) return LZMA_OPTIONS_ERROR; - lzma_options_lzma *opt = lzma_alloc( + 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.0.3-g2++/src/liblzma/lzma/lzma2_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma2_encoder.c Thu Oct 4 03:23:02 2012 @@ -14,20 +14,21 @@ #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 { - SEQ_INIT, - SEQ_LZMA_ENCODE, - SEQ_LZMA_COPY, - SEQ_UNCOMPRESSED_HEADER, - SEQ_UNCOMPRESSED_COPY, - } sequence; + enum lzma_coder_sequence_e sequence; /// LZMA encoder lzma_coder *lzma; /// LZMA options currently in use. lzma_options_lzma opt_cur; @@ -278,13 +279,13 @@ lzma2_encoder_options_update(lzma_coder // 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; + 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) @@ -308,13 +309,13 @@ lzma2_encoder_init(lzma_lz_encoder *lz, 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); + 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; @@ -368,13 +369,13 @@ lzma_lzma2_encoder_memusage(const void * } extern lzma_ret lzma_lzma2_props_encode(const void *options, uint8_t *out) { - const lzma_options_lzma *const opt = options; + 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; --- xz-5.0.3-g2++/src/liblzma/lzma/lzma_common.h.dist Thu Oct 4 02:46:35 2012 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma_common.h Thu Oct 4 02:54:32 2012 @@ -50,27 +50,25 @@ is_lclppb_valid(const lzma_options_lzma /// - Match: Repeat a chunk of data at some distance /// - Long repeat: Multi-byte match at a recently seen distance /// - Short repeat: One-byte repeat at a recently seen distance /// /// The event names are in from STATE_oldest_older_previous. REP means /// either short or long repeated match, and NONLIT means any non-literal. -typedef enum { - STATE_LIT_LIT, - STATE_MATCH_LIT_LIT, - STATE_REP_LIT_LIT, - STATE_SHORTREP_LIT_LIT, - STATE_MATCH_LIT, - STATE_REP_LIT, - STATE_SHORTREP_LIT, - STATE_LIT_MATCH, - STATE_LIT_LONGREP, - STATE_LIT_SHORTREP, - STATE_NONLIT_MATCH, - STATE_NONLIT_REP, -} lzma_lzma_state; - +typedef int lzma_lzma_state; +#define STATE_LIT_LIT 0 +#define STATE_MATCH_LIT_LIT 1 +#define STATE_REP_LIT_LIT 2 +#define STATE_SHORTREP_LIT_LIT 3 +#define STATE_MATCH_LIT 4 +#define STATE_REP_LIT 5 +#define STATE_SHORTREP_LIT 6 +#define STATE_LIT_MATCH 7 +#define STATE_LIT_LONGREP 8 +#define STATE_LIT_SHORTREP 9 +#define STATE_NONLIT_MATCH 10 +#define STATE_NONLIT_REP 11 /// Total number of states #define STATES 12 /// The lowest 7 states indicate that the previous state was a literal. #define LIT_STATES 7 --- xz-5.0.3-g2++/src/liblzma/lzma/lzma_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma_decoder.c Thu Oct 4 03:19:50 2012 @@ -158,12 +158,33 @@ typedef struct { 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_POS_SLOT), + SEQ_POS_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. @@ -234,33 +255,13 @@ struct lzma_coder_s { //////////////////////////////// // 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_POS_SLOT), - SEQ_POS_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; + 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] @@ -337,12 +338,26 @@ lzma_decode(lzma_coder *restrict coder, != LZMA_VLI_UNKNOWN; if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos) dict.limit = dict.pos + (size_t)(coder->uncompressed_size); // The main decoder loop. The "switch" is used to restart the decoder at // correct location. Once restarted, the "switch" is no longer used. + static const lzma_lzma_state next_state[] = { + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_LIT_LIT, + STATE_MATCH_LIT_LIT, + STATE_REP_LIT_LIT, + STATE_SHORTREP_LIT_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT, + STATE_SHORTREP_LIT, + STATE_MATCH_LIT, + STATE_REP_LIT + }; switch (coder->sequence) while (true) { // Calculate new pos_state. This is skipped on the first loop // since we already calculated it when setting up the local // variables. pos_state = dict.pos & pos_mask; @@ -450,26 +465,12 @@ lzma_decode(lzma_coder *restrict coder, } //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, - STATE_REP_LIT_LIT, - STATE_SHORTREP_LIT_LIT, - STATE_MATCH_LIT, - 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; @@ -850,13 +851,13 @@ lzma_lzma_decoder_uncompressed(void *cod } */ static void lzma_decoder_reset(lzma_coder *coder, const void *opt) { - const lzma_options_lzma *options = 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; @@ -934,24 +935,24 @@ lzma_decoder_reset(lzma_coder *coder, co extern lzma_ret lzma_lzma_decoder_create(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *opt, lzma_lz_options *lz_options) { if (lz->coder == NULL) { - lz->coder = lzma_alloc(sizeof(lzma_coder), allocator); + 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 = opt; + 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; } @@ -961,13 +962,13 @@ lzma_lzma_decoder_create(lzma_lz_decoder /// initialization (lzma_lzma_decoder_init() passes function pointer to /// the LZ initialization). static lzma_ret lzma_decoder_init(lzma_lz_decoder *lz, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options) { - if (!is_lclppb_valid(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); @@ -1006,21 +1007,21 @@ lzma_lzma_lclppb_decode(lzma_options_lzm } extern uint64_t lzma_lzma_decoder_memusage_nocheck(const void *options) { - const lzma_options_lzma *const opt = 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(options)) + if (!is_lclppb_valid((lzma_options_lzma *)options)) return UINT64_MAX; return lzma_lzma_decoder_memusage_nocheck(options); } @@ -1029,13 +1030,13 @@ lzma_lzma_props_decode(void **options, l 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); + = (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.0.3-g2++/src/liblzma/lzma/lzma_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma_encoder.c Thu Oct 4 02:59:30 2012 @@ -547,13 +547,13 @@ lzma_lzma_encoder_reset(lzma_coder *code extern lzma_ret lzma_lzma_encoder_create(lzma_coder **coder_ptr, 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); + *coder_ptr = (lzma_coder *)lzma_alloc(sizeof(lzma_coder), allocator); if (*coder_ptr == NULL) return LZMA_MEM_ERROR; } lzma_coder *coder = *coder_ptr; @@ -606,13 +606,13 @@ lzma_lzma_encoder_create(lzma_coder **co static lzma_ret lzma_encoder_init(lzma_lz_encoder *lz, 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); + (lzma_coder **)&lz->coder, allocator, (lzma_options_lzma *)options, lz_options); } extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters) @@ -622,17 +622,17 @@ lzma_lzma_encoder_init(lzma_next_coder * } extern uint64_t lzma_lzma_encoder_memusage(const void *options) { - if (!is_options_valid(options)) + if (!is_options_valid((lzma_options_lzma *)options)) return UINT64_MAX; lzma_lz_options lz_options; - set_lz_options(&lz_options, 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; @@ -653,13 +653,13 @@ lzma_lzma_lclppb_encode(const lzma_optio #ifdef HAVE_ENCODER_LZMA1 extern lzma_ret lzma_lzma_props_encode(const void *options, uint8_t *out) { - const lzma_options_lzma *const opt = options; + 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.0.3-g2++/src/liblzma/lzma/lzma_encoder_presets.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/lzma/lzma_encoder_presets.c Thu Oct 4 03:07:32 2012 @@ -27,20 +27,23 @@ lzma_lzma_preset(lzma_options_lzma *opti options->preset_dict_size = 0; options->lc = LZMA_LC_DEFAULT; options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << (uint8_t []){ - 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + { + static const uint8_t l2s[] = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + options->dict_size = UINT32_C(1) << l2s[level]; + } if (level <= 3) { + static const uint8_t l2d[] = { 4, 8, 24, 48 }; options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + options->depth = l2d[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; options->nice_len = level == 4 ? 16 : level == 5 ? 32 : 64; options->depth = 0; } --- xz-5.0.3-g2++/src/liblzma/rangecoder/range_encoder.h.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/rangecoder/range_encoder.h Thu Oct 4 02:28:12 2012 @@ -21,12 +21,18 @@ /// 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 +typedef uint32_t lzma_range_encoder_symbols_e; +#define RC_BIT_0 0 +#define RC_BIT_1 1 +#define RC_DIRECT_0 2 +#define RC_DIRECT_1 3 +#define RC_FLUSH 4 typedef struct { uint64_t low; uint64_t cache_size; uint32_t range; uint8_t cache; @@ -34,19 +40,13 @@ typedef struct { 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]; + 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; --- xz-5.0.3-g2++/src/liblzma/simple/simple_coder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/simple/simple_coder.c Thu Oct 4 03:32:26 2012 @@ -232,13 +232,13 @@ lzma_simple_coder_init(lzma_next_coder * // 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) + 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; @@ -247,23 +247,23 @@ lzma_simple_coder_init(lzma_next_coder * 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( + 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 = filters[0].options; + 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.0.3-g2++/src/liblzma/simple/simple_decoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/simple/simple_decoder.c Thu Oct 4 03:34:41 2012 @@ -20,13 +20,13 @@ lzma_simple_props_decode(void **options, if (props_size == 0) return LZMA_OK; if (props_size != 4) return LZMA_OPTIONS_ERROR; - lzma_options_bcj *opt = lzma_alloc( + 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.0.3-g2++/src/liblzma/simple/simple_encoder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/liblzma/simple/simple_encoder.c Thu Oct 4 03:33:52 2012 @@ -13,22 +13,22 @@ #include "simple_encoder.h" extern lzma_ret lzma_simple_props_size(uint32_t *size, const void *options) { - const lzma_options_bcj *const opt = 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 = options; + 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.0.3-g2++/src/lzmainfo/Makefile.in.dist Sat May 21 22:59:53 2011 +++ xz-5.0.3-g2++/src/lzmainfo/Makefile.in Thu Dec 18 20:17:24 2014 @@ -81,13 +81,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(lzmainfo_SOURCES) DIST_SOURCES = $(am__lzmainfo_SOURCES_DIST) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; --- xz-5.0.3-g2++/src/lzmainfo/lzmainfo.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/lzmainfo/lzmainfo.c Fri Dec 19 14:18:35 2014 @@ -106,13 +106,13 @@ lzmainfo(const char *name, FILE *f) 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 }; + lzma_filter filter = { /*.id =*/ LZMA_FILTER_LZMA1 }; // Parse the first five bytes. switch (lzma_properties_decode(&filter, NULL, buf, 5)) { case LZMA_OK: break; @@ -149,13 +149,13 @@ lzmainfo(const char *name, FILE *f) else printf("%" PRIu64 " MB (%" PRIu64 " bytes)", (uncompressed_size + 512 * 1024) / (1024 * 1024), uncompressed_size); - lzma_options_lzma *opt = filter.options; + 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.0.3-g2++/src/xz/Makefile.in.dist Sat May 21 22:59:53 2011 +++ xz-5.0.3-g2++/src/xz/Makefile.in Thu Dec 18 20:17:39 2014 @@ -94,13 +94,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(xz_SOURCES) DIST_SOURCES = $(am__xz_SOURCES_DIST) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; --- xz-5.0.3-g2++/src/xz/args.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/args.c Fri Dec 12 14:35:37 2014 @@ -447,13 +447,13 @@ parse_environment(args_info *args, char "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 *)); + 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.0.3-g2++/src/xz/coder.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/coder.c Fri Dec 12 14:39:12 2014 @@ -212,13 +212,13 @@ coder_set_compression_settings(void) ++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; + 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 @@ -294,21 +294,21 @@ is_format_lzma(void) { // The .lzma header is 13 bytes. if (strm.avail_in < 13) return false; // Decode the LZMA1 properties. - lzma_filter filter = { .id = LZMA_FILTER_LZMA1 }; + 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 = filter.options; + 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; @@ -355,13 +355,13 @@ coder_init(file_pair *pair) case FORMAT_XZ: ret = lzma_stream_encoder(&strm, filters, check); break; case FORMAT_LZMA: - ret = lzma_alone_encoder(&strm, filters[0].options); + ret = lzma_alone_encoder(&strm, (lzma_options_lzma *)filters[0].options); break; case FORMAT_RAW: ret = lzma_raw_encoder(&strm, filters); break; } --- xz-5.0.3-g2++/src/xz/file_io.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/file_io.c Fri Dec 12 14:42:57 2014 @@ -515,19 +515,21 @@ io_open_src(const char *src_name) // 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, + /*.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.0.3-g2++/src/xz/main.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/main.c Fri Dec 12 14:44:56 2014 @@ -68,13 +68,13 @@ read_name(const args_info *args) // 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); + name = (char *)xmalloc(size); // Write position in name size_t pos = 0; // Read one character at a time into name. while (!user_abort) { @@ -128,13 +128,13 @@ read_name(const args_info *args) // 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); + name = (char *)xrealloc(name, size); } } return NULL; } --- xz-5.0.3-g2++/src/xz/message.c.dist Sat May 21 21:12:43 2011 +++ xz-5.0.3-g2++/src/xz/message.c Fri Dec 12 15:00:08 2014 @@ -169,25 +169,27 @@ message_init(void) } extern void message_verbosity_increase(void) { - if (verbosity < V_DEBUG) - ++verbosity; - + if (verbosity == V_SILENT ) { verbosity = V_ERROR ; return; } + if (verbosity == V_ERROR ) { verbosity = V_WARNING; return; } + if (verbosity == V_WARNING) { verbosity = V_VERBOSE; return; } + if (verbosity == V_VERBOSE) { verbosity = V_DEBUG ; return; } return; } extern void message_verbosity_decrease(void) { - if (verbosity > V_SILENT) - --verbosity; - + if (verbosity == V_DEBUG ) { verbosity = V_VERBOSE; return; } + if (verbosity == V_VERBOSE) { verbosity = V_WARNING; return; } + if (verbosity == V_WARNING) { verbosity = V_ERROR ; return; } + if (verbosity == V_ERROR ) { verbosity = V_SILENT ; return; } return; } extern enum message_verbosity message_verbosity_get(void) @@ -920,13 +922,13 @@ message_filters_to_str(char buf[FILTERS_ // 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 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: @@ -1007,26 +1009,26 @@ message_filters_to_str(char buf[FILTERS_ "ia64", "arm", "armthumb", "sparc", }; - const lzma_options_bcj *opt = filters[i].options; + 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 = filters[i].options; + const lzma_options_delta *opt = (lzma_options_delta *)filters[i].options; my_snprintf(&pos, &left, "delta=dist=%" PRIu32, opt->dist); break; } default: --- xz-5.0.3-g2++/src/xz/options.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/options.c Fri Dec 19 14:14:18 2014 @@ -149,13 +149,13 @@ enum { static void set_delta(void *options, uint32_t key, uint64_t value, const char *valuestr lzma_attribute((__unused__))) { - lzma_options_delta *opt = options; + lzma_options_delta *opt = (lzma_options_delta *)options; switch (key) { case OPT_DIST: opt->dist = value; break; } } @@ -167,17 +167,17 @@ options_delta(const char *str) 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)); + 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, + /*.type =*/ LZMA_DELTA_TYPE_BYTE, + /*.dist =*/ LZMA_DELTA_DIST_MIN, }; parse_options(str, opts, &set_delta, options); return options; } @@ -193,13 +193,13 @@ enum { static void set_bcj(void *options, uint32_t key, uint64_t value, const char *valuestr lzma_attribute((__unused__))) { - lzma_options_bcj *opt = options; + lzma_options_bcj *opt = (lzma_options_bcj *)options; switch (key) { case OPT_START_OFFSET: opt->start_offset = value; break; } } @@ -210,15 +210,15 @@ options_bcj(const char *str) { static const option_map opts[] = { { "start", NULL, 0, UINT32_MAX }, { NULL, NULL, 0, 0 } }; - lzma_options_bcj *options = xmalloc(sizeof(lzma_options_bcj)); + lzma_options_bcj *options = (lzma_options_bcj *)xmalloc(sizeof(lzma_options_bcj)); *options = (lzma_options_bcj){ - .start_offset = 0, + /*.start_offset =*/ 0, }; parse_options(str, opts, &set_bcj, options); return options; } @@ -248,13 +248,13 @@ error_lzma_preset(const char *valuestr) } static void set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr) { - lzma_options_lzma *opt = options; + lzma_options_lzma *opt = (lzma_options_lzma *)options; switch (key) { case OPT_PRESET: { if (valuestr[0] < '0' || valuestr[0] > '9') error_lzma_preset(valuestr); @@ -269,13 +269,13 @@ set_lzma(void *options, uint32_t key, ui error_lzma_preset(valuestr); if (valuestr[2] != '\0') error_lzma_preset(valuestr); } - if (lzma_lzma_preset(options, preset)) + if (lzma_lzma_preset((lzma_options_lzma *)options, preset)) error_lzma_preset(valuestr); break; } case OPT_DICT: @@ -292,21 +292,21 @@ set_lzma(void *options, uint32_t key, ui case OPT_PB: opt->pb = value; break; case OPT_MODE: - opt->mode = value; + opt->mode = (enum lzma_mode)value; break; case OPT_NICE: opt->nice_len = value; break; case OPT_MF: - opt->mf = value; + opt->mf = (enum lzma_match_finder)value; break; case OPT_DEPTH: opt->depth = value; break; } @@ -342,13 +342,13 @@ options_lzma(const char *str) { "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)); + 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.0.3-g2++/src/xz/suffix.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/suffix.c Fri Dec 19 14:15:27 2014 @@ -121,13 +121,13 @@ uncompressed_name(const char *src_name, 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); + 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; @@ -198,13 +198,13 @@ compressed_name(const char *src_name, co } const char *suffix = custom_suffix != NULL ? custom_suffix : suffixes[0]; const size_t suffix_len = strlen(suffix); - char *dest_name = xmalloc(src_len + suffix_len + 1); + 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.0.3-g2++/src/xz/util.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/src/xz/util.c Fri Dec 19 14:17:49 2014 @@ -36,14 +36,14 @@ xrealloc(void *ptr, size_t size) 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); + 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) { @@ -189,13 +189,19 @@ uint64_to_nicestr(uint64_t value, enum n // 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; + /*++unit*/; + switch(unit) { + case NICESTR_B: unit=NICESTR_KIB; break; + case NICESTR_KIB: unit=NICESTR_MIB; break; + case NICESTR_MIB: unit=NICESTR_GIB; break; + case NICESTR_GIB: unit=NICESTR_TIB; break; + } } 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.0.3-g2++/src/xzdec/Makefile.in.dist Sat May 21 22:59:54 2011 +++ xz-5.0.3-g2++/src/xzdec/Makefile.in Thu Dec 18 20:17:56 2014 @@ -100,13 +100,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(lzmadec_SOURCES) $(xzdec_SOURCES) DIST_SOURCES = $(am__lzmadec_SOURCES_DIST) $(am__xzdec_SOURCES_DIST) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; --- xz-5.0.3-g2++/tests/Makefile.in.dist Sat May 21 22:59:54 2011 +++ xz-5.0.3-g2++/tests/Makefile.in Thu Dec 18 20:17:11 2014 @@ -105,13 +105,13 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) +CCLD = @CCLD@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = create_compress_files.c test_block_header.c test_check.c \ test_filter_flags.c test_index.c test_stream_flags.c DIST_SOURCES = create_compress_files.c test_block_header.c \ --- xz-5.0.3-g2++/tests/test_block_header.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/tests/test_block_header.c Fri Dec 19 15:05:58 2014 @@ -18,64 +18,64 @@ static lzma_block known_options; static lzma_block decoded_options; static lzma_options_lzma opt_lzma; static lzma_filter filters_none[1] = { { - .id = LZMA_VLI_UNKNOWN, + /*.id =*/ LZMA_VLI_UNKNOWN, }, }; static lzma_filter filters_one[2] = { { - .id = LZMA_FILTER_LZMA2, - .options = &opt_lzma, + /*.id =*/ LZMA_FILTER_LZMA2, + /*.options =*/ &opt_lzma, }, { - .id = LZMA_VLI_UNKNOWN, + /*.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_X86, + /*.options =*/ NULL, }, { - .id = LZMA_FILTER_X86, - .options = NULL, + /*.id =*/ LZMA_FILTER_X86, + /*.options =*/ NULL, }, { - .id = LZMA_FILTER_LZMA2, - .options = &opt_lzma, + /*.id =*/ LZMA_FILTER_LZMA2, + /*.options =*/ &opt_lzma, }, { - .id = LZMA_VLI_UNKNOWN, + /*.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_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_FILTER_LZMA2, + /*.options =*/ &opt_lzma, }, { - .id = LZMA_VLI_UNKNOWN, + /*.id =*/ LZMA_VLI_UNKNOWN, } }; static void code(void) @@ -107,16 +107,18 @@ code(void) static void test1(void) { known_options = (lzma_block){ - .check = LZMA_CHECK_NONE, - .compressed_size = LZMA_VLI_UNKNOWN, - .uncompressed_size = LZMA_VLI_UNKNOWN, - .filters = NULL, + /*.version*/ 0, + /*.header_size*/ 0, + /*.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); @@ -124,13 +126,13 @@ test1(void) 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. + 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. @@ -152,16 +154,18 @@ test1(void) 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, + /*.version*/ 0, + /*.header_size*/ 0, + /*.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; @@ -178,16 +182,18 @@ test2(void) 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, + /*.version*/ 0, + /*.header_size*/ 0, + /*.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); --- xz-5.0.3-g2++/tests/test_check.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/tests/test_check.c Fri Dec 19 15:00:12 2014 @@ -12,14 +12,18 @@ // /////////////////////////////////////////////////////////////////////////////// #include "tests.h" -static const uint8_t test_string[9] = "123456789"; -static const uint8_t test_unaligned[12] = "xxx123456789"; +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; @@ -45,13 +49,13 @@ test_crc32(void) } static bool test_crc64(void) { - static const uint64_t test_vector = 0x995DC9BBDF1939FA; + 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.0.3-g2++/tests/test_filter_flags.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/tests/test_filter_flags.c Fri Dec 19 15:04:42 2014 @@ -95,13 +95,13 @@ test_bcj(void) 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; + lzma_options_bcj *decoded = (lzma_options_bcj *)decoded_flags.options; expect(decoded->start_offset == options.start_offset); free(decoded); } #endif @@ -114,14 +114,14 @@ test_delta(void) 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 + /*.type =*/ LZMA_DELTA_TYPE_BYTE, + /*.dist =*/ 0 }; known_flags.options = &options; expect(encode(99)); // Test 3 options.dist = LZMA_DELTA_DIST_MIN; --- xz-5.0.3-g2++/tests/test_index.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/tests/test_index.c Fri Dec 19 15:07:00 2014 @@ -209,13 +209,13 @@ test_read(lzma_index *i) static void test_code(lzma_index *i) { const size_t alloc_size = 128 * 1024; - uint8_t *buf = malloc(alloc_size); + 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); @@ -590,13 +590,13 @@ test_locate(void) static void test_corrupt(void) { const size_t alloc_size = 128 * 1024; - uint8_t *buf = malloc(alloc_size); + 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.0.3-g2++/tests/test_stream_flags.c.dist Sat May 21 21:12:31 2011 +++ xz-5.0.3-g2++/tests/test_stream_flags.c Fri Dec 19 15:04:05 2014 @@ -80,13 +80,13 @@ test_footer(void) } static void test_encode_invalid(void) { - known_flags.check = LZMA_CHECK_ID_MAX + 1; + 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) @@ -164,13 +164,13 @@ test_decode_invalid(void) int main(void) { // Valid headers known_flags.backward_size = 1024; for (lzma_check check = LZMA_CHECK_NONE; - check <= LZMA_CHECK_ID_MAX; ++check) { + check <= LZMA_CHECK_ID_MAX; check=(lzma_check)(check+1)) { test_header(); test_footer(); } // Invalid headers test_encode_invalid();