Fixed cases where signed and unsigned values were compared.

Fix to quiet -Wsign-compare warnings.