]> cygwin.com Git - cygwin-apps/cygutils.git/commitdiff
Fold in latest clip fixes master v1_4_17
authorMark Geisert <mark@maxrnd.com>
Fri, 28 Jan 2022 09:07:45 +0000 (01:07 -0800)
committerMark Geisert <mark@maxrnd.com>
Fri, 28 Jan 2022 09:07:45 +0000 (01:07 -0800)
BRANCHES
ChangeLog
NEWS
configure.ac
cygutils.cygport
src/clip/getclip.c
src/clip/putclip.c

index 753f632a441b12da44f51f44cbff50578c2c9a71..f0a432cb1a7c09c66f3d1fa20d96430dba8c5dc2 100644 (file)
--- a/BRANCHES
+++ b/BRANCHES
@@ -104,3 +104,5 @@ v1_4_14
 v1_4_15
    |
 v1_4_16
+   |
+v1_4_17
index 98e8d408ae08467f2c202bd06a913decc767ef90..0a1709cb9f1ac41f92838323fad46b17e20cc00c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,26 @@
+2022-01-28  Mark Geisert  <mark@maxrnd.com>
+
+       Release 1.4.17
+       * configure.ac: Bump version number to 1.4.17.
+       * BRANCHES: Ditto.
+       * cygutils.cygport: Ditto.
+       * src/clip/getclip.c: Fix segfault on xterm selections. Thanks to
+       Denis Excoffier for the report, Brian Inglis, Andrey Repin, and Jon
+       Turney for the discussion.
+       * src/clip/putclip.c: Add missing 32/64 timespec expansion. Thanks to
+       Takashi Yano for the report and investigation.
+       * src/clip/putclip.c: Make sure allocated buf is large enough to
+       append a NUL character. Thanks to Marco Atzeri for the report.
+       * src/clip/putclip.c: Add debugging feature to allow a file name in
+       argv (undocumented).
+
 2021-11-03  Mark Geisert  <mark@maxrnd.com>  (1.4.16-8)
 
        * src/clip/{get,put}clip.c: Replace use of Windows UTF-8 conversion
        functions with corresponding POSIX functions. MultiByteToWideChar->
        mbstowcs, WideCharToMultiByte->wcstombs. Thanks to Takashi Yano.
-       * src/putclip.c: Have putclip open the clipboard just once instead
-       of multiple times for multiple formats. Thanks to Takashi Yano.
+       * src/clip/putclip.c: Have putclip open the clipboard just once
+       instead of multiple times for multiple formats. Thanks to Takashi Yano.
 
 2021-09-23  Mark Geisert  <mark@maxrnd.com>  (1.4.16-7)
 
@@ -32,7 +48,7 @@
        didn't make it into the released -3 package.  Thank you Takashi Yano.
        * Fix maintainer build environment issues that caused cygstart crash
        on non-AVX user systems: Thank you Takashi Yano, Brian Inglis, Achim
-       Gratz and user Jay Abel for reporting the issue.
+       Gratz, and user Jay Abel for reporting the issue.
        * src/cygdrop/cygdrop.cc: Fix crash with recent gcc and fix printf
        format strings. Thank you Christian Franke.
 
diff --git a/NEWS b/NEWS
index f1cedc08529c86cc89c727439c449a09d6f46d7e..3b42b6220b3c7dfa282dab66fe617e3fb04709e7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+1.4.17
+  * More bug fixes to getclip and putclip.
+
 1.4.16
   * Unicode support added to mkshortcut and readshortcut by Thomas Wolff.
   * Minor formatting fixes to quash compiler warnings.
index 830f1bfdda6b6e4236bf41cb39cea160ad7339c3..ce5b38aa17dd42941ed25c54fa84e8801f07e426 100644 (file)
@@ -1,6 +1,6 @@
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.69)
-AC_INIT(cygutils, 1.4.16, cygwin@cygwin.com)
+AC_INIT(cygutils, 1.4.17, cygwin@cygwin.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
index d2ca1f56ff4edf18373f2813b3ad8edd81f2f552..9898b510d66aa607f8e94a8749a473a87e1845fe 100644 (file)
@@ -1,6 +1,6 @@
 NAME=cygutils
-VERSION=1.4.16
-RELEASE=7
+VERSION=1.4.17
+RELEASE=1
 
 SUMM="A collection of simple utilities"
 DESC="A collection of simple (single source file) utilities, including"
index 4dbaa9786683cc43438974fa806c32dccf7a9c99..4f422d98c5e6db4e1a2deb4abfec040d055415a0 100644 (file)
@@ -479,7 +479,9 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
       char *prev;
       char *curr;
       char *pos;
+#if DEBUGGING
       UINT format;
+#endif
 
       OpenClipboard (0);
 #if DEBUGGING
@@ -505,7 +507,7 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
           DWORD err = GetLastError ();
 #if DEBUGGING
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "GetClipboardData returns %ld\n", err);
+          fprintf (stderr, "GetClipboardData returns %d\n", err);
 #endif
           CloseClipboard ();
           return err != 0;
@@ -563,7 +565,9 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
       char *prev;
       char *curr;
       char *pos;
+#if DEBUGGING
       UINT format;
+#endif
 
       OpenClipboard (0);
 #if DEBUGGING
@@ -589,7 +593,7 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name)
           DWORD err = GetLastError ();
 #if DEBUGGING
           /* look up error code displayed here in w32api/winerror.h */
-          fprintf (stderr, "GetClipboardData returns %ld\n", err);
+          fprintf (stderr, "GetClipboardData returns %d\n", err);
 #endif
           CloseClipboard ();
           return err != 0;
index fb54416363db22815c0d96eba51137a004aae4b1..ff0e4b839342ac19c021d1d1ae2a4fa4a16d0789 100644 (file)
@@ -203,9 +203,21 @@ main (int argc, const char **argv)
 
   setlocale (LC_ALL, "");
   if (rest == NULL)
+#if DEBUGGING
+ready:
+#endif
     ec |= putclip (stdin, flags, stderr, program_name);
   else
     {
+#if DEBUGGING
+      // undocumented debugging feature: read stdin from file named in argv
+      if (isalpha (**rest))
+        {
+          FILE *tmpin = freopen (*rest, "rb", stdin);
+          if (tmpin == stdin && !*(rest + 1))
+            goto ready;
+        }
+#endif
       fprintf (stderr, "Extra args ignored: ");
       while (*rest)
         fprintf (stderr, "%s ", *rest++);
@@ -409,6 +421,10 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
     {
       UINT cygnativeformat;
 
+      // make sure buf and copies of it have space for a NUL to be appended
+      // DO NOT CHANGE len TO ACCOUNT FOR THIS
+      buf = realloc (buf, len + 1);
+
       // if flags.endl_mode == ENDLMODE_NOCONV
       convbuf = buf;
       convlen = len;
@@ -530,7 +546,7 @@ 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, "OpenClipboard returns %ld\n", err);
+          fprintf (stderr, "OpenClipboard returns %d\n", err);
 #endif
           goto failout2;
         }
@@ -573,7 +589,7 @@ putclip (FILE * in, flags_struct flags, FILE * f, char *name)
           clipbufX->cb_sec  = clipbufX->ts.tv_sec;
 #endif
           clipbufX->cb_size = convlen;
-          memcpy (&clipbufX[1], convbuf, convlen);
+          memcpy (((char *) clipbufX) + sizeof (cygcb_t), convbuf, convlen);
         }
       else if (cygNewFormat == 1)
         {
@@ -597,7 +613,7 @@ 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, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }
@@ -647,7 +663,7 @@ 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, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }
@@ -685,7 +701,7 @@ 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, "SetClipboardData returns %ld\n", err);
+          fprintf (stderr, "SetClipboardData returns %d\n", err);
 #endif
           goto failout;
         }
This page took 0.036921 seconds and 5 git commands to generate.