some work on getWritableStructListPointer. still buggy
This commit is contained in:
parent
ec024a2597
commit
10f775a11e
2 changed files with 24 additions and 9 deletions
|
@ -161,13 +161,11 @@ object TestUtil {
|
||||||
assert(textList.get(1).toString() == "xyzzy");
|
assert(textList.get(1).toString() == "xyzzy");
|
||||||
assert(textList.get(2).toString() == "thud");
|
assert(textList.get(2).toString() == "thud");
|
||||||
|
|
||||||
/*
|
|
||||||
val structList = builder.getStructList();
|
val structList = builder.getStructList();
|
||||||
assert(3 == structList.size());
|
//assert(3 == structList.size());
|
||||||
assert(structList.get(0).getTextField().toString() == "structlist 1")
|
//assert(structList.get(0).getTextField().toString() == "structlist 1")
|
||||||
assert(structList.get(1).getTextField().toString() == "structlist 2")
|
//assert(structList.get(1).getTextField().toString() == "structlist 2")
|
||||||
assert(structList.get(2).getTextField().toString() == "structlist 3")
|
//assert(structList.get(2).getTextField().toString() == "structlist 3")
|
||||||
*/
|
|
||||||
|
|
||||||
val enumList = builder.getEnumList();
|
val enumList = builder.getEnumList();
|
||||||
(enumList.get(0)) should equal (TestEnum.FOO);
|
(enumList.get(0)) should equal (TestEnum.FOO);
|
||||||
|
|
|
@ -339,12 +339,29 @@ final class WireHelpers {
|
||||||
if (oldSize == ElementSize.INLINE_COMPOSITE) {
|
if (oldSize == ElementSize.INLINE_COMPOSITE) {
|
||||||
//# Existing list is INLINE_COMPOSITE, but we need to verify that the sizes match.
|
//# Existing list is INLINE_COMPOSITE, but we need to verify that the sizes match.
|
||||||
long oldTag = resolved.segment.get(resolved.ptr);
|
long oldTag = resolved.segment.get(resolved.ptr);
|
||||||
|
int oldPtr = resolved.ptr + Constants.POINTER_SIZE_IN_WORDS;
|
||||||
|
if (WirePointer.kind(oldTag) != WirePointer.STRUCT) {
|
||||||
|
throw new DecodeException("INLINE_COMPOSITE list with non-STRUCT elements not supported.");
|
||||||
|
}
|
||||||
|
int oldDataSize = StructPointer.dataSize(oldTag);
|
||||||
|
int oldPointerCount = StructPointer.ptrCount(oldTag);
|
||||||
|
int oldStep = (oldDataSize + oldPointerCount * Constants.POINTER_SIZE_IN_WORDS);
|
||||||
|
int elementCount = WirePointer.inlineCompositeListElementCount(oldTag);
|
||||||
|
|
||||||
} else {
|
if (oldDataSize >= elementSize.data && oldPointerCount >= elementSize.pointers) {
|
||||||
// ...
|
//# Old size is at least as large as we need. Ship it.
|
||||||
|
return factory.constructBuilder(resolved.segment, resolved.ptr * Constants.BYTES_PER_WORD,
|
||||||
|
elementCount, oldDataSize * Constants.BITS_PER_WORD, oldPointerCount,
|
||||||
|
ElementSize.INLINE_COMPOSITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error("getWritableStructListPointer is unimplemented");
|
//# The structs in this list are smaller than expected, probably written using an older
|
||||||
|
//# version of the protocol. We need to make a copy and expand them.
|
||||||
|
throw new Error("unimplemented");
|
||||||
|
} else {
|
||||||
|
//# We're upgrading from a non-struct list.
|
||||||
|
throw new Error("unimplemented");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// size is in bytes
|
// size is in bytes
|
||||||
|
|
Loading…
Reference in a new issue