diff --git a/common/JSON_Tokenizer.cc b/common/JSON_Tokenizer.cc index 1f866e38281d6081c070f65c2e35fea6f1159906..7cba8c44ce7d33a3fef5d387ed173a132592d40a 100644 --- a/common/JSON_Tokenizer.cc +++ b/common/JSON_Tokenizer.cc @@ -202,7 +202,7 @@ bool JSON_Tokenizer::check_for_literal(const char* p_literal) return false; } -int JSON_Tokenizer::get_next_token(json_token_t* p_token, char** p_token_str, size_t* p_str_len) +size_t JSON_Tokenizer::get_next_token(json_token_t* p_token, char** p_token_str, size_t* p_str_len) { size_t start_pos = buf_pos; *p_token = JSON_TOKEN_NONE; diff --git a/common/JSON_Tokenizer.hh b/common/JSON_Tokenizer.hh index e6d5b95cacb3a967cc57cbed923c9c8ee0159899..a3d4fef2b24d5f365e62811e3c91a2c881d7e53c 100644 --- a/common/JSON_Tokenizer.hh +++ b/common/JSON_Tokenizer.hh @@ -145,7 +145,7 @@ public: * @return The number of characters extracted * @note The token data is not copied, *p_token_str will point to the start of the * data in the tokenizer's buffer. */ - int get_next_token(json_token_t* p_token, char** p_token_str, size_t* p_str_len); + size_t get_next_token(json_token_t* p_token, char** p_token_str, size_t* p_str_len); /** Gets the current read position in the buffer. * This is where get_next_token() will read from next. */ diff --git a/compiler2/enum.c b/compiler2/enum.c index 761b55e5313da6bb52f393318f6f0bfb1fc48859..c45d01b88ede6e4da7941fbd7a802278a71b1df7 100644 --- a/compiler2/enum.c +++ b/compiler2/enum.c @@ -810,7 +810,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) " char* value = 0;\n" " size_t value_len = 0;\n" " boolean error = FALSE;\n" - " int dec_len = 0;\n" + " size_t dec_len = 0;\n" " boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length();\n" " if (use_default) {\n" // No JSON data in the buffer -> use default value @@ -843,7 +843,7 @@ void defEnumClass(const enum_def *edef, output_struct *output) " enum_value = %s;\n" " return JSON_ERROR_FATAL;\n" " }\n" - " return dec_len;\n" + " return (int)dec_len;\n" "}\n\n" , name, unknown_value, unbound_value, unbound_value); } diff --git a/compiler2/record.c b/compiler2/record.c index 51a23f827b0abd8b38b500a33ca3cdda400ef323..0a0384c8821574f33c703322ec05e9135f3edc03 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -4419,7 +4419,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) "int %s::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok, boolean p_silent)\n" "{\n" " json_token_t j_token = JSON_TOKEN_NONE;\n" - " int dec_len = p_tok.get_next_token(&j_token, NULL, NULL);\n" + " size_t dec_len = p_tok.get_next_token(&j_token, NULL, NULL);\n" " if (JSON_TOKEN_ERROR == j_token) {\n" " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" @@ -4533,7 +4533,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " }\n" " return JSON_ERROR_FATAL;\n" " }\n" - " dec_len += ret_val;\n" + " dec_len += (size_t)ret_val;\n" , sdef->elements[i].dispname); if (has_metainfo_enabled) { src = mputstr(src, " }\n"); @@ -4603,7 +4603,7 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " }\n"); } src = mputstr(src, - "\n return dec_len;\n" + "\n return (int)dec_len;\n" "}\n\n"); } @@ -6093,7 +6093,7 @@ static void defEmptyRecordClass(const struct_def *sdef, "int %s::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok, boolean p_silent)\n" "{\n" " json_token_t token = JSON_TOKEN_NONE;\n" - " int dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" + " size_t dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_ERROR == token) {\n" " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" @@ -6107,7 +6107,7 @@ static void defEmptyRecordClass(const struct_def *sdef, " return JSON_ERROR_FATAL;\n" " }\n\n" " bound_flag = TRUE;\n\n" - " return dec_len;\n" + " return (int)dec_len;\n" "}\n\n" , name); } diff --git a/compiler2/record_of.c b/compiler2/record_of.c index 8a6e9874c9988b01bf87cd89c3a11b817b61a2da..fd4cf36754cf995205c0c8d1ae37fdcd9226633b 100644 --- a/compiler2/record_of.c +++ b/compiler2/record_of.c @@ -1139,7 +1139,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " if (own_tag)"); } src=mputprintf(src, - " {\n" /* Do empty element tag */ + " {\n" /* Do empty element tag */ "%s" " p_buf.put_c('<');\n" " if (e_xer) write_ns_prefix(p_td, p_buf);\n" @@ -1327,7 +1327,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) , force_gen_seof ? " && (p_td.xer_bits & XER_ATTRIBUTE)" : ""); } src=mputstr(src, - " if (own_tag){\n" + " if (own_tag) {\n" " p_buf.put_c('<');\n" " p_buf.put_c('/');\n" " if (e_xer) write_ns_prefix(p_td, p_buf);\n" @@ -1565,7 +1565,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) "int %s::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent)\n" "{\n" " json_token_t token = JSON_TOKEN_NONE;\n" - " int dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" + " size_t dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_ERROR == token) {\n" " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" @@ -1576,7 +1576,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " set_size(0);\n" " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" - " int ret_val;\n" + " size_t ret_val;\n" " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" // check for metainfo object " ret_val = p_tok.get_next_token(&token, NULL, NULL);\n" @@ -1601,13 +1601,13 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " p_tok.set_buf_pos(buf_pos);\n" " }\n" " %s* val = new %s;\n" - " ret_val = val->JSON_decode(*p_td.oftype_descr, p_tok, p_silent);\n" - " if (JSON_ERROR_INVALID_TOKEN == ret_val) {\n" + " int ret_val2 = val->JSON_decode(*p_td.oftype_descr, p_tok, p_silent);\n" + " if (JSON_ERROR_INVALID_TOKEN == ret_val2) {\n" " p_tok.set_buf_pos(buf_pos);\n" " delete val;\n" " break;\n" " }\n" - " else if (JSON_ERROR_FATAL == ret_val) {\n" + " else if (JSON_ERROR_FATAL == ret_val2) {\n" " delete val;\n" " if (p_silent) {\n" " clean_up();\n" @@ -1618,7 +1618,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " (void**)val_ptr->value_elements, val_ptr->n_elements, nof_elements + 1);\n" " val_ptr->value_elements[nof_elements] = val;\n" " val_ptr->n_elements = nof_elements + 1;\n" - " dec_len += ret_val;\n" + " dec_len += (size_t)ret_val2;\n" " }\n\n" " dec_len += p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_ARRAY_END != token) {\n" @@ -1628,7 +1628,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " }\n" " return JSON_ERROR_FATAL;\n" " }\n\n" - " return dec_len;\n" + " return (int)dec_len;\n" "}\n\n" , name, type, type, type); } @@ -2607,7 +2607,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " if (own_tag)"); } src=mputprintf(src, - " {\n" /* Do empty element tag */ + " {\n" /* Do empty element tag */ "%s" " p_buf.put_c('<');\n" " if (e_xer) write_ns_prefix(p_td, p_buf);\n" @@ -2790,7 +2790,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct , force_gen_seof ? " && (p_td.xer_bits & XER_ATTRIBUTE)" : ""); } src=mputstr(src, - " if (own_tag){\n" + " if (own_tag) {\n" " p_buf.put_c('<');\n" " p_buf.put_c('/');\n" " if (e_xer) write_ns_prefix(p_td, p_buf);\n" @@ -3017,7 +3017,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct "int %s::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent)\n" "{\n" " json_token_t token = JSON_TOKEN_NONE;\n" - " int dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" + " size_t dec_len = p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_ERROR == token) {\n" " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" @@ -3028,7 +3028,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " set_size(0);\n" " for (int nof_elements = 0; TRUE; ++nof_elements) {\n" " size_t buf_pos = p_tok.get_buf_pos();\n" - " int ret_val;\n" + " size_t ret_val;\n" " if (NULL != p_td.json && p_td.json->metainfo_unbound) {\n" // check for metainfo object " ret_val = p_tok.get_next_token(&token, NULL, NULL);\n" @@ -3053,12 +3053,12 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " p_tok.set_buf_pos(buf_pos);\n" " }\n" " %s val;\n" - " ret_val = val.JSON_decode(*p_td.oftype_descr, p_tok, p_silent);\n" - " if (JSON_ERROR_INVALID_TOKEN == ret_val) {\n" + " int ret_val2 = val.JSON_decode(*p_td.oftype_descr, p_tok, p_silent);\n" + " if (JSON_ERROR_INVALID_TOKEN == ret_val2) {\n" " p_tok.set_buf_pos(buf_pos);\n" " break;\n" " }\n" - " else if (JSON_ERROR_FATAL == ret_val) {\n" + " else if (JSON_ERROR_FATAL == ret_val2) {\n" " if (p_silent) {\n" " clean_up();\n" " }\n" @@ -3066,7 +3066,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " }\n" " set_size(nof_elements + 1);\n" " value_elements[nof_elements] = val;\n" - " dec_len += ret_val;\n" + " dec_len += (size_t)ret_val2;\n" " }\n\n" " dec_len += p_tok.get_next_token(&token, NULL, NULL);\n" " if (JSON_TOKEN_ARRAY_END != token) {\n" @@ -3076,7 +3076,7 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " }\n" " return JSON_ERROR_FATAL;\n" " }\n\n" - " return dec_len;\n" + " return (int)dec_len;\n" "}\n\n" , name, type); } diff --git a/compiler2/union.c b/compiler2/union.c index 4cd7e6ed541e181a3554dc4dc7f3ad35efa2728c..7f3e175bb101b7782b296b1e57ab09c0214de2e2 100644 --- a/compiler2/union.c +++ b/compiler2/union.c @@ -1379,7 +1379,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) if (sdef->xerUseUnion || i > 0) src = mputprintf(src, " need_type = (%s_xer_.namelens[1] > 2) || %s_xer_.xsd_type != XSD_NONE;\n" , sdef->elements[i].typegen - , sdef->elements[i].typegen); + , sdef->elements[i].typegen); src = mputstr(src, " break;\n"); } @@ -1459,18 +1459,18 @@ void defUnionClass(struct_def const *sdef, output_struct *output) , selection_prefix, sdef->elements[i].name); if (!sdef->xerUseUnion) { // UseType src = mputprintf(src, - " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n" - " %s_xer_.namelens[1] > 2) {\n" - /* add the namespace prefix to the type attribute (if the name is not empty) */ - " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n" - " if (my_ns->px[0] != 0) {\n" - " type_name = mprintf(\"%%s:\", my_ns->px);\n" - " }\n" - " }\n" - " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n" - , sdef->elements[i].typegen, sdef->elements[i].typegen - , sdef->elements[i].typegen, sdef->elements[i].typegen - , sdef->elements[i].typegen, sdef->elements[i].typegen + " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n" + " %s_xer_.namelens[1] > 2) {\n" + /* add the namespace prefix to the type attribute (if the name is not empty) */ + " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n" + " if (my_ns->px[0] != 0) {\n" + " type_name = mprintf(\"%%s:\", my_ns->px);\n" + " }\n" + " }\n" + " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n" + , sdef->elements[i].typegen, sdef->elements[i].typegen + , sdef->elements[i].typegen, sdef->elements[i].typegen + , sdef->elements[i].typegen, sdef->elements[i].typegen , sdef->elements[i].typegen); } if (sdef->elements[i].xsd_type != XSD_NONE) { @@ -1600,18 +1600,18 @@ void defUnionClass(struct_def const *sdef, output_struct *output) , selection_prefix, sdef->elements[i].name); if (!sdef->xerUseUnion) { // UseType src = mputprintf(src, - " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n" - " %s_xer_.namelens[1] > 2) {\n" - /* add the namespace prefix to the type attribute (if the name is not empty) */ - " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n" - " if (my_ns->px[0] != 0) {\n" - " type_name = mprintf(\"%%s:\", my_ns->px);\n" - " }\n" - " }\n" - " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n" - , sdef->elements[i].typegen, sdef->elements[i].typegen - , sdef->elements[i].typegen, sdef->elements[i].typegen - , sdef->elements[i].typegen, sdef->elements[i].typegen + " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n" + " %s_xer_.namelens[1] > 2) {\n" + /* add the namespace prefix to the type attribute (if the name is not empty) */ + " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n" + " if (my_ns->px[0] != 0) {\n" + " type_name = mprintf(\"%%s:\", my_ns->px);\n" + " }\n" + " }\n" + " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n" + , sdef->elements[i].typegen, sdef->elements[i].typegen + , sdef->elements[i].typegen, sdef->elements[i].typegen + , sdef->elements[i].typegen, sdef->elements[i].typegen , sdef->elements[i].typegen); } if (sdef->elements[i].xsd_type != XSD_NONE) { @@ -2205,7 +2205,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) "}\n\n"); } else { // not "as value" src = mputprintf(src, - " int dec_len = p_tok.get_next_token(&j_token, NULL, NULL);\n" + " size_t dec_len = p_tok.get_next_token(&j_token, NULL, NULL);\n" " if (JSON_TOKEN_ERROR == j_token) {\n" " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" @@ -2232,7 +2232,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " }\n" " return JSON_ERROR_FATAL;\n" " } else {\n" - " dec_len += ret_val;\n" + " dec_len += (size_t)ret_val;\n" " }\n" " } else " , sdef->elements[i].jsonAlias ? sdef->elements[i].jsonAlias : sdef->elements[i].dispname @@ -2252,7 +2252,7 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_STATIC_OBJECT_END_TOKEN_ERROR, \"\");\n" " return JSON_ERROR_FATAL;\n" " }\n\n" - " return dec_len;\n" + " return (int)dec_len;\n" "}\n\n"); } } diff --git a/core/ASN_Null.cc b/core/ASN_Null.cc index e804d94044cb441efe8b5fe5270dbba704516533..ef8c4e07c9bfd81753d9d051d5b0970f4ce33515 100644 --- a/core/ASN_Null.cc +++ b/core/ASN_Null.cc @@ -307,7 +307,7 @@ int ASN_NULL::JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok) c int ASN_NULL::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = p_tok.get_next_token(&token, NULL, NULL); + size_t dec_len = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); return JSON_ERROR_FATAL; @@ -316,7 +316,7 @@ int ASN_NULL::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok, b return JSON_ERROR_INVALID_TOKEN; } bound_flag = TRUE; - return dec_len; + return (int)dec_len; } boolean operator==(asn_null_type, const ASN_NULL& other_value) diff --git a/core/Array.hh b/core/Array.hh index 5012c95d8f214040bc83c9fe094e893b399b3292..2531ef95a0e467eb30d0b53a789a14eba3ff9cc1 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -549,7 +549,7 @@ int VALUE_ARRAY<T_type,array_size,index_offset>::JSON_decode( const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = p_tok.get_next_token(&token, NULL, NULL); + size_t dec_len = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); return JSON_ERROR_FATAL; @@ -560,7 +560,7 @@ int VALUE_ARRAY<T_type,array_size,index_offset>::JSON_decode( for (unsigned int i = 0; i < array_size; ++i) { size_t buf_pos = p_tok.get_buf_pos(); - int ret_val; + size_t ret_val; if (NULL != p_td.json && p_td.json->metainfo_unbound) { // check for metainfo object ret_val = p_tok.get_next_token(&token, NULL, NULL); @@ -584,19 +584,19 @@ int VALUE_ARRAY<T_type,array_size,index_offset>::JSON_decode( // metainfo object not found, jump back and let the element type decode it p_tok.set_buf_pos(buf_pos); } - ret_val = array_elements[i].JSON_decode(*get_elem_descr(), p_tok, p_silent); - if (JSON_ERROR_INVALID_TOKEN == ret_val) { + int ret_val2 = array_elements[i].JSON_decode(*get_elem_descr(), p_tok, p_silent); + if (JSON_ERROR_INVALID_TOKEN == ret_val2) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_ARRAY_ELEM_TOKEN_ERROR, array_size - i, (array_size - i > 1) ? "s" : ""); return JSON_ERROR_FATAL; } - else if (JSON_ERROR_FATAL == ret_val) { + else if (JSON_ERROR_FATAL == ret_val2) { if (p_silent) { clean_up(); } return JSON_ERROR_FATAL; } - dec_len += ret_val; + dec_len += (size_t)ret_val2; } dec_len += p_tok.get_next_token(&token, NULL, NULL); diff --git a/core/Bitstring.cc b/core/Bitstring.cc index ace5b3707fb5c38c14020d3e888cf061308289f6..7dd470baab26ece5c3d4c62055ce7a27e9ac94cc 100644 --- a/core/Bitstring.cc +++ b/core/Bitstring.cc @@ -1189,7 +1189,7 @@ int BITSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ char* value = 0; size_t value_len = 0; boolean error = FALSE; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1232,7 +1232,7 @@ int BITSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ } return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } diff --git a/core/Boolean.cc b/core/Boolean.cc index a36cd0df436e87c6feee673bff0e33b71f4cbf1a..df037f74aa0ca59d80ae674febd4bda4ad4f2634 100644 --- a/core/Boolean.cc +++ b/core/Boolean.cc @@ -746,7 +746,7 @@ int BOOLEAN::JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok) co int BOOLEAN::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = 0; + size_t dec_len = 0; if (p_td.json->default_value && 0 == p_tok.get_buffer_length()) { // No JSON data in the buffer -> use default value if (strcmp(p_td.json->default_value, "true") == 0) { @@ -774,7 +774,7 @@ int BOOLEAN::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_to bound_flag = FALSE; return JSON_ERROR_INVALID_TOKEN; } - return dec_len; + return (int)dec_len; } diff --git a/core/Charstring.cc b/core/Charstring.cc index 260b9be70dbb011aa7f506dc20609f97e510a42a..13afe2c2a5e0ef733f9625bce677706f042a2363 100644 --- a/core/Charstring.cc +++ b/core/Charstring.cc @@ -1733,7 +1733,7 @@ int CHARSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1755,7 +1755,7 @@ int CHARSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p } else { return JSON_ERROR_INVALID_TOKEN; } - return dec_len; + return (int)dec_len; } diff --git a/core/Float.cc b/core/Float.cc index b8021cdc960a8abec79344a4bfbebcbafb6bb94e..b4ea6074595d25d05717782309a1c4616496c0b1 100644 --- a/core/Float.cc +++ b/core/Float.cc @@ -1111,7 +1111,7 @@ int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1165,7 +1165,7 @@ int FLOAT::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, bound_flag = TRUE; Free(value2); } - return dec_len; + return (int)dec_len; } diff --git a/core/Hexstring.cc b/core/Hexstring.cc index d2b3e022d9e33e396dd58c692bbf6bed136aee0b..1515b3de9417262727e76149abcbb1987aacfdf6 100644 --- a/core/Hexstring.cc +++ b/core/Hexstring.cc @@ -1079,7 +1079,7 @@ int HEXSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ char* value = 0; size_t value_len = 0; boolean error = FALSE; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1122,7 +1122,7 @@ int HEXSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_ } return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } diff --git a/core/Integer.cc b/core/Integer.cc index dc6442f7d31cfcbe9fcdc50a31f3d8dc6be9c6fe..2850f7d116491c028e6845bc720bd9f13f8b2036 100644 --- a/core/Integer.cc +++ b/core/Integer.cc @@ -1738,7 +1738,7 @@ int INTEGER::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_to json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1765,7 +1765,7 @@ int INTEGER::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_to bound_flag = FALSE; return JSON_ERROR_INVALID_TOKEN; } - return dec_len; + return (int)dec_len; } @@ -2104,9 +2104,9 @@ boolean INTEGER_template::match(int other_value, boolean /* legacy */) const // Lower boundary is set. if (!lower_boundary) { if (!value_range.min_is_exclusive) { - lower_boundary = (likely(value_range.min_value.native_flag) ? - int_val_t(value_range.min_value.val.native) : - int_val_t(BN_dup(value_range.min_value.val.openssl))) <= other_value; + lower_boundary = (likely(value_range.min_value.native_flag) ? + int_val_t(value_range.min_value.val.native) : + int_val_t(BN_dup(value_range.min_value.val.openssl))) <= other_value; } else { lower_boundary = (likely(value_range.min_value.native_flag) ? int_val_t(value_range.min_value.val.native) : @@ -2116,9 +2116,9 @@ boolean INTEGER_template::match(int other_value, boolean /* legacy */) const // Upper boundary is set. if (!upper_boundary) { if (!value_range.max_is_exclusive) { - upper_boundary = (likely(value_range.max_value.native_flag) ? - int_val_t(value_range.max_value.val.native) : - int_val_t(BN_dup(value_range.max_value.val.openssl))) >= other_value; + upper_boundary = (likely(value_range.max_value.native_flag) ? + int_val_t(value_range.max_value.val.native) : + int_val_t(BN_dup(value_range.max_value.val.openssl))) >= other_value; } else { upper_boundary = (likely(value_range.max_value.native_flag) ? int_val_t(value_range.max_value.val.native) : @@ -2177,8 +2177,8 @@ boolean INTEGER_template::match(const INTEGER& other_value, } else { upper_boundary = (likely(value_range.max_value.native_flag) ? int_val_t(value_range.max_value.val.native) : - int_val_t(BN_dup(value_range.max_value.val.openssl))) >= other_value.get_val(); - } + int_val_t(BN_dup(value_range.max_value.val.openssl))) >= other_value.get_val(); + } } return lower_boundary && upper_boundary; } default: diff --git a/core/Objid.cc b/core/Objid.cc index ee8b4bcb0263f36d1759409e8be0e29a4cbccb91..522c7a6ca4f4f94f46c9ba2e80f8db81341d350f 100644 --- a/core/Objid.cc +++ b/core/Objid.cc @@ -622,7 +622,7 @@ int OBJID::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, char* value = 0; size_t value_len = 0; boolean error = FALSE; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -659,7 +659,7 @@ int OBJID::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, } return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } void OBJID_template::clean_up() diff --git a/core/Octetstring.cc b/core/Octetstring.cc index 0ee71520fc35e4343455c0b04d2fc5c5bf5a33bb..4f5ef7b9c9b9d4f4e90354d484e581960379efdd 100644 --- a/core/Octetstring.cc +++ b/core/Octetstring.cc @@ -1302,7 +1302,7 @@ int OCTETSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& char* value = 0; size_t value_len = 0; boolean error = FALSE; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -1348,7 +1348,7 @@ int OCTETSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& } return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } // octetstring element class diff --git a/core/Optional.hh b/core/Optional.hh index 2900d5fc835f26d330abd90fdfd61e6ff6039891..becc7ec3829ddeb62a3333555c0162d00677475e 100644 --- a/core/Optional.hh +++ b/core/Optional.hh @@ -873,13 +873,13 @@ int OPTIONAL<T_type>::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokeni // able to decode a "null" value p_tok.set_buf_pos(buf_pos); json_token_t token = JSON_TOKEN_NONE; - dec_len = p_tok.get_next_token(&token, NULL, NULL); + p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_LITERAL_NULL == token) { set_to_omit(); } else { // cannot get JSON_TOKEN_ERROR here, that was already checked by the optional value - dec_len = JSON_ERROR_INVALID_TOKEN; + return JSON_ERROR_INVALID_TOKEN; } } return dec_len; diff --git a/core/Universal_charstring.cc b/core/Universal_charstring.cc index eefcb9190a5b09e692e438aa214be3f25d761ee2..0bb572077ba37bb38535c8b99f7a585a2ff8bfe9 100644 --- a/core/Universal_charstring.cc +++ b/core/Universal_charstring.cc @@ -2536,7 +2536,7 @@ int UNIVERSAL_CHARSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_To json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -2567,7 +2567,7 @@ int UNIVERSAL_CHARSTRING::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_To } else { return JSON_ERROR_INVALID_TOKEN; } - return dec_len; + return (int)dec_len; } diff --git a/core/Verdicttype.cc b/core/Verdicttype.cc index 592d8c87181d1ed457054210b7b92f991e6be958..26be2197bfe1d4aac9b8f2f08d8d8142caef2179 100644 --- a/core/Verdicttype.cc +++ b/core/Verdicttype.cc @@ -385,7 +385,7 @@ int VERDICTTYPE::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& json_token_t token = JSON_TOKEN_NONE; char* value = 0; size_t value_len = 0; - int dec_len = 0; + size_t dec_len = 0; boolean use_default = p_td.json->default_value && 0 == p_tok.get_buffer_length(); if (use_default) { // No JSON data in the buffer -> use default value @@ -417,14 +417,14 @@ int VERDICTTYPE::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& } else { error = FALSE; verdict_value = UNBOUND_VERDICT; - dec_len = JSON_ERROR_INVALID_TOKEN; + return JSON_ERROR_INVALID_TOKEN; } if (error) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_FORMAT_ERROR, "string", "verdicttype"); verdict_value = UNBOUND_VERDICT; - dec_len = JSON_ERROR_FATAL; + return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } diff --git a/core2/Basetype2.cc b/core2/Basetype2.cc index 86533d1b6287d13dabac61afc2d5c38423b8a53f..e889ceb2ebf3ebd07800a8ff928b0d10306137bd 100644 --- a/core2/Basetype2.cc +++ b/core2/Basetype2.cc @@ -1574,7 +1574,7 @@ int Record_Of_Type::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_desc int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = p_tok.get_next_token(&token, NULL, NULL); + size_t dec_len = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); return JSON_ERROR_FATAL; @@ -1587,7 +1587,7 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize for (int nof_elements = 0; TRUE; ++nof_elements) { // Read value tokens until we reach some other token size_t buf_pos = p_tok.get_buf_pos(); - int ret_val; + size_t ret_val; if (NULL != p_td.json && p_td.json->metainfo_unbound) { // check for metainfo object ret_val = p_tok.get_next_token(&token, NULL, NULL); @@ -1612,14 +1612,14 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize p_tok.set_buf_pos(buf_pos); } Base_Type* val = create_elem(); - ret_val = val->JSON_decode(*p_td.oftype_descr, p_tok, p_silent); - if (JSON_ERROR_INVALID_TOKEN == ret_val) { + int ret_val2 = val->JSON_decode(*p_td.oftype_descr, p_tok, p_silent); + if (JSON_ERROR_INVALID_TOKEN == ret_val2) { // undo the last action on the buffer p_tok.set_buf_pos(buf_pos); delete val; break; } - else if (JSON_ERROR_FATAL == ret_val) { + else if (JSON_ERROR_FATAL == ret_val2) { delete val; if (p_silent) { clean_up(); @@ -1636,7 +1636,7 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize get_at(nof_elements)->set_value(val); delete val; } - dec_len += ret_val; + dec_len += (size_t)ret_val2; } dec_len += p_tok.get_next_token(&token, NULL, NULL); @@ -1648,7 +1648,7 @@ int Record_Of_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenize return JSON_ERROR_FATAL; } - return dec_len; + return (int)dec_len; } void Record_Of_Type::encode(const TTCN_Typedescriptor_t& p_td, @@ -5889,7 +5889,7 @@ int Record_Type::JSON_encode_negtest(const Erroneous_descriptor_t* p_err_descr, int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = p_tok.get_next_token(&token, NULL, NULL); + size_t dec_len = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); return JSON_ERROR_FATAL; @@ -5990,9 +5990,9 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& } else { buf_pos = p_tok.get_buf_pos(); - int ret_val = get_at(field_idx)->JSON_decode(*fld_descr(field_idx), p_tok, p_silent); - if (0 > ret_val) { - if (JSON_ERROR_INVALID_TOKEN == ret_val) { + int ret_val2 = get_at(field_idx)->JSON_decode(*fld_descr(field_idx), p_tok, p_silent); + if (0 > ret_val2) { + if (JSON_ERROR_INVALID_TOKEN == ret_val2) { // undo the last action on the buffer, check if the invalid token was a null token p_tok.set_buf_pos(buf_pos); p_tok.get_next_token(&token, NULL, NULL); @@ -6011,7 +6011,7 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& } return JSON_ERROR_FATAL; } - dec_len += ret_val; + dec_len += (size_t)ret_val2; } } } @@ -6047,7 +6047,7 @@ int Record_Type::JSON_decode(const TTCN_Typedescriptor_t& p_td, JSON_Tokenizer& delete[] metainfo; - return dec_len; + return (int)dec_len; } //////////////////////////////////////////////////////////////////////////////// @@ -6403,7 +6403,7 @@ int Empty_Record_Type::JSON_encode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& int Empty_Record_Type::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& p_tok, boolean p_silent) { json_token_t token = JSON_TOKEN_NONE; - int dec_len = p_tok.get_next_token(&token, NULL, NULL); + size_t dec_len = p_tok.get_next_token(&token, NULL, NULL); if (JSON_TOKEN_ERROR == token) { JSON_ERROR(TTCN_EncDec::ET_INVAL_MSG, JSON_DEC_BAD_TOKEN_ERROR, ""); return JSON_ERROR_FATAL; @@ -6420,7 +6420,7 @@ int Empty_Record_Type::JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer& bound_flag = TRUE; - return dec_len; + return (int)dec_len; } boolean operator==(null_type /*null_value*/, const Empty_Record_Type& other_value)