diff options
-rw-r--r-- | compat.c | 17 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | flist.c | 2 | ||||
-rw-r--r-- | options.c | 10 | ||||
-rw-r--r-- | rsync.h | 4 | ||||
-rw-r--r-- | token.c | 11 |
6 files changed, 20 insertions, 26 deletions
@@ -87,10 +87,6 @@ int filesfrom_convert = 0; #define MAX_NSTR_STRLEN 256 -#define CPRES_NONE 0 -#define CPRES_ZLIB 1 -#define CPRES_ZLIBX 2 - struct name_num_obj valid_compressions = { "compress", NULL, NULL, 0, 0, { #ifndef EXTERNAL_ZLIB @@ -169,25 +165,20 @@ void set_allow_inc_recurse(void) void parse_compress_choice(int final_call) { - int num; - if (valid_compressions.negotiated_name) - num = valid_compressions.negotiated_num; + do_compression = valid_compressions.negotiated_num; else if (compress_choice) { struct name_num_item *nni = get_nni_by_name(&valid_compressions, compress_choice, -1); if (!nni) { rprintf(FERROR, "unknown compress name: %s\n", compress_choice); exit_cleanup(RERR_UNSUPPORTED); } - num = nni->num; + do_compression = nni->num; } else - num = CPRES_NONE; + do_compression = CPRES_NONE; - if (num == CPRES_NONE) { - do_compression = 0; + if (do_compression == CPRES_NONE) compress_choice = NULL; - } else if (num > 0) - do_compression = num != CPRES_ZLIB ? 2 : 1; if (final_call && DEBUG_GTE(NSTR, am_server ? 2 : 1)) { const char *c_s = am_server ? "Server" : "Client"; diff --git a/configure.ac b/configure.ac index 427959f3..e22e17e9 100644 --- a/configure.ac +++ b/configure.ac @@ -397,7 +397,7 @@ else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING([whether to enable the xxhash support]) +AC_MSG_CHECKING([whether to enable xxhash checksum support]) AC_ARG_ENABLE([xxhash], AS_HELP_STRING([--disable-xxhash],[disable xxhash checksums])) AH_TEMPLATE([SUPPORT_XXHASH], @@ -142,7 +142,7 @@ void init_flist(void) rprintf(FINFO, "FILE_STRUCT_LEN=%d, EXTRA_LEN=%d\n", (int)FILE_STRUCT_LEN, (int)EXTRA_LEN); } - parse_checksum_choice(1); /* Sets checksum_type && xfersum_type */ + parse_checksum_choice(1); /* Sets checksum_type & xfersum_type */ parse_compress_choice(1); /* Sets do_compression */ flist_csum_len = csum_len_for_type(checksum_type, 1); @@ -1968,7 +1968,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) if (!compress_choice && do_compression > 1) compress_choice = "zlibx"; if (compress_choice && strcasecmp(compress_choice, "auto") != 0) - parse_compress_choice(0); /* Can twiddle do_compression and possibly NULL-out compress_choice */ + parse_compress_choice(0); /* Twiddles do_compression and can possibly NULL-out compress_choice. */ else compress_choice = NULL; @@ -1983,7 +1983,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) do_compression = 0; compress_choice = NULL; } else if (!do_compression) - do_compression = 1; + do_compression = CPRES_ZLIB; if (do_compression && refused_compress) { create_refuse_error(refused_compress); return 0; @@ -2628,7 +2628,7 @@ void server_options(char **args, int *argc_p) } if (sparse_files) argstr[x++] = 'S'; - if (do_compression == 1) + if (do_compression == CPRES_ZLIB) argstr[x++] = 'z'; set_allow_inc_recurse(); @@ -2765,9 +2765,9 @@ void server_options(char **args, int *argc_p) args[ac++] = arg; } - if ((!compress_choice && do_compression > 1) || (compress_choice && strcasecmp(compress_choice, "zlibx") == 0)) + if (do_compression == CPRES_ZLIBX) args[ac++] = "--new-compress"; - else if (compress_choice && strcasecmp(compress_choice, "zlib") == 0) + else if (compress_choice && do_compression == CPRES_ZLIB) args[ac++] = "--old-compress"; else if (compress_choice) { if (asprintf(&arg, "--compress-choice=%s", compress_choice) < 0) @@ -1061,6 +1061,10 @@ typedef struct { #define ACL_READY(sx) ((sx).acc_acl != NULL) #define XATTR_READY(sx) ((sx).xattr != NULL) +#define CPRES_NONE 0 +#define CPRES_ZLIB 1 +#define CPRES_ZLIBX 2 + struct name_num_item { int num; const char *name, *main_name; @@ -300,8 +300,8 @@ static void send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset, int32 nb, int32 toklen) { - int32 n, r; static int init_done, flush_pending; + int32 n, r; if (last_token == -1) { /* initialization */ @@ -406,7 +406,7 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset, if (token == -1) { /* end of file - clean up */ write_byte(f, END_FLAG); - } else if (token != -2 && do_compression == 1) { + } else if (token != -2 && do_compression == CPRES_ZLIB) { /* Add the data in the current block to the compressor's * history and hash table. */ do { @@ -640,11 +640,10 @@ int32 recv_token(int f, char **data) { int tok; - if (!do_compression) { + if (!do_compression) tok = simple_recv_token(f,data); - } else { + else /* CPRES_ZLIB & CPRES_ZLIBX */ tok = recv_deflated_token(f, data); - } return tok; } @@ -653,6 +652,6 @@ int32 recv_token(int f, char **data) */ void see_token(char *data, int32 toklen) { - if (do_compression == 1) + if (do_compression == CPRES_ZLIB) see_deflate_token(data, toklen); } |