Hi, How about this then: C:\libsmi\trunk\win>svn diff Index: win.h =================================================================== --- win.h (revision 8019) +++ win.h (working copy) @@ -79,5 +79,7 @@ #if defined(_MSC_VER) #define strtof(f1,f2) ((float)strtod(f1,f2)) #endif + +#define vsnprintf _vsnprintf
#endif /* _WIN_H */
Index: tools/dstring.c =================================================================== --- tools/dstring.c (revision 8019) +++ tools/dstring.c (working copy) @@ -17,6 +17,11 @@ #include <string.h> #include <stdarg.h> #include <stdio.h> + +#ifdef HAVE_WIN_H +#include "win.h" +#endif + #include "dstring.h"
#if !defined va_copy
--------------- I also found: fprint.c ...\tools\fprint.c(52) : warning C4013: 'smiVasprintf' undefined; assuming extern returning int ...\tools\fprint.c(77) : warning C4018: '>' : signed/unsigned mismatch
Qured by:
Index: tools/fprint.c =================================================================== --- tools/fprint.c (revision 8019) +++ tools/fprint.c (working copy) @@ -25,6 +25,7 @@ #include "win.h" #endif
+#include "smi.h" #include "fprint.h"
Regards Anders
-----Original Message----- From: Andrew Hood [mailto:ajhood@fl.net.au] Sent: den 11 april 2008 00:14 To: libsmi@ibr.cs.tu-bs.de Cc: Anders Broman Subject: Re: [libsmi] Problem with vsnprintf and MSVC6
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
-- There's no point in being grown up if you can't be childish sometimes. -- Dr. Who