diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 14:28:25 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 14:28:25 +0100 |
commit | 590402bb55be940310f68d14a540f2d109420a98 (patch) | |
tree | cdc1a5516a1a5217faf4ad32b4f9c5d5886ef120 | |
parent | 3989e5adf454a3ab98412b249c2c9bd2a3175ae0 (diff) | |
download | busybox-w32-590402bb55be940310f68d14a540f2d109420a98.tar.gz busybox-w32-590402bb55be940310f68d14a540f2d109420a98.tar.bz2 busybox-w32-590402bb55be940310f68d14a540f2d109420a98.zip |
unlzma: expand comments, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/libarchive/decompress_unlzma.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c index 90a428583..a9040877e 100644 --- a/archival/libarchive/decompress_unlzma.c +++ b/archival/libarchive/decompress_unlzma.c | |||
@@ -432,6 +432,21 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
432 | } | 432 | } |
433 | 433 | ||
434 | len += LZMA_MATCH_MIN_LEN; | 434 | len += LZMA_MATCH_MIN_LEN; |
435 | /* | ||
436 | * LZMA SDK has this optimized: | ||
437 | * it precalculates size and copies many bytes | ||
438 | * in a loop with simpler checks, a-la: | ||
439 | * do | ||
440 | * *(dest) = *(dest + ofs); | ||
441 | * while (++dest != lim); | ||
442 | * and | ||
443 | * do { | ||
444 | * buffer[buffer_pos++] = buffer[pos]; | ||
445 | * if (++pos == header.dict_size) | ||
446 | * pos = 0; | ||
447 | * } while (--cur_len != 0); | ||
448 | * Our code is slower (more checks per byte copy): | ||
449 | */ | ||
435 | IF_NOT_FEATURE_LZMA_FAST(string:) | 450 | IF_NOT_FEATURE_LZMA_FAST(string:) |
436 | do { | 451 | do { |
437 | uint32_t pos = buffer_pos - rep0; | 452 | uint32_t pos = buffer_pos - rep0; |
@@ -451,6 +466,9 @@ unpack_lzma_stream(transformer_state_t *xstate) | |||
451 | } while (len != 0 && buffer_pos < header.dst_size); | 466 | } while (len != 0 && buffer_pos < header.dst_size); |
452 | /* FIXME: ...........^^^^^ | 467 | /* FIXME: ...........^^^^^ |
453 | * shouldn't it be "global_pos + buffer_pos < header.dst_size"? | 468 | * shouldn't it be "global_pos + buffer_pos < header.dst_size"? |
469 | * It probably should, but it is a "do we accidentally | ||
470 | * unpack more bytes than expected?" check - which | ||
471 | * never happens for well-formed compression data... | ||
454 | */ | 472 | */ |
455 | } | 473 | } |
456 | } | 474 | } |