/*********************************************************************** // ************************************************************************/ static int find_match(lzo1x_999_t *c, lzo_swd_p s, unsigned this_len, unsigned skip) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); } else { assert(this_len <= 1); } s->m_len = 1; s->m_len = 1; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos, 0, sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; } else { c->look = s->look + 1; } c->bp = c->ip - c->look; return LZO_E_OK; }
static void find_match(UCL_COMPRESS_DATA *c, ucl_swd_t *s, DWORD this_len, DWORD skip) { if(skip > 0) { swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else c->textsize += this_len - skip; s->m_len = 1; swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if(s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else c->look = s->look + 1; c->bp = c->ip - c->look; if(c->pCallback && c->textsize > c->printcount) { (*c->pCallback->callback)(c->textsize, c->codesize, 3, c->pCallback->pData); c->printcount += 1024; } }
static int find_match (lzo1x_999_t * c, lzo1x_999_swd_t * s, lzo_uint this_len, lzo_uint skip) { if (skip > 0) { swd_accept (s, this_len - skip); c->textsize += this_len - skip + 1; } else { c->textsize += this_len - skip; } s->m_len = 1; s->m_len = 1; if (s->use_best_off) memset (s->best_pos, 0, sizeof (s->best_pos)); swd_findbest (s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte (s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; } else { c->look = s->look + 1; } c->bp = c->ip - c->look; if (c->cb && c->textsize > c->printcount) { (*c->cb) (c->textsize, c->codesize); c->printcount += 1024; } return LZO_E_OK; }
tINT find_match (tUCL_COMPRESS_CTX* c, tUCL_SWD* s, tUINT this_len, tUINT skip) { if (skip > 0) { swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { c->textsize += this_len - skip; } s->m_len = THRESHOLD; swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; // swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; if (c->cb && c->textsize > c->printcount) { (*c->cb->CallBack)(c->textsize,c->codesize,3,c->cb->User); c->printcount += 1024; } return UCL_E_OK; }
static int find_match ( struct ucl_compress *c, struct ucl_swd *s, unsigned int this_len, unsigned int skip ) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { assert(this_len <= 1); c->textsize += this_len - skip; } s->m_len = THRESHOLD; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos,0,sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; c->m_off = s->m_off; swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; #if 0 /* brute force match search */ if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look) { const uint8_t *ip = c->bp; const uint8_t *m = c->bp - c->m_off; const uint8_t *in = c->in; if (ip - in > N) in = ip - N; for (;;) { while (*in != *ip) in++; if (in == ip) break; if (in != m) if (memcmp(in,ip,c->m_len+1) == 0) printf("%p %p %p %5d\n",in,ip,m,c->m_len); in++; } } #endif return UCL_E_OK; }
static int find_match(UCL_COMPRESS_T * c, ucl_swd_t * s, ucl_uint this_len, ucl_uint skip) { assert(c->init); if (skip > 0) { assert(this_len >= skip); swd_accept(s, this_len - skip); c->textsize += this_len - skip + 1; } else { assert(this_len <= 1); c->textsize += this_len - skip; } s->m_len = THRESHOLD; #ifdef SWD_BEST_OFF if (s->use_best_off) memset(s->best_pos, 0, sizeof(s->best_pos)); #endif swd_findbest(s); c->m_len = s->m_len; #if defined(__UCL_CHECKER) /* s->m_off may be uninitialized if we didn't find a match, * but then its value will never be used. */ c->m_off = (s->m_len == THRESHOLD) ? 0 : s->m_off; #else c->m_off = s->m_off; #endif swd_getbyte(s); if (s->b_char < 0) { c->look = 0; c->m_len = 0; swd_exit(s); } else { c->look = s->look + 1; } c->bp = c->ip - c->look; #if 0 /* brute force match search */ if (c->m_len > THRESHOLD && c->m_len + 1 <= c->look) { const ucl_byte *ip = c->bp; const ucl_byte *m = c->bp - c->m_off; const ucl_byte *in = c->in; if (ip - in > N) in = ip - N; for (;;) { while (*in != *ip) in++; if (in == ip) break; if (in != m) if (memcmp(in, ip, c->m_len + 1) == 0) printf("%p %p %p %5d\n", in, ip, m, c->m_len); in++; } } #endif if (c->cb && c->textsize > c->printcount) { (*c->cb->callback) (c->textsize, c->codesize, 3, c->cb->user); c->printcount += 1024; } return UCL_E_OK; }