Add some missing casts. Approved by: portmgr (build fix blanket) MFH: 2025Q3 (cherry picked from commit cf96806b)