RE: [AD] Unicode again

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


> Moreover ustrncat(), like the ANSI strncat(), always appends the NULL
> terminating character even if the specified 'n' bytes have already been
> written, so that

I'm shocked :)
I would not have expected strncat to write one more byte.
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.
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').

-- 
Lyrian 



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