亚洲欧美第一页_禁久久精品乱码_粉嫩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在线播放| 丁香六月久久综合狠狠色| 懂色av中文字幕一区二区三区 | 国产精品久久三| av欧美精品.com| 一区二区三区精品视频在线| 色综合久久88色综合天天| 亚洲最新在线观看| 亚洲女爱视频在线| 欧美日韩高清影院| 精品影院一区二区久久久| 国产欧美日本一区二区三区| 91在线视频在线| 国内精品在线播放| 亚洲第一激情av| 久久久高清一区二区三区| 91老司机福利 在线| 久久精品99国产精品日本| 亚洲人成网站色在线观看| 亚洲日本青草视频在线怡红院| 日韩一区二区三区精品视频| 成人国产精品免费观看动漫 | 日韩视频在线你懂得| 欧美成人一区二区三区在线观看| 波多野结衣的一区二区三区| 91在线免费视频观看| 欧美色图片你懂的| 91在线视频免费91| 欧美美女一区二区在线观看| 色偷偷久久人人79超碰人人澡| 欧美无人高清视频在线观看| 成人黄色片在线观看| 欧美曰成人黄网| 在线视频观看一区| 欧美xxxx老人做受| 亚洲视频中文字幕| 美女视频黄a大片欧美| 国产精品中文字幕日韩精品 | 国产亚洲精品aa| 精品久久久久久最新网址| 国产精品视频看| 久久久久国产成人精品亚洲午夜| 一区二区三区精品在线观看| 国内精品久久久久影院薰衣草 | 亚洲精品一区二区三区在线观看| 日韩欧美国产综合| 精品成a人在线观看| 亚洲欧洲制服丝袜| 国产精品888| 欧美日韩精品专区| 国产精品理论片| 精品一区二区国语对白| 欧美亚洲国产怡红院影院| 久久精品人人爽人人爽| 亚洲.国产.中文慕字在线| 97精品视频在线观看自产线路二| 欧美一二三区精品| 亚洲成人av福利| 91欧美激情一区二区三区成人| www国产精品av| 国产精品视频一区二区三区不卡| 蜜桃视频一区二区三区 | 日韩欧美国产1| 亚洲一区二区影院| 日韩精品电影在线| 日韩成人av影视| 国产一区二区福利| 99热这里都是精品| 久久精品一区二区三区不卡| 免费三级欧美电影| 99re8在线精品视频免费播放| 欧美va亚洲va| 激情成人午夜视频| 精品乱码亚洲一区二区不卡| 日韩va亚洲va欧美va久久| 欧美日产在线观看| 午夜久久电影网| 国产大片一区二区| 欧美人妖巨大在线| 日韩电影在线观看电影| 欧美日本国产视频| 久久精品国产网站| 精品国产伦一区二区三区观看方式 | 亚洲一区二区三区视频在线| 成人美女视频在线观看| 一区在线中文字幕| 视频一区二区国产| 日韩三级在线观看| 麻豆成人久久精品二区三区小说| 欧美一区二区日韩一区二区| 国产精品国产自产拍高清av| 成人深夜福利app| 免费成人深夜小野草| 日韩欧美精品在线| 久久99国内精品| 2欧美一区二区三区在线观看视频| 久久99国产乱子伦精品免费| 久久亚洲精精品中文字幕早川悠里| 奇米色一区二区三区四区| 日韩精品一区二区三区中文精品| 免费精品视频在线| 久久综合成人精品亚洲另类欧美| 国产乱人伦偷精品视频不卡| 中文字幕一区二区三| 一道本成人在线| 亚洲成精国产精品女| 欧美丰满一区二区免费视频| 免费高清不卡av| 国产精品久久久久久久午夜片| jlzzjlzz欧美大全| 亚洲成人一区在线| 欧美成人高清电影在线| 国产福利精品一区| 国产精品久久久久影视| 欧美在线一区二区| 久久精品999| 国产精品久久久久久福利一牛影视| 99视频精品全部免费在线| 日韩成人免费电影| 欧美激情一区三区| 99久久综合国产精品| 精品一区二区在线视频| 国产精品色哟哟网站| 欧美无乱码久久久免费午夜一区 | 经典三级一区二区| 综合在线观看色| 91国产成人在线| 久久精品国产99| 亚洲激情成人在线| 日韩精彩视频在线观看| 久久综合九色欧美综合狠狠| 99视频在线观看一区三区| 亚洲国产精品人人做人人爽| 精品国产免费人成电影在线观看四季 | 处破女av一区二区| 一区二区成人在线| 日本一区二区三区国色天香| 精品免费国产一区二区三区四区| aaa亚洲精品| 国产精品主播直播| 日产精品久久久久久久性色| 亚洲欧洲制服丝袜| ●精品国产综合乱码久久久久| 日韩一级精品视频在线观看| 91美女片黄在线观看91美女| 国产精品综合网| 日韩av午夜在线观看| 亚洲国产精品99久久久久久久久| 2023国产精品自拍| 欧美激情综合五月色丁香小说| 欧美性猛片aaaaaaa做受| 国产精品1024久久| 麻豆国产精品777777在线| 玉米视频成人免费看| 中文字幕第一区综合| 欧美一二区视频| 日韩午夜av一区| 欧美一区二区三区公司| 色又黄又爽网站www久久| 色成人在线视频| 99久久伊人网影院| www..com久久爱| 国产成人高清在线| 国产精品中文欧美| 99国产欧美另类久久久精品| 福利电影一区二区三区| 韩国精品久久久| 麻豆成人在线观看| 国产一区二区91| 成人小视频在线| 成人午夜免费av| 福利一区二区在线| 国产91精品久久久久久久网曝门 | 国产精品自拍毛片| 开心九九激情九九欧美日韩精美视频电影 | 国产视频一区二区在线观看| 精品国产乱码91久久久久久网站| 欧美电影免费观看高清完整版在线 | 欧美一区二区三区公司| 欧美三级一区二区| 日韩精品一区二区三区swag| 精品va天堂亚洲国产| 久久久久久久久久久久久女国产乱 | 亚洲一区二区偷拍精品| 亚洲国产日韩精品| 日韩成人精品在线观看| 精品午夜一区二区三区在线观看| 极品少妇一区二区| 国产精品综合一区二区三区| 91福利小视频| 51久久夜色精品国产麻豆| 日韩欧美国产高清| 中文欧美字幕免费| 中文字幕一区av| 91在线观看一区二区| 91福利精品视频| 欧美一级免费大片| 欧美激情综合五月色丁香| 亚洲国产乱码最新视频| 国产高清成人在线|