You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2008/07/06 14:17:51 UTC
svn commit: r674288 -
/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java
Author: sebb
Date: Sun Jul 6 05:17:51 2008
New Revision: 674288
URL: http://svn.apache.org/viewvc?rev=674288&view=rev
Log:
Simplify case statement and avoid drop thru
Modified:
commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java
Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java?rev=674288&r1=674287&r2=674288&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java Sun Jul 6 05:17:51 2008
@@ -423,21 +423,20 @@
}
byte b = in[inPos++];
if (b == PAD) {
- modulus = (++modulus) % 4;
x = x << 6;
switch (modulus) {
- case 3:
+ case 2:
x = x << 6;
- case 0:
buf[pos++] = (byte) ((x >> 16) & MASK_8BITS);
- if (modulus == 0) {
- buf[pos++] = (byte) ((x >> 8) & MASK_8BITS);
- }
- default:
- // WE'RE DONE!!!!
- eof = true;
- return;
+ break;
+ case 3:
+ buf[pos++] = (byte) ((x >> 16) & MASK_8BITS);
+ buf[pos++] = (byte) ((x >> 8) & MASK_8BITS);
+ break;
}
+ // WE'RE DONE!!!!
+ eof = true;
+ return;
} else {
if (b >= 0 && b < base64ToInt.length) {
int result = base64ToInt[b];