| 98 | } |
| 99 | |
| 100 | bool MemoryDataStream::moveString(String& s) |
| 101 | { |
| 102 | // Ensure size < capacity |
| 103 | bool sizeOk = ensureCapacity(size + 1); |
| 104 | |
| 105 | // If we couldn't reallocate for the NUL terminator, drop the last character |
| 106 | bool res = s.setBuffer({buffer, capacity, sizeOk ? size : size - 1}); |
| 107 | (void)res; |
| 108 | assert(res); |
| 109 | |
| 110 | buffer = nullptr; |
| 111 | readPos = 0; |
| 112 | size = 0; |
| 113 | capacity = 0; |
| 114 | return sizeOk; |
| 115 | } |
no test coverage detected