[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] rl_change_case: skip over invalid mbchars
From: |
Chet Ramey |
Subject: |
Re: [PATCH] rl_change_case: skip over invalid mbchars |
Date: |
Thu, 23 May 2024 10:25:35 -0400 |
User-agent: |
Mozilla Thunderbird |
On 5/21/24 2:42 PM, Grisha Levit wrote:
Avoid using (size_t)-1 as an offset.
I can't reproduce this on macOS. Where is the code that's using -1 as an
offset?
Also, not sure it makes sense to
change the case of an invalid byte cast to (wchar_t).
Bash and readline are pretty consistent about treating invalid multibyte
characters as a sequence of bytes. Maybe the thing to do here is to add a
goto to the single-byte case if m == (size_t)-1 or (size_t)-2, but
assigning a byte to a wchar_t variable isn't harmful, since wchar_t is
guaranteed to be an integral type.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature