orbiter 18 years ago
parent 1a45ecb356
commit e03fcf4627

@ -144,7 +144,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer
// this is a text fragment, generate gettext quotation
int ws = sbbs[i].whitespaceStart(true);
int we = sbbs[i].whitespaceEnd(true);
result.add(new String(sbbs[i].getBytes(ws, we)));
result.add(new String(sbbs[i].getBytes(ws, we - ws)));
}
}
return result;

@ -102,7 +102,7 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
this.out.write(Integer.toHexString(len).getBytes());
this.out.write(serverCore.crlf);
this.out.write(b.getBytes(off, off + len));
this.out.write(b.getBytes(off, len));
this.out.write(serverCore.crlf);
this.out.flush();
}

@ -48,7 +48,7 @@ public class httpSSI {
parseSSI(referenceFile, in, start, q + 3 - start, out);
writeSSI(referenceFile, in, start + q + 3, out);
} else if (p > 0) {
int q = in.indexOf("-->".getBytes(), start + 10);
int q = in.indexOf("-->".getBytes(), p + 10);
out.write(in, start, p - start);
parseSSI(referenceFile, in, start + p, q + 3 - start - p, out);
writeSSI(referenceFile, in, start + q + 3, out);

@ -179,7 +179,7 @@ public final class httpTemplate {
if (q >= 0) {
// found a pattern
l.addAll(splitQuotation(new serverByteBuffer(text.getBytes(0, p)), qoff));
l.add(new serverByteBuffer(text.getBytes(p, q + right.length)));
l.add(new serverByteBuffer(text.getBytes(p, q + right.length - p)));
text = new serverByteBuffer(text.getBytes(q + right.length));
} else {
// found only pattern start, no closing parantesis (a syntax error that is silently accepted here)

@ -80,7 +80,7 @@ public class kelondroBufferedRA extends kelondroAbstractRA implements kelondroRA
}
public int read(byte[] b, int off, int len) throws IOException {
byte[] g = sbb.getBytes((int) pos, (int) pos + len);
byte[] g = sbb.getBytes((int) pos, len);
pos += g.length;
System.arraycopy(g, 0, b, off, g.length);
return g.length;

@ -295,13 +295,13 @@ public final class serverByteBuffer extends OutputStream {
public byte[] getBytes(int start) {
return getBytes(start, length);
}
public byte[] getBytes(int start, int end) {
public byte[] getBytes(int start, int len) {
// start is inclusive, end is exclusive
if (end > length) throw new IndexOutOfBoundsException("getBytes: end > length");
if (len > length) throw new IndexOutOfBoundsException("getBytes: len > length");
if (start > length) throw new IndexOutOfBoundsException("getBytes: start > length");
byte[] tmp = new byte[end - start];
System.arraycopy(buffer, offset + start, tmp, 0, end - start);
byte[] tmp = new byte[len];
System.arraycopy(buffer, offset + start, tmp, 0, len);
return tmp;
}
@ -313,13 +313,12 @@ public final class serverByteBuffer extends OutputStream {
return this;
}
public serverByteBuffer trim(int start, int end) {
public serverByteBuffer trim(int start, int len) {
// the end value is outside (+1) of the wanted target array
if (start > length) throw new IndexOutOfBoundsException("trim: start > length");
if (end > length) throw new IndexOutOfBoundsException("trim: end > length");
if (start > end) throw new IndexOutOfBoundsException("trim: start > end");
if (start + len > length) throw new IndexOutOfBoundsException("trim: start + len > length");
offset = offset + start;
length = end - start;
length = len;
return this;
}
@ -337,7 +336,7 @@ public final class serverByteBuffer extends OutputStream {
r--;
}
if (l > r) r = l;
return trim(l, r);
return trim(l, r - l);
}
public int isUTF8char(int start) {

Loading…
Cancel
Save