Closed GoogleCodeExporter closed 9 years ago
The actual problem was not related to decimal fields. The presence map bit
count for
decimal fields is correct. When an optional group had been merged into the
containing application message because there were no typerefs or the typeref of
the
group matched the typeref of the containing segment, the encoder did not write
the
pmap bit for the group in the containing segment's pmap.
Unit test based on the XML in this issue: test_unit_31 in
testFieldInstructions.cpp.
Problem fixed in R270
Original comment by dale.wil...@gmail.com
on 3 Dec 2009 at 9:02
I think we are not talking about the same problem. I'll try to explain the
problem on
detail. When you try to encode a group encodeNop function is called and it call
encodeGroup. Once you are inside encodeGroup, the program will call
presenceMapBitsRequired(FieldInstructionGroup.cpp).
presenceMapBitsRequired iterates for all instructions that compose the group,
asking
them the length of PMAP. As FieldInstructionDecimal returns 0, the instruction
pmap.encode(Encoder.cpp) will not be executed.
This is the trace:
FieldInstructionGroup::encodeNop(...) : Line 104
--> encoder.encodeGroup(destination, segmentBody_ *group);
Encoder::encodeGroup(...) : Line 82
--> size_t presenceMapBits = group->presenceMapBitCount(); * It returns 0
Encoder::encodeGroup(...) : Line 99
--> if (presenceMapBits > 0)
--> {
--> destination.selectBuffer(pmapBuffer);
--> pmap.encode(destination);
--> }
*As presenceMapBits is 0 pmap don't call encode funtion.
Your test file works but is not 100% accurate. You are creating SegmentBodyPtr
with
SegmentBody(1) but parsing XML file you use SegmentBody()(0 by default), so in
some
way your are cheating since you are assuming the group will have 1 bit.
Original comment by carlo...@gmail.com
on 4 Dec 2009 at 12:25
Take two on fixing this one. I changed the test to create a truly empty
segment
body, and the problem showed up.
The fix involved changing how presence map bit requirements are calculated.
The new
technique gives the real number rather than a "best guess."
Original comment by dale.wil...@gmail.com
on 7 Dec 2009 at 4:42
Original issue reported on code.google.com by
carlo...@gmail.com
on 3 Dec 2009 at 2:42Attachments: