[App] remove unnecessary Boolean comparisons

This commit is contained in:
Uwe
2022-06-15 03:58:59 +02:00
parent 6b09da9ab6
commit 063fd56f5f
3 changed files with 7 additions and 7 deletions

View File

@@ -317,7 +317,7 @@ PyObject* Application::sCloseDocument(PyObject * /*self*/, PyObject *args)
return nullptr;
}
if (GetApplication().closeDocument(pstr) == false) {
if (!GetApplication().closeDocument(pstr)) {
PyErr_Format(PyExc_RuntimeError, "Closing the document '%s' failed", pstr);
return nullptr;
}
@@ -333,7 +333,7 @@ PyObject* Application::sSaveDocument(PyObject * /*self*/, PyObject *args)
Document* doc = GetApplication().getDocument(pDoc);
if ( doc ) {
if ( doc->save() == false ) {
if (!doc->save()) {
PyErr_Format(Base::PyExc_FC_GeneralError, "Cannot save document '%s'", pDoc);
return nullptr;
}

View File

@@ -2402,7 +2402,7 @@ private:
fn = str.str();
}
if (fi.renameFile(fn.c_str()) == false)
if (!fi.renameFile(fn.c_str()))
Base::Console().Warning("Cannot rename project file to backup file\n");
}
else {
@@ -2411,7 +2411,7 @@ private:
}
Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
if (!tmp.renameFile(targetname.c_str())) {
throw Base::FileException(
"Cannot rename tmp save file to project file", targetname);
}
@@ -2511,7 +2511,7 @@ private:
}
}
else {
if (renameFileNoErase(fi, fn+".FCBak") == false) {
if (!renameFileNoErase(fi, fn+".FCBak")) {
fn = fn + "-";
}
else {
@@ -2555,7 +2555,7 @@ private:
}
Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
if (!tmp.renameFile(targetname.c_str())) {
throw Base::FileException(
"Save interrupted: Cannot rename temporary file to project file", tmp);
}

View File

@@ -458,7 +458,7 @@ bool Metadata::satisfies(const Meta::Dependency& dep)
}
auto parsedExpression = App::Expression::parse(nullptr, dep.condition);
auto result = parsedExpression->eval();
if (boost::any_cast<bool> (result->getValueAsAny()) == false)
if (!boost::any_cast<bool> (result->getValueAsAny()))
return false;
}