Fix bad signed/unsigned comparisons

Either by casting, or switching to a more appropriate type
for the variable.
14 files changed