[Spice-devel] [PATCH spice-gtk] gtk-session: Set value directly
Victor Toso
victortoso at redhat.com
Mon Feb 20 09:45:48 UTC 2017
Hi,
On Fri, Feb 17, 2017 at 01:44:55PM +0100, Pavel Grunt wrote:
> Spotted by coverity
Including the coverity message instead would be more interesting IMHO.
Acked-by: Victor Toso <victortoso at redhat.com>
> ---
> src/spice-gtk-session.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index a3a2e90..5688cba 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -916,25 +916,23 @@ static gboolean check_clipboard_size_limits(SpiceGtkSession *session,
> */
> static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int *len)
> {
> char *conv = NULL;
> - int new_len = *len;
>
> if (spice_main_agent_test_capability(self->priv->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) {
> conv = spice_unix2dos(text, *len);
> - new_len = strlen(conv);
> + *len = strlen(conv);
> } else {
> /* On Windows, with some versions of gtk+, GtkSelectionData::length
> * will include the final '\0'. When a string with this trailing '\0'
> * is pasted in some linux applications, it will be pasted as <NIL> or
> * as an invisible character, which is unwanted. Ensure the length we
> * send to the agent does not include any trailing '\0'
> * This is gtk+ bug https://bugzilla.gnome.org/show_bug.cgi?id=734670
> */
> - new_len = strlen(text);
> + *len = strlen(text);
> }
>
> - *len = new_len;
> return conv;
> }
>
> static void clipboard_received_text_cb(GtkClipboard *clipboard,
> --
> 2.11.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170220/827f9346/attachment.sig>
More information about the Spice-devel
mailing list