aboutsummaryrefslogtreecommitdiff
path: root/archival/lzop.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/lzop.c')
-rw-r--r--archival/lzop.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/archival/lzop.c b/archival/lzop.c
index c6e718ad7..acb34fe14 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -393,7 +393,7 @@ typedef struct header_t {
393} header_t; 393} header_t;
394 394
395struct globals { 395struct globals {
396 const uint32_t *lzo_crc32_table; 396 /*const uint32_t *lzo_crc32_table;*/
397 chksum_t chksum_in; 397 chksum_t chksum_in;
398 chksum_t chksum_out; 398 chksum_t chksum_out;
399} FIX_ALIASING; 399} FIX_ALIASING;
@@ -468,19 +468,10 @@ lzo_adler32(uint32_t adler, const uint8_t* buf, unsigned len)
468static FAST_FUNC uint32_t 468static FAST_FUNC uint32_t
469lzo_crc32(uint32_t c, const uint8_t* buf, unsigned len) 469lzo_crc32(uint32_t c, const uint8_t* buf, unsigned len)
470{ 470{
471 uint32_t crc; 471 //if (buf == NULL) - impossible
472 // return 0;
472 473
473 if (buf == NULL) 474 return ~crc32_block_endian0(~c, buf, len, global_crc32_table);
474 return 0;
475
476 crc = ~c;
477 if (len != 0) do {
478 crc = G.lzo_crc32_table[(uint8_t)((int)crc ^ *buf)] ^ (crc >> 8);
479 buf += 1;
480 len -= 1;
481 } while (len > 0);
482
483 return ~crc;
484} 475}
485 476
486/**********************************************************************/ 477/**********************************************************************/
@@ -679,8 +670,7 @@ static NOINLINE smallint lzo_compress(const header_t *h)
679 if (dst_len < src_len) { 670 if (dst_len < src_len) {
680 /* write checksum of compressed block */ 671 /* write checksum of compressed block */
681 if (h->flags & F_ADLER32_C) 672 if (h->flags & F_ADLER32_C)
682 write32(lzo_adler32(ADLER32_INIT_VALUE, b2, 673 write32(lzo_adler32(ADLER32_INIT_VALUE, b2, dst_len));
683 dst_len));
684 if (h->flags & F_CRC32_C) 674 if (h->flags & F_CRC32_C)
685 write32(lzo_crc32(CRC32_INIT_VALUE, b2, dst_len)); 675 write32(lzo_crc32(CRC32_INIT_VALUE, b2, dst_len));
686 /* write compressed block data */ 676 /* write compressed block data */
@@ -1080,6 +1070,6 @@ int lzop_main(int argc UNUSED_PARAM, char **argv)
1080 if (applet_name[0] == 'u') 1070 if (applet_name[0] == 'u')
1081 option_mask32 |= OPT_DECOMPRESS; 1071 option_mask32 |= OPT_DECOMPRESS;
1082 1072
1083 G.lzo_crc32_table = crc32_filltable(NULL, 0); 1073 global_crc32_table = crc32_filltable(NULL, 0);
1084 return bbunpack(argv, pack_lzop, make_new_name_lzop, /*unused:*/ NULL); 1074 return bbunpack(argv, pack_lzop, make_new_name_lzop, /*unused:*/ NULL);
1085} 1075}