Fix type mismatch (C4244) in VS builds

Does not appear to me to be fixed in other pull requests. Pardon the multiple commits, I also originally tried to fix other C4244s but CapnLove fixes most of them with 100% fewer C casts in pull request #191.