1 2 #ifndef _NINE_PDATA_H_ 3 #define _NINE_PDATA_H_ 4 5 #include "util/hash_table.h" 6 7 struct pheader 8 { 9 boolean unknown; 10 GUID guid; 11 DWORD size; 12 }; 13 14 static bool ht_guid_compare(const void * a,const void * b)15ht_guid_compare( const void *a, 16 const void *b ) 17 { 18 return GUID_equal(a, b); 19 } 20 21 static uint32_t ht_guid_hash(const void * key)22ht_guid_hash( const void *key ) 23 { 24 unsigned i, hash = 0; 25 const unsigned char *str = key; 26 27 for (i = 0; i < sizeof(GUID); i++) { 28 hash = (unsigned)(str[i]) + (hash << 6) + (hash << 16) - hash; 29 } 30 31 return hash; 32 } 33 34 static void ht_guid_delete(struct hash_entry * entry)35ht_guid_delete( struct hash_entry *entry ) 36 { 37 struct pheader *header = entry->data; 38 void *header_data = (void *)header + sizeof(*header); 39 40 if (header->unknown) { IUnknown_Release(*(IUnknown **)header_data); } 41 FREE(header); 42 } 43 44 #endif /* _NINE_PDATA_H_ */ 45