mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-19 04:28:28 +00:00
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
1 changed files with 3 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue