Re: [reSIProcate] Visual Studio 2005 compilation warnings of 1.4 branch
Jason,
yeah, you're right, this mainly affects ares....
Adam,
> But it will be markedly slower when copying strings into buffers that
> are on the order of the correct size, which is by far the more common
> case -- you end up scanning the string twice to comply with the behavior
> specified for strcpy_s.
Very true, but I really doubt that it's possible to achieve the
Behavior of the *_s functions (ie. not to copy anything to the
dest buffer if it's not large enough) without iterating through
the string two times....
> If you want an alternate model to emulate, you're far better off with
> strlcpy -- you can perform the same checks as strcpy_s without the
> performance penalty (and it doesn't null-fill the buffer like strncpy).
I read about these strl* functions but I thought that those are
OpenBSD specific. If there are free implementations for all relevant
functions (not just for strlcpy) then I'd really be fine with
using this approach! (not just because it would avoid MSVC compiler
warnings ;-)
Best regards,
Matthias Moetje
TERASENS GmbH
Augustenstraße 24
80333 Munich
GERMANY