From: Yuval Lifshitz Date: Wed, 21 Dec 2022 09:07:56 +0000 (+0000) Subject: rgw: fix signed to unsigned comparisson warning X-Git-Tag: v18.1.0~481^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F49530%2Fhead;p=ceph.git rgw: fix signed to unsigned comparisson warning 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 --- diff --git a/src/rgw/rgw_rest_user_policy.cc b/src/rgw/rgw_rest_user_policy.cc index e22b1a81cc0d..25b1f708d97a 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;