Refactoring the field encoder interface.
Replaced the confusing pb_enc_* functions with new pb_encode_* functions that have a cleaner interface. Updated documentation. Got rid of the endian_copy stuff in pb_encode.c, instead using C casts to do it automatically. This makes the code safer and also reduces binary size by about 5%. Fixes Issue 6.
This commit is contained in:
@@ -29,7 +29,7 @@ bool encode_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *a
|
||||
return false;
|
||||
|
||||
uint32_t value = 42;
|
||||
return pb_enc_fixed32(stream, field, &value);
|
||||
return pb_encode_fixed32(stream, &value);
|
||||
}
|
||||
|
||||
bool encode_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *arg)
|
||||
@@ -38,7 +38,7 @@ bool encode_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *a
|
||||
return false;
|
||||
|
||||
uint64_t value = 42;
|
||||
return pb_enc_fixed64(stream, field, &value);
|
||||
return pb_encode_fixed64(stream, &value);
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
Reference in New Issue
Block a user