summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-07-12 08:52:56 -0700
committerSage Weil <sage@inktank.com>2013-07-12 08:52:56 -0700
commitf28aa7e12bd105f65167454244e66de168a3f399 (patch)
tree8cf6f7b3df50ac500190d4030e86fb3116f796dc
parent1f8fe709b6aae60a39f629ed328586b16a4d9a53 (diff)
parent6379f37d48c0dbc442ecb52cbb2de389c5ffac4b (diff)
downloadceph-f28aa7e12bd105f65167454244e66de168a3f399.tar.gz
Merge pull request #426 from dalgaaf/wip-da-SCA-cppcheck-5
Fix some typical SCA issues from cppcheck Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/cls/rgw/cls_rgw.cc2
-rw-r--r--src/common/cmdparse.cc2
-rw-r--r--src/rgw/rgw_rados.cc3
-rw-r--r--src/rgw/rgw_rest_opstate.cc2
-rw-r--r--src/test/test_rgw_admin_log.cc12
-rw-r--r--src/test/test_rgw_admin_meta.cc12
-rw-r--r--src/test/test_rgw_admin_opstate.cc8
7 files changed, 20 insertions, 21 deletions
diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc
index d3f9d756fbf..4361608e271 100644
--- a/src/cls/rgw/cls_rgw.cc
+++ b/src/cls/rgw/cls_rgw.cc
@@ -985,7 +985,7 @@ static int rgw_bi_log_trim(cls_method_context_t hctx, bufferlist *in, bufferlist
if (ret < 0)
return ret;
- if (entries.size() == 0)
+ if (entries.empty())
return -ENODATA;
list<rgw_bi_log_entry>::iterator iter;
diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc
index 26bcde3fdac..370591cb3bb 100644
--- a/src/common/cmdparse.cc
+++ b/src/common/cmdparse.cc
@@ -185,7 +185,7 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea
}
}
return true;
- } catch (runtime_error e) {
+ } catch (runtime_error &e) {
ss << e.what();
return false;
}
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc
index 3459683a8d7..b3e297effa4 100644
--- a/src/rgw/rgw_rados.cc
+++ b/src/rgw/rgw_rados.cc
@@ -3884,8 +3884,7 @@ int RGWRados::get_obj(void *ctx, RGWObjVersionTracker *objv_tracker, void **hand
else
len = end - ofs + 1;
- if (astate->has_manifest &&
- astate->manifest.objs.size() > 0) {
+ if (astate->has_manifest && !astate->manifest.objs.empty()) {
/* now get the relevant object part */
map<uint64_t, RGWObjManifestPart>::iterator iter = astate->manifest.objs.upper_bound(ofs);
/* we're now pointing at the next part (unless the first part starts at a higher ofs),
diff --git a/src/rgw/rgw_rest_opstate.cc b/src/rgw/rgw_rest_opstate.cc
index 434b0db5989..2b215a7117d 100644
--- a/src/rgw/rgw_rest_opstate.cc
+++ b/src/rgw/rgw_rest_opstate.cc
@@ -88,7 +88,7 @@ void RGWOp_Opstate_List::send_response() {
void RGWOp_Opstate_List::send_response(list<cls_statelog_entry> entries) {
RGWOpState oc(store);
for (list<cls_statelog_entry>::iterator it = entries.begin();
- it != entries.end(); it++) {
+ it != entries.end(); ++it) {
oc.dump_entry(*it, s->formatter);
flusher.flush();
}
diff --git a/src/test/test_rgw_admin_log.cc b/src/test/test_rgw_admin_log.cc
index fe281025553..876c76973e0 100644
--- a/src/test/test_rgw_admin_log.cc
+++ b/src/test/test_rgw_admin_log.cc
@@ -286,7 +286,7 @@ int test_helper::send_request(string method, string res,
slist = curl_slist_append(slist, auth.c_str());
slist = curl_slist_append(slist, http_date.c_str());
for(list<string>::iterator it = extra_hdrs.begin();
- it != extra_hdrs.end(); it++){
+ it != extra_hdrs.end(); ++it){
slist = curl_slist_append(slist, (*it).c_str());
}
if(read_function)
@@ -323,7 +323,7 @@ int run_rgw_admin(string& cmd, string& resp) {
argv[0] = (char *)"radosgw-admin";
for (list<string>::iterator it = l.begin();
- it != l.end(); it++) {
+ it != l.end(); ++it) {
argv[loop++] = (char *)(*it).c_str();
}
argv[loop] = NULL;
@@ -375,7 +375,7 @@ int get_creds(string& json, string& creds) {
decode_json_obj(info, &parser);
creds = "";
for(map<string, RGWAccessKey>::iterator it = info.access_keys.begin();
- it != info.access_keys.end(); it++) {
+ it != info.access_keys.end(); ++it) {
RGWAccessKey _k = it->second;
/*cout << "accesskeys [ " << it->first << " ] = " <<
"{ " << _k.id << ", " << _k.key << ", " << _k.subuser << "}" << std::endl;*/
@@ -611,7 +611,7 @@ static int get_log_list(list<cls_log_entry_json> &entries) {
l = parser.get_array_elements();
int loop = 0;
for(vector<string>::iterator it = l.begin();
- it != l.end(); it++, loop++) {
+ it != l.end(); ++it, loop++) {
JSONParser jp;
cls_log_entry_json entry;
@@ -655,7 +655,7 @@ static int get_bilog_list(list<cls_bilog_entry> &entries) {
l = parser.get_array_elements();
int loop = 0;
for(vector<string>::iterator it = l.begin();
- it != l.end(); it++, loop++) {
+ it != l.end(); ++it, loop++) {
JSONParser jp;
cls_bilog_entry entry;
@@ -691,7 +691,7 @@ static int get_datalog_list(list<rgw_data_change> &entries) {
l = parser.get_array_elements();
int loop = 0;
for(vector<string>::iterator it = l.begin();
- it != l.end(); it++, loop++) {
+ it != l.end(); ++it, loop++) {
JSONParser jp;
rgw_data_change entry;
diff --git a/src/test/test_rgw_admin_meta.cc b/src/test/test_rgw_admin_meta.cc
index 3c9529ba72c..f366c83c782 100644
--- a/src/test/test_rgw_admin_meta.cc
+++ b/src/test/test_rgw_admin_meta.cc
@@ -280,7 +280,7 @@ int test_helper::send_request(string method, string res,
slist = curl_slist_append(slist, auth.c_str());
slist = curl_slist_append(slist, http_date.c_str());
for(list<string>::iterator it = extra_hdrs.begin();
- it != extra_hdrs.end(); it++){
+ it != extra_hdrs.end(); ++it){
slist = curl_slist_append(slist, (*it).c_str());
}
if(read_function)
@@ -317,7 +317,7 @@ int run_rgw_admin(string& cmd, string& resp) {
argv[0] = (char *)"radosgw-admin";
for (list<string>::iterator it = l.begin();
- it != l.end(); it++) {
+ it != l.end(); ++it) {
argv[loop++] = (char *)(*it).c_str();
}
argv[loop] = NULL;
@@ -369,7 +369,7 @@ int get_creds(string& json, string& creds) {
decode_json_obj(info, &parser);
creds = "";
for(map<string, RGWAccessKey>::iterator it = info.access_keys.begin();
- it != info.access_keys.end(); it++) {
+ it != info.access_keys.end(); ++it) {
RGWAccessKey _k = it->second;
/*cout << "accesskeys [ " << it->first << " ] = " <<
"{ " << _k.id << ", " << _k.key << ", " << _k.subuser << "}" << std::endl;*/
@@ -484,7 +484,7 @@ int compare_user_info(RGWUserInfo& i1, RGWUserInfo& i2) {
if (i1.access_keys.size() != i2.access_keys.size())
return -1;
for (map<string, RGWAccessKey>::iterator it = i1.access_keys.begin();
- it != i1.access_keys.end(); it++) {
+ it != i1.access_keys.end(); ++it) {
RGWAccessKey k1, k2;
k1 = it->second;
if (i2.access_keys.count(it->first) == 0)
@@ -496,7 +496,7 @@ int compare_user_info(RGWUserInfo& i1, RGWUserInfo& i2) {
if (i1.swift_keys.size() != i2.swift_keys.size())
return -1;
for (map<string, RGWAccessKey>::iterator it = i1.swift_keys.begin();
- it != i1.swift_keys.end(); it++) {
+ it != i1.swift_keys.end(); ++it) {
RGWAccessKey k1, k2;
k1 = it->second;
if (i2.swift_keys.count(it->first) == 0)
@@ -508,7 +508,7 @@ int compare_user_info(RGWUserInfo& i1, RGWUserInfo& i2) {
if (i1.subusers.size() != i2.subusers.size())
return -1;
for (map<string, RGWSubUser>::iterator it = i1.subusers.begin();
- it != i1.subusers.end(); it++) {
+ it != i1.subusers.end(); ++it) {
RGWSubUser k1, k2;
k1 = it->second;
if (!i2.subusers.count(it->first))
diff --git a/src/test/test_rgw_admin_opstate.cc b/src/test/test_rgw_admin_opstate.cc
index 0ab5780a417..cfd709043dd 100644
--- a/src/test/test_rgw_admin_opstate.cc
+++ b/src/test/test_rgw_admin_opstate.cc
@@ -283,7 +283,7 @@ int test_helper::send_request(string method, string res,
slist = curl_slist_append(slist, auth.c_str());
slist = curl_slist_append(slist, http_date.c_str());
for(list<string>::iterator it = extra_hdrs.begin();
- it != extra_hdrs.end(); it++){
+ it != extra_hdrs.end(); ++it){
slist = curl_slist_append(slist, (*it).c_str());
}
if(read_function)
@@ -321,7 +321,7 @@ int run_rgw_admin(string& cmd, string& resp) {
argv[0] = (char *)"radosgw-admin";
for (list<string>::iterator it = l.begin();
- it != l.end(); it++) {
+ it != l.end(); ++it) {
argv[loop++] = (char *)(*it).c_str();
}
argv[loop] = NULL;
@@ -373,7 +373,7 @@ int get_creds(string& json, string& creds) {
decode_json_obj(info, &parser);
creds = "";
for(map<string, RGWAccessKey>::iterator it = info.access_keys.begin();
- it != info.access_keys.end(); it++) {
+ it != info.access_keys.end(); ++it) {
RGWAccessKey _k = it->second;
/*cout << "accesskeys [ " << it->first << " ] = " <<
"{ " << _k.id << ", " << _k.key << ", " << _k.subuser << "}" << std::endl;*/
@@ -504,7 +504,7 @@ static int get_opstate_list(list<cls_statelog_entry> &entries) {
l = parser.get_array_elements();
int loop = 0;
for(vector<string>::iterator it = l.begin();
- it != l.end(); it++, loop++) {
+ it != l.end(); ++it, loop++) {
JSONParser jp;
cls_statelog_entry entry;