Add printf format attributes & fix the warnings.