X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftest_decode_callbacks.c;h=7ce4ec0b683fb34e7787ef2a1222b96b0b5a05d1;hb=214b0eae8aa011fa8b3e8a3dcc784f8d423aeffb;hp=aaf4cdcc93d809379c0f65adb49293adb8857a05;hpb=e66675a25d39bb5dfebea3041c8f2360bcac290c;p=apps%2Fagl-service-can-low-level.git diff --git a/tests/test_decode_callbacks.c b/tests/test_decode_callbacks.c index aaf4cdcc..7ce4ec0b 100644 --- a/tests/test_decode_callbacks.c +++ b/tests/test_decode_callbacks.c @@ -6,7 +6,7 @@ #include #include "callbacks.pb.h" -bool print_string(pb_istream_t *stream, const pb_field_t *field, void *arg) +bool print_string(pb_istream_t *stream, const pb_field_t *field, void **arg) { uint8_t buffer[1024] = {0}; @@ -20,37 +20,37 @@ bool print_string(pb_istream_t *stream, const pb_field_t *field, void *arg) /* Print the string, in format comparable with protoc --decode. * Format comes from the arg defined in main(). */ - printf((char*)arg, buffer); + printf((char*)*arg, buffer); return true; } -bool print_int32(pb_istream_t *stream, const pb_field_t *field, void *arg) +bool print_int32(pb_istream_t *stream, const pb_field_t *field, void **arg) { uint64_t value; if (!pb_decode_varint(stream, &value)) return false; - printf((char*)arg, (long)value); + printf((char*)*arg, (long)value); return true; } -bool print_fixed32(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); + printf((char*)*arg, (long)value); return true; } -bool print_fixed64(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); + printf((char*)*arg, (long long)value); return true; } @@ -88,4 +88,4 @@ int main() return 1; return 0; -} \ No newline at end of file +}