mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-05-24 14:55:46 -04:00
Use write_ndx() and read_ndx().
This commit is contained in:
8
flist.c
8
flist.c
@@ -1300,7 +1300,7 @@ void send_extra_file_list(int f, int at_least)
|
||||
flist = flist_new(0, "send_extra_file_list");
|
||||
start_write = stats.total_written;
|
||||
|
||||
write_int(f, NDX_FLIST_OFFSET - send_dir_ndx);
|
||||
write_ndx(f, NDX_FLIST_OFFSET - send_dir_ndx);
|
||||
change_local_filter_dir(fbuf, dlen, send_dir_depth);
|
||||
send_directory(f, flist, send_dir_ndx, fbuf, dlen, FLAG_DIVERT_DIRS | FLAG_XFER_DIR);
|
||||
write_byte(f, 0);
|
||||
@@ -1319,7 +1319,7 @@ void send_extra_file_list(int f, int at_least)
|
||||
} else {
|
||||
while (DIR_NEXT_SIBLING(dp) < 0) {
|
||||
if ((send_dir_ndx = DIR_PARENT(dp)) < 0) {
|
||||
write_int(f, NDX_FLIST_EOF);
|
||||
write_ndx(f, NDX_FLIST_EOF);
|
||||
flist_eof = 1;
|
||||
change_local_filter_dir(NULL, 0, 0);
|
||||
goto finish;
|
||||
@@ -1630,7 +1630,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
|
||||
* was just 1 item in the first file-list, send 1 more
|
||||
* file-list to check if this is a 1-file xfer. */
|
||||
if (send_dir_ndx < 0)
|
||||
write_int(f, NDX_DONE);
|
||||
write_ndx(f, NDX_DONE);
|
||||
else
|
||||
send_extra_file_list(f, 1);
|
||||
}
|
||||
@@ -1743,7 +1743,7 @@ struct file_list *recv_file_list(int f)
|
||||
void recv_additional_file_list(int f)
|
||||
{
|
||||
struct file_list *flist;
|
||||
int ndx = read_int(f);
|
||||
int ndx = read_ndx(f);
|
||||
if (ndx == NDX_DONE) {
|
||||
flist_eof = 1;
|
||||
change_local_filter_dir(NULL, 0, 0);
|
||||
|
||||
16
generator.c
16
generator.c
@@ -554,7 +554,7 @@ void itemize(struct file_struct *file, int ndx, int statret,
|
||||
|| stdout_format_has_i > 1 || (xname && *xname)) && !read_batch) {
|
||||
if (protocol_version >= 29) {
|
||||
if (ndx >= 0)
|
||||
write_int(sock_f_out, ndx + cur_flist->ndx_start);
|
||||
write_ndx(sock_f_out, ndx + cur_flist->ndx_start);
|
||||
write_shortint(sock_f_out, iflags);
|
||||
if (iflags & ITEM_BASIS_TYPE_FOLLOWS)
|
||||
write_byte(sock_f_out, fnamecmp_type);
|
||||
@@ -1605,7 +1605,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||
file->flags |= FLAG_FILE_SENT;
|
||||
#endif
|
||||
write_int(f_out, ndx + cur_flist->ndx_start);
|
||||
write_ndx(f_out, ndx + cur_flist->ndx_start);
|
||||
if (itemizing) {
|
||||
int iflags = ITEM_TRANSFER;
|
||||
if (always_checksum > 0)
|
||||
@@ -1771,7 +1771,7 @@ void generate_files(int f_out, char *local_name)
|
||||
phase);
|
||||
}
|
||||
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
}
|
||||
|
||||
csum_length = SUM_LENGTH;
|
||||
@@ -1865,10 +1865,10 @@ void generate_files(int f_out, char *local_name)
|
||||
}
|
||||
}
|
||||
|
||||
flist_free(cur_flist);
|
||||
flist_free(first_flist); /* updates cur_flist & first_flist */
|
||||
|
||||
if (!read_batch)
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
}
|
||||
} while ((cur_flist = next_flist) != NULL);
|
||||
|
||||
@@ -1876,10 +1876,10 @@ void generate_files(int f_out, char *local_name)
|
||||
if (verbose > 2)
|
||||
rprintf(FINFO, "generate_files phase=%d\n", phase);
|
||||
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
/* Reduce round-trip lag-time for a useless delay-updates phase. */
|
||||
if (protocol_version >= 29 && !delay_updates)
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
|
||||
/* Read MSG_DONE for the redo phase (and any prior messages). */
|
||||
while (done_cnt <= 1) {
|
||||
@@ -1892,7 +1892,7 @@ void generate_files(int f_out, char *local_name)
|
||||
if (verbose > 2)
|
||||
rprintf(FINFO, "generate_files phase=%d\n", phase);
|
||||
if (delay_updates)
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
/* Read MSG_DONE for delay-updates phase & prior messages. */
|
||||
while (done_cnt == 2)
|
||||
wait_for_receiver();
|
||||
|
||||
2
main.c
2
main.c
@@ -776,7 +776,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
|
||||
io_flush(FULL_FLUSH);
|
||||
if (protocol_version >= 24) {
|
||||
/* send a final goodbye message */
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
}
|
||||
io_flush(FULL_FLUSH);
|
||||
|
||||
|
||||
2
rsync.c
2
rsync.c
@@ -105,7 +105,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr,
|
||||
|
||||
read_loop:
|
||||
while (1) {
|
||||
ndx = read_int(f_in);
|
||||
ndx = read_ndx(f_in);
|
||||
|
||||
if (ndx >= 0)
|
||||
break;
|
||||
|
||||
8
sender.c
8
sender.c
@@ -149,7 +149,7 @@ void successful_send(int ndx)
|
||||
void write_ndx_and_attrs(int f_out, int ndx, int iflags,
|
||||
uchar fnamecmp_type, char *buf, int len)
|
||||
{
|
||||
write_int(f_out, ndx);
|
||||
write_ndx(f_out, ndx);
|
||||
if (protocol_version < 29)
|
||||
return;
|
||||
write_shortint(f_out, iflags);
|
||||
@@ -191,7 +191,7 @@ void send_files(int f_in, int f_out)
|
||||
if (incremental && first_flist) {
|
||||
flist_free(first_flist);
|
||||
if (first_flist) {
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void send_files(int f_in, int f_out)
|
||||
break;
|
||||
if (verbose > 2)
|
||||
rprintf(FINFO, "send_files phase=%d\n", phase);
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -354,5 +354,5 @@ void send_files(int f_in, int f_out)
|
||||
|
||||
match_report();
|
||||
|
||||
write_int(f_out, NDX_DONE);
|
||||
write_ndx(f_out, NDX_DONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user