From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: num_in_chars incremented after each mbrtowc()
Date: Sun, 6 Dec 2015 11:24:23 +0100 [thread overview]
Message-ID: <CAKc7PVDcSUiVzR_c1nT3c7XjbNOwq4D49dci4H3b+JVnez9WSw@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVCmApbPrfcArqxJcDX0nHN9NmuE7zqcrSZb51bSfGyuuQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
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@gmail.com> 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
[-- Attachment #2: num_in_char2.diff --]
[-- Type: text/plain, Size: 483 bytes --]
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);
next prev parent reply other threads:[~2015-12-06 10:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-06 9:37 Sebastian Gniazdowski
2015-12-06 10:24 ` Sebastian Gniazdowski [this message]
2015-12-06 15:49 ` Peter Stephenson
2015-12-06 16:40 ` Sebastian Gniazdowski
2015-12-06 17:13 ` Peter Stephenson
2015-12-06 17:03 ` Sebastian Gniazdowski
2015-12-06 17:33 ` Peter Stephenson
2015-12-06 17:40 ` Peter Stephenson
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=CAKc7PVDcSUiVzR_c1nT3c7XjbNOwq4D49dci4H3b+JVnez9WSw@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=zsh-workers@zsh.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).