Re: [protobuf] Proto3 Default Value Conformance

2018-05-29 Thread Cyrus Katrak
I previously neglected to Include the error message I was getting:

ERROR,
test=Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput:
Response didn't have any field in the Response. request=protobuf_payload: "
\271` \377\377\377\377\377\377\377\377\377\001 \000"
requested_output_format: PROTOBUF message_type:
"protobuf_test_messages.proto3.TestAllTypesProto3", response=

I now suspect the issue is actually related to my [incomplete] handling of
one_ofs+default values, and is entirely unrelated to the thing this
particular conformance test is checking. When the result of the conformance
test is the empty byte array, my implementation does not serialize that
field on the wire and the one_of ConformanceResponse.result has no field
set.

Thanks for the quick reply!

On Tue, May 29, 2018 at 1:54 PM, Feng Xiao  wrote:

> On Tue, May 29, 2018 at 11:30 AM Cyrus Katrak 
> wrote:
>
>> I am implementing a protobuf implementation for a new language and I am
>> failing the conformance test named:
>>
>> Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.
>> UINT64.ProtobufOutput
>>
>> The test input appears to be an optional (non-repeated) field that
>> appears multiple times on the wire, with the last occurrence having a value
>> of zero (the default value for the field).
>>
>> The expected test output appears to be the same field, appearing once on
>> the wire, with a value of zero.
>>
>> I am confused why this is the expected output given the Langauge Guide
>> for proto3 states:
>> > Also note that if a scalar message field is set to its default, the
>> value will not be serialized on the wire.
>>
>> Any clarification would be much appreciated!
>>
> The conformance test specifies output in text format, but it does not
> compare your output against the text format directly. Instead, it will
> parse the text data into proto, and serialize it again. In this case, your
> output will be compared to an empty byte array and your implementation has
> failed this test.
>
>
>> --
>> 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.
>>
>

-- 
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.


Re: [protobuf] Proto3 Default Value Conformance

2018-05-29 Thread 'Feng Xiao' via Protocol Buffers
On Tue, May 29, 2018 at 11:30 AM Cyrus Katrak 
wrote:

> I am implementing a protobuf implementation for a new language and I am
> failing the conformance test named:
>
>
> Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
>
> The test input appears to be an optional (non-repeated) field that appears
> multiple times on the wire, with the last occurrence having a value of zero
> (the default value for the field).
>
> The expected test output appears to be the same field, appearing once on
> the wire, with a value of zero.
>
> I am confused why this is the expected output given the Langauge Guide for
> proto3 states:
> > Also note that if a scalar message field is set to its default, the
> value will not be serialized on the wire.
>
> Any clarification would be much appreciated!
>
The conformance test specifies output in text format, but it does not
compare your output against the text format directly. Instead, it will
parse the text data into proto, and serialize it again. In this case, your
output will be compared to an empty byte array and your implementation has
failed this test.


> --
> 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.
>

-- 
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.


Re: [protobuf] Errors building Protobuf 3.5.1 with Visual Studio 2005

2018-05-29 Thread 'Feng Xiao' via Protocol Buffers
On Tue, May 29, 2018 at 9:42 AM Eric Pederson  wrote:

> Hi all:
>
> I am trying to build Protobuf (3.5.1) using Visual Studio 2005 (I know,
> it's ancient, but we are stuck with it for now).  I am getting these errors:
>
>
> Compiling...
> main.cc
> src\google/protobuf/stubs/hash.h(309) : error C2977: 'stdext::hash_map' : too 
> many template arguments
> C:\Program Files (x86)\Microsoft Visual Studio 
> 8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'
> src\google/protobuf/stubs/hash.h(319) : see reference to class template 
> instantiation 'google::protobuf::hash_map' being compiled
> src\google/protobuf/stubs/hash.h(309) : error C2955: 'stdext::hash_map' : use 
> of class template requires template argument list
> C:\Program Files (x86)\Microsoft Visual Studio 
> 8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'
> src\google/protobuf/stubs/hash.h(311) : error C2977: 'stdext::hash_map' : too 
> many template arguments
> C:\Program Files (x86)\Microsoft Visual Studio 
> 8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'
>
>
> Is there a workaround for this?   Or is Protobuf 3 not compatible with VS
> 2005?   I am able to build Protobuf 2.6.1 with VS 2005.
>
If you have to use vs2005, protobuf 2.6.1 might be the latest version you
can use. From protobuf 3.0.0, we require at least vs 2008 to build.


> --
> 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.
>

-- 
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.


[protobuf] Proto3 Default Value Conformance

2018-05-29 Thread Cyrus Katrak
I am implementing a protobuf implementation for a new language and I am
failing the conformance test named:

Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput

The test input appears to be an optional (non-repeated) field that appears
multiple times on the wire, with the last occurrence having a value of zero
(the default value for the field).

The expected test output appears to be the same field, appearing once on
the wire, with a value of zero.

I am confused why this is the expected output given the Langauge Guide for
proto3 states:
> Also note that if a scalar message field is set to its default, the value
will not be serialized on the wire.

Any clarification would be much appreciated!

-- 
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.


[protobuf] Errors building Protobuf 3.5.1 with Visual Studio 2005

2018-05-29 Thread Eric Pederson
Hi all:

I am trying to build Protobuf (3.5.1) using Visual Studio 2005 (I know, 
it's ancient, but we are stuck with it for now).  I am getting these errors:


Compiling...
main.cc
src\google/protobuf/stubs/hash.h(309) : error C2977: 'stdext::hash_map' : too 
many template arguments
C:\Program Files (x86)\Microsoft Visual Studio 
8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'
src\google/protobuf/stubs/hash.h(319) : see reference to class template 
instantiation 'google::protobuf::hash_map' being compiled
src\google/protobuf/stubs/hash.h(309) : error C2955: 'stdext::hash_map' : use 
of class template requires template argument list
C:\Program Files (x86)\Microsoft Visual Studio 
8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'
src\google/protobuf/stubs/hash.h(311) : error C2977: 'stdext::hash_map' : too 
many template arguments
C:\Program Files (x86)\Microsoft Visual Studio 
8\VC\include\hash_map(89) : see declaration of 'stdext::hash_map'


Is there a workaround for this?   Or is Protobuf 3 not compatible with VS 
2005?   I am able to build Protobuf 2.6.1 with VS 2005.

-- 
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.


[protobuf] [C++] Equivalent of python's function --> unpack_from('!f',...)

2018-05-29 Thread wala
Hello everyone,

I really just want to transcript this part of python code in C++ :

--

data, addr = sock.recvfrom(1024)#buffer size is 1024 bytes
print "received message: ", "%1.4f" %unpack_from ('!f', data, 0), "%1.4f" 
%unpack_from ('!f', data, 4)

--

I can't seem to find the correct way to unpack the buffer. I suppose it has 
something to do with the google::protobuf::Any type but that's it.

To be more precise, I receive informations from an IMU through udp. So I 
have a buffer of char[1024] which should contain floats.

Thanks a lot.

-- 
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.