Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/archival/lzop.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/archival/lzop.c

    r3232 r3621  
    2525   "Minimalized" for busybox by Alain Knaff
    2626*/
     27
     28//config:config LZOP
     29//config:   bool "lzop"
     30//config:   default y
     31//config:   help
     32//config:     Lzop compression/decompresion.
     33//config:
     34//config:config LZOP_COMPR_HIGH
     35//config:   bool "lzop compression levels 7,8,9 (not very useful)"
     36//config:   default n
     37//config:   depends on LZOP
     38//config:   help
     39//config:     High levels (7,8,9) of lzop compression. These levels
     40//config:     are actually slower than gzip at equivalent compression ratios
     41//config:     and take up 3.2K of code.
     42
     43//applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP))
     44//applet:IF_LZOP(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat))
     45//applet:IF_LZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop))
     46//kbuild:lib-$(CONFIG_LZOP) += lzop.o
    2747
    2848//usage:#define lzop_trivial_usage
     
    5272
    5373#include "libbb.h"
     74#include "common_bufsiz.h"
    5475#include "bb_archive.h"
    5576#include "liblzo_interface.h"
     
    424445    chksum_t chksum_out;
    425446} FIX_ALIASING;
    426 #define G (*(struct globals*)&bb_common_bufsiz1)
    427 #define INIT_G() do { } while (0)
     447#define G (*(struct globals*)bb_common_bufsiz1)
     448#define INIT_G() do { setup_common_bufsiz(); } while (0)
    428449//#define G (*ptr_to_globals)
    429450//#define INIT_G() do {
     
    437458//#define LZOP_VERSION_DATE       "Apr 27th 2003"
    438459
    439 #define OPTION_STRING "cfvdt123456789CF"
    440 
     460#define OPTION_STRING "cfvqdt123456789CF"
     461
     462/* Note: must be kept in sync with archival/bbunzip.c */
    441463enum {
    442464    OPT_STDOUT      = (1 << 0),
    443465    OPT_FORCE       = (1 << 1),
    444466    OPT_VERBOSE     = (1 << 2),
    445     OPT_DECOMPRESS  = (1 << 3),
    446     OPT_TEST        = (1 << 4),
    447     OPT_1           = (1 << 5),
    448     OPT_2           = (1 << 6),
    449     OPT_3           = (1 << 7),
    450     OPT_4           = (1 << 8),
    451     OPT_5           = (1 << 9),
    452     OPT_6           = (1 << 10),
    453     OPT_789         = (7 << 11),
    454     OPT_7           = (1 << 11),
    455     OPT_8           = (1 << 12),
    456     OPT_C           = (1 << 14),
    457     OPT_F           = (1 << 15),
     467    OPT_QUIET       = (1 << 3),
     468    OPT_DECOMPRESS  = (1 << 4),
     469    OPT_TEST        = (1 << 5),
     470    OPT_1           = (1 << 6),
     471    OPT_2           = (1 << 7),
     472    OPT_3           = (1 << 8),
     473    OPT_4           = (1 << 9),
     474    OPT_5           = (1 << 10),
     475    OPT_6           = (1 << 11),
     476    OPT_789         = (7 << 12),
     477    OPT_7           = (1 << 13),
     478    OPT_8           = (1 << 14),
     479    OPT_C           = (1 << 15),
     480    OPT_F           = (1 << 16),
    458481};
    459482
     
    619642// compress a file
    620643/**********************************************************************/
    621 static NOINLINE smallint lzo_compress(const header_t *h)
     644static NOINLINE int lzo_compress(const header_t *h)
    622645{
    623646    unsigned block_size = LZO_BLOCK_SIZE;
     
    629652    uint32_t d_crc32 = CRC32_INIT_VALUE;
    630653    int l;
    631     smallint ok = 1;
    632654    uint8_t *wrk_mem = NULL;
    633655
     
    711733    free(b1);
    712734    free(b2);
    713     return ok;
     735    return 1;
    714736}
    715737
     
    732754// decompress a file
    733755/**********************************************************************/
    734 static NOINLINE smallint lzo_decompress(const header_t *h)
     756static NOINLINE int lzo_decompress(const header_t *h)
    735757{
    736758    unsigned block_size = LZO_BLOCK_SIZE;
     
    740762    uint32_t d_adler32 = ADLER32_INIT_VALUE;
    741763    uint32_t c_crc32 = CRC32_INIT_VALUE, d_crc32 = CRC32_INIT_VALUE;
    742     smallint ok = 1;
    743764    uint8_t *b1;
    744765    uint32_t mcs_block_size = MAX_COMPRESSED_SIZE(block_size);
     
    844865
    845866    free(b2);
    846     return ok;
     867    return 1;
    847868}
    848869
     
    876897 * The rest is identical.
    877898*/
    878 static const unsigned char lzop_magic[9] = {
     899static const unsigned char lzop_magic[9] ALIGN1 = {
    879900    0x89, 0x4c, 0x5a, 0x4f, 0x00, 0x0d, 0x0a, 0x1a, 0x0a
    880901};
     
    10291050}
    10301051
    1031 static smallint do_lzo_compress(void)
     1052static int do_lzo_compress(void)
    10321053{
    10331054    header_t header;
     
    10571078// decompress
    10581079/**********************************************************************/
    1059 static smallint do_lzo_decompress(void)
     1080static int do_lzo_decompress(void)
    10601081{
    10611082    header_t header;
     
    10781099}
    10791100
    1080 static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(transformer_aux_data_t *aux UNUSED_PARAM)
     1101static IF_DESKTOP(long long) int FAST_FUNC pack_lzop(transformer_state_t *xstate UNUSED_PARAM)
    10811102{
    10821103    if (option_mask32 & OPT_DECOMPRESS)
     
    10941115        option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS);
    10951116    /* unlzop? */
    1096     if (applet_name[0] == 'u')
     1117    if (applet_name[4] == 'o')
    10971118        option_mask32 |= OPT_DECOMPRESS;
    10981119
Note: See TracChangeset for help on using the changeset viewer.