Anders Broman wrote:
Hi, Would this patch work on unix it works for me on MSVC6:
Won't work with my linux+glibc. This is another case of M$ choosing to implement those standards that suit them. You could wrap them with "#ifdef _MSC_VER" or "#define vsnprintf _vsnprintf" in win.h.
MSVC8 gives lots of other "you should use _xxx instead of xxx" warnings.
The #define method is probably the simpler one, since it covers the entire build in one hit, and the same method would work for all the other warnings.
Index: dstring.c
--- dstring.c (revision 8016) +++ dstring.c (working copy) @@ -147,7 +147,7 @@ o = ds->len; while (1) { va_copy(ap, _ap);
n = vsnprintf(ds->str + o, ds->len+1 - o, format, ap);
n = _vsnprintf(ds->str + o, ds->len+1 - o, format, ap); va_end(ap); if (n > -1 && n+o <= ds->len) { if (n+o < ds->len) {
@@ -186,7 +186,7 @@ if (ds) { while (1) { va_copy(ap, _ap);
n = vsnprintf(ds->str, ds->len+1, format, ap);
n = _vsnprintf(ds->str, ds->len+1, format, ap); va_end(ap); if (n > -1 && n <= ds->len) { if (n < ds->len) {
Regards Anders