Andrew Pashkin | 29 Oct 08:31 2014
Picon

Python: metclass customization

Hi al!

I'm seeking for way to replace original Protobuf's metaclasses with my own ones. What is the best way to do that?

--
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.
piyush tiwari | 29 Oct 08:34 2014
Picon

Not able to import proto files

Hi,

I am using protobuf and having the problem explain below:


Could someone please look into the same and let me know what could be done in order to resolve the same.

Please let me know If any additional information is needed, any help would be appreciated.

Thanks & Regards,
Piyush Tiwari
tiwari.piyush7 <at> gmail.com

--
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.
Michael Wagner | 29 Oct 00:41 2014
Picon

Is there a C++ placement new() operator for messages?

I would like to use Google Protocol Buffers in a memory constrained environment - not so much that the environment is low on memory as much as memory usage is tracked on a per subsystem basis.
 
Generally, in this environment for other non-Google Protocol Buffers, I use the C++ placement new operator, which allows me to allocate a buffer from a specializes allocator and pass the address of that buffer to the new() operator.
 
char* fooAllocation = memoryBroker->Allocate(MY_SUBSYSTEM_ID, MAX_FOO_SIZE);
 
class Foo foo* = new (fooAllocation);
 
When I am done with foo, I can call
 
memoryBroker->Free(MY_SUBYSTEM_ID, MAX_FOO_SIZE, foo);
 
That allows memoryBroker to keep accurate stats on memory usage by subsystem.
 
I'd like to do the same with a GPB message.
 
Is there some way to do that?
 
Mike

--
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.
Shuo Zhou | 27 Oct 23:33 2014
Picon

Move nested message.

Hi,

Suppose I got a message as follows:

message Foo {
  message Bar {
    optional string name = 1;
  }
  repeated Bar bar = 1;
....
}  

Then I find Bar is needed widely as a generic message, and want to move it outside of Foo as follows:
message Bar {
  optional string name = 1;
}
message Foo {
  repeated Bar bar = 1;
...

Would this change cause serializing problem? 

Thanks,
Shuo

--
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.
Peter Hubner | 24 Oct 18:28 2014
Picon

C++ modifying field without knowing field accessor at compile time

All I am trying to achieve is to modify a message on the fly with a set of fields that are supplied to the program at runtime.

simple case:
// message declared as - const google::protobuf::Message& message
auto x = reflection->GetDouble(message, field);
// do some modification to x
reflection->SetDouble(message, field, x);

my main question is how in the world do I get from a const ref (needed for GetDouble() ) to a pointer (needed for SetDouble() )???

I know that if I knew the field name at compile time I would be able to use mutable_<name>, but since I don't know that until runtime there does not seem to be an easy way to do this. Or I am just missing something super simple.

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.
Josh Strickland | 26 Oct 03:54 2014
Picon

Possible bug in the compiler api

I have built a autocode generator that uses the protobuffer's api in combination with template code to autogenerate complete stub code for working with the network code from the Qt libraries. It worked flawlessly with a past version of the protobuffer (from more than a year ago, but not sure the version). 

I updated to the latest protocol buffer code and rebuilt and rerun and found a problem in the api to the compiler that is provided for working with the files. The following is the proto file I am using when parsing:

package proto;

message
ServerType1
{
 
optional bytes data = 1;
}

message
ServerType2
{
  optional bytes data
= 1;
}

The following is a quick application I wrote that repeats the problem.

#include <iostream>
#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/descriptor.h>
 

int main( int, char ** )
{
 
using namespace google::protobuf;
  using namespace google::protobuf::compiler;

 
DiskSourceTree source_tree;
  source_tree
.MapPath( "", "/home/josh/qtworkspace/gtqt/example/libs" );
 
Importer import( &source_tree, 0 );

 
const FileDescriptor* fd = import.Import( "example1.proto" );
 
 
if( fd )
 
{
   
for( int i = 0; i < fd->message_type_count(); ++i )
   
{
     
const Descriptor* d = fd->message_type( i );

     
if( d )
     
{
        std
::cout << "Message: " << d->name() << std::endl;
     
}
   
}
 
}
 
 
return 0;
}

When running this simple application I wrote, you can see that the first message, "ServerType1" is found just as it should be expected to be found.However, when "ServerType2" is found, instead of actually finding "ServerType2" I get basically a dump of memory because it seems the pointer I am returned from the call to message_type (even though non-null) is invalid.

--
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.
Kelsey Bekkedahl | 22 Oct 16:43 2014
Picon

How to link against debug build for protocol buffers

In the README file for Protocol Buffers for Visual studio, it states "To avoid conflicts between the MSVC debug and release runtime libraries, when compiling a debug build of your application, you may need to link against a debug build of libprotobuf.lib. Similarly, release builds should link against release libs." How do I link against a debug build of libprotobuf in Visual Studio 2012? Thanks ahead of time!

--
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.
Feng Xiao | 22 Oct 01:31 2014
Picon

Protocol Buffers 2.6.1

Hi all,

I just published Protocol Buffers v2.6.1:
https://github.com/google/protobuf/releases/tag/2.6.1

2014-10-20 version 2.6.1:

  C++
  * Added atomicops support for Solaris.
  * Released memory allocated by InitializeDefaultRepeatedFields() and
    GetEmptyString(). Some memory sanitizers reported them as memory leaks.

  Java
  * Updated DynamicMessage.setField() to handle repeated enum values
    correctly.
  * Fixed a bug that caused NullPointerException to be thrown when
    converting manually constructed FileDescriptorProto to
    FileDescriptor.

  Python
  * Fixed WhichOneof() to work with de-serialized protobuf messages.
  * Fixed a missing file problem of Python C++ implementation.

I'll soon upload it to Maven and pypi for Java and Python respectively.

Cheers,
Feng

--
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 | 21 Oct 21:32 2014

Issue 676 in protobuf: protoc does not warn for Java keyword "super"

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

New issue 676 by klocksve... <at> gmail.com: protoc does not warn for Java  
keyword "super"
https://code.google.com/p/protobuf/issues/detail?id=676

What steps will reproduce the problem?
1. Be mindless and forget that super is a keyword and try to use it as an  
enum identifier.
2. Create protofile:
enum SuperEnum {
   super = 1;
}

message SuperMessage {
   required SuperEnum super = 1;
}

3. compile with protoc
4. compile with javac
5. Get confused, because a moment ago before some copy and paste  
acrobatics, everything worked just fine and the cause is obfuscated by  
unrelated errors.

What is the expected output? What do you see instead?
protoc should warn or deny to use identifier "super", instead it does not  
show any warning.

javac does not compile with error
SuperEnumMessage.java:13: error: <identifier> expected
       implements com.google.protobuf.ProtocolMessageEnum {
and tons of subsequent errors.

What version of the product are you using? On what operating system?
protoc 2.5.0, java hotspot 1.8.0_25, Linux 64-bit

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

Aijing Sun | 19 Oct 15:58 2014
Picon

can protobuf cost less bytes?

1.if a int value is -1,then through varint 128 serialze is 10 bytes.
2. a bool true is none 0,and false is 0,but it cost 1 byte .

I hope -1 just cost 1 byte,and bool cost no byte.
and it can cost less byte when serialize
and I suggest change wire type:
0(000) --- positive varint
1(001) --- negative  varint
2(010) ---- true
3(011) ---- false
4(100) ---- bit32
5(101) ---- bit64
6(110) ---- Length-delimited


 

--
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 | 20 Oct 03:54 2014

Issue 675 in protobuf: memory leak

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

New issue 675 by vxm... <at> gmail.com: memory leak
https://code.google.com/p/protobuf/issues/detail?id=675

A memory leak is detected by vld(visual leak detector).
I think the problem is caused by this function:
void InitEmptyString() {
   empty_string_ = new string;
}
empty_string_ will not be deleted later.

In previous version protobuf-2.5.0, empty string is a global std::string
const ::std::string kEmptyString;

protobuf version: protobuf-2.6.0
OS: windows 8.1
build env: visual studio 2013

Some output generated by vld:
d:\sdk\protobuf\protobuf-2.6.0\src\google\protobuf\generated_message_util.cc  
(55):  
ChatServerd.exe!google::protobuf::internal::InitEmptyString + 0x7  
bytes
d:\sdk\protobuf\protobuf-2.6.0\src\google\protobuf\stubs\common.h (876):  
ChatServerd.exe!google::protobuf::internal::FunctionClosure0::Run + 0xA  
bytes
d:\sdk\protobuf\protobuf-2.6.0\src\google\protobuf\stubs\once.cc (83):  
ChatServerd.exe!google::protobuf::GoogleOnceInitImpl + 0xF bytes
d:\sdk\protobuf\protobuf-2.6.0\src\google\protobuf\stubs\once.h (127):  
ChatServerd.exe!google::protobuf::GoogleOnceInit + 0xD bytes
d:\sdk\protobuf\protobuf-2.6.0\src\google\protobuf\generated_message_util.h  
(84): ChatServerd.exe!google::protobuf::internal::GetEmptyString + 0xF bytes

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


Gmane