fix a variety of msvc compiler warnings about signed/unsigned implicit conversion