diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-08-24 10:38:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:42 -0500 |
commit | 403530d0ecbb7df31325141e04d1544dda1d5304 (patch) | |
tree | 26a9046781d9c4b4af120fb0311bb99df307a540 /source4/torture/rpc | |
parent | 5645acdb67ec077db4c0d4eae45cb7374e5b760f (diff) | |
download | samba-403530d0ecbb7df31325141e04d1544dda1d5304.tar.gz samba-403530d0ecbb7df31325141e04d1544dda1d5304.tar.bz2 samba-403530d0ecbb7df31325141e04d1544dda1d5304.zip |
r17787: ifdef out unused macros and generate a smb_panic()
when the wrong macro is used on a field.
metze
(This used to be commit dd0f692d19416c82f237661710b814ba20163605)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/spoolss.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 4011c2bc6c..05bd987c85 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -64,33 +64,55 @@ struct test_spoolss_context { }\ } while(0) +#define _CHECK_FIELD_SIZE(c,r,e,type) do {\ + if (sizeof(__typeof__(c.e)) != sizeof(type)) { \ + printf(__location__ ":" #c "." #e "field is not " #type "\n"); \ + smb_panic(__location__ ":" #c "." #e "field is not " #type ); \ + ret = False; \ + }\ + if (sizeof(__typeof__(r.e)) != sizeof(type)) { \ + printf(__location__ ":" #r "." #e "field is not " #type "\n"); \ + smb_panic(__location__ ":" #r "." #e "field is not " #type ); \ + ret = False; \ + }\ +} while(0) + +#if 0 /* unused */ #define COMPARE_UINT16(c,r,e) do {\ + _CHECK_FIELD_SIZE(c,r,e,uint16_t); \ if (c.e != r.e){\ - printf("%s: " #c "." #e " 0x%08X (%u) doesn't match " #r "." #e " 0x%08X (%u)\n",\ + printf("%s: " #c "." #e " 0x%04X (%u) doesn't match " #r "." #e " 0x%04X (%u)\n",\ __location__, c.e, c.e, r.e, r.e);\ ret = False;\ }\ } while(0) +#endif #define COMPARE_UINT32(c,r,e) do {\ + _CHECK_FIELD_SIZE(c,r,e,uint32_t); \ if (c.e != r.e){\ - printf("%s: " #c "." #e " 0x%04X (%u) doesn't match " #r "." #e " 0x%04X (%u)\n",\ + printf("%s: " #c "." #e " 0x%08X (%u) doesn't match " #r "." #e " 0x%08X (%u)\n",\ __location__, c.e, c.e, r.e, r.e);\ ret = False;\ }\ } while(0) +#if 0 /* unused */ #define COMPARE_UINT64(c,r,e) do {\ + _CHECK_FIELD_SIZE(c,r,e,uint64_t); \ if (c.e != r.e){\ printf("%s: " #c "." #e " 0x%016llX (%llu) doesn't match " #r "." #e " 0x%016llX (%llu)\n",\ __location__, c.e, c.e, r.e, r.e);\ ret = False;\ }\ } while(0) +#endif /* TODO: ! */ +#if 0 /* unused */ #define COMPARE_SEC_DESC(c,r,e) #define COMPARE_SPOOLSS_TIME(c,r,e) +#endif #define COMPARE_STRING_ARRAY(c,r,e) static BOOL test_OpenPrinter_server(struct test_spoolss_context *ctx) |