| 223 | } |
| 224 | |
| 225 | bool ParseNextKey() { |
| 226 | current_ = NextEntryOffset(); |
| 227 | const char* p = data_ + current_; |
| 228 | const char* limit = data_ + restarts_; // Restarts come right after data |
| 229 | if (p >= limit) { |
| 230 | // No more entries to return. Mark as invalid. |
| 231 | current_ = restarts_; |
| 232 | restart_index_ = num_restarts_; |
| 233 | return false; |
| 234 | } |
| 235 | |
| 236 | // Decode next entry |
| 237 | uint32_t shared, non_shared, value_length; |
| 238 | p = DecodeEntry(p, limit, &shared, &non_shared, &value_length); |
| 239 | if (p == nullptr || key_.size() < shared) { |
| 240 | CorruptionError(); |
| 241 | return false; |
| 242 | } else { |
| 243 | key_.resize(shared); |
| 244 | key_.append(p, non_shared); |
| 245 | value_ = Slice(p + non_shared, value_length); |
| 246 | while (restart_index_ + 1 < num_restarts_ && |
| 247 | GetRestartPoint(restart_index_ + 1) < current_) { |
| 248 | ++restart_index_; |
| 249 | } |
| 250 | return true; |
| 251 | } |
| 252 | } |
| 253 | }; |
| 254 | |
| 255 | Iterator* Block::NewIterator(const Comparator* comparator) { |
nothing calls this directly
no test coverage detected