Add explicit casts for conversion from long or unsigned long to int
or uint32_t, to silence warnings on 64-bit builds.