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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gzappend.c

?? ZIP壓縮算法源代碼,可以直接加入C++Project中編譯調(diào)用
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* gzappend -- command to append to a gzip file

  Copyright (C) 2003 Mark Adler, all rights reserved
  version 1.1, 4 Nov 2003

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the author be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  Mark Adler    madler@alumni.caltech.edu
 */

/*
 * Change history:
 *
 * 1.0  19 Oct 2003     - First version
 * 1.1   4 Nov 2003     - Expand and clarify some comments and notes
 *                      - Add version and copyright to help
 *                      - Send help to stdout instead of stderr
 *                      - Add some preemptive typecasts
 *                      - Add L to constants in lseek() calls
 *                      - Remove some debugging information in error messages
 *                      - Use new data_type definition for zlib 1.2.1
 *                      - Simplfy and unify file operations
 *                      - Finish off gzip file in gztack()
 *                      - Use deflatePrime() instead of adding empty blocks
 *                      - Keep gzip file clean on appended file read errors
 *                      - Use in-place rotate instead of auxiliary buffer
 *                        (Why you ask?  Because it was fun to write!)
 */

/*
   gzappend takes a gzip file and appends to it, compressing files from the
   command line or data from stdin.  The gzip file is written to directly, to
   avoid copying that file, in case it's large.  Note that this results in the
   unfriendly behavior that if gzappend fails, the gzip file is corrupted.

   This program was written to illustrate the use of the new Z_BLOCK option of
   zlib 1.2.x's inflate() function.  This option returns from inflate() at each
   block boundary to facilitate locating and modifying the last block bit at
   the start of the final deflate block.  Also whether using Z_BLOCK or not,
   another required feature of zlib 1.2.x is that inflate() now provides the
   number of unusued bits in the last input byte used.  gzappend will not work
   with versions of zlib earlier than 1.2.1.

   gzappend first decompresses the gzip file internally, discarding all but
   the last 32K of uncompressed data, and noting the location of the last block
   bit and the number of unused bits in the last byte of the compressed data.
   The gzip trailer containing the CRC-32 and length of the uncompressed data
   is verified.  This trailer will be later overwritten.

   Then the last block bit is cleared by seeking back in the file and rewriting
   the byte that contains it.  Seeking forward, the last byte of the compressed
   data is saved along with the number of unused bits to initialize deflate.

   A deflate process is initialized, using the last 32K of the uncompressed
   data from the gzip file to initialize the dictionary.  If the total
   uncompressed data was less than 32K, then all of it is used to initialize
   the dictionary.  The deflate output bit buffer is also initialized with the
   last bits from the original deflate stream.  From here on, the data to
   append is simply compressed using deflate, and written to the gzip file.
   When that is complete, the new CRC-32 and uncompressed length are written
   as the trailer of the gzip file.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include "zlib.h"

#define local static
#define LGCHUNK 14
#define CHUNK (1U << LGCHUNK)
#define DSIZE 32768U

/* print an error message and terminate with extreme prejudice */
local void bye(char *msg1, char *msg2)
{
    fprintf(stderr, "gzappend error: %s%s\n", msg1, msg2);
    exit(1);
}

/* return the greatest common divisor of a and b using Euclid's algorithm,
   modified to be fast when one argument much greater than the other, and
   coded to avoid unnecessary swapping */
local unsigned gcd(unsigned a, unsigned b)
{
    unsigned c;

    while (a && b)
        if (a > b) {
            c = b;
            while (a - c >= c)
                c <<= 1;
            a -= c;
        }
        else {
            c = a;
            while (b - c >= c)
                c <<= 1;
            b -= c;
        }
    return a + b;
}

/* rotate list[0..len-1] left by rot positions, in place */
local void rotate(unsigned char *list, unsigned len, unsigned rot)
{
    unsigned char tmp;
    unsigned cycles;
    unsigned char *start, *last, *to, *from;

    /* normalize rot and handle degenerate cases */
    if (len < 2) return;
    if (rot >= len) rot %= len;
    if (rot == 0) return;

    /* pointer to last entry in list */
    last = list + (len - 1);

    /* do simple left shift by one */
    if (rot == 1) {
        tmp = *list;
        memcpy(list, list + 1, len - 1);
        *last = tmp;
        return;
    }

    /* do simple right shift by one */
    if (rot == len - 1) {
        tmp = *last;
        memmove(list + 1, list, len - 1);
        *list = tmp;
        return;
    }

    /* otherwise do rotate as a set of cycles in place */
    cycles = gcd(len, rot);             /* number of cycles */
    do {
        start = from = list + cycles;   /* start index is arbitrary */
        tmp = *from;                    /* save entry to be overwritten */
        for (;;) {
            to = from;                  /* next step in cycle */
            from += rot;                /* go right rot positions */
            if (from > last) from -= len;   /* (pointer better not wrap) */
            if (from == start) break;   /* all but one shifted */
            *to = *from;                /* shift left */
        }
        *to = tmp;                      /* complete the circle */
    } while (--cycles);
}

/* structure for gzip file read operations */
typedef struct {
    int fd;                     /* file descriptor */
    int size;                   /* 1 << size is bytes in buf */
    unsigned left;              /* bytes available at next */
    unsigned char *buf;         /* buffer */
    unsigned char *next;        /* next byte in buffer */
    char *name;                 /* file name for error messages */
} file;

/* reload buffer */
local int readin(file *in)
{
    int len;

    len = read(in->fd, in->buf, 1 << in->size);
    if (len == -1) bye("error reading ", in->name);
    in->left = (unsigned)len;
    in->next = in->buf;
    return len;
}

/* read from file in, exit if end-of-file */
local int readmore(file *in)
{
    if (readin(in) == 0) bye("unexpected end of ", in->name);
    return 0;
}

#define read1(in) (in->left == 0 ? readmore(in) : 0, \
                   in->left--, *(in->next)++)

/* skip over n bytes of in */
local void skip(file *in, unsigned n)
{
    unsigned bypass;

    if (n > in->left) {
        n -= in->left;
        bypass = n & ~((1U << in->size) - 1);
        if (bypass) {
            if (lseek(in->fd, (off_t)bypass, SEEK_CUR) == -1)
                bye("seeking ", in->name);
            n -= bypass;
        }
        readmore(in);
        if (n > in->left)
            bye("unexpected end of ", in->name);
    }
    in->left -= n;
    in->next += n;
}

/* read a four-byte unsigned integer, little-endian, from in */
unsigned long read4(file *in)
{
    unsigned long val;

    val = read1(in);
    val += (unsigned)read1(in) << 8;
    val += (unsigned long)read1(in) << 16;
    val += (unsigned long)read1(in) << 24;
    return val;
}

/* skip over gzip header */
local void gzheader(file *in)
{
    int flags;
    unsigned n;

    if (read1(in) != 31 || read1(in) != 139) bye(in->name, " not a gzip file");
    if (read1(in) != 8) bye("unknown compression method in", in->name);
    flags = read1(in);
    if (flags & 0xe0) bye("unknown header flags set in", in->name);
    skip(in, 6);
    if (flags & 4) {
        n = read1(in);
        n += (unsigned)(read1(in)) << 8;
        skip(in, n);
    }
    if (flags & 8) while (read1(in) != 0) ;
    if (flags & 16) while (read1(in) != 0) ;
    if (flags & 2) skip(in, 2);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产麻豆精品视频| 91免费在线看| 亚洲精品久久久蜜桃| 91精品一区二区三区在线观看| 国产激情视频一区二区在线观看| 亚洲一区在线看| 国产精品国产三级国产三级人妇| 日韩欧美中文字幕公布| 色哟哟欧美精品| 国产91在线观看| 毛片av一区二区| 亚洲va在线va天堂| 中文字幕亚洲精品在线观看| 精品国产sm最大网站| 欧美日韩国产成人在线免费| av在线一区二区三区| 国产河南妇女毛片精品久久久 | 国产精品久久看| 日韩一二在线观看| 欧美喷潮久久久xxxxx| 91丨九色丨国产丨porny| 国产一区高清在线| 蜜桃视频一区二区三区在线观看| 久久久欧美精品sm网站| 精品国产在天天线2019| 欧美一区在线视频| 91国产成人在线| 色婷婷综合久色| 97se亚洲国产综合自在线不卡| 国产传媒久久文化传媒| 国内成人自拍视频| 国产真实乱子伦精品视频| 极品少妇xxxx偷拍精品少妇| 看电影不卡的网站| 亚洲精品写真福利| 1024成人网| 亚洲精品欧美激情| 亚洲欧美日韩国产中文在线| 一区二区三区中文在线| 亚洲综合色婷婷| 香蕉久久夜色精品国产使用方法| 亚洲妇熟xx妇色黄| 婷婷一区二区三区| 天堂蜜桃91精品| 蜜桃视频第一区免费观看| 精品中文字幕一区二区小辣椒 | 五月激情综合色| 午夜久久久久久久久久一区二区| 亚洲成人动漫在线免费观看| 丝袜美腿亚洲综合| 日韩精品视频网| 美女一区二区视频| 国产黄色精品网站| 97se亚洲国产综合自在线不卡| 日本韩国一区二区| 欧美日韩国产电影| 久久网站最新地址| 国产精品久久99| 亚洲另类在线制服丝袜| 亚洲午夜国产一区99re久久| 日韩不卡一区二区三区| 伦理电影国产精品| 国产99精品在线观看| 91久久香蕉国产日韩欧美9色| 精品视频在线免费观看| 666欧美在线视频| 国产网红主播福利一区二区| 一区在线中文字幕| 日韩电影网1区2区| 成人毛片在线观看| 欧美猛男gaygay网站| www日韩大片| 伊人性伊人情综合网| 天堂av在线一区| 国产精品一二三区| 欧美视频自拍偷拍| wwwwww.欧美系列| 亚洲欧美日韩一区| 蜜臀精品一区二区三区在线观看| 粉嫩aⅴ一区二区三区四区五区 | 粉嫩av一区二区三区粉嫩| 欧美在线视频不卡| 久久久精品国产99久久精品芒果| 亚洲黄色小说网站| 国产剧情一区在线| 欧美日韩日日摸| 国产欧美一区二区三区鸳鸯浴| 一区二区三区不卡在线观看| 免费高清在线视频一区·| av在线播放一区二区三区| 91精品国产综合久久久蜜臀粉嫩| 欧美国产激情二区三区 | 国产一区二区免费视频| 欧洲生活片亚洲生活在线观看| 精品国产一区二区三区久久影院| 伊人开心综合网| 国产成人综合在线观看| 91麻豆精品久久久久蜜臀 | 最新国产精品久久精品| 蜜桃视频一区二区三区| 欧美在线短视频| 国产精品网站在线| 国产自产v一区二区三区c| 欧美日韩在线综合| 欧美国产日本视频| 国产一区二区福利视频| 在线电影院国产精品| 亚洲人成在线播放网站岛国| 国产精品自拍毛片| 欧美成人一区二区| 日韩激情中文字幕| 欧美在线啊v一区| 亚洲日本在线看| 成人激情av网| 欧美激情一二三区| 狠狠色丁香久久婷婷综合丁香| 91麻豆精品久久久久蜜臀| 一级精品视频在线观看宜春院 | 日韩一区二区在线观看| 亚洲成av人综合在线观看| 色www精品视频在线观看| 亚洲欧洲性图库| av电影在线观看不卡| 国产欧美一区二区精品仙草咪| 精品一区二区av| 日韩美女天天操| 欧美96一区二区免费视频| 欧美日韩高清一区| 亚洲一卡二卡三卡四卡无卡久久| 91美女精品福利| 亚洲美女电影在线| 一本大道久久a久久综合婷婷| 国产精品久久久一本精品| 国产成都精品91一区二区三| 国产亚洲一二三区| 国产成人精品三级| 国产精品网站导航| 91麻豆福利精品推荐| 亚洲欧美偷拍三级| 91国产精品成人| 亚洲国产一区二区三区青草影视| 欧美图区在线视频| 日本欧美大码aⅴ在线播放| 日韩精品中文字幕在线不卡尤物| 精品系列免费在线观看| 久久老女人爱爱| 不卡一区二区中文字幕| 一区二区三区在线视频播放 | av亚洲产国偷v产偷v自拍| 国产精品美女视频| 色久综合一二码| 亚洲国产wwwccc36天堂| 8x8x8国产精品| 免费在线观看一区二区三区| 久久人人97超碰com| 成人精品免费视频| 亚洲精品乱码久久久久久黑人| 欧美日韩在线电影| 日韩不卡手机在线v区| 久久综合精品国产一区二区三区| 国产福利一区在线观看| 国产精品久久久久久久岛一牛影视 | 日韩国产精品大片| 国产亚洲精品中文字幕| 91麻豆swag| 日本欧美一区二区在线观看| 国产日韩欧美电影| 欧美在线免费视屏| 精品一区二区精品| 有码一区二区三区| 日韩三级伦理片妻子的秘密按摩| 粉嫩欧美一区二区三区高清影视| 亚洲综合激情另类小说区| 日韩精品一区二区三区中文不卡| 高清在线观看日韩| 午夜精品一区二区三区免费视频 | 久久蜜桃av一区精品变态类天堂 | 久久久久久综合| 欧美亚洲尤物久久| 国产曰批免费观看久久久| 亚洲精品视频观看| 26uuu精品一区二区 | 欧美激情一区二区三区四区| 在线免费一区三区| 国产精品亚洲成人| 午夜视频在线观看一区二区三区| 欧美极品少妇xxxxⅹ高跟鞋| 欧美日韩成人综合在线一区二区| 成人午夜私人影院| 久久精品99国产精品日本| 亚洲欧美福利一区二区| 久久久欧美精品sm网站| 8x8x8国产精品| 一本大道久久a久久综合| 国产美女精品在线| 蜜桃av一区二区在线观看 | 久久99精品久久久久婷婷| 亚洲美女在线国产| 国产午夜精品一区二区三区四区| 欧美人成免费网站|