Remove unused variables

This fixes warnings with clang and gcc.
Add casts to avoid warnings about comparison between signed and unsigned

This fixes warnings with gcc.
Change integer literals to unsigned to avoid warnings about comparison between signed and unsigned

This fixes warnings in gcc.
Merge pull request #1508 from mstorsjo/remove-unused-variables

Remove unused variables
Merge pull request #1509 from mstorsjo/fix-warnings-cast

Add casts to avoid warnings about comparison between signed and unsigned
Merge pull request #1510 from mstorsjo/unsigned-int-literals

Change integer literals to unsigned to avoid warnings about comparison between signed and unsigned
Merge remote-tracking branch 'upstream/master' into travis.osx