The null byte at the end of the string should not be included in the
size of a text data object in the clipboard, otherwise we have to subtract it when the data is requested and that results in truncating one byte for other data formats. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -238,7 +238,7 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
|
|||||||
{
|
{
|
||||||
wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() );
|
wxCharBuffer buffer = GetConv(format).cWX2MB( GetText().c_str() );
|
||||||
|
|
||||||
return buffer ? strlen( buffer ) + 1 : 0;
|
return buffer ? strlen( buffer ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
|
bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
|
||||||
|
@@ -300,7 +300,7 @@ selection_handler( GtkWidget *WXUNUSED(widget),
|
|||||||
gtk_selection_data_set_text(
|
gtk_selection_data_set_text(
|
||||||
selection_data,
|
selection_data,
|
||||||
(const gchar*)d,
|
(const gchar*)d,
|
||||||
size-1 );
|
size );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -309,7 +309,7 @@ selection_handler( GtkWidget *WXUNUSED(widget),
|
|||||||
GDK_SELECTION_TYPE_STRING,
|
GDK_SELECTION_TYPE_STRING,
|
||||||
8*sizeof(gchar),
|
8*sizeof(gchar),
|
||||||
(unsigned char*) d,
|
(unsigned char*) d,
|
||||||
size-1 );
|
size );
|
||||||
}
|
}
|
||||||
|
|
||||||
free(d);
|
free(d);
|
||||||
|
@@ -298,7 +298,7 @@ selection_handler( GtkWidget *WXUNUSED(widget),
|
|||||||
GDK_SELECTION_TYPE_STRING,
|
GDK_SELECTION_TYPE_STRING,
|
||||||
8 * sizeof(gchar),
|
8 * sizeof(gchar),
|
||||||
(unsigned char*) d,
|
(unsigned char*) d,
|
||||||
size-1 );
|
size );
|
||||||
|
|
||||||
free(d);
|
free(d);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user