clang: fix -Wsign-conversion errors
Cast some values as their unsigned equivalents or size_t to match the
parameter type used for the template object under test. Also, provide
UInt32 equivalent delegate methods for some callers (with
int-equivalents for backwards compatibility).
This closes #2146.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>