Fix integer overflow issue on 32-bit Linux.
Fix compiler warnings on Linux.