public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: clipboard: Make intent of the code clearer.
Date: Fri, 10 Dec 2021 12:02:55 +0100	[thread overview]
Message-ID: <YbMz31+Yu1wlefXB@calimero.vinschen.de> (raw)
In-Reply-To: <20211210195647.d9977a915a6968de33726804@nifty.ne.jp>

On Dec 10 19:56, Takashi Yano wrote:
> On Wed,  8 Dec 2021 21:26:45 +0900
> Takashi Yano wrote:
> > ---
> >  winsup/cygwin/fhandler_clipboard.cc   | 4 ++--
> >  winsup/cygwin/include/sys/clipboard.h | 1 +
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc
> > index 05f54ffb3..14820701c 100644
> > --- a/winsup/cygwin/fhandler_clipboard.cc
> > +++ b/winsup/cygwin/fhandler_clipboard.cc
> > @@ -76,7 +76,7 @@ fhandler_dev_clipboard::set_clipboard (const void *buf, size_t len)
> >        clipbuf->cb_sec  = clipbuf->ts.tv_sec;
> >  #endif
> >        clipbuf->cb_size = len;
> > -      memcpy (&clipbuf[1], buf, len); // append user-supplied data
> > +      memcpy (clipbuf->cb_data, buf, len); // append user-supplied data
> >  
> >        GlobalUnlock (hmem);
> >        EmptyClipboard ();
> > @@ -229,7 +229,7 @@ fhandler_dev_clipboard::read (void *ptr, size_t& len)
> >        if (pos < (off_t) clipbuf->cb_size)
> >  	{
> >  	  ret = (len > (clipbuf->cb_size - pos)) ? clipbuf->cb_size - pos : len;
> > -	  memcpy (ptr, (char *) (clipbuf + 1) + pos, ret);
> > +	  memcpy (ptr, clipbuf->cb_data + pos, ret);
> >  	  pos += ret;
> >  	}
> >      }
> > diff --git a/winsup/cygwin/include/sys/clipboard.h b/winsup/cygwin/include/sys/clipboard.h
> > index 4c00c8ea1..932fe98d9 100644
> > --- a/winsup/cygwin/include/sys/clipboard.h
> > +++ b/winsup/cygwin/include/sys/clipboard.h
> > @@ -44,6 +44,7 @@ typedef struct
> >      };
> >    };
> >    uint64_t      cb_size; // 8 bytes everywhere
> > +  char          cb_data[];
> >  } cygcb_t;
> >  
> >  #endif
> > -- 
> > 2.34.1
> 
> What should we do with this one?

Do your worst :)


Thanks,
Corinna

      reply	other threads:[~2021-12-10 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 12:26 Takashi Yano
2021-12-10 10:56 ` Takashi Yano
2021-12-10 11:02   ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YbMz31+Yu1wlefXB@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).