last few weeks I am using ProtoBuf together with MQTT and sqlite to control 
lab experiments and make logs of. Overall I am very satisfied, using 
C/nanopb (without malloc), original C++ implementation (dynamic compilation 
of .protos is great), Python and Julia (ProtoBuf.jl). ** Many thanks here 
for nanopb & ProtoBuf.jl authors! **

The last one is, at present time, unable to parse some messages, and I 
would like to resolve, whether they are encoded well, or not, ie. where to 
put bugreports/own development efforts.

Example: I have the following .proto:

message DoubleVector {
  repeated double v = 1;

Some encoding libs (e.g. Python, Julia ProtoBuf.jl) encodes one value as 
{0x09, some_8_bytes}, more values by {0x09, first_8_bytes, 0x09, 
second_8_bytes, etc.}. It gets decoded by Python, Julia, C++ correctly.

However, nanopb (3rd party protobuf lib, ligthweight and in many respects 
very useful) generates something like this: {0x0a, 0x08, some_8_bytes}. It 
seems, that instead of encoding "single 8byte value", it encodes "string 
length 8 bytes".

What is interesting, all library decoders (except ProtoBuf.jl) decodes well 
both variants, 0x9 + payload, as well as 0xa, 0x8 + payload. Tested even 
with protoc --decode. Can you tell me, what applies:

a) both variants are correct (so, ProtoBuf.jl shall be corrected)

b) 0xa, 0x8 is a wrong way (although it works under several libraries and 
protoc --decode; so nanopb shall be corrected)

Is there any recommendation on how these repeated arrays shall be encoded? 
I tried to find the information at Google ProtoBuf website, but I have 
found only a very basic examples, not covering this in particular.

Many thanks,

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to