Fix a couple of issues pointed out by https://scan.coverity.com/

This commit is contained in:
Alexey Sokolov
2016-12-26 17:22:09 +00:00
parent b666931883
commit 2fcde9f2e1
6 changed files with 23 additions and 42 deletions
+7 -15
View File
@@ -549,28 +549,20 @@ class CAdminMod : public CModule {
const CString sNetwork = sLine.Token(3);
const CString sValue = sLine.Token(4, true);
CUser* pUser = nullptr;
CIRCNetwork* pNetwork = nullptr;
if (sValue.empty()) {
PutModule(
"Usage: SetNetwork <variable> <username> <network> <value>");
return;
}
if (sUsername.empty()) {
pUser = GetUser();
pNetwork = CModule::GetNetwork();
} else {
pUser = FindUser(sUsername);
if (!pUser) {
return;
}
CUser* pUser = FindUser(sUsername);
if (!pUser) {
return;
}
pNetwork = FindNetwork(pUser, sNetwork);
if (!pNetwork && !sNetwork.empty()) {
return;
}
CIRCNetwork* pNetwork = FindNetwork(pUser, sNetwork);
if (!pNetwork) {
return;
}
if (sVar.Equals("nick")) {
+1 -1
View File
@@ -225,8 +225,8 @@ class ZNC_EXPORT_LIB_EXPORT CPyTimer : public CTimer {
: CTimer(pModule, uInterval, uCycles, sLabel, sDescription),
m_pyObj(pyObj) {
Py_INCREF(pyObj);
pModule->AddTimer(this);
m_pModPython = pModule->GetModPython();
pModule->AddTimer(this);
}
void RunJob() override;
PyObject* GetPyObj() { return m_pyObj; }
+6 -7
View File
@@ -136,7 +136,7 @@ class CModTcl : public CModule {
Tcl_CreateCommand(interp, "exit", tcl_exit, this, nullptr);
if (!sMyArgs.empty()) {
i = Tcl_EvalFile(interp, sMyArgs.c_str());
int i = Tcl_EvalFile(interp, sMyArgs.c_str());
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -171,7 +171,7 @@ class CModTcl : public CModule {
void TclUpdate() {
while (Tcl_DoOneEvent(TCL_DONT_WAIT)) {
}
i = Tcl_Eval(interp, "Binds::ProcessTime");
int i = Tcl_Eval(interp, "Binds::ProcessTime");
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -212,7 +212,7 @@ class CModTcl : public CModule {
CString sCommand = "Binds::ProcessPubm {" + sNick + "} {" + sHost +
"} - {" + sChannel + "} {" + sMes + "}";
i = Tcl_Eval(interp, sCommand.c_str());
int i = Tcl_Eval(interp, sCommand.c_str());
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -227,7 +227,7 @@ class CModTcl : public CModule {
CString sCommand = "Binds::ProcessMsgm {" + sNick + "} {" + sHost +
"} - {" + sMes + "}";
i = Tcl_Eval(interp, sCommand.c_str());
int i = Tcl_Eval(interp, sCommand.c_str());
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -249,7 +249,7 @@ class CModTcl : public CModule {
sCommand = "Binds::ProcessNick {" + sOldNick + "} {" + sHost +
"} - {" + vChans[n]->GetName() + "} {" + sNewNickTmp +
"}";
i = Tcl_Eval(interp, sCommand.c_str());
int i = Tcl_Eval(interp, sCommand.c_str());
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -266,7 +266,7 @@ class CModTcl : public CModule {
CString sCommand = "Binds::ProcessKick {" + sOpNick + "} {" + sOpHost +
"} - {" + Channel.GetName() + "} {" + sNick + "} {" +
sMessage + "}";
i = Tcl_Eval(interp, sCommand.c_str());
int i = Tcl_Eval(interp, sCommand.c_str());
if (i != TCL_OK) {
PutModule(Tcl_GetStringResult(interp));
}
@@ -274,7 +274,6 @@ class CModTcl : public CModule {
private:
Tcl_Interp* interp;
int i;
static CString argvit(const char* argv[], unsigned int end,
unsigned int begin, CString delim) {