[cage] better int type casts and fmt strings

32-bit:
shared.c:1506: warning: signed and unsigned type in conditional expression
socket.c:254: warning: format ‘%ld’ expects type long int, but argument 4 has type INTVAL
debug.c:479: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 14 has type ‘unsigned int’