Skip to content

Commit

Permalink
recode for fix CI;
Browse files Browse the repository at this point in the history
  • Loading branch information
housisong committed Dec 8, 2023
1 parent 3a913bb commit 4b10ed1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/apk_normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static void printUsage(){
" -as-alignSize\n"
" set align size for uncompressed file in zip for optimize app run speed,\n"
" 1 <= alignSize <= 4k, recommended 4,8, DEFAULT -as-8.\n"
" NOTE: if -ap-1, must 4096%%alignSize==0;\n"
" -ap-isPageAlignSoFile\n"
" if found uncompressed .so file in the zip, need align it to 4k page?\n"
" -ap-0 not page-align uncompressed .so files;\n"
Expand Down
7 changes: 1 addition & 6 deletions src/diff/DiffData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ bool zipFileData_isSame(UnZipper* selfZip,int selfIndex,UnZipper* srcZip,int src
return 0==memcmp(buf.data(),buf.data()+selfFileSize,selfFileSize);
}


bool getIsStampCertFile(const UnZipper* self,int fileIndex){
return UnZipper_file_is_lastNameWith(self,fileIndex,"stamp-cert-sha256",17);
}

bool getZipIsSameWithStream(const hpatch_TStreamInput* oldZipStream,
const hpatch_TStreamInput* newZipStream,
int newApkFilesRemoved,bool* out_isOldHaveApkV2Sign){
Expand Down Expand Up @@ -103,7 +98,7 @@ bool getZipIsSameWithStream(const hpatch_TStreamInput* oldZipStream,
for (std::map<std::string,int>::iterator it=oldMap.begin();it!=oldMap.end();++it){
int old_i=it->second;
check_clear(UnZipper_file_isApkV1Sign(&oldZip,old_i)
||getIsStampCertFile(&oldZip,old_i)
||UnZipper_file_isStampCertFile(&oldZip,old_i)
||(UnZipper_file_uncompressedSize(&oldZip,old_i)==0));
}
}
Expand Down
1 change: 0 additions & 1 deletion src/diff/DiffData.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ static inline std::string zipFile_name(const UnZipper* self,int fileIndex){
const char* nameBegin=UnZipper_file_nameBegin(self,fileIndex);
return std::string(nameBegin,nameBegin+nameLen);
}
bool getIsStampCertFile(const UnZipper* self,int fileIndex);

bool getSamePairList(UnZipper* newZip,UnZipper* oldZip,
bool newCompressedDataIsNormalized,
Expand Down
2 changes: 1 addition & 1 deletion src/normalized/normalized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bool ZipNormalized(const char* srcApk,const char* dstApk,int ZipAlignSize,int co
continue; //remove JarSign(ApkV1Sign) when found ApkV2Sign
}
}
if (getIsStampCertFile(&unzipper,fileIndex)){
if (UnZipper_file_isStampCertFile(&unzipper,fileIndex)){
++apkFilesRemoved;
removedFiles.push_back(files[i].fileName);
continue; //remove stamp cert file
Expand Down
2 changes: 1 addition & 1 deletion src/patch/Patcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TPatchResult VirtualZipPatchWithStream(const hpatch_TStreamInput* oldZipStream,c
check(oldStream.stream->streamSize==diffInfo.oldDataSize,PATCH_OLDDATA_ERROR);

check(Zipper_openStream(&out_newZip,outNewZipStream,(int)zipDiffData.newZipFileCount,
(int)zipDiffData.newZipAlignSize,(int)zipDiffData.newCompressLevel,
(int)zipDiffData.newZipAlignSize,(int)zipDiffData.newZipAlignSize,(int)zipDiffData.newCompressLevel,
(int)zipDiffData.newCompressMemLevel),PATCH_OPENWRITE_ERROR);
check(NewStream_open(&newStream,&out_newZip,&oldZip, (size_t)diffInfo.newDataSize,
zipDiffData.newZipIsDataNormalized!=0,
Expand Down
3 changes: 2 additions & 1 deletion src/patch/Zipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,8 @@ static bool _write_fileHeaderInfo(Zipper* self,int fileIndex,UnZipper* srcZip,in
if (isNeedAlign){
size_t headInfoLen=30+fileNameLen+extraFieldLen;
size_t skipLen=_getAlignSkipLen(self->_curFilePos+headInfoLen,self->_ZipAlignSize);
if (UnZipper_file_is_nameEndWith(srcZip,srcFileIndex,".so",3)){
if ((self->_SoPageAlignSize!=self->_ZipAlignSize)&&UnZipper_file_is_nameEndWith(srcZip,srcFileIndex,".so",3)){
check(0==(self->_SoPageAlignSize%self->_ZipAlignSize));
size_t skipSoLen=_getAlignSkipLen(self->_curFilePos+headInfoLen,self->_SoPageAlignSize);
if (skipSoLen!=skipLen){
skipLen=skipSoLen;
Expand Down
3 changes: 3 additions & 0 deletions src/patch/Zipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ bool UnZipper_file_is_sameName(const UnZipper* self,int fileIndex,const char* pa
bool UnZipper_file_is_lastNameWith(const UnZipper* self,int fileIndex,const char* lastName,int lastNameLen);
bool UnZipper_file_is_nameEndWith(const UnZipper* self,int fileIndex,const char* nameSuffix,int nameSuffixLen);//file name is end with nameSuffix

static inline bool UnZipper_file_isStampCertFile(const UnZipper* self,int fileIndex){
return UnZipper_file_is_lastNameWith(self,fileIndex,"stamp-cert-sha256",17);
}

struct TZipThreadWorks;
struct TZipThreadWork;
Expand Down

0 comments on commit 4b10ed1

Please sign in to comment.