iter--
This commit is contained in:
1 parent
faa0a364f4
commit
3f32f170aa
3 files changed
+36
-6
No files matched your search
+21
-1
@@ -211,7 +211,7 @@ EXT2_Inode::iterator& EXT2_Inode::iterator::operator++() {
|
||||
if (indexs[level] >= sub_blocks_in_block[level]) {
|
||||
// 小升级!
|
||||
int t = level;
|
||||
while (t > 0 && indexs[t] >= sub_blocks_in_block[level]) {
|
||||
while (t > 0 && indexs[t] >= sub_blocks_in_block[t]) {
|
||||
// 重设指针
|
||||
indexs[t - 1]++;
|
||||
indexs[t] = 0;
|
||||
@@ -228,6 +228,26 @@ EXT2_Inode::iterator& EXT2_Inode::iterator::operator++() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const EXT2_Inode::iterator& EXT2_Inode::iterator::operator--(int) {
|
||||
return --(*this);
|
||||
}
|
||||
|
||||
EXT2_Inode::iterator& EXT2_Inode::iterator::operator--() {
|
||||
if (index_cnt == 0)
|
||||
return *this;
|
||||
index_cnt--;
|
||||
int t = level;
|
||||
while (t >= 0 && indexs[t] == 0) {
|
||||
indexs[t] = sub_blocks_in_block[t] - 1;
|
||||
t--;
|
||||
}
|
||||
indexs[t]--;
|
||||
if (t == 0)
|
||||
level = indexs[t] < 12? 0: indexs[t] - 11;
|
||||
load_buf(t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
EXT2_Inode::iterator::operator==(const iterator& ano) const {
|
||||
_error(inode != ano.inode);
|
||||
|
||||
Reference in new issue
Block a user