replacing more c-style casts with c++ equivalents