summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-03-10 20:36:44 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-03-10 20:36:44 +0100
commit6ad1ef901b7a07bc8b070e64c4bf5e53f708cb7b (patch)
tree91ba47496c1be5fb3ef895f254fad5af41705a93 /include
parent4d32ec5ab668d02c5b3dee83f0d8275b70e9014d (diff)
downloadwolfbones-6ad1ef901b7a07bc8b070e64c4bf5e53f708cb7b.tar.gz
wolfbones-6ad1ef901b7a07bc8b070e64c4bf5e53f708cb7b.tar.bz2
fixed snprintf on native Windows
Diffstat (limited to 'include')
-rw-r--r--include/wolf/port/stdio.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/include/wolf/port/stdio.h b/include/wolf/port/stdio.h
index 03e4d77..e72743c 100644
--- a/include/wolf/port/stdio.h
+++ b/include/wolf/port/stdio.h
@@ -33,14 +33,30 @@
#include <stdio.h>
+/* snprintf: a disaster, there are several versions out there. They
+ * differ in:
+ * - what they return: BSD and C99 stipulates the number of character which
+ * would be needed to map the whole string (which is the version we must
+ * stick to). Some other versions return -1 and ERANGE/EOVERFLOW in the
+ * the case of an overflow (notably older GNU C libraries)
+ * - what format string options they support:
+ * - some older Sun snprintf's were famous for being wrong in the floating
+ * point format placeholders
+ * - if they work at all (for instance sprintf_s on Windows 32k happily
+ * crashes the runnig process)! Also some older Solaris versions are
+ * known to have terrible bugs.
+ */
+
/* TODO: check which features we need in snprintf, make sure the platform one supports it,
* otherwise we take the stub */
/* TODO: also clean up mess here with autoconf relicts! */
-#if defined _WIN32
-/* secure snprintf on Wndows is called differently */
-#define snprintf sprintf_s
-#else
+#if defined _WIN32
+/* secure snprintf on Wndows is called differently, but not working
+ * we don't take sprintf_s
+ */
+//#define snprintf sprintf_s
+#endif
#include <stdarg.h> /* for va_list */
@@ -61,8 +77,6 @@ extern int rpl_vsnprintf( char *str, size_t size, const char *format, va_list ar
#define vsnprintf( str, size, format, ap ) rpl_vsnprintf( str, size, format, ap )
#endif /* !defined HAVE_VSNPRINTF */
-#endif /* defined _WIN32 */
-
/** @} */ /* @addtogroup wolf_port */
#endif /* ifndef WOLF_STDIO_H */