Commit 73f2f84c authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Minor fixes to new JSON attributes and tests



Change-Id: I26a4671f5f5a0ebed07af0d7fbc027785f39830a
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 91b67e45
......@@ -1664,7 +1664,8 @@ char* CHARSTRING::to_JSON_string(json_string_escaping mode) const
}
// fall through if ESCAPE_AS_TRANSPARENT
default:
if (val_ptr->chars_ptr[i] <= 0x1F || val_ptr->chars_ptr[i] == 0x7F) {
if ((val_ptr->chars_ptr[i] >= 0 && val_ptr->chars_ptr[i] <= 0x1F) ||
val_ptr->chars_ptr[i] == 0x7F) {
// C0 control characters use USI-like escape sequences
json_str = mputprintf(json_str, "\\u00%X%X",
val_ptr->chars_ptr[i] / 16, val_ptr->chars_ptr[i] % 16);
......
......@@ -893,7 +893,7 @@ int OPTIONAL<T_type>::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokeni
p_tok.set_buf_pos(buf_pos);
}
}
dec_len = optional_value->JSON_decode(p_td, p_tok, p_silent, p_chosen_field);
dec_len = optional_value->JSON_decode(p_td, p_tok, p_silent, FALSE, p_chosen_field);
if (JSON_ERROR_FATAL == dec_len) {
if (p_silent) {
clean_up();
......
......@@ -153,7 +153,7 @@ testcase tc_charstring_ascii_basic_escapes() runs on MTC{
"\r","\t","\f","\b"
};
var RoOS os_expected := {
'225C5C22'O, '222F22'O,'225C6E22'O,
'225C5C22'O, '225C2F22'O,'225C6E22'O,
'225C7222'O,'225C7422'O,'225C6622'O, '225C6222'O
};
var integer len:=lengthof(cs);
......@@ -259,7 +259,7 @@ testcase tc_ucharstring_higherplanes() runs on MTC{
char(0,3,0,0) & char(0,3,0,175) & char(0,3,255,255),
char(0,15,0,0)& char(0,15,0,175)& char(0,15,255,255),
char(0,16,0,0)& char(0,16,0,175)& char(0,16,255,255),
char(0,16,0,0) & char(0,0,0,1) & " "
char(0,16,0,0) & " "
};
var octetstring os;
var integer len:=lengthof(us);
......
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