Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: num_in_chars incremented after each mbrtowc()
- X-seq: zsh-workers 37324
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: num_in_chars incremented after each mbrtowc()
- Date: Sun, 6 Dec 2015 11:24:23 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Qg4vkn/c8TsByrrGqbfZcwc6bRRoYYdR0mOTRRNM4uI=; b=LA9MxvV5tgQg1yueoj4vxL+Y8hTLCnh4mrpuAygDR+iAMMp29IZkT4NffwHJKeXn0o Lsycpp3dbp9wAnbn/g0OFtWXKnCHk7trC1id2RwBRXsDW+fVhYv/hdHjMYxajfR7O7Xd BloUzHyz2nJMVCVhniB1nLjAQq11nofiVnJtf5d27rpXfJVfRj/6k8b9XG9h/A06J42L P7weJMi6DFjtWK7y68All3utOTXbptnQUqtq37U8EImLrzDUQADRVc1cPXzdfbvnRBos 4Uzg9ClHshriI5o7n1jzi+2dZzb+ZyJcHKC/8luDY3SWJvkbaOKzJZcHR72/NFpJw6gE vztw==
- In-reply-to: <CAKc7PVCmApbPrfcArqxJcDX0nHN9NmuE7zqcrSZb51bSfGyuuQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCmApbPrfcArqxJcDX0nHN9NmuE7zqcrSZb51bSfGyuuQ@mail.gmail.com>
Found one other missing incrementation of num_in_char. Diff against
utils.c with the previous patch applied
Best regards,
Sebastian Gniazdowski
On 6 December 2015 at 10:37, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> while working my hands off on implementing display width handling in
> params.c rather than subst.c I encountered a bug in mb_metastrlenend.
> It will reveal itself only on improper unicode strings.
>
> Best regards,
> Sebastian Gniazdowski
diff --git a/Src/utils.c b/Src/utils.c
index b0a6625..d42d5c3 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5066,9 +5066,10 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
memset(&mb_shiftstate, 0, sizeof(mb_shiftstate));
while (*ptr && !(eptr && ptr >= eptr)) {
- if (*ptr == Meta)
+ if (*ptr == Meta) {
inchar = *++ptr ^ 32;
- else
+ num_in_char++;
+ } else
inchar = *ptr;
ptr++;
ret = mbrtowc(&wc, &inchar, 1, &mb_shiftstate);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author