From 0d80c3400cac8c13f183b2449e64133ac76c1f80 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Wed, 21 Dec 2022 09:07:56 +0000 Subject: [PATCH] rgw: fix signed to unsigned comparisson warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit warning: rgw_rest_user_policy.cc:159:25: warning: comparison of integer expressions of different signedness: ‘std::map, std::__cxx11::basic_string >::size_type’ {aka ‘long unsigned int’} and ‘int’ Signed-off-by: Yuval Lifshitz --- src/rgw/rgw_rest_user_policy.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc index e22b1a81cc0de..25b1f708d97ac 100644 --- a/src/rgw/rgw_rest_user_policy.cc +++ b/src/rgw/rgw_rest_user_policy.cc @@ -151,11 +151,9 @@ void RGWPutUserPolicy::execute(optional_yield y) } bufferlist in_bl; policies[policy_name] = policy; -#define USER_POLICIES_MAX_NUM 100 - int max_num = s->cct->_conf->rgw_user_policies_max_num; - if (max_num < 0) { - max_num = USER_POLICIES_MAX_NUM; - } + constexpr unsigned int USER_POLICIES_MAX_NUM = 100; + const unsigned int max_num = s->cct->_conf->rgw_user_policies_max_num < 0 ? + USER_POLICIES_MAX_NUM : s->cct->_conf->rgw_user_policies_max_num; if (policies.size() > max_num) { ldpp_dout(this, 4) << "IAM user policies has reached the num config: " << max_num << ", cant add another" << dendl; -- 2.39.5