]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: optimize the usage of string.find and some indents
authorYan Jun <yan.jun8@zte.com.cn>
Tue, 5 Jul 2016 03:11:20 +0000 (11:11 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Tue, 5 Jul 2016 03:11:20 +0000 (11:11 +0800)
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
src/rgw/rgw_rados.cc

index 9e072479cd6bdad51881ce2fbeab8a51b7e0dbf8..77d3863d1de5467b469a19bd3d0be953ffd3454d 100644 (file)
@@ -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<string, bufferlist> *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;