From e93040c618090700386eb69a01db2d98a9a36385 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Fri, 14 Dec 2018 15:40:08 -0800 Subject: [PATCH] Fix sign-compare warnings system/core/fs_mgr/fs_mgr_fstab.cpp:161:18: error: comparison of integers of different signs: 'int' and 'const uint64_t' (aka 'const unsigned long') [-Werror,-Wsign-compare] if (flag == j->flag) { ~~~~ ^ ~~~~~~~ system/core/fs_mgr/fs_mgr.cpp:674:11: error: comparison of integers of different signs: 'int' and 'std::__1::vector >::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare] if (i < fstab.size()) --i; ~ ^ ~~~~~~~~~~~~ Test: m checkbuild Change-Id: I056add222a92f99134a49ac141bd143ddd54179b --- fs_mgr/fs_mgr.cpp | 2 +- fs_mgr/fs_mgr_fstab.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 8757689d5..88f7a2ce6 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -615,7 +615,7 @@ static bool fs_match(const std::string& in1, const std::string& in2) { // Sets errno to match the 1st mount failure on failure. static bool mount_with_alternatives(const Fstab& fstab, int start_idx, int* end_idx, int* attempted_idx) { - int i; + unsigned long i; int mount_errno = 0; bool mounted = false; diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index bd9d67515..e0891eb67 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -154,7 +154,7 @@ static int encryption_mode_to_flag(const struct flag_list* list, const char* mod return 0; } -static const char* flag_to_encryption_mode(const struct flag_list* list, int flag) { +static const char* flag_to_encryption_mode(const struct flag_list* list, uint64_t flag) { const struct flag_list *j; for (j = list; j->name; ++j) {