mirror of
https://github.com/holub/mame
synced 2025-05-16 10:52:43 +03:00
Two hash_collections can only match if they have at least one matching hash.
This commit is contained in:
parent
17e077da3a
commit
340fda9b68
@ -441,15 +441,20 @@ hash_collection &hash_collection::operator=(const hash_collection &src)
|
|||||||
bool hash_collection::operator==(const hash_collection &rhs) const
|
bool hash_collection::operator==(const hash_collection &rhs) const
|
||||||
{
|
{
|
||||||
// look for a mismatch in any hash; do not fail if one is missing
|
// look for a mismatch in any hash; do not fail if one is missing
|
||||||
|
int matches = 0;
|
||||||
for (hash_base *hash = m_hashlist.first(); hash != NULL; hash = hash->next())
|
for (hash_base *hash = m_hashlist.first(); hash != NULL; hash = hash->next())
|
||||||
{
|
{
|
||||||
hash_base *rhs_hash = rhs.hash(hash->id());
|
hash_base *rhs_hash = rhs.hash(hash->id());
|
||||||
if (hash != NULL && rhs_hash != NULL && *hash != *rhs_hash)
|
if (hash != NULL)
|
||||||
|
{
|
||||||
|
if (rhs_hash != NULL && *hash != *rhs_hash)
|
||||||
return false;
|
return false;
|
||||||
|
matches++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if all shared hashes match, return true
|
// if all shared hashes match, return true
|
||||||
return true;
|
return (matches > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user