Skip to content

Commit a787996

Browse files
committed
recode print filename, support non-en filename;
1 parent 02a63ea commit a787996

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

src/ZiPatExtraDemo.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ int extra_cmd_line(int argc, const char * argv[]) {
7373
srcZiPatPath =argv[1];
7474
outZiPatPath =argv[2];
7575
const char* appendData=argv[3];//NOTE: modify this for your require
76-
printf(" src ZiPat :\"%s\"\n",srcZiPatPath);
77-
printf(" out ZiPat :\"%s\"\n",outZiPatPath);
78-
printf("test append:\"%s\"\n",appendData);
76+
hpatch_printPath_utf8((std::string("src ZiPat : \"")+srcZiPatPath+"\"\n").c_str());
77+
hpatch_printPath_utf8((std::string("out ZiPat : \"")+outZiPatPath+"\"\n").c_str());
78+
hpatch_printPath_utf8((std::string("test append: \"")+appendData+"\"\n").c_str());
7979
if (!(addToExtra(srcZiPatPath,outZiPatPath,(const TByte*)appendData,strlen(appendData)))){
8080
return _kRET_ERROR;
8181
}

src/apk_normalized.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ int normalized_cmd_line(int argc, const char * argv[]){
192192
_options_check(arg_values_size==2,"count");
193193
const char* srcApk=arg_values[0];
194194
const char* dstApk=arg_values[1];
195-
printf("src: \"%s\"\nout: \"%s\"\n",srcApk,dstApk);
195+
hpatch_printPath_utf8((std::string("src: \"")+srcApk+"\"\n").c_str());
196+
hpatch_printPath_utf8((std::string("out: \"")+dstApk+"\"\n").c_str());
196197
double time0=clock_s();
197198
int apkFilesRemoved=0;
198199
if (!ZipNormalized(srcApk,dstApk,(int)alignSize,(int)compressLevel,

src/diff/DiffData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ bool getSamePairList(UnZipper* newZip,UnZipper* oldZip,
270270
if (zipFile_name(newZip,i)==zipFile_name(oldZip,oldIndex)) break;
271271
}else{
272272
printf("WARNING: crc32 equal but data not equal! file index: %d,%d\n",i,oldIndex);
273-
printf(" name:\"%s\"\n \"%s\"\n",zipFile_name(newZip,i).c_str(),
274-
zipFile_name(oldZip,oldIndex).c_str());
273+
hpatch_printPath_utf8((" name: \""+zipFile_name(newZip,i)+"\"\n").c_str());
274+
hpatch_printPath_utf8((" \""+zipFile_name(oldZip,oldIndex)+"\"\n").c_str());
275275
}
276276
}
277277
if (findSame){

src/normalized/normalized.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,14 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co
185185
int fileIndex=fileIndexs[i];
186186
std::string fileName=zipFile_name(&unzipper,fileIndex);
187187
if (g_isPrintApkNormalizedFileName)
188-
printf("\"%s\"\n",fileName.c_str());
188+
hpatch_printPath_utf8(("\""+fileName+"\"\n").c_str());
189189
if (compressLevel==0){
190190
check(Zipper_file_append_set_new_isCompress(&zipper,false));
191191
} else if (isCompressedEmptyFile(&unzipper,fileIndex)){
192192
if (isNotCompressEmptyFile){
193193
check(Zipper_file_append_set_new_isCompress(&zipper,false));
194-
printf("NOTE: \"%s\" is a compressed empty file, change to uncompressed!\n",fileName.c_str());
194+
hpatch_printPath_utf8(("NOTE: \""+fileName+"\"").c_str());
195+
printf(" is a compressed empty file, change to uncompressed!\n");
195196
}else{
196197
_compressedEmptyFiles.push_back(fileName);
197198
}
@@ -214,7 +215,8 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co
214215
check(Zipper_endCentralDirectory_append(&zipper,&unzipper));
215216

216217
for (int i=0;i<(int)_compressedEmptyFiles.size();++i){
217-
printf("WARNING: \"%s\" is a compressed empty file, can't patch by old(version<v1.3.5) ZipPatch!)\n",_compressedEmptyFiles[i].c_str());
218+
hpatch_printPath_utf8(("WARNING: \""+_compressedEmptyFiles[i]).c_str());
219+
printf(" is a compressed empty file, can't patch by old(version<v1.3.5) ZipPatch!)\n");
218220
}
219221
if (jarSignFileCount>0){
220222
if (isHaveApkV2Sign){
@@ -224,7 +226,7 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co
224226
}
225227
}
226228
for (size_t i=0;i<removedFiles.size();++i)
227-
printf("WARNING: removed file: %s\n",removedFiles[i].c_str());
229+
hpatch_printPath_utf8((std::string("WARNING: removed file: \"")+removedFiles[i]+"\"\n").c_str());
228230
if (isHaveApkV2Sign){
229231
printf(isHaveApkV3Sign?
230232
"WARNING: src removed ApkV2Sign & ApkV3Sign data (%d Byte, need re-sign)\n"

src/zip_diff.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,11 @@ int zipdiff_cmd_line(int argc, const char * argv[]) {
356356
oldZipPath =arg_values[0];
357357
newZipPath =arg_values[1];
358358
outDiffFileName =arg_values[2];
359-
printf((isDiff?"oldZip :\"%s\"\nnewZip :\"%s\"\noutDiff :\"%s\"\n":
360-
"oldZip :\"%s\"\nnewZip :\"%s\"\ntestDiff:\"%s\"\n"),
361-
oldZipPath,newZipPath,outDiffFileName);
362-
359+
hpatch_printPath_utf8((std::string("oldZip : \"")+oldZipPath+"\"\n").c_str());
360+
hpatch_printPath_utf8((std::string("newZip : \"")+newZipPath+"\"\n").c_str());
361+
hpatch_printPath_utf8((std::string(isDiff?
362+
"outDiff : \"":
363+
"testDiff: \"")+outDiffFileName+"\"\n").c_str());
363364
double time0=clock_s();
364365
bool isNewZipApkV2SignNoError=true;
365366
if (isDiff){

src/zip_patch.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,13 @@ int zippatch_cmd_line(int argc, const char * argv[]) {
162162
}else{
163163
_options_check(false,"count");
164164
}
165-
printf("oldZip :\"%s\"\nzipDiff :\"%s\"\noutNewZip:\"%s\"\n",oldZipPath,zipDiffPath,outNewZipPath);
166-
if (tempUncompressFileName!=0)
167-
printf("maxUncompressMemory:%" PRSizeT "\ntempUncompressFileName:\"%s\"\n",
168-
maxUncompressMemory,tempUncompressFileName);
165+
hpatch_printPath_utf8((std::string("oldZip : \"")+oldZipPath+"\"\n").c_str());
166+
hpatch_printPath_utf8((std::string("zipDiff : \"")+zipDiffPath+"\"\n").c_str());
167+
hpatch_printPath_utf8((std::string("outNewZip: \"")+outNewZipPath+"\"\n").c_str());
168+
if (tempUncompressFileName!=0){
169+
printf("maxUncompressMemory:%" PRSizeT "\n",maxUncompressMemory);
170+
hpatch_printPath_utf8((std::string("tempUncompressFileName:\"")+tempUncompressFileName+"\"\n").c_str());
171+
}
169172

170173
double time0=clock_s();
171174
int exitCode=ZipPatch(oldZipPath,zipDiffPath,outNewZipPath,

0 commit comments

Comments
 (0)