[Spice-devel] [spice-gtk 1/2] clipboard: Add fixup_clipboard_text helper

Pavel Grunt pgrunt at redhat.com
Wed Aug 31 10:07:43 UTC 2016


On Wed, 2016-08-31 at 10:52 +0200, Christophe Fergeau wrote:
> On Mon, Aug 15, 2016 at 12:37:51PM +0200, Pavel Grunt wrote:
> 
> > Hi Christophe,
> > 
> > On Wed, 2016-08-10 at 12:26 +0200, Christophe Fergeau wrote:
> > 
> > > This makes clipboard_received_cb a bit shorter, and will be useful
> > > in the next commit.
> > > ---
> > >  src/spice-gtk-session.c | 63 +++++++++++++++++++++++++++++---------------
> > > ----
> > > -
> > >  1 file changed, 38 insertions(+), 25 deletions(-)
> > > 
> > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > > index 6cdae87..1343302 100644
> > > --- a/src/spice-gtk-session.c
> > > +++ b/src/spice-gtk-session.c
> > > @@ -910,6 +910,43 @@ static gboolean
> > > check_clipboard_size_limits(SpiceGtkSession *session,
> > >      return TRUE;
> > >  }
> > >  
> > > +static char *fixup_clipboard_text(SpiceGtkSession *self, const char
> > > *text,
> > > int *len)
> > 
> > In my opinion would be better if the function worked with
> > 'const GtkSelectionData *' instead of text & len pair. Or keep len as output
> > only parameter ?
> 
> After the second patch, we don't have a GtkSelectionData instance we can
> pass to that method, so this would not be so convenient. I can change
> fixup_clipboard_text() to return a GString though if you think it would
> make things more readable. Or I can add a comment explaining what the
> method is doing, and that 'len' may be modified.
Yes, the comment would be nice 
Thanks,
Pavel
> 
> Christophe
> 


More information about the Spice-devel mailing list