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.

No, I meant that the routine, if outputting a terminating NULL, should
ensure that it does so in the bounds of the given size (effectively making
sure it substracts itself the needed space for the NULL from the given
size argument).

> > 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 ?

Inconsistency between Allegro routines ? If these are the same as the
inconsistencies between libc functions, then I think this is OK. If you
prefer another (more self consistent) behavior, it is still possible to
add either other functions or macros which alter the size parameter, as:

#define ustrnconcat(s,size) ustrncat((s),(size)-ucwidth(0))

--
Lyrian



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