14 if (iter->index >= iter->descriptor->field_count)
18 iter->type = (
pb_type_t)((word0 >> 8) & 0xFF);
25 iter->tag = (
pb_size_t)((word0 >> 2) & 0x3F);
27 data_offset = (word0 >> 16) & 0xFF;
28 iter->data_size = (
pb_size_t)((word0 >> 28) & 0x0F);
36 iter->array_size = (
pb_size_t)((word0 >> 16) & 0x0FFF);
37 iter->tag = (
pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6));
39 data_offset = word1 & 0xFFFF;
40 iter->data_size = (
pb_size_t)((word1 >> 16) & 0x0FFF);
50 iter->array_size = (
pb_size_t)(word0 >> 16);
51 iter->tag = (
pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
66 iter->tag = (
pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
82 iter->pField = (
char*)iter->message + data_offset;
86 iter->pSize = (
char*)iter->pField - size_offset;
93 iter->pSize = &iter->array_size;
102 iter->pData = *(
void**)iter->pField;
106 iter->pData = iter->pField;
112 iter->submsg_desc = iter->descriptor->submsg_info[iter->submessage_index];
116 iter->submsg_desc =
NULL;
126 if (iter->index >= iter->descriptor->field_count)
130 iter->field_info_index = 0;
131 iter->submessage_index = 0;
132 iter->required_field_index = 0;
143 pb_type_t prev_type = (prev_descriptor >> 8) & 0xFF;
150 iter->field_info_index = (
pb_size_t)(iter->field_info_index + descriptor_len);
158 memset(iter, 0,
sizeof(*iter));
160 iter->descriptor = desc;
161 iter->message = message;
168 const pb_msgdesc_t *msg = (
const pb_msgdesc_t*)extension->type->arg;
184 iter->pSize = &extension->found;
192 return iter->index != 0;
197 if (iter->tag == tag)
201 else if (tag > iter->descriptor->largest_tag)
215 iter->index = iter->descriptor->field_count;
226 if (((fieldinfo >> 2) & 0x3F) == (tag & 0x3F))
231 if (iter->tag == tag &&
238 }
while (iter->index != start);
269 }
while (iter->index != start);
302 if (field->data_size ==
sizeof(pb_callback_t))
304 pb_callback_t *pCallback = (pb_callback_t*)field->pData;
306 if (pCallback !=
NULL)
308 if (istream !=
NULL && pCallback->funcs.decode !=
NULL)
310 return pCallback->funcs.decode(istream, field, &pCallback->arg);
313 if (ostream !=
NULL && pCallback->funcs.encode !=
NULL)
315 return pCallback->funcs.encode(ostream, field, &pCallback->arg);
324#ifdef PB_VALIDATE_UTF8
334bool pb_validate_utf8(
const char *str)
344 else if ((s[0] & 0xe0) == 0xc0)
347 if ((s[1] & 0xc0) != 0x80 ||
348 (s[0] & 0xfe) == 0xc0)
353 else if ((s[0] & 0xf0) == 0xe0)
356 if ((s[1] & 0xc0) != 0x80 ||
357 (s[2] & 0xc0) != 0x80 ||
358 (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) ||
359 (s[0] == 0xed && (s[1] & 0xe0) == 0xa0) ||
360 (s[0] == 0xef && s[1] == 0xbf &&
361 (s[2] & 0xfe) == 0xbe))
366 else if ((s[0] & 0xf8) == 0xf0)
369 if ((s[1] & 0xc0) != 0x80 ||
370 (s[2] & 0xc0) != 0x80 ||
371 (s[3] & 0xc0) != 0x80 ||
372 (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) ||
373 (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4)
MOSAPI void(1, 2) fatal_abort(const char *fmt
#define PB_LTYPE_EXTENSION
#define PB_HTYPE_REQUIRED
pb_field_iter_t pb_field_t
#define PB_HTYPE_REPEATED
#define PB_LTYPE_IS_SUBMSG(x)
#define PB_PROGMEM_READU32(x)
static bool load_descriptor_values(pb_field_iter_t *iter)
bool pb_field_iter_next(pb_field_iter_t *iter)
bool pb_field_iter_find_extension(pb_field_iter_t *iter)
bool pb_default_field_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field)
bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension)
bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension)
static void * pb_const_cast(const void *p)
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message)
bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
static void advance_iterator(pb_field_iter_t *iter)
bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message)
static void * memset(void *s, int c, size_t n)