From: Yan Jun Date: Tue, 5 Jul 2016 03:11:20 +0000 (+0800) Subject: rgw: optimize the usage of string.find and some indents X-Git-Tag: ses5-milestone5~121^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8cb5b88cfa29aa4b21eaba34959fefdd04d69339;p=ceph.git rgw: optimize the usage of string.find and some indents Signed-off-by: Yan Jun --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 9e072479cd6..77d3863d1de 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1962,7 +1962,7 @@ int RGWObjManifest::generator::create_next(uint64_t ofs) if (ofs >= max_head_size) { manifest->set_head_size(max_head_size); cur_stripe = (ofs - max_head_size) / rule.stripe_max_size; - cur_stripe_size = rule.stripe_max_size; + cur_stripe_size = rule.stripe_max_size; if (cur_part_id == 0 && max_head_size > 0) { cur_stripe++; @@ -10491,8 +10491,8 @@ void RGWRados::get_bucket_instance_obj(rgw_bucket& bucket, rgw_obj& obj) int RGWRados::get_bucket_instance_info(RGWObjectCtx& obj_ctx, const string& meta_key, RGWBucketInfo& info, real_time *pmtime, map *pattrs) { - int pos = meta_key.find(':'); - if (pos < 0) { + size_t pos = meta_key.find(':'); + if (pos == string::npos) { return -EINVAL; } string oid = RGW_BUCKET_INSTANCE_MD_PREFIX + meta_key;