fix multi-segment reading
This commit is contained in:
parent
331c4f4e89
commit
1a3561c0f7
2 changed files with 4 additions and 7 deletions
|
@ -21,7 +21,7 @@ class EncodingSuite extends FunSuite {
|
||||||
TestUtil.initTestMessage(allTypes);
|
TestUtil.initTestMessage(allTypes);
|
||||||
|
|
||||||
TestUtil.checkTestMessage(allTypes);
|
TestUtil.checkTestMessage(allTypes);
|
||||||
//TestUtil.checkTestMessage(allTypes.asReader());
|
TestUtil.checkTestMessage(allTypes.asReader());
|
||||||
}
|
}
|
||||||
|
|
||||||
// to debug, do this:
|
// to debug, do this:
|
||||||
|
|
|
@ -111,20 +111,17 @@ final class WireHelpers {
|
||||||
//# If the segment is null, this is an unchecked message,
|
//# If the segment is null, this is an unchecked message,
|
||||||
//# so there are no FAR pointers.
|
//# so there are no FAR pointers.
|
||||||
if (segment != null && WirePointer.kind(ref) == WirePointer.FAR) {
|
if (segment != null && WirePointer.kind(ref) == WirePointer.FAR) {
|
||||||
|
|
||||||
SegmentReader resultSegment = segment.arena.tryGetSegment(FarPointer.getSegmentId(ref));
|
SegmentReader resultSegment = segment.arena.tryGetSegment(FarPointer.getSegmentId(ref));
|
||||||
|
|
||||||
int ptr = FarPointer.positionInSegment(ref);
|
int padOffset = FarPointer.positionInSegment(ref);
|
||||||
|
long pad = WirePointer.get(resultSegment.buffer, padOffset);
|
||||||
|
|
||||||
int padWords = FarPointer.isDoubleFar(ref) ? 2 : 1;
|
int padWords = FarPointer.isDoubleFar(ref) ? 2 : 1;
|
||||||
// TODO read limiting
|
// TODO read limiting
|
||||||
|
|
||||||
int pad = ptr;
|
|
||||||
|
|
||||||
if (!FarPointer.isDoubleFar(ref)) {
|
if (!FarPointer.isDoubleFar(ref)) {
|
||||||
|
|
||||||
return new FollowFarsResult(WirePointer.target(pad,
|
return new FollowFarsResult(WirePointer.target(padOffset, pad),
|
||||||
WirePointer.get(resultSegment.buffer, pad)),
|
|
||||||
pad, resultSegment);
|
pad, resultSegment);
|
||||||
} else {
|
} else {
|
||||||
//# Landing pad is another far pointer. It is
|
//# Landing pad is another far pointer. It is
|
||||||
|
|
Loading…
Reference in a new issue