IssueNo: #I5S5B9

Description: code check
Sig:SIG_ApplicaitonFramework 
Feature or Bugfix:Bugfix 
Binary Source:No

Signed-off-by: wangtiantian <wangtiantian19@huawei.com>
This commit is contained in:
wangtiantian
2022-09-20 12:15:16 +00:00
committed by Gitee
parent 7c3a6bf1e7
commit aa3c069184
+2 -4
View File
@@ -112,7 +112,6 @@ bool ZipFile::ParseAllEntries()
bool ret = true;
ZipPos currentPos = centralDirPos_;
CentralDirEntry directoryEntry = {};
size_t fileLength = 0;
for (int32_t i = 0; i < endDir_.totalEntries; i++) {
std::string fileName;
@@ -141,7 +140,7 @@ bool ZipFile::ParseAllEntries()
break;
}
fileLength = (directoryEntry.nameSize >= MAX_FILE_NAME) ? (MAX_FILE_NAME - 1) : (directoryEntry.nameSize);
size_t fileLength = (directoryEntry.nameSize >= MAX_FILE_NAME) ? (MAX_FILE_NAME - 1) : (directoryEntry.nameSize);
if (fread(&(fileName[0]), fileLength, FILE_READ_COUNT, file_) != FILE_READ_COUNT) {
HILOG_ERROR(HILOG_MODULE_APP,
"parse entry(%{public}d) read file name failed, error: %{public}s", i, strerror(errno));
@@ -489,7 +488,6 @@ bool ZipFile::UnzipWithInflated(const ZipEntry &zipEntry, const uint16_t extraSi
bool ret = true;
int32_t zlibErr = Z_OK;
uint32_t remainCompressedSize = zipEntry.compressedSize;
size_t inflateLen = 0;
uint8_t errorTimes = 0;
while ((remainCompressedSize > 0) || (zstream.avail_in > 0)) {
@@ -508,7 +506,7 @@ bool ZipFile::UnzipWithInflated(const ZipEntry &zipEntry, const uint16_t extraSi
break;
}
inflateLen = UNZIP_BUF_OUT_LEN - zstream.avail_out;
size_t inflateLen = UNZIP_BUF_OUT_LEN - zstream.avail_out;
if (inflateLen > 0) {
dest.write((const char*)bufOut, inflateLen);
zstream.next_out = bufOut;