diff options
author | yang.zhang <y0169.zhang@samsung.com> | 2016-05-18 11:25:47 +0800 |
---|---|---|
committer | yang.zhang <y0169.zhang@samsung.com> | 2016-05-18 11:27:16 +0800 |
commit | 41c06420b9ff028fd452cec19ac1412be665673f (patch) | |
tree | ece29e014e212b56654888fa3f95f50625164919 /xdelta3-merge.h | |
parent | a96d62621beefe4aa20b696744be6325bc536fb6 (diff) | |
download | xdelta3-release-20160531.tar.gz xdelta3-release-20160531.tar.bz2 xdelta3-release-20160531.zip |
Imported upstream 3.0.8HEADsubmit/trunk/20191101.102136submit/trunk/20191030.112603submit/trunk/20191017.233826submit/trunk/20191017.111201submit/trunk/20190927.012842accepted/tools/devbase/tools/legacy/20240424.050617accepted/tools/devbase/tools/legacy/20240423.040635accepted/tools/devbase/tools/legacy/20240422.110744accepted/tizen/devbase/tools/20190927.044910spin-release-latestrelease-20161231release-20160930release-20160615release-20160531masterdevel_psk_20160727develaccepted/tools_devbase_tools_legacyaccepted/tizen_devbase_tools
Change-Id: I8423a2e4bed8a15b862b6b1ab6f6371c92e78b3f
Diffstat (limited to 'xdelta3-merge.h')
-rw-r--r-- | xdelta3-merge.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/xdelta3-merge.h b/xdelta3-merge.h index 6e46a3d..e65978d 100644 --- a/xdelta3-merge.h +++ b/xdelta3-merge.h @@ -258,8 +258,8 @@ xd3_whole_append_window (xd3_stream *stream) /* xd3_merge_input_output applies *source to *stream, returns the * result in stream. */ -static int xd3_merge_input_output (xd3_stream *stream, - xd3_whole_state *source) +int xd3_merge_input_output (xd3_stream *stream, + xd3_whole_state *source) { int ret; xd3_stream tmp_stream; @@ -446,7 +446,7 @@ xd3_merge_source_copy (xd3_stream *stream, XD3_ASSERT (sinst->size > sinst_offset); sinst_left = sinst->size - sinst_offset; - this_take = xd3_min (iinst.size, sinst_left); + this_take = min (iinst.size, sinst_left); XD3_ASSERT (this_take > 0); @@ -492,15 +492,10 @@ xd3_merge_source_copy (xd3_stream *stream, } else { - // Note: A better implementation will construct the - // mapping of output ranges, starting from the input - // range, applying deltas in forward order, using an - // interval tree. This code uses recursion to construct - // each copied range, recursively (using binary search - // in xd3_merge_find_position). - // - // TODO: This code can cause stack overflow. Fix as - // described above. + // TODO: this is slow because of the recursion, which + // could reach a depth equal to the number of target + // copies, and this is compression-inefficient because + // it can produce duplicate adds. xd3_winst tinst; tinst.type = XD3_CPY; tinst.mode = iinst.mode; @@ -560,14 +555,12 @@ int xd3_merge_inputs (xd3_stream *stream, ret = xd3_merge_add (stream, input, iinst); break; default: - if (iinst->mode == 0) + /* TODO: VCD_TARGET support is completely untested all + * throughout. */ + if (iinst->mode == 0 || iinst->mode == VCD_TARGET) { ret = xd3_merge_target_copy (stream, iinst); } - else if (iinst->mode == VCD_TARGET) - { - ret = XD3_INVALID_INPUT; - } else { ret = xd3_merge_source_copy (stream, source, iinst); |