1
0
Fork 0

Merging upstream version 0.8.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 14:58:29 +01:00
parent bf2d3846fd
commit 5cc24ddf2c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 26 additions and 16 deletions

View file

@ -1,3 +1,8 @@
2016-01-23 Antonio Diaz Diaz <antonio@gnu.org>
* Version 0.8 released.
* Documented that lzip does not use 'literal_pos_state_bits'.
2015-07-07 Antonio Diaz Diaz <antonio@gnu.org> 2015-07-07 Antonio Diaz Diaz <antonio@gnu.org>
* Version 0.7 released. * Version 0.7 released.
@ -33,7 +38,7 @@
* Version 0.1 released. * Version 0.1 released.
Copyright (C) 2013-2015 Antonio Diaz Diaz. Copyright (C) 2013-2016 Antonio Diaz Diaz.
This file is a collection of facts, and thus it is not copyrightable, This file is a collection of facts, and thus it is not copyrightable,
but just in case, you have unlimited permission to copy, distribute and but just in case, you have unlimited permission to copy, distribute and

View file

@ -50,7 +50,7 @@ After running 'configure', you can run 'make' and 'make install' as
explained above. explained above.
Copyright (C) 2013-2015 Antonio Diaz Diaz. Copyright (C) 2013-2016 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

5
NEWS
View file

@ -1,3 +1,4 @@
Changes in version 0.7: Changes in version 0.8:
Minor changes. It has been documented that lzip does not use the LZMA parameter
'literal_pos_state_bits'.

2
README
View file

@ -45,7 +45,7 @@ range encoding), and Igor Pavlov (for putting all the above together in
LZMA). LZMA).
Copyright (C) 2013-2015 Antonio Diaz Diaz. Copyright (C) 2013-2016 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

10
configure vendored
View file

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
# configure script for Lzd - Educational decompressor for the lzip format # configure script for Lzd - Educational decompressor for the lzip format
# Copyright (C) 2013-2015 Antonio Diaz Diaz. # Copyright (C) 2013-2016 Antonio Diaz Diaz.
# #
# This configure script is free software: you have unlimited permission # This configure script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.
pkgname=lzd pkgname=lzd
pkgversion=0.7 pkgversion=0.8
progname=lzd progname=lzd
srctrigger=lzd.cc srctrigger=lzd.cc
@ -139,7 +139,7 @@ if [ -z "${no_create}" ] ; then
rm -f config.status rm -f config.status
cat > config.status << EOF cat > config.status << EOF
#! /bin/sh #! /bin/sh
# This file was generated automatically by configure. Do not edit. # This file was generated automatically by configure. Don't edit.
# Run this file to recreate the current configuration. # Run this file to recreate the current configuration.
# #
# This script is free software: you have unlimited permission # This script is free software: you have unlimited permission
@ -165,8 +165,8 @@ echo "LDFLAGS = ${LDFLAGS}"
rm -f Makefile rm -f Makefile
cat > Makefile << EOF cat > Makefile << EOF
# Makefile for Lzd - Educational decompressor for the lzip format # Makefile for Lzd - Educational decompressor for the lzip format
# Copyright (C) 2013-2015 Antonio Diaz Diaz. # Copyright (C) 2013-2016 Antonio Diaz Diaz.
# This file was generated automatically by configure. Do not edit. # This file was generated automatically by configure. Don't edit.
# #
# This Makefile is free software: you have unlimited permission # This Makefile is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.

14
lzd.cc
View file

@ -1,5 +1,5 @@
/* Lzd - Educational decompressor for the lzip format /* Lzd - Educational decompressor for the lzip format
Copyright (C) 2013-2015 Antonio Diaz Diaz. Copyright (C) 2013-2016 Antonio Diaz Diaz.
This program is free software: you have unlimited permission This program is free software: you have unlimited permission
to copy, distribute and modify it. to copy, distribute and modify it.
@ -52,6 +52,7 @@ enum {
min_dictionary_size = 1 << 12, min_dictionary_size = 1 << 12,
max_dictionary_size = 1 << 29, max_dictionary_size = 1 << 29,
literal_context_bits = 3, literal_context_bits = 3,
literal_pos_state_bits = 0, // not used
pos_state_bits = 2, pos_state_bits = 2,
pos_states = 1 << pos_state_bits, pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1, pos_state_mask = pos_states - 1,
@ -238,6 +239,7 @@ class LZ_decoder
unsigned pos; // current pos in buffer unsigned pos; // current pos in buffer
unsigned stream_pos; // first byte not yet written to stdout unsigned stream_pos; // first byte not yet written to stdout
uint32_t crc_; uint32_t crc_;
bool pos_wrapped;
void flush_data(); void flush_data();
@ -262,7 +264,8 @@ public:
buffer( new uint8_t[dictionary_size] ), buffer( new uint8_t[dictionary_size] ),
pos( 0 ), pos( 0 ),
stream_pos( 0 ), stream_pos( 0 ),
crc_( 0xFFFFFFFFU ) crc_( 0xFFFFFFFFU ),
pos_wrapped( false )
{ buffer[dictionary_size-1] = 0; } // prev_byte of first byte { buffer[dictionary_size-1] = 0; } // prev_byte of first byte
~LZ_decoder() { delete[] buffer; } ~LZ_decoder() { delete[] buffer; }
@ -284,7 +287,8 @@ void LZ_decoder::flush_data()
if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size ) if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size )
{ std::fprintf( stderr, "Write error: %s\n", std::strerror( errno ) ); { std::fprintf( stderr, "Write error: %s\n", std::strerror( errno ) );
std::exit( 1 ); } std::exit( 1 ); }
if( pos >= dictionary_size ) { partial_data_pos += pos; pos = 0; } if( pos >= dictionary_size )
{ partial_data_pos += pos; pos = 0; pos_wrapped = true; }
stream_pos = pos; stream_pos = pos;
} }
} }
@ -380,7 +384,7 @@ bool LZ_decoder::decode_member() // Returns false if error
} }
} }
state.set_match(); state.set_match();
if( rep0 >= dictionary_size || rep0 >= data_position() ) if( rep0 >= dictionary_size || ( rep0 >= pos && !pos_wrapped ) )
{ flush_data(); return false; } { flush_data(); return false; }
} }
for( int i = 0; i < len; ++i ) put_byte( peek( rep0 ) ); for( int i = 0; i < len; ++i ) put_byte( peek( rep0 ) );
@ -402,7 +406,7 @@ int main( const int argc, const char * const argv[] )
"It is not safe to use lzd for any real work.\n" "It is not safe to use lzd for any real work.\n"
"\nUsage: %s < file.lz > file\n", argv[0] ); "\nUsage: %s < file.lz > file\n", argv[0] );
std::printf( "Lzd decompresses from standard input to standard output.\n" std::printf( "Lzd decompresses from standard input to standard output.\n"
"\nCopyright (C) 2015 Antonio Diaz Diaz.\n" "\nCopyright (C) 2016 Antonio Diaz Diaz.\n"
"This is free software: you are free to change and redistribute it.\n" "This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n" "There is NO WARRANTY, to the extent permitted by law.\n"
"Report bugs to lzip-bug@nongnu.org\n" "Report bugs to lzip-bug@nongnu.org\n"

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# check script for Lzd - Educational decompressor for lzip files # check script for Lzd - Educational decompressor for lzip files
# Copyright (C) 2013-2015 Antonio Diaz Diaz. # Copyright (C) 2013-2016 Antonio Diaz Diaz.
# #
# This script is free software: you have unlimited permission # This script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.