| 716 | } |
| 717 | |
| 718 | bool MutateString(const char *str, size_t len) { |
| 719 | auto s = AsString(); |
| 720 | if (s.IsTheEmptyString()) return false; |
| 721 | // This is very strict, could allow shorter strings, but that creates |
| 722 | // garbage. |
| 723 | if (s.length() != len) return false; |
| 724 | memcpy(const_cast<char *>(s.c_str()), str, len); |
| 725 | return true; |
| 726 | } |
| 727 | bool MutateString(const char *str) { return MutateString(str, strlen(str)); } |
| 728 | bool MutateString(const std::string &str) { |
| 729 | return MutateString(str.data(), str.length()); |
nothing calls this directly
no test coverage detected