]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Optionally define PropVariantInit() locally to restore ability to build with
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 26 Dec 2010 18:29:53 +0000 (18:29 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 26 Dec 2010 18:29:53 +0000 (18:29 +0000)
MinGW after r9046, and munge the COMPTR() macro to remove a couple of warnings
with my MinGW GCC (3.4.5).

[originally from svn r9049]
[r9046 == 1a03fa9292f2258384d037994d8e8e119ac11458]

windows/winjump.c

index 6552e074051ef2387548493370a5ebad6438a8a9..4e69dd7467c67f0d72fe64065d6a83a31a8e8858 100644 (file)
@@ -40,6 +40,11 @@ typedef struct _tagpropertykey {
 #define _REFPROPVARIANT_DEFINED
 typedef PROPVARIANT *REFPROPVARIANT;
 #endif
 #define _REFPROPVARIANT_DEFINED
 typedef PROPVARIANT *REFPROPVARIANT;
 #endif
+/* MinGW doesn't define this yet: */
+#ifndef _PROPVARIANTINIT_DEFINED_
+#define _PROPVARIANTINIT_DEFINED_
+#define PropVariantInit(pvar) memset((pvar),0,sizeof(PROPVARIANT))
+#endif
 
 #define IID_IShellLink IID_IShellLinkA
 
 
 #define IID_IShellLink IID_IShellLinkA
 
@@ -348,7 +353,12 @@ static const PROPERTYKEY PKEY_Title = {
     0x00000002
 };
 
     0x00000002
 };
 
-#define COMPTR(type, obj) &IID_##type, ((sizeof((obj)-(type **)(obj))), (obj))
+/* Type-checking macro to provide arguments for CoCreateInstance() etc.
+ * The pointer arithmetic is a compile-time pointer type check that 'obj'
+ * really is a 'type **', but is intended to have no effect at runtime. */
+#define COMPTR(type, obj) &IID_##type, \
+    (void **)(void *)((obj) + (sizeof((obj)-(type **)(obj))) \
+                           - (sizeof((obj)-(type **)(obj))))
 
 static char putty_path[2048];
 
 
 static char putty_path[2048];