コード例 #1
0
ファイル: type_matcher.c プロジェクト: Bhumi28/sra-tools
static bool match_type_with_id_vector( const VSchema * s,
                const VTypedecl * td, const Vector * id_vector )
{
    bool res = false;
    uint32_t idx, len;

    len = VectorLength( id_vector );
    for ( idx = 0;  idx < len && !res; ++idx )
    {
        uint32_t *id = (uint32_t *) VectorGet ( id_vector, idx );
        if ( id != NULL )
        {
            VTypedecl cast;
            uint32_t distance;
            res = VTypedeclToType ( td, s, *id, &cast, &distance );
        }
    }
    return res;
}
コード例 #2
0
static
rc_t mark_type_sensitivity ( const BSTree *stype_tbl, const VSchema *schema,
    const VTypedecl *td, vtblcp_column_map *cm )
{
    const stype_id *node;

    /* simple case - look for exact matches */
    if ( BSTreeFind ( stype_tbl, td, stype_id_cmp ) != NULL )
    {
        cm -> sensitive = true;
        return 0;
    }

    /* exhaustive case - perform one by one ancestry test */
    for ( node = ( const stype_id* ) BSTreeFirst ( stype_tbl );
          node != NULL;
          node = ( const stype_id* ) BSTNodeNext ( & node -> n ) )
    {
        cm -> redact_value = NULL;
        if ( td -> type_id > node -> type_id )
        {
            VTypedecl cast;

            /* test for our type being a subtype */
            if ( VTypedeclToType ( td, schema, node -> type_id, & cast, NULL ) )
            {
                cm -> redact_value = node -> redact_value;
                cm -> sensitive = true;
                return 0;
            }
        }
    }

    /* doesn't appear to be sensitive */
    cm -> sensitive = false;
    return 0;
}