[PATCH 1/2] Show 4 byte UTF-8 as \Uxxxxxxxx Simplify this by using a single uint32 rather than four bytes.
Alan Modra
amodra@gmail.com
Tue Sep 9 21:48:35 GMT 2025
On Tue, Sep 09, 2025 at 08:56:10PM +0100, Andrew C Aitchison wrote:
> On Tue, 9 Sep 2025, Andrew C Aitchison wrote:
>
> > ---
> > binutils/doc/binutils.texi | 32 +++++++++++++++++---------------
> > binutils/nm.c | 9 +++++----
> > binutils/objdump.c | 9 +++++----
> > binutils/readelf.c | 10 +++++-----
> > binutils/strings.c | 2 +-
> > 5 files changed, 33 insertions(+), 29 deletions(-)
>
> > diff --git a/binutils/objdump.c b/binutils/objdump.c
> > index 34199e30ab8..7fc7b6fb86d 100644
> > --- a/binutils/objdump.c
> > +++ b/binutils/objdump.c
> > @@ -658,10 +658,11 @@ display_utf8 (const unsigned char * in, char * out, unsigned int * consumed)
> > break;
> >
> > case 4:
> > - out += sprintf (out, "\\u%02x%02x%02x",
> > - ((in[0] & 0x07) << 2) | ((in[1] & 0x30) >> 4),
> > - ((in[1] & 0x0f) << 4) | ((in[2] & 0x3c) >> 2),
> > - ((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
> > +
> > +
> > +
> > +
> > +
>
> This is wrong.
> We should be calculating with the values of in[] no out[].
>
> I will cut a full new set of patches.
Please fix the formatting when you do that. No trailing operators.
--
Alan Modra
More information about the Binutils
mailing list