Browse Source

Use the same internal data type for conversion function

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
72faf89e26
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/rss/rss_autodownloadrule.cpp
  2. 6
      src/base/tristatebool.h

4
src/base/rss/rss_autodownloadrule.cpp

@ -64,7 +64,7 @@ namespace @@ -64,7 +64,7 @@ namespace
QJsonValue triStateBoolToJsonValue(const TriStateBool &triStateBool)
{
switch (static_cast<int>(triStateBool)) {
switch (static_cast<signed char>(triStateBool)) {
case 0: return false;
case 1: return true;
default: return {};
@ -82,7 +82,7 @@ namespace @@ -82,7 +82,7 @@ namespace
int triStateBoolToAddPausedLegacy(const TriStateBool &triStateBool)
{
switch (static_cast<int>(triStateBool)) {
switch (static_cast<signed char>(triStateBool)) {
case 0: return 2; // never
case 1: return 1; // always
default: return 0; // default

6
src/base/tristatebool.h

@ -43,13 +43,13 @@ public: @@ -43,13 +43,13 @@ public:
*this = boolean ? True : False;
}
explicit constexpr operator int() const
TriStateBool &operator=(const TriStateBool &other) = default; // TODO: add constexpr when using C++17
explicit constexpr operator signed char() const
{
return m_value;
}
TriStateBool &operator=(const TriStateBool &other) = default; // add constexpr when using C++17
constexpr friend bool operator==(const TriStateBool &left, const TriStateBool &right)
{
return (left.m_value == right.m_value);

Loading…
Cancel
Save