diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-07-02 17:28:05 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-07-02 17:28:05 +0200 |
commit | ace5e90b3dbc33f0fc34ac2f3dc40d3c990a6a11 (patch) | |
tree | 0b5cda436e04ee29efb5220da5634d04455c65c0 /lzo/src/lzo_mchw.ch | |
parent | 78172a10165a969b8c002b6bdcf9dc47fa6cd5f3 (diff) |
Update lzo version
Diffstat (limited to 'lzo/src/lzo_mchw.ch')
-rw-r--r-- | lzo/src/lzo_mchw.ch | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lzo/src/lzo_mchw.ch b/lzo/src/lzo_mchw.ch index a8c4fec5..fec8d92b 100644 --- a/lzo/src/lzo_mchw.ch +++ b/lzo/src/lzo_mchw.ch @@ -2,6 +2,9 @@ This file is part of the LZO real-time data compression library. + Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer @@ -44,7 +47,7 @@ typedef struct { - int init; + unsigned init; lzo_uint look; /* bytes in lookahead buffer */ @@ -115,9 +118,9 @@ LZO_COMPRESS_T; #if (LZO_CC_BORLANDC && LZO_ARCH_I086) && (__BORLANDC__ < 0x0450) /* work around a Borland C 3.1 bug */ # define getbyte(c) ((c).ip < (c).in_end ? (c).ip +=1, (c).ip[-1] : (-1)) -#elif defined(__TURBOC__) && defined(__TOS__) - /* work around a bug in Turbo C / Pure C (Atari ST) */ -# define getbyte(c) ((c).ip < (c).in_end ? (int)(unsigned) *((c).ip)++ : (-1)) +#elif (LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) + /* work around a code generation bug in Turbo C / Pure C (Atari ST) */ +# define getbyte(c) ((c).ip < (c).in_end ? (int) (unsigned) *((c).ip)++ : (-1)) #else # define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) #endif @@ -148,11 +151,14 @@ init_match ( LZO_COMPRESS_T *c, lzo_swd_p s, c->lazy = 0; r = swd_init(s,dict,dict_len); - if (r != 0) + if (r != LZO_E_OK) + { + swd_exit(s); return r; + } s->use_best_off = (flags & 1) ? 1 : 0; - return r; + return LZO_E_OK; } @@ -178,8 +184,8 @@ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s, c->textsize += this_len - skip; } - s->m_len = 1; - s->m_len = THRESHOLD; + s->m_len = SWD_THRESHOLD; + s->m_off = 0; #ifdef SWD_BEST_OFF if (s->use_best_off) lzo_memset(s->best_pos,0,sizeof(s->best_pos)); @@ -204,14 +210,14 @@ find_match ( LZO_COMPRESS_T *c, lzo_swd_p s, #if 0 /* brute force match search */ - if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look) + if (c->m_len > SWD_THRESHOLD && c->m_len + 1 <= c->look) { const lzo_bytep ip = c->bp; const lzo_bytep m = c->bp - c->m_off; const lzo_bytep in = c->in; - if (ip - in > N) - in = ip - N; + if (ip - in > s->swd_n) + in = ip - s->swd_n; for (;;) { while (*in != *ip) |