On Sat, Jan 05, 2002 at 08:22:24PM +0200, Andi Gutmans wrote:
> You're missing the point. In order to minimize the amount of API misuse of 
> the str*cat() family of functions we decided only to use the ones I 
> mentioned, everywhere. I am sure that you're code is correct but all places 
> should use strlcat()/strlcpy() if they are using the str* family of 
> functions.

in all due respect, i think you're missing my point. wordwrap() copies
chunks from the middle of the source string to the end of the
destination string. neither strlcpy() nor strlcat() is useful in this
situation, because all they take is the length of the destination
buffer, not a length of characters to copy from the source.

  char *source = "this is my string";
  strncpy(dest, source+5, 5); // copy 'is my' to dest.

i guess you could use strlcat() if you kept track of the current end
position of the destination string and then lied about the size of the
destination string so only the right number of characters were copied
from the source, but that seems a rather obtuse way to do it.

in any case, i'm working on a memcpy()-based rewrite. i don't know that
it is really useful for wordwrap() to be binary-safe, but that will be
one of the side-effects. :)

jim

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to