Honk if you knew memset(nullptr, 0, 0) was UB

This commit is contained in:
RipleyTom 2024-01-09 16:27:19 +01:00 committed by Megamouse
parent 236e32fb3d
commit 61e130e68c
2 changed files with 6 additions and 5 deletions

View File

@ -9,12 +9,13 @@ LOG_CHANNEL(np_cache);
namespace np
{
memberbin_cache::memberbin_cache(SceNpMatching2RoomMemberBinAttrInternal* sce_memberbin)
memberbin_cache::memberbin_cache(const SceNpMatching2RoomMemberBinAttrInternal* sce_memberbin)
{
id = sce_memberbin->data.id;
ensure(sce_memberbin && (sce_memberbin->data.ptr.get_ptr() || !sce_memberbin->data.size));
id = sce_memberbin->data.id;
updateDate.tick = sce_memberbin->updateDate.tick;
data.resize(sce_memberbin->data.size);
memcpy(data.data(), sce_memberbin->data.ptr.get_ptr(), sce_memberbin->data.size);
data = std::vector<u8>(sce_memberbin->data.ptr.get_ptr(), sce_memberbin->data.ptr.get_ptr() + sce_memberbin->data.size);
}
member_cache::member_cache(const SceNpMatching2RoomMemberDataInternal* sce_member)

View File

@ -19,7 +19,7 @@ namespace np
struct memberbin_cache
{
memberbin_cache(SceNpMatching2RoomMemberBinAttrInternal* sce_memberbin);
memberbin_cache(const SceNpMatching2RoomMemberBinAttrInternal* sce_memberbin);
SceNpMatching2AttributeId id;
CellRtcTick updateDate;