multiple bugfixes for new stack/row features

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2159 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent fcefefb65d
commit 89424ff122

@ -681,11 +681,11 @@ public class kelondroRecords {
}
}
private void setValue(byte[] value, int valuewidth, byte[] targetarray, int targetoffset) {
private void setValue(byte[] value, int valueoffset, int valuewidth, byte[] targetarray, int targetoffset) {
if (value == null) {
while (valuewidth-- > 0) targetarray[targetoffset + valuewidth] = 0;
} else {
System.arraycopy(value, 0, targetarray, targetoffset, Math.min(value.length, valuewidth)); // error?
System.arraycopy(value, valueoffset, targetarray, targetoffset, Math.min(value.length, valuewidth)); // error?
if (value.length < valuewidth) {
while (valuewidth-- > value.length) targetarray[targetoffset + valuewidth] = 0;
}
@ -736,10 +736,10 @@ public class kelondroRecords {
// set values
if (this.handle.index != NUL) {
setValue(row[0], ROW.width(0), headChunk, overhead);
setValue(row[0], 0, ROW.width(0), headChunk, overhead);
int offset = 0;
for (int i = 1; i < row.length; i++) {
setValue(row[i], ROW.width(i), tailChunk, offset);
setValue(row[i], 0, ROW.width(i), tailChunk, offset);
offset +=ROW.width(i);
}
}
@ -755,8 +755,8 @@ public class kelondroRecords {
// set values
if (this.handle.index != NUL) {
setValue(row, ROW.width(0), headChunk, overhead);
setValue(row, ROW.width(1), tailChunk, 0);
setValue(row, 0, ROW.width(0), headChunk, overhead);
if (ROW.columns() > 0) setValue(row, ROW.width(0), ROW.size() - ROW.width(0), tailChunk, 0);
}
this.headChanged = true;
this.tailChanged = true;

@ -143,7 +143,7 @@ public class kelondroRow {
rowinstance = new byte[objectsize];
for (int i = 0; i < objectsize; i++) this.rowinstance[i] = 0;
for (int i = 0; i < cols.length; i++) {
System.arraycopy(cols[i], 0, rowinstance, colstart[i], row[i].cellwidth());
if (cols[i] != null) System.arraycopy(cols[i], 0, rowinstance, colstart[i], Math.min(cols[i].length, row[i].cellwidth()));
}
}

@ -443,7 +443,17 @@ public final class kelondroStack extends kelondroRecords {
// -g test.stack
// -v test.stack
// -g 1 test.stack
cmd(args);
cmd(args);
/*
kelondroStack s = new kelondroStack(new File("/Users/admin/dev/yacy/trunk/test.stack"), 1024, new int[]{10,10}, false);
try {
s.push(s.row().newEntry(new byte[][]{"test123".getBytes(), "abcdefg".getBytes()}));
s.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
}
}

Loading…
Cancel
Save