RE: [AD] Unicode again

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


> The strn functions are supposed to be for avoiding buffer overflows, so
> what is the point of one that can sometimes leave a string unterminated?

This is a fait point, and I tend to agree with this because of the nature
of variable width characters, with which it is difficult to know where to
put them, which was your main point. But OTOH, I guess a fair amount of
people will convert a program to u* calls from libc ones. Most probably
this problem is already taken care of (I know that I always add a zero
terminator at the right place when I use the strn functions, and the porting
will be eased by having a set of u* calls that mimic the libc behavior. This
is not attainable though as unicode strings are not byte addressable, so my
point is probably moot anyway.

That said, I cringe at the idea of something writing more bytes than the
actual size passed ...

I think the best thing to do is to have two calls, one with the same name
and with similar behavior, and the another "fixed" one with a slightly
different name. Any takers ?

--
Lyrian



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