Fix a number of build warnings.

This gets rid of about 50 warnings. Deprecation warnings still remain,
though.