Merge "Add casts to avoid build warnings with gcc-4.7"