Re: [AD] Unicode again

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I'm shocked :)
> I would not have expected strncat to write one more byte.

I'm not :-)
We are manipulating NULL-terminated strings, I think every function should
ensure that its output is a NULL-terminated string.

> I would rather write
>
>    usetc(dest, 0);
>    ustrncat(dest, src, sizeof(dest));
>
> instead of:
>
> >    usetc(dest, 0);
> >    ustrncat(dest, src, sizeof(dest) - ucwidth(0));
>
> since the strn* calls are usually used to avoid buffer overflows.

That's obviously a problem: the 'natural' way would be to pass the buffer
size (and I just realized I did that for uvsnprintf() and usnprintf()...)
but then we'll get farther away from the ANSI standard.

> I didn't know about that "feature" of libc. But I still think it would be
> best to emulate its behavior as much as possible (at least if keeping the
> same names prepended by 'u').

Even if this leads to obvious inconsistencies ?

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/