public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: glob: fix conversion from UTF-32 to multibyte Date: Fri, 3 Mar 2023 17:20:29 +0000 (GMT) [thread overview] Message-ID: <20230303172029.D5C5B3858D37@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6bc687e35d6a74b4b9d8531c73b3f6cc571bc744 commit 6bc687e35d6a74b4b9d8531c73b3f6cc571bc744 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Fri Mar 3 11:32:31 2023 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Fri Mar 3 18:19:17 2023 +0100 Cygwin: glob: fix conversion from UTF-32 to multibyte The conversion function g_Ctoc missed to drop the flag values from the wint_t value. That wasn't noticable with the original version because it used a 64 bit Char type and the flags were in the upper 32 bit region. So the flag values were silently dropped when wcrtomb was called. After converting Char to wint_t, we have to do drop the flags explicitely. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/glob.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/glob.cc b/winsup/cygwin/glob.cc index dadc67e4c10a..4730d09f5590 100644 --- a/winsup/cygwin/glob.cc +++ b/winsup/cygwin/glob.cc @@ -130,7 +130,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/glob.c,v 1.28 2010/05/12 17:44:00 gordon Ex #define M_PROTECT 0x20000000U #define M_MASK 0x70ffffffU #define M_COLL_MASK 0x700000ffU -#define M_CHAR 0x0fffffffU +#define M_CHAR 0x00ffffffU typedef wint_t Char; @@ -1030,7 +1030,7 @@ g_Ctoc(const Char *str, char *buf, size_t len) memset(&mbs, 0, sizeof(mbs)); while (len >= (size_t) MB_CUR_MAX) { - clen = wirtomb(buf, *str, &mbs); + clen = wirtomb(buf, CHAR (*str), &mbs); if (clen == (size_t)-1) return (1); if (*str == L'\0')
reply other threads:[~2023-03-03 17:20 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=20230303172029.D5C5B3858D37@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-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).