]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Include stdint.h (where available) for uintptr_t.
authorSimon Tatham <anakin@pobox.com>
Mon, 28 Sep 2015 18:52:38 +0000 (19:52 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 28 Sep 2015 18:52:38 +0000 (19:52 +0100)
Commit f2e61275f introduced the use of uintptr_t, without adding an
include of <stdint.h> which is where the C standard says that type
should be defined. This didn't cause a build failure, because Visual
Studio also defines it in <stddef.h> which we do include. But a user
points out that other Windows toolchains - e.g. MinGW - don't
necessarily do the same.

I can't add an unconditional include of <stdint.h>, because the VS I
use for the current official builds doesn't have that header at all.
So I conditionalise it out for old VS; if it needs throwing out for
any other toolchain, I'll add further conditions as reports come in.

windows/winstuff.h

index 5147c08f37941717969934c99512f101e24ac361..4f2b4e887184b50dd766ca55178662c57a50aa51 100644 (file)
 #include <windows.h>
 #include <stdio.h>                    /* for FILENAME_MAX */
 
+/* We use uintptr_t for Win32/Win64 portability, so we should in
+ * principle include stdint.h, which defines it according to the C
+ * standard. But older versions of Visual Studio - including the one
+ * used for official PuTTY builds as of 2015-09-28 - don't provide
+ * stdint.h at all, but do (non-standardly) define uintptr_t in
+ * stddef.h. So here we try to make sure _some_ standard header is
+ * included which defines uintptr_t. */
+#include <stddef.h>
+#if !defined _MSC_VER || _MSC_VER >= 1600
+#include <stdint.h>
+#endif
+
 #include "tree234.h"
 
 #include "winhelp.h"