mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Remove zero-row checks #120
Improperly closed databases may set num_rows to zero. Allow reading of these tables anyway.
This commit is contained in:
parent
197c3dc35a
commit
6db8ed13a6
@ -304,7 +304,7 @@ int mdb_read_row(MdbTableDef *table, unsigned int row)
|
||||
MdbField *fields;
|
||||
int num_fields;
|
||||
|
||||
if (table->num_rows == 0 || table->num_cols == 0)
|
||||
if (table->num_cols == 0)
|
||||
return 0;
|
||||
|
||||
if (mdb_find_row(mdb, row, &row_start, &row_size)) {
|
||||
@ -438,9 +438,6 @@ mdb_fetch_row(MdbTableDef *table)
|
||||
int rc;
|
||||
guint32 pg;
|
||||
|
||||
if (table->num_rows==0)
|
||||
return 0;
|
||||
|
||||
/* initialize */
|
||||
if (!table->cur_pg_num) {
|
||||
table->cur_pg_num=1;
|
||||
|
@ -76,6 +76,8 @@ MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
|
||||
|
||||
mdb_get_int16(pg_buf, 8); /* len */
|
||||
|
||||
/* Note that num_rows may be zero if the database was improperly closed.
|
||||
* See https://github.com/mdbtools/mdbtools/issues/120 for discussion. */
|
||||
table->num_rows = mdb_get_int32(pg_buf, fmt->tab_num_rows_offset);
|
||||
table->num_var_cols = mdb_get_int16(pg_buf, fmt->tab_num_cols_offset-2);
|
||||
table->num_cols = mdb_get_int16(pg_buf, fmt->tab_num_cols_offset);
|
||||
|
Loading…
Reference in New Issue
Block a user