#if wxUSE_DATAOBJ
+#include "wx/dataobj.h"
+
#ifndef WX_PRECOMP
-#include "wx/intl.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
+ #include "wx/dcmemory.h"
+ #include "wx/image.h"
#endif
-#include "wx/log.h"
-#include "wx/dataobj.h"
-#include "wx/dcmemory.h"
#include "wx/mstream.h"
-#include "wx/image.h"
#include "wx/metafile.h"
#include "wx/tokenzr.h"
-
#include "wx/mac/private.h"
#ifndef __DARWIN__
default:
m_type = wxDF_PRIVATE;
char text[5];
- strncpy( text, (char*)&format, 4 );
+ memcpy( text, (const char*)&format, 4 );
text[4] = 0;
m_id = wxString::FromAscii( text );
break;
}
else
{
- wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
+ wxDataFormat *pFormats = new wxDataFormat[nFormatCount];
GetAllFormats( pFormats, vDir );
for (size_t n = 0; n < nFormatCount; n++)
{
if (pFormats[n] == rFormat)
{
- found = true;
+ found = true;
break;
}
}
// wxFileDataObject
// ----------------------------------------------------------------------------
-void wxFileDataObject::GetFileNames(wxCharBuffer &buf) const
+void wxFileDataObject::GetFileNames( wxCharBuffer &buf ) const
{
wxString filenames;
-
+
for (size_t i = 0; i < m_filenames.GetCount(); i++)
{
filenames += m_filenames[i];
filenames += wxT('\n');
}
-
+
buf = filenames.fn_str();
}
return false;
wxCharBuffer buf;
- GetFileNames( buf );
+ size_t buffLength;
- memcpy( pBuf, (const char*) buf, strlen(buf) + 1 );
+ GetFileNames( buf );
+ buffLength = strlen( buf );
+ memcpy( pBuf, (const char*)buf, buffLength + 1 );
return true;
}
size_t wxFileDataObject::GetDataSize() const
{
wxCharBuffer buf;
+ size_t buffLength;
+
GetFileNames( buf );
+ buffLength = strlen( buf );
- return strlen(buf) + 1;
+ return buffLength + 1;
}
bool wxFileDataObject::SetData( size_t nSize, const void *pBuf )
{
wxString filenames;
+
#if wxUSE_UNICODE
- filenames = wxString( (const char*) pBuf , *wxConvFileName );
+ filenames = wxString( (const char*)pBuf, *wxConvFileName );
#else
- filenames = wxString( wxConvFileName->cMB2WX( pBuf ) , wxConvLocal );
+ filenames = wxString (wxConvLocal.cWC2WX(wxConvFileName->cMB2WC( (const char*)pBuf)));
#endif
- m_filenames = wxStringTokenize( filenames , wxT("\n") , wxTOKEN_STRTOK );
-
+ m_filenames = wxStringTokenize( filenames, wxT("\n"), wxTOKEN_STRTOK );
+
return true;
}