Lines Matching refs:descr

527 			 const struct json_obj_descr *descr, size_t descr_len,
536 const struct json_obj_descr *descr, in decode_value() argument
540 if (!equivalent_types(value->type, descr->type)) { in decode_value()
544 switch (descr->type) { in decode_value()
546 return obj_parse(obj, descr->object.sub_descr, in decode_value()
547 descr->object.sub_descr_len, in decode_value()
550 return arr_parse(obj, descr->array.element_descr, in decode_value()
551 descr->array.n_elements, field, val); in decode_value()
603 static ptrdiff_t get_elem_size(const struct json_obj_descr *descr) in get_elem_size() argument
605 switch (descr->type) { in get_elem_size()
624 size = descr->array.n_elements * get_elem_size(descr->array.element_descr); in get_elem_size()
626 if (descr->field_name_len > 0) { in get_elem_size()
637 for (i = 0; i < descr->object.sub_descr_len; i++) { in get_elem_size()
638 total += get_elem_size(&descr->object.sub_descr[i]); in get_elem_size()
640 if (descr->object.sub_descr[i].align_shift > align_shift) { in get_elem_size()
641 align_shift = descr->object.sub_descr[i].align_shift; in get_elem_size()
741 static int64_t obj_parse(struct json_obj *obj, const struct json_obj_descr *descr, in obj_parse() argument
755 void *decode_field = (char *)val + descr[i].offset; in obj_parse()
763 if (kv.key_len != descr[i].field_name_len) { in obj_parse()
767 if (memcmp(kv.key, descr[i].field_name, in obj_parse()
768 descr[i].field_name_len)) { in obj_parse()
773 ret = decode_value(obj, &descr[i], &kv.value, in obj_parse()
796 const struct json_obj_descr *descr, size_t descr_len, in json_obj_parse() argument
809 return obj_parse(&obj, descr, descr_len, val); in json_obj_parse()
813 const struct json_obj_descr *descr, void *val) in json_arr_parse() argument
823 void *ptr = (char *)val + descr->offset; in json_arr_parse()
825 return arr_parse(&arr, descr->array.element_descr, in json_arr_parse()
826 descr->array.n_elements, ptr, val); in json_arr_parse()
835 int json_arr_separate_parse_object(struct json_obj *json, const struct json_obj_descr *descr, in json_arr_separate_parse_object() argument
856 return obj_parse(json, descr, descr_len, val); in json_arr_separate_parse_object()
957 static int encode(const struct json_obj_descr *descr, const void *val,
1133 static int encode(const struct json_obj_descr *descr, const void *val, in encode() argument
1136 void *ptr = (char *)val + descr->offset; in encode()
1138 switch (descr->type) { in encode()
1145 return arr_encode(descr->array.element_descr, ptr, in encode()
1148 return json_obj_encode(descr->object.sub_descr, in encode()
1149 descr->object.sub_descr_len, in encode()
1168 int json_obj_encode(const struct json_obj_descr *descr, size_t descr_len, in json_obj_encode() argument
1181 ret = str_encode((const char **)&descr[i].field_name, in json_obj_encode()
1192 ret = encode(&descr[i], val, append_bytes, data); in json_obj_encode()
1208 int json_arr_encode(const struct json_obj_descr *descr, const void *val, in json_arr_encode() argument
1211 void *ptr = (char *)val + descr->offset; in json_arr_encode()
1213 return arr_encode(descr->array.element_descr, ptr, val, append_bytes, in json_arr_encode()
1238 int json_obj_encode_buf(const struct json_obj_descr *descr, size_t descr_len, in json_obj_encode_buf() argument
1243 return json_obj_encode(descr, descr_len, val, append_bytes_to_buf, in json_obj_encode_buf()
1247 int json_arr_encode_buf(const struct json_obj_descr *descr, const void *val, in json_arr_encode_buf() argument
1252 return json_arr_encode(descr, val, append_bytes_to_buf, &appender); in json_arr_encode_buf()
1266 ssize_t json_calc_encoded_len(const struct json_obj_descr *descr, in json_calc_encoded_len() argument
1272 ret = json_obj_encode(descr, descr_len, val, measure_bytes, &total); in json_calc_encoded_len()
1280 ssize_t json_calc_encoded_arr_len(const struct json_obj_descr *descr, in json_calc_encoded_arr_len() argument
1286 ret = json_arr_encode(descr, val, measure_bytes, &total); in json_calc_encoded_arr_len()