Fix various build warnings

This fixes various build warnings on Mac and Windows (64-bit).
Merge pull request #1414 from arrbee/more-build-warning-fixes

Fix various build warnings