Fix some snprintf format specifiers

Use %u (not %d) for unsigned int.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Reduce the scope of some variables in create_levels()

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>