Fix -Wformat warning
frameworks/base/core/jni/com_android_internal_content_FileSystemUtils.cpp:92:38: error: format specifies type 'int' but the argument has type 'long' [-Werror,-Wformat]
91 | ", st_blksize: %d, st_size: %" PRIu64 "",
| ~~
| %ld
92 | beforePunch.st_blocks, beforePunch.st_blksize,
| ^~~~~~~~~~~~~~~~~~~~~~
Test: presubmit
Bug: 315250603
Change-Id: I87b2f17928f8e7029e4a6de3df231a41d6807aaf
diff --git a/core/jni/com_android_internal_content_FileSystemUtils.cpp b/core/jni/com_android_internal_content_FileSystemUtils.cpp
index d426f12..6c72544 100644
--- a/core/jni/com_android_internal_content_FileSystemUtils.cpp
+++ b/core/jni/com_android_internal_content_FileSystemUtils.cpp
@@ -87,9 +87,10 @@
IF_ALOGD() {
ALOGD("Total number of LOAD segments %zu", programHeaders.size());
- ALOGD("Size before punching holes st_blocks: %" PRIu64
- ", st_blksize: %d, st_size: %" PRIu64 "",
- beforePunch.st_blocks, beforePunch.st_blksize,
+ ALOGD("Size before punching holes st_blocks: %" PRIu64 ", st_blksize: %" PRIu64
+ ", st_size: %" PRIu64 "",
+ static_cast<uint64_t>(beforePunch.st_blocks),
+ static_cast<uint64_t>(beforePunch.st_blksize),
static_cast<uint64_t>(beforePunch.st_size));
}
@@ -193,9 +194,10 @@
ALOGD("lstat64 failed for filePath %s, error:%d", filePath, errno);
return false;
}
- ALOGD("Size after punching holes st_blocks: %" PRIu64 ", st_blksize: %d, st_size: %" PRIu64
- "",
- afterPunch.st_blocks, afterPunch.st_blksize,
+ ALOGD("Size after punching holes st_blocks: %" PRIu64 ", st_blksize: %" PRIu64
+ ", st_size: %" PRIu64 "",
+ static_cast<uint64_t>(afterPunch.st_blocks),
+ static_cast<uint64_t>(afterPunch.st_blksize),
static_cast<uint64_t>(afterPunch.st_size));
}
@@ -271,8 +273,9 @@
uint64_t blockSize = beforePunch.st_blksize;
IF_ALOGD() {
ALOGD("Extra field length: %hu, Size before punching holes st_blocks: %" PRIu64
- ", st_blksize: %d, st_size: %" PRIu64 "",
- extraFieldLen, beforePunch.st_blocks, beforePunch.st_blksize,
+ ", st_blksize: %" PRIu64 ", st_size: %" PRIu64 "",
+ extraFieldLen, static_cast<uint64_t>(beforePunch.st_blocks),
+ static_cast<uint64_t>(beforePunch.st_blksize),
static_cast<uint64_t>(beforePunch.st_size));
}
@@ -346,8 +349,9 @@
return false;
}
ALOGD("punchHolesInApk:: Size after punching holes st_blocks: %" PRIu64
- ", st_blksize: %d, st_size: %" PRIu64 "",
- afterPunch.st_blocks, afterPunch.st_blksize,
+ ", st_blksize: %" PRIu64 ", st_size: %" PRIu64 "",
+ static_cast<uint64_t>(afterPunch.st_blocks),
+ static_cast<uint64_t>(afterPunch.st_blksize),
static_cast<uint64_t>(afterPunch.st_size));
}
return true;