From 214b0eae8aa011fa8b3e8a3dcc784f8d423aeffb Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Tue, 2 Apr 2013 19:55:21 +0300 Subject: Change the callback function to use void**. NOTE: This change breaks backwards-compatibility by default. If you have old callback functions, you can define PB_OLD_CALLBACK_STYLE to retain the old behaviour. If you want to convert your old callbacks to new signature, you need to do the following: 1) Change decode callback argument to void **arg and encode callback argument to void * const *arg. 2) Change any reference to arg into *arg. The rationale for making the new behaviour the default is that it simplifies the common case of "allocate some memory in decode callback". Update issue 69 Status: FixedInGit --- example/client.c | 2 +- example/server.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'example') diff --git a/example/client.c b/example/client.c index edc83948..e6e9a2e0 100644 --- a/example/client.c +++ b/example/client.c @@ -23,7 +23,7 @@ #include "fileproto.pb.h" #include "common.h" -bool printfile_callback(pb_istream_t *stream, const pb_field_t *field, void *arg) +bool printfile_callback(pb_istream_t *stream, const pb_field_t *field, void **arg) { FileInfo fileinfo; diff --git a/example/server.c b/example/server.c index 346e9fb9..9a9c2644 100644 --- a/example/server.c +++ b/example/server.c @@ -23,9 +23,9 @@ #include "fileproto.pb.h" #include "common.h" -bool listdir_callback(pb_ostream_t *stream, const pb_field_t *field, const void *arg) +bool listdir_callback(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) { - DIR *dir = (DIR*) arg; + DIR *dir = (DIR*) *arg; struct dirent *file; FileInfo fileinfo; -- cgit 1.2.3-korg