fix issue 1535
Don't implicitly convert int to bool

This avoids warnings with MSVC.
Merge pull request #1585 from dongzha/issue1535New

fix issue #1535 new
Merge pull request #1587 from mstorsjo/msvc-warnings

Don't implicitly convert int to bool