Home
last modified time | relevance | path

Searched refs:iter (Results 1 – 12 of 12) sorted by relevance

/nanopb-3.4.0/tests/common_unittests/
Dcommon_unittests.c15 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-3.4.0/
Dpb_common.c8 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 …]
Dpb_common.h16 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);
Dpb_decode.c35 static bool pb_message_set_to_defaults(pb_field_iter_t *iter);
831 pb_field_iter_t iter; in default_extension_decoder() local
833 if (!pb_field_iter_begin_extension(&iter, extension)) in default_extension_decoder()
836 if (iter.tag != tag || !iter.message) in default_extension_decoder()
840 return decode_field(stream, wire_type, &iter); in default_extension_decoder()
950 static bool pb_message_set_to_defaults(pb_field_iter_t *iter) in pb_message_set_to_defaults() argument
957 if (iter->descriptor->default_value) in pb_message_set_to_defaults()
959 defstream = pb_istream_from_buffer(iter->descriptor->default_value, (size_t)-1); in pb_message_set_to_defaults()
966 if (!pb_field_set_to_default(iter)) in pb_message_set_to_defaults()
969 if (tag != 0 && iter->tag == tag) in pb_message_set_to_defaults()
[all …]
Dpb_encode.c320 pb_field_iter_t iter; in pb_check_proto3_default_value() local
321 if (pb_field_iter_begin(&iter, field->submsg_desc, field->pData)) in pb_check_proto3_default_value()
325 if (!pb_check_proto3_default_value(&iter)) in pb_check_proto3_default_value()
329 } while (pb_field_iter_next(&iter)); in pb_check_proto3_default_value()
475 pb_field_iter_t iter; in default_extension_encoder() local
477 if (!pb_field_iter_begin_extension_const(&iter, extension)) in default_extension_encoder()
480 return encode_field(stream, &iter); in default_extension_encoder()
513 pb_field_iter_t iter; in pb_encode() local
514 if (!pb_field_iter_begin_const(&iter, fields, src_struct)) in pb_encode()
518 if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION) in pb_encode()
[all …]
/nanopb-3.4.0/tests/fuzztest/
Dvalidation.c6 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 …]
Dgenerate_message.c24 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-3.4.0/spm_headers/nanopb/
Dpb_common.h16 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-3.4.0/tests/multiple_files/
Dtest_multiple_files.c21 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-3.4.0/examples/using_union_messages/
Dencode.c20 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()
Ddecode.c28 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-3.4.0/docs/
Dreference.md991 bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message);
995 | iter | Pointer to destination [pb_field_iter_t](#pb_field_iter_t) variable.
1004 bool pb_field_iter_next(pb_field_iter_t *iter);
1008 | iter | Pointer to `pb_field_iter_t` previously initialized by [pb_field_iter_begi…
1012 will return false and initialize `iter` back to the first field in the
1019 bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
1023 | iter | Pointer to `pb_field_iter_t` previously initialized by [pb_field_iter_begi…
1027 This function is functionally identical to calling `pb_field_iter_next()` until `iter.tag` equals t…