commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r674288 - /commons/proper/codec/trunk/src/java/org/apache/commons/codec/binary/Base64.java
Date Sun, 06 Jul 2008 12:17:51 GMT
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];



Mime
View raw message