DescriptionSince we're using its types, #include <stdint.h>. Don't cast 'void *' to 'uint32_t' where we need to do byte-pointer arithmetic. Instead, use 'char *'; the language guarantees that sizeof(char) == 1. To make the above easier, pass pointers to byte buffers as 'char *', not 'void *. Use natural pointer arithmetic where possible. If ptr is a 'struct A *', then write: (struct B *) (ptr + 1) instead of: (struct B *) ((char *) ptr + sizeof(struct A)) This helps us avoid (say) using the size of the 32-bit Mach-O header to skip a 64-bit Mach-O header. (The latter has an extra 32-bit word at the end.) Patch Set 1 #
MessagesTotal messages: 2
|