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

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

?? deflate.c

?? dc++(一個曾經大量使用的p2p)的源代碼,dc++,開源的p2p源代碼
?? 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一区二区三区免费野_久草精品视频
99精品在线观看视频| 国产亚洲精久久久久久| 国产高清精品久久久久| 蜜桃av一区二区| 国产精品水嫩水嫩| 在线看一区二区| 91高清视频免费看| 欧美在线综合视频| 国产精品夜夜嗨| 久草热8精品视频在线观看| 国产精品超碰97尤物18| 欧美日韩国产成人在线91 | 亚洲精品成人悠悠色影视| 国产网红主播福利一区二区| 久久久久久一二三区| 欧美日韩在线直播| 本田岬高潮一区二区三区| 国产成人免费在线观看不卡| 五月婷婷另类国产| 视频在线观看国产精品| 久久精品国内一区二区三区 | 91美女视频网站| 久久国产精品99久久久久久老狼| 欧美裸体一区二区三区| 成人高清在线视频| 美女性感视频久久| 国产乱子轮精品视频| av高清久久久| 911精品产国品一二三产区| 精品捆绑美女sm三区| 中文字幕免费不卡| 亚洲一区二区av在线| 老司机精品视频一区二区三区| 一区二区三区精品久久久| 免费成人美女在线观看| 亚洲大尺度视频在线观看| 久久国产欧美日韩精品| 三级亚洲高清视频| 国产美女娇喘av呻吟久久| 91福利视频网站| www一区二区| www国产成人| 日韩视频一区二区三区在线播放| 欧美三片在线视频观看| 91年精品国产| 高清不卡一二三区| 欧美日韩电影一区| 欧美精品欧美精品系列| 亚洲欧洲三级电影| 久久电影国产免费久久电影| 91麻豆成人久久精品二区三区| 日本美女一区二区三区视频| 日韩av一级片| 91麻豆国产福利在线观看| 在线欧美日韩国产| 欧美唯美清纯偷拍| 欧美日本乱大交xxxxx| 欧美二区乱c少妇| 欧美精品日韩一区| 日韩欧美一区在线观看| 精品国产一区二区在线观看| 精品乱人伦小说| 国产精品麻豆欧美日韩ww| 国产精品久久久久国产精品日日| 最新国产の精品合集bt伙计| 韩国毛片一区二区三区| 99久久婷婷国产精品综合| 欧美不卡在线视频| 日本伊人色综合网| jlzzjlzz国产精品久久| 欧洲中文字幕精品| 亚洲精品国产无天堂网2021 | 色拍拍在线精品视频8848| 久久久久九九视频| 亚洲另类在线视频| 日本成人在线视频网站| 欧美色中文字幕| 亚洲图片有声小说| 91成人在线精品| 精品国产网站在线观看| 亚洲女人的天堂| 久久成人免费日本黄色| 欧美不卡一区二区三区四区| 黄色精品一二区| 久久精品一区二区三区不卡| 国产精品一二三四| 国产精品免费久久久久| 日av在线不卡| 日韩欧美国产麻豆| 一区二区在线看| 91成人免费在线| 亚洲成人av电影| 成人涩涩免费视频| 日韩欧美亚洲国产精品字幕久久久 | 一区二区三区四区精品在线视频| 蜜臀av一区二区| 在线精品视频一区二区| 无吗不卡中文字幕| 色屁屁一区二区| 亚洲国产精品黑人久久久| 老司机免费视频一区二区三区| 91啪九色porn原创视频在线观看| 99re这里都是精品| 国产亚洲综合色| 久久99国产精品麻豆| 欧美国产综合色视频| 欧美一区二区视频观看视频| 中文字幕的久久| 91丨九色丨黑人外教| 国产欧美1区2区3区| 91蜜桃视频在线| 中文字幕欧美激情| 91黄色免费版| 一个色妞综合视频在线观看| 波多野结衣一区二区三区| 欧美激情综合在线| 欧美私人免费视频| 亚洲免费在线观看视频| 日韩精品一区二区三区三区免费| 天天操天天综合网| 欧洲国内综合视频| 夜夜嗨av一区二区三区四季av| 成人教育av在线| 亚洲欧洲av在线| 99精品国产一区二区三区不卡| 国产日韩精品视频一区| 欧美日韩精品专区| 日韩电影在线观看网站| 中文字幕亚洲区| 在线观看91视频| 懂色av一区二区三区蜜臀| 视频一区在线视频| 精品国产乱码久久久久久久| 国产自产2019最新不卡| 亚洲成人av电影在线| 日韩一区二区麻豆国产| 精品一区二区三区免费播放| 久久综合视频网| 懂色一区二区三区免费观看| 日韩av中文字幕一区二区| 日韩视频一区二区三区| 欧美性色黄大片| 91麻豆自制传媒国产之光| 亚洲永久免费av| 国产精品电影一区二区| 国产亚洲美州欧州综合国| 99精品久久免费看蜜臀剧情介绍| 一区二区三区四区激情| 日韩一级片网站| 国产成人夜色高潮福利影视| 亚洲欧美激情一区二区| 亚洲国产高清在线观看视频| 91亚洲国产成人精品一区二区三| 亚洲一区日韩精品中文字幕| 亚洲视频在线观看三级| 欧美成人bangbros| 777xxx欧美| 69p69国产精品| 日韩午夜精品电影| 精品裸体舞一区二区三区| 精品国产乱码久久久久久影片| 日本视频在线一区| 日韩av在线播放中文字幕| 亚洲午夜精品一区二区三区他趣| 欧美一区中文字幕| 成人毛片在线观看| 日韩高清在线不卡| 亚洲日本在线a| 久久人人爽人人爽| 欧美人动与zoxxxx乱| www.久久精品| 在线国产亚洲欧美| 不卡视频在线看| 久久精品国产精品亚洲精品| 亚洲人123区| 久久精品视频一区二区三区| 欧美无砖专区一中文字| av成人免费在线观看| 91国在线观看| 91在线无精精品入口| 粉嫩嫩av羞羞动漫久久久| 免费看日韩精品| 亚洲成人综合视频| 激情久久久久久久久久久久久久久久| 亚洲精品视频在线| 亚洲欧洲在线观看av| 亚洲国产毛片aaaaa无费看| 亚洲欧洲日韩女同| 日韩av一二三| 午夜久久久久久久久久一区二区| 日韩欧美国产综合在线一区二区三区| 色综合久久精品| av不卡在线播放| 欧美一卡2卡3卡4卡| 欧美一区二区三区公司| 亚洲国产激情av| 国产精品久久一级| 中文字幕免费不卡| 国产目拍亚洲精品99久久精品| 91婷婷韩国欧美一区二区|