| 76 | } |
| 77 | |
| 78 | const void *CSnapshot::FindItem(int Type, int Id) const |
| 79 | { |
| 80 | int InternalType = Type; |
| 81 | if(Type >= OFFSET_UUID) |
| 82 | { |
| 83 | CUuid TypeUuid = g_UuidManager.GetUuid(Type); |
| 84 | int aTypeUuidItem[sizeof(CUuid) / sizeof(int32_t)]; |
| 85 | for(size_t i = 0; i < sizeof(CUuid) / sizeof(int32_t); i++) |
| 86 | aTypeUuidItem[i] = bytes_be_to_uint(&TypeUuid.m_aData[i * sizeof(int32_t)]); |
| 87 | |
| 88 | bool Found = false; |
| 89 | for(int i = 0; i < m_NumItems; i++) |
| 90 | { |
| 91 | const CSnapshotItem *pItem = GetItem(i); |
| 92 | if(pItem->Type() == 0 && pItem->Id() >= OFFSET_UUID_TYPE) // NETOBJTYPE_EX |
| 93 | { |
| 94 | if(mem_comp(pItem->Data(), aTypeUuidItem, sizeof(CUuid)) == 0) |
| 95 | { |
| 96 | InternalType = pItem->Id(); |
| 97 | Found = true; |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | if(!Found) |
| 103 | { |
| 104 | return nullptr; |
| 105 | } |
| 106 | } |
| 107 | int Index = GetItemIndex((InternalType << 16) | Id); |
| 108 | return Index < 0 ? nullptr : GetItem(Index)->Data(); |
| 109 | } |
| 110 | |
| 111 | unsigned CSnapshot::Crc() const |
| 112 | { |