Fix compilation warnings.

The string.h include was necessary for compilation (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)).

The other changes just tidy up compilation warnings.
`%p` is not the same as `%lx` because it prefixes the output with "0x". I merged your patch nevertheless and fixed it otherwise.