diff --git a/src/CLI2.cpp b/src/CLI2.cpp index fddc40585..263cd3c64 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -1492,9 +1492,11 @@ void CLI2::findIDs () } std::string raw = a.attribute ("raw"); - previousFilterArgWasAnOperator = a._lextype == Lexer::Type::op && + previousFilterArgWasAnOperator = (a._lextype == Lexer::Type::op && raw != "(" && - raw != ")"; + raw != ")") + ? true + : false; } } @@ -1720,7 +1722,10 @@ void CLI2::insertIDExpr () bool ascending = true; int low = strtol (r->first.c_str (), nullptr, 10); int high = strtol (r->second.c_str (), nullptr, 10); - ascending = low <= high; + if (low <= high) + ascending = true; + else + ascending = false; reconstructed.push_back (openParen); reconstructed.push_back (argID); diff --git a/src/Filter.cpp b/src/Filter.cpp index 15403c01c..7a890d037 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -73,7 +73,7 @@ void Filter::subset (const std::vector & input, std::vector & output // Debug output from Eval during compilation is useful. During evaluation // it is mostly noise. - eval.debug (Context::getContext ().config.getInteger ("debug.parser") >= 3); + eval.debug (Context::getContext ().config.getInteger ("debug.parser") >= 3 ? true : false); eval.compileExpression (precompiled); for (auto& task : input) @@ -124,7 +124,7 @@ void Filter::subset (std::vector & output) // Debug output from Eval during compilation is useful. During evaluation // it is mostly noise. - eval.debug (Context::getContext ().config.getInteger ("debug.parser") >= 3); + eval.debug (Context::getContext ().config.getInteger ("debug.parser") >= 3 ? true : false); eval.compileExpression (precompiled); output.clear (); @@ -240,10 +240,16 @@ bool Filter::pendingOnly () const if (countStatus) { - return !(!countPending && !countWaiting && !countRecurring); + if (!countPending && !countWaiting && !countRecurring) + return false; + + return true; } - return countId != 0; + if (countId) + return true; + + return false; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Lexer.cpp b/src/Lexer.cpp index a47794477..c9d70476a 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -75,7 +75,7 @@ bool Lexer::token (std::string& token, Lexer::Type& type) // - path < substitution < pattern // - set < number // - word last - return isString (token, type, "'\"") || + if (isString (token, type, "'\"") || isDate (token, type) || isDuration (token, type) || isURL (token, type) || @@ -92,7 +92,10 @@ bool Lexer::token (std::string& token, Lexer::Type& type) isPattern (token, type) || isOperator (token, type) || isIdentifier (token, type) || - isWord (token, type); + isWord (token, type)) + return true; + + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -263,7 +266,10 @@ void Lexer::dequote (std::string& input, const std::string& quotes) // escapes, to get them past the shell. bool Lexer::wasQuoted (const std::string& input) { - return input.find_first_of (" \t()<>&~") != std::string::npos; + if (input.find_first_of (" \t()<>&~") != std::string::npos) + return true; + + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -1565,7 +1571,7 @@ bool Lexer::readWord ( prev = c; } - return word.length () > 0; + return word.length () > 0 ? true : false; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 847681652..772e3db4a 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -1438,7 +1438,7 @@ int TDB2::id (const std::string& uuid) bool TDB2::verifyUniqueUUID (const std::string& uuid) { pending.get_tasks (); - return pending.id (uuid) == 0; + return pending.id (uuid) != 0 ? false : true; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Task.cpp b/src/Task.cpp index eb8a66260..e60e1ee2d 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -190,7 +190,10 @@ void Task::setAsNow (const std::string& att) //////////////////////////////////////////////////////////////////////////////// bool Task::has (const std::string& name) const { - return data.find (name) != data.end (); + if (data.find (name) != data.end ()) + return true; + + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -1046,7 +1049,7 @@ int Task::getAnnotationCount () const //////////////////////////////////////////////////////////////////////////////// bool Task::hasAnnotations () const { - return annotation_count != 0; + return annotation_count ? true : false; } //////////////////////////////////////////////////////////////////////////////// @@ -1293,7 +1296,10 @@ bool Task::hasTag (const std::string& tag) const // Concrete tags. auto tags = split (get ("tags"), ','); - return std::find (tags.begin (), tags.end (), tag) != tags.end (); + if (std::find (tags.begin (), tags.end (), tag) != tags.end ()) + return true; + + return false; } //////////////////////////////////////////////////////////////////////////////// @@ -1362,7 +1368,7 @@ void Task::substitute ( const std::string& to, const std::string& flags) { - bool global = (flags.find ('g') != std::string::npos); + bool global = (flags.find ('g') != std::string::npos ? true : false); // Get the data to modify. std::string description = get ("description"); diff --git a/src/Variant.cpp b/src/Variant.cpp index 96c818142..abbdb81c0 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -1820,7 +1820,7 @@ void Variant::cast (const enum type new_type) case type_integer: switch (new_type) { - case type_boolean: _bool = _integer != 0; break; + case type_boolean: _bool = _integer == 0 ? false : true; break; case type_integer: break; case type_real: _real = static_cast(_integer); break; case type_string: @@ -1838,7 +1838,7 @@ void Variant::cast (const enum type new_type) case type_real: switch (new_type) { - case type_boolean: _bool = _real != 0.0; break; + case type_boolean: _bool = _real == 0.0 ? false : true; break; case type_integer: _integer = static_cast(_real); break; case type_real: break; case type_string: @@ -1858,9 +1858,9 @@ void Variant::cast (const enum type new_type) switch (new_type) { case type_boolean: - _bool = !(_string.length () == 0 || + _bool = (_string.length () == 0 || _string == "0" || - _string == "0.0"); + _string == "0.0") ? false : true; break; case type_integer: _integer = static_cast(strtol (_string.c_str (), nullptr, (_string.substr (0, 2) == "0x" ? 16 : 10))); @@ -1913,7 +1913,7 @@ void Variant::cast (const enum type new_type) case type_date: switch (new_type) { - case type_boolean: _bool = _date != 0; break; + case type_boolean: _bool = _date != 0 ? true : false; break; case type_integer: _integer = static_cast(_date); break; case type_real: _real = static_cast(_date); break; case type_string: _string = std::string(*this); break; @@ -1925,7 +1925,7 @@ void Variant::cast (const enum type new_type) case type_duration: switch (new_type) { - case type_boolean: _bool = _duration != 0; break; + case type_boolean: _bool = _duration != 0 ? true : false; break; case type_integer: _integer = static_cast(_duration); break; case type_real: _real = static_cast(_duration); break; case type_string: _string = std::string(*this); break; diff --git a/src/ViewTask.cpp b/src/ViewTask.cpp index ccfe7eaed..28244d7c9 100644 --- a/src/ViewTask.cpp +++ b/src/ViewTask.cpp @@ -302,7 +302,7 @@ std::string ViewTask::render (std::vector & data, std::vector & seque autoColorize (data[sequence[s]], rule_color); // Alternate rows based on |s % 2| - bool odd = (s % 2) != 0; + bool odd = (s % 2) ? true : false; Color row_color; if (Context::getContext ().color ()) { diff --git a/src/recur.cpp b/src/recur.cpp index 6c32d946f..70703e4dc 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -174,8 +174,11 @@ bool generateDueDates (Task& parent, std::vector & allDue) // parent mask contains all + or X, then there never will be another task // to generate, and this parent task may be safely reaped. auto mask = parent.get ("mask"); - return !(mask.length () == allDue.size () && - mask.find ('-') == std::string::npos); + if (mask.length () == allDue.size () && + mask.find ('-') == std::string::npos) + return false; + + return true; } if (i > now)