• 大小: 5.13MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-25
  • 语言: C/C++
  • 标签: C++  zlib  minizip  

资源简介

zlib库, minizip帮助类解压zip文件例子,带编译好的zlib库,vs2013编译通过,没有考虑多线程性能之类,适合初学者参考

资源截图

代码片段和文件信息

/* ioapi.h -- IO base function header for compress/uncompress .zip
   part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )

         Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )

         Modifications for Zip64 support
         Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )

         For more info read MiniZip_info.txt

*/

#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
        #define _CRT_SECURE_NO_WARNINGS
#endif

#if defined(__APPLE__) || defined(IOAPI_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename mode) fopen(filename mode)
#define FTELLO_FUNC(stream) ftello(stream)
#define FSEEKO_FUNC(stream offset origin) fseeko(stream offset origin)
#else
#define FOPEN_FUNC(filename mode) fopen64(filename mode)
#define FTELLO_FUNC(stream) ftello64(stream)
#define FSEEKO_FUNC(stream offset origin) fseeko64(stream offset origin)
#endif


#include “ioapi.h“

voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefuncconst void*filenameint mode)
{
    if (pfilefunc->zfile_func64.zopen64_file != NULL)
        return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaquefilenamemode);
    else
    {
        return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque(const char*)filenamemode);
    }
}

long call_zseek64 (const zlib_filefunc64_32_def* pfilefuncvoidpf filestream ZPOS64_T offset int origin)
{
    if (pfilefunc->zfile_func64.zseek64_file != NULL)
        return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaquefilestreamoffsetorigin);
    else
    {
        uLong offsetTruncated = (uLong)offset;
        if (offsetTruncated != offset)
            return -1;
        else
            return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaquefilestreamoffsetTruncatedorigin);
    }
}

ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefuncvoidpf filestream)
{
    if (pfilefunc->zfile_func64.zseek64_file != NULL)
        return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaquefilestream);
    else
    {
        uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaquefilestream);
        if ((tell_uLong) == MAXU32)
            return (ZPOS64_T)-1;
        else
            return tell_uLong;
    }
}

void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32const zlib_filefunc_def* p_filefunc32)
{
    p_filefunc64_32->zfile_func64.zopen64_file = NULL;
    p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
    p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
    p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
    p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
    p_filefunc64_32->zfile_func64.ztell64_file = 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-05 09:47  ZipDemo\
     目录           0  2017-11-05 09:47  ZipDemo\bin\
     文件      107520  2012-06-14 20:36  ZipDemo\bin\zlib1.dll
     目录           0  2017-11-05 09:47  ZipDemo\contrib\
     目录           0  2017-11-05 09:47  ZipDemo\contrib\minizip\
     文件        4735  2013-02-24 00:32  ZipDemo\contrib\minizip\crypt.h
     文件        8225  2012-01-21 12:58  ZipDemo\contrib\minizip\ioapi.c
     文件        7051  2012-01-16 19:51  ZipDemo\contrib\minizip\ioapi.h
     文件       14192  2017-09-29 15:42  ZipDemo\contrib\minizip\iowin32.c
     文件         851  2010-02-15 04:58  ZipDemo\contrib\minizip\iowin32.h
     文件        8146  2017-09-29 15:32  ZipDemo\contrib\minizip\mztools.c
     文件         708  2012-01-21 12:58  ZipDemo\contrib\minizip\mztools.h
     文件       71054  2013-02-24 00:32  ZipDemo\contrib\minizip\unzip.c
     文件       16352  2012-07-08 16:34  ZipDemo\contrib\minizip\unzip.h
     文件       15508  2012-06-14 20:00  ZipDemo\contrib\minizip\zconf.h
     文件       65850  2013-02-24 00:32  ZipDemo\contrib\minizip\zip.c
     文件       15366  2010-02-15 04:58  ZipDemo\contrib\minizip\zip.h
     文件       87883  2012-06-14 19:58  ZipDemo\contrib\minizip\zlib.h
     目录           0  2017-11-05 09:47  ZipDemo\lib\
     文件       15256  2010-07-19 06:22  ZipDemo\lib\zdll.lib
     文件        1391  2012-05-31 15:17  ZipDemo\lib\zlib.def
     文件        9108  2017-09-29 15:07  ZipDemo\lib\zlib.exp
     文件       15582  2017-09-29 15:07  ZipDemo\lib\zlib.lib
     目录           0  2017-11-05 09:47  ZipDemo\ZipDemo\
     文件         967  2017-09-29 09:17  ZipDemo\ZipDemo.sln
     文件       28672  2017-09-29 18:36  ZipDemo\ZipDemo.v12.suo
     目录           0  2017-11-05 09:47  ZipDemo\ZipDemo\Debug\
     文件       18390  2017-09-29 15:43  ZipDemo\ZipDemo\Debug\ioapi.obj
     文件       46750  2017-09-29 15:43  ZipDemo\ZipDemo\Debug\iowin32.obj
     文件       54398  2017-09-29 15:33  ZipDemo\ZipDemo\Debug\miniunz.obj
     文件       42748  2017-09-29 15:33  ZipDemo\ZipDemo\Debug\minizip.obj
............此处省略25个文件信息

评论

共有 条评论