It fixes the following compile warnings:
- '0' flag ignored with precision and ‘%d’ gnu_printf format
- enumeral and non-enumeral type in conditional expression
- format ‘%d’ expects argument of type ‘int’, but argument 4 has type ...
- enumeration value ‘...’ not handled in switch
- cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ casts away qualifiers
- extra ‘;’
- comparison between signed and unsigned integer expressions
- variable ‘register_operand’ set but not used
- control reaches end of non-void function
I find this code pretty ugly because of how the line breaks. Can you change this to:
or, alternatively:
// global scope static uint32_t translateSegmentPermissions(uint32_t initprot) { return ((initprot & VM_PROT_READ) ? ePermissionsReadable : 0u) | (initprot & VM_PROT_WRITE) ? ePermissionsWritable : 0u) | (initprot & VM_PROT_EXECUTE) ? ePermissionsExecutable : 0u); } // at this location const uint32_t segment_permissions = translateSegmentPermissions(load_cmd.initprot);