< prev index next >

src/java.desktop/share/classes/sun/awt/image/GifImageDecoder.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -84,11 +84,11 @@
 
     /**
      * Read a number of bytes into a buffer.
      * @return number of bytes that were not read due to EOF or error
      */
-    private int readBytes(byte buf[], int off, int len) {
+    private int readBytes(byte[] buf, int off, int len) {
         while (len > 0) {
             try {
                 int n = input.read(buf, off, len);
                 if (n < 0) {
                     break;

@@ -100,15 +100,15 @@
             }
         }
         return len;
     }
 
-    private static final int ExtractByte(byte buf[], int off) {
+    private static final int ExtractByte(byte[] buf, int off) {
         return (buf[off] & 0xFF);
     }
 
-    private static final int ExtractWord(byte buf[], int off) {
+    private static final int ExtractWord(byte[] buf, int off) {
         return (buf[off] & 0xFF) | ((buf[off + 1] & 0xFF) << 8);
     }
 
     /**
      * produce an image from the stream.

@@ -131,11 +131,11 @@
 
                 switch (code = input.read()) {
                   case EXBLOCK:
                     switch (code = input.read()) {
                       case EX_GRAPHICS_CONTROL: {
-                        byte buf[] = new byte[6];
+                        byte[] buf = new byte[6];
                         if (readBytes(buf, 0, 6) != 0) {
                             return;//error("corrupt GIF file");
                         }
                         if ((buf[0] != 4) || (buf[5] != 0)) {
                             return;//error("corrupt GIF file (GCE size)");

@@ -163,11 +163,11 @@
                         while (true) {
                             int n = input.read();
                             if (n <= 0) {
                                 break;
                             }
-                            byte buf[] = new byte[n];
+                            byte[] buf = new byte[n];
                             if (readBytes(buf, 0, n) != 0) {
                                 return;//error("corrupt GIF file");
                             }
                             if (code == EX_COMMENT) {
                                 comment += new String(buf, 0);

@@ -273,11 +273,11 @@
     /**
      * Read Image header
      */
     private void readHeader() throws IOException, ImageFormatException {
         // Create a buffer
-        byte buf[] = new byte[13];
+        byte[] buf = new byte[13];
 
         // Read the header
         if (readBytes(buf, 0, 13) != 0) {
             throw new IOException();
         }

@@ -337,13 +337,13 @@
      */
     private static final int interlaceflags =
         ImageConsumer.RANDOMPIXELORDER | ImageConsumer.COMPLETESCANLINES |
         ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME;
 
-    private short prefix[]  = new short[4096];
-    private byte  suffix[]  = new byte[4096];
-    private byte  outCode[] = new byte[4097];
+    private short[] prefix  = new short[4096];
+    private byte[]  suffix  = new byte[4096];
+    private byte[]  outCode = new byte[4097];
 
     private static native void initIDs();
 
     static {
         /* ensure that the necessary native libraries are loaded */

@@ -351,15 +351,15 @@
         initIDs();
     }
 
     private native boolean parseImage(int x, int y, int width, int height,
                                       boolean interlace, int initCodeSize,
-                                      byte block[], byte rasline[],
+                                      byte[] block, byte[] rasline,
                                       IndexColorModel model);
 
     private int sendPixels(int x, int y, int width, int height,
-                           byte rasline[], ColorModel model) {
+                           byte[] rasline, ColorModel model) {
         int rasbeg, rasend, x2;
         if (y < 0) {
             height += y;
             y = 0;
         }

@@ -465,11 +465,11 @@
         if (verbose) {
             tm = System.currentTimeMillis();
         }
 
         // Allocate the buffer
-        byte block[] = new byte[256 + 3];
+        byte[] block = new byte[256 + 3];
 
         // Read the image descriptor
         if (readBytes(block, 0, 10) != 0) {
             throw new IOException();
         }

@@ -555,11 +555,11 @@
              * fill the gap with transparent pixels.
              */
             if ((height < global_height) && (model != null)) {
                 byte tpix = (byte)model.getTransparentPixel();
                 if (tpix >= 0) {
-                    byte trans_rasline[] = new byte[global_width];
+                    byte[] trans_rasline = new byte[global_width];
                     for (int i=0; i<global_width;i++) {
                         trans_rasline[i] = tpix;
                     }
 
                     setPixels(0, 0, global_width, y,

@@ -577,11 +577,11 @@
         curframe = new GifFrame(this, disposal_method, delay,
                                 (curframe == null), model,
                                 x, y, width, height);
 
         // allocate the raster data
-        byte rasline[] = new byte[width];
+        byte[] rasline = new byte[width];
 
         if (verbose) {
             System.out.print("Reading a " + width + " by " + height + " " +
                       (interlace ? "" : "non-") + "interlaced image...");
         }
< prev index next >