Use proper casting and format string

Based on TortoiseSVN revision 24271

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>