From 0f23574234d28a79cd13fef97b439ae0d62e4abf Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 27 Jul 2017 11:07:53 +0800 Subject: [PATCH] crush: avoid implicitly cast pool-id may overflow(though actually can not happen...) Signed-off-by: xie xingguo --- src/crush/CrushWrapper.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 94153723082..0b58dacb3fe 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -1294,12 +1294,12 @@ public: return result; } - bool have_choose_args(uint64_t choose_args_index) const { + bool have_choose_args(int64_t choose_args_index) const { return choose_args.count(choose_args_index); } crush_choose_arg_map choose_args_get_with_fallback( - uint64_t choose_args_index) const { + int64_t choose_args_index) const { auto i = choose_args.find(choose_args_index); if (i == choose_args.end()) { i = choose_args.find(DEFAULT_CHOOSE_ARGS); @@ -1313,7 +1313,7 @@ public: return i->second; } } - crush_choose_arg_map choose_args_get(uint64_t choose_args_index) const { + crush_choose_arg_map choose_args_get(int64_t choose_args_index) const { auto i = choose_args.find(choose_args_index); if (i == choose_args.end()) { crush_choose_arg_map arg_map; @@ -1340,7 +1340,7 @@ public: free(arg_map.args); } - void create_choose_args(int id, int positions) { + void create_choose_args(int64_t id, int positions) { if (choose_args.count(id)) return; assert(positions); @@ -1373,7 +1373,7 @@ public: } } - void rm_choose_args(int id) { + void rm_choose_args(int64_t id) { auto p = choose_args.find(id); if (p != choose_args.end()) { destroy_choose_args(p->second); -- 2.39.5