Coverage Report

Created: 2026-08-14 06:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/open5gs/lib/asn1c/common/constr_SEQUENCE_OF.c
Line
Count
Source
1
/*-
2
 * Copyright (c) 2003, 2004, 2006 Lev Walkin <vlm@lionet.info>.
3
 * All rights reserved.
4
 * Redistribution and modifications are permitted subject to BSD license.
5
 */
6
#include <asn_internal.h>
7
#include <constr_SEQUENCE_OF.h>
8
#include <asn_SEQUENCE_OF.h>
9
10
/*
11
 * Generic placeholder descriptor for anonymous SEQUENCE OF.
12
 * NOTE: not a concrete "OF T" — used only to satisfy references from
13
 * some codegen paths. Concrete OF types still have their own descriptors.
14
 */
15
asn_TYPE_descriptor_t asn_DEF_SEQUENCE_OF = {
16
    "SEQUENCE OF",
17
    "SEQUENCE OF",
18
    &asn_OP_SEQUENCE_OF,
19
    0, 0,
20
    0, 0,
21
    {0},            /* No constraints */
22
    0, 0,           /* No members */
23
    0               /* No specifics */
24
};
25
26
asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
27
    .kind = ASN_KIND_SEQUENCE_OF,
28
    SEQUENCE_OF_free,
29
#if !defined(ASN_DISABLE_PRINT_SUPPORT)
30
    SEQUENCE_OF_print,
31
#else
32
    0,
33
#endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
34
    SEQUENCE_OF_compare,
35
    SEQUENCE_OF_copy,
36
#if !defined(ASN_DISABLE_BER_SUPPORT)
37
    SEQUENCE_OF_decode_ber,
38
    SEQUENCE_OF_encode_der,
39
#else
40
    0,
41
    0,
42
#endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */
43
#if !defined(ASN_DISABLE_XER_SUPPORT)
44
    SEQUENCE_OF_decode_xer,
45
    SEQUENCE_OF_encode_xer,
46
#else
47
    0,
48
    0,
49
#endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */
50
#if !defined(ASN_DISABLE_JER_SUPPORT)
51
    SEQUENCE_OF_decode_jer,
52
    SEQUENCE_OF_encode_jer,
53
#else
54
    0,
55
    0,
56
#endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */
57
#if !defined(ASN_DISABLE_OER_SUPPORT)
58
    SEQUENCE_OF_decode_oer,  /* Same as SET OF decoder. */
59
    SEQUENCE_OF_encode_oer,  /* Same as SET OF encoder */
60
#else
61
    0,
62
    0,
63
#endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */
64
#if !defined(ASN_DISABLE_UPER_SUPPORT)
65
    SEQUENCE_OF_decode_uper,  /* Same as SET OF decoder */
66
    SEQUENCE_OF_encode_uper,
67
#else
68
    0,
69
    0,
70
#endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) */
71
#if !defined(ASN_DISABLE_APER_SUPPORT)
72
    SEQUENCE_OF_decode_aper,
73
    SEQUENCE_OF_encode_aper,
74
#else
75
    0,
76
    0,
77
#endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */
78
#if !defined(ASN_DISABLE_RFILL_SUPPORT)
79
    SEQUENCE_OF_random_fill,
80
#else
81
    0,
82
#endif  /* !defined(ASN_DISABLE_RFILL_SUPPORT) */
83
    0  /* Use generic outmost tag fetcher */,
84
#if !defined(ASN_DISABLE_CBOR_SUPPORT)
85
    SEQUENCE_OF_decode_cbor,
86
    SEQUENCE_OF_encode_cbor,
87
#else
88
    0,
89
    0,
90
#endif  /* !defined(ASN_DISABLE_CBOR_SUPPORT) */
91
};
92
93
int
94
SEQUENCE_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
95
0
               const void *bptr) {
96
0
    const asn_anonymous_sequence_ *a = _A_CSEQUENCE_FROM_VOID(aptr);
97
0
    const asn_anonymous_sequence_ *b = _A_CSEQUENCE_FROM_VOID(bptr);
98
0
    ssize_t idx;
99
100
0
    if(a && b) {
101
0
        ssize_t common_length = (a->count < b->count ? a->count : b->count);
102
0
        for(idx = 0; idx < common_length; idx++) {
103
0
            int ret = td->elements->type->op->compare_struct(
104
0
                td->elements->type, a->array[idx], b->array[idx]);
105
0
            if(ret) return ret;
106
0
        }
107
108
0
        if(idx < b->count) /* more elements in b */
109
0
            return -1;    /* a is shorter, so put it first */
110
0
        if(idx < a->count) return 1;
111
112
0
    } else if(!a) {
113
0
        return -1;
114
0
    } else if(!b) {
115
0
        return 1;
116
0
    }
117
118
0
    return 0;
119
0
}