a bit of work on copyPointer
This commit is contained in:
parent
2d7816fae4
commit
1ab3601bf0
2 changed files with 20 additions and 4 deletions
|
@ -25,6 +25,7 @@ import java.nio.ByteBuffer;
|
||||||
|
|
||||||
final class StructPointer{
|
final class StructPointer{
|
||||||
public static short dataSize(long ref) {
|
public static short dataSize(long ref) {
|
||||||
|
// in words.
|
||||||
return (short)(WirePointer.upper32Bits(ref) & 0xffff);
|
return (short)(WirePointer.upper32Bits(ref) & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,8 +551,13 @@ final class WireHelpers {
|
||||||
throw new DecodeException("Message is too deeply nested or contains cycles. See org.capnproto.ReaderOptions.");
|
throw new DecodeException("Message is too deeply nested or contains cycles. See org.capnproto.ReaderOptions.");
|
||||||
}
|
}
|
||||||
resolved.segment.arena.checkReadLimit(StructPointer.wordSize(resolved.ref));
|
resolved.segment.arena.checkReadLimit(StructPointer.wordSize(resolved.ref));
|
||||||
// TODO
|
return setStructPointer(dstSegment, dstOffset,
|
||||||
//return setStructPointer(dstSegment, dstOffset, ...);
|
new StructReader(srcSegment,
|
||||||
|
resolved.ptr,
|
||||||
|
resolved.ptr + StructPointer.dataSize(resolved.ref),
|
||||||
|
StructPointer.dataSize(resolved.ref) * Constants.BITS_PER_WORD,
|
||||||
|
StructPointer.ptrCount(resolved.ref),
|
||||||
|
(byte) 0, nestingLimit - 1));
|
||||||
case WirePointer.LIST :
|
case WirePointer.LIST :
|
||||||
byte elementSize = ListPointer.elementSize(resolved.ref);
|
byte elementSize = ListPointer.elementSize(resolved.ref);
|
||||||
if (nestingLimit <= 0) {
|
if (nestingLimit <= 0) {
|
||||||
|
@ -560,9 +565,19 @@ final class WireHelpers {
|
||||||
}
|
}
|
||||||
if (elementSize == ElementSize.INLINE_COMPOSITE) {
|
if (elementSize == ElementSize.INLINE_COMPOSITE) {
|
||||||
int wordCount = ListPointer.inlineCompositeWordCount(resolved.ref);
|
int wordCount = ListPointer.inlineCompositeWordCount(resolved.ref);
|
||||||
//long tag =
|
long tag = WirePointer.get(resolved.segment.buffer, resolved.ptr);
|
||||||
} else {
|
int ptr = resolved.ptr + 1;
|
||||||
|
|
||||||
|
resolved.segment.arena.checkReadLimit(wordCount + 1);
|
||||||
|
|
||||||
|
if (WirePointer.kind(tag) != WirePointer.STRUCT) {
|
||||||
|
throw new DecodeException("INLINE_COMPOSITE lists of non-STRUCT type are not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int elementCount = WirePointer.inlineCompositeListElementCount(tag);
|
||||||
|
// ...
|
||||||
|
} else {
|
||||||
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
case WirePointer.FAR :
|
case WirePointer.FAR :
|
||||||
|
|
Loading…
Reference in a new issue