Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/archival/lzop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1122 by niro, Sun May 30 11:32:42 2010 UTC revision 1123 by niro, Wed Aug 18 21:56:57 2010 UTC
# Line 166  static NOINLINE int lzo1x_optimize(uint8 Line 166  static NOINLINE int lzo1x_optimize(uint8
166   o_m1_a++;   o_m1_a++;
167   }   }
168   /* test if a literal run follows */   /* test if a literal run follows */
169   else if (nl == 0 && ip[0] < 16 && ip[0] != 0 &&   else
170   (lit + 2 + ip[0] < 16))   if (nl == 0
171   {   && ip[0] < 16
172     && ip[0] != 0
173     && (lit + 2 + ip[0] < 16)
174     ) {
175   t = *ip++;   t = *ip++;
176   /* remove short run */   /* remove short run */
177   *litp &= ~3;   *litp &= ~3;
# Line 393  struct globals { Line 396  struct globals {
396   const uint32_t *lzo_crc32_table;   const uint32_t *lzo_crc32_table;
397   chksum_t chksum_in;   chksum_t chksum_in;
398   chksum_t chksum_out;   chksum_t chksum_out;
399  };  } FIX_ALIASING;
400  #define G (*(struct globals*)&bb_common_bufsiz1)  #define G (*(struct globals*)&bb_common_bufsiz1)
401  #define INIT_G() do { } while (0)  #define INIT_G() do { } while (0)
402  //#define G (*ptr_to_globals)  //#define G (*ptr_to_globals)
# Line 472  lzo_crc32(uint32_t c, const uint8_t* buf Line 475  lzo_crc32(uint32_t c, const uint8_t* buf
475    
476   crc = ~c;   crc = ~c;
477   if (len != 0) do {   if (len != 0) do {
478   crc = G.lzo_crc32_table[((int)crc ^ *buf) & 0xff] ^ (crc >> 8);   crc = G.lzo_crc32_table[(uint8_t)((int)crc ^ *buf)] ^ (crc >> 8);
479   buf += 1;   buf += 1;
480   len -= 1;   len -= 1;
481   } while (len > 0);   } while (len > 0);
# Line 735  static NOINLINE smallint lzo_decompress( Line 738  static NOINLINE smallint lzo_decompress(
738   bb_error_msg_and_die("this file is a split lzop file");   bb_error_msg_and_die("this file is a split lzop file");
739    
740   if (dst_len > MAX_BLOCK_SIZE)   if (dst_len > MAX_BLOCK_SIZE)
741   bb_error_msg_and_die("lzop file corrupted");   bb_error_msg_and_die("corrupted data");
742    
743   /* read compressed block size */   /* read compressed block size */
744   src_len = read32();   src_len = read32();
745   if (src_len <= 0 || src_len > dst_len)   if (src_len <= 0 || src_len > dst_len)
746   bb_error_msg_and_die("lzop file corrupted");   bb_error_msg_and_die("corrupted data");
747    
748   if (dst_len > block_size) {   if (dst_len > block_size) {
749   if (b2) {   if (b2) {
# Line 794  static NOINLINE smallint lzo_decompress( Line 797  static NOINLINE smallint lzo_decompress(
797   r = lzo1x_decompress_safe(b1, src_len, b2, &d, NULL);   r = lzo1x_decompress_safe(b1, src_len, b2, &d, NULL);
798    
799   if (r != 0 /*LZO_E_OK*/ || dst_len != d) {   if (r != 0 /*LZO_E_OK*/ || dst_len != d) {
800   bb_error_msg_and_die("corrupted compressed data");   bb_error_msg_and_die("corrupted data");
801   }   }
802   dst = b2;   dst = b2;
803   } else {   } else {
# Line 1039  static smallint do_lzo_decompress(void) Line 1042  static smallint do_lzo_decompress(void)
1042   return lzo_decompress(&header);   return lzo_decompress(&header);
1043  }  }
1044    
1045  static char* make_new_name_lzop(char *filename)  static char* FAST_FUNC make_new_name_lzop(char *filename, const char *expected_ext UNUSED_PARAM)
1046  {  {
1047   if (option_mask32 & OPT_DECOMPRESS) {   if (option_mask32 & OPT_DECOMPRESS) {
1048   char *extension = strrchr(filename, '.');   char *extension = strrchr(filename, '.');
# Line 1051  static char* make_new_name_lzop(char *fi Line 1054  static char* make_new_name_lzop(char *fi
1054   return xasprintf("%s.lzo", filename);   return xasprintf("%s.lzo", filename);
1055  }  }
1056    
1057  static IF_DESKTOP(long long) int pack_lzop(unpack_info_t *info UNUSED_PARAM)  static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(unpack_info_t *info UNUSED_PARAM)
1058  {  {
1059   if (option_mask32 & OPT_DECOMPRESS)   if (option_mask32 & OPT_DECOMPRESS)
1060   return do_lzo_decompress();   return do_lzo_decompress();
# Line 1071  int lzop_main(int argc UNUSED_PARAM, cha Line 1074  int lzop_main(int argc UNUSED_PARAM, cha
1074   option_mask32 |= OPT_DECOMPRESS;   option_mask32 |= OPT_DECOMPRESS;
1075    
1076   G.lzo_crc32_table = crc32_filltable(NULL, 0);   G.lzo_crc32_table = crc32_filltable(NULL, 0);
1077   return bbunpack(argv, make_new_name_lzop, pack_lzop);   return bbunpack(argv, pack_lzop, make_new_name_lzop, /*unused:*/ NULL);
1078  }  }

Legend:
Removed from v.1122  
changed lines
  Added in v.1123