summaryrefslogtreecommitdiff
path: root/rsync/delta.c
Unidiff
Diffstat (limited to 'rsync/delta.c') (more/less context) (ignore whitespace changes)
-rw-r--r--rsync/delta.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rsync/delta.c b/rsync/delta.c
index 323c079..42f3afb 100644
--- a/rsync/delta.c
+++ b/rsync/delta.c
@@ -290,62 +290,64 @@ static rs_result rs_delta_s_slack(rs_job_t *job)
290 return RS_RUNNING; 290 return RS_RUNNING;
291 } else { 291 } else {
292 if (rs_job_input_is_ending(job)) { 292 if (rs_job_input_is_ending(job)) {
293 job->statefn = rs_delta_s_end; 293 job->statefn = rs_delta_s_end;
294 return RS_RUNNING; 294 return RS_RUNNING;
295 } else { 295 } else {
296 return RS_BLOCKED; 296 return RS_BLOCKED;
297 } 297 }
298 } 298 }
299} 299}
300 300
301 301
302/** 302/**
303 * State function for writing out the header of the encoding job. 303 * State function for writing out the header of the encoding job.
304 */ 304 */
305static rs_result rs_delta_s_header(rs_job_t *job) 305static rs_result rs_delta_s_header(rs_job_t *job)
306{ 306{
307 rs_emit_delta_header(job); 307 rs_emit_delta_header(job);
308 308
309 if (job->block_len) { 309 if (job->block_len) {
310 if (!job->signature) { 310 if (!job->signature) {
311 rs_error("no signature is loaded into the job"); 311 rs_error("no signature is loaded into the job");
312 return RS_PARAM_ERROR; 312 return RS_PARAM_ERROR;
313 } 313 }
314 job->statefn = rs_delta_s_scan; 314 job->statefn = rs_delta_s_scan;
315 } else { 315 } else {
316 rs_trace("block length is zero for this delta; " 316 rs_trace("block length is zero for this delta; "
317 "therefore using slack deltas"); 317 "therefore using slack deltas");
318 job->statefn = rs_delta_s_slack; 318 job->statefn = rs_delta_s_slack;
319 } 319 }
320 320
321 return RS_RUNNING; 321 return RS_RUNNING;
322} 322}
323 323
324 324
325/** 325/**
326 * Prepare to compute a streaming delta. 326 * Prepare to compute a streaming delta.
327 */ 327 */
328rs_job_t *rs_delta_begin(rs_signature_t *sig) 328rs_job_t *rs_delta_begin(rs_signature_t *sig)
329{ 329{
330 rs_job_t *job; 330 rs_job_t *job;
331 331
332 job = rs_job_new("delta", rs_delta_s_header); 332 job = rs_job_new("delta", rs_delta_s_header);
333 job->signature = sig; 333 job->signature = sig;
334 334
335 if ((job->block_len = sig->block_len) < 0) { 335 if ((job->block_len = sig->block_len) < 0) {
336 rs_log(RS_LOG_ERR, "unreasonable block_len %d in signature", 336 rs_log(RS_LOG_ERR, "unreasonable block_len %d in signature",
337 job->block_len); 337 job->block_len);
338 rs_job_free(job);
338 return NULL; 339 return NULL;
339 } 340 }
340 341
341 job->strong_sum_len = sig->strong_sum_len; 342 job->strong_sum_len = sig->strong_sum_len;
342 if (job->strong_sum_len < 0 || job->strong_sum_len > RS_MD4_LENGTH) { 343 if (job->strong_sum_len < 0 || job->strong_sum_len > RS_MD4_LENGTH) {
343 rs_log(RS_LOG_ERR, "unreasonable strong_sum_len %d in signature", 344 rs_log(RS_LOG_ERR, "unreasonable strong_sum_len %d in signature",
344 job->strong_sum_len); 345 job->strong_sum_len);
346 rs_job_free(job);
345 return NULL; 347 return NULL;
346 } 348 }
347 349
348 return job; 350 return job;
349} 351}
350 352
351 353