More const_cast fixes for C++ apps using the public headers (thanks, Martin!).