From 78f7decf00a5a3b8f075222464879aa6d8b9ce48 Mon Sep 17 00:00:00 2001 From: Axel Howind Date: Mon, 10 Jan 2022 14:37:13 +0000 Subject: [PATCH] Bug 65796: License violation in PICT.java git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896887 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/hslf/blip/PICT.java | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java b/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java index 864bce2b2c..8ae0496e4f 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/PICT.java @@ -23,6 +23,7 @@ import java.awt.Dimension; import java.io.ByteArrayInputStream; import java.io.EOFException; import java.io.IOException; +import java.util.Arrays; import java.util.zip.InflaterInputStream; import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; @@ -99,7 +100,7 @@ public final class PICT extends Metafile { out.write(chunk, 0, count); // PICT zip-stream can be erroneous, so we clear the array to determine // the maximum of read bytes, after the inflater crashed - bytefill(chunk, (byte) 0); + Arrays.fill(chunk, (byte) 0); } } catch (Exception e) { int lastLen = chunk.length - 1; @@ -186,22 +187,4 @@ public final class PICT extends Metafile { throw new IllegalArgumentException(signature+" is not a valid instance/signature value for PICT"); } } - - - /* - * initialize a smaller piece of the array and use the System.arraycopy - * call to fill in the rest of the array in an expanding binary fashion - */ - private static void bytefill(byte[] array, byte value) { - // http://stackoverflow.com/questions/9128737/fastest-way-to-set-all-values-of-an-array - int len = array.length; - - if (len > 0){ - array[0] = value; - } - - for (int i = 1; i < len; i += i) { - System.arraycopy(array, 0, array, i, Math.min(len - i, i)); - } - } } -- 2.39.5