From f0f38e0f164b7e8b9132665407445d93f33be7ad Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 14 Jul 2006 07:55:14 +0000 Subject: Made everything have a virtual deconstructor. This is apparently very important. --- src/arraylist.h | 2 +- src/cgi.h | 2 +- src/connection.h | 2 +- src/connectionmanager.h | 2 +- src/flexbuf.h | 2 +- src/hashfunctioncasestring.h | 2 +- src/hashfunctionint.h | 2 +- src/hashfunctionstring.h | 2 +- src/hashtable.h | 2 +- src/http.h | 2 +- src/linkedlist.h | 2 +- src/md5.h | 2 +- src/multilog.h | 4 ++-- src/multilogtext.h | 2 +- src/pqueue.h | 2 +- src/programchain.h | 2 +- src/protocoltelnet.h | 2 +- src/ringlist.h | 2 +- src/serializerbinary.h | 2 +- src/serializerbzip2.h | 2 +- src/serializertext.h | 2 +- src/staticstring.h | 2 +- src/test/xmlwritetest/xmlwritetest.cpp | 7 +++++++ src/tokenstring.h | 2 +- src/xmldocument.h | 2 +- src/xmlfilereader.h | 2 +- src/xmlfilewriter.h | 2 +- src/xmlnode.h | 2 +- src/xmlreader.h | 2 +- src/xmlstringreader.h | 2 +- src/xmlstringwriter.h | 2 +- src/xmlwriter.h | 2 +- 32 files changed, 39 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/arraylist.h b/src/arraylist.h index 74992cf..0fda34a 100644 --- a/src/arraylist.h +++ b/src/arraylist.h @@ -24,7 +24,7 @@ public: /** * Destroy the ArrayList */ - ~ArrayList(); + virtual ~ArrayList(); void *getAt( int nIndex ); void append( void *pData ); diff --git a/src/cgi.h b/src/cgi.h index 8e9a584..01142b5 100644 --- a/src/cgi.h +++ b/src/cgi.h @@ -43,7 +43,7 @@ public: /** * Destroy the cgi object. */ - ~Cgi( ); + virtual ~Cgi( ); /** * Get's the value for a variable as a character string. The name is the diff --git a/src/connection.h b/src/connection.h index dd4112b..29fcc25 100644 --- a/src/connection.h +++ b/src/connection.h @@ -34,7 +34,7 @@ public: * such an operation could take considerable time, depending on the pending * data and state of the receiving end. */ - ~Connection(); + virtual ~Connection(); /** * Open a connection to a remote server. This sets up this connection as diff --git a/src/connectionmanager.h b/src/connectionmanager.h index da49a39..85eb7ad 100644 --- a/src/connectionmanager.h +++ b/src/connectionmanager.h @@ -33,7 +33,7 @@ public: * Cleans up everything, and even clears out all still-connected Connection * objects. */ - ~ConnectionManager(); + virtual ~ConnectionManager(); /** * Starts a server socket and binds to it, listening for new connections. diff --git a/src/flexbuf.h b/src/flexbuf.h index 5ce4a89..a68dcc6 100644 --- a/src/flexbuf.h +++ b/src/flexbuf.h @@ -24,7 +24,7 @@ public: /** * Clean up the FlexBuf, delete all buffers. */ - ~FlexBuf(); + virtual ~FlexBuf(); /** Appends a whole string of data to the buffer. The string * must be null terminated. diff --git a/src/hashfunctioncasestring.h b/src/hashfunctioncasestring.h index 9ca3d48..7816a1b 100644 --- a/src/hashfunctioncasestring.h +++ b/src/hashfunctioncasestring.h @@ -20,7 +20,7 @@ public: /** * Standard Deconstructor. */ - ~HashFunctionCaseString(); + virtual ~HashFunctionCaseString(); unsigned long int hash( const void *id ); bool cmpIDs( const void *id1, const void *id2 ); }; diff --git a/src/hashfunctionint.h b/src/hashfunctionint.h index 57bce89..0fbc764 100644 --- a/src/hashfunctionint.h +++ b/src/hashfunctionint.h @@ -18,7 +18,7 @@ public: /** * Standard Deconstructor. */ - ~HashFunctionInt(); + virtual ~HashFunctionInt(); unsigned long int hash( const void *id ); bool cmpIDs( const void *id1, const void *id2 ); }; diff --git a/src/hashfunctionstring.h b/src/hashfunctionstring.h index 566f8ae..7d2a1a6 100644 --- a/src/hashfunctionstring.h +++ b/src/hashfunctionstring.h @@ -19,7 +19,7 @@ public: /** * Standard Deconstructor. */ - ~HashFunctionString(); + virtual ~HashFunctionString(); unsigned long int hash( const void *id ); bool cmpIDs( const void *id1, const void *id2 ); }; diff --git a/src/hashtable.h b/src/hashtable.h index b015107..170793f 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -69,7 +69,7 @@ public: * Destroys the hashtable, cleaning up all internal storage, but not stored * elements. Also deletes the HashFunction passed in in the constructor. */ - ~HashTable(); + virtual ~HashTable(); /** Inserts an item into the hashtable. This function will trigger a * rehash if adding another item would force the table's load factor over diff --git a/src/http.h b/src/http.h index 4ee4470..fc9e15a 100644 --- a/src/http.h +++ b/src/http.h @@ -55,7 +55,7 @@ public: /** * Standard Deconstructor. */ - ~Http(); + virtual ~Http(); /** * Perform all parsing needed to figure out what an HTTP client wants from diff --git a/src/linkedlist.h b/src/linkedlist.h index c45cc9b..e430108 100644 --- a/src/linkedlist.h +++ b/src/linkedlist.h @@ -27,7 +27,7 @@ public: /** * Delete all list data, but do not delete any of the contained elements. */ - ~LinkedList(); + virtual ~LinkedList(); void *getAt( int nIndex ); void append( void *pData ); diff --git a/src/md5.h b/src/md5.h index 810345e..7f77d83 100644 --- a/src/md5.h +++ b/src/md5.h @@ -21,7 +21,7 @@ public: md5(); /** Deconstruct */ - ~md5(); + virtual ~md5(); /** * Create a sum of a standard c string, null terminated. This is probably diff --git a/src/multilog.h b/src/multilog.h index 7e4a357..692095a 100644 --- a/src/multilog.h +++ b/src/multilog.h @@ -42,7 +42,7 @@ public: typedef struct LogEntry { /** Safely delete a log entry. */ - ~LogEntry(); + virtual ~LogEntry(); time_t xTime; /**< The time the log entry was made. */ int nLevel; /**< The log-level of the entry. */ char *lpFile; /**< The name of the file this entry came from. */ @@ -59,7 +59,7 @@ protected: /** * Destroy the multilog. */ - ~MultiLog(); + virtual ~MultiLog(); /** * Append a new logentry to the log list, possibly pushing an old entry off. diff --git a/src/multilogtext.h b/src/multilogtext.h index 8994b68..197aef1 100644 --- a/src/multilogtext.h +++ b/src/multilogtext.h @@ -49,7 +49,7 @@ public: /** * Destroy the object. */ - ~MultiLogText(); + virtual ~MultiLogText(); bool openLog(); bool append( MultiLog::LogEntry *pEntry ); diff --git a/src/pqueue.h b/src/pqueue.h index 1b45f75..8307d56 100644 --- a/src/pqueue.h +++ b/src/pqueue.h @@ -19,7 +19,7 @@ public: /** * Cleanup all contained queues. */ - ~PQueue(); + virtual ~PQueue(); /** Add a new item to the queue at the specified priority. A lower * number means a higher priority! diff --git a/src/programchain.h b/src/programchain.h index 333c91b..1752d2c 100644 --- a/src/programchain.h +++ b/src/programchain.h @@ -20,7 +20,7 @@ public: /** * Destroy your chain. */ - ~ProgramChain(); + virtual ~ProgramChain(); /** Adds a link to the end of the chain. *@param pLink A pointer to the link to add to the chain. diff --git a/src/protocoltelnet.h b/src/protocoltelnet.h index 4b2fb32..a6d2e49 100644 --- a/src/protocoltelnet.h +++ b/src/protocoltelnet.h @@ -14,7 +14,7 @@ class ProtocolTelnet : public Protocol { public: ProtocolTelnet(); - ~ProtocolTelnet(); + virtual ~ProtocolTelnet(); bool onNewData(); bool onNewConnection(); diff --git a/src/ringlist.h b/src/ringlist.h index 1a4d3a9..bc069f3 100644 --- a/src/ringlist.h +++ b/src/ringlist.h @@ -28,7 +28,7 @@ public: /** * Clean up the data structures, but not the contained elements. */ - ~RingList(); + virtual ~RingList(); /** * Get an element at the specified index. diff --git a/src/serializerbinary.h b/src/serializerbinary.h index 9d68d46..fe83ad5 100644 --- a/src/serializerbinary.h +++ b/src/serializerbinary.h @@ -9,7 +9,7 @@ class SerializerBinary : public Serializer public: SerializerBinary(FILE *fhFile, bool bLoading); SerializerBinary(char *sFileName, bool bLoading); - ~SerializerBinary(); + virtual ~SerializerBinary(); virtual void close(); diff --git a/src/serializerbzip2.h b/src/serializerbzip2.h index 2d646f2..098c66e 100644 --- a/src/serializerbzip2.h +++ b/src/serializerbzip2.h @@ -9,7 +9,7 @@ class SerializerBZip2 : public Serializer public: SerializerBZip2(FILE *fhFile, bool bLoading); SerializerBZip2(char *sFileName, bool bLoading); - ~SerializerBZip2(); + virtual ~SerializerBZip2(); virtual void close(); diff --git a/src/serializertext.h b/src/serializertext.h index c3fe202..9bead59 100644 --- a/src/serializertext.h +++ b/src/serializertext.h @@ -9,7 +9,7 @@ class SerializerText : public Serializer public: SerializerText(FILE *fhFile, bool bLoading); SerializerText(char *sFileName, bool bLoading); - ~SerializerText(); + virtual ~SerializerText(); virtual void close(); diff --git a/src/staticstring.h b/src/staticstring.h index 1c98b3c..7ffa21f 100644 --- a/src/staticstring.h +++ b/src/staticstring.h @@ -18,7 +18,7 @@ public: StaticString( const char *lpNewStr, int nNewLen=-1 ); StaticString( StaticString &xSrcStr, int nNewLen=-1 ); StaticString( int nLength ); - ~StaticString(); + virtual ~StaticString(); char *getString(); int getLength(); diff --git a/src/test/xmlwritetest/xmlwritetest.cpp b/src/test/xmlwritetest/xmlwritetest.cpp index 2986c35..fc93510 100644 --- a/src/test/xmlwritetest/xmlwritetest.cpp +++ b/src/test/xmlwritetest/xmlwritetest.cpp @@ -1,5 +1,6 @@ #include "xmlfilewriter.h" #include "xmlstringwriter.h" +#include "xmlstringreader.h" void fillItIn( XmlWriter &w ) { @@ -28,6 +29,12 @@ void fillItIn( XmlWriter &w ) int main() { printf("Testing XmlWriter...\n"); + + XmlStringReader *xsr = new XmlStringReader(""); + + printf("%08X\n%08X\n%08X\n", xsr, (XmlReader *)xsr, (XmlDocument *)xsr ); + + delete (XmlDocument *)xsr; //XmlFileWriter wf("test.xml", "\t"); //fillItIn( wf ); diff --git a/src/tokenstring.h b/src/tokenstring.h index 37ce6f5..42f7309 100644 --- a/src/tokenstring.h +++ b/src/tokenstring.h @@ -27,7 +27,7 @@ public: *@author Mike Buland */ TokenString( const char *lpNewTokenString=NULL ); - ~TokenString(); + virtual ~TokenString(); /** Performs a tokenizing parse on the given command line, setting it as * the internal command line for all future tokenizing (excluding diff --git a/src/xmldocument.h b/src/xmldocument.h index 1a8eb52..6671c41 100644 --- a/src/xmldocument.h +++ b/src/xmldocument.h @@ -27,7 +27,7 @@ public: /** * Destroy all contained nodes. */ - ~XmlDocument(); + virtual ~XmlDocument(); /** * Add a new node to the document. The new node is appended to the end of diff --git a/src/xmlfilereader.h b/src/xmlfilereader.h index 24a6e28..e3e02c2 100644 --- a/src/xmlfilereader.h +++ b/src/xmlfilereader.h @@ -35,7 +35,7 @@ public: /** * Destroy the reader and cleanup. */ - ~XmlFileReader(); + virtual ~XmlFileReader(); private: char getChar( int nIndex = 0 ); diff --git a/src/xmlfilewriter.h b/src/xmlfilewriter.h index 97b3e00..231bb0d 100644 --- a/src/xmlfilewriter.h +++ b/src/xmlfilewriter.h @@ -33,7 +33,7 @@ public: /** * Destroy the writer. */ - ~XmlFileWriter(); + virtual ~XmlFileWriter(); private: void writeString( const char *sString ); diff --git a/src/xmlnode.h b/src/xmlnode.h index 2b01226..02ab41d 100644 --- a/src/xmlnode.h +++ b/src/xmlnode.h @@ -33,7 +33,7 @@ public: /** * Delete the node and cleanup all memory. */ - ~XmlNode(); + virtual ~XmlNode(); /** * Change the name of the node. diff --git a/src/xmlreader.h b/src/xmlreader.h index a9881cb..c8f7202 100644 --- a/src/xmlreader.h +++ b/src/xmlreader.h @@ -37,7 +37,7 @@ public: /** * Destroy this XmlReader. */ - ~XmlReader(); + virtual ~XmlReader(); /** * Build a document based on some kind of input. This is called diff --git a/src/xmlstringreader.h b/src/xmlstringreader.h index 19df427..1239ef4 100644 --- a/src/xmlstringreader.h +++ b/src/xmlstringreader.h @@ -36,7 +36,7 @@ public: /** * Destroy this string reader. */ - ~XmlStringReader(); + virtual ~XmlStringReader(); private: char getChar( int nIndex = 0 ); diff --git a/src/xmlstringwriter.h b/src/xmlstringwriter.h index 530db3e..0d567b9 100644 --- a/src/xmlstringwriter.h +++ b/src/xmlstringwriter.h @@ -32,7 +32,7 @@ public: /** * Destroy the string writer and the internal string. */ - ~XmlStringWriter(); + virtual ~XmlStringWriter(); /** * Get the string that was built. This is only valid after the document has diff --git a/src/xmlwriter.h b/src/xmlwriter.h index 5bc3f0a..c48e810 100644 --- a/src/xmlwriter.h +++ b/src/xmlwriter.h @@ -36,7 +36,7 @@ public: /** * Destroy the writer. */ - ~XmlWriter(); + virtual ~XmlWriter(); /** * This override of the parent class closeNode function calls the parent -- cgit v1.2.3