Fix a few signed/unsigned mismatches

They could conceivably cause misbehavior but did not do so under gcc.
Hush a compiler warning