summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-merge.h
diff options
context:
space:
mode:
authorJosh MacDonald <josh.macdonald@gmail.com>2015-11-10 23:27:29 -0800
committerJosh MacDonald <josh.macdonald@gmail.com>2015-11-10 23:27:29 -0800
commit336f37f35beee264c22f7ce9baca1300bc292aa5 (patch)
treed15ec05f6e751f3500add4cc50c709310c104abd /xdelta3/xdelta3-merge.h
parent248b9eb093d04d769eee4dff0ad7999c39f35556 (diff)
Merge command comments; VCD_TARGET cleanup
Diffstat (limited to 'xdelta3/xdelta3-merge.h')
-rw-r--r--xdelta3/xdelta3-merge.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/xdelta3/xdelta3-merge.h b/xdelta3/xdelta3-merge.h
index 72bc892..a09f814 100644
--- a/xdelta3/xdelta3-merge.h
+++ b/xdelta3/xdelta3-merge.h
@@ -492,10 +492,15 @@ xd3_merge_source_copy (xd3_stream *stream,
492 } 492 }
493 else 493 else
494 { 494 {
495 // TODO: this is slow because of the recursion, which 495 // Note: A better implementation will construct the
496 // could reach a depth equal to the number of target 496 // mapping of output ranges, starting from the input
497 // copies, and this is compression-inefficient because 497 // range, applying deltas in forward order, using an
498 // it can produce duplicate adds. 498 // interval tree. This code uses recursion to construct
499 // each copied range, recursively (using binary search
500 // in xd3_merge_find_position).
501 //
502 // TODO: This code can cause stack overflow. Fix as
503 // described above.
499 xd3_winst tinst; 504 xd3_winst tinst;
500 tinst.type = XD3_CPY; 505 tinst.type = XD3_CPY;
501 tinst.mode = iinst.mode; 506 tinst.mode = iinst.mode;
@@ -555,12 +560,14 @@ int xd3_merge_inputs (xd3_stream *stream,
555 ret = xd3_merge_add (stream, input, iinst); 560 ret = xd3_merge_add (stream, input, iinst);
556 break; 561 break;
557 default: 562 default:
558 /* TODO: VCD_TARGET support is completely untested all 563 if (iinst->mode == 0)
559 * throughout. */
560 if (iinst->mode == 0 || iinst->mode == VCD_TARGET)
561 { 564 {
562 ret = xd3_merge_target_copy (stream, iinst); 565 ret = xd3_merge_target_copy (stream, iinst);
563 } 566 }
567 else if (iinst->mode == VCD_TARGET)
568 {
569 ret = XD3_INVALID_INPUT;
570 }
564 else 571 else
565 { 572 {
566 ret = xd3_merge_source_copy (stream, source, iinst); 573 ret = xd3_merge_source_copy (stream, source, iinst);