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
@ -134,6 +134,8 @@ final class HttpPostBodyUtil {
|
||||
int readerIndex;
|
||||
|
||||
int pos;
|
||||
|
||||
int origPos;
|
||||
|
||||
int limit;
|
||||
|
||||
@ -148,7 +150,8 @@ final class HttpPostBodyUtil {
|
||||
}
|
||||
this.buffer = buffer;
|
||||
bytes = buffer.array();
|
||||
pos = readerIndex = buffer.arrayOffset() + buffer.readerIndex();
|
||||
readerIndex = buffer.readerIndex();
|
||||
origPos = pos = buffer.arrayOffset() + readerIndex;
|
||||
limit = buffer.arrayOffset() + buffer.writerIndex();
|
||||
}
|
||||
|
||||
@ -159,10 +162,19 @@ final class HttpPostBodyUtil {
|
||||
*/
|
||||
void setReadPosition(int minus) {
|
||||
pos -= minus;
|
||||
readerIndex = pos;
|
||||
readerIndex = getReadPosition(pos);
|
||||
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() {
|
||||
buffer = null;
|
||||
bytes = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user