Add casts to void* for C++ compilers

Tested with MSVC11