#define HAVE_VSNPRINTF 1
#define vsnprintf _vsnprintf
+
+#define HAVE_SNPRINTF 1
+#define snprintf _snprintf
AM_CONDITIONAL([INCLUDED_JPEG], [ test "x$INCLUDED_JPEG" = xyes ])
AC_CONFIG_SUBDIRS([jpeg])
-AC_CHECK_FUNCS_ONCE([vsnprintf strcasecmp strncasecmp getaddrinfo])
+AC_CHECK_FUNCS_ONCE([vsnprintf snprintf strcasecmp strncasecmp getaddrinfo])
AC_CHECK_TYPES([socklen_t],
[AC_DEFINE([VNC_SOCKLEN_T], [socklen_t], [Use correct size])],
//#include <io.h>
#include <winsock2.h>
#define errorNumber WSAGetLastError()
-#define snprintf _snprintf
#ifndef VNC_SOCKLEN_T
#define VNC_SOCKLEN_T int
#endif
}
#endif /* HAVE_VSNPRINTF */
+#ifndef HAVE_SNPRINTF
+int tight_snprintf(char *str, size_t n, const char *format, ...) {
+ va_list ap;
+ int written;
+
+ va_start(ap, format);
+ written = vsnprintf(str, n, format, ap);
+ va_end(ap);
+
+ return written;
+}
+#endif /* HAVE_SNPRINTF */
+
#define vsnprintf tight_vsnprintf
#endif
+#ifndef HAVE_SNPRINTF
+/* Inherits tight_vsnprintf limitations if vsnprintf is not present */
+int tight_snprintf(char *str, size_t n, const char *format, ...);
+#define snprintf tight_snprintf
+#endif
+
#ifdef __cplusplus
};
#endif