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

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

?? fitblk.c

?? ZIP壓縮算法源代碼,可以直接加入C++Project中編譯調用
?? C
字號:
/* fitblk.c: example of fitting compressed output to a specified size
   Not copyrighted -- provided to the public domain
   Version 1.1  25 November 2004  Mark Adler */

/* Version history:
   1.0  24 Nov 2004  First version
   1.1  25 Nov 2004  Change deflateInit2() to deflateInit()
                     Use fixed-size, stack-allocated raw buffers
                     Simplify code moving compression to subroutines
                     Use assert() for internal errors
                     Add detailed description of approach
 */

/* Approach to just fitting a requested compressed size:

   fitblk performs three compression passes on a portion of the input
   data in order to determine how much of that input will compress to
   nearly the requested output block size.  The first pass generates
   enough deflate blocks to produce output to fill the requested
   output size plus a specfied excess amount (see the EXCESS define
   below).  The last deflate block may go quite a bit past that, but
   is discarded.  The second pass decompresses and recompresses just
   the compressed data that fit in the requested plus excess sized
   buffer.  The deflate process is terminated after that amount of
   input, which is less than the amount consumed on the first pass.
   The last deflate block of the result will be of a comparable size
   to the final product, so that the header for that deflate block and
   the compression ratio for that block will be about the same as in
   the final product.  The third compression pass decompresses the
   result of the second step, but only the compressed data up to the
   requested size minus an amount to allow the compressed stream to
   complete (see the MARGIN define below).  That will result in a
   final compressed stream whose length is less than or equal to the
   requested size.  Assuming sufficient input and a requested size
   greater than a few hundred bytes, the shortfall will typically be
   less than ten bytes.

   If the input is short enough that the first compression completes
   before filling the requested output size, then that compressed
   stream is return with no recompression.

   EXCESS is chosen to be just greater than the shortfall seen in a
   two pass approach similar to the above.  That shortfall is due to
   the last deflate block compressing more efficiently with a smaller
   header on the second pass.  EXCESS is set to be large enough so
   that there is enough uncompressed data for the second pass to fill
   out the requested size, and small enough so that the final deflate
   block of the second pass will be close in size to the final deflate
   block of the third and final pass.  MARGIN is chosen to be just
   large enough to assure that the final compression has enough room
   to complete in all cases.
 */

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "zlib.h"

#define local static

/* print nastygram and leave */
local void quit(char *why)
{
    fprintf(stderr, "fitblk abort: %s\n", why);
    exit(1);
}

#define RAWLEN 4096    /* intermediate uncompressed buffer size */

/* compress from file to def until provided buffer is full or end of
   input reached; return last deflate() return value, or Z_ERRNO if
   there was read error on the file */
local int partcompress(FILE *in, z_streamp def)
{
    int ret, flush;
    unsigned char raw[RAWLEN];

    flush = Z_NO_FLUSH;
    do {
        def->avail_in = fread(raw, 1, RAWLEN, in);
        if (ferror(in))
            return Z_ERRNO;
        def->next_in = raw;
        if (feof(in))
            flush = Z_FINISH;
        ret = deflate(def, flush);
        assert(ret != Z_STREAM_ERROR);
    } while (def->avail_out != 0 && flush == Z_NO_FLUSH);
    return ret;
}

/* recompress from inf's input to def's output; the input for inf and
   the output for def are set in those structures before calling;
   return last deflate() return value, or Z_MEM_ERROR if inflate()
   was not able to allocate enough memory when it needed to */
local int recompress(z_streamp inf, z_streamp def)
{
    int ret, flush;
    unsigned char raw[RAWLEN];

    flush = Z_NO_FLUSH;
    do {
        /* decompress */
        inf->avail_out = RAWLEN;
        inf->next_out = raw;
        ret = inflate(inf, Z_NO_FLUSH);
        assert(ret != Z_STREAM_ERROR && ret != Z_DATA_ERROR &&
               ret != Z_NEED_DICT);
        if (ret == Z_MEM_ERROR)
            return ret;

        /* compress what was decompresed until done or no room */
        def->avail_in = RAWLEN - inf->avail_out;
        def->next_in = raw;
        if (inf->avail_out != 0)
            flush = Z_FINISH;
        ret = deflate(def, flush);
        assert(ret != Z_STREAM_ERROR);
    } while (ret != Z_STREAM_END && def->avail_out != 0);
    return ret;
}

#define EXCESS 256      /* empirically determined stream overage */
#define MARGIN 8        /* amount to back off for completion */

/* compress from stdin to fixed-size block on stdout */
int main(int argc, char **argv)
{
    int ret;                /* return code */
    unsigned size;          /* requested fixed output block size */
    unsigned have;          /* bytes written by deflate() call */
    unsigned char *blk;     /* intermediate and final stream */
    unsigned char *tmp;     /* close to desired size stream */
    z_stream def, inf;      /* zlib deflate and inflate states */

    /* get requested output size */
    if (argc != 2)
        quit("need one argument: size of output block");
    ret = strtol(argv[1], argv + 1, 10);
    if (argv[1][0] != 0)
        quit("argument must be a number");
    if (ret < 8)            /* 8 is minimum zlib stream size */
        quit("need positive size of 8 or greater");
    size = (unsigned)ret;

    /* allocate memory for buffers and compression engine */
    blk = malloc(size + EXCESS);
    def.zalloc = Z_NULL;
    def.zfree = Z_NULL;
    def.opaque = Z_NULL;
    ret = deflateInit(&def, Z_DEFAULT_COMPRESSION);
    if (ret != Z_OK || blk == NULL)
        quit("out of memory");

    /* compress from stdin until output full, or no more input */
    def.avail_out = size + EXCESS;
    def.next_out = blk;
    ret = partcompress(stdin, &def);
    if (ret == Z_ERRNO)
        quit("error reading input");

    /* if it all fit, then size was undersubscribed -- done! */
    if (ret == Z_STREAM_END && def.avail_out >= EXCESS) {
        /* write block to stdout */
        have = size + EXCESS - def.avail_out;
        if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
            quit("error writing output");

        /* clean up and print results to stderr */
        ret = deflateEnd(&def);
        assert(ret != Z_STREAM_ERROR);
        free(blk);
        fprintf(stderr,
                "%u bytes unused out of %u requested (all input)\n",
                size - have, size);
        return 0;
    }

    /* it didn't all fit -- set up for recompression */
    inf.zalloc = Z_NULL;
    inf.zfree = Z_NULL;
    inf.opaque = Z_NULL;
    inf.avail_in = 0;
    inf.next_in = Z_NULL;
    ret = inflateInit(&inf);
    tmp = malloc(size + EXCESS);
    if (ret != Z_OK || tmp == NULL)
        quit("out of memory");
    ret = deflateReset(&def);
    assert(ret != Z_STREAM_ERROR);

    /* do first recompression close to the right amount */
    inf.avail_in = size + EXCESS;
    inf.next_in = blk;
    def.avail_out = size + EXCESS;
    def.next_out = tmp;
    ret = recompress(&inf, &def);
    if (ret == Z_MEM_ERROR)
        quit("out of memory");

    /* set up for next reocmpression */
    ret = inflateReset(&inf);
    assert(ret != Z_STREAM_ERROR);
    ret = deflateReset(&def);
    assert(ret != Z_STREAM_ERROR);

    /* do second and final recompression (third compression) */
    inf.avail_in = size - MARGIN;   /* assure stream will complete */
    inf.next_in = tmp;
    def.avail_out = size;
    def.next_out = blk;
    ret = recompress(&inf, &def);
    if (ret == Z_MEM_ERROR)
        quit("out of memory");
    assert(ret == Z_STREAM_END);    /* otherwise MARGIN too small */

    /* done -- write block to stdout */
    have = size - def.avail_out;
    if (fwrite(blk, 1, have, stdout) != have || ferror(stdout))
        quit("error writing output");

    /* clean up and print results to stderr */
    free(tmp);
    ret = inflateEnd(&inf);
    assert(ret != Z_STREAM_ERROR);
    ret = deflateEnd(&def);
    assert(ret != Z_STREAM_ERROR);
    free(blk);
    fprintf(stderr,
            "%u bytes unused out of %u requested (%lu input)\n",
            size - have, size, def.total_in);
    return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色香色香欲天天天影视综合网| 欧美大片拔萝卜| 国产日韩精品一区二区浪潮av | 国产欧美日产一区| 国产成人在线视频免费播放| 亚洲国产精品av| 一本一本大道香蕉久在线精品| 一区二区国产盗摄色噜噜| 欧美系列在线观看| 美腿丝袜亚洲一区| 久久精品一区二区三区不卡| 国产69精品久久99不卡| 国产露脸91国语对白| 美女在线视频一区| 欧美大胆人体bbbb| 国产91综合一区在线观看| 亚洲欧美日韩国产综合| 欧美疯狂性受xxxxx喷水图片| 久久se精品一区精品二区| 国产精品无码永久免费888| 色噜噜偷拍精品综合在线| 日韩二区三区四区| 国产欧美日韩久久| 在线观看亚洲精品视频| 国内外成人在线| 亚洲天堂成人网| 日韩精品一区二| 91在线观看美女| 奇米888四色在线精品| 国产精品久久久久久亚洲毛片 | 在线观看不卡视频| 日本va欧美va精品发布| 亚洲精品国产一区二区精华液| 亚洲久草在线视频| 91精品国产入口在线| 国产成人av一区二区| 午夜免费久久看| 欧美国产激情一区二区三区蜜月| 欧美综合亚洲图片综合区| 九九久久精品视频| 亚洲午夜一二三区视频| 久久久久88色偷偷免费| 欧美精品丝袜中出| 成人免费视频caoporn| 青青青伊人色综合久久| 亚洲毛片av在线| 国产精品视频一二| 精品成人佐山爱一区二区| 欧美日韩色一区| 91小视频在线观看| 国产乱色国产精品免费视频| 日韩黄色在线观看| 亚洲综合成人网| 亚洲日本在线看| 国产欧美日本一区二区三区| 日韩一区二区精品在线观看| 欧美日韩综合一区| 亚洲综合色丁香婷婷六月图片| 日韩一二三区视频| 欧美视频中文字幕| 99re这里只有精品首页| 成人性色生活片免费看爆迷你毛片| 麻豆成人久久精品二区三区红| 一区二区三区国产精华| 亚洲欧美日韩人成在线播放| 国产三级一区二区| 国产人伦精品一区二区| 久久久午夜电影| 精品福利一区二区三区| 制服丝袜亚洲网站| 亚洲一区二区精品久久av| 久久99国产精品麻豆| www亚洲一区| 日韩亚洲欧美成人一区| 国产曰批免费观看久久久| 久久66热偷产精品| 美女一区二区三区| 久久99精品一区二区三区三区| 日韩精品一卡二卡三卡四卡无卡| 亚洲国产日产av| 亚洲不卡av一区二区三区| 亚洲在线免费播放| 亚洲亚洲精品在线观看| 精品伦理精品一区| 欧美日韩电影一区| 在线不卡中文字幕播放| 5月丁香婷婷综合| 91精品欧美福利在线观看| 欧美一卡在线观看| 欧美va亚洲va香蕉在线| 日韩精品综合一本久道在线视频| 精品久久久久久久久久久久久久久久久 | 精品对白一区国产伦| 久久免费看少妇高潮| 欧美国产综合色视频| 亚洲男人电影天堂| 天天av天天翘天天综合网| 视频一区中文字幕国产| 激情五月激情综合网| 成人精品视频一区二区三区| 色综合视频在线观看| 成人av片在线观看| 亚洲成a人v欧美综合天堂下载| 亚洲一级电影视频| 青青草原综合久久大伊人精品| 精品在线播放免费| 成人高清免费观看| 欧美日韩中文字幕精品| 日韩免费一区二区| 国产精品萝li| 日韩国产欧美三级| 国产成人av一区二区三区在线| 在线观看国产精品网站| 亚洲精品在线三区| 亚洲综合激情小说| 黄页网站大全一区二区| 91猫先生在线| 精品国产凹凸成av人网站| 亚洲桃色在线一区| 久久国产欧美日韩精品| 99久久99久久免费精品蜜臀| 欧美一区二区三区在线| 中文字幕一区二区日韩精品绯色| 亚洲国产精品久久久男人的天堂| 国产精品一区二区久激情瑜伽 | 午夜久久久久久久久| 国产成人av网站| 91蜜桃传媒精品久久久一区二区| 国产传媒久久文化传媒| 欧美日韩一区二区在线视频| 久久精品免费在线观看| 亚洲国产综合色| 成人福利视频网站| 日韩欧美一区在线观看| 亚洲精品老司机| 国产精品一区在线观看乱码 | 久久久三级国产网站| 亚洲国产美女搞黄色| 成人短视频下载 | 在线观看不卡一区| 国产精品一区免费视频| 欧美高清激情brazzers| 亚洲人吸女人奶水| 高清国产一区二区三区| 欧美一级精品在线| 夜夜爽夜夜爽精品视频| 成av人片一区二区| 国产亚洲精久久久久久| 免费人成在线不卡| 精品视频1区2区| 一区二区三区中文字幕精品精品| 高清在线观看日韩| 久久蜜臀精品av| 九九国产精品视频| 日韩精品一区二区在线观看| 亚洲综合成人网| 欧美性受xxxx黑人xyx性爽| 亚洲免费伊人电影| 色老头久久综合| 综合网在线视频| 91日韩一区二区三区| 国产精品毛片a∨一区二区三区| 国产成人精品免费一区二区| 久久久久久免费毛片精品| 久久99精品一区二区三区三区| 日韩一区二区高清| 久久激五月天综合精品| 欧美日韩激情一区| 天堂蜜桃91精品| 日韩 欧美一区二区三区| 91国产免费看| 一区二区三区四区精品在线视频| 91麻豆精品在线观看| 亚洲色图制服诱惑| 99精品1区2区| 一个色综合av| 欧美日本国产一区| 五月婷婷欧美视频| 日韩一区二区免费电影| 精品一区二区三区日韩| 久久久久久97三级| 粉嫩久久99精品久久久久久夜 | 欧美亚洲图片小说| 偷拍一区二区三区| 欧美电视剧免费观看| 国产一区二区中文字幕| 国产清纯美女被跳蛋高潮一区二区久久w | 亚洲欧美日韩国产综合在线| 欧美日韩久久不卡| 久久精品国产精品亚洲综合| 精品国产sm最大网站免费看| 国产乱码精品1区2区3区| 亚洲日本免费电影| 欧美一级二级三级蜜桃| 精品夜夜嗨av一区二区三区| 中文一区二区在线观看| 欧亚洲嫩模精品一区三区| 免费成人小视频| 成人免费一区二区三区视频| 欧美日韩高清一区二区不卡|