S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override) const { // Figure out which permissions to use. LLPermissions perm; if (perm_override) { // Use the permissions override. perm = *perm_override; } else { // Use the current permissions. perm = getPermissions(); } // describe the inventory item char* buffer = (char*) bin_bucket; std::string creator_id_str; perm.getCreator().toString(creator_id_str); std::string owner_id_str; perm.getOwner().toString(owner_id_str); std::string last_owner_id_str; perm.getLastOwner().toString(last_owner_id_str); std::string group_id_str; perm.getGroup().toString(group_id_str); std::string asset_id_str; getAssetUUID().toString(asset_id_str); S32 size = sprintf(buffer, /* Flawfinder: ignore */ "%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x", getType(), getInventoryType(), getName().c_str(), creator_id_str.c_str(), owner_id_str.c_str(), last_owner_id_str.c_str(), group_id_str.c_str(), perm.getMaskBase(), perm.getMaskOwner(), perm.getMaskGroup(), perm.getMaskEveryone(), perm.getMaskNextOwner(), asset_id_str.c_str(), getDescription().c_str(), getSaleInfo().getSaleType(), getSaleInfo().getSalePrice(), getFlags()) + 1; return size; }
void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item) { // Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags // because we now detect when they should be set. setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) ); // Enforce the PERM_OVERWRITE flags for any masks that are different // but only for AT_OBJECT's since that is the only asset type that can // exist in-world (instead of only in-inventory or in-object-contents). if (LLAssetType::AT_OBJECT == getType()) { LLPermissions old_permissions = old_item.getPermissions(); U32 flags_to_be_set = 0; if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner()) { flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM; } if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone()) { flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; } if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup()) { flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } LLSaleInfo old_sale_info = old_item.getSaleInfo(); if(old_sale_info != getSaleInfo()) { flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE; } setFlags(getFlags() | flags_to_be_set); } }