Found the issue: the encoded data contains the newline sequence, which when
written to the console on windows is automatically replaced with \r\n
instead of \n. The fix is to set the cout mode to binary so it doesn't do
the replacement.
Example:
#include #include #include
int main( int argc, char * argv[] ){
_setmode( _fileno( stdout ), _O_BINARY );
std::cout << std::endl;}
I hope somebody finds this useful. Also, an example C++ plugin-generator on
the protobuf website would be key in highlighting this issue.
On Tuesday, July 19, 2011 at 7:20:23 PM UTC-7, Alex Antonov wrote:
>
> I've tried to use the experimental Java support for writing the protoc
> plugins from http://codereview.appspot.com/912042/show
> Everything got compiled correctly but when I started using it, got the
> following error:
>
> protoc --java_out=. --plugin=protoc-gen-my --my_out=. config.proto
> --my_out: protoc-gen-my: Plugin output is unparseable.
>
> Redirecting the output of 'protoc-gen-my' script to a file and then
> trying to recreate the 'CodeGeneratorResponse' in code worked without
> any issues.
> However when using it with protoc, it refuses to parse it. :(
>
> This is the content of my 'protoc-gen-my' script:
>
> #!/bin/bash
> #cd `dirname $0`
>
> #java -Xdebug -
> Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar
> protobuf-java-codegen-0.1.jar
> #java -jar protobuf-java-codegen-0.1.jar 1> data.pb
> java -jar protobuf-java-codegen-0.1.jar
>
> Any idea what I could be doing wrong?
>
> Thanks,
> Alex
--
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.