I got the problem I was facing, It was a problem of converting QByteArray 
to QString. By passing raw QByteArray parses the response correctly.

On Monday, 23 November 2015 11:51:10 UTC+5:30, kushal umarkar wrote:
>
> We have been using QByteArray data = m_networkReply->readAll(); to get the 
> complete response of REST API called. 
>
> In data variable we have complete response in proto format which we pass 
> to get it parsed using ParseFromCodedStream function.
>
> ReadingResp m_RdListRes;
>
> ::google::protobuf::io::ZeroCopyInputStream* stringIn = new 
> ::google::protobuf::io::ArrayInputStream(data, data.size());
> ::google::protobuf::io::CodedInputStream* inReader = new 
> ::google::protobuf::io::CodedInputStream(stringIn);
> inReader->SetTotalBytesLimit(512 << 20, 256 << 20);
>
> if (m_RdListRes.ParseFromCodedStream( inReader ))
> {
> std::cout << "[DEBUG]\tDeserializing from String : Success\n" << std::endl;
> }
> else
> {
> std::cout << "[ERROR]\tDeserializing from String : Failed\n" << std::endl;
> }
>
>
> whereas ReadingResp has repeated pair of messages.
>
> For ex. 
>
> message StrSnMap {
> repeated StrSnInfoPair pairs = 1;
> }
> message ReadingResp {
> optional RdingLstResp rding_lst_resp = 1;
> optional StrSnMap sn_map = 2;
> repeated ReadingLst rding_lst = 3;
> }
>
> When there is only one StrSnMap it is parsed successfully. But when, in a 
> response there are multiple StrSnMap, it fails in parsing. 
> In debugging I found it fails in expectTag(26) function. What is 
> expectTag(26) and how the tag is created? 
>
> Could anyone please assist me on this? Many Thanks in Advance. Early 
> response is appreciated :)
>
>

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