Fix warnings of unsafe string functions and type casts.