X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinjump.c;h=f674133b43d5f42e959eac215f920ffbed797d5f;hb=1472aa2a265dfbfe7225729862ea21b5fb2da22f;hp=abefe445dcfcbce2f4207f2e4136a79181e79e3f;hpb=b99bec3b02d79c6902f50cfa616eebaee43536f6;p=PuTTY.git 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];