From a78799639452b4a2c626e0d85746b56a44a59495 Mon Sep 17 00:00:00 2001 From: sisong Date: Mon, 11 Dec 2023 08:16:48 +0800 Subject: [PATCH] recode print filename, support non-en filename; --- src/ZiPatExtraDemo.cpp | 6 +++--- src/apk_normalized.cpp | 3 ++- src/diff/DiffData.cpp | 4 ++-- src/normalized/normalized.cpp | 10 ++++++---- src/zip_diff.cpp | 9 +++++---- src/zip_patch.cpp | 11 +++++++---- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/ZiPatExtraDemo.cpp b/src/ZiPatExtraDemo.cpp index dae6ace..6253318 100644 --- a/src/ZiPatExtraDemo.cpp +++ b/src/ZiPatExtraDemo.cpp @@ -73,9 +73,9 @@ int extra_cmd_line(int argc, const char * argv[]) { srcZiPatPath =argv[1]; outZiPatPath =argv[2]; const char* appendData=argv[3];//NOTE: modify this for your require - printf(" src ZiPat :\"%s\"\n",srcZiPatPath); - printf(" out ZiPat :\"%s\"\n",outZiPatPath); - printf("test append:\"%s\"\n",appendData); + hpatch_printPath_utf8((std::string("src ZiPat : \"")+srcZiPatPath+"\"\n").c_str()); + hpatch_printPath_utf8((std::string("out ZiPat : \"")+outZiPatPath+"\"\n").c_str()); + hpatch_printPath_utf8((std::string("test append: \"")+appendData+"\"\n").c_str()); if (!(addToExtra(srcZiPatPath,outZiPatPath,(const TByte*)appendData,strlen(appendData)))){ return _kRET_ERROR; } diff --git a/src/apk_normalized.cpp b/src/apk_normalized.cpp index 47075d0..0426116 100644 --- a/src/apk_normalized.cpp +++ b/src/apk_normalized.cpp @@ -192,7 +192,8 @@ int normalized_cmd_line(int argc, const char * argv[]){ _options_check(arg_values_size==2,"count"); const char* srcApk=arg_values[0]; const char* dstApk=arg_values[1]; - printf("src: \"%s\"\nout: \"%s\"\n",srcApk,dstApk); + hpatch_printPath_utf8((std::string("src: \"")+srcApk+"\"\n").c_str()); + hpatch_printPath_utf8((std::string("out: \"")+dstApk+"\"\n").c_str()); double time0=clock_s(); int apkFilesRemoved=0; if (!ZipNormalized(srcApk,dstApk,(int)alignSize,(int)compressLevel, diff --git a/src/diff/DiffData.cpp b/src/diff/DiffData.cpp index 399840a..3d8be08 100644 --- a/src/diff/DiffData.cpp +++ b/src/diff/DiffData.cpp @@ -270,8 +270,8 @@ bool getSamePairList(UnZipper* newZip,UnZipper* oldZip, if (zipFile_name(newZip,i)==zipFile_name(oldZip,oldIndex)) break; }else{ printf("WARNING: crc32 equal but data not equal! file index: %d,%d\n",i,oldIndex); - printf(" name:\"%s\"\n \"%s\"\n",zipFile_name(newZip,i).c_str(), - zipFile_name(oldZip,oldIndex).c_str()); + hpatch_printPath_utf8((" name: \""+zipFile_name(newZip,i)+"\"\n").c_str()); + hpatch_printPath_utf8((" \""+zipFile_name(oldZip,oldIndex)+"\"\n").c_str()); } } if (findSame){ diff --git a/src/normalized/normalized.cpp b/src/normalized/normalized.cpp index 4895c7c..8c54d4f 100644 --- a/src/normalized/normalized.cpp +++ b/src/normalized/normalized.cpp @@ -185,13 +185,14 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co int fileIndex=fileIndexs[i]; std::string fileName=zipFile_name(&unzipper,fileIndex); if (g_isPrintApkNormalizedFileName) - printf("\"%s\"\n",fileName.c_str()); + hpatch_printPath_utf8(("\""+fileName+"\"\n").c_str()); if (compressLevel==0){ check(Zipper_file_append_set_new_isCompress(&zipper,false)); } else if (isCompressedEmptyFile(&unzipper,fileIndex)){ if (isNotCompressEmptyFile){ check(Zipper_file_append_set_new_isCompress(&zipper,false)); - printf("NOTE: \"%s\" is a compressed empty file, change to uncompressed!\n",fileName.c_str()); + hpatch_printPath_utf8(("NOTE: \""+fileName+"\"").c_str()); + printf(" is a compressed empty file, change to uncompressed!\n"); }else{ _compressedEmptyFiles.push_back(fileName); } @@ -214,7 +215,8 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co check(Zipper_endCentralDirectory_append(&zipper,&unzipper)); for (int i=0;i<(int)_compressedEmptyFiles.size();++i){ - printf("WARNING: \"%s\" is a compressed empty file, can't patch by old(version0){ if (isHaveApkV2Sign){ @@ -224,7 +226,7 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co } } for (size_t i=0;i