some work on copyPointer

This commit is contained in:
David Renshaw 2014-10-11 09:18:41 -04:00
parent 4d6b885f4b
commit 40fc0193c2

View file

@ -532,6 +532,40 @@ final class WireHelpers {
// readStructPointer(), etc. because they do type checking whereas here we want to accept any // readStructPointer(), etc. because they do type checking whereas here we want to accept any
// valid pointer. // valid pointer.
long srcRef = WirePointer.get(srcSegment.buffer, srcOffset);
if (WirePointer.isNull(srcRef)) {
dstSegment.buffer.putLong(dstOffset * 8, 0L);
return dstSegment;
}
int srcTarget = WirePointer.target(srcOffset, srcRef);
FollowFarsResult resolved = followFars(srcRef, srcTarget, srcSegment);
switch (WirePointer.kind(resolved.ref)) {
case WirePointer.STRUCT :
if (nestingLimit <= 0) {
throw new DecodeException("Message is too deeply nested or contains cycles. See org.capnproto.ReaderOptions.");
}
resolved.segment.arena.checkReadLimit(StructPointer.wordSize(resolved.ref));
// TODO
//return setStructPointer(dstSegment, dstOffset, ...);
case WirePointer.LIST :
byte elementSize = ListPointer.elementSize(resolved.ref);
if (nestingLimit <= 0) {
throw new DecodeException("Message is too deeply nested or contains cycles. See org.capnproto.ReaderOptions.");
}
if (elementSize == FieldSize.INLINE_COMPOSITE) {
int wordCount = ListPointer.inlineCompositeWordCount(resolved.ref);
//long tag =
} else {
}
case WirePointer.FAR :
case WirePointer.OTHER :
}
throw new Error("copyPointer is unimplemented"); throw new Error("copyPointer is unimplemented");
} }