| 76 | } |
| 77 | |
| 78 | void PrefixSuccessor(std::string* prefix) { |
| 79 | // We can increment the last character in the string and be done |
| 80 | // unless that character is 255, in which case we have to erase the |
| 81 | // last character and increment the previous character, unless that |
| 82 | // is 255, etc. If the string is empty or consists entirely of |
| 83 | // 255's, we just return the empty string. |
| 84 | while (!prefix->empty()) { |
| 85 | char& c = prefix->back(); |
| 86 | if (c == '\xff') { // char literal avoids signed/unsigned. |
| 87 | prefix->pop_back(); |
| 88 | } else { |
| 89 | ++c; |
| 90 | break; |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | static void StringAppendV(std::string* dst, const char* format, va_list ap) { |
| 96 | // First try with a small fixed size buffer |
no test coverage detected