Пример #1
0
        public LookupTable_val GetLookupTable_val(uint i)
        {
            LookupTable_val lt = null;

            if (i < LookupCount)
            {
                ushort offset = (ushort)(m_offsetLookupListTable + GetLookupOffset(i));
                if (offset + 6 <= m_bufTable.GetLength()) // minimum lookuptable with zero entries is six bytes
                {
                    lt = new LookupTable_val(offset, m_bufTable, m_tag);
                }
            }

            return(lt);
        }
Пример #2
0
        public bool Validate(Validator v, string sIdentity, OTTable table)
        {
            bool bRet          = true;
            bool bLookupListOk = true;

            // check that the Lookup array doesn't extend past end of table
            if (m_offsetLookupListTable + (uint)FieldOffsets.LookupArray + LookupCount * 2 > m_bufTable.GetLength())
            {
                v.Error(T.T_NULL, E._OTL_LookupListTable_E_LookupArray_pastEOT, table.m_tag, sIdentity);
                bLookupListOk = false;
                bRet          = false;
            }

            // check that each offset is within the table
            for (uint i = 0; i < LookupCount; i++)
            {
                if (m_offsetLookupListTable + GetLookupOffset(i) > m_bufTable.GetLength())
                {
                    v.Error(T.T_NULL, E._OTL_LookupListTable_E_Lookup_offset, table.m_tag, sIdentity + ", Lookup[" + i + "]");
                    bLookupListOk = false;
                    bRet          = false;
                }
            }

            // validate each lookup table
            for (uint i = 0; i < LookupCount; i++)
            {
                LookupTable_val lt = GetLookupTable_val(i);
                if (lt != null)
                {
                    bRet &= lt.Validate(v, sIdentity + ", Lookup[" + i + "]", table);
                }
                else
                {
                    bLookupListOk = false;
                    bRet          = false;
                }
            }

            if (bLookupListOk)
            {
                v.Pass(T.T_NULL, P._OTL_LookupListTable_P_valid, table.m_tag, sIdentity);
            }

            return(bRet);
        }
Пример #3
0
        public LookupTable_val GetLookupTable_val(uint i)
        {
            LookupTable_val lt = null;

            if (i < LookupCount)
            {
                ushort offset = (ushort)(m_offsetLookupListTable + GetLookupOffset(i));
                if (offset + 6 <= m_bufTable.GetLength()) // minimum lookuptable with zero entries is six bytes
                {
                    lt = new LookupTable_val(offset, m_bufTable, m_tag);
                }
            }

            return lt;
        }