From: Adam Tkac Date: Thu, 11 Nov 2010 14:29:35 +0000 (+0000) Subject: [Development] Allow changing the default value of string parameters. (Martin Koegler) X-Git-Tag: v1.0.90~124 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3c7f8e18151425700f254e016a3df048bfc995ee;p=tigervnc.git [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 6811a79b..e9eee1a9 100644 --- a/common/rfb/Configuration.cxx +++ b/common/rfb/Configuration.cxx @@ -418,6 +418,12 @@ StringParameter::~StringParameter() { 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 3e21b184..276651d5 100644 --- a/common/rfb/Configuration.h +++ b/common/rfb/Configuration.h @@ -240,6 +240,7 @@ namespace rfb { 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.