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

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

?? unzipfile.cpp

?? 本程序所用壓縮函數庫在子目錄zipfunc中,在zipfunc目錄下,有兩個子目錄分別包含Release版和Debug版的zipfunc.lib,兩者都是共享鏈接庫編譯生成.同樣,主程序的鏈接也必須用
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// UnzipFile.cpp: implementation of the CUnzipFile class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "UnzipFile.h"

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


#ifndef UNZ_BUFSIZE
#define UNZ_BUFSIZE (16384)
#endif

#ifndef UNZ_MAXFILENAMEINZIP
#define UNZ_MAXFILENAMEINZIP (256)
#endif

#define BUFREADCOMMENT (0x400)


#define UNZ_PARAMERROR                  (-102)
#define UNZ_BADZIPFILE                  (-103)
#define UNZ_CRCERROR                    (-105)

unz_s::unz_s()
{
	pfile_in_zip_read = NULL;
}

void unz_s::alloc_pfile_in_zip_read()
{
	if (!pfile_in_zip_read)
		pfile_in_zip_read = new file_in_zip_read_info;
}

void unz_s::free_pfile_in_zip_read()
{
	if (pfile_in_zip_read)
	{
		delete pfile_in_zip_read;
		pfile_in_zip_read = NULL;
	}

}

unz_s::~unz_s()
{
	free_pfile_in_zip_read();
}

file_in_zip_read_info::file_in_zip_read_info()
{
	read_buffer = new char[UNZ_BUFSIZE];
	stream_initialised  = 0;
	pos_local_extrafield = 0;
	crc32 = 0;
	stream.total_out = 0;
}


file_in_zip_read_info::~file_in_zip_read_info()
{
	delete[] read_buffer;
}


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CUnzipFile::CUnzipFile()
{
	m_bZipFile = false;
	m_pFile = &uf.file;
}


CUnzipFile::CUnzipFile(LPCTSTR lpszPath)
{
	m_bZipFile = false;
	m_pFile = &uf.file;
	Open(lpszPath);
}

//   Close a ZipFile
void CUnzipFile::Close()
{
	if (IsClosed())
		return;

    if (uf.pfile_in_zip_read)
        CloseCurrentFile();
	
	uf.file.Close();
}

//   Close the file in zip opened with OpenCurrentFile
void CUnzipFile::CloseCurrentFile()
{

	if (uf.pfile_in_zip_read == NULL)
		return; // already closed - do not throw an exception

	if (uf.pfile_in_zip_read->rest_read_uncompressed == 0)
	{
		if (uf.pfile_in_zip_read->crc32 != uf.pfile_in_zip_read->crc32_wait)
			ThrowError(UNZ_CRCERROR);
	}

	
	if (uf.pfile_in_zip_read->stream_initialised)
		inflateEnd(&uf.pfile_in_zip_read->stream);

	uf.free_pfile_in_zip_read();

}

/*
  Set the current file of the zipfile to the first file.
*/
void CUnzipFile::GoToFirstFile()
{
	uf.pos_in_central_dir = uf.offset_central_dir;
	uf.num_file = 0;
	unzlocal_GetCurrentFileInfoInternal(uf.cur_file_info,
										uf.cur_file_info_internal,
										NULL,0,NULL,0,NULL,0);
	uf.current_file_ok = 1;
}


/*
  Try locate the file szFileName in the zipfile.

  return value :
  true if the file is found. It becomes the current file.
  false if the file is not found
*/
bool CUnzipFile::LocateFile(CString szFileName, bool bCaseSensitive)
{

    if (szFileName.GetLength() >= UNZ_MAXFILENAMEINZIP)
        ThrowError(UNZ_PARAMERROR);

	if (!uf.current_file_ok)
		return false;

	uLong num_fileSaved = uf.num_file;
	uLong pos_in_central_dirSaved = uf.pos_in_central_dir;

	GoToFirstFile();

	bool res = true;
	while (res)
	{
		char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
		GetCurrentFileInfo(NULL, szCurrentFileName, sizeof(szCurrentFileName)-1,
								NULL,0,NULL,0);
		if (StringFileNameCompare(szCurrentFileName, szFileName, bCaseSensitive)==0)
			return true;

		res = GoToNextFile();
	}

	uf.num_file = num_fileSaved ;
	uf.pos_in_central_dir = pos_in_central_dirSaved ;

	return false;
}



/*
  Set the current file of the zipfile to the next file.
  return true if there is no problem
  return false if the actual file was the latest.
*/
bool CUnzipFile::GoToNextFile()
{
	if (!uf.current_file_ok)
		return false;

	if (uf.num_file + 1 == uf.gi.number_entry)
		return false;

	uf.pos_in_central_dir += SIZECENTRALDIRITEM + uf.cur_file_info.size_filename +
			uf.cur_file_info.size_file_extra + uf.cur_file_info.size_file_comment ;

	uf.num_file++;
	unzlocal_GetCurrentFileInfoInternal(uf.cur_file_info,
										uf.cur_file_info_internal,
										NULL,0,NULL,0,NULL,0);
	uf.current_file_ok = 1;
	return true;
}

/*
  Read the local header of the current zipfile
  Check the coherency of the local header and info in the end of central
        directory about this file
  store in *piSizeVar the size of extra info in local header
        (filename and size of extra field data)
*/
void CUnzipFile::unzlocal_CheckCurrentFileCoherencyHeader (uInt & iSizeVar,
													uLong & offset_local_extrafield,
													uLong & size_local_extrafield)
{

	iSizeVar = 0;
	offset_local_extrafield = 0;
	size_local_extrafield = 0;

	uf.file.Seek(uf.cur_file_info_internal.offset_curfile + uf.byte_before_the_zipfile, CFile::begin);

	uLong uMagic;
	unzlocal_getLong(uMagic);
	if (uMagic!=0x04034b50)
		ThrowError(UNZ_BADZIPFILE);

	uLong uData;
	unzlocal_getShort(uData);

// 	if (uData != uf.cur_file_info.version)
// 		ThrowError(UNZ_BADZIPFILE);

	uLong uFlags;
	unzlocal_getShort(uFlags);

	unzlocal_getShort(uData);
	if (uData != uf.cur_file_info.compression_method)
		ThrowError(UNZ_BADZIPFILE);

    if ((uf.cur_file_info.compression_method != 0) &&
                         (uf.cur_file_info.compression_method != Z_DEFLATED))
        ThrowError(UNZ_BADZIPFILE);

	unzlocal_getLong(uData); /* date/time */

	unzlocal_getLong(uData); /* crc */
	if ((uData != uf.cur_file_info.crc) &&
		                      ((uFlags & 8)==0))
		ThrowError(UNZ_BADZIPFILE);

	unzlocal_getLong(uData); /* size compr */

	if ((uData != uf.cur_file_info.compressed_size) &&
							  ((uFlags & 8) == 0))
		ThrowError(UNZ_BADZIPFILE);

	unzlocal_getLong(uData); /* size uncompr */

	if ((uData!=uf.cur_file_info.uncompressed_size) && 
							  ((uFlags & 8)==0))
		ThrowError(UNZ_BADZIPFILE);

	uLong size_filename;
	unzlocal_getShort(size_filename);

	if ((size_filename != uf.cur_file_info.size_filename))
		ThrowError(UNZ_BADZIPFILE);

	iSizeVar = (uInt)size_filename;

	uLong size_extra_field;
	unzlocal_getShort(size_extra_field);

	offset_local_extrafield = uf.cur_file_info_internal.offset_curfile +
									SIZEZIPLOCALHEADER + size_filename;
	size_local_extrafield = (uInt)size_extra_field;

	iSizeVar += (uInt)size_extra_field;

}


//   Open for reading data the current file in the zipfile.
void CUnzipFile::OpenCurrentFile()
{

	ASSERT(uf.current_file_ok);

	if (!uf.current_file_ok)
		ThrowError(UNZ_PARAMERROR);

    if (uf.pfile_in_zip_read)
        CloseCurrentFile();

	uInt iSizeVar;
	uLong offset_local_extrafield;  /* offset of the local extra field */
	uLong  size_local_extrafield;    /* size of the local extra field */

	unzlocal_CheckCurrentFileCoherencyHeader(iSizeVar,
				offset_local_extrafield, size_local_extrafield);

	uf.alloc_pfile_in_zip_read();


	uf.pfile_in_zip_read->offset_local_extrafield = offset_local_extrafield;
	uf.pfile_in_zip_read->size_local_extrafield = size_local_extrafield;

	
	if ((uf.cur_file_info.compression_method!=0) &&
        (uf.cur_file_info.compression_method!=Z_DEFLATED))
		ThrowError(UNZ_BADZIPFILE);


	uf.pfile_in_zip_read->crc32_wait = uf.cur_file_info.crc;
	uf.pfile_in_zip_read->compression_method =
            uf.cur_file_info.compression_method;
	
	uf.pfile_in_zip_read->byte_before_the_zipfile=uf.byte_before_the_zipfile;


	if (uf.cur_file_info.compression_method != 0)
	{
	  uf.pfile_in_zip_read->stream.zalloc = (alloc_func)myalloc;
	  uf.pfile_in_zip_read->stream.zfree = (free_func)myfree;
	  uf.pfile_in_zip_read->stream.opaque = m_bDetectZlibMemoryLeaks ? &m_list : 0;
      
	  int err = inflateInit2(&uf.pfile_in_zip_read->stream, -MAX_WBITS);

	  if (err == Z_OK)
	    uf.pfile_in_zip_read->stream_initialised=1;
	  else 
		  CheckForError(err);
        /* windowBits is passed < 0 to tell that there is no zlib header.
         * Note that in this case inflate *requires* an extra "dummy" byte
         * after the compressed stream in order to complete decompression and
         * return Z_STREAM_END. 
         * In unzip, i don't wait absolutely Z_STREAM_END because I known the 
         * size of both compressed and uncompressed data
         */
	}
	uf.pfile_in_zip_read->rest_read_compressed = 
            uf.cur_file_info.compressed_size ;
	uf.pfile_in_zip_read->rest_read_uncompressed = 
            uf.cur_file_info.uncompressed_size ;

	
	uf.pfile_in_zip_read->pos_in_zipfile = 
            uf.cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + 
			  iSizeVar;
	
	uf.pfile_in_zip_read->stream.avail_in = (uInt)0;

}
/*
  Write info about the ZipFile in the *pglobal_info structure.
  No preparation of the structure is needed
*/
void CUnzipFile::GetGlobalInfo(unz_global_info &global_info)
{
	global_info = uf.gi;
}

void CUnzipFile::GetCurrentFileInfo ( unz_file_info* file_info,
                                         LPSTR szFileName,
										 uLong fileNameBufferSize,
										 void *extraField,
										 uLong extraFieldBufferSize,
										 LPSTR szComment,
										 uLong commentBufferSize)
{

	
	unz_file_info temp;
	if (!file_info)
		file_info = &temp;

	unz_file_info_internal temp1;
	unzlocal_GetCurrentFileInfoInternal(*file_info, temp1, szFileName, fileNameBufferSize,
		extraField, extraFieldBufferSize, szComment, commentBufferSize);
}



/*
  Read bytes from the current file.
  buf contain buffer where data must be copied
  len the size of buf.

  return the number of byte copied if somes bytes are copied
  return 0 if the end of file was reached
*/
int CUnzipFile::ReadCurrentFile(void* buf, UINT len)
{

	if (!uf.pfile_in_zip_read)
		ThrowError(UNZ_PARAMERROR);

	if ((len == 0) || !buf)
		return 0;

	uf.pfile_in_zip_read->stream.next_out = (Bytef*)buf;
	uf.pfile_in_zip_read->stream.avail_out = (uInt)len;
	
	if (len > uf.pfile_in_zip_read->rest_read_uncompressed)
		uf.pfile_in_zip_read->stream.avail_out = 
		  (uInt)uf.pfile_in_zip_read->rest_read_uncompressed;


	uInt iRead = 0;

	while (uf.pfile_in_zip_read->stream.avail_out>0)
	{
		if ((uf.pfile_in_zip_read->stream.avail_in==0) &&
            (uf.pfile_in_zip_read->rest_read_compressed>0))
		{
			uInt uReadThis = UNZ_BUFSIZE;
			if (uf.pfile_in_zip_read->rest_read_compressed<uReadThis)
				uReadThis = (uInt)uf.pfile_in_zip_read->rest_read_compressed;
			if (uReadThis == 0)
				return 0;


			uf.file.Seek(uf.pfile_in_zip_read->pos_in_zipfile + 
				uf.pfile_in_zip_read->byte_before_the_zipfile, CFile::begin);

			uf.file.Read(uf.pfile_in_zip_read->read_buffer, uReadThis);
			uf.pfile_in_zip_read->pos_in_zipfile += uReadThis;

			uf.pfile_in_zip_read->rest_read_compressed-=uReadThis;
			
			uf.pfile_in_zip_read->stream.next_in = 
                (Bytef*)uf.pfile_in_zip_read->read_buffer;
			uf.pfile_in_zip_read->stream.avail_in = (uInt)uReadThis;
		}

		if (uf.pfile_in_zip_read->compression_method==0)
		{
			uInt uDoCopy;
			if (uf.pfile_in_zip_read->stream.avail_out < 
                            uf.pfile_in_zip_read->stream.avail_in)
				uDoCopy = uf.pfile_in_zip_read->stream.avail_out ;
			else
				uDoCopy = uf.pfile_in_zip_read->stream.avail_in ;

			memcpy(uf.pfile_in_zip_read->stream.next_out, 
				uf.pfile_in_zip_read->stream.next_in, uDoCopy);
					
			uf.pfile_in_zip_read->crc32 = crc32(uf.pfile_in_zip_read->crc32,
								uf.pfile_in_zip_read->stream.next_out,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产偷v国产偷v亚洲高清| 亚洲精选视频在线| 国产精品黄色在线观看| 亚洲成人你懂的| 成人一区二区在线观看| 6080午夜不卡| 欧美国产国产综合| 青青草97国产精品免费观看 | 亚洲成人av一区二区三区| 免费观看日韩电影| 欧美性大战久久久久久久| 欧美高清一级片在线观看| 日韩在线一二三区| 欧美影院精品一区| 中文字幕亚洲综合久久菠萝蜜| 奇米一区二区三区| 欧美视频在线一区| 综合久久给合久久狠狠狠97色| 久久er精品视频| 在线观看91av| 亚洲成人免费视| 日本久久精品电影| 一区在线中文字幕| 成人综合在线视频| 国产亚洲综合在线| 国产成人在线视频播放| 精品国产亚洲在线| 久久福利视频一区二区| 欧美久久一区二区| 三级成人在线视频| 欧美日韩精品一二三区| 亚洲国产日韩在线一区模特| 91论坛在线播放| 亚洲天堂福利av| 99精品偷自拍| 亚洲精品中文字幕乱码三区| 成人午夜电影久久影院| 国产偷v国产偷v亚洲高清| 国产精品一级二级三级| 久久久精品天堂| 国产河南妇女毛片精品久久久| 久久欧美一区二区| 丁香婷婷综合色啪| 国产精品激情偷乱一区二区∴| 成人a级免费电影| 亚洲少妇中出一区| 欧美在线一区二区三区| 亚洲国产毛片aaaaa无费看| 欧美日韩视频在线观看一区二区三区| 一区二区日韩av| 欧美蜜桃一区二区三区| 免费观看30秒视频久久| 2020国产精品自拍| 成人福利视频在线看| 亚洲视频一区二区在线观看| 色av综合在线| 美女一区二区在线观看| 久久久久久久免费视频了| 成人动漫av在线| 亚洲一区二区三区视频在线播放| 欧美精品 国产精品| 国内成人自拍视频| ㊣最新国产の精品bt伙计久久| 91黄色激情网站| 喷水一区二区三区| 国产精品嫩草影院com| 色婷婷国产精品久久包臀| 日韩中文字幕1| 国产午夜精品一区二区三区嫩草 | 国产偷国产偷亚洲高清人白洁| av在线这里只有精品| 亚洲国产一区二区三区青草影视| 日韩视频一区二区三区在线播放 | 色天天综合色天天久久| 视频在线观看一区二区三区| 精品精品国产高清一毛片一天堂| av亚洲精华国产精华精| 日本在线不卡视频| 亚洲欧美怡红院| 欧美一区二区三区在线视频| 成人午夜视频福利| 美女视频黄频大全不卡视频在线播放| 国产欧美va欧美不卡在线| 欧美亚一区二区| 国产超碰在线一区| 免费成人你懂的| 亚洲色图在线看| 久久综合色播五月| 欧美日韩高清在线播放| 不卡的av在线播放| 激情综合一区二区三区| 亚洲成人激情自拍| 一色屋精品亚洲香蕉网站| 久久先锋影音av鲁色资源网| 欧美群妇大交群中文字幕| 成人av网站在线观看免费| 精品午夜久久福利影院| 日韩精品欧美精品| 亚洲自拍偷拍av| 亚洲三级视频在线观看| 久久婷婷成人综合色| 91精品国产色综合久久不卡电影| 91看片淫黄大片一级| 成人久久视频在线观看| 国内精品伊人久久久久av影院 | 午夜精品在线看| 亚洲欧美区自拍先锋| 国产精品无圣光一区二区| 精品国产一区二区在线观看| 日韩一区二区三区高清免费看看| 精品视频全国免费看| 色婷婷综合五月| 色哟哟欧美精品| 91在线国产观看| 91亚洲大成网污www| av电影天堂一区二区在线观看| 国产精品自拍网站| 国产精品伊人色| 国产福利91精品| 国产精一品亚洲二区在线视频| 国产精品一区在线观看乱码| 国产综合成人久久大片91| 久久激五月天综合精品| 国产真实乱对白精彩久久| 韩国成人福利片在线播放| 国产一区二区在线影院| 国产在线精品免费av| 国产91精品精华液一区二区三区| 国产激情精品久久久第一区二区 | 欧美videos中文字幕| 日韩欧美中文一区| 精品国产一区二区三区久久久蜜月 | 欧美日韩在线观看一区二区 | 国产一区二区伦理片| 国产成人啪免费观看软件 | 奇米精品一区二区三区在线观看| 免费成人性网站| 国产精品123区| 97久久超碰精品国产| 在线亚洲高清视频| 777亚洲妇女| 精品国一区二区三区| 国产欧美日韩在线视频| 亚洲人成在线播放网站岛国| 一区二区三区电影在线播| 视频一区二区欧美| 久久99国产精品免费网站| av高清不卡在线| 欧美男同性恋视频网站| 2021久久国产精品不只是精品| 国产精品高清亚洲| 午夜欧美视频在线观看| 国产成人自拍网| 精品视频在线看| 久久综合视频网| 亚洲精品中文字幕乱码三区| 精品一区二区在线视频| 99久久精品情趣| 日韩片之四级片| 亚洲精选在线视频| 国产精品资源站在线| 欧洲一区二区三区免费视频| 欧美v国产在线一区二区三区| 一区二区三区四区在线免费观看| 美女一区二区视频| 在线观看成人小视频| 久久久久亚洲蜜桃| 亚洲成人精品在线观看| 波多野结衣精品在线| 日韩一区二区免费电影| 1000精品久久久久久久久| 激情久久久久久久久久久久久久久久| 99国产精品久久久久久久久久| 日韩午夜精品视频| 亚洲综合一区二区三区| a级高清视频欧美日韩| 精品成人免费观看| 日韩一区欧美二区| 色综合久久天天综合网| 国产日韩亚洲欧美综合| 日本vs亚洲vs韩国一区三区| 色成年激情久久综合| 国产精品国产三级国产普通话99| 日韩av电影免费观看高清完整版在线观看| 成人毛片视频在线观看| 久久网这里都是精品| 蜜臀av一区二区| 欧美乱妇23p| 亚洲激情自拍视频| 91免费看`日韩一区二区| 国产人成一区二区三区影院| 黑人精品欧美一区二区蜜桃| 欧美军同video69gay| 亚洲欧美电影一区二区| 成人精品一区二区三区四区| 久久久午夜电影| 国产a区久久久| 久久久五月婷婷| 国产精品一区二区三区网站| 精品国产伦一区二区三区观看体验|