Fixed type warnings.

Added casts to silence compiler warnings.  Relying on limited platform
capabilities to make casts valid.