forked from openkylin/platform_build
Fix an uninitialized value warning.
Warning from the static analyzer: build/tools/zipalign/ZipFile.cpp:503:5: warning: Function call argument is an uninitialized value pEntry->setDataInfo(uncompressedLen, endPosn - startPosn, crc, Specifically, it's referencing `crc`, which would be uninitialized if we hit either of these two error cases, since we'd return `NO_ERROR`. Note that the warning is still there, but that's only because the static analyzer can't see the asserts. If we #undef NDEBUG in the file, then the warning disappears. Bug: none Test: With NDEBUG undefined, the warning is gone. Change-Id: Iaed66127746c38add2c842ab027f2e1982d0e2fd
This commit is contained in:
parent
a8c8dadd09
commit
221c1c027a
|
@ -919,6 +919,7 @@ status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp,
|
||||||
getSize = fread(inBuf, 1, kBufSize, srcFp);
|
getSize = fread(inBuf, 1, kBufSize, srcFp);
|
||||||
if (ferror(srcFp)) {
|
if (ferror(srcFp)) {
|
||||||
ALOGD("deflate read failed (errno=%d)\n", errno);
|
ALOGD("deflate read failed (errno=%d)\n", errno);
|
||||||
|
result = UNKNOWN_ERROR;
|
||||||
delete[] inBuf;
|
delete[] inBuf;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
@ -937,6 +938,7 @@ status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp,
|
||||||
ALOGV("+++ writing %d bytes\n", (int)outSize);
|
ALOGV("+++ writing %d bytes\n", (int)outSize);
|
||||||
if (fwrite(outBuf, 1, outSize, dstFp) != outSize) {
|
if (fwrite(outBuf, 1, outSize, dstFp) != outSize) {
|
||||||
ALOGD("write %d failed in deflate\n", (int)outSize);
|
ALOGD("write %d failed in deflate\n", (int)outSize);
|
||||||
|
result = UNKNOWN_ERROR;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue