apps/examples/lzf: lzf_compress() now expects the hash table as user allocated input parmeter rather than declaring the huge array on the stack.
This commit is contained in:
parent
d05f6ccf85
commit
7c70ca5006
@ -70,6 +70,7 @@ static enum { COMPRESS, UNCOMPRESS, LZCAT } g_mode = COMPRESS;
|
||||
static bool g_verbose = false;
|
||||
static bool g_force = 0;
|
||||
static long blocksize = BLOCKSIZE;
|
||||
static lzf_state_t g_htab;
|
||||
|
||||
static FAR const char *opt =
|
||||
"-c compress\n"
|
||||
@ -167,7 +168,8 @@ static int compress_fd(int from, int to)
|
||||
g_nread = g_nwritten = 0;
|
||||
while ((us = rread(from, &buf1[MAX_HDR_SIZE], blocksize)) > 0)
|
||||
{
|
||||
cs = lzf_compress(&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE], us > 4 ? us - 4 : us);
|
||||
cs = lzf_compress(&buf1[MAX_HDR_SIZE], us, &buf2[MAX_HDR_SIZE],
|
||||
us > 4 ? us - 4 : us, g_htab);
|
||||
if (cs)
|
||||
{
|
||||
header = &buf2[MAX_HDR_SIZE - TYPE1_HDR_SIZE];
|
||||
|
Loading…
Reference in New Issue
Block a user