Fix MSVC warnings (#9621). There should be no behavior change.