From: Mark Geisert Date: Sat, 25 Sep 2021 05:37:55 +0000 (-0700) Subject: Update to released 1.4.16-4 content X-Git-Tag: v1_4_17~7 X-Git-Url: https://cygwin.com/git/?a=commitdiff_plain;h=f7c4555aa83a128efee00202765c59344b565184;p=cygwin-apps%2Fcygutils.git Update to released 1.4.16-4 content --- diff --git a/ChangeLog b/ChangeLog index c67ee00..6542152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2021-08-15 Mark Geisert + + * Makefile.am: Add -lkernel32 to src_clip_getclip_LDADD. This somehow + 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. + * src/cygdrop/cygdrop.cc: Fix crash with recent gcc and fix printf + format strings. Thank you Christian Franke. + +2021-07-05 Mark Geisert + + * src/clip/getclip.c: Add Unicode support. + 2017-07-03 Mark Geisert Release 1.4.16 diff --git a/Makefile.am b/Makefile.am index 79eb2b1..bcad1c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 +src_clip_getclip_LDADD = -lpopt -lkernel32 src_clip_putclip_LDADD = -lpopt src_conv_conv_LDADD = -lpopt src_cygstart_cygstart_LDADD = -lpopt diff --git a/NEWS b/NEWS index dbc9879..99914d4 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ * Minor formatting fixes to quash compiler warnings. * Execute bits removed from files not needing them. * Temporarily rename /usr/lib/libpopt.la while building package. + * Unicode support added to getclip. 1.4.15 New maintainer Mark Geisert . diff --git a/cygutils.cygport b/cygutils.cygport index 6f603aa..398e433 100644 --- a/cygutils.cygport +++ b/cygutils.cygport @@ -1,6 +1,6 @@ NAME=cygutils VERSION=1.4.16 -RELEASE=3 +RELEASE=4 SUMM="A collection of simple utilities" DESC="A collection of simple (single source file) utilities, including" diff --git a/src/clip/getclip.c b/src/clip/getclip.c index 21eef59..e9300ea 100644 --- a/src/clip/getclip.c +++ b/src/clip/getclip.c @@ -31,9 +31,7 @@ #include #include #include -#include -/* This Windows 7+ function is not yet present in w32api/winternl.h */ -extern NTSYSAPI NTSTATUS RtlUnicodeToUTF8N(PCHAR, ULONG, PULONG, LPWSTR, ULONG); +#include #define DEBUGGING 0 // Set 1 to display debug output on stderr @@ -424,19 +422,21 @@ getclip (FILE * out, flags_struct flags, FILE * f, char *name) LPWSTR lpwstr = (LPWSTR) GlobalLock (hglb); if (lpwstr) { - ULONG count; - ULONG srclen = wcslen (lpwstr) * sizeof (wchar_t); // byte count - ULONG dstlen = srclen + 32; - PCHAR dst = (PCHAR) malloc (dstlen); - NTSTATUS res = RtlUnicodeToUTF8N (dst, dstlen, &count, - lpwstr, srclen); + int srclen = wcslen (lpwstr); // wide-char count + int dstlen = srclen << 2; // byte count + LPSTR dst = (LPSTR) malloc (dstlen); + int res = WideCharToMultiByte (CP_UTF8, 0, lpwstr, srclen, + dst, dstlen, NULL, NULL); + if (res > 0) + fwrite (dst, sizeof (char), res, out); + else if (res == 0) + { #if DEBUGGING - /* look up hex error code displayed here in w32api/ntstatus.h */ - fprintf (stderr, "RtlUnicodeToUTF8N returns 0x%X\n", res); + DWORD err = GetLastError (); + /* look up error code displayed here in w32api/winerror.h */ + fprintf (stderr, "WideCharToMultiByte returns %d\n", err); #endif - if (res == STATUS_SUCCESS || res == STATUS_SOME_NOT_MAPPED) - if (count > 0) - fwrite (dst, sizeof (char), count, out); + } free (dst); GlobalUnlock (hglb); } diff --git a/src/cygdrop/cygdrop.cc b/src/cygdrop/cygdrop.cc index 35bcc19..0c036bb 100644 --- a/src/cygdrop/cygdrop.cc +++ b/src/cygdrop/cygdrop.cc @@ -39,7 +39,7 @@ static void help (FILE * f, const char *name); static void version (FILE * f, const char *name); static void license (FILE * f, const char *name); -static int +static void usageCore (FILE * f, const char * name) { fprintf (f, @@ -378,7 +378,7 @@ main (int argc, char **argv) ? " [logon_id]" : "")); const struct group * g = strsid_to_group (strsid); if (g) - printf (" gid=%lu(%s)", g->gr_gid, g->gr_name); + printf (" gid=%u(%s)", (unsigned) g->gr_gid, g->gr_name); printf ("\n"); } @@ -415,7 +415,7 @@ main (int argc, char **argv) printf ("r %s", strsid); const struct group * g = strsid_to_group (strsid); if (g) - printf (" gid=%lu(%s)", g->gr_gid, g->gr_name); + printf (" gid=%u(%s)", (unsigned) g->gr_gid, g->gr_name); printf ("\n"); }