Xiaofeng Mi | 17 Sep 22:17 2014
Picon

Why we can't we add an message-typed element to a repeatedptrfield directly.

Say message A has "repeated B b = ...", we have to do

    *a.add_b() = another_b_instance;
or the deprecated
    *a.add_b()->CopyFrom(another_b_instance);

Why not just let us do something like:

    a.add_b(another_b_instance);

And not just C++, this seems to be the paradigm in other language as well.  I am curious about the design consideration.  Thanks!

-Xiaofeng

--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Nick Retallack | 17 Sep 21:07 2014
Picon

What format is DebugString using for bytes?

When I put some arbitrary bytes in a bytes field in a protocol buffer and then print it out with DebugString, it formats the bytes in a format I'm unfamiliar with.  It's full of three-digit escape sequences like "\364\007".  What format is this?  364 is too big to be a byte, but nothing seems to exceed 3 digits.

--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Robert Edmonds | 17 Sep 20:42 2014

protobuf build failures on certain compilers and architectures

Hi,

Any chance someone could take a look at PR #20 ("Remove
GOOGLE_PROTOBUF_ARCH_PPC"):

    https://github.com/google/protobuf/pull/20

and PR #21 ("Expose generic atomicops on Clang")?

    https://github.com/google/protobuf/pull/21

I'm planning on uploading a patched protobuf package to Debian in the
very near future containing my patches in PR #20 and #21, as the 'mips'
build failure described below blocks the transition of protobuf 2.6.0
into the Debian archive.  So if someone from Google could look at these
patches I'd appreciate it.

[PR #20]

The GOOGLE_PROTOBUF_ARCH_PPC macro does not appear to be used anywhere
in the protobuf code base.  There is no Power-specific atomicops
implementation.  I think this would cause a build failure on Power
systems where __ppc__ is actually defined.  Notably, __ppc__ is not
defined on either 32-bit or 64-bit Power on gcc, but *is* defined on
32/64-bit Power on clang.  By luck, on Debian we happen to build
protobuf and all of its reverse build dependencies (which are also
affected, since this occurs in the headers compiled by client code) with
gcc on the 'powerpc' (32-bit Power) and 'ppc64el' (64-bit Power,
little-endian) architectures, so we have not run into this particular
build failure corner case yet.

It appears to be safe to simply remove the __ppc__ check and the
GOOGLE_PROTOBUF_ARCH_PPC define, as it is not used anywhere in protobuf.
This makes sure the generic atomicops implementation is used on Power.
This is done in PR #20.

[PR #21]

A related issue is that the generic atomicops implementation is only
exposed on GCC >= 4.7.  However, Clang also supports the __atomic_*()
intrinsics, but does not claim to be GCC >= 4.7.  So in PR #21 I
modified the preprocessor check to also support Clang.  I have an
example of a Debian build failure of one of protobuf's reverse build
dependencies because of this bug, in the 'shogun' package:

    https://buildd.debian.org/status/fetch.php?pkg=shogun&arch=mips&ver=3.2.0-7.2%2Bb1&stamp=1410641206

The 'shogun' package happens to be built with Clang on the Debian 'mips'
architecture, so it needs to fall back to the generic atomicops
implementation.  Note, this is big-endian MIPS, not the little-endian
'mipsel' Debian architecture, which has a custom atomicops
implementation in protobuf.  (Confusingly, what Debian calls 'mipsel',
protobuf calls 'GOOGLE_PROTOBUF_ARCH_MIPS'.)  Compiling protobuf
generated code on 'mips' with Clang results in the familiar error
message:

    In file included from /usr/lib/../include/google/protobuf/generated_message_util.h:44:
    In file included from /usr/lib/../include/google/protobuf/stubs/once.h:81:
    In file included from /usr/lib/../include/google/protobuf/stubs/atomicops.h:59:
    /usr/lib/../include/google/protobuf/stubs/platform_macros.h:77:2: error: Host architecture was
not detected as supported by protobuf

[Issue #25]

However, building protobuf with Clang on a generic atomicops
architecture generates new compiler diagnostics that do not appear to
have an equivalent in gcc, so I've filed issue #25:

    https://github.com/google/protobuf/issues/25

This looks to be a genuine bug in the original generic atomicops
implementation.  These warnings appear to currently be harmless, since
the affected functions do not appear to be used anywhere in protobuf or
protobuf generated code.

Thanks!

-- 
Robert Edmonds

--

-- 
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Kibum Ko | 17 Sep 09:21 2014
Picon

I don't under stand this Issue 2.6.0

Hello I'm junior programmer

I am studying English. sorry.

I'm download protobuf 2.6.0.

i using c++ project.

i want protocol buffer tips. 

because

1 step. download protocol buffer - Oh ~ So easy

2 step. example .proto file compiling - easy easy good

3 step. add .pb.cc, pb.h files . my protocol buffer sample project ( my environment vs 2013 )

and add 

#include <iostream>
#include <fstream>
#include <string>
#include "addressbook.pb.h"
#include <google/protobuf/text_format.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>

include header.



4.step. F7 button (compile) 

5. step. Oh what the.. compile error ( reason: .cc files precompile header ) OK so easy . i can change file property.

6. step. F7 button (compile)

7. step.what the.. 

error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility 2132



very unkind.. TT .. 

i want kind library.. 

this greed ??

Thank you reading my topic.



--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Kibum Ko | 17 Sep 09:27 2014
Picon

2.6.0 Compile Error in c++

I am studying English. sorry.

I'm download protobuf 2.6.0.

i using c++ project.

i want protocol buffer tips. 

because

1 step. download protocol buffer - Oh ~ So easy

2 step. example .proto file compiling - easy easy good

3 step. add .pb.cc, pb.h files . my protocol buffer sample project ( my environment vs 2013 )

and add 

#include <iostream>
#include <fstream>
#include <string>
#include "addressbook.pb.h"
#include <google/protobuf/text_format.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>

include header.



4.step. F7 button (compile) 

5. step. Oh what the.. compile error ( reason: precompile header auto ) OK so easy . i can change file property.

6. step. F7 button (compile)

7. step.what the.. 

error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility 2132



very unkind.. TT .. 

i want kind library.. 

this greed ??

Thank you reading my topic.


--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
kumar raja | 16 Sep 10:56 2014
Picon

Resolving namespaces when using a DescriptorPool

Hi all,

I have a proto file where a set of classes are defined under a package.
When the corresponding classes are generated, they get accommodated under the namespace as defined by the package name in proto file.

Now the issue i have is interms of how to retrieve the respective class descriptors from the descriptor pool.
By giving the classname, it doesn't work due to namespace issue.

Can someone help me on this.

Regards

Raja

--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
Marc Gravell | 15 Sep 10:49 2014
Picon

Re: Proto-net Deserialization exception

With the supplied network data and example proto schemas: the error message is correct. Firstly, note that you need to indicate (to DeserializeWithLengthPrefix) that we aren't using spoof field-numbers along with the headers; basically - tell it to use field-number zero:

                Command comando = Serializer.DeserializeWithLengthPrefix<Command>(streamR, PrefixStyle.Base128, 0);
                ChannelInfo chInfo = Serializer.DeserializeWithLengthPrefix<ChannelInfo>(streamR, PrefixStyle.Base128, 0);

(note the final 0 at the end)

With this, the first message deserializes fine - the name is "ChannelInfo". The second message, however, fails. It fails because the second message starts: 0x0a, 0x14 - meaning "field 1, length prefixed, 20 bytes" - however, field 1 on ChannelInfo is "fixed32 serialNr = 1". This is *not* a valid match for a length-prefix wire-type. So; I can only conclude that either the .proto is wrong, or the second message is not actually a ChannelInfo. It does not match the definition.

Marc

--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
protobuf | 13 Sep 04:44 2014

Issue 672 in protobuf: FileDescriptorTables double free problem when use protobuf both in shared library and in main.cpp

Status: New
Owner: liujisi <at> google.com
Labels: Type-Defect Priority-Medium

New issue 672 by leoxiang... <at> gmail.com: FileDescriptorTables double free  
problem when use protobuf both in shared library and in main.cpp
https://code.google.com/p/protobuf/issues/detail?id=672

What steps will reproduce the problem?
1. compile *.pb.cpp file with main.cpp to generate executable
2. compile *.pb.cpp file witeh other.cpp to generate a shared library  
test.so
3. dlopen test.so in main.cpp and call the function in shared library
4. when process end, there will be a double free corruption catched.

What is the expected output? What do you see instead?
hello in so
*** glibc detected *** ./main: double free or corruption (!prev):  
0x000000000097e850 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7ec66)[0x7f2e9d1d7c66]
./main[0x4479de]
./main[0x42cc1b]
./main[0x42b628]
./main[0x42a5db]
./main[0x429935]
./main[0x41370c]
./main[0x413726]
./main[0x413740]
./main(_ZN6google8protobuf20FileDescriptorTablesD1Ev+0x31)[0x41389b]
/lib/x86_64-linux-gnu/libc.so.6(+0x3b9d1)[0x7f2e9d1949d1]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ba55)[0x7f2e9d194a55]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf4)[0x7f2e9d17a794]
./main[0x4070c9]
======= Memory map: ========

What version of the product are you using? On what operating system?
protobuf 2.5 on Linux ubuntu 3.11.0-15-generic

Please provide any additional information below.
it seems something wrong with the deconstruction with FileDescriptorTables

Attachments:
	main.cpp  1.2 KB
	Makefile  900 bytes
	so.so  2.9 MB
	poker_config.pb.cpp  13.6 KB
	poker_config.pb.h  7.6 KB

-- 
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

-- 
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Antonio Ramos | 12 Sep 11:44 2014
Picon

Deserialization problem with protobuf-net

Hi all, this is my first time with protobuf protocol and protobuf-net.

I have the following question. I read in a buffer of bytes one response wich contains two proto messages. I´m trying deserializate those messages.

I can deserializate the first one perfectly. But when i try to deserializate de second one i have a deserialization wired exception: "Invalid wire-type; this usually means you have over-written a file without truncating or setting the length; see http://stackoverflow.com/q/2152978/23354"

My code is de following:

            int valo = networkStream.Read(buffer, 0, buffer.Length);
           
            using (MemoryStream streamR = new MemoryStream(buffer))
            {
                try
                {           
                    Command comando = Serializer.DeserializeWithLengthPrefix<Command>(streamR, PrefixStyle.Base128); 
                    ChannelInfo chInfo = Serializer.DeserializeWithLengthPrefix<ChannelInfo>(streamR, PrefixStyle.Base128);                
                }
                catch (Exception ex)
                {
                }
            }

What can i do???

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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.
尹天仇 | 12 Sep 03:49 2014
Picon

i am working on a protobuf-rpc project support c++(libev)&python(gevent)

project home:
https://github.com/w359405949/libmaid

list it on the add-on pages, thanks.
https://github.com/google/protobuf/wiki/Third-Party-Add-ons#RPC_Implementations

--

-- 
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

尹天仇 | 12 Sep 04:37 2014
Picon

libmaid(pymaid), new third party add-on rpc implement in c++(libev)&python(gevent)

third part add-on rpc implement in c++(libev)&python(gevent),

 project home
https://github.com/w359405949/libmaid

please list it on 
https://github.com/google/protobuf/wiki/Third-Party-Add-ons

--
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+unsubscribe <at> googlegroups.com.
To post to this group, send email to protobuf <at> googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Gmane