Skip to content

Commit

Permalink
josm-mirror: bumped externals
Browse files Browse the repository at this point in the history
  • Loading branch information
JOSM GitHub mirror committed Jan 22, 2017
1 parent 6f027ed commit d0f7689
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Expand Up @@ -202,8 +202,8 @@ private byte[] expand(final int offset, final int length) {
if (offset == 1) { // surprisingly common special case
byte[] block = expandedBlocks.peekFirst();
byte b = block[block.length - 1];
for (int i = 0; i < expanded.length; i++) {
expanded[i] = b;
if (b != 0) { // the fresh array contains 0s anyway
Arrays.fill(expanded, b);
}
} else {
expandFromList(expanded, offset, length);
Expand Down Expand Up @@ -236,9 +236,6 @@ private void expandFromList(final byte[] expanded, int offset, int length) {
copyOffset = writeOffset + offsetRemaining;
copyLen = Math.min(lengthRemaining, writeOffset + offsetRemaining);
}
if (copyLen < 1) {
throw new IllegalStateException("zero copy");
}
System.arraycopy(block, copyOffset, expanded, writeOffset, copyLen);
offsetRemaining -= copyLen;
lengthRemaining -= copyLen;
Expand Down
Expand Up @@ -20,6 +20,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

import org.apache.commons.compress.compressors.CompressorInputStream;
import org.apache.commons.compress.utils.ByteUtils;
Expand Down Expand Up @@ -222,9 +223,8 @@ private void tryToCopy(int bytesToCopy) {
// NOP
} else if (backReferenceOffset == 1) { // pretty common special case
final byte last = buf[writeIndex - 1];
for (int i = 0; i < copy; i++) {
buf[writeIndex++] = last;
}
Arrays.fill(buf, writeIndex, writeIndex + copy, last);
writeIndex += copy;
} else if (copy < backReferenceOffset) {
System.arraycopy(buf, writeIndex - backReferenceOffset, buf, writeIndex, copy);
writeIndex += copy;
Expand Down

0 comments on commit d0f7689

Please sign in to comment.