Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: num_in_chars incremented after each mbrtowc()
- X-seq: zsh-workers 37328
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: num_in_chars incremented after each mbrtowc()
- Date: Sun, 6 Dec 2015 18:03:08 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- 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 :cc:content-type; bh=8x62k7GPI80g6/Tj0l0VyjVwuikSaLTZ+UlUh8LbZKE=; b=S+WZRnXsdbzAvRJ74WV11W6oweuixhVO+jqG4hM5V/FTGrYKChhYGipDVO6yRx+F7E 4u2NmefsFJAEOEbsV5VJ1Cyvlfu6V1b24eCefJmP5aQhUjXBlnbiNBX1VlASKB804I6R abZJ2MZdSJWF+dwPzI4oE7PYwtutpB0B3D4HiCDvCHRRZ9n6BJESJAitFRYKGGk16pHU X0S0f+8vNOf0YZ4MF6AUVvFcplPpsbGG58GW0Dy4WN4B98BfrrHhsEQmLBwbQRW3mRnb fzHn97bH20mzEGKussKWZopNHazmC/KOOUyC6R8L2xz6ytUh8p/t3HJoPgwSo1XSLqI1 BNxA==
- In-reply-to: <20151206154956.104b10c6@ntlworld.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> <20151206154956.104b10c6@ntlworld.com>
On 6 December 2015 at 16:49, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sun, 6 Dec 2015 10:37:21 +0100
> Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author