- removed trailing ';' - use array initialization instead of loops where appropriate
As I said before, I saw the big patch on bugzilla and forgot about this, but as the big patch is no longer valid (breaks bc), here's my (very) minor version :)
Kev
Index: CBZip2InputStream.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/bzip2/CBZip2InputStream.java,v retrieving revision 1.20 diff -u -r1.20 CBZip2InputStream.java --- CBZip2InputStream.java 12 Nov 2004 15:17:10 -0000 1.20 +++ CBZip2InputStream.java 24 Mar 2005 10:55:39 -0000 @@ -22,8 +22,10 @@ */ package org.apache.tools.bzip2; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; + +import org.apache.tools.ant.util.FileUtils; /** * An input stream that decompresses from the BZip2 format (without the file @@ -36,14 +38,6 @@ //throw new CCoruptionError(); } - private static void badBGLengths() { - cadvise(); - } - - private static void bitStreamEOF() { - cadvise(); - } - private static void compressedStreamEOF() { cadvise(); } @@ -144,32 +138,31 @@ public int read() { if (streamEnd) { return -1; - } else { - int retChar = currentChar; - switch(currentState) { - case START_BLOCK_STATE: - break; - case RAND_PART_A_STATE: - break; - case RAND_PART_B_STATE: - setupRandPartB(); - break; - case RAND_PART_C_STATE: - setupRandPartC(); - break; - case NO_RAND_PART_A_STATE: - break; - case NO_RAND_PART_B_STATE: - setupNoRandPartB(); - break; - case NO_RAND_PART_C_STATE: - setupNoRandPartC(); - break; - default: - break; - } - return retChar; + } + int retChar = currentChar; + switch(currentState) { + case START_BLOCK_STATE: + break; + case RAND_PART_A_STATE: + break; + case RAND_PART_B_STATE: + setupRandPartB(); + break; + case RAND_PART_C_STATE: + setupRandPartC(); + break; + case NO_RAND_PART_A_STATE: + break; + case NO_RAND_PART_B_STATE: + setupNoRandPartB(); + break; + case NO_RAND_PART_C_STATE: + setupNoRandPartC(); + break; + default: + break; } + return retChar; } private void initialize() { @@ -258,15 +251,8 @@ } private void bsFinishedWithStream() { - try { - if (this.bsStream != null) { - if (this.bsStream != System.in) { - this.bsStream.close(); - this.bsStream = null; - } - } - } catch (IOException ioe) { - //ignore + if (bsStream != System.in) { + FileUtils.close(bsStream); } } @@ -335,9 +321,7 @@ } } - for (i = 0; i < MAX_CODE_LEN; i++) { - base[i] = 0; - } + base = new int[MAX_CODE_LEN]; for (i = 0; i < alphaSize; i++) { base[length[i] + 1]++; } @@ -346,9 +330,7 @@ base[i] += base[i - 1]; } - for (i = 0; i < MAX_CODE_LEN; i++) { - limit[i] = 0; - } + limit = new int[MAX_CODE_LEN]; vec = 0; for (i = minLen; i <= maxLen; i++) { @@ -371,14 +353,10 @@ for (i = 0; i < 16; i++) { if (bsR(1) == 1) { inUse16[i] = true; - } else { - inUse16[i] = false; } } - for (i = 0; i < 256; i++) { - inUse[i] = false; - } + inUse = new boolean[256]; for (i = 0; i < 16; i++) { if (inUse16[i]) { Index: CBZip2OutputStream.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java,v retrieving revision 1.22 diff -u -r1.22 CBZip2OutputStream.java --- CBZip2OutputStream.java 9 Mar 2004 16:48:54 -0000 1.22 +++ CBZip2OutputStream.java 24 Mar 2005 10:55:41 -0000 @@ -702,7 +702,7 @@ bc = cost[t]; bt = t; } - }; + } totc += bc; fave[bt]++; selector[nSelectors] = (char) bt; @@ -1046,7 +1046,7 @@ ltLo++; unLo++; continue; - }; + } if (n > 0) { break; } @@ -1065,7 +1065,7 @@ gtHi--; unHi--; continue; - }; + } if (n < 0) { break; } @@ -1359,7 +1359,7 @@ origPtr = i; break; } - }; + } if (origPtr == -1) { panic(); @@ -1477,11 +1477,11 @@ if (i1 > last) { i1 -= last; i1--; - }; + } if (i2 > last) { i2 -= last; i2--; - }; + } k -= 4; workDone++; @@ -1564,7 +1564,7 @@ tmp2 = tmp; tmp = yy[j]; yy[j] = tmp2; - }; + } yy[0] = tmp; if (j == 0) { @@ -1584,12 +1584,12 @@ wr++; mtfFreq[RUNB]++; break; - }; + } if (zPend < 2) { break; } zPend = (zPend - 2) / 2; - }; + } zPend = 0; } szptr[wr] = (short) (j + 1); @@ -1627,5 +1627,3 @@ nMTF = wr; } } - -
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]