#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
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";
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],
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);
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;
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;
}
if (sparse_files)
argstr[x++] = 'S';
- if (do_compression == 1)
+ if (do_compression == CPRES_ZLIB)
argstr[x++] = 'z';
set_allow_inc_recurse();
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)
#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;
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 */
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 {
{
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;
}
*/
void see_token(char *data, int32 toklen)
{
- if (do_compression == 1)
+ if (do_compression == CPRES_ZLIB)
see_deflate_token(data, toklen);
}