Many small fixes for compile time warnings

This PR fixes 30+ compile warnings to satisfy gcc and clang, including signedness problems, format string ambiguities, implicit use of functions caused by missing includes/omitted prototype definitions, etc. It is comprised of many localized, low-impact commits as well as one larger commit (which touches many invocations of dbprint/errprint to clear up architecture-dependent warnings related to format conversion specifiers, specifically by taking advantage of the PRI* macros from inttypes.h).