【修复】tsdb 数据为空时迭代器运行错误问题
Signed-off-by: chenyong <chenyong@rt-thread.com>
This commit is contained in:
parent
e7b42f3059
commit
fd99aaff4a
|
@ -423,6 +423,7 @@ void fdb_tsl_iter(fdb_tsdb_t db, fdb_tsl_cb cb, void *arg)
|
|||
sec_addr = db->oldest_addr;
|
||||
/* search all sectors */
|
||||
do {
|
||||
traversed_len += db_sec_size(db);
|
||||
if (read_sector_info(db, sec_addr, §or, false) != FDB_NO_ERR) {
|
||||
continue;
|
||||
}
|
||||
|
@ -442,7 +443,6 @@ void fdb_tsl_iter(fdb_tsdb_t db, fdb_tsl_cb cb, void *arg)
|
|||
}
|
||||
} while ((tsl.addr.index = get_next_tsl_addr(§or, &tsl)) != FAILED_ADDR);
|
||||
}
|
||||
traversed_len += db_sec_size(db);
|
||||
} while ((sec_addr = get_next_sector_addr(db, §or, traversed_len)) != FAILED_ADDR);
|
||||
}
|
||||
|
||||
|
@ -476,6 +476,7 @@ void fdb_tsl_iter_by_time(fdb_tsdb_t db, fdb_time_t from, fdb_time_t to, fdb_tsl
|
|||
sec_addr = oldest_addr;
|
||||
/* search all sectors */
|
||||
do {
|
||||
traversed_len += db_sec_size(db);
|
||||
if (read_sector_info(db, sec_addr, §or, false) != FDB_NO_ERR) {
|
||||
continue;
|
||||
}
|
||||
|
@ -517,7 +518,6 @@ void fdb_tsl_iter_by_time(fdb_tsdb_t db, fdb_time_t from, fdb_time_t to, fdb_tsl
|
|||
} else if (sector.status == FDB_SECTOR_STORE_EMPTY) {
|
||||
return;
|
||||
}
|
||||
traversed_len += db_sec_size(db);
|
||||
} while ((sec_addr = get_next_sector_addr(db, §or, traversed_len)) != FAILED_ADDR);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue