summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3')
-rw-r--r--xdelta3/xdelta3.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 8c536b3..1487864 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -477,7 +477,8 @@ IF_BUILD_DEFAULT(static const xd3_smatcher __smatcher_default;)
477#endif /* XD3_DEBUG */ 477#endif /* XD3_DEBUG */
478 478
479/* Update the run-length state */ 479/* Update the run-length state */
480#define NEXTRUN(c) do { if ((c) == run_c) { run_l += 1; } else { run_c = (c); run_l = 1; } } while (0) 480#define NEXTRUN(c) do { if ((c) == run_c) { run_l += 1; } \
481 else { run_c = (c); run_l = 1; } } while (0)
481 482
482/* Update the checksum state. */ 483/* Update the checksum state. */
483#define OLD_LARGE_CKSUM 1 484#define OLD_LARGE_CKSUM 1
@@ -493,9 +494,9 @@ IF_BUILD_DEFAULT(static const xd3_smatcher __smatcher_default;)
493#else 494#else
494#define LARGE_CKSUM_UPDATE(cksum,base,look) \ 495#define LARGE_CKSUM_UPDATE(cksum,base,look) \
495 do { \ 496 do { \
496 (cksum) = (cksum 497 // linear congruential generators of different
497linear congruential generators of different sizes and good lattice structure 498 // sizes and good lattice structure
498 } while (0) 499 } while (1)
499#endif 500#endif
500 501
501/* Multiply and add hash function */ 502/* Multiply and add hash function */
@@ -1152,9 +1153,10 @@ xd3_compute_alternate_table_encoding (xd3_stream *stream, const uint8_t **data,
1152static uint8_t __alternate_code_table_compressed[CODE_TABLE_VCDIFF_SIZE]; 1153static uint8_t __alternate_code_table_compressed[CODE_TABLE_VCDIFF_SIZE];
1153static usize_t __alternate_code_table_compressed_size; 1154static usize_t __alternate_code_table_compressed_size;
1154 1155
1155/* This function generates a delta describing the code table for encoding within a VCDIFF 1156/* This function generates a delta describing the code table for
1156 * file. This function is NOT thread safe because it is only intended that this function 1157 * encoding within a VCDIFF file. This function is NOT thread safe
1157 * is used to generate statically-compiled strings. */ 1158 * because it is only intended that this function is used to generate
1159 * statically-compiled strings. */
1158int xd3_compute_code_table_encoding (xd3_stream *in_stream, const xd3_dinst *code_table, 1160int xd3_compute_code_table_encoding (xd3_stream *in_stream, const xd3_dinst *code_table,
1159 uint8_t *comp_string, usize_t *comp_string_size) 1161 uint8_t *comp_string, usize_t *comp_string_size)
1160{ 1162{
@@ -2660,8 +2662,9 @@ xd3_close_stream (xd3_stream *stream)
2660 { 2662 {
2661 case DEC_VCHEAD: 2663 case DEC_VCHEAD:
2662 case DEC_WININD: 2664 case DEC_WININD:
2663 /* TODO: Address the zero-byte ambiguity. Does the encoder emit a window or 2665 /* TODO: Address the zero-byte ambiguity. Does the encoder
2664 * not? If so, then catch an error here. If not, need another routine to say 2666 * emit a window or not? If so, then catch an error here.
2667 * If not, need another routine to say
2665 * decode_at_least_one_if_empty. */ 2668 * decode_at_least_one_if_empty. */
2666 case DEC_ABORTED: 2669 case DEC_ABORTED:
2667 break; 2670 break;
@@ -4091,8 +4094,9 @@ xd3_string_match_init (xd3_stream *stream)
4091 if (stream->small_table != NULL) 4094 if (stream->small_table != NULL)
4092 { 4095 {
4093 /* The target hash table is reinitialized once per window. */ 4096 /* The target hash table is reinitialized once per window. */
4094 /* TODO: This would not have to be reinitialized if absolute offsets 4097 /* TODO: This would not have to be reinitialized if absolute
4095 * were being stored, as we would do for VCD_TARGET encoding. */ 4098 * offsets were being stored, as we would do for VCD_TARGET
4099 * encoding. */
4096 if (stream->small_reset) 4100 if (stream->small_reset)
4097 { 4101 {
4098 stream->small_reset = 0; 4102 stream->small_reset = 0;