fix warning about unreferenced variable
fix MSVC warning about data loss
fix MSVC warning about comparison signed <-> unsigned
mute an invalid MSVC warning about unreachable code