summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-11-26 14:16:02 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-11-26 14:16:02 +0100
commit22c5a38364cbe0df1b710e8cf9e31141adac441c (patch)
treeac1aa1cf817ee6e3f0d2cfcfc13ed8fca432b90c
parent71ccb6acb62fed319367fc71108d5b3fff8f3a5b (diff)
downloadvdr-22c5a38364cbe0df1b710e8cf9e31141adac441c.tar.gz
vdr-22c5a38364cbe0df1b710e8cf9e31141adac441c.tar.bz2
Added a copy constructor to cString and fixed its assignment operator
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY2
-rw-r--r--tools.c9
-rw-r--r--tools.h3
4 files changed, 15 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 230b20d2..c4173a03 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1544,3 +1544,6 @@ Ralf Müller <ralf@bj-ig.de>
Maarten Wisse <Maarten.Wisse@urz.uni-hd.de>
for translating OSD texts to the Dutch language
+
+Holger Brunn <holger.brunn@stud.uni-karlsruhe.de>
+ for adding a copy constructor to cString and fixing its assignment operator
diff --git a/HISTORY b/HISTORY
index 99e71518..884fe241 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3955,3 +3955,5 @@ Video Disk Recorder Revision History
and isn't actively used, yet.
- Fixed SetProgress() in the 'skincurses' plugin in case Total is 0 (reported
by Stefan Huelswitt).
+- Added a copy constructor to cString and fixed its assignment operator
+ (thanks to Holger Brunn).
diff --git a/tools.c b/tools.c
index 832f4293..4a4a3aa6 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.103 2005/11/04 16:33:18 kls Exp $
+ * $Id: tools.c 1.104 2005/11/26 14:12:31 kls Exp $
*/
#include "tools.h"
@@ -527,6 +527,11 @@ cString::cString(const char *S, bool TakePointer)
s = TakePointer ? (char *)S : S ? strdup(S) : NULL;
}
+cString::cString(const cString &String)
+{
+ s = String.s ? strdup(String.s) : NULL;
+}
+
cString::~cString()
{
free(s);
@@ -534,6 +539,8 @@ cString::~cString()
cString &cString::operator=(const cString &String)
{
+ if (this == &String)
+ return *this;
free(s);
s = String.s ? strdup(String.s) : NULL;
return *this;
diff --git a/tools.h b/tools.h
index c344fce2..833ba847 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.83 2005/11/05 10:54:39 kls Exp $
+ * $Id: tools.h 1.84 2005/11/26 14:03:47 kls Exp $
*/
#ifndef __TOOLS_H
@@ -75,6 +75,7 @@ private:
char *s;
public:
cString(const char *S = NULL, bool TakePointer = false);
+ cString(const cString &String);
virtual ~cString();
operator const char * () const { return s; } // for use in (const char *) context
const char * operator*() const { return s; } // for use in (const void *) context (printf() etc.)