Fix numerous compiler warnings on various platforms