| 23 | } |
| 24 | |
| 25 | void AppendEscapedStringTo(std::string* str, const Slice& value) { |
| 26 | for (size_t i = 0; i < value.size(); i++) { |
| 27 | char c = value[i]; |
| 28 | if (c >= ' ' && c <= '~') { |
| 29 | str->push_back(c); |
| 30 | } else { |
| 31 | char buf[10]; |
| 32 | snprintf(buf, sizeof(buf), "\\x%02x", |
| 33 | static_cast<unsigned int>(c) & 0xff); |
| 34 | str->append(buf); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | std::string NumberToString(uint64_t num) { |
| 40 | std::string r; |