亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? deflate.c

?? p2p技術C源代碼.rar
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* deflate.c -- compress data using the deflation algorithm
 * Copyright (C) 1995-2002 Jean-loup Gailly.
 * For conditions of distribution and use, see copyright notice in zlib.h 
 */

/*
 *  ALGORITHM
 *
 *      The "deflation" process depends on being able to identify portions
 *      of the input text which are identical to earlier input (within a
 *      sliding window trailing behind the input currently being processed).
 *
 *      The most straightforward technique turns out to be the fastest for
 *      most input files: try all possible matches and select the longest.
 *      The key feature of this algorithm is that insertions into the string
 *      dictionary are very simple and thus fast, and deletions are avoided
 *      completely. Insertions are performed at each input character, whereas
 *      string matches are performed only when the previous match ends. So it
 *      is preferable to spend more time in matches to allow very fast string
 *      insertions and avoid deletions. The matching algorithm for small
 *      strings is inspired from that of Rabin & Karp. A brute force approach
 *      is used to find longer strings when a small match has been found.
 *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
 *      (by Leonid Broukhis).
 *         A previous version of this file used a more sophisticated algorithm
 *      (by Fiala and Greene) which is guaranteed to run in linear amortized
 *      time, but has a larger average cost, uses more memory and is patented.
 *      However the F&G algorithm may be faster for some highly redundant
 *      files if the parameter max_chain_length (described below) is too large.
 *
 *  ACKNOWLEDGEMENTS
 *
 *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
 *      I found it in 'freeze' written by Leonid Broukhis.
 *      Thanks to many people for bug reports and testing.
 *
 *  REFERENCES
 *
 *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
 *      Available in ftp://ds.internic.net/rfc/rfc1951.txt
 *
 *      A description of the Rabin and Karp algorithm is given in the book
 *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
 *
 *      Fiala,E.R., and Greene,D.H.
 *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
 *
 */

/* @(#) $Id: deflate.c,v 1.1 2002/12/28 01:31:50 arnetheduck Exp $ */

#include "deflate.h"

const char deflate_copyright[] =
   " deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly ";
/*
  If you use the zlib library in a product, an acknowledgment is welcome
  in the documentation of your product. If for some reason you cannot
  include such an acknowledgment, I would appreciate that you keep this
  copyright string in the executable of your product.
 */

/* ===========================================================================
 *  Function prototypes.
 */
typedef enum {
    need_more,      /* block not completed, need more input or more output */
    block_done,     /* block flush performed */
    finish_started, /* finish started, need only more output at next deflate */
    finish_done     /* finish done, accept no more input or output */
} block_state;

typedef block_state (*compress_func) OF((deflate_state *s, int flush));
/* Compression function. Returns the block state after the call. */

local void fill_window    OF((deflate_state *s));
local block_state deflate_stored OF((deflate_state *s, int flush));
local block_state deflate_fast   OF((deflate_state *s, int flush));
local block_state deflate_slow   OF((deflate_state *s, int flush));
local void lm_init        OF((deflate_state *s));
local void putShortMSB    OF((deflate_state *s, uInt b));
local void flush_pending  OF((z_streamp strm));
local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV
      void match_init OF((void)); /* asm code initialization */
      uInt longest_match  OF((deflate_state *s, IPos cur_match));
#else
local uInt longest_match  OF((deflate_state *s, IPos cur_match));
#endif

#ifdef DEBUG
local  void check_match OF((deflate_state *s, IPos start, IPos match,
                            int length));
#endif

/* ===========================================================================
 * Local data
 */

#define NIL 0
/* Tail of hash chains */

#ifndef TOO_FAR
#  define TOO_FAR 4096
#endif
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */

#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
 * See deflate.c for comments about the MIN_MATCH+1.
 */

/* Values for max_lazy_match, good_match and max_chain_length, depending on
 * the desired pack level (0..9). The values given below have been tuned to
 * exclude worst case performance for pathological files. Better values may be
 * found for specific files.
 */
typedef struct config_s {
   ush good_length; /* reduce lazy search above this match length */
   ush max_lazy;    /* do not perform lazy search above this match length */
   ush nice_length; /* quit search above this match length */
   ush max_chain;
   compress_func func;
} config;

local const config configuration_table[10] = {
/*      good lazy nice chain */
/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
/* 1 */ {4,    4,  8,    4, deflate_fast}, /* maximum speed, no lazy matches */
/* 2 */ {4,    5, 16,    8, deflate_fast},
/* 3 */ {4,    6, 32,   32, deflate_fast},

/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
/* 5 */ {8,   16, 32,   32, deflate_slow},
/* 6 */ {8,   16, 128, 128, deflate_slow},
/* 7 */ {8,   32, 128, 256, deflate_slow},
/* 8 */ {32, 128, 258, 1024, deflate_slow},
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */

/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
 * meaning.
 */

#define EQUAL 0
/* result of memcmp for equal strings */

struct static_tree_desc_s {int dummy;}; /* for buggy compilers */

/* ===========================================================================
 * Update a hash value with the given input byte
 * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
 *    input characters, so that a running hash key can be computed from the
 *    previous key instead of complete recalculation each time.
 */
#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)


/* ===========================================================================
 * Insert string str in the dictionary and set match_head to the previous head
 * of the hash chain (the most recent string with same hash key). Return
 * the previous length of the hash chain.
 * If this file is compiled with -DFASTEST, the compression level is forced
 * to 1, and no hash chains are maintained.
 * IN  assertion: all calls to to INSERT_STRING are made with consecutive
 *    input characters and the first MIN_MATCH bytes of str are valid
 *    (except for the last MIN_MATCH-1 bytes of the input file).
 */
#ifdef FASTEST
#define INSERT_STRING(s, str, match_head) \
   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
    match_head = s->head[s->ins_h], \
    s->head[s->ins_h] = (Pos)(str))
#else
#define INSERT_STRING(s, str, match_head) \
   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
    s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
    s->head[s->ins_h] = (Pos)(str))
#endif

/* ===========================================================================
 * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 * prev[] will be initialized on the fly.
 */
#define CLEAR_HASH(s) \
    s->head[s->hash_size-1] = NIL; \
    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));

/* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size)
    z_streamp strm;
    int level;
    const char *version;
    int stream_size;
{
    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
			 Z_DEFAULT_STRATEGY, version, stream_size);
    /* To do: ignore strm->next_in if we use it as window */
}

/* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
		  version, stream_size)
    z_streamp strm;
    int  level;
    int  method;
    int  windowBits;
    int  memLevel;
    int  strategy;
    const char *version;
    int stream_size;
{
    deflate_state *s;
    int noheader = 0;
    static const char* my_version = ZLIB_VERSION;

    ushf *overlay;
    /* We overlay pending_buf and d_buf+l_buf. This works since the average
     * output size for (length,distance) codes is <= 24 bits.
     */

    if (version == Z_NULL || version[0] != my_version[0] ||
        stream_size != sizeof(z_stream)) {
	return Z_VERSION_ERROR;
    }
    if (strm == Z_NULL) return Z_STREAM_ERROR;

    strm->msg = Z_NULL;
    if (strm->zalloc == Z_NULL) {
	strm->zalloc = zcalloc;
	strm->opaque = (voidpf)0;
    }
    if (strm->zfree == Z_NULL) strm->zfree = zcfree;

    if (level == Z_DEFAULT_COMPRESSION) level = 6;
#ifdef FASTEST
    level = 1;
#endif

    if (windowBits < 0) { /* undocumented feature: suppress zlib header */
        noheader = 1;
        windowBits = -windowBits;
    }
    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
        windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
	strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
        return Z_STREAM_ERROR;
    }
    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
    if (s == Z_NULL) return Z_MEM_ERROR;
    strm->state = (struct internal_state FAR *)s;
    s->strm = strm;

    s->noheader = noheader;
    s->w_bits = windowBits;
    s->w_size = 1 << s->w_bits;
    s->w_mask = s->w_size - 1;

    s->hash_bits = memLevel + 7;
    s->hash_size = 1 << s->hash_bits;
    s->hash_mask = s->hash_size - 1;
    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);

    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));

    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */

    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
    s->pending_buf = (uchf *) overlay;
    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);

    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
        s->pending_buf == Z_NULL) {
        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
        deflateEnd (strm);
        return Z_MEM_ERROR;
    }
    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;

    s->level = level;
    s->strategy = strategy;
    s->method = (Byte)method;

    return deflateReset(strm);
}

/* ========================================================================= */
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
    z_streamp strm;
    const Bytef *dictionary;
    uInt  dictLength;
{
    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;
}

/* ========================================================================= */
int ZEXPORT deflateReset (strm)
    z_streamp strm;
{
    deflate_state *s;
    
    if (strm == Z_NULL || strm->state == Z_NULL ||
        strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚洲一区二区三区明星换脸| 日韩理论片中文av| 国产精品电影一区二区| 石原莉奈在线亚洲二区| 国产99精品在线观看| 欧美日韩一区三区| 日本一区二区免费在线观看视频| 五月天一区二区| www.av亚洲| 26uuuu精品一区二区| 性久久久久久久久| 94-欧美-setu| 国产精品久久综合| 国产一区二区成人久久免费影院 | 亚洲成人动漫精品| 不卡一区在线观看| 精品入口麻豆88视频| 亚洲一级不卡视频| 97se狠狠狠综合亚洲狠狠| 欧美国产精品一区二区三区| 免费成人在线视频观看| 欧美四级电影网| 亚洲午夜一区二区| 日本高清不卡视频| 亚洲品质自拍视频| 99久久国产综合色|国产精品| 久久久久久99精品| 国产老女人精品毛片久久| 欧美三级视频在线| 精品国一区二区三区| 国产成人综合自拍| 综合自拍亚洲综合图不卡区| 九九九精品视频| 欧美一区二区三区播放老司机| 亚洲风情在线资源站| 欧美性受xxxx黑人xyx性爽| 伊人婷婷欧美激情| 欧美午夜精品一区| 日韩成人午夜电影| 日韩三级视频在线看| 久久国产尿小便嘘嘘| 久久综合久久综合久久| 国产黄色精品视频| 亚洲欧洲成人精品av97| 99精品久久99久久久久| 亚洲美女免费在线| 欧美日韩黄色影视| 全部av―极品视觉盛宴亚洲| 欧美mv和日韩mv的网站| 东方aⅴ免费观看久久av| 国产精品免费网站在线观看| 色狠狠桃花综合| 亚洲国产精品久久人人爱蜜臀| 欧美精品tushy高清| 久久精品国产成人一区二区三区| 久久久久久久久久久久电影| 成人v精品蜜桃久久一区| 一区二区在线观看不卡| 欧美一区二区三区四区在线观看| 久久91精品久久久久久秒播| 国产精品色呦呦| 欧美日韩国产系列| 国产乱人伦偷精品视频免下载| 日韩一区在线看| 91精品在线麻豆| 大胆欧美人体老妇| 午夜久久久久久久久| 久久久一区二区三区捆绑**| 91日韩在线专区| 久久99精品国产| 一区二区三区 在线观看视频| 3d动漫精品啪啪| 欧美精品黑人性xxxx| 国内精品伊人久久久久影院对白| 中文字幕人成不卡一区| 91精品婷婷国产综合久久性色 | 韩日av一区二区| ...xxx性欧美| 日韩美一区二区三区| 91麻豆蜜桃一区二区三区| 蜜臀91精品一区二区三区| 国产精品亲子伦对白| 7777精品伊人久久久大香线蕉的| 成人午夜在线免费| 理论片日本一区| 亚洲午夜激情网站| 国产精品久久久99| 久久久久久久久岛国免费| 欧美日韩日日摸| 成人黄色一级视频| 黑人巨大精品欧美黑白配亚洲| 亚洲在线视频一区| 18成人在线观看| 亚洲国产精品激情在线观看| 日韩三级av在线播放| 欧洲av在线精品| 成人av动漫网站| 国产成人日日夜夜| 精品在线你懂的| 日韩av电影免费观看高清完整版在线观看 | 欧美变态tickling挠脚心| 91免费精品国自产拍在线不卡| 国产尤物一区二区在线 | 自拍偷拍国产精品| 久久久不卡影院| 欧美精品一区二区三区蜜臀| 欧美日韩在线播放| 欧洲中文字幕精品| 91麻豆精品视频| 97国产一区二区| 9i在线看片成人免费| 成人午夜视频在线| 国产不卡免费视频| 国产一区二区伦理| 国产精品18久久久| 风间由美一区二区三区在线观看| 国产一区欧美二区| 国产精品一区在线观看你懂的| 国产一区二区在线影院| 国产剧情av麻豆香蕉精品| 国产一区二区三区免费看| 国产精品77777| 成人免费不卡视频| 一本久久精品一区二区| 91久久香蕉国产日韩欧美9色| 色综合久久久久综合99| 欧美亚洲精品一区| 在线播放日韩导航| 精品久久久网站| 国产精品欧美经典| 亚洲精品成人精品456| 午夜欧美大尺度福利影院在线看| 日韩av电影免费观看高清完整版 | 欧美国产日韩a欧美在线观看 | 精品少妇一区二区三区| 久久香蕉国产线看观看99| 欧美激情综合网| 亚洲欧美日韩人成在线播放| 一区二区三区欧美日| 亚洲国产乱码最新视频| 久久精品国产精品亚洲综合| 国产69精品一区二区亚洲孕妇| 成人黄色小视频在线观看| 91视频91自| 日韩一区二区三区电影在线观看| 精品久久久久久久久久久院品网| 欧美国产精品一区| 亚洲成人免费视频| 国产在线精品免费| 91美女视频网站| 91精品国产乱| 综合欧美亚洲日本| 麻豆精品一二三| 91在线观看成人| 91精品国产欧美日韩| 国产精品电影院| 裸体在线国模精品偷拍| 91看片淫黄大片一级在线观看| 精品奇米国产一区二区三区| 亚洲欧洲av在线| 久久成人羞羞网站| 在线一区二区观看| 国产日韩欧美一区二区三区综合| 一区二区不卡在线视频 午夜欧美不卡在| 蜜桃一区二区三区在线观看| 91麻豆国产自产在线观看| 精品国产一区二区亚洲人成毛片| 一区二区三区中文字幕在线观看| 狠狠色丁香久久婷婷综合_中| 欧美丝袜丝交足nylons| 国产亚洲欧美在线| 日韩激情一二三区| 在线视频一区二区三| 日本一区二区三区高清不卡| 日韩中文字幕不卡| 91视视频在线观看入口直接观看www | 久久日韩粉嫩一区二区三区| 亚洲男人的天堂在线aⅴ视频| 国产制服丝袜一区| 5858s免费视频成人| 亚洲精品免费在线| 成人激情文学综合网| 欧美tk—视频vk| 奇米影视7777精品一区二区| 在线免费观看日本一区| 亚洲婷婷国产精品电影人久久| 韩国av一区二区| 日韩一区和二区| 婷婷国产v国产偷v亚洲高清| 在线观看网站黄不卡| 亚洲男同性视频| 欧美日韩国产影片| 亚洲一区在线电影| 在线观看三级视频欧美| 亚洲欧美日韩电影| 91老司机福利 在线| 亚洲三级视频在线观看| 97久久超碰国产精品| 中文字幕亚洲一区二区va在线| 波多野结衣中文字幕一区|