Fix plane_it_t skipping the last entry when iterating

This commit is contained in:
Cameron Gutman 2024-01-16 18:28:45 -06:00
parent 35b785ebb8
commit df2d728af7

View File

@ -186,14 +186,14 @@ namespace platf {
public:
plane_it_t(int fd, std::uint32_t *plane_p, std::uint32_t *end):
fd { fd }, plane_p { plane_p }, end { end } {
inc();
load_next_valid_plane();
}
plane_it_t(int fd, std::uint32_t *end):
fd { fd }, plane_p { end }, end { end } {}
void
inc() {
load_next_valid_plane() {
this->plane.reset();
for (; plane_p != end; ++plane_p) {
@ -204,13 +204,16 @@ namespace platf {
}
this->plane = util::make_shared<plane_t>(plane.release());
// One last increment
++plane_p;
break;
}
}
void
inc() {
++plane_p;
load_next_valid_plane();
}
bool
eq(const plane_it_t &other) const {
return plane_p == other.plane_p;