mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 16:47:43 +08:00
Merge remote-tracking branch 'origin/GT-3465'
This commit is contained in:
@@ -338,14 +338,16 @@ public class ChainedBuffer implements Buffer {
|
|||||||
* @throws UnsupportedOperationException if read-only or uninitialized data source is used
|
* @throws UnsupportedOperationException if read-only or uninitialized data source is used
|
||||||
*/
|
*/
|
||||||
public synchronized void setSize(int size, boolean preserveData) throws IOException {
|
public synchronized void setSize(int size, boolean preserveData) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
if (uninitializedDataSource != null) {
|
if (uninitializedDataSource != null) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"Buffer size may not be changed when using unintialized data source");
|
"Buffer size may not be changed when using unintialized data source");
|
||||||
}
|
}
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
|
}
|
||||||
if (size > this.size) {
|
if (size > this.size) {
|
||||||
grow(size, preserveData);
|
grow(size, preserveData);
|
||||||
}
|
}
|
||||||
@@ -381,6 +383,16 @@ public class ChainedBuffer implements Buffer {
|
|||||||
newFirstDataBuf = bufferMgr.createBuffer();
|
newFirstDataBuf = bufferMgr.createBuffer();
|
||||||
newFirstDataBuf.copy(DATA_BASE_OFFSET_INDEXED, firstBuffer,
|
newFirstDataBuf.copy(DATA_BASE_OFFSET_INDEXED, firstBuffer,
|
||||||
DATA_BASE_OFFSET_NONINDEXED, oldSize);
|
DATA_BASE_OFFSET_NONINDEXED, oldSize);
|
||||||
|
|
||||||
|
int indexedDataSpace = newFirstDataBuf.length() - DATA_BASE_OFFSET_INDEXED;
|
||||||
|
byte[] zeroBytes = new byte[indexedDataSpace - oldSize];
|
||||||
|
if (useXORMask) {
|
||||||
|
int offset = oldSize;
|
||||||
|
for (int i = 0; i < zeroBytes.length; i++, offset++) {
|
||||||
|
zeroBytes[i] = xorMaskByte(offset, zeroBytes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newFirstDataBuf.put(DATA_BASE_OFFSET_INDEXED + oldSize, zeroBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establish index for DBBuffer
|
// Establish index for DBBuffer
|
||||||
@@ -403,6 +415,7 @@ public class ChainedBuffer implements Buffer {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust stored buffer size
|
// Adjust stored buffer size
|
||||||
DataBuffer buffer = bufferMgr.getBuffer(firstBufferId);
|
DataBuffer buffer = bufferMgr.getBuffer(firstBufferId);
|
||||||
buffer.putInt(DATA_LENGTH_OFFSET, getObfuscationDataLengthFieldValue());
|
buffer.putInt(DATA_LENGTH_OFFSET, getObfuscationDataLengthFieldValue());
|
||||||
@@ -465,8 +478,9 @@ public class ChainedBuffer implements Buffer {
|
|||||||
private boolean shrinkToSingleBuffer(boolean preserveData) throws IOException {
|
private boolean shrinkToSingleBuffer(boolean preserveData) throws IOException {
|
||||||
|
|
||||||
int singleDataSpace = bufferMgr.getBufferSize() - DATA_BASE_OFFSET_NONINDEXED;
|
int singleDataSpace = bufferMgr.getBufferSize() - DATA_BASE_OFFSET_NONINDEXED;
|
||||||
if (size > singleDataSpace)
|
if (size > singleDataSpace) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert first index buffer to a data buffer
|
// Convert first index buffer to a data buffer
|
||||||
DataBuffer firstBuffer = bufferMgr.getBuffer(firstBufferId);
|
DataBuffer firstBuffer = bufferMgr.getBuffer(firstBufferId);
|
||||||
@@ -582,12 +596,15 @@ public class ChainedBuffer implements Buffer {
|
|||||||
* @throws IOException thrown if an IO error occurs
|
* @throws IOException thrown if an IO error occurs
|
||||||
*/
|
*/
|
||||||
public synchronized ChainedBuffer split(int offset) throws IOException {
|
public synchronized ChainedBuffer split(int offset) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
if (firstBufferId < 0)
|
}
|
||||||
|
if (firstBufferId < 0) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || offset >= size)
|
}
|
||||||
|
if (offset < 0 || offset >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
|
|
||||||
// Create new DBBuffer
|
// Create new DBBuffer
|
||||||
int cnt = size - offset;
|
int cnt = size - offset;
|
||||||
@@ -647,16 +664,19 @@ public class ChainedBuffer implements Buffer {
|
|||||||
* or both buffers do not have the same obfuscation enablement
|
* or both buffers do not have the same obfuscation enablement
|
||||||
*/
|
*/
|
||||||
public synchronized void append(ChainedBuffer dbBuf) throws IOException {
|
public synchronized void append(ChainedBuffer dbBuf) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
if (uninitializedDataSource != null) {
|
if (uninitializedDataSource != null) {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"Buffer size may not be changed when using unintialized data source");
|
"Buffer size may not be changed when using unintialized data source");
|
||||||
}
|
}
|
||||||
if (firstBufferId < 0)
|
if (firstBufferId < 0) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (dbBuf.firstBufferId < 0 || firstBufferId == dbBuf.firstBufferId)
|
}
|
||||||
|
if (dbBuf.firstBufferId < 0 || firstBufferId == dbBuf.firstBufferId) {
|
||||||
throw new IllegalArgumentException("Illegal DBBuffer argument");
|
throw new IllegalArgumentException("Illegal DBBuffer argument");
|
||||||
|
}
|
||||||
|
|
||||||
// Grow this buffer - preserve data
|
// Grow this buffer - preserve data
|
||||||
int offset = size;
|
int offset = size;
|
||||||
@@ -802,8 +822,9 @@ public class ChainedBuffer implements Buffer {
|
|||||||
// Advance to next index buffer if needed
|
// Advance to next index buffer if needed
|
||||||
if (ix == indexesPerBuffer) {
|
if (ix == indexesPerBuffer) {
|
||||||
int nextId = indexBuffer.getInt(NEXT_INDEX_ID_OFFSET);
|
int nextId = indexBuffer.getInt(NEXT_INDEX_ID_OFFSET);
|
||||||
if (nextId < 0)
|
if (nextId < 0) {
|
||||||
throw new AssertException();
|
throw new AssertException();
|
||||||
|
}
|
||||||
bufferMgr.releaseBuffer(indexBuffer);
|
bufferMgr.releaseBuffer(indexBuffer);
|
||||||
indexBuffer = bufferMgr.getBuffer(nextId);
|
indexBuffer = bufferMgr.getBuffer(nextId);
|
||||||
indexBufferIdTable[++index] = indexBuffer.getId();
|
indexBufferIdTable[++index] = indexBuffer.getId();
|
||||||
@@ -837,10 +858,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
* Delete and release all underlying DataBuffers.
|
* Delete and release all underlying DataBuffers.
|
||||||
*/
|
*/
|
||||||
public synchronized void delete() throws IOException {
|
public synchronized void delete() throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
if (firstBufferId < 0)
|
}
|
||||||
|
if (firstBufferId < 0) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
|
}
|
||||||
|
|
||||||
// Remove all data buffers
|
// Remove all data buffers
|
||||||
for (int element : dataBufferIdTable) {
|
for (int element : dataBufferIdTable) {
|
||||||
@@ -908,10 +931,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void get(int offset, byte[] data, int dataOffset, int length)
|
public synchronized void get(int offset, byte[] data, int dataOffset, int length)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + length - 1) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + length - 1) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (data.length < dataOffset + length) {
|
if (data.length < dataOffset + length) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
}
|
}
|
||||||
@@ -950,10 +975,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized byte getByte(int offset) throws IOException {
|
public synchronized byte getByte(int offset) throws IOException {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || offset >= size)
|
}
|
||||||
|
if (offset < 0 || offset >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
int index = offset / dataSpace;
|
int index = offset / dataSpace;
|
||||||
int bufferDataOffset = offset % dataSpace;
|
int bufferDataOffset = offset % dataSpace;
|
||||||
int id = dataBufferIdTable[index];
|
int id = dataBufferIdTable[index];
|
||||||
@@ -979,10 +1006,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
public synchronized int getInt(int offset) throws IOException {
|
public synchronized int getInt(int offset) throws IOException {
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 3 <= dataSpace) {
|
if (bufferOffset + 3 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 3) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 3) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
int index = offset / dataSpace;
|
int index = offset / dataSpace;
|
||||||
int id = dataBufferIdTable[index];
|
int id = dataBufferIdTable[index];
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
@@ -1011,10 +1040,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
public synchronized long getLong(int offset) throws IOException {
|
public synchronized long getLong(int offset) throws IOException {
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 7 <= dataSpace) {
|
if (bufferOffset + 7 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 7) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 7) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
int index = offset / dataSpace;
|
int index = offset / dataSpace;
|
||||||
int id = dataBufferIdTable[index];
|
int id = dataBufferIdTable[index];
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
@@ -1045,10 +1076,12 @@ public class ChainedBuffer implements Buffer {
|
|||||||
public synchronized short getShort(int offset) throws IOException {
|
public synchronized short getShort(int offset) throws IOException {
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 1 <= dataSpace) {
|
if (bufferOffset + 1 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 1) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 1) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
int index = offset / dataSpace;
|
int index = offset / dataSpace;
|
||||||
int id = dataBufferIdTable[index];
|
int id = dataBufferIdTable[index];
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
@@ -1085,12 +1118,15 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
public synchronized void fill(int startOffset, int endOffset, byte fillByte)
|
public synchronized void fill(int startOffset, int endOffset, byte fillByte)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
if (endOffset <= startOffset)
|
}
|
||||||
|
if (endOffset <= startOffset) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
if (startOffset < 0 || endOffset > size)
|
}
|
||||||
|
if (startOffset < 0 || endOffset > size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
byte[] fillData = new byte[dataSpace];
|
byte[] fillData = new byte[dataSpace];
|
||||||
Arrays.fill(fillData, fillByte);
|
Arrays.fill(fillData, fillByte);
|
||||||
int index = startOffset / dataSpace;
|
int index = startOffset / dataSpace;
|
||||||
@@ -1153,8 +1189,9 @@ public class ChainedBuffer implements Buffer {
|
|||||||
* @throws IOException thrown if IO error occurs.
|
* @throws IOException thrown if IO error occurs.
|
||||||
*/
|
*/
|
||||||
public synchronized void fill(InputStream in) throws IOException {
|
public synchronized void fill(InputStream in) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
byte[] data = new byte[dataSpace];
|
byte[] data = new byte[dataSpace];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@@ -1199,12 +1236,15 @@ public class ChainedBuffer implements Buffer {
|
|||||||
public synchronized int put(int offset, byte[] data, int dataOffset, int length)
|
public synchronized int put(int offset, byte[] data, int dataOffset, int length)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
if (dataBufferIdTable == null)
|
}
|
||||||
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + length - 1) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + length - 1) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
int index = offset / dataSpace;
|
int index = offset / dataSpace;
|
||||||
int bufferDataOffset = offset % dataSpace;
|
int bufferDataOffset = offset % dataSpace;
|
||||||
int len = length;
|
int len = length;
|
||||||
@@ -1239,12 +1279,15 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized int putByte(int offset, byte b) throws IOException {
|
public synchronized int putByte(int offset, byte b) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
if (dataBufferIdTable == null)
|
}
|
||||||
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || offset >= size)
|
}
|
||||||
|
if (offset < 0 || offset >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
DataBuffer buffer = getBuffer(offset / dataSpace);
|
DataBuffer buffer = getBuffer(offset / dataSpace);
|
||||||
int bufferDataOffset = offset % dataSpace;
|
int bufferDataOffset = offset % dataSpace;
|
||||||
if (useXORMask) {
|
if (useXORMask) {
|
||||||
@@ -1260,14 +1303,17 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized int putInt(int offset, int v) throws IOException {
|
public synchronized int putInt(int offset, int v) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 3 <= dataSpace) {
|
if (bufferOffset + 3 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 3) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 3) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (useXORMask) {
|
if (useXORMask) {
|
||||||
v = v ^ (int) getXorMask(offset % dataSpace, 4);
|
v = v ^ (int) getXorMask(offset % dataSpace, 4);
|
||||||
}
|
}
|
||||||
@@ -1291,14 +1337,17 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized int putLong(int offset, long v) throws IOException {
|
public synchronized int putLong(int offset, long v) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 7 <= dataSpace) {
|
if (bufferOffset + 7 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 7) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 7) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (useXORMask) {
|
if (useXORMask) {
|
||||||
v = v ^ getXorMask(offset % dataSpace, 8);
|
v = v ^ getXorMask(offset % dataSpace, 8);
|
||||||
}
|
}
|
||||||
@@ -1326,14 +1375,17 @@ public class ChainedBuffer implements Buffer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized int putShort(int offset, short v) throws IOException {
|
public synchronized int putShort(int offset, short v) throws IOException {
|
||||||
if (readOnly)
|
if (readOnly) {
|
||||||
throw new UnsupportedOperationException("Read-only buffer");
|
throw new UnsupportedOperationException("Read-only buffer");
|
||||||
|
}
|
||||||
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
int bufferOffset = dataBaseOffset + (offset % dataSpace);
|
||||||
if (bufferOffset + 1 <= dataSpace) {
|
if (bufferOffset + 1 <= dataSpace) {
|
||||||
if (dataBufferIdTable == null)
|
if (dataBufferIdTable == null) {
|
||||||
throw new AssertException("Invalid Buffer");
|
throw new AssertException("Invalid Buffer");
|
||||||
if (offset < 0 || (offset + 1) >= size)
|
}
|
||||||
|
if (offset < 0 || (offset + 1) >= size) {
|
||||||
throw new ArrayIndexOutOfBoundsException();
|
throw new ArrayIndexOutOfBoundsException();
|
||||||
|
}
|
||||||
if (useXORMask) {
|
if (useXORMask) {
|
||||||
v = (short) (v ^ (short) getXorMask(offset % dataSpace, 2));
|
v = (short) (v ^ (short) getXorMask(offset % dataSpace, 2));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -884,11 +884,12 @@ public abstract class AbstractChainedBufferTest extends AbstractGenericTest {
|
|||||||
assertEquals(0, mgr.getLockCount());
|
assertEquals(0, mgr.getLockCount());
|
||||||
|
|
||||||
// Grow buffer (single index buffer)
|
// Grow buffer (single index buffer)
|
||||||
int newSize = 2 * BUFFER_SIZE;
|
int newSize = (int) (2.3 * BUFFER_SIZE);
|
||||||
if (doSetSize(cb, newSize, true)) {
|
if (doSetSize(cb, newSize, true)) {
|
||||||
assertTrue(Arrays.equals(bytes, cb.get(0, size)));
|
assertTrue(Arrays.equals(bytes, cb.get(0, size)));
|
||||||
int addSize = newSize - size;
|
int addSize = newSize - size;
|
||||||
byte[] addBytes = new byte[addSize];
|
byte[] addBytes = new byte[addSize];
|
||||||
|
assertTrue(Arrays.equals(addBytes, cb.get(size, addBytes.length)));
|
||||||
random.nextBytes(addBytes);
|
random.nextBytes(addBytes);
|
||||||
cb.put(size, addBytes);
|
cb.put(size, addBytes);
|
||||||
assertTrue(Arrays.equals(bytes, cb.get(0, size)));
|
assertTrue(Arrays.equals(bytes, cb.get(0, size)));
|
||||||
|
|||||||
Reference in New Issue
Block a user