mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* misc.c (compress_algo_to_string, string_to_compress_algo,
check_compress_algo): Add bzip2. * compress.c (compress_filter): Make static to help force the use of push_compress_filter. Remove default algorithm setting since that is done in push_compress_filter now. * main.h: Use named algorithm. * filter.h, compress.c (push_compress_filter, push_compress_filter2): New. Figure out which is the appropriate compression filter to use, and push it into place. * compress.c (handle_compressed), encode.c (encode_simple, encode_crypt), sign.c (sign_file, sign_symencrypt_file), import.c (read_block), export.c (do_export): Use push_compress_filter instead of pushing the compression filter ourselves. * compress-bz2.c: New. Bzlib versions of the compression filter routines. * Makefile.am: Include compress-bz2.c if bz2lib is available.
This commit is contained in:
parent
8d82e1af00
commit
869c6bb7e4
12 changed files with 366 additions and 40 deletions
25
g10/misc.c
25
g10/misc.c
|
@ -548,17 +548,23 @@ compress_algo_to_string(int algo)
|
|||
|
||||
switch(algo)
|
||||
{
|
||||
case 0:
|
||||
case COMPRESS_ALGO_NONE:
|
||||
s="Uncompressed";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case COMPRESS_ALGO_ZIP:
|
||||
s="ZIP";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case COMPRESS_ALGO_ZLIB:
|
||||
s="ZLIB";
|
||||
break;
|
||||
|
||||
#ifdef HAVE_BZIP2
|
||||
case COMPRESS_ALGO_BZIP2:
|
||||
s="BZIP2";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return s;
|
||||
|
@ -573,12 +579,20 @@ string_to_compress_algo(const char *string)
|
|||
return 1;
|
||||
else if(ascii_strcasecmp(string,"zlib")==0)
|
||||
return 2;
|
||||
#ifdef HAVE_BZIP2
|
||||
else if(ascii_strcasecmp(string,"bzip2")==0)
|
||||
return 3;
|
||||
#endif
|
||||
else if(ascii_strcasecmp(string,"z0")==0)
|
||||
return 0;
|
||||
else if(ascii_strcasecmp(string,"z1")==0)
|
||||
return 1;
|
||||
else if(ascii_strcasecmp(string,"z2")==0)
|
||||
return 2;
|
||||
#ifdef HAVE_BZIP2
|
||||
else if(ascii_strcasecmp(string,"z3")==0)
|
||||
return 3;
|
||||
#endif
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
@ -586,8 +600,13 @@ string_to_compress_algo(const char *string)
|
|||
int
|
||||
check_compress_algo(int algo)
|
||||
{
|
||||
#ifdef HAVE_BZIP2
|
||||
if(algo>=0 && algo<=3)
|
||||
return 0;
|
||||
#else
|
||||
if(algo>=0 && algo<=2)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return G10ERR_COMPR_ALGO;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue