diff options
author | 2018-08-10 15:14:26 -0700 | |
---|---|---|
committer | 2018-08-10 15:14:26 -0700 | |
commit | 0c0d92887c8ee1721fdead2fd4a75bf00b2336c5 (patch) | |
tree | 8775dd4d79141f6ca2af0f03836e488bbdab8bda | |
parent | edeab211d2cbdc3cde1e9b95ea540da237b03cf7 (diff) |
Fix or suppress some google-runtime-int warnings.
Bug: 112478838
Test: build with WITH_TIDY=1
Change-Id: Ie3b15a85770b5806cddfd49a475aaf0553f9ec78
-rw-r--r-- | tools/zipalign/ZipAlign.cpp | 16 | ||||
-rw-r--r-- | tools/zipalign/ZipEntry.cpp | 8 | ||||
-rw-r--r-- | tools/zipalign/ZipEntry.h | 4 | ||||
-rw-r--r-- | tools/zipalign/ZipFile.cpp | 6 | ||||
-rw-r--r-- | tools/zipalign/ZipFile.h | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp index d56ac291ac..c4d6fc49a7 100644 --- a/tools/zipalign/ZipAlign.cpp +++ b/tools/zipalign/ZipAlign.cpp @@ -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()); } } } diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp index 63d75d1057..c3c833efe9 100644 --- a/tools/zipalign/ZipEntry.cpp +++ b/tools/zipalign/ZipEntry.cpp @@ -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) diff --git a/tools/zipalign/ZipEntry.h b/tools/zipalign/ZipEntry.h index 247cf69f29..4c7e18c2c7 100644 --- a/tools/zipalign/ZipEntry.h +++ b/tools/zipalign/ZipEntry.h @@ -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. diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp index 43bc9bfb59..9e44956e6e 100644 --- a/tools/zipalign/ZipFile.cpp +++ b/tools/zipalign/ZipFile.cpp @@ -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; } diff --git a/tools/zipalign/ZipFile.h b/tools/zipalign/ZipFile.h index d5ace7c492..11d20c5a2a 100644 --- a/tools/zipalign/ZipFile.h +++ b/tools/zipalign/ZipFile.h @@ -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); |