zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: num_in_chars incremented after each mbrtowc()
Date: Sun, 6 Dec 2015 18:03:08 +0100	[thread overview]
Message-ID: <CAKc7PVDCiREGLtGP+SQbpoG74bBFtdn-EnSo31dYwr7xMNx+og@mail.gmail.com> (raw)
In-Reply-To: <20151206154956.104b10c6@ntlworld.com>

On 6 December 2015 at 16:49, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> On Sun, 6 Dec 2015 10:37:21 +0100
> Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> Somebody complained about this function a couple of months ago and I
> explained, then, too; it suggests it needs some more comments, so I've
> added some.

It was me that complained. I couldn't get through to you with message
that num_in_char should be treated as representing single character.
Now you've written the same:

> +            * "num_in_char" is only used for incomplete characters.  The
> +            * assumption is that we will output this octet as a single
> +            * character (of single width) if we don't get a complete
> +            * character; if we do get a complete character, num_in_char

So, despite having num_in_char arbitrarily large, it represents single
character. The code in mb_metastrlenend() does something else:

    /* If incomplete, treat remainder as trailing single bytes */
    return num + num_in_char;

It should be:
    return num + num_in_char > 0 ? 1 : 0;

Best regards,
Sebastian Gniazdowski


  parent reply	other threads:[~2015-12-06 17:03 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
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 [this message]
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=CAKc7PVDCiREGLtGP+SQbpoG74bBFtdn-EnSo31dYwr7xMNx+og@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=p.w.stephenson@ntlworld.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).