From 6c61dfabc7a1975696d9a14f088f9597226bfbfb Mon Sep 17 00:00:00 2001 From: Gabor Szalai <gabor.szalai@ericsson.com> Date: Mon, 8 Apr 2019 22:46:43 +0200 Subject: [PATCH] Correcting the call of record/set of RAW decoder The parameter values of the RAW decoder of the record/set of was faulty: The value of the first_call parameter was wrong. The number of elements was passed intead of the first call indication. Meaning of the parameters: - sel_field: * union -> the selected field to be decoded * record of -> the number of the element in the list - first_call: * record of -> indicates that the decode is called for the first time or it is a repeated call Change-Id: I2394eca0392454c7b1c0a2e1b4da4141267e370c Signed-off-by: Gabor Szalai <gabor.szalai@ericsson.com> --- compiler2/record.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/compiler2/record.c b/compiler2/record.c index e8721a8b6..a4c457015 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -5491,23 +5491,28 @@ static char *genRawDecodeRecordField(char *src, const struct_def *sdef, } src = mputprintf(src, ", local_top_order, %s", sdef->elements[i].isOptional ? "TRUE" : "no_err"); + boolean lengthof_or_crostag_found = FALSE; if (sdef->elements[i].hasRaw && - sdef->elements[i].raw.crosstaglist.nElements > 0) + sdef->elements[i].raw.crosstaglist.nElements > 0){ src = mputstr(src, ", selected_field"); - else src = mputstr(src, ", -1"); - boolean lengthof_found = FALSE; - for (a = 0; a < raw_options[i].lengthof; a++) { - int field_index = raw_options[i].lengthoffield[a]; - /* number of elements in 'record of' or 'set of' */ - if (sdef->elements[field_index].raw.unit == -1) { - src = mputprintf(src, ", value_of_length_field%d", field_index); - lengthof_found = TRUE; - break; + lengthof_or_crostag_found = TRUE; + } + else { + for (a = 0; a < raw_options[i].lengthof; a++) { + int field_index = raw_options[i].lengthoffield[a]; + /* number of elements in 'record of' or 'set of' */ + if (sdef->elements[field_index].raw.unit == -1) { + src = mputprintf(src, ", value_of_length_field%d", field_index); + lengthof_or_crostag_found = TRUE; + break; + } } } - if (!lengthof_found) { - src = mputstr(src, ", TRUE"); + if (!lengthof_or_crostag_found) { + src = mputstr(src, ", -1"); } + + src = mputstr(src, ", TRUE"); src = mputprintf(src, ", &field_%d_force_omit);\n", i); if (delayed_decode) { src = mputprintf(src, " if (decoded_field_length != %d) return -1;\n", -- GitLab