Fix invalid casts.

Merged Simon Morlat requested to merge fix/windows-uwp-warnings into master

Merge request reports