这篇教程C++ unzOpen2函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中unzOpen2函数的典型用法代码示例。如果您正苦于以下问题:C++ unzOpen2函数的具体用法?C++ unzOpen2怎么用?C++ unzOpen2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了unzOpen2函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: fill_memory_filefuncvoid *minizip_unpack_to_memory(void *ptr, int len, int *unpack_len){ char *data = (char*)ptr; if (data[0]!='P'||data[1]!='K') goto unpack_to_mem_fail; zlib_filefunc_def pzlib_filefunc_def; fill_memory_filefunc(&pzlib_filefunc_def); char memname[128]; sprintf(memname,"%lx+%lx", (unsigned long)ptr, (unsigned long)len); unzFile hFile = unzOpen2(memname,&pzlib_filefunc_def); if (unzGoToFirstFile(hFile) != UNZ_OK) goto unpack_to_mem_fail; if (unzOpenCurrentFile(hFile) != UNZ_OK) goto unpack_to_mem_fail; unsigned char *tot = 0; unsigned int n_tot=0, n_read=0; unsigned char buf[1024]; while ((n_read = unzReadCurrentFile(hFile, buf, 1024)) > 0) { if (tot==0) tot = malloc(n_read); else tot = realloc(tot,n_tot+n_read); if (tot==0) goto unpack_to_mem_fail; memcpy(tot+n_tot,buf,n_read); n_tot+=n_read; } unzClose(hFile); *unpack_len = n_tot; return tot; unpack_to_mem_fail: return 0;}
开发者ID:ShengDian,项目名称:lambdanative,代码行数:26,
示例2: al void Zips::add(const char* name) { MutexAutoLock al(_lock); zlib_filefunc_def zpfs; memset(&zpfs, 0, sizeof(zpfs)); zpfs.zopen_file = ox_fopen; zpfs.zread_file = ox_fread; zpfs.zwrite_file = 0; zpfs.ztell_file = ox_ftell; zpfs.zseek_file = ox_fseek; zpfs.zclose_file = ox_fclose; zpfs.zerror_file = ox_ferror; zpfs.opaque = (void*)_zps.size(); //zpfs.opaque = name; unzFile zp = unzOpen2(name, &zpfs);//todo, optimize search in zip OX_ASSERT(zp); if (!zp) return; zpitem item; item.handle = zp; strcpy(item.name, name); _zps.push_back(item); read(zp); }
开发者ID:Yahor10,项目名称:oxygine-framework,代码行数:29,
示例3: UnzipByteArrayToDirboolUnzipByteArrayToDir (GByteArray *array, const char *dir, CanonMode mode){ zlib_filefunc_def zfuncs; memzip_ctx_t ctx; unzFile zipfile; bool rv; ctx.array = array; ctx.pos = 0; zfuncs.zopen_file = memzip_open; zfuncs.zread_file = memzip_read; zfuncs.zwrite_file = memzip_write; zfuncs.ztell_file = memzip_tell; zfuncs.zseek_file = memzip_seek; zfuncs.zclose_file = memzip_close; zfuncs.zerror_file = memzip_error; zfuncs.opaque = (void *) &ctx; if (!(zipfile = unzOpen2 (NULL, &zfuncs))) return false; rv = ExtractAll (zipfile, dir, mode); unzClose (zipfile); return rv;}
开发者ID:kangaroo,项目名称:moon,代码行数:29,
示例4: ERR_FAIL_COND_VunzFile ZipArchive::get_file_handle(String p_file) const { ERR_FAIL_COND_V(!file_exists(p_file), NULL); File file = files[p_file]; FileAccess *f = FileAccess::open(packages[file.package].filename, FileAccess::READ); ERR_FAIL_COND_V(!f, NULL); zlib_filefunc_def io; zeromem(&io, sizeof(io)); io.opaque = f; io.zopen_file = godot_open; io.zread_file = godot_read; io.zwrite_file = godot_write; io.ztell_file = godot_tell; io.zseek_file = godot_seek; io.zclose_file = godot_close; io.zerror_file = godot_testerror; io.alloc_mem = godot_alloc; io.free_mem = godot_free; unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io); ERR_FAIL_COND_V(!pkg, NULL); int unz_err = unzGoToFilePos(pkg, &file.file_pos); if (unz_err != UNZ_OK || unzOpenCurrentFile(pkg) != UNZ_OK) { unzClose(pkg); ERR_FAIL_V(NULL); }; return pkg;};
开发者ID:93i,项目名称:godot,代码行数:35,
示例5: unzOpen2bool ZipArchive::try_open_pack(const String& p_name) { //printf("opening zip pack %ls, %i, %i/n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); if (p_name.get_extension().nocasecmp_to("zip") != 0 && p_name.get_extension().nocasecmp_to("pcz") != 0) return false; zlib_filefunc_def io; FileAccess* f = FileAccess::open(p_name, FileAccess::READ); if (!f) return false; io.opaque = f; io.zopen_file = godot_open; io.zread_file = godot_read; io.zwrite_file = godot_write; io.ztell_file = godot_tell; io.zseek_file = godot_seek; io.zclose_file = godot_close; io.zerror_file = godot_testerror; unzFile zfile = unzOpen2(p_name.utf8().get_data(), &io); ERR_FAIL_COND_V(!zfile, false); unz_global_info64 gi; int err = unzGetGlobalInfo64(zfile, &gi); ERR_FAIL_COND_V(err!=UNZ_OK, false); Package pkg; pkg.filename = p_name; pkg.zfile = zfile; packages.push_back(pkg); int pkg_num = packages.size()-1; for (unsigned int i=0;i<gi.number_entry;i++) { char filename_inzip[256]; unz_file_info64 file_info; err = unzGetCurrentFileInfo64(zfile,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); ERR_CONTINUE(err != UNZ_OK); File f; f.package = pkg_num; unzGetFilePos(zfile, &f.file_pos); String fname = String("res://") + filename_inzip; files[fname] = f; uint8_t md5[16]={0,0,0,0,0,0,0,0 , 0,0,0,0,0,0,0,0}; PackedData::get_singleton()->add_path(p_name, fname, 1, 0, md5, this); //printf("packed data add path %ls, %ls/n", p_name.c_str(), fname.c_str()); if ((i+1)<gi.number_entry) { unzGoToNextFile(zfile); }; }; return true;};
开发者ID:baekdahl,项目名称:godot,代码行数:60,
示例6: InputSourceExceptionconst byte *JARInputSource::openStream(){ if (stream != null) throw InputSourceException(StringBuffer("openStream(): source stream already opened: '")+baseLocation+"'"); MemoryFile *mf = new MemoryFile; mf->stream = sharedIS->getStream(); mf->length = sharedIS->length(); zlib_filefunc_def zlib_ff; fill_mem_filefunc(&zlib_ff, mf); unzFile fid = unzOpen2(null, &zlib_ff); if (fid == 0) throw InputSourceException(StringBuffer("Can't locate file in JAR content: '")+inJarLocation+"'"); int ret = unzLocateFile(fid, inJarLocation->getChars(), 0); if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't locate file in JAR content: '")+inJarLocation+"'"); unz_file_info file_info; ret = unzGetCurrentFileInfo(fid, &file_info, null, 0, null, 0, null, 0); if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't retrieve current file in JAR content: '")+inJarLocation+"'"); len = file_info.uncompressed_size; stream = new byte[len]; ret = unzOpenCurrentFile(fid); if (ret != UNZ_OK) throw InputSourceException(StringBuffer("Can't open current file in JAR content: '")+inJarLocation+"'"); ret = unzReadCurrentFile(fid, stream, len); if (ret <= 0) throw InputSourceException(StringBuffer("Can't read current file in JAR content: '")+inJarLocation+"' ("+SString(ret)+")"); ret = unzCloseCurrentFile(fid); if (ret == UNZ_CRCERROR) throw InputSourceException(StringBuffer("Bad JAR file CRC")); ret = unzClose(fid); return stream;};
开发者ID:OutOfOrder,项目名称:mod_highlight,代码行数:31,
示例7: unzipopenunzFile unzipopen (const char* path){ unzFile uf = NULL; int err=UNZ_OK;#ifdef USEWIN32IOAPI zlib_filefunc_def ffunc;#endif#ifdef USEWIN32IOAPI fill_win32_filefunc(&ffunc); uf = unzOpen2(path,&ffunc);#else uf = unzOpen(path);#endif if (uf == NULL) return NULL; err = unzGoToFirstFile(uf); if (err != UNZ_OK) { unzClose(uf); return NULL; } err = unzOpenCurrentFile(uf); if (err != UNZ_OK) { unzClose(uf); return NULL; } return uf;}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:34,
示例8: OpenHandleForUnzipping unzFile OpenHandleForUnzipping(HANDLE zip_handle) { zlib_filefunc_def zip_funcs; fill_win32_filefunc(&zip_funcs); zip_funcs.zopen_file = HandleOpenFileFunc; zip_funcs.opaque = zip_handle; return unzOpen2("fd", &zip_funcs); }
开发者ID:h82258652,项目名称:YDWE,代码行数:8,
示例9: OpenForUnzipping unzFile OpenForUnzipping(const std::string& file_name_utf8) { zlib_filefunc_def* zip_func_ptrs = NULL; zlib_filefunc_def zip_funcs; fill_win32_filefunc(&zip_funcs); zip_funcs.zopen_file = ZipOpenFunc; zip_func_ptrs = &zip_funcs; return unzOpen2(file_name_utf8.c_str(), zip_func_ptrs); }
开发者ID:h82258652,项目名称:YDWE,代码行数:9,
示例10: StreamOpen/** ************************************************************************** * Open *****************************************************************************/int StreamOpen( vlc_object_t *p_this ){ stream_t *s = (stream_t*) p_this; stream_sys_t *p_sys; /* Verify file format */ const uint8_t *p_peek; if( stream_Peek( s->p_source, &p_peek, i_zip_marker ) < i_zip_marker ) return VLC_EGENERIC; if( memcmp( p_peek, p_zip_marker, i_zip_marker ) ) return VLC_EGENERIC; s->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) ); if( !p_sys ) return VLC_ENOMEM; s->pf_read = Read; s->pf_peek = Peek; s->pf_control = Control; p_sys->fileFunctions = ( zlib_filefunc_def * ) calloc( 1, sizeof( zlib_filefunc_def ) ); if( !p_sys->fileFunctions ) { free( p_sys ); return VLC_ENOMEM; } p_sys->fileFunctions->zopen_file = ZipIO_Open; p_sys->fileFunctions->zread_file = ZipIO_Read; p_sys->fileFunctions->zwrite_file = ZipIO_Write; p_sys->fileFunctions->ztell_file = ZipIO_Tell; p_sys->fileFunctions->zseek_file = ZipIO_Seek; p_sys->fileFunctions->zclose_file = ZipIO_Close; p_sys->fileFunctions->zerror_file = ZipIO_Error; p_sys->fileFunctions->opaque = ( void * ) s; p_sys->zipFile = unzOpen2( NULL /* path */, p_sys->fileFunctions ); if( !p_sys->zipFile ) { msg_Warn( s, "unable to open file" ); free( p_sys->fileFunctions ); free( p_sys ); return VLC_EGENERIC; } /* Find the stream uri */ char *psz_tmp; if( asprintf( &psz_tmp, "%s.xspf", s->psz_path ) == -1 ) { free( p_sys->fileFunctions ); free( p_sys ); return VLC_ENOMEM; } p_sys->psz_path = s->psz_path; s->psz_path = psz_tmp; return VLC_SUCCESS;}
开发者ID:cobr123,项目名称:qtVlc,代码行数:60,
示例11: qWarningbool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi){ p->zipError=UNZ_OK; if(isOpen()) { qWarning("QuaZip::open(): ZIP already opened"); return false; } QIODevice *ioDevice = p->ioDevice; if (ioDevice == NULL) { if (p->zipName.isEmpty()) { qWarning("QuaZip::open(): set either ZIP file name or IO device first"); return false; } else { ioDevice = new QFile(p->zipName); } } switch(mode) { case mdUnzip: p->unzFile_f=unzOpen2(ioDevice, ioApi); if(p->unzFile_f!=NULL) { p->mode=mode; p->ioDevice = ioDevice; return true; } else { p->zipError=UNZ_OPENERROR; if (!p->zipName.isEmpty()) delete ioDevice; return false; } case mdCreate: case mdAppend: case mdAdd: p->zipFile_f=zipOpen2(ioDevice, mode==mdCreate?APPEND_STATUS_CREATE: mode==mdAppend?APPEND_STATUS_CREATEAFTER: APPEND_STATUS_ADDINZIP, NULL, ioApi); if(p->zipFile_f!=NULL) { p->mode=mode; p->ioDevice = ioDevice; return true; } else { p->zipError=UNZ_OPENERROR; if (!p->zipName.isEmpty()) delete ioDevice; return false; } default: qWarning("QuaZip::open(): unknown mode: %d", (int)mode); if (!p->zipName.isEmpty()) delete ioDevice; return false; break; }}
开发者ID:valentinos,项目名称:ModMine,代码行数:56,
示例12: m_ZipFileHandle// ------------------------------------------------------------------------------------------------// Constructor.Q3BSPZipArchive::Q3BSPZipArchive(IOSystem* pIOHandler, const std::string& rFile) : m_ZipFileHandle(NULL), m_ArchiveMap() { if (! rFile.empty()) { zlib_filefunc_def mapping = IOSystem2Unzip::get(pIOHandler); m_ZipFileHandle = unzOpen2(rFile.c_str(), &mapping); if(m_ZipFileHandle != NULL) { mapArchive(); } }}
开发者ID:AldoMarzullo,项目名称:OpenGL_core_project,代码行数:13,
示例13: CW2ASTDMETHODIMP CLarrysOpenOfficeandStarOfficeIndexerObj::HandleFile(BSTR RawFullPath, IDispatch* IFactory){ string FullPath = CW2A(RawFullPath); // Open the zip file (since OpenOffice files are all zips. If you don't // believe me, rename one to .zip and decompress it) unzFile UnzipFile = NULL; zlib_filefunc_def FileFunc; fill_win32_filefunc(&FileFunc); UnzipFile = unzOpen2(FullPath.c_str(), &FileFunc); // Verify that the file was successfully opened if (UnzipFile == NULL) { return S_FALSE; } // Get data from the Content.xml which is inside of the archive string ContentData; ContentData = GetDataFromContentXML(UnzipFile); // Close the file unzClose(UnzipFile); if (ContentData == "") { return S_FALSE; } // Convert the XML into plain text ContentData = HTMLToText(ContentData); // Get the modification time of the file HANDLE FileHandle; FileHandle = CreateFile(FullPath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); FILETIME *ModifiedTime = (FILETIME *)malloc(sizeof FILETIME); BOOL FileTimeResult = GetFileTime(FileHandle, 0, 0, ModifiedTime); CloseHandle(FileHandle); if (!FileTimeResult) { return S_FALSE; } // Format modification date properly SYSTEMTIME SystemTime; FileTimeToSystemTime(ModifiedTime, &SystemTime); // Index file LarGDSPlugin GDSPlugin(PluginClassID); if (!GDSPlugin.SendTextFileEvent(ContentData, FullPath, SystemTime)) { return S_FALSE; } return S_OK; }
开发者ID:lg,项目名称:gd-openoffice-indexer,代码行数:53,
示例14: unzOpenFileunzFile unzOpenFile(const QString& filename){ unzFile unz;#if defined(_WIN32) && defined(HAVE_UNICODE) fill_fopen_filefunc(&file_api); file_api.zopen_file = fopen_filefunc_unicode; unz = unzOpen2((const char*)filename.utf16(), &file_api); #else QByteArray fname(filename.toLocal8Bit()); unz = unzOpen(fname.data()); #endif return unz;}
开发者ID:avary,项目名称:scribus,代码行数:13,
示例15: strstrbool ThemeLoader::extractZip( const std::string &zipFile, const std::string &rootDir ){ bool b_isWsz = strstr( zipFile.c_str(), ".wsz" ); // Try to open the ZIP file zlib_filefunc_def descr; fill_fopen_filefunc( &descr ); descr.zopen_file = open_vlc; descr.opaque = getIntf(); unzFile file = unzOpen2( zipFile.c_str(), &descr ); if( file == 0 ) { msg_Dbg( getIntf(), "failed to open %s as a zip file", zipFile.c_str() ); return false; } unz_global_info info; if( unzGetGlobalInfo( file, &info ) != UNZ_OK ) { msg_Dbg( getIntf(), "failed to read zip info from %s", zipFile.c_str() ); unzClose( file ); return false; } // Extract all the files in the archive for( unsigned long i = 0; i < info.number_entry; i++ ) { if( !extractFileInZip( file, rootDir, b_isWsz ) ) { msg_Warn( getIntf(), "error while unzipping %s", zipFile.c_str() ); unzClose( file ); return false; } if( i < info.number_entry - 1 ) { // Go the next file in the archive if( unzGoToNextFile( file ) != UNZ_OK ) { msg_Warn( getIntf(), "error while unzipping %s", zipFile.c_str() ); unzClose( file ); return false; } } } unzClose( file ); return true;}
开发者ID:Gonsaave,项目名称:vlc,代码行数:51,
示例16: unzOpen2 void* ZipIOBase::__openUnzip(const char* pathname) { zlib_filefunc_def_s s; s.opaque=this; s.zopen_file=&___open_file_func; s.zread_file=&___read_file_func; s.zwrite_file=&___write_file_func; s.ztell_file=&___tell_file_func; s.zseek_file=&___seek_file_func; s.zclose_file=&___close_file_func; s.zerror_file=&___testerror_file_func; return unzOpen2(pathname,&s); }
开发者ID:vinceplusplus,项目名称:z3D,代码行数:14,
示例17: openUnzFilestatic unzFileopenUnzFile( const char* zipfilename ){ unzFile uf = NULL; if( zipfilename ){#ifdef USEWIN32IOAPI zlib_filefunc_def ffunc; fill_win32_filefunc( &ffunc ); uf = unzOpen2( zipfilename, &ffunc );#else uf = unzOpen( zipfilename );#endif } return uf;}
开发者ID:mr-moai-2016,项目名称:znk_project,代码行数:15,
示例18: MFFileSystemZipFile_Mountint MFFileSystemZipFile_Mount(MFMount *pMount, MFMountData *pMountData){ MFCALLSTACK; MFDebug_Assert(pMountData->cbSize == sizeof(MFMountDataZipFile), "Incorrect size for MFMountDataNative structure. Invalid pMountData."); MFMountDataZipFile *pMountZipFile = (MFMountDataZipFile*)pMountData; bool flatten = (pMount->volumeInfo.flags & MFMF_FlattenDirectoryStructure) != 0; bool recursive = (pMount->volumeInfo.flags & MFMF_Recursive) != 0; MFDebug_Assert(flatten, ".zip file currently only supports a flattened directory structure."); if(!recursive) MFDebug_Warn(3, "Mounting Zip filesystems without the 'Recursive' flag is invalid. Zip file will be mounted recursive anyway."); // attempt to open zipfile.. zlib_filefunc_def zipIOFunctions; zipIOFunctions.zopen_file = zopen_file_func; zipIOFunctions.zread_file = zread_file_func; zipIOFunctions.zwrite_file = zwrite_file_func; zipIOFunctions.ztell_file = ztell_file_func; zipIOFunctions.zseek_file = zseek_file_func; zipIOFunctions.zclose_file = zclose_file_func; zipIOFunctions.zerror_file = ztesterror_file_func; zipIOFunctions.opaque = pMountZipFile->pZipArchive; unzFile zipFile = unzOpen2(NULL, &zipIOFunctions); if(!zipFile) { MFDebug_Warn(1, "FileSystem: Supplied file handle is not a valid .zip file."); return -1; } pMount->pFilesysData = zipFile; // make sure the toc is being cached... if(pMount->volumeInfo.flags & MFMF_DontCacheTOC) { MFDebug_Warn(2, "Zip files MUST cache the toc"); pMount->volumeInfo.flags &= ~MFMF_DontCacheTOC; } return 0;}
开发者ID:RemedyGameJam,项目名称:fuji,代码行数:47,
示例19: unzOpen2gbooleanManagedUnzip::StreamToStreamNthFile (ManagedStreamCallbacks *source, ManagedStreamCallbacks *dest, int file){ zlib_filefunc_def funcs; unzFile zipFile; gboolean ret; ret = FALSE; funcs.zopen_file = managed_stream_open; funcs.zread_file = managed_stream_read; funcs.zwrite_file = managed_stream_write; funcs.ztell_file = managed_stream_tell; funcs.zseek_file = managed_stream_seek; funcs.zclose_file = managed_stream_close; funcs.zerror_file = managed_stream_error; funcs.opaque = source; zipFile = unzOpen2 (NULL, &funcs); if (!zipFile) return FALSE; if (unzGoToFirstFile (zipFile) != UNZ_OK) goto cleanup; while (!IsCurrentFileValid (zipFile) || file > 0) { if (unzGoToNextFile (zipFile) != UNZ_OK) goto cleanup; if (!IsCurrentFileValid (zipFile)) continue; file --; } if (unzOpenCurrentFile (zipFile) != UNZ_OK) goto cleanup; ret = ExtractToStream (zipFile, dest);cleanup: unzCloseCurrentFile (zipFile); unzClose (zipFile); return ret;}
开发者ID:499940913,项目名称:moon,代码行数:45,
示例20: CArchiveBufferedCArchiveZip::CArchiveZip(const std::string& name): CArchiveBuffered(name), curSearchHandle(1){#ifdef USEWIN32IOAPI zlib_filefunc_def ffunc; fill_win32_filefunc(&ffunc); zip = unzOpen2(name.c_str(),&ffunc);#else zip = unzOpen(name.c_str());#endif if (!zip) { LogObject() << "Error opening " << name; return; } // We need to map file positions to speed up opening later for (int ret = unzGoToFirstFile(zip); ret == UNZ_OK; ret = unzGoToNextFile(zip)) { unz_file_info info; char fname[512]; unzGetCurrentFileInfo(zip, &info, fname, 512, NULL, 0, NULL, 0); const std::string name = StringToLower(fname); if (name.empty()) { continue; } const char last = name[name.length() - 1]; if ((last == '/') || (last == '//')) { continue; // exclude directory names } FileData fd; unzGetFilePos(zip, &fd.fp); fd.size = info.uncompressed_size; fd.origName = fname; fd.crc = info.crc; fileData[name] = fd; }}
开发者ID:javaphoon,项目名称:spring,代码行数:40,
示例21: qWarningbool QuaZip::open(Mode mode, zlib_filefunc_def* ioApi){ zipError=UNZ_OK; if(isOpen()) { qWarning("QuaZip::open(): ZIP already opened"); return false; } switch(mode) { case mdUnzip: unzFile_f=unzOpen2(QFile::encodeName(zipName).constData(), ioApi); if(unzFile_f!=NULL) { this->mode=mode; return true; } else { zipError=UNZ_OPENERROR; return false; } case mdCreate: case mdAppend: case mdAdd: zipFile_f=zipOpen2(QFile::encodeName(zipName).constData(), mode==mdCreate?APPEND_STATUS_CREATE: mode==mdAppend?APPEND_STATUS_CREATEAFTER: APPEND_STATUS_ADDINZIP, NULL, ioApi); if(zipFile_f!=NULL) { this->mode=mode; return true; } else { zipError=UNZ_OPENERROR; return false; } default: qWarning("QuaZip::open(): unknown mode: %d", (int)mode); return false; break; }}
开发者ID:BrainsoftLtd,项目名称:fritzing-app,代码行数:39,
示例22: unzOpen2bool nglZipFS::Open(){ mpFileFuncDef = new zlib_filefunc_def; mpFileFuncDef->opaque = mpStream; mpFileFuncDef->zopen_file = &::zOpen; mpFileFuncDef->zread_file = &::zRead; mpFileFuncDef->zwrite_file = &::zWrite; mpFileFuncDef->ztell_file = &::zTell; mpFileFuncDef->zseek_file = &::zSeek; mpFileFuncDef->zclose_file = &::zClose; mpFileFuncDef->zerror_file = &::zError; if (mpStream == NULL || mpPrivate == NULL || !IsValid()) return false; mpPrivate->mZip = unzOpen2("", mpFileFuncDef); if (mpPrivate->mZip == NULL) return false; return BuildIndex();}
开发者ID:JamesLinus,项目名称:nui3,代码行数:22,
示例23: PreprareMemoryForUnzipping // static unzFile PreprareMemoryForUnzipping(const std::string& data) { if (data.empty()) return NULL; ZipBuffer* buffer = static_cast<ZipBuffer*>(malloc(sizeof(ZipBuffer))); if (!buffer) return NULL; buffer->data = data.data(); buffer->length = data.length(); buffer->offset = 0; zlib_filefunc_def zip_functions; zip_functions.zopen_file = OpenZipBuffer; zip_functions.zread_file = ReadZipBuffer; zip_functions.zwrite_file = WriteZipBuffer; zip_functions.ztell_file = GetOffsetOfZipBuffer; zip_functions.zseek_file = SeekZipBuffer; zip_functions.zclose_file = CloseZipBuffer; zip_functions.zerror_file = GetErrorOfZipBuffer; zip_functions.opaque = static_cast<void*>(buffer); return unzOpen2(NULL, &zip_functions); }
开发者ID:h82258652,项目名称:YDWE,代码行数:24,
示例24: managed_unzip_stream_to_streamgbooleanmanaged_unzip_stream_to_stream (ManagedStreamCallbacks *source, ManagedStreamCallbacks *dest, const char *partname){ zlib_filefunc_def funcs; unzFile zipFile; gboolean ret; ret = FALSE; funcs.zopen_file = managed_stream_open; funcs.zread_file = managed_stream_read; funcs.zwrite_file = managed_stream_write; funcs.ztell_file = managed_stream_tell; funcs.zseek_file = managed_stream_seek; funcs.zclose_file = managed_stream_close; funcs.zerror_file = managed_stream_error; funcs.opaque = source; zipFile = unzOpen2 (NULL, &funcs); if (!zipFile) return FALSE; if (unzLocateFile (zipFile, partname, 2) != UNZ_OK) goto cleanup; if (unzOpenCurrentFile (zipFile) != UNZ_OK) goto cleanup; ret = managed_unzip_extract_to_stream (zipFile, dest);cleanup: unzCloseCurrentFile (zipFile); unzClose (zipFile); return ret;}
开发者ID:kangaroo,项目名称:moon,代码行数:37,
示例25: CArchiveBufferedCArchiveZip::CArchiveZip(const string& name) : CArchiveBuffered(name), curSearchHandle(1){#ifdef USEWIN32IOAPI zlib_filefunc_def ffunc; fill_win32_filefunc(&ffunc); zip = unzOpen2(name.c_str(),&ffunc);#else zip = unzOpen(name.c_str());#endif if (!zip) return; // We need to map file positions to speed up opening later for (int ret = unzGoToFirstFile(zip); ret == UNZ_OK; ret = unzGoToNextFile(zip)) { unz_file_info info; char fname[512]; string name; unzGetCurrentFileInfo(zip, &info, fname, 512, NULL, 0, NULL, 0); if (info.uncompressed_size > 0) { name = StringToLower(fname);// SetSlashesForwardToBack(name); FileData fd; unzGetFilePos(zip, &fd.fp); fd.size = info.uncompressed_size; fd.origName = fname; fd.crc = info.crc;// SetSlashesForwardToBack(fd.origName); fileData[name] = fd; } }}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:37,
示例26: ReadZipFileMessageRef ReadZipFile(DataIO & readFrom, bool loadData){ TCHECKPOINT; static const int NAME_BUF_LEN = 8*1024; // names longer than 8KB are ridiculous anyway! char * nameBuf = newnothrow_array(char, NAME_BUF_LEN); if (nameBuf) { MessageRef ret = GetMessageFromPool(); if (ret()) { zlib_filefunc_def zdefs = { fopen_dataio_func, fread_dataio_func, fwrite_dataio_func, ftell_dataio_func, fseek_dataio_func, fclose_dataio_func, ferror_dataio_func, &readFrom }; zipFile zf = unzOpen2(NULL, &zdefs); if (zf != NULL) { if (ReadZipFileAux(zf, *ret(), nameBuf, NAME_BUF_LEN, loadData) != B_NO_ERROR) ret.Reset(); unzClose(zf); } else ret.Reset(); // failure! } delete [] nameBuf; return ret; } else WARN_OUT_OF_MEMORY; return MessageRef();}
开发者ID:jfriesne,项目名称:muscle,代码行数:36,
示例27: apk_uncompress_internalenum ApkResultapk_uncompress_internal(AndroidApk *apk, char **buffer, size_t *size){ zlib_filefunc_def filefunc; fill_memory_filefunc(&filefunc); char *old_buffer = *buffer; char path[1024]; sprintf(path, "%x+%x", *buffer, *size); /* Decompress a single file in a .zip from memory */ unz_file_info info; unzFile *unz = unzOpen2(path, &filefunc); unzGoToFirstFile(unz); unzGetCurrentFileInfo(unz, &info, NULL, 0, NULL, 0, NULL, 0); *size = info.uncompressed_size; *buffer = malloc(*size); unzOpenCurrentFile(unz); unzReadCurrentFile(unz, *buffer, *size); unzCloseCurrentFile(unz); unzClose(unz); free(old_buffer); return APK_OK;}
开发者ID:raimue,项目名称:apkenv,代码行数:24,
注:本文中的unzOpen2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unzOpenCurrentFile函数代码示例 C++ unzOpen函数代码示例 |