convert old style casts to fix warnings

Sorry about all the blank lines changes. My editor removes trailing spaces on save.

This fixes a good chunk of the old style cast warnings.
Yes it does.