ksys/util: Fix matching issue in StrTreeMapKey::setKey

The stack variable is in fact a StrTreeMapKey temporary that is used
by the default assignment operator.
This commit is contained in:
Léo Lam 2020-09-25 20:27:18 +02:00
parent 90b93ef720
commit 53f375b0ec
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
2 changed files with 5 additions and 8 deletions

View File

@ -89551,7 +89551,7 @@
0x00000071011bd2e4,sub_71011BD2E4,36,
0x00000071011bd308,BaseProcMgr::init,680,
0x00000071011bd5b0,BaseProcMgr::generateActorId,28,_ZN4ksys3act11BaseProcMgr14generateProcIdEPj
0x00000071011bd5cc,BaseProcMgr::registerActor,156,_ZN4ksys3act11BaseProcMgr12registerProcERNS0_8BaseProcE?
0x00000071011bd5cc,BaseProcMgr::registerActor,156,_ZN4ksys3act11BaseProcMgr12registerProcERNS0_8BaseProcE
0x00000071011bd668,StringMap::insert,316,_ZN4ksys3act11BaseProcMap6insertEPNS0_15BaseProcMapNodeE
0x00000071011bd7a4,BaseProcMgr::unregisterActor,188,_ZN4ksys3act11BaseProcMgr14unregisterProcERNS0_8BaseProcE
0x00000071011bd860,BaseProcMgr::requestPreDelete,8,

Can't render this file because it is too large.

View File

@ -8,16 +8,13 @@ namespace ksys::util {
class StrTreeMapKey {
public:
StrTreeMapKey() = default;
StrTreeMapKey(u32 key_hash, const sead::SafeString& key) : mKeyHash(key_hash), mKey(key) {}
const sead::SafeString& key() const { return mKey; }
// NON_MATCHING: stack
void setKey(u32 hash, sead::SafeString key) {
mKeyHash = hash;
mKey = key;
}
void setKey(const sead::SafeString& key) {
setKey(sead::HashCRC32::calcStringHash(key.cstr()), key);
*this = {sead::HashCRC32::calcStringHash(key.cstr()), key};
}
s32 compare(const StrTreeMapKey& rhs) const {