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

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

?? unzipfile.cpp

?? winzip 開發環境:C++
?? 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一区二区三区免费野_久草精品视频
色综合网站在线| 中文字幕乱码日本亚洲一区二区| 欧美www视频| 国产精品美女久久久久久久久久久| 亚洲一二三四在线| 成人午夜电影小说| 91精品国产黑色紧身裤美女| 亚洲日本在线看| 国产ts人妖一区二区| 日韩欧美视频一区| 亚洲永久免费av| 91免费看视频| 国产精品美女www爽爽爽| 蜜桃一区二区三区在线| 在线观看一区日韩| 亚洲啪啪综合av一区二区三区| 国产在线精品一区二区三区不卡| 欧美日韩三级视频| 夜夜夜精品看看| 色拍拍在线精品视频8848| 中文一区二区在线观看| 国产激情视频一区二区三区欧美 | 国产电影一区在线| 欧美成人精品高清在线播放| 亚洲第一综合色| 91激情在线视频| 亚洲精品亚洲人成人网在线播放| 成人免费视频视频在线观看免费| 久久综合给合久久狠狠狠97色69| 日韩av电影免费观看高清完整版在线观看| 在线一区二区三区四区五区| 一级精品视频在线观看宜春院 | 国产福利一区二区三区视频在线 | 欧美日韩一区二区三区视频| 亚洲制服丝袜一区| 久久婷婷国产综合精品青草| 国产盗摄一区二区三区| 中文字幕第一页久久| 成人小视频在线观看| 国产精品久久久久久久久果冻传媒 | 亚洲国产wwwccc36天堂| 欧美日韩亚洲丝袜制服| 水蜜桃久久夜色精品一区的特点| 精品视频免费在线| 日韩成人午夜电影| 精品理论电影在线观看 | 色婷婷综合久久久| 亚洲精品大片www| 宅男噜噜噜66一区二区66| 久久精品国产亚洲高清剧情介绍| 精品乱人伦一区二区三区| 成人视屏免费看| 一区二区欧美视频| 欧美成人综合网站| av资源站一区| 日韩黄色在线观看| 久久久噜噜噜久久人人看| 91小视频免费观看| 日韩精品福利网| 国产欧美一区二区三区沐欲| 91免费小视频| 美国精品在线观看| 日本一区二区三级电影在线观看 | 99精品国产一区二区三区不卡| 亚洲裸体xxx| 日韩欧美国产系列| 99精品视频在线观看免费| 亚洲国产一区二区三区| ww亚洲ww在线观看国产| 色偷偷久久一区二区三区| 精品一区二区三区香蕉蜜桃| 亚洲欧美一区二区久久| 精品久久久久久久人人人人传媒 | 欧美成人免费网站| 91浏览器在线视频| 国产一区欧美一区| 香蕉影视欧美成人| 成人免费在线播放视频| 欧美一区二区三区白人| 色域天天综合网| 国产精品18久久久久久vr| 婷婷国产在线综合| **欧美大码日韩| 久久综合视频网| 欧美日韩电影在线| av中文字幕亚洲| 欧美亚洲一区二区在线观看| 国产精品资源网站| 日日夜夜精品视频免费| 亚洲四区在线观看| 国产亲近乱来精品视频| 日韩女优电影在线观看| 在线观看不卡视频| 99在线热播精品免费| 国产精品一区二区91| 日本在线播放一区二区三区| 亚洲免费观看视频| 中文字幕制服丝袜一区二区三区| 日韩欧美不卡一区| 日韩欧美中文字幕制服| 欧美日韩在线免费视频| 欧美亚洲一区二区在线| 91视频精品在这里| 99免费精品视频| 国产成人在线免费| 国产美女精品人人做人人爽| 久久精品99久久久| 蜜桃av一区二区| 久久成人久久爱| 麻豆91免费看| 九一久久久久久| 经典一区二区三区| 韩国三级在线一区| 国产美女精品一区二区三区| 国产一区二区三区四区五区入口| 日本美女一区二区三区视频| 日本成人中文字幕| 久久不见久久见免费视频7| 秋霞电影网一区二区| 日韩精品电影一区亚洲| 另类小说一区二区三区| 国内精品嫩模私拍在线| 久久国产免费看| 国产精品一区二区三区99| 国产成人av电影| 99精品偷自拍| 欧美日韩一二区| 日韩精品一区二区三区视频在线观看 | 欧美三级中文字幕在线观看| 欧美日韩亚洲另类| 欧美日韩高清一区二区| 欧美哺乳videos| 亚洲国产精品ⅴa在线观看| 亚洲欧美日本在线| 国产成人日日夜夜| av午夜一区麻豆| 欧美日韩综合在线免费观看| 91精品免费在线观看| 精品福利视频一区二区三区| 国产亚洲成年网址在线观看| 最新日韩av在线| 婷婷丁香激情综合| 国产99精品国产| 欧美三级一区二区| 2023国产精品视频| 国产精品久久毛片| 日韩精品欧美成人高清一区二区| 黑人巨大精品欧美一区| 91麻豆swag| 欧美xxxx在线观看| 亚洲精品日韩一| 韩国一区二区在线观看| 91麻豆国产精品久久| 精品久久久久久久久久久院品网 | 久久99九九99精品| 99国产精品久久久久久久久久| 欧美精品免费视频| 国产精品久久久久9999吃药| 日韩电影在线一区| 99久久精品99国产精品| 欧美成人video| 亚洲成av人片一区二区梦乃| 国产精品一区久久久久| 911国产精品| 亚洲人精品午夜| 国产大陆亚洲精品国产| 欧美一区在线视频| 亚洲精品va在线观看| 国产精品一品视频| 欧美一区二区视频网站| 亚洲另类春色校园小说| 成人午夜视频免费看| 日韩写真欧美这视频| 亚洲国产婷婷综合在线精品| www.成人在线| 久久久久亚洲综合| 久久99精品久久久| 欧美麻豆精品久久久久久| 一色屋精品亚洲香蕉网站| 国产一区不卡视频| 精品久久久久久综合日本欧美 | 日韩欧美中文字幕制服| 亚洲图片欧美一区| 色视频成人在线观看免| 另类的小说在线视频另类成人小视频在线| 色婷婷综合久色| 亚洲乱码中文字幕综合| 成人av网址在线观看| 国产目拍亚洲精品99久久精品| 韩国v欧美v亚洲v日本v| 日韩美女主播在线视频一区二区三区| 亚洲一区二区三区视频在线播放| 99久久伊人精品| 中文字幕一区二区三区av| 成人一区在线观看| 欧美激情综合五月色丁香| 国产一区二区精品在线观看| 久久亚洲春色中文字幕久久久| 国产一区二区三区四| 久久视频一区二区|