Exemple #1
0
        public void Add(StructField f)
        {
            Fields.Add(f);
            var countTag = f.SizeTagField;

            if (countTag == null)
            {
                Debug.Assert(f.SizedField == null || f.IsTag() || f.Type.IsAlgOrHashAlg());
                return;
            }
            Debug.Assert(countTag.MarshalType == MarshalType.LengthOfStruct ? f.MarshalType == MarshalType.Normal : f.IsArray());

            // TSS implementations marshal variable length byte buffers tagged with an algorithm as fixed size arrays,
            // i.e. without marshaling the numeric size tag, as the algorithm tag (marshaled as a normal field)
            // is used to determine the buffer size.
            if (countTag.MarshalType == MarshalType.Normal && countTag.Type.IsAlgOrHashAlg())
            {
                f.MarshalType = MarshalType.SpecialVariableLengthArray;
            }
        }