]> cygwin.com Git - cygwin-apps/cygutils.git/commitdiff
Update to released 1.4.16-6 content
authorMark Geisert <mark@maxrnd.com>
Sat, 25 Sep 2021 05:47:04 +0000 (22:47 -0700)
committerMark Geisert <mark@maxrnd.com>
Sat, 25 Sep 2021 05:47:04 +0000 (22:47 -0700)
ChangeLog
Makefile.am
cygutils.cygport
src/clip/getclip.c
src/clip/putclip.c

index 07a75a3f7caa59f1a743980684d6ac682d418646..8a4bafd2fc19b6e335f91356aac8822adde9a957 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,18 @@
-2021-08-24  Mark Geisert  <mark@maxrnd.com>
+2021-08-28  Mark Geisert  <mark@maxrnd.com>  (1.4.16-6)
+
+       * src/clip/putclip.c: Supply terminator for Unicode input lacking it.
+       Add diagnostic for OpenClipboard() failure that results in "Couldn't
+       write CF_TEXT format to the clipboard" error message.  Thanks to
+       Takashi Yano for the reports.
+       * Makefile.am: src_clip_getclip_LDADD no longer needs -lkernel32.
+
+2021-08-24  Mark Geisert  <mark@maxrnd.com>  (1.4.16-5)
 
        * src/clip/putclip.c: Fix broken Unicode support. Don't GlobalFree a
        handle that's been transferred to the system by SetClipboardData().
        Thanks to Christian Franke for that last bit.
 
-2021-08-15  Mark Geisert  <mark@maxrnd.com>
+2021-08-15  Mark Geisert  <mark@maxrnd.com>  (1.4.16-4)
 
        * Makefile.am: Add -lkernel32 to src_clip_getclip_LDADD.  This somehow
        didn't make it into the released -3 package.  Thank you Takashi Yano.
@@ -14,7 +22,7 @@
        * src/cygdrop/cygdrop.cc: Fix crash with recent gcc and fix printf
        format strings. Thank you Christian Franke.
 
-2021-07-05  Mark Geisert  <mark@maxrnd.com>
+2021-07-05  Mark Geisert  <mark@maxrnd.com>  (1.4.16-3)
 
        * src/clip/getclip.c: Add Unicode support.
 
index bcad1c6c7531206bb0f8790f1b47d7f165434466..79eb2b1dec33494136928e845c2388d17dfab758 100644 (file)
@@ -117,7 +117,7 @@ DISTCLEANFILES = \
 
 libuuid = `${CC} -print-file-name=w32api/libuuid.a`
 src_banner_banner_LDADD             = -lpopt -lkernel32 -lgdi32
-src_clip_getclip_LDADD              = -lpopt -lkernel32
+src_clip_getclip_LDADD              = -lpopt
 src_clip_putclip_LDADD              = -lpopt
 src_conv_conv_LDADD                 = -lpopt
 src_cygstart_cygstart_LDADD         = -lpopt
index 188f2788454ffcb035a404dc9190e21152046968..0ef1e384f9d787d35541b6eb8a1c9b7223afb661 100644 (file)
@@ -1,6 +1,6 @@
 NAME=cygutils
 VERSION=1.4.16
-RELEASE=5
+RELEASE=6
 
 SUMM="A collection of simple utilities"
 DESC="A collection of simple (single source file) utilities, including"
index e9300ea42476a4be5e34d3f79f23a8e5a4c087c5..82e70700c4db5bd594c3f31bf55b9303a1a30504 100644 (file)
@@ -434,7 +434,7 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
                   DWORD err = GetLastError ();
                   /* look up error code displayed here in w32api/winerror.h */
-                  fprintf (stderr, "WideCharToMultiByte returns %d\n", err);
+                  fprintf (stderr, "WideCharToMultiByte returns %ld\n", err);
 #endif
                 }
               free (dst);
index 5919883bf51a12f5704c8e52a4342b95d612ce4a..76bddebaad7cb04189bdd372776f8abdfedc6718 100644 (file)
@@ -401,7 +401,16 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       const char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD";
       UINT cygnativeformat;
 
-      OpenClipboard (0);
+      if (!OpenClipboard (0))
+        {
+          fprintf (stderr, "Unable to open the clipboard\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "OpenClipboard returns %ld\n", err);
+#endif
+          return (PUTCLIP_ERR);
+        }
       cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
       CloseClipboard ();
 
@@ -520,7 +529,18 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 
       /* Allocate memory and copy the string to it */
       /* cygwin native format */
-      OpenClipboard (0);
+      if (!OpenClipboard (0))
+        {
+          fprintf (stderr, "Unable to open the clipboard\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "OpenClipboard returns %ld\n", err);
+#endif
+          if (convbuf)
+            free (convbuf);
+          return (PUTCLIP_ERR);
+        }
       if (cygNewFormat)
        hData = GlobalAlloc (GMEM_MOVEABLE, convlen + sizeof (cygcb_t));
       else
@@ -559,6 +579,11 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
           fprintf (f,
                    "Couldn't write native format to the clipboard %04x %x\n",
                    cygnativeformat, hData);
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+#endif
           free (convbuf);
           return (PUTCLIP_ERR);
         }
@@ -576,7 +601,17 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       clipbuf = NULL;
 
       /* CF_UNICODETEXT format */
-      OpenClipboard (0);
+      if (!OpenClipboard (0))
+        {
+          fprintf (f, "Unable to open the clipboard\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "OpenClipboard returns %ld\n", err);
+#endif
+          free (convbuf);
+          return (PUTCLIP_ERR);
+        }
       if (!(hData = GlobalAlloc (GMEM_MOVEABLE, sizeof (WCHAR) * convlen + 2)))
         {
           fprintf (f, "Couldn't allocate global buffer for write.\n");
@@ -597,11 +632,12 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
 #if DEBUGGING
           DWORD err = GetLastError ();
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "MultiByteToWideChar returns %d\n", err);
+          fprintf (stderr, "MultiByteToWideChar returns %ld\n", err);
 #endif
         }
       else /* res != 0 */
         {
+          *((WCHAR *) clipbuf + res) = 0; /* NULL-terminate just in case */
 #if DEBUGGING
           fprintf (stderr, "len %d, convlen %d, res %d\n", len, convlen, res);
 #endif
@@ -611,6 +647,11 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       if (!SetClipboardData (CF_UNICODETEXT, hData))
         {
           fprintf (f, "Couldn't write CF_UNICODETEXT format to the clipboard.\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+#endif
           free (convbuf);
           return (PUTCLIP_ERR);
         }
@@ -628,7 +669,17 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       clipbuf = NULL;
 
       /* CF_TEXT format */
-      OpenClipboard (0);
+      if (!OpenClipboard (0))
+        {
+          fprintf (f, "Unable to open the clipboard\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "OpenClipboard returns %ld\n", err);
+#endif
+          free (convbuf);
+          return (PUTCLIP_ERR);
+        }
       if (!(hData = GlobalAlloc (GMEM_MOVEABLE, convlen + 2)))
         {
           fprintf (f, "Couldn't allocate global buffer for write.\n");
@@ -650,6 +701,11 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
       if (!SetClipboardData (CF_TEXT, hData))
         {
           fprintf (f, "Couldn't write CF_TEXT format to the clipboard.\n");
+#if DEBUGGING
+          DWORD err = GetLastError ();
+          /* look up error code displayed here in w32api/winerror.h */
+          fprintf (stderr, "SetClipboardData returns %ld\n", err);
+#endif
           free (convbuf);
           return (PUTCLIP_ERR);
         }
This page took 0.037579 seconds and 5 git commands to generate.