From 7f541e764495a17068a940dd467c77d12d3b5b8c Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 14 Jun 2022 17:59:46 +0800 Subject: [PATCH] uncompress files OK...first version on Windows. --- CMCore | 2 +- uuzip.cpp | 130 +++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 120 insertions(+), 12 deletions(-) diff --git a/CMCore b/CMCore index 22267b5..58c8f1d 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 22267b5f6fb1fbb18c3fba0bf707f927c6bb8aaa +Subproject commit 58c8f1db909e9210ed67c0ff04cd0e266741740d diff --git a/uuzip.cpp b/uuzip.cpp index f521f85..2c9372d 100644 --- a/uuzip.cpp +++ b/uuzip.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include @@ -9,6 +9,57 @@ using namespace hgl; using namespace hgl::io; +constexpr size_t TEMP_BUF_SIZE=HGL_SIZE_1MB; +char temp_buffer[TEMP_BUF_SIZE]; + +bool UnzipFile(const OSString &filename,zip_file_t *zf,const int filesize) +{ + int fs=0; + int size; + + FileOutputStream fos; + + if(!fos.CreateTrunc(filename)) + { + LOG_ERROR(OS_TEXT("Create file failed,filename: ")+filename); + zip_fclose(zf); + return(false); + } + + while(fs3) + { + if(argv[3][0]=='.' + &&argv[3][1]==0) + filesystem::GetCurrentPath(output_directory); + else + { + output_directory=argv[3]; + } + } + else + { + filesystem::GetCurrentPath(output_directory); + } + + LOG_INFO(OS_TEXT("zip file: ")+OSString(argv[2])); + LOG_INFO(OS_TEXT("output directory: ")+output_directory); - os_out< filename(256); + MemBlock filename(1024); + u16char last_char; + OSString os_filename; + OSString full_filename; int len=0; - int u16len=256; + int u16len=filename.GetMaxLength(); if(zs) { @@ -94,7 +170,39 @@ int os_main(int argc,os_char **argv) to_utf16(cs,filename,filename.GetMaxLength(),sb.name,len); - os_out<