]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Martin Huter <m.huter@phion.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 12 Jul 2009 09:06:29 +0000 (21:06 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 12 Jul 2009 09:06:29 +0000 (21:06 +1200)
Bug 2658: Missing TextException copy constructor

src/TextException.cc
src/TextException.h

index ada4f5c6baabea10fb15add8ab1e6df509b5707c..03592658f7a72f110bc2124530731571bc0c9d79 100644 (file)
@@ -1,13 +1,36 @@
 #include "squid.h"
 #include "TextException.h"
 
+TextException::TextException()
+{
+       message=NULL;
+       theFileName=NULL;
+       theLineNo=0;
+}
+
+TextException::TextException(const TextException& right) :
+       message((right.message?xstrdup(right.message):NULL)), theFileName(right.theFileName), theLineNo(right.theLineNo)
+{
+}
+
 TextException::TextException(const char *aMsg, const char *aFileName, int aLineNo):
         message(xstrdup(aMsg)), theFileName(aFileName), theLineNo(aLineNo)
 {}
 
 TextException::~TextException() throw()
 {
-    xfree(message);
+    if(message) xfree(message);
+}
+
+TextException& TextException::operator=(const TextException &right)
+{
+       if(this==&right) return *this;
+       if(message) xfree(message);
+    message=(right.message?xstrdup(right.message):NULL);
+    theFileName=right.theFileName;
+    theLineNo=right.theLineNo;
+
+       return *this;   
 }
 
 const char *TextException::what() const throw()
index 27b44b063cbc91e851d63834088c6190ddfb8f14..5edf33f17a7af975ab268b57e380ac7d868d0e29 100644 (file)
@@ -13,11 +13,15 @@ class TextException: public std::exception
 {
 
 public:
+    TextException();
     TextException(const char *aMessage, const char *aFileName = 0, int aLineNo = -1);
+    TextException(const TextException& right);
     virtual ~TextException() throw();
 
     virtual const char *what() const throw();
 
+       TextException& operator=(const TextException &right);
+
 public:
     char *message; // read-only