public inbox for cygwin-apps-cvs@sourceware.org help / color / mirror / Atom feed
From: Mark Geisert <mgeisert@sourceware.org> To: cygwin-apps-cvs@sourceware.org Subject: [cygutils - Chuck Wilson's collection of Cygwin utilities] branch master, updated. v1_4_16-11-g3e94e05 Date: Sun, 21 Nov 2021 10:16:33 +0000 (GMT) [thread overview] Message-ID: <20211121101633.221963858411@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygutils.git;h=3e94e050af7ad4ac84d12c18e9408e4c4f34cb56 commit 3e94e050af7ad4ac84d12c18e9408e4c4f34cb56 Author: Mark Geisert <mark@maxrnd.com> Date: Sun Nov 21 02:15:07 2021 -0800 Fix getclip segfault on xterm selections Diff: --- src/clip/getclip.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/clip/getclip.c b/src/clip/getclip.c index 5cdb8f1..4dbaa97 100644 --- a/src/clip/getclip.c +++ b/src/clip/getclip.c @@ -399,6 +399,9 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name) return (0); } +#if DEBUGGING + fprintf (stderr, "Using format: %u\n", format); +#endif hglb = GetClipboardData (format); if (format == cygnativeformat) @@ -476,9 +479,37 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name) char *prev; char *curr; char *pos; + UINT format; OpenClipboard (0); +#if DEBUGGING + { + fprintf (stderr, "ThreadLocale: %u\nClipboardFormats:", + GetThreadLocale ()); + format = 0; + do { + format = EnumClipboardFormats (format); + fprintf (stderr, " %u", format); + if (format == CF_LOCALE) + fprintf (stderr, "(%u)", *(LCID *) GetClipboardData (CF_LOCALE)); + } while (format != 0); + fprintf (stderr, "\n"); + } +#endif +#if DEBUGGING + fprintf (stderr, "Using format: %u\n", CF_TEXT); +#endif hglb = GetClipboardData (CF_TEXT); //TODO support CF_UNICODETEXT too? + if (!hglb) + { + DWORD err = GetLastError (); +#if DEBUGGING + /* look up error code displayed here in w32api/winerror.h */ + fprintf (stderr, "GetClipboardData returns %ld\n", err); +#endif + CloseClipboard (); + return err != 0; + } lpstr = GlobalLock (hglb); lplen = strlen (lpstr); @@ -532,9 +563,37 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name) char *prev; char *curr; char *pos; + UINT format; OpenClipboard (0); +#if DEBUGGING + { + fprintf (stderr, "ThreadLocale: %u\nClipboardFormats:", + GetThreadLocale ()); + format = 0; + do { + format = EnumClipboardFormats (format); + fprintf (stderr, " %u", format); + if (format == CF_LOCALE) + fprintf (stderr, "(%u)", *(LCID *) GetClipboardData (CF_LOCALE)); + } while (format != 0); + fprintf (stderr, "\n"); + } +#endif +#if DEBUGGING + fprintf (stderr, "Using format: %u\n", CF_TEXT); +#endif hglb = GetClipboardData (CF_TEXT); //TODO support CF_UNICODETEXT too? + if (!hglb) + { + DWORD err = GetLastError (); +#if DEBUGGING + /* look up error code displayed here in w32api/winerror.h */ + fprintf (stderr, "GetClipboardData returns %ld\n", err); +#endif + CloseClipboard (); + return err != 0; + } lpstr = GlobalLock (hglb); lplen = strlen (lpstr);
reply other threads:[~2021-11-21 10:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211121101633.221963858411@sourceware.org \ --to=mgeisert@sourceware.org \ --cc=cygwin-apps-cvs@sourceware.org \ /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: linkBe 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).