Found mistakes in my example after posted it, fixed version:
ssize_t encode_field_i32(iter_t *iter,
int field_num,
field_encoding_t field_encoding,
int32_t value)
{
ssize_t encoded_size;
encoded_size = encode_field_key(iter, field_num, field_encoding);
if (encoded_size < 0) {
return encoded_size;
}
switch (field_encoding) {
case FIXED32:
return write(iter, &value, sizeof(value));
case VINT_SIGNED:
return write_i32_as_vint8(iter, value);
case VINT_ZIGZAG:
return write_i32_as_zzvint8(iter, value);
default:
errno = EINVAL;
return -1;
}
}
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.