Skip to content

Commit

Permalink
recode print filename, support non-en filename;
Browse files Browse the repository at this point in the history
  • Loading branch information
housisong committed Dec 11, 2023
1 parent 02a63ea commit a787996
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/ZiPatExtraDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/apk_normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/diff/DiffData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
10 changes: 6 additions & 4 deletions src/normalized/normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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(version<v1.3.5) ZipPatch!)\n",_compressedEmptyFiles[i].c_str());
hpatch_printPath_utf8(("WARNING: \""+_compressedEmptyFiles[i]).c_str());
printf(" is a compressed empty file, can't patch by old(version<v1.3.5) ZipPatch!)\n");
}
if (jarSignFileCount>0){
if (isHaveApkV2Sign){
Expand All @@ -224,7 +226,7 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co
}
}
for (size_t i=0;i<removedFiles.size();++i)
printf("WARNING: removed file: %s\n",removedFiles[i].c_str());
hpatch_printPath_utf8((std::string("WARNING: removed file: \"")+removedFiles[i]+"\"\n").c_str());
if (isHaveApkV2Sign){
printf(isHaveApkV3Sign?
"WARNING: src removed ApkV2Sign & ApkV3Sign data (%d Byte, need re-sign)\n"
Expand Down
9 changes: 5 additions & 4 deletions src/zip_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ int zipdiff_cmd_line(int argc, const char * argv[]) {
oldZipPath =arg_values[0];
newZipPath =arg_values[1];
outDiffFileName =arg_values[2];
printf((isDiff?"oldZip :\"%s\"\nnewZip :\"%s\"\noutDiff :\"%s\"\n":
"oldZip :\"%s\"\nnewZip :\"%s\"\ntestDiff:\"%s\"\n"),
oldZipPath,newZipPath,outDiffFileName);

hpatch_printPath_utf8((std::string("oldZip : \"")+oldZipPath+"\"\n").c_str());
hpatch_printPath_utf8((std::string("newZip : \"")+newZipPath+"\"\n").c_str());
hpatch_printPath_utf8((std::string(isDiff?
"outDiff : \"":
"testDiff: \"")+outDiffFileName+"\"\n").c_str());
double time0=clock_s();
bool isNewZipApkV2SignNoError=true;
if (isDiff){
Expand Down
11 changes: 7 additions & 4 deletions src/zip_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ int zippatch_cmd_line(int argc, const char * argv[]) {
}else{
_options_check(false,"count");
}
printf("oldZip :\"%s\"\nzipDiff :\"%s\"\noutNewZip:\"%s\"\n",oldZipPath,zipDiffPath,outNewZipPath);
if (tempUncompressFileName!=0)
printf("maxUncompressMemory:%" PRSizeT "\ntempUncompressFileName:\"%s\"\n",
maxUncompressMemory,tempUncompressFileName);
hpatch_printPath_utf8((std::string("oldZip : \"")+oldZipPath+"\"\n").c_str());
hpatch_printPath_utf8((std::string("zipDiff : \"")+zipDiffPath+"\"\n").c_str());
hpatch_printPath_utf8((std::string("outNewZip: \"")+outNewZipPath+"\"\n").c_str());
if (tempUncompressFileName!=0){
printf("maxUncompressMemory:%" PRSizeT "\n",maxUncompressMemory);
hpatch_printPath_utf8((std::string("tempUncompressFileName:\"")+tempUncompressFileName+"\"\n").c_str());
}

double time0=clock_s();
int exitCode=ZipPatch(oldZipPath,zipDiffPath,outNewZipPath,
Expand Down

0 comments on commit a787996

Please sign in to comment.