Add missing prototypes and fix compiler warnings.