diff options
author | Sven Gothel <[email protected]> | 2022-09-06 01:32:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-09-06 01:32:13 +0200 |
commit | 093c9d20089d273c0789e44594963022e4a94fc3 (patch) | |
tree | d93b276b714b3dd26d0f625cbf61578247c41594 /java_base | |
parent | ec30a11513f53ad0052825e71e27f1a5ab90acd4 (diff) |
BaseCodec/jau::codec::base: Align out_len for encode64() and decode64(), annotate. C++ decode64() out vector potentially reserved not enough bytes (performance, clarity)
Diffstat (limited to 'java_base')
-rw-r--r-- | java_base/org/jau/util/BaseCodec.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/java_base/org/jau/util/BaseCodec.java b/java_base/org/jau/util/BaseCodec.java index 4d14550..500eec7 100644 --- a/java_base/org/jau/util/BaseCodec.java +++ b/java_base/org/jau/util/BaseCodec.java @@ -526,7 +526,7 @@ public class BaseCodec { } final char padding = aspec.padding64(); - final int out_len = (in_len +2) / 3 * 4; + final int out_len = ( in_len + 2 ) / 3 * 4; // estimate .. final StringBuilder res = new StringBuilder(out_len); while( 0 < in_len && 0 < out_len ) { @@ -589,7 +589,7 @@ public class BaseCodec { } final char padding = aspec.padding64(); - final int out_len = 3 * ( in_len / 4 ) + 2; + final int out_len = 3 * ( in_len / 4 ) + 2; // estimate w/ potentially up to 2 additional bytes final ByteBuffer res = ByteBuffer.allocate(out_len); int in_pos = 0; |