Remove unnecessary casts to non-const to fix -Werror=cast-qual issue during make distcheck