/nanopb-2.7.6/tests/common_unittests/ |
D | common_unittests.c | 15 pb_field_iter_t iter; in main() local 19 TEST(pb_field_iter_begin(&iter, AllTypes_fields, &msg)) in main() 21 TEST(iter.tag == 1 && iter.pData == &msg.req_int32 && !iter.pSize) in main() 22 …TEST(pb_field_iter_next(&iter) && iter.tag == 2 && iter.pData == &msg.req_int64 && !iter.pSize) in main() 23 …TEST(pb_field_iter_next(&iter) && iter.tag == 3 && iter.pData == &msg.req_uint32 && !iter.pSize) in main() 24 …TEST(pb_field_iter_next(&iter) && iter.tag == 4 && iter.pData == &msg.req_uint64 && !iter.pSize) in main() 25 …TEST(pb_field_iter_next(&iter) && iter.tag == 5 && iter.pData == &msg.req_sint32 && !iter.pSize) in main() 26 …TEST(pb_field_iter_next(&iter) && iter.tag == 6 && iter.pData == &msg.req_sint64 && !iter.pSize) in main() 27 …TEST(pb_field_iter_next(&iter) && iter.tag == 7 && iter.pData == &msg.req_bool && !iter.pSize) in main() 28 …TEST(pb_field_iter_next(&iter) && iter.tag == 8 && iter.pData == &msg.req_fixed32 && !iter.pSize) in main() [all …]
|
/nanopb-2.7.6/ |
D | pb_common.c | 8 static bool load_descriptor_values(pb_field_iter_t *iter) in load_descriptor_values() argument 14 if (iter->index >= iter->descriptor->field_count) in load_descriptor_values() 17 word0 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]); in load_descriptor_values() 18 iter->type = (pb_type_t)((word0 >> 8) & 0xFF); in load_descriptor_values() 24 iter->array_size = 1; in load_descriptor_values() 25 iter->tag = (pb_size_t)((word0 >> 2) & 0x3F); in load_descriptor_values() 28 iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F); in load_descriptor_values() 34 … uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]); in load_descriptor_values() 36 iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF); in load_descriptor_values() 37 iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6)); in load_descriptor_values() [all …]
|
D | pb_common.h | 16 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message); 19 bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension); 24 bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message… 25 bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension); 29 bool pb_field_iter_next(pb_field_iter_t *iter); 33 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); 37 bool pb_field_iter_find_extension(pb_field_iter_t *iter);
|
D | pb_decode.c | 35 static bool pb_message_set_to_defaults(pb_field_iter_t *iter); 820 pb_field_iter_t iter; in default_extension_decoder() local 822 if (!pb_field_iter_begin_extension(&iter, extension)) in default_extension_decoder() 825 if (iter.tag != tag || !iter.message) in default_extension_decoder() 829 return decode_field(stream, wire_type, &iter); in default_extension_decoder() 939 static bool pb_message_set_to_defaults(pb_field_iter_t *iter) in pb_message_set_to_defaults() argument 946 if (iter->descriptor->default_value) in pb_message_set_to_defaults() 948 defstream = pb_istream_from_buffer(iter->descriptor->default_value, (size_t)-1); in pb_message_set_to_defaults() 955 if (!pb_field_set_to_default(iter)) in pb_message_set_to_defaults() 958 if (tag != 0 && iter->tag == tag) in pb_message_set_to_defaults() [all …]
|
D | pb_encode.c | 318 pb_field_iter_t iter; in pb_check_proto3_default_value() local 319 if (pb_field_iter_begin(&iter, field->submsg_desc, field->pData)) in pb_check_proto3_default_value() 323 if (!pb_check_proto3_default_value(&iter)) in pb_check_proto3_default_value() 327 } while (pb_field_iter_next(&iter)); in pb_check_proto3_default_value() 473 pb_field_iter_t iter; in default_extension_encoder() local 475 if (!pb_field_iter_begin_extension_const(&iter, extension)) in default_extension_encoder() 478 return encode_field(stream, &iter); in default_extension_encoder() 511 pb_field_iter_t iter; in pb_encode() local 512 if (!pb_field_iter_begin_const(&iter, fields, src_struct)) in pb_encode() 516 if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION) in pb_encode() [all …]
|
/nanopb-2.7.6/tests/fuzztest/ |
D | validation.c | 6 void validate_static(pb_field_iter_t *iter) in validate_static() argument 13 if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED && iter->pSize) in validate_static() 16 count = *(pb_size_t*)iter->pSize; in validate_static() 17 assert(count <= iter->array_size); in validate_static() 19 else if (PB_HTYPE(iter->type) == PB_HTYPE_OPTIONAL && iter->pSize) in validate_static() 22 assert(memcmp(iter->pSize, &truebool, sizeof(bool)) == 0 || in validate_static() 23 memcmp(iter->pSize, &falsebool, sizeof(bool)) == 0); in validate_static() 25 else if (PB_HTYPE(iter->type) == PB_HTYPE_ONEOF) in validate_static() 27 if (*(pb_size_t*)iter->pSize != iter->tag) in validate_static() 36 void *pData = (char*)iter->pData + iter->data_size * i; in validate_static() [all …]
|
D | generate_message.c | 24 pb_field_iter_t iter; in limit_sizes() local 25 pb_field_iter_begin(&iter, alltypes_static_AllTypes_fields, msg); in limit_sizes() 26 while (pb_field_iter_next(&iter)) in limit_sizes() 28 if (PB_LTYPE(iter.type) == PB_LTYPE_BYTES) in limit_sizes() 30 ((pb_bytes_array_t*)iter.pData)->size %= iter.data_size - PB_BYTES_ARRAY_T_ALLOCSIZE(0); in limit_sizes() 33 if (PB_HTYPE(iter.type) == PB_HTYPE_REPEATED) in limit_sizes() 35 *((pb_size_t*)iter.pSize) %= iter.array_size; in limit_sizes() 38 if (PB_HTYPE(iter.type) == PB_HTYPE_ONEOF) in limit_sizes() 43 *((pb_size_t*)iter.pSize) = iter.tag; in limit_sizes()
|
/nanopb-2.7.6/spm_headers/nanopb/ |
D | pb_common.h | 16 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message); 19 bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension); 24 bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message… 25 bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension); 29 bool pb_field_iter_next(pb_field_iter_t *iter); 33 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); 37 bool pb_field_iter_find_extension(pb_field_iter_t *iter);
|
/nanopb-2.7.6/tests/multiple_files/ |
D | test_multiple_files.c | 21 pb_field_iter_t iter; in main() local 23 TEST(pb_field_iter_begin(&iter, Enums_fields, &msg)); in main() 24 TEST(PB_LTYPE(iter.type) == PB_LTYPE_VARINT); in main() 25 TEST(pb_field_iter_next(&iter)); in main() 26 TEST(PB_LTYPE(iter.type) == PB_LTYPE_UVARINT); in main()
|
/nanopb-2.7.6/examples/using_union_messages/ |
D | encode.c | 20 pb_field_iter_t iter; in encode_unionmessage() local 22 if (!pb_field_iter_begin(&iter, UnionMessage_fields, message)) in encode_unionmessage() 27 if (iter.submsg_desc == messagetype) in encode_unionmessage() 30 if (!pb_encode_tag_for_field(stream, &iter)) in encode_unionmessage() 35 } while (pb_field_iter_next(&iter)); in encode_unionmessage()
|
D | decode.c | 28 pb_field_iter_t iter; in decode_unionmessage_type() local 29 if (pb_field_iter_begin(&iter, UnionMessage_fields, NULL) && in decode_unionmessage_type() 30 pb_field_iter_find(&iter, tag)) in decode_unionmessage_type() 33 return iter.submsg_desc; in decode_unionmessage_type()
|
/nanopb-2.7.6/docs/ |
D | reference.md | 978 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message); 982 | iter | Pointer to destination [pb_field_iter_t](#pb_field_iter_t) variable. 991 bool pb_field_iter_next(pb_field_iter_t *iter); 995 | iter | Pointer to `pb_field_iter_t` previously initialized by [pb_field_iter_begi… 999 will return false and initialize `iter` back to the first field in the 1006 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); 1010 | iter | Pointer to `pb_field_iter_t` previously initialized by [pb_field_iter_begi… 1014 This function is functionally identical to calling `pb_field_iter_next()` until `iter.tag` equals t…
|