Remove a couple of useless casts in core headers

This helps users who compile their code with `-Wuseless-cast`.