예제 #1
0
int main() {
  int strstart = 0;
  int hash_head = 2;
  int prev_length = 5;
  int ins_h = 1;
  int prev[32<<10] = { 0 };
  int head[32<<10] = { 0 };
  int window[1024] = { 0 };
  do {
      strstart++;
      INSERT_STRING(strstart, hash_head);
  } while (--prev_length != 0);
}
예제 #2
0
파일: loopmacro.c 프로젝트: larryv/clang
int main() {                                // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+12]]:2 = #0
  int strstart = 0;
  int hash_head = 2;
  int prev_length = 5;
  int ins_h = 1;
  int prev[32] = { 0 };
  int head[32] = { 0 };
  int window[1024] = { 0 };
  do {                                     // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE+3]]:30 = (#0 + #1)
      strstart++;
      INSERT_STRING(strstart, hash_head);  // CHECK-NEXT: Expansion,File 0, [[@LINE]]:7 -> [[@LINE]]:20 = (#0 + #1) (Expanded file = 1)
  } while (--prev_length != 0);
}
예제 #3
0
/* ========================================================================= */
EXPORT_C int ZEXPORT deflateSetDictionary (
    z_streamp strm,
    const Bytef *dictionary,
    uInt  dictLength)
{
    // Line to stop compiler warning about unused mandatory global variable
    char __z=deflate_copyright[0];
    __z=__z;

    deflate_state *s;
    uInt length = dictLength;
    uInt n;
    IPos hash_head = 0;

    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
            strm->state->status != INIT_STATE) return Z_STREAM_ERROR;

    s = strm->state;
    strm->adler = adler32(strm->adler, dictionary, dictLength);

    if (length < MIN_MATCH) return Z_OK;
    if (length > MAX_DIST(s)) {
        length = MAX_DIST(s);
#ifndef USE_DICT_HEAD
        dictionary += dictLength - length; /* use the tail of the dictionary */
#endif
    }
    zmemcpy(s->window, dictionary, length);
    s->strstart = length;
    s->block_start = (long)length;

    /* Insert all strings in the hash table (except for the last two bytes).
     * s->lookahead stays null, so s->ins_h will be recomputed at the next
     * call of fill_window.
     */
    s->ins_h = s->window[0];
    UPDATE_HASH(s, s->ins_h, s->window[1]);
    for (n = 0; n <= length - MIN_MATCH; n++) {
        INSERT_STRING(s, n, hash_head);
    }
    if (hash_head) hash_head = 0;  /* to make compiler happy */
    return Z_OK;
}
예제 #4
0
int zlib_deflateSetDictionary(
	z_streamp strm,
	const Byte *dictionary,
	uInt  dictLength
)
{
    deflate_state *s;
    uInt length = dictLength;
    uInt n;
    IPos hash_head = 0;

    if (strm == NULL || strm->state == NULL || dictionary == NULL)
	return Z_STREAM_ERROR;

    s = (deflate_state *) strm->state;
    if (s->status != INIT_STATE) return Z_STREAM_ERROR;

    strm->adler = zlib_adler32(strm->adler, dictionary, dictLength);

    if (length < MIN_MATCH) return Z_OK;
    if (length > MAX_DIST(s)) {
	length = MAX_DIST(s);
#ifndef USE_DICT_HEAD
	dictionary += dictLength - length; /* use the tail of the dictionary */
#endif
    }
    memcpy((char *)s->window, dictionary, length);
    s->strstart = length;
    s->block_start = (long)length;

    /* Insert all strings in the hash table (except for the last two bytes).
     * s->lookahead stays null, so s->ins_h will be recomputed at the next
     * call of fill_window.
     */
    s->ins_h = s->window[0];
    UPDATE_HASH(s, s->ins_h, s->window[1]);
    for (n = 0; n <= length - MIN_MATCH; n++) {
	INSERT_STRING(s, n, hash_head);
    }
    if (hash_head) hash_head = 0;  /* to make compiler happy */
    return Z_OK;
}