Silence a number of warnings

Explicit casts, not naming unused parameters, removing unused code,
spurious syntax, ...
Revert int->size_t change from previous commit