Merge
authorprr
Fri, 23 Mar 2018 11:14:43 -0700
changeset 49316 73da889306b7
parent 49315 2d4964bc055d (diff)
parent 49313 49e0f711bb2b (current diff)
child 49412 2c3b9dbba7bc
child 49495 f46bfa7a2956
child 56346 514c68575523
Merge
make/mapfiles/libjsoundalsa/mapfile-vers
src/java.base/linux/classes/sun/nio/ch/EPollArrayWrapper.java
src/java.base/linux/native/libnio/ch/EPollArrayWrapper.c
src/java.base/linux/native/libnio/ch/EPollPort.c
src/java.base/macosx/classes/sun/nio/ch/KQueueArrayWrapper.java
src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c
src/java.base/macosx/native/libnio/ch/KQueuePort.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_CommonUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_CommonUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_MidiIn.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_MidiOut.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_MidiUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_MidiUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_PCM.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_PCMUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_PCMUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_BsdOS_ALSA_Ports.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiIn.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiOut.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_PCM.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.h
src/java.desktop/unix/native/libjsound/PLATFORM_API_LinuxOS_ALSA_Ports.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_SolarisOS_PCM.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_SolarisOS_Ports.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_SolarisOS_Utils.c
src/java.desktop/unix/native/libjsound/PLATFORM_API_SolarisOS_Utils.h
test/jdk/java/nio/channels/DatagramChannel/SendToUnresolved.java
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPConstants.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPConstants.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -30,6 +30,7 @@
     static final String VERSION_2 = "BMP v. 2.x";
     static final String VERSION_3 = "BMP v. 3.x";
     static final String VERSION_3_NT = "BMP v. 3.x NT";
+    static final String VERSION_3_EXT = "BMP V2/V3 INFO";
     static final String VERSION_4 = "BMP v. 4.x";
     static final String VERSION_5 = "BMP v. 5.x";
 
@@ -48,3 +49,4 @@
     static final int BI_JPEG = 4;
     static final int BI_PNG = 5;
 }
+
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -78,6 +78,8 @@
  *
  *  This class supports Microsoft Windows Bitmap Version 3-5,
  *  as well as OS/2 Bitmap Version 2.x (for single-image BMP file).
+ *  It also supports undocumented DIB header of type BITMAPV2INFOHEADER
+ *  & BITMAPV3INFOHEADER.
  */
 public class BMPImageReader extends ImageReader implements BMPConstants {
     // BMP Image types
@@ -94,16 +96,25 @@
     private static final int VERSION_3_NT_16_BIT = 8;
     private static final int VERSION_3_NT_32_BIT = 9;
 
-    private static final int VERSION_4_1_BIT = 10;
-    private static final int VERSION_4_4_BIT = 11;
-    private static final int VERSION_4_8_BIT = 12;
-    private static final int VERSION_4_16_BIT = 13;
-    private static final int VERSION_4_24_BIT = 14;
-    private static final int VERSION_4_32_BIT = 15;
+    // All VERSION_3_EXT_* are for BITMAPV2INFOHEADER & BITMAPV3INFOHEADER
+    private static final int VERSION_3_EXT_1_BIT = 10;
+    private static final int VERSION_3_EXT_4_BIT = 11;
+    private static final int VERSION_3_EXT_8_BIT = 12;
+    private static final int VERSION_3_EXT_16_BIT = 13;
+    private static final int VERSION_3_EXT_24_BIT = 14;
+    private static final int VERSION_3_EXT_32_BIT = 15;
 
-    private static final int VERSION_3_XP_EMBEDDED = 16;
-    private static final int VERSION_4_XP_EMBEDDED = 17;
-    private static final int VERSION_5_XP_EMBEDDED = 18;
+    private static final int VERSION_4_1_BIT = 16;
+    private static final int VERSION_4_4_BIT = 17;
+    private static final int VERSION_4_8_BIT = 18;
+    private static final int VERSION_4_16_BIT = 19;
+    private static final int VERSION_4_24_BIT = 20;
+    private static final int VERSION_4_32_BIT = 21;
+
+    private static final int VERSION_3_XP_EMBEDDED = 22;
+    private static final int VERSION_3_EXT_EMBEDDED = 23;
+    private static final int VERSION_4_XP_EMBEDDED = 24;
+    private static final int VERSION_5_XP_EMBEDDED = 25;
 
     // BMP variables
     private long bitmapFileSize;
@@ -409,6 +420,63 @@
                     throw new
                         IIOException(I18N.getString("BMPImageReader2"));
                 }
+            } else if (size == 52 || size == 56) {
+                // BITMAPV2INFOHEADER or BITMAPV3INFOHEADER
+                redMask = (int)iis.readUnsignedInt();
+                greenMask = (int)iis.readUnsignedInt();
+                blueMask = (int)iis.readUnsignedInt();
+                if (size == 56) {
+                    alphaMask = (int)iis.readUnsignedInt();
+                }
+
+                metadata.bmpVersion = VERSION_3_EXT;
+                // Read in the palette
+                int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
+                int sizeOfPalette = numberOfEntries*4;
+                palette = new byte[sizeOfPalette];
+                iis.readFully(palette, 0, sizeOfPalette);
+                metadata.palette = palette;
+                metadata.paletteSize = numberOfEntries;
+
+                switch((int)compression) {
+
+                    case BI_JPEG:
+                    case BI_PNG:
+                        imageType = VERSION_3_EXT_EMBEDDED;
+                        break;
+                    default:
+                        if (bitsPerPixel == 1) {
+                            imageType = VERSION_3_EXT_1_BIT;
+                        } else if (bitsPerPixel == 4) {
+                            imageType = VERSION_3_EXT_4_BIT;
+                        } else if (bitsPerPixel == 8) {
+                            imageType = VERSION_3_EXT_8_BIT;
+                        } else if (bitsPerPixel == 16) {
+                            imageType = VERSION_3_EXT_16_BIT;
+                            if ((int)compression == BI_RGB) {
+                                redMask = 0x7C00;
+                                greenMask = 0x3E0;
+                                blueMask = 0x1F;
+                            }
+                        } else if (bitsPerPixel == 24) {
+                            imageType = VERSION_3_EXT_24_BIT;
+                        } else if (bitsPerPixel == 32) {
+                            imageType = VERSION_3_EXT_32_BIT;
+                            if ((int)compression == BI_RGB) {
+                                redMask   = 0x00FF0000;
+                                greenMask = 0x0000FF00;
+                                blueMask  = 0x000000FF;
+                            }
+                        } else {
+                            throw new
+                            IIOException(I18N.getString("BMPImageReader8"));
+                        }
+
+                        metadata.redMask = redMask;
+                        metadata.greenMask = greenMask;
+                        metadata.blueMask = blueMask;
+                        metadata.alphaMask = alphaMask;
+                }
             } else if (size == 108 || size == 124) {
                 // Windows 4.x BMP
                 if (size == 108)
@@ -908,15 +976,18 @@
             break;
 
         case VERSION_3_XP_EMBEDDED:
+        case VERSION_3_EXT_EMBEDDED:
         case VERSION_4_XP_EMBEDDED:
         case VERSION_5_XP_EMBEDDED:
             bi = readEmbedded((int)compression, bi, param);
             break;
 
+        case VERSION_3_EXT_1_BIT:
         case VERSION_4_1_BIT:
             read1Bit(bdata);
             break;
 
+        case VERSION_3_EXT_4_BIT:
         case VERSION_4_4_BIT:
             switch((int)compression) {
 
@@ -934,6 +1005,7 @@
             }
             break;
 
+        case VERSION_3_EXT_8_BIT:
         case VERSION_4_8_BIT:
             switch((int)compression) {
 
@@ -951,14 +1023,17 @@
             }
             break;
 
+        case VERSION_3_EXT_16_BIT:
         case VERSION_4_16_BIT:
             read16Bit(sdata);
             break;
 
+        case VERSION_3_EXT_24_BIT:
         case VERSION_4_24_BIT:
             read24Bit(bdata);
             break;
 
+        case VERSION_3_EXT_32_BIT:
         case VERSION_4_32_BIT:
             read32Bit(idata);
             break;
@@ -2000,3 +2075,4 @@
         }
     }
 }
+
--- a/src/java.desktop/share/classes/javax/sound/midi/package-info.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/javax/sound/midi/package-info.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,12 @@
  *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
  *   The Java Sound Tutorial</a>
  * </ul>
+ * Please note: In the {@code javax.sound.midi} APIs, a {@code null} reference
+ * parameter to methods is incorrect unless explicitly documented on the method
+ * as having a meaningful interpretation. Usage to the contrary is incorrect
+ * coding and may result in a run time exception either immediately or at some
+ * later time. {@code NullPointerException} is an example of typical and
+ * acceptable run time exception for such cases.
  *
  * @since 1.3
  */
--- a/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,12 @@
  *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
  *   The Java Sound Tutorial</a>
  * </ul>
+ * Please note: In the {@code javax.sound.midi.spi} APIs, a {@code null}
+ * reference parameter to methods is incorrect unless explicitly documented on
+ * the method as having a meaningful interpretation. Usage to the contrary is
+ * incorrect coding and may result in a run time exception either immediately or
+ * at some later time. {@code NullPointerException} is an example of typical and
+ * acceptable run time exception for such cases.
  *
  * @since 1.3
  */
--- a/src/java.desktop/share/classes/javax/sound/sampled/package-info.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/javax/sound/sampled/package-info.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,12 @@
  *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
  *   The Java Sound Tutorial</a>
  * </ul>
+ * Please note: In the {@code javax.sound.sampled} APIs, a {@code null}
+ * reference parameter to methods is incorrect unless explicitly documented on
+ * the method as having a meaningful interpretation. Usage to the contrary is
+ * incorrect coding and may result in a run time exception either immediately or
+ * at some later time. {@code NullPointerException} is an example of typical and
+ * acceptable run time exception for such cases.
  *
  * @since 1.3
  */
--- a/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java	Fri Mar 23 10:09:45 2018 -0700
+++ b/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java	Fri Mar 23 11:14:43 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -33,6 +33,12 @@
  *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
  *   The Java Sound Tutorial</a>
  * </ul>
+ * Please note: In the {@code javax.sound.sampled.spi} APIs, a {@code null}
+ * reference parameter to methods is incorrect unless explicitly documented on
+ * the method as having a meaningful interpretation. Usage to the contrary is
+ * incorrect coding and may result in a run time exception either immediately or
+ * at some later time. {@code NullPointerException} is an example of typical and
+ * acceptable run time exception for such cases.
  *
  * @since 1.3
  */
Binary file test/jdk/javax/imageio/plugins/bmp/DIB_size-56_ARGB_16bits.bmp has changed
Binary file test/jdk/javax/imageio/plugins/bmp/DIB_size-56_RGB_16bits.bmp has changed
Binary file test/jdk/javax/imageio/plugins/bmp/DIB_size-56_XRGB_32bits.bmp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/imageio/plugins/bmp/ReadBITMAPV3INFOHEADERTest.java	Fri Mar 23 11:14:43 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     7031957
+ * @summary Test verifies whether BMPImageReader is capable of reading
+ *          images with DIB header type BITMAPV3INFOHEADER.
+ * @run     main ReadBITMAPV3INFOHEADERTest
+ */
+
+import javax.imageio.ImageIO;
+import java.io.File;
+import java.io.IOException;
+
+public class ReadBITMAPV3INFOHEADERTest {
+    public static void main(String[] args) throws IOException {
+        String dir = System.getProperty("test.src");
+        String sep = System.getProperty("file.separator");
+        /*
+         * Try reading BITMAPV3INFOHEADER type BMP images and check whether
+         * read fails. If read fails we throw Exception.
+         */
+        ImageIO.read(new File(dir + sep + "DIB_size-56_ARGB_16bits.bmp"));
+        ImageIO.read(new File(dir + sep + "DIB_size-56_RGB_16bits.bmp"));
+        ImageIO.read(new File(dir + sep + "DIB_size-56_XRGB_32bits.bmp"));
+    }
+}
+