This sounds like something *very* weird is going wrong in your runtime. What does the debugger show as the memory locations of the string fields? the memory locations the allocator provided for the string data?
I think if you make a stand alone unit test for this, you won't see this behaviour. --Chris On Apr 5, 2012, at 1:03 AM, "G." <[email protected]> wrote: > Hi, > > Thanks for responding. This is exactly the way I access the fields. > > Code snippet: > ... > b.set_billableseat("Mediamind"); > b.set_category(5); > b.set_clickthroughurl("http://www.ynet.co.il"); > b.set_creativeid("ab15a"); > ... > I walked through this with the debugger. When billableseat is set, > Clickthroughurl and creativeId both become "Mediamind" as well. Same > with clickthroughUrl and creativeId - setting each one of them turns > all 3 fields the same value. Only setting Category didn't affect > anything except category. > > Thanks, > > G. > > > > On Apr 4, 7:45 pm, Jeremiah Jordan <[email protected]> wrote: >> How are you setting the data? >> You should be using something like: >> bid.set_HtmlSnippet("Stuff"); >> and >> std::string html = bid.HtmlSnippet(); >> >> See:https://developers.google.com/protocol-buffers/docs/reference/cpp/goo... >> >> >> >> >> >> >> >> On Wednesday, April 4, 2012 7:25:15 AM UTC-5, G. wrote: >> >>> Hi all, >> >>> I am using protobuf 2.4.1, and I encountered a weird issue: >> >>> I created the following .proto file: >> >>> message Auction { >>> // Bid request id >>> required bytes Id = 1; >>> optional bytes Ip = 2; >>> required int32 adId = 3; >>> required int32 adHeight = 4; >>> required int32 adWidth = 5; >>> optional string domain = 6; >>> optional string country = 7; >>> optional string region = 8; >>> required string exchangeUserId = 9; >>> optional string pageUrl = 10; >>> optional int32 publisherId = 11; >>> optional int32 timezoneOffset = 12; >>> optional string userAgent = 13; >>> required string identifier = 14; >>> } >> >>> message Bid { >>> // Bid request Id >>> required bytes Id = 1; >>> required int32 processingTime = 2; >>> required int32 adId = 3; >>> required float bid = 4; >>> required int32 advertiserId = 5; >>> required string creativeId = 6; >>> required string billableSeat = 7; >>> required int32 category = 8; >>> required int32 vendorType = 9; >>> required int32 strategyId = 10; >>> required string clickthroughUrl = 11; >>> required string HtmlSnippet = 12; >>> } >> >>> It compiles fine with protoc.exe. >> >>> However, when I tried assigning the fields, I noticed the following >>> phenomenon: the fields id, billableseat and htmlsnippet in Bid >>> structure share the same address! When one is assigned, so are the >>> other two. >> >>> What am I doing wrong? Has anyone encountered such a thing before? >> >>> Thanks, >> >>> G. > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
