This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 965792e2bf9126165f7a402c105e7fd669bd60f6 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Sep 9 11:40:09 2019 +0100 Simplify In calculateChunkHeader() start pos at 8 rather than 7 and then decrement before it is used rather than after. This results in the same number of decrement calls and the same values used in chunkHeader.put() but the returned value is 1 higher than previously, removing the need for the +1 in the caller. --- java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java index b382683..6eedd81 100644 --- a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java +++ b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java @@ -106,7 +106,7 @@ public class ChunkedOutputFilter implements OutputFilter { int pos = calculateChunkHeader(result); - chunkHeader.position(pos + 1).limit(10); + chunkHeader.position(pos).limit(10); buffer.doWrite(chunkHeader); buffer.doWrite(chunk); @@ -120,12 +120,12 @@ public class ChunkedOutputFilter implements OutputFilter { private int calculateChunkHeader(int len) { // Calculate chunk header - int pos = 7; + int pos = 8; int current = len; while (current > 0) { int digit = current % 16; current = current / 16; - chunkHeader.put(pos--, HexUtils.getHex(digit)); + chunkHeader.put(--pos, HexUtils.getHex(digit)); } return pos; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org