#ifndef _WX_BUFFER_H
#define _WX_BUFFER_H
+#include "wx/wxchar.h"
#include <string.h> // strdup
-#include <wchar.h> // wchar_t
// ----------------------------------------------------------------------------
// Special classes for (wide) character strings: they use malloc/free instead
{
wxASSERT_MSG( wcs, _T("NULL string in wxWCharBuffer") );
- m_wcs = wcs ? (wchar_t *)malloc((wcslen(wcs)+1)*sizeof(wchar_t))
- : (wchar_t *)NULL;
- if (m_wcs) wcscpy(m_wcs, wcs);
+ if (wcs) {
+ size_t siz = (wcslen(wcs)+1)*sizeof(wchar_t);
+ m_wcs = (wchar_t *)malloc(siz);
+ memcpy(m_wcs, wcs, siz);
+ }
+ else m_wcs = (wchar_t *)NULL;
}
wxWCharBuffer(size_t len)
{
{
m_wcs = src.m_wcs;
// no reference count yet...
- (wxWCharBuffer)src.m_wcs = (wchar_t *)NULL;
+ ((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
}
wxWCharBuffer& operator=(const wxWCharBuffer& src)
{
m_wcs = src.m_wcs;
// no reference count yet...
- (wxWCharBuffer)src.m_wcs = (wchar_t *)NULL;
+ ((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
return *this;
}