]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/buffer.h
remove unused wxAppTraits-related files
[wxWidgets.git] / include / wx / buffer.h
index c4cb0dc2087e850053f4afdfa0867afe32cda30b..346ef113f9b6bb78d4f9f0e653d765e54810c773 100644 (file)
@@ -15,7 +15,9 @@
 #include "wx/chartype.h"
 #include "wx/wxcrtbase.h"
 
+#ifndef __WXPALMOS5__
 #include <stdlib.h>             // malloc() and free()
+#endif // ! __WXPALMOS5__
 
 class WXDLLIMPEXP_FWD_BASE wxCStrData;
 
@@ -105,9 +107,12 @@ public:
 
     wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src)
     {
-        if ( m_owned )
-            free(m_str);
-        CopyFrom(src);
+        if (&src != this)
+        {
+            if ( m_owned )
+                free(m_str);
+            CopyFrom(src);
+        }
         return *this;
     }
 
@@ -150,6 +155,8 @@ private:
     bool m_owned;
 };
 
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<char> )
+
 class WXDLLIMPEXP_BASE wxCharBuffer : public wxCharTypeBuffer<char>
 {
 public:
@@ -165,6 +172,8 @@ public:
 };
 
 #if wxUSE_WCHAR_T
+WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<wchar_t> )
+
 class WXDLLIMPEXP_BASE wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
 {
 public:
@@ -222,6 +231,13 @@ typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer;
     #define wxWX2WCbuf wxWCharBuffer
 #endif // Unicode/ANSI
 
+// type of the value returned by wxString::utf8_str()
+#if wxUSE_UNICODE_UTF8
+    #define wxUTF8Buf char *
+#else
+    #define wxUTF8Buf wxCharBuffer
+#endif
+
 // ----------------------------------------------------------------------------
 // A class for holding growable data buffers (not necessarily strings)
 // ----------------------------------------------------------------------------
@@ -306,9 +322,12 @@ public:
 
     wxMemoryBuffer& operator=(const wxMemoryBuffer& src)
     {
-        m_bufdata->DecRef();
-        m_bufdata = src.m_bufdata;
-        m_bufdata->IncRef();
+        if (&src != this)
+        {
+            m_bufdata->DecRef();
+            m_bufdata = src.m_bufdata;
+            m_bufdata->IncRef();
+        }
         return *this;
     }