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

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

?? unzip.cpp

?? 一個C語言實現的壓縮解壓的工具代碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
/* unzip.c -- IO on .zip files using zlib 
   Version 0.15 beta, Mar 19th, 1998,

   Read unzip.h for more info
*/

#include "stdafx.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "unzip.h"

#ifdef STDC
#  include <stddef.h>
#  include <string.h>
#  include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
    extern int errno;
#else
#   include <errno.h>
#endif


#ifndef local
#  define local static
#endif
/* compile with -Dlocal if your debugger can't find static symbols */



#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
                      !defined(CASESENSITIVITYDEFAULT_NO)
#define CASESENSITIVITYDEFAULT_NO
#endif


#ifndef UNZ_BUFSIZE
#define UNZ_BUFSIZE (16384)
#endif

#ifndef UNZ_MAXFILENAMEINZIP
#define UNZ_MAXFILENAMEINZIP (256)
#endif

#ifndef ALLOC
# define ALLOC(size) (malloc(size))
#endif
#ifndef TRYFREE
# define TRYFREE(p) {if (p) free(p);}
#endif

#define SIZECENTRALDIRITEM (0x2e)
#define SIZEZIPLOCALHEADER (0x1e)


/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */

#ifndef SEEK_CUR
#define SEEK_CUR    1
#endif

#ifndef SEEK_END
#define SEEK_END    2
#endif

#ifndef SEEK_SET
#define SEEK_SET    0
#endif

const char unz_copyright[] =
   " unzip 0.15 Copyright 1998 Gilles Vollant ";

/* unz_file_info_interntal contain internal info about a file in zipfile*/
typedef struct unz_file_info_internal_s
{
    uLong offset_curfile;/* relative offset of local header 4 bytes */
} unz_file_info_internal;


/* file_in_zip_read_info_s contain internal information about a file in zipfile,
    when reading and decompress it */
typedef struct
{
	char  *read_buffer;         /* internal buffer for compressed data */
	z_stream stream;            /* zLib stream structure for inflate */

	uLong pos_in_zipfile;       /* position in byte on the zipfile, for fseek*/
	uLong stream_initialised;   /* flag set if stream structure is initialised*/

	uLong offset_local_extrafield;/* offset of the local extra field */
	uInt  size_local_extrafield;/* size of the local extra field */
	uLong pos_local_extrafield;   /* position in the local extra field in read*/

	uLong crc32;                /* crc32 of all data uncompressed */
	uLong crc32_wait;           /* crc32 we must obtain after decompress all */
	uLong rest_read_compressed; /* number of byte to be decompressed */
	uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
	FILE* file;                 /* io structore of the zipfile */
	uLong compression_method;   /* compression method (0==store) */
	uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
} file_in_zip_read_info_s;


/* unz_s contain internal information about the zipfile
*/
typedef struct
{
	FILE* file;                 /* io structore of the zipfile */
	unz_global_info gi;       /* public global information */
	uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
	uLong num_file;             /* number of the current file in the zipfile*/
	uLong pos_in_central_dir;   /* pos of the current file in the central dir*/
	uLong current_file_ok;      /* flag about the usability of the current file*/
	uLong central_pos;          /* position of the beginning of the central dir*/

	uLong size_central_dir;     /* size of the central directory  */
	uLong offset_central_dir;   /* offset of start of central directory with
								   respect to the starting disk number */

	unz_file_info cur_file_info; /* public info about the current file in zip*/
	unz_file_info_internal cur_file_info_internal; /* private info about it*/
    file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
	                                    file if we are decompressing it */
} unz_s;


/* ===========================================================================
     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
   for end of file.
   IN assertion: the stream s has been sucessfully opened for reading.
*/


local int unzlocal_getByte(	FILE *fin,
	int *pi)

{
    unsigned char c;
	int err = fread(&c, 1, 1, fin);
    if (err==1)
    {
        *pi = (int)c;
        return UNZ_OK;
    }
    else
    {
        if (ferror(fin)) 
            return UNZ_ERRNO;
        else
            return UNZ_EOF;
    }
}


/* ===========================================================================
   Reads a long in LSB order from the given gz_stream. Sets 
*/
local int unzlocal_getShort (	FILE* fin,
    uLong *pX)

{
    uLong x ;
    int i;
    int err;

    err = unzlocal_getByte(fin,&i);
    x = (uLong)i;
    
    if (err==UNZ_OK)
        err = unzlocal_getByte(fin,&i);
    x += ((uLong)i)<<8;
   
    if (err==UNZ_OK)
        *pX = x;
    else
        *pX = 0;
    return err;
}

local int unzlocal_getLong (	FILE* fin,
    uLong *pX)

{
    uLong x ;
    int i;
    int err;

    err = unzlocal_getByte(fin,&i);
    x = (uLong)i;
    
    if (err==UNZ_OK)
        err = unzlocal_getByte(fin,&i);
    x += ((uLong)i)<<8;

    if (err==UNZ_OK)
        err = unzlocal_getByte(fin,&i);
    x += ((uLong)i)<<16;

    if (err==UNZ_OK)
        err = unzlocal_getByte(fin,&i);
    x += ((uLong)i)<<24;
   
    if (err==UNZ_OK)
        *pX = x;
    else
        *pX = 0;
    return err;
}


/* My own strcmpi / strcasecmp */
local int strcmpcasenosensitive_internal (	const char* fileName1,
	const char* fileName2)

{
	for (;;)
	{
		char c1=*(fileName1++);
		char c2=*(fileName2++);
		if ((c1>='a') && (c1<='z'))
			c1 -= 0x20;
		if ((c2>='a') && (c2<='z'))
			c2 -= 0x20;
		if (c1=='\0')
			return ((c2=='\0') ? 0 : -1);
		if (c2=='\0')
			return 1;
		if (c1<c2)
			return -1;
		if (c1>c2)
			return 1;
	}
}


#ifdef  CASESENSITIVITYDEFAULT_NO
#define CASESENSITIVITYDEFAULTVALUE 2
#else
#define CASESENSITIVITYDEFAULTVALUE 1
#endif

#ifndef STRCMPCASENOSENTIVEFUNCTION
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif

/* 
   Compare two filename (fileName1,fileName2).
   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
   If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
                                                                or strcasecmp)
   If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
        (like 1 on Unix, 2 on Windows)

*/
extern int ZEXPORT unzStringFileNameCompare (	const char* fileName1,
	const char* fileName2,
	int iCaseSensitivity)

{
	if (iCaseSensitivity==0)
		iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;

	if (iCaseSensitivity==1)
		return strcmp(fileName1,fileName2);

	return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
} 

#define BUFREADCOMMENT (0x400)

/*
  Locate the Central directory of a zipfile (at the end, just before
    the global comment)
*/
local uLong unzlocal_SearchCentralDir(	FILE *fin)

{
	unsigned char* buf;
	uLong uSizeFile;
	uLong uBackRead;
	uLong uMaxBack=0xffff; /* maximum size of global comment */
	uLong uPosFound=0;
	
	if (fseek(fin,0,SEEK_END) != 0)
		return 0;


	uSizeFile = ftell( fin );
	
	if (uMaxBack>uSizeFile)
		uMaxBack = uSizeFile;

	buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
	if (buf==NULL)
		return 0;

	uBackRead = 4;
	while (uBackRead<uMaxBack)
	{
		uLong uReadSize,uReadPos ;
		int i;
		if (uBackRead+BUFREADCOMMENT>uMaxBack) 
			uBackRead = uMaxBack;
		else
			uBackRead+=BUFREADCOMMENT;
		uReadPos = uSizeFile-uBackRead ;
		
		uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? 
                     (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
		if (fseek(fin,uReadPos,SEEK_SET)!=0)
			break;

		if (fread(buf,(uInt)uReadSize,1,fin)!=1)
			break;

                for (i=(int)uReadSize-3; (i--)>0;)
			if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 
				((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
			{
				uPosFound = uReadPos+i;
				break;
			}

		if (uPosFound!=0)
			break;
	}
	TRYFREE(buf);
	return uPosFound;
}

/*
  Open a Zip file. path contain the full pathname (by example,
     on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer
	 "zlib/zlib109.zip".
	 If the zipfile cannot be opened (file don't exist or in not valid), the
	   return value is NULL.
     Else, the return value is a unzFile Handle, usable with other function
	   of this unzip package.
*/
extern unzFile ZEXPORT unzOpen (	const char *path)

{
	unz_s us;
	unz_s *s;
	uLong central_pos,uL;
	FILE * fin ;

	uLong number_disk;          /* number of the current dist, used for 
								   spaning ZIP, unsupported, always 0*/
	uLong number_disk_with_CD;  /* number the the disk with central dir, used
								   for spaning ZIP, unsupported, always 0*/
	uLong number_entry_CD;      /* total number of entries in
	                               the central dir 
	                               (same than number_entry on nospan) */

	int err=UNZ_OK;

    if (unz_copyright[0]!=' ')
        return NULL;

    fin=fopen(path,"rb");
	if (fin==NULL)
		return NULL;

	central_pos = unzlocal_SearchCentralDir(fin);
	if (central_pos==0)
		err=UNZ_ERRNO;

	if (fseek(fin,central_pos,SEEK_SET)!=0)
		err=UNZ_ERRNO;

	/* the signature, already checked */
	if (unzlocal_getLong(fin,&uL)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* number of this disk */
	if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* number of the disk with the start of the central directory */
	if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* total number of entries in the central dir on this disk */
	if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* total number of entries in the central dir */
	if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK)
		err=UNZ_ERRNO;

	if ((number_entry_CD!=us.gi.number_entry) ||
		(number_disk_with_CD!=0) ||
		(number_disk!=0))
		err=UNZ_BADZIPFILE;

	/* size of the central directory */
	if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* offset of start of central directory with respect to the 
	      starting disk number */
	if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
		err=UNZ_ERRNO;

	/* zipfile comment length */
	if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
		err=UNZ_ERRNO;

	if ((central_pos<us.offset_central_dir+us.size_central_dir) && 
		(err==UNZ_OK))
		err=UNZ_BADZIPFILE;

	if (err!=UNZ_OK)
	{
		fclose(fin);
		return NULL;
	}

	us.file=fin;
	us.byte_before_the_zipfile = central_pos -
		                    (us.offset_central_dir+us.size_central_dir);
	us.central_pos = central_pos;
    us.pfile_in_zip_read = NULL;
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色综合久久| 91污片在线观看| 成人高清视频在线| 欧美一级淫片007| 亚洲欧美综合色| 久久国内精品视频| 色综合一个色综合亚洲| 久久蜜桃香蕉精品一区二区三区| 夜色激情一区二区| 成人夜色视频网站在线观看| 91麻豆精品国产无毒不卡在线观看| 国产欧美一二三区| 六月丁香综合在线视频| 欧美亚洲丝袜传媒另类| 国产精品久久久久久久午夜片| 青青草国产精品97视觉盛宴| 色国产综合视频| 亚洲欧美一区二区不卡| 国产精华液一区二区三区| 欧美人狂配大交3d怪物一区| ...av二区三区久久精品| 国产aⅴ精品一区二区三区色成熟| 欧美丰满嫩嫩电影| 亚洲gay无套男同| 在线观看免费亚洲| 亚洲综合男人的天堂| 99国产精品久| 1024精品合集| 91浏览器在线视频| 亚洲男人的天堂在线观看| 成人av网在线| 国产精品视频一区二区三区不卡| 国产一区欧美日韩| 久久久亚洲精品石原莉奈| 蜜芽一区二区三区| 精品久久久久香蕉网| 久久国产精品区| 26uuu色噜噜精品一区| 精品亚洲成a人| 国产午夜精品一区二区三区四区| 韩国三级电影一区二区| 久久这里都是精品| 成人永久aaa| 亚洲女人小视频在线观看| 色狠狠桃花综合| 日韩成人午夜精品| 久久色在线视频| 成人av网站免费| 一区二区激情小说| 91麻豆精品国产自产在线 | 国产原创一区二区三区| 欧美videossexotv100| 国产一区二区91| 亚洲一区二区高清| 欧美日韩一区二区在线观看 | 欧美国产精品劲爆| 91亚洲精品乱码久久久久久蜜桃| 尤物在线观看一区| 91精品国产综合久久精品性色| 美腿丝袜在线亚洲一区| 国产亚洲精品免费| 91国偷自产一区二区开放时间| 一区二区三区四区视频精品免费 | av亚洲精华国产精华精| 亚洲免费三区一区二区| 91精品在线一区二区| 国产一区二区免费在线| 一区二区免费看| 欧美电影免费观看高清完整版在线 | 久久久久久久久久美女| 色综合天天性综合| 美女视频网站久久| 中文字幕一区二区在线播放| 欧美男人的天堂一二区| 国产成人av资源| 三级成人在线视频| 欧美经典三级视频一区二区三区| 欧美日本一道本| 成人激情小说乱人伦| 婷婷国产在线综合| 国产精品久久久爽爽爽麻豆色哟哟 | 精品国产污污免费网站入口| 成人av网站大全| 国产一区二区调教| 夜夜操天天操亚洲| 中文av一区特黄| 日韩欧美精品在线| 欧美在线一区二区| 不卡视频免费播放| 激情久久五月天| 日韩成人一区二区三区在线观看| 亚洲欧美另类图片小说| 久久久蜜桃精品| 91精品国产综合久久精品| 日本精品免费观看高清观看| 国产一区二区福利视频| 奇米一区二区三区av| 亚洲综合一二区| 国产精品福利一区二区三区| 亚洲精品一区二区精华| 欧美一卡二卡三卡| 欧美日韩精品久久久| 欧美年轻男男videosbes| 不卡一区二区在线| 风流少妇一区二区| 国内成人自拍视频| 久久精品国产99国产精品| 午夜伊人狠狠久久| 婷婷综合另类小说色区| 亚洲尤物在线视频观看| 亚洲欧美激情插 | 日本高清视频一区二区| a美女胸又www黄视频久久| 丁香激情综合国产| 高清不卡在线观看| 国产大片一区二区| 国产99久久精品| 国产激情一区二区三区| 国产成人av电影在线| 国产精品资源站在线| 国产夫妻精品视频| 成人黄色综合网站| www.亚洲精品| 色狠狠色噜噜噜综合网| 欧美日韩一级黄| 88在线观看91蜜桃国自产| 日韩一级视频免费观看在线| 777午夜精品视频在线播放| 91精品国产综合久久精品麻豆| 欧美一区二区三区小说| 精品久久人人做人人爰| 亚洲国产精品黑人久久久| 国产精品午夜电影| 亚洲一区免费观看| 五月综合激情日本mⅴ| 麻豆精品久久久| 国产不卡免费视频| 一本久道中文字幕精品亚洲嫩| 91免费观看视频在线| 欧美三电影在线| 日韩精品中文字幕一区| 国产欧美日韩在线观看| 亚洲免费色视频| 另类小说视频一区二区| youjizz国产精品| 欧美午夜电影在线播放| 日韩写真欧美这视频| 欧美极品少妇xxxxⅹ高跟鞋| 一区二区三区四区精品在线视频 | 欧美日韩国产中文| 精品国产精品网麻豆系列| |精品福利一区二区三区| 日韩成人精品在线| 成人白浆超碰人人人人| 精品视频在线免费| 国产视频一区不卡| 天堂精品中文字幕在线| 国产成人夜色高潮福利影视| 欧美日韩一级二级| 一区二区三区在线视频观看58| 丝袜美腿亚洲综合| 成+人+亚洲+综合天堂| 欧美一级生活片| 亚洲另类中文字| 国产成人亚洲综合色影视| 欧美久久一二三四区| 欧美激情一区二区在线| 日本亚洲天堂网| 97久久精品人人爽人人爽蜜臀| 欧美成人精品3d动漫h| 亚洲情趣在线观看| 处破女av一区二区| 日韩三级伦理片妻子的秘密按摩| 综合精品久久久| 国产精品一区二区三区四区| 欧美精品第1页| 亚洲你懂的在线视频| 国产精品99久| 日韩欧美中文字幕精品| 亚洲午夜一区二区| 99国产精品视频免费观看| 日本一区二区三区dvd视频在线| 日本aⅴ亚洲精品中文乱码| 色老头久久综合| 亚洲欧洲精品一区二区三区不卡| 韩国中文字幕2020精品| 欧美一区二区三区视频在线| 亚洲一区二区三区影院| 色综合咪咪久久| 中文字幕日韩精品一区| 国产.欧美.日韩| 久久久99精品免费观看不卡| 蜜桃久久久久久| 日韩欧美一区中文| 日精品一区二区| 91精品国产综合久久福利| 日韩高清不卡一区| 9191精品国产综合久久久久久| 亚洲一级在线观看| 欧美三级中文字幕在线观看|