Replaced C casts by C++ casts