fix a lot of compile warnings

all of them being `comparison between signed and unsigned integer expressions`
Merge pull request #14 from tony2001/unsigned_warnings

fix a lot of compile warnings