[protobuf] Issue 379 in protobuf: Build failure with MSVC2011

2012-03-26 Thread protobuf

Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 379 by thier...@filewave.com: Build failure with MSVC2011
http://code.google.com/p/protobuf/issues/detail?id=379

What steps will reproduce the problem?
1. build with MSVC2011
2. failure to buid command_line_interface.cc (l 784 and 913)
3.

What is the expected output? What do you see instead?
it should work

What version of the product are you using? On what operating system?
MSVC2011 beta on windows 7

Please provide any additional information below.
The pb is linked to C++11's new definition of make_pair. The fix is as easy  
as changing make_pair into pair. See  
http://connect.microsoft.com/VisualStudio/feedback/details/691756/std-make-pair-error-in-vc11  
for more info.


--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Memory leaks in VS2008 using 2.4.1

2012-03-26 Thread Eric Holtman
I've tried building the library as static.   I've tried building the
library as dll.  I've even gone so far as starting from scratch and
building my own project, and including all the .cc and .h files.

I cannot make the memory leaks on program exit go away.

I am definitely calling google::protobuf::ShutdownProtobufLibrary ();

I have traced through, and it *looks* like it's getting to the
OnShutdown functions for my .proto generated message files, and
calling delete.  I am definitely calling Shutdown *before* the leak
checker runs.

And yet, I still get reported memory leaks.

I don't really want to ignore the leaks, because sooner or later,
that's going to hide a real error.

Am I not doing something correctly?   Is there any way to fix this.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] [Java][Python][TCP] Reading messages that where written with writeDelimited and viceversa

2012-03-26 Thread Galileo Sanchez
Hello! I've been searching in this group a little bit, and found this 
https://groups.google.com/forum/?fromgroups#!searchin/protobuf/python$20delimited/protobuf/_3gAmvU4_80/rEeMA3A9H1UJ

Now, I'm  very very very new to python, never heard of it kind of new, 
 so I got a little confused on how to apply that patch
should I directly patch my compiled request.proto ( that would be 
request_pb2.py), or should I apply it to some other file that is on the 
source
of the python implementation of the protocol buffer api.

If it is useful, basically what I'm trying to do is, run a TCP java server, 
and write clients in python, c++,and as I already have a good
proficiency in java, I wrote the server first, and I used 
parseDelimitedTo(), and writeDelimitedTo, because it will be reading 
multiple request from different
clients and that seemed the better way to go. Actually it launches a new 
thread per client, but anyway, a client could send multiple requests

Just in case that patch isn't intended to the purpose I want, I tried a 
different approach and tried to write the delimiter, 
str(request.ByteSize())+request.SerializeToString()

but now I see that I need to add the size in a raw bit format

So the questions are:

Is the patch for what i thought it was? 
then  to wich file should I apply it?

else 
if (Should I write the size as a raw bit string?)
thenHow do I do that?

else
How do I write the message in a format that my Java server can understand?

Basically I just don't want to change my server implementation.

Thanks very much people, in the mean time I will be looking for other 
solutions...

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/gJFaTjB_PLUJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Problem with accent

2012-03-26 Thread Simon
Hi guys,

I have an annoying problem with some accent.
I build my proto-object, no problem, and when i want to read it the
browser, using .toString function, i have \303\240 instead of à,
\303\250 instead of è, etc...

So i'm wondering where can be the problem ?
Eclipse encode the files in UTF-8, Maven the same.

I just don't know where to look for :/

Thanks !

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Memory leaks in VS2008 using 2.4.1

2012-03-26 Thread Henner Zeller
On Sun, Mar 25, 2012 at 06:55, Eric Holtman e...@holtmans.com wrote:
 I've tried building the library as static.   I've tried building the
 library as dll.  I've even gone so far as starting from scratch and
 building my own project, and including all the .cc and .h files.

 I cannot make the memory leaks on program exit go away.

 I am definitely calling         google::protobuf::ShutdownProtobufLibrary ();

 I have traced through, and it *looks* like it's getting to the
 OnShutdown functions for my .proto generated message files, and
 calling delete.  I am definitely calling Shutdown *before* the leak
 checker runs.

 And yet, I still get reported memory leaks.

 I don't really want to ignore the leaks, because sooner or later,
 that's going to hide a real error.

 Am I not doing something correctly?   Is there any way to fix this.

Can you drill down _what_ object is leaking ? In particular, did you
narrow down that it is indeed protobufs that cause the leak ?
You need to find the leaking object first, otherwise it is a bit hard
do diagnose what is going on.

-h


 --
 You received this message because you are subscribed to the Google Groups 
 Protocol Buffers group.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to 
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/protobuf?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Problem with accent

2012-03-26 Thread Evan Jones
On Mar 23, 2012, at 9:07 , Simon wrote:
 I have an annoying problem with some accent.
 I build my proto-object, no problem, and when i want to read it the
 browser, using .toString function, i have \303\240 instead of à,
 \303\250 instead of è, etc…

What do you mean i want to read it the browser using .toString function? Is 
this Java or C++ or something else? What does your message definition look like?

By default, protocol buffers encodes strings in UTF-8. These characters seem to 
be encoded correctly as UTF-8, so the sending side is doing the right thing, 
but the code that is reading them is not doing the correct decoding:

à = U+00E0

Escaped in hexadecimal this is: \xc3\xa0
Escaped in octal this is: \303\240


So you need to decode from UTF-8 to get the correct characters. Hope this helps,

Evan

--
http://evanjones.ca/

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Memory leaks in VS2008 using 2.4.1

2012-03-26 Thread Eric J. Holtman
On 3/26/2012 7:25 PM, Henner Zeller wrote:
 
 Can you drill down _what_ object is leaking ? In particular, did you
 narrow down that it is indeed protobufs that cause the leak ?
 You need to find the leaking object first, otherwise it is a bit hard
 do diagnose what is going on.
 

I just finally got around to figuring it out this afternoon,
after spending the morning fighting with my debugging tools.

It's line 85 in parser.cc:

const TypeNameMap kTypeNames = MakeTypeNameTable();

I have done some more poking around, and I can't tell if what
is happening is that the destructor for that hash_map isn't
getting called (unlikely), or that it's getting called after
the MSFT memory tracer has already run (which I would find
more likely).

I've tried a couple of different ways to use libprotobuf (static,
dll, etc), and they all seem to exhibit this behavior.

I'm really leaning towards it's an order of initialization
problem at this point, and I might have to just eat the
warnings, unless someone sees the kTypeNames variable there
and says oh yeah, I know what's going on there.



-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] [Java][Python][TCP] Reading messages that where written with writeDelimited and viceversa

2012-03-26 Thread Evan Jones
On Mar 25, 2012, at 18:09 , Galileo Sanchez wrote:
 else 
 if (Should I write the size as a raw bit string?)
 thenHow do I do that?


You need to use something like the following. Not 100% sure it works but it 
should be close? Hope this helps,

Evan


# Output a message to be read with Java's parseDelimitedFrom
import google.protobuf.internal.encoder as encoder
out = message.SerializeToString()
out = encoder._VarintBytes(len(out)) + out


# Read a message from Java's writeDelimitedTo:
import google.protobuf.internal.decoder as decoder

# Read length
(size, position) = decoder._DecodeVarint(buffer, 0)
# Read the message
message_object.ParseFromString(buffer[position:position+size])


--
http://evanjones.ca/

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] [Java][Python][TCP] Reading messages that where written with writeDelimited and viceversa

2012-03-26 Thread Galileo Sanchez
Thanks man... It worked great! I guess I should read the documentation a 
little more xP.



On Monday, March 26, 2012 9:49:17 PM UTC-3, Evan Jones wrote:

 On Mar 25, 2012, at 18:09 , Galileo Sanchez wrote:
  else 
  if (Should I write the size as a raw bit string?)
  thenHow do I do that?


 You need to use something like the following. Not 100% sure it works but 
 it should be close? Hope this helps,

 Evan


 # Output a message to be read with Java's parseDelimitedFrom
 import google.protobuf.internal.encoder as encoder
 out = message.SerializeToString()
 out = encoder._VarintBytes(len(out)) + out


 # Read a message from Java's writeDelimitedTo:
 import google.protobuf.internal.decoder as decoder

 # Read length
 (size, position) = decoder._DecodeVarint(buffer, 0)
 # Read the message
 message_object.ParseFromString(buffer[position:position+size])


 --
 http://evanjones.ca/



-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/GDPoYpNMZl4J.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.