[Development] Allow changing the default value of string parameters. (Martin Koegler)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4194 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/Configuration.cxx b/common/rfb/Configuration.cxx
index 6811a79..e9eee1a 100644
--- a/common/rfb/Configuration.cxx
+++ b/common/rfb/Configuration.cxx
@@ -418,6 +418,12 @@
strFree(value);
}
+void StringParameter::setDefaultStr(const char* v) {
+ def_value = v;
+ strFree(value);
+ value = strDup(v);
+}
+
bool StringParameter::setParam(const char* v) {
LOCK_CONFIG;
if (immutable) return true;
diff --git a/common/rfb/Configuration.h b/common/rfb/Configuration.h
index 3e21b18..276651d 100644
--- a/common/rfb/Configuration.h
+++ b/common/rfb/Configuration.h
@@ -240,6 +240,7 @@
virtual bool setParam(const char* value);
virtual char* getDefaultStr() const;
virtual char* getValueStr() const;
+ void setDefaultStr(const char* v);
// getData() returns a copy of the data - it must be delete[]d by the
// caller.