Commit 3cbafbd3 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Changed default octetstring RAW alignment for backward compatibility (bug 547307)



Change-Id: Ie0dc06cb23af91047c5d1ef69afd3d355c7e4b08
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent bdafc462
......@@ -722,8 +722,16 @@ void Type::generate_code_rawdescriptor(output_struct *target)
else str = mputstr(str, "SG_NO,");
if (rawattrib->byteorder == XDEFLAST) str = mputstr(str, "ORDER_MSB,");
else str = mputstr(str, "ORDER_LSB,");
if (rawattrib->align == XDEFLEFT) str = mputstr(str, "ORDER_MSB,");
else str = mputstr(str, "ORDER_LSB,");
if (get_type_refd_last()->typetype == T_OSTR) {
// the default alignment for octetstrings is 'left'
if (rawattrib->align == XDEFRIGHT) str = mputstr(str, "ORDER_LSB,");
else str = mputstr(str, "ORDER_MSB,");
}
else {
// the default alignment for all other types is 'right'
if (rawattrib->align == XDEFLEFT) str = mputstr(str, "ORDER_MSB,");
else str = mputstr(str, "ORDER_LSB,");
}
if (rawattrib->bitorderinfield == XDEFMSB)
str = mputstr(str, "ORDER_MSB,");
else str = mputstr(str, "ORDER_LSB,");
......
......@@ -514,7 +514,7 @@ int min_of_ints(unsigned int num_of_int,...)
const TTCN_RAWdescriptor_t INTEGER_raw_= {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t BOOLEAN_raw_= {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t BITSTRING_raw_= {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t OCTETSTRING_raw_= {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t OCTETSTRING_raw_= {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t HEXSTRING_raw_= {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t CHARSTRING_raw_= {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
const TTCN_RAWdescriptor_t FLOAT_raw_= {64,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL};
......
......@@ -375,9 +375,9 @@ testcase TC_FIELDLENGTH_4_and_BYTEORDER_first_for_octetstring() runs on TempComp
testcase TC_FIELDLENGTH_4_for_octetstring_3_octets_long() runs on TempComp {
const RAW_PDU_18 i := '123456'O
const octetstring o := '00123456'O
const octetstring o := '12345600'O
if ((enc_RAW_PDU_18(i) == o)and(dec_RAW_PDU_18(o) == '00'O & i)) {setverdict(pass);}
if ((enc_RAW_PDU_18(i) == o)and(dec_RAW_PDU_18(o) == i & '00'O)) {setverdict(pass);}
else {setverdict(fail,"enc_RAW_PDU_18(i)= ", enc_RAW_PDU_18(i), "; dec_RAW_PDU_18(o)= ", dec_RAW_PDU_18(o));}
}
......@@ -392,9 +392,9 @@ external function dec_RAW_PDU_19(in octetstring stream) return RAW_PDU_19 with {
testcase TC_FIELDLENGTH_5_for_octetstring_2_octets_long() runs on TempComp {
const RAW_PDU_19 i := '1234'O
const octetstring o := '0000001234'O
const octetstring o := '1234000000'O
if ((enc_RAW_PDU_19(i) == o)and(dec_RAW_PDU_19(o) == '000000'O & i)) {setverdict(pass);}
if ((enc_RAW_PDU_19(i) == o)and(dec_RAW_PDU_19(o) == i & '000000'O)) {setverdict(pass);}
else {setverdict(fail,"enc_RAW_PDU_19(i)= ", enc_RAW_PDU_19(i), "; dec_RAW_PDU_19(o)= ", dec_RAW_PDU_19(o));}
}
......@@ -418,9 +418,9 @@ testcase TC_FIELDLENGTH_4_and_BYTEORDER_last_for_octetstring() runs on TempComp
testcase TC_FIELDLENGTH_4_and_BYTEORDER_last_for_octetstring_3_octets_long() runs on TempComp {
const RAW_PDU_20 i := '123456'O
const octetstring o := '56341200'O
const octetstring o := '00563412'O
if ((enc_RAW_PDU_20(i) == o)and(dec_RAW_PDU_20(o) == '00'O & i)) {setverdict(pass);}
if ((enc_RAW_PDU_20(i) == o)and(dec_RAW_PDU_20(o) == i & '00'O)) {setverdict(pass);}
else {setverdict(fail,"enc_RAW_PDU_20(i)= ", enc_RAW_PDU_20(i), "; dec_RAW_PDU_20(o)= ", dec_RAW_PDU_20(o));}
}
......
......@@ -2514,7 +2514,7 @@ Attribute syntax: `ALIGN(<parameter>)`
Parameters allowed: `left`, `right`
Default value: `right`
Default value: `left` for `octetstrings`, `right` for all other types
Can be used with: stand-alone types or the field of a `record` or `set`.
......
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