avoid comparison between signed and unsigned
remove useless cast
fix 'unused parameter waring' by a reset of the printer state
structure.
remove trailing white space