Merging upstream version 1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d24d609a01
commit
a2dab4fd78
10 changed files with 48 additions and 39 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,19 +1,8 @@
|
||||||
2010-03-13 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
* Version 1.0-rc3 released.
|
* Version 1.0 released.
|
||||||
* decoder.h: Input_buffer integrated in Range_decoder.
|
|
||||||
|
|
||||||
2010-02-21 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* Version 1.0-rc2 released.
|
|
||||||
* Code cleanup.
|
|
||||||
* clzip.h: Fixed warnings produced by over-optimization (-O3).
|
|
||||||
|
|
||||||
2010-02-14 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* Version 1.0-rc1 released.
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
* Translated to C from the C++ source for lzip 1.10-rc1.
|
* Translated to C from the C++ source for lzip 1.10.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2010 Antonio Diaz Diaz.
|
Copyright (C) 2010 Antonio Diaz Diaz.
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -2,4 +2,4 @@ Changes in version 1.0:
|
||||||
|
|
||||||
Initial release.
|
Initial release.
|
||||||
|
|
||||||
Translated to C from the C++ source for lzip 1.10-rc3.
|
Translated to C from the C++ source for lzip 1.10.
|
||||||
|
|
5
README
5
README
|
@ -6,6 +6,11 @@ gzip or bzip2. Clzip decompresses almost as fast as gzip and compresses
|
||||||
better than bzip2, which makes it well suited for software distribution
|
better than bzip2, which makes it well suited for software distribution
|
||||||
and data archiving.
|
and data archiving.
|
||||||
|
|
||||||
|
Clzip uses the lzip file format; the files produced by clzip are fully
|
||||||
|
compatible with lzip-1.4 or newer. Clzip is in fact a C language version
|
||||||
|
of lzip, intended for embedded devices or systems lacking a C++
|
||||||
|
compiler.
|
||||||
|
|
||||||
Clzip replaces every file given in the command line with a compressed
|
Clzip replaces every file given in the command line with a compressed
|
||||||
version of itself, with the name "original_name.lz". Each compressed
|
version of itself, with the name "original_name.lz". Each compressed
|
||||||
file has the same modification date, permissions, and, when possible,
|
file has the same modification date, permissions, and, when possible,
|
||||||
|
|
4
configure
vendored
4
configure
vendored
|
@ -5,12 +5,12 @@
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
# Date of this version: 2010-03-13
|
# Date of this version: 2010-04-05
|
||||||
|
|
||||||
args=
|
args=
|
||||||
no_create=
|
no_create=
|
||||||
pkgname=clzip
|
pkgname=clzip
|
||||||
pkgversion=1.0-rc3
|
pkgversion=1.0
|
||||||
progname=clzip
|
progname=clzip
|
||||||
srctrigger=clzip.h
|
srctrigger=clzip.h
|
||||||
|
|
||||||
|
|
11
decoder.c
11
decoder.c
|
@ -63,7 +63,7 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder,
|
||||||
struct Pretty_print * const pp )
|
struct Pretty_print * const pp )
|
||||||
{
|
{
|
||||||
File_trailer trailer;
|
File_trailer trailer;
|
||||||
const int trailer_size = Ft_versioned_size( decoder->format_version );
|
const int trailer_size = Ft_versioned_size( decoder->member_version );
|
||||||
const long long member_size = LZd_member_position( decoder ) + trailer_size;
|
const long long member_size = LZd_member_position( decoder ) + trailer_size;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder,
|
||||||
for( ; i < trailer_size; ++i ) trailer[i] = 0;
|
for( ; i < trailer_size; ++i ) trailer[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( decoder->format_version == 0 ) Ft_set_member_size( trailer, member_size );
|
if( decoder->member_version == 0 ) Ft_set_member_size( trailer, member_size );
|
||||||
if( !Rd_code_is_zero( decoder->range_decoder ) )
|
if( !Rd_code_is_zero( decoder->range_decoder ) )
|
||||||
{
|
{
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -153,10 +153,11 @@ int LZd_decode_member( struct LZ_decoder * const decoder,
|
||||||
{
|
{
|
||||||
const uint8_t prev_byte = LZd_get_byte( decoder, 0 );
|
const uint8_t prev_byte = LZd_get_byte( decoder, 0 );
|
||||||
if( St_is_char( state ) )
|
if( St_is_char( state ) )
|
||||||
LZd_put_byte( decoder, Lid_decode( &decoder->literal_decoder, decoder->range_decoder, prev_byte ) );
|
LZd_put_byte( decoder, Lid_decode( &decoder->literal_decoder,
|
||||||
|
decoder->range_decoder, prev_byte ) );
|
||||||
else
|
else
|
||||||
LZd_put_byte( decoder, Lid_decode_matched( &decoder->literal_decoder, decoder->range_decoder, prev_byte,
|
LZd_put_byte( decoder, Lid_decode_matched( &decoder->literal_decoder,
|
||||||
LZd_get_byte( decoder, rep0 ) ) );
|
decoder->range_decoder, prev_byte, LZd_get_byte( decoder, rep0 ) ) );
|
||||||
St_set_char( &state );
|
St_set_char( &state );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,7 +43,7 @@ static inline void Rd_init( struct Range_decoder * const rdec, const int infd )
|
||||||
rdec->pos = 0;
|
rdec->pos = 0;
|
||||||
rdec->stream_pos = 0;
|
rdec->stream_pos = 0;
|
||||||
rdec->code = 0;
|
rdec->code = 0;
|
||||||
rdec->range = 0xFFFFFFFF;
|
rdec->range = 0xFFFFFFFFU;
|
||||||
rdec->infd_ = infd;
|
rdec->infd_ = infd;
|
||||||
rdec->at_stream_end = false;
|
rdec->at_stream_end = false;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ static inline uint8_t Lid_decode_matched( struct Literal_decoder * const literal
|
||||||
struct LZ_decoder
|
struct LZ_decoder
|
||||||
{
|
{
|
||||||
long long partial_data_pos;
|
long long partial_data_pos;
|
||||||
int format_version;
|
int member_version;
|
||||||
int dictionary_size;
|
int dictionary_size;
|
||||||
int buffer_size;
|
int buffer_size;
|
||||||
uint8_t * buffer;
|
uint8_t * buffer;
|
||||||
|
@ -313,7 +313,7 @@ static inline void LZd_init( struct LZ_decoder * const decoder,
|
||||||
struct Range_decoder * const rdec, const int outfd )
|
struct Range_decoder * const rdec, const int outfd )
|
||||||
{
|
{
|
||||||
decoder->partial_data_pos = 0;
|
decoder->partial_data_pos = 0;
|
||||||
decoder->format_version = Fh_version( header );
|
decoder->member_version = Fh_version( header );
|
||||||
decoder->dictionary_size = Fh_get_dictionary_size( header );
|
decoder->dictionary_size = Fh_get_dictionary_size( header );
|
||||||
decoder->buffer_size = max( 65536, decoder->dictionary_size );
|
decoder->buffer_size = max( 65536, decoder->dictionary_size );
|
||||||
decoder->buffer = (uint8_t *)malloc( decoder->buffer_size );
|
decoder->buffer = (uint8_t *)malloc( decoder->buffer_size );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
||||||
.TH CLZIP "1" "March 2010" "Clzip 1.0-rc3" "User Commands"
|
.TH CLZIP "1" "April 2010" "Clzip 1.0" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Clzip \- data compressor based on the LZMA algorithm
|
Clzip \- data compressor based on the LZMA algorithm
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -66,6 +66,7 @@ Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,
|
||||||
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
|
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
|
||||||
.SH "REPORTING BUGS"
|
.SH "REPORTING BUGS"
|
||||||
Report bugs to lzip\-bug@nongnu.org
|
Report bugs to lzip\-bug@nongnu.org
|
||||||
|
.br
|
||||||
Clzip home page: http://www.nongnu.org/lzip/clzip.html
|
Clzip home page: http://www.nongnu.org/lzip/clzip.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2010 Antonio Diaz Diaz.
|
Copyright \(co 2010 Antonio Diaz Diaz.
|
||||||
|
|
|
@ -12,7 +12,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir)
|
||||||
Clzip Manual
|
Clzip Manual
|
||||||
************
|
************
|
||||||
|
|
||||||
This manual is for Clzip (version 1.0-rc3, 13 March 2010).
|
This manual is for Clzip (version 1.0, 5 April 2010).
|
||||||
|
|
||||||
* Menu:
|
* Menu:
|
||||||
|
|
||||||
|
@ -42,6 +42,11 @@ gzip or bzip2. Clzip decompresses almost as fast as gzip and compresses
|
||||||
better than bzip2, which makes it well suited for software distribution
|
better than bzip2, which makes it well suited for software distribution
|
||||||
and data archiving.
|
and data archiving.
|
||||||
|
|
||||||
|
Clzip uses the lzip file format; the files produced by clzip are
|
||||||
|
fully compatible with lzip-1.4 or newer. Clzip is in fact a C language
|
||||||
|
version of lzip, intended for embedded devices or systems lacking a C++
|
||||||
|
compiler.
|
||||||
|
|
||||||
Clzip replaces every file given in the command line with a compressed
|
Clzip replaces every file given in the command line with a compressed
|
||||||
version of itself, with the name "original_name.lz". Each compressed
|
version of itself, with the name "original_name.lz". Each compressed
|
||||||
file has the same modification date, permissions, and, when possible,
|
file has the same modification date, permissions, and, when possible,
|
||||||
|
@ -432,12 +437,12 @@ Concept Index
|
||||||
|
|
||||||
Tag Table:
|
Tag Table:
|
||||||
Node: Top226
|
Node: Top226
|
||||||
Node: Introduction835
|
Node: Introduction830
|
||||||
Node: Algorithm4160
|
Node: Algorithm4377
|
||||||
Node: Invoking Clzip6391
|
Node: Invoking Clzip6608
|
||||||
Node: File Format10747
|
Node: File Format10964
|
||||||
Node: Examples12703
|
Node: Examples12920
|
||||||
Node: Problems13880
|
Node: Problems14097
|
||||||
Node: Concept Index14406
|
Node: Concept Index14623
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
@finalout
|
@finalout
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
@set UPDATED 13 March 2010
|
@set UPDATED 5 April 2010
|
||||||
@set VERSION 1.0-rc3
|
@set VERSION 1.0
|
||||||
|
|
||||||
@dircategory Data Compression
|
@dircategory Data Compression
|
||||||
@direntry
|
@direntry
|
||||||
|
@ -58,6 +58,11 @@ gzip or bzip2. Clzip decompresses almost as fast as gzip and compresses
|
||||||
better than bzip2, which makes it well suited for software distribution
|
better than bzip2, which makes it well suited for software distribution
|
||||||
and data archiving.
|
and data archiving.
|
||||||
|
|
||||||
|
Clzip uses the lzip file format; the files produced by clzip are fully
|
||||||
|
compatible with lzip-1.4 or newer. Clzip is in fact a C language version
|
||||||
|
of lzip, intended for embedded devices or systems lacking a C++
|
||||||
|
compiler.
|
||||||
|
|
||||||
Clzip replaces every file given in the command line with a compressed
|
Clzip replaces every file given in the command line with a compressed
|
||||||
version of itself, with the name "original_name.lz". Each compressed
|
version of itself, with the name "original_name.lz". Each compressed
|
||||||
file has the same modification date, permissions, and, when possible,
|
file has the same modification date, permissions, and, when possible,
|
||||||
|
|
7
main.c
7
main.c
|
@ -82,6 +82,7 @@ enum Mode { m_compress = 0, m_decompress, m_test };
|
||||||
|
|
||||||
char * output_filename = 0;
|
char * output_filename = 0;
|
||||||
int outfd = -1;
|
int outfd = -1;
|
||||||
|
mode_t outfd_mode = S_IRUSR | S_IWUSR;
|
||||||
bool delete_output_on_interrupt = false;
|
bool delete_output_on_interrupt = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,8 +321,7 @@ static bool open_outstream( const bool force )
|
||||||
int flags = O_CREAT | O_WRONLY | o_binary;
|
int flags = O_CREAT | O_WRONLY | o_binary;
|
||||||
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
|
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
|
||||||
|
|
||||||
outfd = open( output_filename, flags,
|
outfd = open( output_filename, flags, outfd_mode );
|
||||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
|
|
||||||
if( outfd < 0 )
|
if( outfd < 0 )
|
||||||
{
|
{
|
||||||
if( errno == EEXIST ) outfd = -2; else outfd = -1;
|
if( errno == EEXIST ) outfd = -2; else outfd = -1;
|
||||||
|
@ -600,6 +600,7 @@ void cleanup_and_fail( const int retval )
|
||||||
{
|
{
|
||||||
if( delete_output_on_interrupt )
|
if( delete_output_on_interrupt )
|
||||||
{
|
{
|
||||||
|
delete_output_on_interrupt = false;
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 0 )
|
||||||
fprintf( stderr, "%s: Deleting output file `%s', if it exists.\n",
|
fprintf( stderr, "%s: Deleting output file `%s', if it exists.\n",
|
||||||
program_name, output_filename );
|
program_name, output_filename );
|
||||||
|
@ -831,6 +832,7 @@ int main( const int argc, const char * const argv[] )
|
||||||
strlen( default_output_filename ) + 1 );
|
strlen( default_output_filename ) + 1 );
|
||||||
strcpy( output_filename, default_output_filename );
|
strcpy( output_filename, default_output_filename );
|
||||||
}
|
}
|
||||||
|
outfd_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||||
if( !open_outstream( force ) )
|
if( !open_outstream( force ) )
|
||||||
{
|
{
|
||||||
if( outfd == -1 && retval < 1 ) retval = 1;
|
if( outfd == -1 && retval < 1 ) retval = 1;
|
||||||
|
@ -855,6 +857,7 @@ int main( const int argc, const char * const argv[] )
|
||||||
if( program_mode == m_compress )
|
if( program_mode == m_compress )
|
||||||
set_c_outname( input_filename, volume_size != LLONG_MAX );
|
set_c_outname( input_filename, volume_size != LLONG_MAX );
|
||||||
else set_d_outname( input_filename, eindex );
|
else set_d_outname( input_filename, eindex );
|
||||||
|
outfd_mode = S_IRUSR | S_IWUSR;
|
||||||
if( !open_outstream( force ) )
|
if( !open_outstream( force ) )
|
||||||
{
|
{
|
||||||
if( outfd == -1 && retval < 1 ) retval = 1;
|
if( outfd == -1 && retval < 1 ) retval = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue