mirror of
https://github.com/ceph/ceph
synced 2025-02-24 19:47:44 +00:00
Merge pull request #376 from dalgaaf/wip-da-SCA-cppcheck-3
Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
commit
9a9c941d8d
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user