Use C++ strings (which include lengths) in API

Right now, the usage is safe with const char *, but it's a matter of
time before we use it in other places.