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

Reply via email to