From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 73489383D80C; Mon, 30 May 2022 15:07:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73489383D80C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: remove 32-bit only clipboard code X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: f6bb8bfaa055ddf5efee422290e034b463aa154b X-Git-Newrev: b1e304cbd310a6bf36356ccb87aba24f03881885 Message-Id: <20220530150705.73489383D80C@sourceware.org> Date: Mon, 30 May 2022 15:07:05 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 15:07:05 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Db1e304cbd31= 0a6bf36356ccb87aba24f03881885 commit b1e304cbd310a6bf36356ccb87aba24f03881885 Author: Ken Brown Date: Tue May 24 10:25:06 2022 -0400 Cygwin: remove 32-bit only clipboard code Diff: --- winsup/cygwin/fhandler_clipboard.cc | 16 ---------------- winsup/cygwin/include/sys/clipboard.h | 23 ++++------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_c= lipboard.cc index 9515795e4..ae6de4551 100644 --- a/winsup/cygwin/fhandler_clipboard.cc +++ b/winsup/cygwin/fhandler_clipboard.cc @@ -68,14 +68,6 @@ fhandler_dev_clipboard::set_clipboard (const void *buf, = size_t len) clipbuf =3D (cygcb_t *) GlobalLock (hmem); =20 clock_gettime (CLOCK_REALTIME, &clipbuf->ts); -#ifdef __x86_64__ - /* ts overlays cb_sec and cb_nsec such that no conversion is needed = */ -#elif __i386__ - /* Expand 32-bit timespec layout to 64-bit layout. - NOTE: Steps must be done in this order to avoid data loss. */ - clipbuf->cb_nsec =3D clipbuf->ts.tv_nsec; - clipbuf->cb_sec =3D clipbuf->ts.tv_sec; -#endif clipbuf->cb_size =3D len; memcpy (clipbuf->cb_data, buf, len); // append user-supplied data =20 @@ -180,14 +172,6 @@ fhandler_dev_clipboard::fstat (struct stat *buf) && (hglb =3D GetClipboardData (format)) && (clipbuf =3D (cygcb_t *) GlobalLock (hglb))) { -#ifdef __x86_64__ - /* ts overlays cb_sec and cb_nsec such that no conversion is needed */ -#elif __i386__ - /* Compress 64-bit timespec layout to 32-bit layout. - NOTE: Steps must be done in this order to avoid data loss. */ - clipbuf->ts.tv_sec =3D clipbuf->cb_sec; - clipbuf->ts.tv_nsec =3D clipbuf->cb_nsec; -#endif buf->st_atim =3D buf->st_mtim =3D clipbuf->ts; buf->st_size =3D clipbuf->cb_size; GlobalUnlock (hglb); diff --git a/winsup/cygwin/include/sys/clipboard.h b/winsup/cygwin/include/= sys/clipboard.h index 932fe98d9..e3901d0c8 100644 --- a/winsup/cygwin/include/sys/clipboard.h +++ b/winsup/cygwin/include/sys/clipboard.h @@ -17,33 +17,18 @@ details. */ =20 static const WCHAR *CYGWIN_NATIVE =3D L"CYGWIN_NATIVE_CLIPBOARD"; =20 -/* - * The following layout of cygcb_t is new with Cygwin 3.3.0. It aids in t= he - * transfer of clipboard contents between 32- and 64-bit Cygwin environmen= ts. - */ typedef struct { union { - /* - * Note that ts below overlays the struct following it. On 32-bit Cyg= win - * timespec values have to be converted to|from cygcb_t layout. On 64= -bit - * Cygwin timespec values perfectly conform to the struct following, so - * no conversion is needed. - * - * We avoid directly using 'struct timespec' or 'size_t' here because = they - * are different sizes on different architectures. When copy/pasting - * between 32- and 64-bit Cygwin, the pasted data could appear corrupt= ed, - * or partially interpreted as a size which can cause an access violat= ion. - */ - struct timespec ts; // 8 bytes on 32-bit Cygwin, 16 bytes on 64-bit C= ygwin + struct timespec ts; struct { - uint64_t cb_sec; // 8 bytes everywhere - uint64_t cb_nsec; // 8 bytes everywhere + uint64_t cb_sec; // =3D=3D ts.tv_sec + uint64_t cb_nsec; // =3D=3D ts.tv_nsec }; }; - uint64_t cb_size; // 8 bytes everywhere + uint64_t cb_size; char cb_data[]; } cygcb_t;