Rémi Bernon (@rbernon) commented about dlls/bluetoothapis/tests/sdp.c:
}
- case SDP_TYPE_UUID:
+#undef XX +#define XX(st) case SDP_ST_UUID ##st: return (st)/8
switch (st)
{
XX( 16 );
XX( 32 );
default: XX( 128 );
}
+#undef XX
- default:
return sizeof( BYTE * ) + sizeof( ULONG );
- }
+}
We usually use X as a temporary macro, I don't see why XX is better if not necessary. Also in this case with only a couple of cases and the need to redefine it, it doesn't seem very helpful to have a macro in the first place. The default cases for UINT/INT/UUID also looks wrong. What about:
```suggestion:-33+0 static SIZE_T sdp_type_size( SDP_TYPE type, SDP_SPECIFICTYPE st ) { switch (type) { case SDP_TYPE_NIL: return 0; case SDP_TYPE_UINT: case SDP_TYPE_INT: case SDP_TYPE_UUID: switch (st) { case SDP_ST_UINT8: case SDP_ST_INT8: return 1; case SDP_ST_UINT16: case SDP_ST_INT16: case SDP_ST_UUID16: return 2; case SDP_ST_UINT32: case SDP_ST_INT32: /* case SDP_ST_UUID32: */ return 4; case SDP_ST_UINT64: case SDP_ST_INT64: return 8; case SDP_ST_UINT128: case SDP_ST_INT128: case SDP_ST_UUID128: return 16; default: FIXME( "Unexpected type %#x/%#x\n", type, st ); return 0; } case SDP_TYPE_BOOLEAN: return 1; case SDP_TYPE_STRING: case SDP_TYPE_SEQUENCE: case SDP_TYPE_ALTERNATIVE: case SDP_TYPE_URL: case SDP_TYPE_CONTAINER: return sizeof(BYTE *) + sizeof(ULONG); default: FIXME( "Unexpected type %#x\n", type ); return 0; } }
```
I would even be fine with `return 1 << ((st >> 8) & 0x7);` for the INT/UINT/UUID case as it seems to be how specific types are encoded.