45 rs_trace(
"emit DELTA magic");
53 int param_len = rs_int_len(len);
56 cmd = RS_OP_LITERAL_N1;
57 else if (param_len == 2)
58 cmd = RS_OP_LITERAL_N2;
60 assert(param_len == 4);
61 cmd = RS_OP_LITERAL_N4;
64 rs_trace(
"emit LITERAL_N%d(len=%d), cmd_byte=%#04x", param_len, len, cmd);
81 const int where_bytes = rs_int_len(where);
82 const int len_bytes = rs_int_len(len);
86 cmd = RS_OP_COPY_N8_N1;
87 else if (where_bytes == 4)
88 cmd = RS_OP_COPY_N4_N1;
89 else if (where_bytes == 2)
90 cmd = RS_OP_COPY_N2_N1;
92 assert(where_bytes == 1);
93 cmd = RS_OP_COPY_N1_N1;
97 else if (len_bytes == 2)
99 else if (len_bytes == 4)
102 assert(len_bytes == 8);
106 rs_trace(
"emit COPY_N%d_N%d(where=" FMT_LONG
", len=" FMT_LONG
107 "), cmd_byte=%#04x", where_bytes, len_bytes, where, len, cmd);
113 stats->copy_bytes += len;
114 stats->copy_cmdbytes += 1 + where_bytes + len_bytes;
124 rs_trace(
"emit END, cmd_byte=%#04x", cmd);
rs_long_t lit_cmdbytes
Number of bytes used in literal command headers.
void rs_emit_delta_header(rs_job_t *job)
Write the magic for the start of a delta.
Types of commands present in the encoding stream.
rs_result rs_squirt_netint(rs_job_t *job, rs_long_t d, int len)
Write a variable-length integer to a stream.
void rs_emit_end_cmd(rs_job_t *job)
Write an END command.
rs_stats_t stats
Encoding statistics.
Public header for librsync.
int lit_cmds
Number of literal commands.
rs_long_t lit_bytes
Number of literal bytes.
Performance statistics from a librsync encoding or decoding operation.
How to emit commands to the client.
void rs_emit_copy_cmd(rs_job_t *job, rs_long_t where, rs_long_t len)
Write a COPY command for given offset and length.
rs_result rs_squirt_byte(rs_job_t *job, unsigned char d)
Write a single byte to a stream output.
void rs_emit_literal_cmd(rs_job_t *job, int len)
Write a LITERAL command.
of this structure are private.