ILDeclSecurity *ILProgramItemNextDeclSecurity(ILProgramItem *item, ILDeclSecurity *security) { ILToken token; ILImage *image; ILDeclSecurity *newSecurity; if(!security) { return ILDeclSecurityGetFromOwner(item); } image = security->ownedItem.programItem.image; token = security->ownedItem.programItem.token; ++token; while((newSecurity = ILDeclSecurity_FromToken(image, token)) != 0) { if(newSecurity->ownedItem.owner == security->ownedItem.owner) { return newSecurity; } if(image->type != IL_IMAGETYPE_BUILDING) { /* * In loaded images the security records have to be sorted on * owner. So if the owner changes we are at the end of the list. */ return 0; } ++token; } return 0; }
/* * Get metadata size information for an item, plus all of its attributes. */ static void GetMetadataSizeWithAttrs(ILSizeInfo *info, ILProgramItem *item) { ILAttribute *attr; ILDeclSecurity *decl; /* Get the basic size information for the item */ GetMetadataSize(info, item); /* Collect up size information for the attributes */ attr = 0; while((attr = ILProgramItemNextAttribute(item, attr)) != 0) { GetMetadataSize(info, ILToProgramItem(attr)); } /* Account for the security declaration if there is one */ decl = ILDeclSecurityGetFromOwner(item); if(decl) { GetMetadataSize(info, ILToProgramItem(decl)); } }