Replace some C-isms with C++-isms.

* 'const char*' to 'const std::string&'.
* snprintf to std::string concatenation.