Code

fix some includes
[inkscape.git] / src / dom / domstring.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 11b3010..34629ed
@@ -27,6 +27,8 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdio.h>
+#include <stdlib.h>
 
 #include "domstring.h"
 
@@ -63,7 +65,7 @@ DOMString::DOMString(const char *str)
 DOMString::~DOMString()
 {
     if (cstring)
-        free(cstring);
+        delete cstring;
 }
 
 
@@ -122,6 +124,13 @@ DOMString &DOMString::assign(const DOMString &str)
     return *this;
 }
 
+DOMString &DOMString::operator=(const DOMString &str)
+{
+    clear();
+    append(str);
+    return *this;
+}
+
 DOMString &DOMString::assign(const char *str)
 {
     clear();
@@ -254,7 +263,7 @@ void DOMString::clear()
     chars.clear();
     if (cstring)
         {
-        free(cstring);
+        delete cstring;
         cstring = NULL;
         }
 }
@@ -284,11 +293,11 @@ DOMString DOMString::substr(unsigned long start, unsigned long end) const
 const char *DOMString::c_str()
 {
     if (cstring)
-        free(cstring);
+        delete cstring;
 
     int length = chars.size();
 
-    cstring = (char *)malloc(length + 1);
+    cstring = new char[length+1];
 
     int i=0;
     for ( ; i<length ; i++ )