From: Sascha Hauer Date: Tue, 5 Oct 2010 15:36:03 +0200 Subject: [PATCH] make block size configureable Signed-off-by: Sascha Hauer Signed-off-by: Marc Kleine-Budde --- src/lzop.c | 5 +++++ src/p_lzo.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lzop.c b/src/lzop.c index 5571e89..4cd1bb7 100644 --- a/src/lzop.c +++ b/src/lzop.c @@ -2462,6 +2462,7 @@ char* prepare_shortopts(char *buf, const char *n, return buf; } +extern lzo_uint block_size; static int do_option(acc_getopt_p g, int optc) { @@ -2471,6 +2472,9 @@ static int do_option(acc_getopt_p g, int optc) switch (optc) { + case 'b': + block_size = strtoul(mfx_optarg,NULL,0); + break; case 'c': opt_stdout = 1; break; @@ -2745,6 +2749,7 @@ static int get_options(int argc, char **argv) static const struct acc_getopt_longopt_t longopts[] = { + {"blocksize", 1, 0, 'b'}, {"best", 0, 0, '9'}, /* compress better */ {"decompress", 0, 0, 'd'}, /* decompress */ {"fast", 0, 0, '1'}, /* compress faster */ diff --git a/src/p_lzo.c b/src/p_lzo.c index bacb28d..d635ad6 100644 --- a/src/p_lzo.c +++ b/src/p_lzo.c @@ -192,7 +192,7 @@ static lzo_bool alloc_mem(lzo_uint32 s1, lzo_uint32 s2, lzo_uint32 w) **************************************************************************/ /* maybe make this an option ? */ -static const lzo_uint block_size = BLOCK_SIZE; +lzo_uint block_size = BLOCK_SIZE; lzo_bool lzo_enter(const header_t *h) { @@ -219,7 +219,7 @@ lzo_bool lzo_enter(const header_t *h) #endif assert(block_size <= BLOCK_SIZE); assert(block_size <= MAX_BLOCK_SIZE); - assert(block_size >= 16*1024); + assert(block_size >= 1024); if (opt_method == M_LZO1X_1) wrk_len = LZO1X_1_MEM_COMPRESS; -- 1.7.2.3