]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix signed to unsigned comparisson warning 49530/head
authorYuval Lifshitz <ylifshit@redhat.com>
Wed, 21 Dec 2022 09:07:56 +0000 (09:07 +0000)
committerYuval Lifshitz <ylifshit@redhat.com>
Wed, 21 Dec 2022 09:27:38 +0000 (09:27 +0000)
warning:
rgw_rest_user_policy.cc:159:25: warning: comparison of integer expressions of different signedness:
‘std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::size_type’ {aka ‘long unsigned int’} and ‘int’

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_rest_user_policy.cc

index e22b1a81cc0de38c07199b8c78f994afbe7bdaa8..25b1f708d97ac03980e126e46e82a58d8baf7565 100644 (file)
@@ -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;