First part of fix for issue #569
When moving to take into account arrayOffset, it should have been taken into account also in setReadPosition and other places. Fix it now...
This commit is contained in:
parent
8b4f593397
commit
a3cedc8b47
@ -135,6 +135,8 @@ final class HttpPostBodyUtil {
|
|||||||
|
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
int origPos;
|
||||||
|
|
||||||
int limit;
|
int limit;
|
||||||
|
|
||||||
ChannelBuffer buffer;
|
ChannelBuffer buffer;
|
||||||
@ -148,7 +150,8 @@ final class HttpPostBodyUtil {
|
|||||||
}
|
}
|
||||||
this.buffer = buffer;
|
this.buffer = buffer;
|
||||||
bytes = buffer.array();
|
bytes = buffer.array();
|
||||||
pos = readerIndex = buffer.arrayOffset() + buffer.readerIndex();
|
readerIndex = buffer.readerIndex();
|
||||||
|
origPos = pos = buffer.arrayOffset() + readerIndex;
|
||||||
limit = buffer.arrayOffset() + buffer.writerIndex();
|
limit = buffer.arrayOffset() + buffer.writerIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,10 +162,19 @@ final class HttpPostBodyUtil {
|
|||||||
*/
|
*/
|
||||||
void setReadPosition(int minus) {
|
void setReadPosition(int minus) {
|
||||||
pos -= minus;
|
pos -= minus;
|
||||||
readerIndex = pos;
|
readerIndex = getReadPosition(pos);
|
||||||
buffer.readerIndex(readerIndex);
|
buffer.readerIndex(readerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param index raw index of the array (pos in general)
|
||||||
|
* @return the value equivalent of raw index to be used in readerIndex(value)
|
||||||
|
*/
|
||||||
|
int getReadPosition(int index) {
|
||||||
|
return index - origPos + readerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
buffer = null;
|
buffer = null;
|
||||||
bytes = null;
|
bytes = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user