Commit 5bdb5555 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu Committed by Lev Walkin

Fix duplicate 'asn_VAL_23_ignore' generated from RANAP ASN.1

Information object set RANAP-ELEMENTARY-PROCEDURES is a union of
RANAP-ELEMENTARY-PROCEDURES-CLASS-1 and RANAP-ELEMENTARY-PROCEDURES-CLASS-2.

Each time _asn1f_assign_cell_value() parses an object, value of an
incremented counter is assigned to '_type_unique_index' field for
distinquishing different items.

However, these two information object sets have their own counters.
It has chance that generated variables have the same name and also the same
'_type_unique_index'. And they collide if they join up into one set.

S1AP's ASN.1 is lucky without this problem, while RANAP has.

By adding the number of items of the first set to '_type_unique_index' field
of items of the second set can solve this issue.
parent 7156898e
......@@ -27,11 +27,13 @@ asn1p_ioc_table_add(asn1p_ioc_table_t *it, asn1p_ioc_row_t *row) {
void
asn1p_ioc_table_append(asn1p_ioc_table_t *it, asn1p_ioc_table_t *src) {
int base_idx;
if(!src) return;
if(!src || !it) return;
base_idx = it->rows;
for(size_t i = 0; i < src->rows; i++) {
asn1p_ioc_table_add(it, asn1p_ioc_row_clone(src->row[i]));
asn1p_ioc_table_add(it, asn1p_ioc_row_clone(src->row[i], base_idx));
}
}
......@@ -104,7 +106,7 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) {
}
asn1p_ioc_row_t *
asn1p_ioc_row_clone(asn1p_ioc_row_t *src) {
asn1p_ioc_row_clone(asn1p_ioc_row_t *src, int base_idx) {
asn1p_ioc_row_t *row;
row = calloc(1, sizeof *row);
......@@ -119,7 +121,11 @@ asn1p_ioc_row_clone(asn1p_ioc_row_t *src) {
for(size_t i = 0; i < src->columns; i++) {
row->column[i].field = src->column[i].field;
row->column[i].value = src->column[i].value ? asn1p_expr_clone(src->column[i].value, 0) : 0;
row->column[i].value = 0;
if(src->column[i].value) {
row->column[i].value = asn1p_expr_clone(src->column[i].value, 0);
row->column[i].value->_type_unique_index += base_idx;
}
row->column[i].new_ref = 1;
}
......
......@@ -16,7 +16,7 @@ typedef struct asn1p_ioc_row_s {
} asn1p_ioc_row_t;
asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);
asn1p_ioc_row_t *asn1p_ioc_row_clone(asn1p_ioc_row_t *src);
asn1p_ioc_row_t *asn1p_ioc_row_clone(asn1p_ioc_row_t *src, int base_idx);
size_t asn1p_ioc_row_max_identifier_length(asn1p_ioc_row_t *);
void asn1p_ioc_row_delete(asn1p_ioc_row_t *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment