This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git

commit d9d45f676ea2f01b6f5803fd0facbc840b937aa0
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Apr 15 18:06:53 2024 -0400

    Refactor instance variables that act like temps into locals
---
 src/main/java/org/apache/commons/codec/binary/Base32.java | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java 
b/src/main/java/org/apache/commons/codec/binary/Base32.java
index 9c3ac7ee..3bc44f08 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32.java
@@ -132,12 +132,6 @@ public class Base32 extends BaseNCodec {
     // The private member fields below are used with the new streaming 
approach, which requires
     // some state be preserved between calls of encode() and decode().
 
-    /**
-     * Convenience variable to help us determine when our buffer is going to 
run out of room and needs resizing. {@code decodeSize = {@link
-     * #BYTES_PER_ENCODED_BLOCK} - 1 + lineSeparator.length;}
-     */
-    private final int decodeSize;
-
     /**
      * Decode table to use.
      */
@@ -318,8 +312,6 @@ public class Base32 extends BaseNCodec {
             this.encodeSize = BYTES_PER_ENCODED_BLOCK;
             this.lineSeparator = null;
         }
-        this.decodeSize = this.encodeSize - 1;
-
         if (isInAlphabet(padding) || Character.isWhitespace(padding)) {
             throw new IllegalArgumentException("pad must not be in alphabet or 
whitespace");
         }
@@ -347,13 +339,13 @@ public class Base32 extends BaseNCodec {
     @Override
     void decode(final byte[] input, int inPos, final int inAvail, final 
Context context) {
         // package protected for access from I/O streams
-
         if (context.eof) {
             return;
         }
         if (inAvail < 0) {
             context.eof = true;
         }
+        final int decodeSize = this.encodeSize - 1;
         for (int i = 0; i < inAvail; i++) {
             final byte b = input[inPos++];
             if (b == pad) {
@@ -378,7 +370,6 @@ public class Base32 extends BaseNCodec {
                 }
             }
         }
-
         // Two forms of EOF as far as Base32 decoder is concerned: actual
         // EOF (-1) and first time '=' character is encountered in stream.
         // This approach makes the '=' padding characters completely optional.

Reply via email to