Frameworks/base: Fix more warnings
Exposed by switching the target to Clang, and GCC 4.9 used by
MIPS.
Change-Id: Icb79285ab2306c39c2d381e53ea2e643ee2d2947
diff --git a/libs/androidfw/BackupData.cpp b/libs/androidfw/BackupData.cpp
index 2b45a70..ba4a4ff 100644
--- a/libs/androidfw/BackupData.cpp
+++ b/libs/androidfw/BackupData.cpp
@@ -45,12 +45,6 @@
const static int ROUND_UP[4] = { 0, 3, 2, 1 };
static inline size_t
-round_up(size_t n)
-{
- return n + ROUND_UP[n % 4];
-}
-
-static inline size_t
padding_extra(size_t n)
{
return ROUND_UP[n % 4];
@@ -343,7 +337,7 @@
}
int remaining = m_dataEndPos - m_pos;
if (kIsDebug) {
- ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n",
+ ALOGD("ReadEntityData size=%zu m_pos=0x%zx m_dataEndPos=0x%zx remaining=%d\n",
size, m_pos, m_dataEndPos, remaining);
}
if (remaining <= 0) {
@@ -353,7 +347,7 @@
size = remaining;
}
if (kIsDebug) {
- ALOGD(" reading %d bytes", size);
+ ALOGD(" reading %zu bytes", size);
}
int amt = read(m_fd, data, size);
if (amt < 0) {
diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp
index 36a4cfe..c78593d 100644
--- a/libs/androidfw/BackupHelpers.cpp
+++ b/libs/androidfw/BackupHelpers.cpp
@@ -555,7 +555,7 @@
snprintf(buf + 124, 12, "%011llo", (isdir) ? 0LL : s.st_size);
// [ 136 : 12 ] last mod time as a UTC time_t
- snprintf(buf + 136, 12, "%0lo", s.st_mtime);
+ snprintf(buf + 136, 12, "%0lo", (unsigned long)s.st_mtime);
// [ 156 : 1 ] link/file type
uint8_t type;
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index e2263d2..679a75f 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -733,8 +733,8 @@
}
#else
// We do not want to be in this case when actually running Android.
- ALOGW("CREATING STRING CACHE OF %d bytes",
- mHeader->stringCount*sizeof(char16_t**));
+ ALOGW("CREATING STRING CACHE OF %zu bytes",
+ static_cast<size_t>(mHeader->stringCount*sizeof(char16_t**)));
#endif
mCache = (char16_t**)calloc(mHeader->stringCount, sizeof(char16_t**));
if (mCache == NULL) {