32 rs_trace(
"emit DELTA magic");
36void rs_emit_literal_cmd(
rs_job_t *job,
int len)
39 int param_len = len <= 64 ? 0 : rs_int_len(len);
43 rs_trace(
"emit LITERAL_%d, cmd_byte=%#04x", len, cmd);
44 }
else if (param_len == 1) {
45 cmd = RS_OP_LITERAL_N1;
46 rs_trace(
"emit LITERAL_N1(len=%d), cmd_byte=%#04x", len, cmd);
47 }
else if (param_len == 2) {
48 cmd = RS_OP_LITERAL_N2;
49 rs_trace(
"emit LITERAL_N2(len=%d), cmd_byte=%#04x", len, cmd);
51 assert(param_len == 4);
52 cmd = RS_OP_LITERAL_N4;
53 rs_trace(
"emit LITERAL_N4(len=%d), cmd_byte=%#04x", len, cmd);
56 rs_squirt_byte(job, (rs_byte_t)cmd);
58 rs_squirt_netint(job, len, param_len);
65void rs_emit_copy_cmd(
rs_job_t *job, rs_long_t where, rs_long_t len)
69 const int where_bytes = rs_int_len(where);
70 const int len_bytes = rs_int_len(len);
74 cmd = RS_OP_COPY_N8_N1;
75 else if (where_bytes == 4)
76 cmd = RS_OP_COPY_N4_N1;
77 else if (where_bytes == 2)
78 cmd = RS_OP_COPY_N2_N1;
80 assert(where_bytes == 1);
81 cmd = RS_OP_COPY_N1_N1;
84 else if (len_bytes == 2)
86 else if (len_bytes == 4)
89 assert(len_bytes == 8);
93 rs_trace(
"emit COPY_N%d_N%d(where=" FMT_LONG
", len=" FMT_LONG
94 "), cmd_byte=%#04x", where_bytes, len_bytes, where, len, cmd);
95 rs_squirt_byte(job, (rs_byte_t)cmd);
96 rs_squirt_netint(job, where, where_bytes);
97 rs_squirt_netint(job, len, len_bytes);
100 stats->copy_bytes += len;
101 stats->copy_cmdbytes += 1 + where_bytes + len_bytes;
108 rs_trace(
"emit END, cmd_byte=%#04x", cmd);
109 rs_squirt_byte(job, (rs_byte_t)cmd);
encoding output routines.
Generic state-machine interface.
Public header for librsync.
@ RS_DELTA_MAGIC
A delta file.
Network-byte-order output to the tube.
The contents of this structure are private.
rs_stats_t stats
Encoding statistics.
Performance statistics from a librsync encoding or decoding operation.
int lit_cmds
Number of literal commands.
rs_long_t lit_cmdbytes
Number of bytes used in literal command headers.
rs_long_t lit_bytes
Number of literal bytes.