From 3c7f8e18151425700f254e016a3df048bfc995ee Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Thu, 11 Nov 2010 14:29:35 +0000 Subject: [PATCH] [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 --- common/rfb/Configuration.cxx | 6 ++++++ common/rfb/Configuration.h | 1 + 2 files changed, 7 insertions(+) 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. -- 2.39.5