Adjust build fix from r199494 to use C++ casts

Change suggested by Joerg Sonnenberger!