From 135906e4b2c3f14f52eff8b89e8e203c11a63966 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 27 Apr 2015 12:48:47 +0200 Subject: [PATCH] Remove parameter "hasBeenSet" logic It doesn't really make sense anymore given that settings might come from the GUI or configuration and not only the command line. --- common/rfb/Configuration.cxx | 14 +------------- common/rfb/Configuration.h | 3 --- tests/encperf.cxx | 4 ++-- vncviewer/DesktopWindow.cxx | 6 +++--- vncviewer/vncviewer.cxx | 21 --------------------- 5 files changed, 6 insertions(+), 42 deletions(-) diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx index d7005221..8e1ea6e9 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -88,7 +88,6 @@ bool Configuration::set(const char* name, int len, strncasecmp(current->getName(), name, len) == 0) { bool b = current->setParam(val); - current->setHasBeenSet(); if (b && immutable) current->setImmutable(); return b; @@ -113,7 +112,6 @@ bool Configuration::set(const char* config, bool immutable) { while (current) { if (strcasecmp(current->getName(), config) == 0) { bool b = current->setParam(); - current->setHasBeenSet(); if (b && immutable) current->setImmutable(); return b; @@ -182,7 +180,7 @@ void Configuration::list(int width, int nameWidth) { VoidParameter::VoidParameter(const char* name_, const char* desc_, ConfigurationObject co) - : immutable(false), _hasBeenSet(false), name(name_), description(desc_) + : immutable(false), name(name_), description(desc_) { Configuration *conf = NULL; @@ -226,16 +224,6 @@ VoidParameter::setImmutable() { immutable = true; } -void -VoidParameter::setHasBeenSet() { - _hasBeenSet = true; -} - -bool -VoidParameter::hasBeenSet() { - return _hasBeenSet; -} - // -=- AliasParameter AliasParameter::AliasParameter(const char* name_, const char* desc_, diff --git a/common/rfb/Configuration.h b/common/rfb/Configuration.h index 4feeb789..da93fddf 100644 --- a/common/rfb/Configuration.h +++ b/common/rfb/Configuration.h @@ -165,8 +165,6 @@ namespace rfb { virtual bool isBool() const; virtual void setImmutable(); - virtual void setHasBeenSet(); - bool hasBeenSet(); protected: friend class Configuration; @@ -174,7 +172,6 @@ namespace rfb { VoidParameter* _next; bool immutable; - bool _hasBeenSet; const char* name; const char* description; }; diff --git a/tests/encperf.cxx b/tests/encperf.cxx index 9b632e78..d93c771f 100644 --- a/tests/encperf.cxx +++ b/tests/encperf.cxx @@ -427,12 +427,12 @@ int main(int argc, char **argv) usage(argv[0]); } - if (!format.hasBeenSet()) { + if (strcmp(format, "") == 0) { fprintf(stderr, "Pixel format not specified!\n\n"); usage(argv[0]); } - if (!width.hasBeenSet() || !height.hasBeenSet()) { + if (width == 0 || height == 0) { fprintf(stderr, "Frame buffer size not specified!\n\n"); usage(argv[0]); } diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index eb62edd6..bba502b2 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -85,7 +85,7 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, // coordinates relative to the right edge / bottom edge) at this // time. int geom_x = 0, geom_y = 0; - if (geometry.hasBeenSet()) { + if (strcmp(geometry, "") != 0) { int matched; matched = sscanf(geometry.getValueStr(), "+%d+%d", &geom_x, &geom_y); if (matched == 2) { @@ -606,12 +606,12 @@ void DesktopWindow::maximizeWindow() void DesktopWindow::handleDesktopSize() { - if (desktopSize.hasBeenSet()) { + if (strcmp(desktopSize, "") != 0) { int width, height; // An explicit size has been requested - if (sscanf(desktopSize.getValueStr(), "%dx%d", &width, &height) != 2) + if (sscanf(desktopSize, "%dx%d", &width, &height) != 2) return; remoteResize(width, height); diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 09c8b2fe..4b989bb2 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -496,27 +496,6 @@ int main(int argc, char** argv) vncServerName[VNCSERVERNAMELEN - 1] = '\0'; } - if (!::autoSelect.hasBeenSet()) { - // Default to AutoSelect=0 if -PreferredEncoding or -FullColor is used - if (::preferredEncoding.hasBeenSet() || ::fullColour.hasBeenSet() || - ::fullColourAlias.hasBeenSet()) { - ::autoSelect.setParam(false); - } - } - if (!::fullColour.hasBeenSet() && !::fullColourAlias.hasBeenSet()) { - // Default to FullColor=0 if AutoSelect=0 && LowColorLevel is set - if (!::autoSelect && (::lowColourLevel.hasBeenSet() || - ::lowColourLevelAlias.hasBeenSet())) { - ::fullColour.setParam(false); - } - } - if (!::customCompressLevel.hasBeenSet()) { - // Default to CustomCompressLevel=1 if CompressLevel is used. - if(::compressLevel.hasBeenSet()) { - ::customCompressLevel.setParam(true); - } - } - mkvnchomedir(); CSecurity::upg = &dlg; -- 2.39.5