]> source.dussan.org Git - tigervnc.git/commitdiff
Remove parameter "hasBeenSet" logic
authorPierre Ossman <ossman@cendio.se>
Mon, 27 Apr 2015 10:48:47 +0000 (12:48 +0200)
committerPierre Ossman <ossman@cendio.se>
Mon, 27 Apr 2015 10:48:47 +0000 (12:48 +0200)
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
common/rfb/Configuration.h
tests/encperf.cxx
vncviewer/DesktopWindow.cxx
vncviewer/vncviewer.cxx

index d7005221e4615db96116ee457811ebac055ed267..8e1ea6e93dee53a95cc779ca42c6c87fd3afedfd 100644 (file)
@@ -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_,
index 4feeb7892cfbeb86cd73cc3a0b443b0a0ef5cfa1..da93fddf4640bafb20abd1a734329602e23de260 100644 (file)
@@ -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;
   };
index 9b632e7850d262b09b92dc6110332856be23d03f..d93c771f90d38d1acf009b1fc42fc249a1bea202 100644 (file)
@@ -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]);
   }
index eb62edd6284bd6f55abc2c72faf447d9ab2c2acd..bba502b26a12049adec239833320e0ef8ebd4350 100644 (file)
@@ -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);
index 09c8b2fe84aa5ddc83825e0da5307f4209bcb800..4b989bb28f519c137483947e19ad9fb2a9bf1962 100644 (file)
@@ -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;