33 rs_trace(
"emit DELTA magic");
37void rs_emit_literal_cmd(
rs_job_t *job,
int len)
40 int param_len = len <= 64 ? 0 : rs_int_len(len);
44 rs_trace(
"emit LITERAL_%d, cmd_byte=%#04x", len, cmd);
45 }
else if (param_len == 1) {
46 cmd = RS_OP_LITERAL_N1;
47 rs_trace(
"emit LITERAL_N1(len=%d), cmd_byte=%#04x", len, cmd);
48 }
else if (param_len == 2) {
49 cmd = RS_OP_LITERAL_N2;
50 rs_trace(
"emit LITERAL_N2(len=%d), cmd_byte=%#04x", len, cmd);
52 assert(param_len == 4);
53 cmd = RS_OP_LITERAL_N4;
54 rs_trace(
"emit LITERAL_N4(len=%d), cmd_byte=%#04x", len, cmd);
57 rs_squirt_byte(job, (rs_byte_t)cmd);
59 rs_squirt_netint(job, len, param_len);
66void rs_emit_copy_cmd(
rs_job_t *job, rs_long_t where, rs_long_t len)
70 const int where_bytes = rs_int_len(where);
71 const int len_bytes = rs_int_len(len);
75 cmd = RS_OP_COPY_N8_N1;
76 else if (where_bytes == 4)
77 cmd = RS_OP_COPY_N4_N1;
78 else if (where_bytes == 2)
79 cmd = RS_OP_COPY_N2_N1;
81 assert(where_bytes == 1);
82 cmd = RS_OP_COPY_N1_N1;
85 else if (len_bytes == 2)
87 else if (len_bytes == 4)
90 assert(len_bytes == 8);
94 rs_trace(
"emit COPY_N%d_N%d(where=" FMT_LONG
", len=" FMT_LONG
95 "), cmd_byte=%#04x", where_bytes, len_bytes, where, len, cmd);
96 rs_squirt_byte(job, (rs_byte_t)cmd);
97 rs_squirt_netint(job, where, where_bytes);
98 rs_squirt_netint(job, len, len_bytes);
101 stats->copy_bytes += len;
102 stats->copy_cmdbytes += 1 + where_bytes + len_bytes;
109 rs_trace(
"emit END, cmd_byte=%#04x", cmd);
110 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.