Replace C-style cast with C++ static_cast.