| 142 | DCHECK_GE(uintptr_t((src).data() - (dest).data()), uintptr_t((dest).size())) |
| 143 | |
| 144 | void AppendPieces(string *result, std::initializer_list<StringPiece> pieces) { |
| 145 | size_t old_size = result->size(); |
| 146 | size_t total_size = old_size; |
| 147 | for (const StringPiece piece : pieces) { |
| 148 | DCHECK_NO_OVERLAP(*result, piece); |
| 149 | total_size += piece.size(); |
| 150 | } |
| 151 | gtl::STLStringResizeUninitialized(result, total_size); |
| 152 | |
| 153 | char *const begin = &*result->begin(); |
| 154 | char *out = begin + old_size; |
| 155 | for (const StringPiece piece : pieces) { |
| 156 | const size_t this_size = piece.size(); |
| 157 | memcpy(out, piece.data(), this_size); |
| 158 | out += this_size; |
| 159 | } |
| 160 | DCHECK_EQ(out, begin + result->size()); |
| 161 | } |
| 162 | |
| 163 | } // namespace internal |
| 164 |
no test coverage detected