int do_extract(unzFile uf, char * revisionRoot) { uLong i; unz_global_info64 gi; int err; err = unzGetGlobalInfo64(uf,&gi); if (err!=UNZ_OK) printf("error %d with zipfile in unzGetGlobalInfo \n",err); for (i=0; i<gi.number_entry; i++) { if (do_extract_currentfile(uf, revisionRoot) != UNZ_OK) break; if ((i+1)<gi.number_entry) { err = unzGoToNextFile(uf); if (err!=UNZ_OK) { printf("error %d with zipfile in unzGoToNextFile\n",err); break; } } } return 0; }
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password) { uLong i; unz_global_info gi; int err; err = unzGetGlobalInfo (uf,&gi); if (err!=UNZ_OK) printf("error %d with zipfile in unzGetGlobalInfo \n",err); for (i=0;i<gi.number_entry;i++) { if (do_extract_currentfile(uf,&opt_extract_without_path, &opt_overwrite, password) != UNZ_OK) break; if ((i+1)<gi.number_entry) { err = unzGoToNextFile(uf); if (err!=UNZ_OK) { printf("error %d with zipfile in unzGoToNextFile\n",err); break; } } } return err; }
int extract_zip(unzFile uf, TCHAR *dirToExtractTo) { uLong i; unz_global_info64 gi; int err; FILE* fout = NULL; err = unzGetGlobalInfo64(uf, &gi); if (err != UNZ_OK) _tprintf(_T("error %d with zipfile in unzGetGlobalInfo \n"), err); for (i = 0; i < gi.number_entry; i++) { if (do_extract_currentfile(uf, dirToExtractTo) != UNZ_OK) break; if ((i + 1) < gi.number_entry) { err = unzGoToNextFile(uf); if (err != UNZ_OK) { _tprintf(_T("error %d with zipfile in unzGoToNextFile\n"), err); break; } } } return 0; }
int extractZipOnefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) { if (unzLocateFile(uf, filename, CASESENSITIVITY) != UNZ_OK) { // printf("file %s not found in the zipfile\n",filename); return 2; } if (do_extract_currentfile(uf, &opt_extract_without_path, &opt_overwrite, password, NULL) == UNZ_OK) return 0; else return 1; }
int do_extract_onefile(unzFile uf, const QString& filename, int opt_extract_without_path, int opt_overwrite, const char* password) { // int err = UNZ_OK; QByteArray fname = filename.toLocal8Bit(); if (unzLocateFile(uf,fname.data(),CASESENSITIVITY)!=UNZ_OK) return 2; if (do_extract_currentfile(uf,&opt_extract_without_path, &opt_overwrite, password) == UNZ_OK) return 0; else return 1; }
static int do_extract( unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password, const OnProgressCallback* progress ) { uLong i; unz_global_info gi; int err; FILE* fout=NULL; err = unzGetGlobalInfo (uf,&gi); for (i=0;i<gi.number_entry;i++) { if (do_extract_currentfile(uf,&opt_extract_without_path, &opt_overwrite, password) != UNZ_OK) break; if ( progress != NULL ) { short cancel = 0; long progressValue = ( 1000000 / gi.number_entry * i ); if(NULL != progress) (*progress)( UTILS_ONPROGRESSEVENT_ID, progressValue, &cancel ); if ( cancel != 0 ) { return err; } } if ((i+1)<gi.number_entry) { err = unzGoToNextFile(uf); if (err!=UNZ_OK) { break; } } } if ( progress != NULL ) { short cancel = 0; long progressValue = 1000000; if(NULL != progress) (*progress)( UTILS_ONPROGRESSEVENT_ID, progressValue, &cancel ); } return 0; }
int XSYNCZIP_getCrrEntryFile ( XDRM_CTRL_CONTEXT_PTR pCtx, char *path ) { #if 0 int retval = 0; int opt =0; chdir ( path ); if ( 0 != do_extract_currentfile ( ( unzFile ) pCtx->pZipFile, &opt, &opt, NULL, path ) ) retval = -1; return retval; #else return NOT_IMPLEMENTED_YET; #endif }
Znk_INLINE int do_extract_onefile( unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password, ZnkStr ermsg ) { int err = UNZ_OK; err = unzLocateFile( uf, filename, CASESENSITIVITY ); if( err != UNZ_OK ){ Znk_printf_e("file %s not found in the zipfile\n",filename); return 2; } err = do_extract_currentfile( uf, &opt_extract_without_path, &opt_overwrite, password, ermsg, NULL, NULL, 1, 0 ); return err == UNZ_OK ? 0 : 1; }
static bool do_extract( unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password, ZnkStr ermsg, ZnkZipProgressFuncT progress_func, void* param ) { uLong i; unz_global_info gi; int err; err = unzGetGlobalInfo( uf, &gi ); if( err != UNZ_OK ){ ZnkStr_addf( ermsg, "ZnkZip : Error : %d with zipfile in unzGetGlobalInfo \n", err ); return false; } for( i=0; i<gi.number_entry; ++i ){ err = do_extract_currentfile( uf, &opt_extract_without_path, &opt_overwrite, password, ermsg, progress_func, param, gi.number_entry, i ); if( err != UNZ_OK ){ ZnkStr_addf( ermsg, "ZnkZip : Error : %d do_extract_currentfile.\n", err ); break; } if( (i+1)<gi.number_entry ){ err = unzGoToNextFile( uf ); if( err != UNZ_OK ){ ZnkStr_addf( ermsg, "ZnkZip : Error : %d with zipfile in unzGoToNextFile\n", err ); break; } } } return (bool)( err == UNZ_OK ); }