util.c: fix comiler warnings

A recent commit gave some warnings about format types,
and assignments without extra parens within an if condition.