Clean up of warnings (tested on clang).

I tried to cleanup all of the warnings for implicit conversions. I understand that it can be a non-trivial task, for the formability issues related to type conversion can be hard to spot at a first look on the code. For this reason, I am not 100% sure I've done all the necessary edits to your code.
Nonetheless, I think that checking and cleaning up type conversion warnings would be a desirable task, giving users some larger confidence in the code reliability.

Of course, thanks for sharing such a helpful piece of software.

 
tpl_dump is supposed to return 0 or -1. I'd prefer to change the code in some way, than to make it appear that tpl_dump is returning something more meaningful than a success code.