Skip to content

Commit

Permalink
Use "on"/"off" when displaying bool parameters
Browse files Browse the repository at this point in the history
This is a lot more readable than "0"/"1", which can easily be confused
with integer parameters.

Note that this breaks some backwards compatibility. Older clients will
not be able to parse configuration files generated by newer clients, as
they had a bug where they could only understand "0" and "1".
  • Loading branch information
CendioOssman committed Jan 10, 2025
1 parent 5cd38b6 commit df67cd5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/rfb/Configuration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@ bool BoolParameter::setParam() {
void BoolParameter::setParam(bool b) {
if (immutable) return;
value = b;
vlog.debug("Set %s(Bool) to %d", getName(), value);
vlog.debug("Set %s(Bool) to %s", getName(), getValueStr().c_str());
}

std::string BoolParameter::getDefaultStr() const {
return def_value ? "1" : "0";
return def_value ? "on" : "off";
}

std::string BoolParameter::getValueStr() const {
return value ? "1" : "0";
return value ? "on" : "off";
}

BoolParameter::operator bool() const {
Expand Down

0 comments on commit df67cd5

Please sign in to comment.