From: jacob Date: Sun, 26 Dec 2010 18:29:53 +0000 (+0000) Subject: Optionally define PropVariantInit() locally to restore ability to build with X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/735a4294762b784c878bc249f591be8fd154c237 Optionally define PropVariantInit() locally to restore ability to build with MinGW after r9046, and munge the COMPTR() macro to remove a couple of warnings with my MinGW GCC (3.4.5). git-svn-id: svn://svn.tartarus.org/sgt/putty@9049 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/windows/winjump.c b/windows/winjump.c index 6552e074..4e69dd74 100644 --- a/windows/winjump.c +++ b/windows/winjump.c @@ -40,6 +40,11 @@ typedef struct _tagpropertykey { #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 @@ -348,7 +353,12 @@ static const PROPERTYKEY PKEY_Title = { 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];