X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/d05088f2689473808d1db331b8895f398079b4b5..47061bb488400d53fd20deb52d51763d2caa056e:/windows/winjump.c diff --git a/windows/winjump.c b/windows/winjump.c index abefe445..f674133b 100644 --- a/windows/winjump.c +++ b/windows/winjump.c @@ -353,12 +353,12 @@ static const PROPERTYKEY PKEY_Title = { 0x00000002 }; -/* 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. */ +/* Type-checking macro to provide arguments for CoCreateInstance() + * etc, ensuring that 'obj' really is a 'type **'. */ +#define typecheck(checkexpr, result) \ + (sizeof(checkexpr) ? (result) : (result)) #define COMPTR(type, obj) &IID_##type, \ - (void **)(void *)((obj) + (sizeof((obj)-(type **)(obj))) \ - - (sizeof((obj)-(type **)(obj)))) + typecheck((obj)-(type **)(obj), (void **)(void *)(obj)) static char putty_path[2048];