From 2c906a490735b158266030c0531ab779257d0aff Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 25 Mar 2006 00:06:25 +0000 Subject: [PATCH] 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 --- src/common/dobjcmn.cpp | 2 +- src/gtk/clipbrd.cpp | 4 ++-- src/gtk1/clipbrd.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index dd27a6032d..cbed32d72f 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -238,7 +238,7 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { 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 diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index 3dabd926b4..e5aec7830b 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -300,7 +300,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), gtk_selection_data_set_text( selection_data, (const gchar*)d, - size-1 ); + size ); } else { @@ -309,7 +309,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), (unsigned char*) d, - size-1 ); + size ); } free(d); diff --git a/src/gtk1/clipbrd.cpp b/src/gtk1/clipbrd.cpp index f9d56bf0f8..43b4ccea5e 100644 --- a/src/gtk1/clipbrd.cpp +++ b/src/gtk1/clipbrd.cpp @@ -298,7 +298,7 @@ selection_handler( GtkWidget *WXUNUSED(widget), GDK_SELECTION_TYPE_STRING, 8 * sizeof(gchar), (unsigned char*) d, - size-1 ); + size ); free(d); } -- 2.45.2