Fix warnings
Force unsigned constants to avoid narrowing conversion warnings

Hopefully this will fix the gcc4 build.