Fixed signed/unsigned compile warnings with -Wextra on gcc 4.9.2