Merging upstream version 1.7~pre1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
dda2aa8bae
commit
20b2675ae0
27 changed files with 1157 additions and 1534 deletions
46
lzcheck.c
46
lzcheck.c
|
@ -1,5 +1,5 @@
|
|||
/* Lzcheck - Test program for the lzlib library
|
||||
Copyright (C) 2009-2014 Antonio Diaz Diaz.
|
||||
Copyright (C) 2009-2015 Antonio Diaz Diaz.
|
||||
|
||||
This program is free software: you have unlimited permission
|
||||
to copy, distribute and modify it.
|
||||
|
@ -34,30 +34,14 @@ uint8_t mid_buffer[buffer_size];
|
|||
uint8_t out_buffer[buffer_size];
|
||||
|
||||
|
||||
int main( const int argc, const char * const argv[] )
|
||||
int lzcheck( FILE * const file, const int dictionary_size )
|
||||
{
|
||||
const int dictionary_size = 1 << 20;
|
||||
const int match_len_limit = 16;
|
||||
const unsigned long long member_size = 0x7FFFFFFFFFFFFFFFULL; /* INT64_MAX */
|
||||
struct LZ_Encoder * encoder;
|
||||
struct LZ_Decoder * decoder;
|
||||
FILE * file;
|
||||
int retval = 0;
|
||||
|
||||
if( argc < 2 )
|
||||
{
|
||||
fprintf( stderr, "Usage: lzcheck filename.txt\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
file = fopen( argv[1], "rb" );
|
||||
if( !file )
|
||||
{
|
||||
fprintf( stderr, "lzcheck: Can't open file '%s' for reading\n", argv[1] );
|
||||
return 1;
|
||||
}
|
||||
/* fprintf( stderr, "lzcheck: Testing file '%s'\n", argv[1] ); */
|
||||
|
||||
encoder = LZ_compress_open( dictionary_size, match_len_limit, member_size );
|
||||
if( !encoder || LZ_compress_errno( encoder ) != LZ_ok )
|
||||
{
|
||||
|
@ -224,6 +208,32 @@ int main( const int argc, const char * const argv[] )
|
|||
|
||||
LZ_decompress_close( decoder );
|
||||
LZ_compress_close( encoder );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int main( const int argc, const char * const argv[] )
|
||||
{
|
||||
FILE * file;
|
||||
int retval;
|
||||
|
||||
if( argc < 2 )
|
||||
{
|
||||
fprintf( stderr, "Usage: lzcheck filename.txt\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
file = fopen( argv[1], "rb" );
|
||||
if( !file )
|
||||
{
|
||||
fprintf( stderr, "lzcheck: Can't open file '%s' for reading.\n", argv[1] );
|
||||
return 1;
|
||||
}
|
||||
/* fprintf( stderr, "lzcheck: Testing file '%s'\n", argv[1] ); */
|
||||
|
||||
retval = lzcheck( file, 65535 );
|
||||
if( retval == 0 )
|
||||
{ rewind( file ); retval = lzcheck( file, 1 << 20 ); }
|
||||
fclose( file );
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue