Fix or suppress some google-runtime-int warnings.

Bug: 112478838
Test: build with WITH_TIDY=1
Change-Id: Ie3b15a85770b5806cddfd49a475aaf0553f9ec78
This commit is contained in:
Chih-Hung Hsieh 2018-08-10 15:14:26 -07:00
parent edeab211d2
commit 0c0d92887c
5 changed files with 18 additions and 18 deletions

View File

@ -102,7 +102,7 @@ static int copyAndAlign(ZipFile* pZin, ZipFile* pZout, int alignment, bool zopfl
* file position in the new file will be equal to the file
* position in the original.
*/
long newOffset = pEntry->getFileOffset() + bias;
off_t newOffset = pEntry->getFileOffset() + bias;
padding = (alignTo - (newOffset % alignTo)) % alignTo;
//printf("--- %s: orig at %ld(+%d) len=%ld, adding pad=%d\n",
@ -190,23 +190,23 @@ static int verify(const char* fileName, int alignment, bool verbose,
pEntry = zipFile.getEntryByIndex(i);
if (pEntry->isCompressed()) {
if (verbose) {
printf("%8ld %s (OK - compressed)\n",
(long) pEntry->getFileOffset(), pEntry->getFileName());
printf("%8jd %s (OK - compressed)\n",
(intmax_t) pEntry->getFileOffset(), pEntry->getFileName());
}
} else {
long offset = pEntry->getFileOffset();
off_t offset = pEntry->getFileOffset();
const int alignTo = getAlignment(pageAlignSharedLibs, alignment, pEntry);
if ((offset % alignTo) != 0) {
if (verbose) {
printf("%8ld %s (BAD - %ld)\n",
(long) offset, pEntry->getFileName(),
printf("%8jd %s (BAD - %ld)\n",
(intmax_t) offset, pEntry->getFileName(),
offset % alignTo);
}
foundBad = true;
} else {
if (verbose) {
printf("%8ld %s (OK)\n",
(long) offset, pEntry->getFileName());
printf("%8jd %s (OK)\n",
(intmax_t) offset, pEntry->getFileName());
}
}
}

View File

@ -41,7 +41,7 @@ using namespace android;
status_t ZipEntry::initFromCDE(FILE* fp)
{
status_t result;
long posn;
long posn; // NOLINT(google-runtime-int), for ftell/fseek
bool hasDD;
//ALOGV("initFromCDE ---\n");
@ -258,8 +258,8 @@ void ZipEntry::copyCDEtoLFH(void)
/*
* Set some information about a file after we add it.
*/
void ZipEntry::setDataInfo(long uncompLen, long compLen, uint32_t crc32,
int compressionMethod)
void ZipEntry::setDataInfo(uint32_t uncompLen, uint32_t compLen, uint32_t crc32,
uint32_t compressionMethod)
{
mCDE.mCompressionMethod = compressionMethod;
mCDE.mCRC32 = crc32;
@ -367,7 +367,7 @@ void ZipEntry::setModWhen(time_t when)
struct tm* ptm;
/* round up to an even number of seconds */
even = (time_t)(((unsigned long)(when) + 1) & (~1));
even = (when & 1) ? (when + 1) : when;
/* expand */
#if !defined(_WIN32)

View File

@ -179,8 +179,8 @@ protected:
/*
* Set information about the data for this entry.
*/
void setDataInfo(long uncompLen, long compLen, uint32_t crc32,
int compressionMethod);
void setDataInfo(uint32_t uncompLen, uint32_t compLen, uint32_t crc32,
uint32_t compressionMethod);
/*
* Set the modification date.

View File

@ -804,7 +804,7 @@ status_t ZipFile::copyDataToFp(FILE* dstFp,
* On exit, "srcFp" will be seeked to the end of the file, and "dstFp"
* will be seeked immediately past the data just written.
*/
status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, long length,
status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, size_t length,
uint32_t* pCRC32)
{
uint8_t tmpBuf[32768];
@ -814,14 +814,14 @@ status_t ZipFile::copyPartialFpToFp(FILE* dstFp, FILE* srcFp, long length,
*pCRC32 = crc32(0L, Z_NULL, 0);
while (length) {
long readSize;
size_t readSize;
readSize = sizeof(tmpBuf);
if (readSize > length)
readSize = length;
count = fread(tmpBuf, 1, readSize, srcFp);
if ((long) count != readSize) { // error or unexpected EOF
if (count != readSize) { // error or unexpected EOF
ALOGD("fread %d bytes failed\n", (int) readSize);
return UNKNOWN_ERROR;
}

View File

@ -224,7 +224,7 @@ private:
status_t copyDataToFp(FILE* dstFp,
const void* data, size_t size, uint32_t* pCRC32);
/* copy some of "srcFp" into "dstFp" */
status_t copyPartialFpToFp(FILE* dstFp, FILE* srcFp, long length,
status_t copyPartialFpToFp(FILE* dstFp, FILE* srcFp, size_t length,
uint32_t* pCRC32);
/* like memmove(), but on parts of a single file */
status_t filemove(FILE* fp, off_t dest, off_t src, size_t n);