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

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

?? unzipfile.cpp

?? 學生信息管理系統x
?? 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一区二区三区免费野_久草精品视频
欧美日韩黄色一区二区| 日韩精彩视频在线观看| 国产精品99久久不卡二区| 久久亚洲一级片| 国产精品一区在线观看你懂的| 精品国产成人系列| 国产成人综合在线播放| 国产精品免费视频网站| 一本大道久久精品懂色aⅴ| 亚洲国产一区二区三区青草影视| 欧美美女bb生活片| 日韩精品亚洲专区| 国产午夜精品在线观看| 97se狠狠狠综合亚洲狠狠| 亚洲国产欧美另类丝袜| 欧美一级生活片| 成人丝袜视频网| 亚洲综合久久久久| 欧美精品18+| 国产精品99精品久久免费| 亚洲精品久久久久久国产精华液 | 国产一区二区美女| 中文欧美字幕免费| 欧美偷拍一区二区| 国产美女主播视频一区| 亚洲欧美电影院| 精品乱码亚洲一区二区不卡| av影院午夜一区| 日韩国产精品大片| 亚洲人成网站在线| 欧美xxxx老人做受| 欧洲一区二区三区在线| 国产在线视视频有精品| 一区二区成人在线| 国产午夜精品福利| 3751色影院一区二区三区| 高清不卡一区二区| 日韩福利电影在线观看| 国产精品二三区| 精品日产卡一卡二卡麻豆| 91理论电影在线观看| 国产精品综合二区| 蜜桃视频一区二区三区| 亚洲啪啪综合av一区二区三区| 精品人伦一区二区色婷婷| 欧美无乱码久久久免费午夜一区| 国产成人欧美日韩在线电影| 日本少妇一区二区| 亚洲尤物视频在线| 国产精品乱码妇女bbbb| 欧美大度的电影原声| 欧美日韩国产片| 欧美视频一区二区在线观看| 国产成人综合亚洲91猫咪| 奇米综合一区二区三区精品视频| 亚洲三级小视频| 国产午夜精品久久久久久久| 欧美一区二区三区不卡| 欧美日韩三级一区| 在线观看日韩电影| 亚洲成人自拍网| 中文字幕永久在线不卡| 欧美大黄免费观看| 欧美日韩一区视频| 日本丶国产丶欧美色综合| 粉嫩高潮美女一区二区三区| 另类小说图片综合网| 首页欧美精品中文字幕| 性久久久久久久久久久久 | 中文字幕久久午夜不卡| 久久综合久久综合九色| 日韩欧美第一区| 在线综合视频播放| 欧美亚洲国产一区二区三区| 日本高清不卡在线观看| 99国产精品久久久久久久久久 | 97超碰欧美中文字幕| 风间由美性色一区二区三区| 国产麻豆精品在线| 丁香天五香天堂综合| 国产成人高清在线| 成人国产亚洲欧美成人综合网| 成人爽a毛片一区二区免费| 国产成人av电影| av一本久道久久综合久久鬼色| 成人免费高清在线观看| 91在线免费视频观看| 在线视频一区二区三区| 欧美色网一区二区| 欧美一区二区三区免费在线看| 日韩午夜在线观看视频| 久久众筹精品私拍模特| 国产午夜亚洲精品不卡| 亚洲视频一区二区在线观看| 亚洲综合成人在线视频| 天堂久久久久va久久久久| 日本视频一区二区三区| 免费亚洲电影在线| 国产中文字幕精品| 91麻豆自制传媒国产之光| 欧美性videosxxxxx| 日韩精品一区二区三区四区| 国产亚洲婷婷免费| 亚洲精品中文字幕在线观看| 亚洲线精品一区二区三区八戒| 蜜桃一区二区三区在线观看| 国产夫妻精品视频| 99re66热这里只有精品3直播 | 91 com成人网| 国产亚洲一区二区三区四区| 亚洲欧美激情视频在线观看一区二区三区 | 中文字幕欧美国产| 亚洲高清久久久| 国产成人av一区| 精品视频免费在线| 国产女主播在线一区二区| 亚洲伦在线观看| 欧美日韩成人一区二区| 麻豆91精品91久久久的内涵| 在线国产亚洲欧美| 免费久久精品视频| 国产香蕉久久精品综合网| 亚洲欧美综合在线精品| 亚洲美女视频在线观看| 91精品国产手机| 免费在线观看日韩欧美| 久久精品人人做人人综合| 香蕉av福利精品导航| 精品一区二区三区免费观看 | 久久久国际精品| 亚洲一区二区三区小说| 国产精品123| 欧美一级免费大片| 亚洲特黄一级片| 久久99精品久久久| 欧美性感一类影片在线播放| 国产亚洲一二三区| 日本午夜一本久久久综合| 91亚洲精品一区二区乱码| 久久婷婷久久一区二区三区| 一区二区三区四区av| 国产精品一二三在| 日韩欧美第一区| 五月开心婷婷久久| 91在线一区二区三区| 国产日韩v精品一区二区| 天天色 色综合| 在线一区二区三区四区五区 | 一区二区三区四区激情 | 樱花影视一区二区| 99久久伊人精品| 国产欧美精品一区二区色综合| 免费在线观看成人| 91精品一区二区三区久久久久久| 一区二区视频在线| 91麻豆福利精品推荐| 最好看的中文字幕久久| 福利电影一区二区| 久久久精品天堂| 国产成人在线网站| 久久你懂得1024| 黄色小说综合网站| 日韩欧美的一区| 麻豆精品一区二区三区| 欧美电影免费观看高清完整版在线 | 欧美色大人视频| 亚洲最大色网站| 欧美一级二级三级蜜桃| 亚洲 欧美综合在线网络| 欧美日韩国产美| 日韩成人精品视频| 欧美日韩精品电影| 石原莉奈在线亚洲三区| 这里只有精品电影| 日韩高清不卡一区二区| 欧美剧情电影在线观看完整版免费励志电影 | 一本色道**综合亚洲精品蜜桃冫| 国产精品国产自产拍高清av王其 | 理论电影国产精品| 精品第一国产综合精品aⅴ| 国产一区二区影院| 中文字幕欧美日韩一区| 91在线porny国产在线看| 亚洲香蕉伊在人在线观| 91精品国产高清一区二区三区| 麻豆成人免费电影| 国产偷国产偷亚洲高清人白洁| 成人丝袜视频网| 亚洲免费av网站| 欧美日韩国产经典色站一区二区三区 | 色综合亚洲欧洲| 亚洲综合久久久| 欧美电视剧在线看免费| 国产精品亚洲综合一区在线观看| 国产精品久久久久久妇女6080 | 欧美老肥妇做.爰bbww| 秋霞电影一区二区| 国产亚洲欧美中文| 91久久精品一区二区三| 日韩国产欧美在线播放|