Publishing nanopb-0.2.1
[apps/agl-service-can-low-level.git] / example / server.c
index aba0667..9a9c264 100644 (file)
@@ -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;
     
@@ -38,7 +38,7 @@ bool listdir_callback(pb_ostream_t *stream, const pb_field_t *field, const void
         if (!pb_encode_tag_for_field(stream, field))
             return false;
         
-        if (!pb_enc_submessage(stream, field, &fileinfo))
+        if (!pb_encode_submessage(stream, FileInfo_fields, &fileinfo))
             return false;
     }
     
@@ -55,7 +55,7 @@ void handle_connection(int connfd)
     
     if (!pb_decode(&input, ListFilesRequest_fields, &request))
     {
-        printf("Decoding failed.\n");
+        printf("Decode failed: %s\n", PB_GET_ERROR(&input));
         return;
     }