Fix comparison between signed and unsigned.

Redefined some signed int variables more strict.
Still there are some signedness confusions in the repository. I'll fix them also later.