diff options
author | Sage Weil <sage@inktank.com> | 2013-06-24 13:47:50 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-06-24 13:47:50 -0700 |
commit | 9a9c941d8d9e311d1642f7a93813a4c43c5707ee (patch) | |
tree | 615164abdf990f2289f7705a5e0517345c806a1d | |
parent | 046e3b71a1753aa1a5d221c075aa2594ba8e49f5 (diff) | |
parent | ab6ccbe2269f64a8b9d6b6f9d072a8496a174eda (diff) | |
download | ceph-9a9c941d8d9e311d1642f7a93813a4c43c5707ee.tar.gz |
Merge pull request #376 from dalgaaf/wip-da-SCA-cppcheck-3
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/common/cmdparse.cc | 13 | ||||
-rw-r--r-- | src/mon/MonCap.cc | 2 | ||||
-rw-r--r-- | src/mon/MonClient.cc | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 2 | ||||
-rw-r--r-- | src/osd/OSD.cc | 2 | ||||
-rw-r--r-- | src/osdc/Objecter.cc | 2 | ||||
-rw-r--r-- | src/test/librados/cmd.cc | 2 |
7 files changed, 12 insertions, 13 deletions
diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc index d4984d1d332..23e67f6de1b 100644 --- a/src/common/cmdparse.cc +++ b/src/common/cmdparse.cc @@ -47,15 +47,14 @@ dump_cmd_to_json(JSONFormatter *f, const string& cmd) // Snarf up all the key=val,key=val pairs, put 'em in a dict. // no '=val' implies '=True'. std::stringstream argdesc(word); - std::string keyval, name; + std::string keyval; std::map<std::string, std::string>desckv; // accumulate descriptor keywords in desckv - size_t pos; while (std::getline(argdesc, keyval, ',')) { // key=value; key by itself implies value is bool true // name="name" means arg dict will be titled 'name' - pos = keyval.find('='); + size_t pos = keyval.find('='); std::string key, val; if (pos != std::string::npos) { key = keyval.substr(0, pos); @@ -70,7 +69,7 @@ dump_cmd_to_json(JSONFormatter *f, const string& cmd) f->open_object_section(desckv["name"].c_str()); // dump all the keys including name into the array for (std::map<std::string, std::string>::iterator it = desckv.begin(); - it != desckv.end(); it++) { + it != desckv.end(); ++it) { f->dump_string(it->first.c_str(), it->second); } f->close_section(); // attribute object for individual desc @@ -106,7 +105,7 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea string fullcmd; // First, join all cmd strings for (vector<string>::iterator it = cmd.begin(); - it != cmd.end(); it++) + it != cmd.end(); ++it) fullcmd += *it; try { @@ -119,7 +118,7 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea // make sure all contents are simple types (not arrays or objects) json_spirit::mObject o = v.get_obj(); for (map<string, json_spirit::mValue>::iterator it = o.begin(); - it != o.end(); it++) { + it != o.end(); ++it) { // ok, marshal it into our string->cmd_vartype map, or throw an // exception if it's not a simple datatype. This is kind of @@ -140,7 +139,7 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea vector<json_spirit::mValue> spvals = it->second.get_array(); vector<string> outv; for (vector<json_spirit::mValue>::iterator sv = spvals.begin(); - sv != spvals.end(); sv++) { + sv != spvals.end(); ++sv) { if (sv->type() != json_spirit::str_type) throw(runtime_error("Can't handle arrays of non-strings")); outv.push_back(sv->get_str()); diff --git a/src/mon/MonCap.cc b/src/mon/MonCap.cc index 6f1055091e0..1114ca3b9da 100644 --- a/src/mon/MonCap.cc +++ b/src/mon/MonCap.cc @@ -75,7 +75,7 @@ ostream& operator<<(ostream& out, const MonCapGrant& m) } if (m.command.length()) { out << " command " << maybe_quote_string(m.command); - if (m.command_args.size()) { + if (!m.command_args.empty()) { out << " with"; for (map<string,StringConstraint>::const_iterator p = m.command_args.begin(); p != m.command_args.end(); diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index ba5f218dc11..f47b5c0ef16 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -206,7 +206,7 @@ bool MonClient::ms_dispatch(Message *m) handle_get_version_reply(static_cast<MMonGetVersionReply*>(m)); break; case MSG_MON_COMMAND_ACK: - handle_mon_command_ack((MMonCommandAck*)m); + handle_mon_command_ack(static_cast<MMonCommandAck*>(m)); break; case MSG_LOGACK: if (log_client) { diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a623afed019..986bf3a821b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2150,7 +2150,7 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) } else if (prefix == "osd blacklist ls") { for (hash_map<entity_addr_t,utime_t>::iterator p = osdmap.blacklist.begin(); p != osdmap.blacklist.end(); - p++) { + ++p) { stringstream ss; string s; ss << p->first << " " << p->second; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 5b499fd6492..e96e05eb7cd 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3877,7 +3877,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist goto out; } string args = argsvec.front(); - for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); a++) + for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a) args += " " + *a; osd_lock.Unlock(); g_conf->injectargs(args, &ss); diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 4d4cdf919ff..f5e997ad67f 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -438,7 +438,7 @@ void Objecter::dispatch(Message *m) break; case MSG_COMMAND_REPLY: - handle_command_reply((MCommandReply*)m); + handle_command_reply(static_cast<MCommandReply*>(m)); break; default: diff --git a/src/test/librados/cmd.cc b/src/test/librados/cmd.cc index 6abcca9772b..bef0ab12dd6 100644 --- a/src/test/librados/cmd.cc +++ b/src/test/librados/cmd.cc @@ -146,7 +146,7 @@ void log_cb(void *arg, const char *who, uint64_t stampsec, uint64_t stamp_nsec, uint64_t seq, const char *level, const char *msg) { - Log *l = (Log *)arg; + Log *l = static_cast<Log *>(arg); Mutex::Locker locker(l->lock); l->log.push_back(line); l->cond.Signal(); |