This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 096bb8d5347611099ba3a68f133a8e82b37dd28c 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 063f462..7da9ea8 100644 --- a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java +++ b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java @@ -117,7 +117,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); @@ -132,12 +132,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