Reorganize the field decoder interface.

This makes the field decoding functions more intuitive to use.
The old interface is still present if you specify NANOPB_INTERNALS.

Update issue 2
Status: FixedInGit
This commit is contained in:
Petteri Aimonen
2012-08-24 20:23:25 +03:00
parent dc2da0edc5
commit 2941e90e04
6 changed files with 150 additions and 152 deletions

View File

@@ -1,3 +1,5 @@
#define NANOPB_INTERNALS
#include <stdio.h>
#include <string.h>
#include "pb_decode.h"

View File

@@ -37,7 +37,7 @@ bool print_int32(pb_istream_t *stream, const pb_field_t *field, void *arg)
bool print_fixed32(pb_istream_t *stream, const pb_field_t *field, void *arg)
{
uint32_t value;
if (!pb_dec_fixed32(stream, NULL, &value))
if (!pb_decode_fixed32(stream, &value))
return false;
printf((char*)arg, (long)value);
@@ -47,7 +47,7 @@ bool print_fixed32(pb_istream_t *stream, const pb_field_t *field, void *arg)
bool print_fixed64(pb_istream_t *stream, const pb_field_t *field, void *arg)
{
uint64_t value;
if (!pb_dec_fixed64(stream, NULL, &value))
if (!pb_decode_fixed64(stream, &value))
return false;
printf((char*)arg, (long long)value);