Fix cppcheck-detected source code errors
The current list of issues detected by cppcheck are at:
https://jenkins.isc.org/view/BIND/job/bind9-cpp-check/
(currently not visible outside ISC - you need to be logged into Jenkins to see them). A number are false positives, but there are also a significant number of real issues (mainly relating to a mismatch between a format string and variable type).