putil: Fix SimpleHashMap error reporting at static init time

This commit is contained in:
rdb 2023-02-12 13:49:44 +01:00
parent a9e9cfae1c
commit 914993f31b

View File

@ -532,11 +532,10 @@ validate() const {
size_t index = (size_t)index_array[slot];
++count;
if (index >= _num_entries) {
util_cat.error()
write(util_cat->error()
<< "SimpleHashMap " << this << " is invalid: slot " << slot
<< " contains index " << index << " which is past the end of the"
" table\n";
write(util_cat.error(false));
" table\n");
return false;
}
nassertd(index < _num_entries) continue;
@ -546,21 +545,19 @@ validate() const {
wants_slot = next_hash(wants_slot);
}
if (wants_slot != slot) {
util_cat.error()
write(util_cat->error()
<< "SimpleHashMap " << this << " is invalid: key "
<< _table[index]._key << " should be in slot " << wants_slot
<< " instead of " << slot << " (ideal is " << ideal_slot << ")\n";
write(util_cat.error(false));
<< " instead of " << slot << " (ideal is " << ideal_slot << ")\n");
return false;
}
}
}
if (count != _num_entries) {
util_cat.error()
write(util_cat->error()
<< "SimpleHashMap " << this << " is invalid: reports " << _num_entries
<< " entries, actually has " << count << "\n";
write(util_cat.error(false));
<< " entries, actually has " << count << "\n");
return false;
}