summaryrefslogtreecommitdiff
path: root/java/openjdk7/files/patch-7u80-b32
diff options
context:
space:
mode:
Diffstat (limited to 'java/openjdk7/files/patch-7u80-b32')
-rw-r--r--java/openjdk7/files/patch-7u80-b32109450
1 files changed, 109450 insertions, 0 deletions
diff --git a/java/openjdk7/files/patch-7u80-b32 b/java/openjdk7/files/patch-7u80-b32
new file mode 100644
index 000000000000..7820ee0f54d4
--- /dev/null
+++ b/java/openjdk7/files/patch-7u80-b32
@@ -0,0 +1,109450 @@
+--- ./.hgtags Mon Jan 05 11:48:37 2015 -0800
++++ ./.hgtags Fri Apr 10 09:18:39 2015 -0700
+@@ -525,6 +525,10 @@
+ fa606411d8fd650334b6f90d626399e13e77740f jdk7u72-b14
+ f42462b4dfd81539eacf90955d2d26e1dc1686c0 jdk7u72-b30
+ 891bb800d7b2abff392669276f9e55ff30ba9962 jdk7u72-b31
++cc4b22b0bc1810d6bb1367f08c47707923a89b0e jdk7u72-b32
++9179bba54a0d43be8a5325152acd29ac2852c4d5 jdk7u72-b33
++8c92ab4f302fea71b378a0eb8912d2321acdae68 jdk7u72-b34
++8d5af53bb3926fac6aa21e2f02a8df7c6718c5c2 jdk7u72-b35
+ 569e053e97b4fecaf1371f7cf2645394edb8a11a jdk7u75-b00
+ 618b221a71a962f1d62a5b02db1b4256bad9441a jdk7u75-b01
+ eb36016211cb5d412c779836bd8efbf133cbf6f5 jdk7u75-b02
+@@ -556,3 +560,37 @@
+ 01d1d34f82f30de97a61f8b0048c61aa17d0dd12 jdk7u76-b12
+ a9728fbea214dbf6f58567e729fdc5276f3c704f jdk7u76-b13
+ a788e9c5671436bb711f0e185cd74b17220d6e35 jdk7u76-b30
++ed58c355d118cb3d9713de41ecb105cca3175472 jdk7u76-b31
++79a5a54289ef52fc67d5447bacc60610282b1e3c jdk7u76-b32
++dcc07fe8d380a63c22086abeb62a5a9780b3639c jdk7u79-b00
++9d7b2508882acda9da48a0f52490e1b31111fcd6 jdk7u79-b01
++fc70c5c1a1c0cfd7fd11237a5a7fcce6a1cd2cd8 jdk7u79-b02
++6842b297466cf696cca4ac6f776183bd74e8f52f jdk7u79-b03
++7d851d1726c67146e491575e905aaa3f1eb90083 jdk7u79-b06
++9e76c64141e8b65d64d0defbe12094d6c9eb8f03 jdk7u79-b07
++52a09e691b39ab0f23ca0830fbb2a372e157990c jdk7u79-b08
++5127e5f6909283ade8de12d0a912b82383cd0084 jdk7u79-b09
++83f6693e12e6265e914ad07b5fe137ab01c2dbbf jdk7u79-b10
++be4cf73f2c91c252c84fb1799e68585027eab3b0 jdk7u79-b11
++fae704111ce1257c66c80e1221cf89522fd2d52e jdk7u79-b12
++434885f8214fd2671ea6b4708663fc9a14505872 jdk7u79-b13
++4dc3a33c7c9d3a88ee566554ffd8253b777aa6a4 jdk7u79-b14
++ee3b3ebecd737ff98883e4f15471887dfdfa8dce jdk7u79-b30
++127bfeeddc9cf2f8cbf58052f32f6c8676fb8840 jdk7u79-b15
++d4397128f8b65eb96287128575dd1a3da6a7825b jdk7u80-b00
++90564f0970e92b844122be27f051655aef6dc423 jdk7u80-b01
++36e8397bf04d972519b80ca9e24e68a2ed1e4dbd jdk7u80-b02
++4093bbbc90009bfd9311ccd6373c7a2f2755c9d9 jdk7u80-b03
++928d01695cd2b65119bbfcd51032ae427a66f83d jdk7u80-b04
++46d516760a680deaeffdb03e3221648bc14c0818 jdk7u80-b05
++8fffdc2d1faaf2c61abff00ee41f50d28da2174a jdk7u80-b06
++6d0aaea852b04d7270fde5c289827b00f2391374 jdk7u80-b07
++e8daab5fb25eb513c53d6d766d50caf662131d79 jdk7u80-b08
++8c0f70ebdfbd5b06c759ab762b093e8c3ee6558e jdk7u80-b09
++67dafced5999152f5f88ace0a84122909049182c jdk7u80-b10
++7a31b13266333dbc62825b827fb5730417d7212c jdk7u80-b11
++96d3f807999b5c2d8b07ebf0b79fdbc1952d1109 jdk7u80-b12
++5bd350f497873137786dc6ff5abcae1207bcc30b jdk7u80-b13
++4da82068f37e17858d318d24a5a6284d48627e68 jdk7u80-b14
++611f7d38d9346243b558dc78409b813241eb426f jdk7u80-b30
++f19659de2034611095d307ccc68f777abc8b008e jdk7u80-b15
+--- ./THIRD_PARTY_README Mon Jan 05 11:48:37 2015 -0800
++++ ./THIRD_PARTY_README Fri Apr 10 09:18:39 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./make/jprt.properties Mon Jan 05 11:48:37 2015 -0800
++++ ./make/jprt.properties Fri Apr 10 09:18:39 2015 -0700
+@@ -83,6 +83,7 @@
+ ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
++ ${jprt.my.test.target.set:TESTNAME=jdk_security4}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_management}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \
+--- ./test/Makefile Mon Jan 05 11:48:37 2015 -0800
++++ ./test/Makefile Fri Apr 10 09:18:39 2015 -0700
+@@ -63,7 +63,7 @@
+ jdk_other \
+ jdk_net \
+ jdk_nio \
+- jdk_security1 jdk_security2 jdk_security3 \
++ jdk_security1 jdk_security2 jdk_security3 jdk_security4 \
+ jdk_sound \
+ jdk_text \
+ jdk_tools \
+--- ./corba/.hgtags Mon Jan 05 11:49:17 2015 -0800
++++ ./corba/.hgtags Fri Apr 10 09:18:50 2015 -0700
+@@ -527,6 +527,10 @@
+ bd80d0c18ccd97669dd8392dbde5cd91f647ee1d jdk7u72-b14
+ 66da7f46eff05df2aa3bb9b5c1f7ee47a75828a5 jdk7u72-b30
+ 4fefe5c11ddb650e681e2dd5e8ac8dfeb15e6afd jdk7u72-b31
++c8d42c36b2ab3db65bcd7497ca87e3b2c191f3f7 jdk7u72-b32
++a3070ed2ab6aa1542e5e545e9e19684dcd056945 jdk7u72-b33
++5d1445139b101e045fd389578df8825d5b2d0dad jdk7u72-b34
++acc110e88fc38ed6118ed1fe44a3211f5b4a6337 jdk7u72-b35
+ 88772da384953fed254492c3ea9da498381081f2 jdk7u75-b00
+ 0466441d71122c9af252ec17f597f228dbf64578 jdk7u75-b01
+ 9aa7fe309fa584ff782ab9d557632321747ba11e jdk7u75-b02
+@@ -558,3 +562,37 @@
+ 14f0846f4d1b8373e3e3cce10901f37341bf6980 jdk7u76-b12
+ 0db41b697138ce89f15c49eef1dc670f94a27d89 jdk7u76-b13
+ 71a8665159f2f014b1869f3d723d3b6fbe878a16 jdk7u76-b30
++7a566e2b22722a59174c7cced744bdda3709ce2e jdk7u76-b31
++dbbdf5e8b66e6fccd36977016d38683346c5d107 jdk7u76-b32
++f55967c261230a4fcc8d71ecfe58f2f47ea50393 jdk7u79-b00
++d2a032b5389366fdff24b8a5ba52931da14d2a8d jdk7u79-b01
++0a8522745129e647c3b1fe9ef7b5f7d84e063938 jdk7u79-b02
++df1f9eb105ed2b05c0d15b08abded72e8e4a76c5 jdk7u79-b03
++f2c5c65d2d7f2153370429ebc8dfded9f9ada43e jdk7u79-b06
++3f5ddba1c4f1f5268d2419360c9b83f303166f4f jdk7u79-b07
++65366f746473f25f9ccda87e5c77f04247050a86 jdk7u79-b08
++58c0e28636cd1b3e947e71a40693f57f65a48ba4 jdk7u79-b09
++b36cf254eef39119d817eef3344b98c5a79c30b8 jdk7u79-b10
++0ebb0413e7d9f8352bdb92552f5fc1056049c9dd jdk7u79-b11
++2ae2ecbcdd17641b8eb4d97fa2324ef41a2fddb7 jdk7u79-b12
++ec5c1e656d0383c697c7a3a7f3c6839d225ea649 jdk7u79-b13
++4262b390c9460e6dbeb6968a60ac6356452d47a9 jdk7u79-b14
++89b8b9610d476843e696cdad5d8d238f83e00c94 jdk7u79-b30
++59faa52493939dccdf6ff9efe86371101769b8f9 jdk7u79-b15
++1a3aa4637b80fabbd069ae88c241efcb3520fc49 jdk7u80-b00
++df1decc820934ad8bf91c853e81c88d4f7590e25 jdk7u80-b01
++2444fa7df7e3e07f2533f6c875c3a8e408048f6c jdk7u80-b02
++fc6a39d6be24e0c1f7d9193e4f3ea4e474bb4dc3 jdk7u80-b03
++d9ddd2aec6bee31e3bd8bb4eb258c27a624162c3 jdk7u80-b04
++6696348644df30f1807acd3a38a603ebdf09480c jdk7u80-b05
++4362d8c11c43fb414a75b03616252cf8007eea61 jdk7u80-b06
++1191862bb140612cc458492a0ffac5969f48c4df jdk7u80-b07
++6a12979724faeb9abe3e6af347c64f173713e8a4 jdk7u80-b08
++f09d8e79d1e970a583677987f2baa2a030903441 jdk7u80-b09
++d4abe9013712af965bc7284efaa7f8d3cc90dde8 jdk7u80-b10
++7c5957c3d8d6d5c2e9562267bf2db68dec775fb1 jdk7u80-b11
++fa884531a1a32d78fb6b4e5253dae275eaaddd2c jdk7u80-b12
++8e4a2983e0d085331c7281d90f23c43bfdab5ed4 jdk7u80-b13
++90e140a093262c0ca0b408a5997074fbd87639c0 jdk7u80-b14
++52b7bbe24e490090f98bee27dbd5ec5715b31243 jdk7u80-b30
++353be4a0a6ec19350d18e0e9ded5544ed5d7433f jdk7u80-b15
+--- ./corba/THIRD_PARTY_README Mon Jan 05 11:49:17 2015 -0800
++++ ./corba/THIRD_PARTY_README Fri Apr 10 09:18:50 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./hotspot/.hgtags Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/.hgtags Fri Apr 10 09:19:25 2015 -0700
+@@ -752,6 +752,10 @@
+ d9b56c6bdddb6f9d8242230f5fdd58f9c7d30ea5 jdk7u72-b14
+ a6ae698522bfab3c595a4f8c2c3ee7e8939eb1bb jdk7u72-b30
+ 492a2abed4ca015459e24f7348233531b7e929d2 jdk7u72-b31
++61dacdb82145abe6cb5911e5a06fd8d8622fb55f jdk7u72-b32
++64cbcac4027843d0292f262520a8945161cc1657 jdk7u72-b33
++bcb9613e07e212f3103a3bcc5e5085b4d69ad5e1 jdk7u72-b34
++f9c89a617dac063054749d1880807f6700f04c8a jdk7u72-b35
+ e6b6d91b3934c281086f8efacb0926e7451cc18b jdk7u75-b00
+ 9096ac248b379a0f3012f18c7289ec47cdef8459 jdk7u75-b01
+ a6964b2822d906eab9c923cdd723cf3dd4facfcd jdk7u75-b02
+@@ -783,3 +787,44 @@
+ e375023d196199ffb263cb15739f7218e1621be6 jdk7u76-b12
+ a395c29532e5322657c542d54dd957940cf2f523 jdk7u76-b13
+ 98f0c5279ba76eb1b5741dc67f7b5f10e7508449 jdk7u76-b30
++875d0ccc97fe7a46a0a9996e897827022db58200 jdk7u76-b31
++dfc50bbce42cff3d17d4d8780646dedac8d3dad0 jdk7u76-b32
++2480d9d778301a3f88b0ab8ee35a585df82528e5 jdk7u79-b00
++ae6723b35de91e3e964cc92d832e17743e4f43c6 jdk7u79-b01
++653c92d16c45392cd7a5073528c8b8396c1f087c jdk7u79-b02
++e6d47ed41881381a212faf9e394011cf10d76509 jdk7u79-b03
++c5486f8bb2dbc5ab176235adc999d31ad5f413fb jdk7u79-b06
++5439057a4c7fd26de2fe129eb5d695dda7f42dcf jdk7u79-b07
++e65e02cf3523bf5c5ea4df6d17a7b60b456c53b5 jdk7u79-b08
++641e2adae9d455ef8a41b319e86c4ed8148735b9 jdk7u79-b09
++e5512513c35ccd3f3552039b0cf6352cce0af9f2 jdk7u79-b10
++5cef060f38caed08ea20a08d40735a5395d3f73e jdk7u79-b11
++8f34a2992faa8a2592fc15a5309340635a423fd5 jdk7u79-b12
++08c8504cd6ce900078d2187ca8f0545328872cba jdk7u79-b13
++30e5853fcd717f6284b916b2c8fe388408e055f0 jdk7u79-b14
++4d4936bc95f47c3b6591b163ae06e4952ef66344 jdk7u79-b30
++78dcbf58e349beaafeed97f7e897832d28a3403f jdk7u79-b15
++b92f390febd01615af4a736b4f830f6052aa1d09 hs24.80-b00
++1448ebfef4f1aae0174eca983ad05507730ca6fd hs24.80-b01
++b1d29549dca7e36a4d050af5a54f8f56963a5c7d hs24.80-b02
++ff18bcebe2943527cdbc094375c38c27ec7f2442 hs24.80-b03
++1b9722b5134a8e565d8b8fe851849e034beff057 hs24.80-b04
++04d6919c44db8c9d811ef0ac4775a579f854cdfc hs24.80-b05
++ee18e60e7e8da9f1912895af353564de0330a2b1 hs24.80-b06
++05fe7a87d14908eb3f21a0d29fc72cee2f996b7f jdk7u80-b00
++e2533d62ca887078e4b952a75a75680cfb7894b9 jdk7u80-b01
++bad107a5d096b070355c5a2d80aa50bc5576144b jdk7u80-b02
++9d2b485d2a58ea57ab2b3c06b2128f456ab39a38 jdk7u80-b03
++a89267b51c40cba0b26fe84831478389723c8321 jdk7u80-b04
++00402b4ff7a90a6deba09816192e335cadfdb4f0 jdk7u80-b05
++87d4354a3ce8aafccf1f1cd9cb9d88a58731dde8 jdk7u80-b06
++d496bd71dc129828c2b5962e2072cdb591454e4a jdk7u80-b07
++5ce33a4444cf74e04c22fb11b1e1b76b68a6477a jdk7u80-b08
++48af02f3c56ceefc4a1b16a4bdb6d54e416b2171 jdk7u80-b09
++502c24b2ffaed2e2a209c7d84bb53a98c062e5ef jdk7u80-b10
++c59862e92fb3f919da426efa01b4c699ce122517 jdk7u80-b11
++a0572b740d79d089de854e498f57a55c9a59c9ad jdk7u80-b12
++a550ec1c311fe9c3393597cae620b02fa9e1dfa1 jdk7u80-b13
++c63aa8d5e8ab6e86df1f5d54bcf7a54ec325667c jdk7u80-b14
++27e0103f3b11f06bc3277914564ed9a1976fb3d5 jdk7u80-b30
++426e09df7eda980317d1308af15c29ef691cd471 jdk7u80-b15
+--- ./hotspot/THIRD_PARTY_README Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/THIRD_PARTY_README Fri Apr 10 09:19:25 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./hotspot/make/hotspot_version Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/make/hotspot_version Fri Apr 10 09:19:25 2015 -0700
+@@ -34,8 +34,8 @@
+ HOTSPOT_VM_COPYRIGHT=Copyright 2015
+
+ HS_MAJOR_VER=24
+-HS_MINOR_VER=76
+-HS_BUILD_NUMBER=04
++HS_MINOR_VER=80
++HS_BUILD_NUMBER=11
+
+ JDK_MAJOR_VER=1
+ JDK_MINOR_VER=7
+--- ./hotspot/make/jprt.properties Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/make/jprt.properties Fri Apr 10 09:19:25 2015 -0700
+@@ -38,7 +38,7 @@
+
+ # This tells jprt what default release we want to build
+
+-jprt.hotspot.default.release=jdk7u60
++jprt.hotspot.default.release=jdk7u72
+
+ jprt.tools.default.release=${jprt.submit.option.release?${jprt.submit.option.release}:${jprt.hotspot.default.release}}
+
+@@ -54,92 +54,94 @@
+ # Define the Solaris platforms we want for the various releases
+ jprt.my.solaris.sparc.jdk8=solaris_sparc_5.10
+ jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
+-jprt.my.solaris.sparc.jdk7u60=${jprt.my.solaris.sparc.jdk7}
++jprt.my.solaris.sparc.jdk7u72=${jprt.my.solaris.sparc.jdk7}
+ jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
+
+ jprt.my.solaris.sparcv9.jdk8=solaris_sparcv9_5.10
+ jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
+-jprt.my.solaris.sparcv9.jdk7u60=${jprt.my.solaris.sparcv9.jdk7}
++jprt.my.solaris.sparcv9.jdk7u72=${jprt.my.solaris.sparcv9.jdk7}
+ jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
+
+ jprt.my.solaris.i586.jdk8=solaris_i586_5.10
+ jprt.my.solaris.i586.jdk7=solaris_i586_5.10
+-jprt.my.solaris.i586.jdk7u60=${jprt.my.solaris.i586.jdk7}
++jprt.my.solaris.i586.jdk7u72=${jprt.my.solaris.i586.jdk7}
+ jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
+
+ jprt.my.solaris.x64.jdk8=solaris_x64_5.10
+ jprt.my.solaris.x64.jdk7=solaris_x64_5.10
+-jprt.my.solaris.x64.jdk7u60=${jprt.my.solaris.x64.jdk7}
++jprt.my.solaris.x64.jdk7u72=${jprt.my.solaris.x64.jdk7}
+ jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
+
+ jprt.my.linux.i586.jdk8=linux_i586_2.6
+ jprt.my.linux.i586.jdk7=linux_i586_2.6
+-jprt.my.linux.i586.jdk7u60=${jprt.my.linux.i586.jdk7}
++jprt.my.linux.i586.jdk7u72=${jprt.my.linux.i586.jdk7}
+ jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
+
+ jprt.my.linux.x64.jdk8=linux_x64_2.6
+ jprt.my.linux.x64.jdk7=linux_x64_2.6
+-jprt.my.linux.x64.jdk7u60=${jprt.my.linux.x64.jdk7}
++jprt.my.linux.x64.jdk7u72=${jprt.my.linux.x64.jdk7}
+ jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
+
+ jprt.my.linux.ppc.jdk8=linux_ppc_2.6
+ jprt.my.linux.ppc.jdk7=linux_ppc_2.6
+-jprt.my.linux.ppc.jdk7u60=${jprt.my.linux.ppc.jdk7}
++jprt.my.linux.ppc.jdk7u72=${jprt.my.linux.ppc.jdk7}
+ jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
+
+ jprt.my.linux.ppcv2.jdk8=linux_ppcv2_2.6
+ jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
+-jprt.my.linux.ppcv2.jdk7u60=${jprt.my.linux.ppcv2.jdk7}
++jprt.my.linux.ppcv2.jdk7u72=${jprt.my.linux.ppcv2.jdk7}
+ jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
+
+ jprt.my.linux.armvfp.jdk8=linux_armvfp_2.6
+ jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
+-jprt.my.linux.armvfp.jdk7u60=${jprt.my.linux.armvfp.jdk7}
++jprt.my.linux.armvfp.jdk7u72=${jprt.my.linux.armvfp.jdk7}
+ jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
+
+ jprt.my.linux.armvfpsflt.jdk8=linux_armvfpsflt_2.6
+ jprt.my.linux.armvfpsflt.jdk7=linux_armvfpsflt_2.6
+-jprt.my.linux.armvfpsflt.jdk7u60=${jprt.my.linux.armvfpsflt.jdk7}
++jprt.my.linux.armvfpsflt.jdk7u72=${jprt.my.linux.armvfpsflt.jdk7}
+ jprt.my.linux.armvfpsflt=${jprt.my.linux.armvfpsflt.${jprt.tools.default.release}}
+
+ jprt.my.linux.armvfphflt.jdk8=linux_armvfphflt_2.6
+ jprt.my.linux.armvfphflt.jdk7=linux_armvfphflt_2.6
+-jprt.my.linux.armvfphflt.jdk7u60=${jprt.my.linux.armvfphflt.jdk7}
++jprt.my.linux.armvfphflt.jdk7u72=${jprt.my.linux.armvfphflt.jdk7}
+ jprt.my.linux.armvfphflt=${jprt.my.linux.armvfphflt.${jprt.tools.default.release}}
+
+ jprt.my.linux.armv6.jdk8=linux_armv6_2.6
+ jprt.my.linux.armv6.jdk7=linux_armv6_2.6
+-jprt.my.linux.armv6.jdk7u60=${jprt.my.linux.armv6.jdk7}
++jprt.my.linux.armv6.jdk7u72=${jprt.my.linux.armv6.jdk7}
+ jprt.my.linux.armv6=${jprt.my.linux.armv6.${jprt.tools.default.release}}
+
+ jprt.my.linux.armvs.jdk8=linux_armvs_2.6
+ jprt.my.linux.armvs.jdk7=linux_armvs_2.6
+-jprt.my.linux.armvs.jdk7u60=${jprt.my.linux.armvs.jdk7}
++jprt.my.linux.armvs.jdk7u72=${jprt.my.linux.armvs.jdk7}
+ jprt.my.linux.armvs=${jprt.my.linux.armvs.${jprt.tools.default.release}}
+
+ jprt.my.linux.armvh.jdk8=linux_armvh_2.6
+ jprt.my.linux.armvh.jdk7=linux_armvh_2.6
+-jprt.my.linux.armvh.jdk7u60=${jprt.my.linux.armvh.jdk7}
++jprt.my.linux.armvh.jdk7u72=${jprt.my.linux.armvh.jdk7}
+ jprt.my.linux.armvh=${jprt.my.linux.armvh.${jprt.tools.default.release}}
+
+ jprt.my.linux.armsflt.jdk8=linux_armsflt_2.6
+ jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
+-jprt.my.linux.armsflt.jdk7u60=${jprt.my.linux.armsflt.jdk7}
++jprt.my.linux.armsflt.jdk7u72=${jprt.my.linux.armsflt.jdk7}
+ jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
+
++jprt.my.linux.sparcv9=linux_sparcv9_3.8
++
+ jprt.my.macosx.x64.jdk8=macosx_x64_10.7
+ jprt.my.macosx.x64.jdk7=macosx_x64_10.7
+-jprt.my.macosx.x64.jdk7u60=${jprt.my.macosx.x64.jdk7}
++jprt.my.macosx.x64.jdk7u72=${jprt.my.macosx.x64.jdk7}
+ jprt.my.macosx.x64=${jprt.my.macosx.x64.${jprt.tools.default.release}}
+
+ jprt.my.windows.i586.jdk8=windows_i586_5.1
+ jprt.my.windows.i586.jdk7=windows_i586_5.1
+-jprt.my.windows.i586.jdk7u60=${jprt.my.windows.i586.jdk7}
++jprt.my.windows.i586.jdk7u72=${jprt.my.windows.i586.jdk7}
+ jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
+
+ jprt.my.windows.x64.jdk8=windows_x64_5.2
+ jprt.my.windows.x64.jdk7=windows_x64_5.2
+-jprt.my.windows.x64.jdk7u60=${jprt.my.windows.x64.jdk7}
++jprt.my.windows.x64.jdk7u72=${jprt.my.windows.x64.jdk7}
+ jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
+
+ # Standard list of jprt build targets for this source tree
+@@ -151,6 +153,7 @@
+ ${jprt.my.solaris.x64}-{product|fastdebug|debug}, \
+ ${jprt.my.linux.i586}-{product|fastdebug|debug}, \
+ ${jprt.my.linux.x64}-{product|fastdebug}, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}, \
+ ${jprt.my.macosx.x64}-{product|fastdebug|debug}, \
+ ${jprt.my.windows.i586}-{product|fastdebug|debug}, \
+ ${jprt.my.windows.x64}-{product|fastdebug|debug}, \
+@@ -177,7 +180,7 @@
+
+ jprt.build.targets.jdk8=${jprt.build.targets.all}
+ jprt.build.targets.jdk7=${jprt.build.targets.all}
+-jprt.build.targets.jdk7u60=${jprt.build.targets.all}
++jprt.build.targets.jdk7u72=${jprt.build.targets.all}
+ jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}}
+
+ # Subset lists of test targets for this source tree
+@@ -352,6 +355,30 @@
+ ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_G1, \
+ ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_ParOldGC
+
++jprt.my.linux.sparcv9.test.targets = \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jvm98, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jvm98_nontiered, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-scimark, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_default, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_SerialGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_CMS, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_G1, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCBasher_ParOldGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_default, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_SerialGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParallelGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParNewGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_CMS, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_G1, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-GCOld_ParOldGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_default, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_default_nontiered, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_ParallelGC, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_G1, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-jbb_ParOldGC
++
+ jprt.my.macosx.x64.test.targets = \
+ ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jvm98, \
+ ${jprt.my.macosx.x64}-{product|fastdebug}-c2-jvm98_nontiered, \
+@@ -452,6 +479,7 @@
+ ${jprt.my.solaris.x64.test.targets}, \
+ ${jprt.my.linux.i586.test.targets}, \
+ ${jprt.my.linux.x64.test.targets}, \
++ ${jprt.my.linux.sparcv9.test.targets}, \
+ ${jprt.my.macosx.x64.test.targets}, \
+ ${jprt.my.windows.i586.test.targets}, \
+ ${jprt.my.windows.x64.test.targets}, \
+@@ -470,7 +498,7 @@
+
+ jprt.test.targets.jdk8=${jprt.test.targets.standard}
+ jprt.test.targets.jdk7=${jprt.test.targets.standard}
+-jprt.test.targets.jdk7u60=${jprt.test.targets.jdk7}
++jprt.test.targets.jdk7u72=${jprt.test.targets.jdk7}
+ jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}}
+
+ # The default test/Makefile targets that should be run
+@@ -490,6 +518,7 @@
+ ${jprt.my.solaris.x64}-*-c2-servertest, \
+ ${jprt.my.linux.i586}-*-c2-servertest, \
+ ${jprt.my.linux.x64}-*-c2-servertest, \
++ ${jprt.my.linux.sparcv9}-*-c2-servertest, \
+ ${jprt.my.macosx.x64}-*-c2-servertest, \
+ ${jprt.my.windows.i586}-*-c2-servertest, \
+ ${jprt.my.windows.x64}-*-c2-servertest
+@@ -501,6 +530,7 @@
+ ${jprt.my.solaris.x64}-fastdebug-c2-internalvmtests, \
+ ${jprt.my.linux.i586}-fastdebug-c2-internalvmtests, \
+ ${jprt.my.linux.x64}-fastdebug-c2-internalvmtests, \
++ ${jprt.my.linux.sparcv9}-fastdebug-c2-internalvmtests, \
+ ${jprt.my.macosx.x64}-fastdebug-c2-internalvmtests, \
+ ${jprt.my.windows.i586}-fastdebug-c2-internalvmtests, \
+ ${jprt.my.windows.x64}-fastdebug-c2-internalvmtests
+@@ -512,6 +542,7 @@
+ ${jprt.my.solaris.x64}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.linux.i586}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.linux.x64}-{product|fastdebug}-c2-wbapitest, \
++ ${jprt.my.linux.sparcv9}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.windows.i586}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.windows.x64}-{product|fastdebug}-c2-wbapitest, \
+ ${jprt.my.solaris.sparc}-{product|fastdebug}-c1-wbapitest, \
+@@ -530,7 +561,7 @@
+
+ jprt.make.rule.test.targets.jdk8=${jprt.make.rule.test.targets.standard}
+ jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard}
+-jprt.make.rule.test.targets.jdk7u60=${jprt.make.rule.test.targets.jdk7}
++jprt.make.rule.test.targets.jdk7u72=${jprt.make.rule.test.targets.jdk7}
+ jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
+
+ # 7155453: Work-around to prevent popups on OSX from blocking test completion
+--- ./hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/sparc/vm/assembler_sparc.inline.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -119,7 +119,15 @@
+ inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
+ inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d, RelocationHolder const& rspec) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); }
+
+-inline void Assembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) { relocate(a.rspec(offset)); ldf( w, a.base(), a.disp() + offset, d); }
++inline void Assembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) {
++ relocate(a.rspec(offset));
++ if (a.has_index()) {
++ assert(offset == 0, "");
++ ldf(w, a.base(), a.index(), d);
++ } else {
++ ldf(w, a.base(), a.disp() + offset, d);
++ }
++}
+
+ inline void Assembler::ldfsr( Register s1, Register s2) { v9_dep(); emit_long( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
+ inline void Assembler::ldfsr( Register s1, int simm13a) { v9_dep(); emit_data( op(ldst_op) | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
+--- ./hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -614,8 +614,8 @@
+ // Save the regs and make space for a C call
+ __ save(SP, -96, SP);
+ __ save_all_globals_into_locals();
+- BLOCK_COMMENT("call os::naked_sleep");
+- __ call(CAST_FROM_FN_PTR(address, os::naked_sleep));
++ BLOCK_COMMENT("call os::naked_short_sleep");
++ __ call(CAST_FROM_FN_PTR(address, os::naked_short_sleep));
+ __ delayed()->nop();
+ __ restore_globals_from_locals();
+ __ restore();
+--- ./hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -98,6 +98,27 @@
+ _supports_cx8 = has_v9();
+ _supports_atomic_getset4 = true; // swap instruction
+
++ // There are Fujitsu Sparc64 CPUs which support blk_init as well so
++ // we have to take this check out of the 'is_niagara()' block below.
++ if (has_blk_init()) {
++ // When using CMS or G1, we cannot use memset() in BOT updates
++ // because the sun4v/CMT version in libc_psr uses BIS which
++ // exposes "phantom zeros" to concurrent readers. See 6948537.
++ if (FLAG_IS_DEFAULT(UseMemSetInBOT) && (UseConcMarkSweepGC || UseG1GC)) {
++ FLAG_SET_DEFAULT(UseMemSetInBOT, false);
++ }
++ // Issue a stern warning if the user has explicitly set
++ // UseMemSetInBOT (it is known to cause issues), but allow
++ // use for experimentation and debugging.
++ if (UseConcMarkSweepGC || UseG1GC) {
++ if (UseMemSetInBOT) {
++ assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error");
++ warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability"
++ " on sun4v; please understand that you are using at your own risk!");
++ }
++ }
++ }
++
+ if (is_niagara()) {
+ // Indirect branch is the same cost as direct
+ if (FLAG_IS_DEFAULT(UseInlineCaches)) {
+@@ -107,12 +128,6 @@
+ if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
+ FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
+ }
+- // When using CMS or G1, we cannot use memset() in BOT updates
+- // because the sun4v/CMT version in libc_psr uses BIS which
+- // exposes "phantom zeros" to concurrent readers. See 6948537.
+- if (FLAG_IS_DEFAULT(UseMemSetInBOT) && (UseConcMarkSweepGC || UseG1GC)) {
+- FLAG_SET_DEFAULT(UseMemSetInBOT, false);
+- }
+ #ifdef _LP64
+ // 32-bit oops don't make sense for the 64-bit VM on sparc
+ // since the 32-bit VM has the same registers and smaller objects.
+--- ./hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -96,7 +96,13 @@
+ static bool is_M_family(int features) { return (features & M_family_m) != 0; }
+ static bool is_T_family(int features) { return (features & T_family_m) != 0; }
+ static bool is_niagara() { return is_T_family(_features); }
+- DEBUG_ONLY( static bool is_niagara(int features) { return (features & sun4v_m) != 0; } )
++#ifdef ASSERT
++ static bool is_niagara(int features) {
++ // 'sun4v_m' may be defined on both Sun/Oracle Sparc CPUs as well as
++ // on Fujitsu Sparc64 CPUs, but only Sun/Oracle Sparcs can be 'niagaras'.
++ return (features & sun4v_m) != 0 && (features & sparc64_family_m) == 0;
++ }
++#endif
+
+ // Returns true if it is niagara1 (T1).
+ static bool is_T1_model(int features) { return is_T_family(features) && ((features & T1_model_m) != 0); }
+--- ./hotspot/src/cpu/x86/vm/assembler_x86.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/x86/vm/assembler_x86.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -7641,10 +7641,12 @@
+ // if fast computation is not possible, result is NaN. Requires
+ // fallback from user of this macro.
+ // increase precision for intermediate steps of the computation
++ BLOCK_COMMENT("fast_pow {");
+ increase_precision();
+ fyl2x(); // Stack: (Y*log2(X)) ...
+ pow_exp_core_encoding(); // Stack: exp(X) ...
+ restore_precision();
++ BLOCK_COMMENT("} fast_pow");
+ }
+
+ void MacroAssembler::fast_exp() {
+--- ./hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/x86/vm/frame_x86.inline.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -292,14 +292,18 @@
+ return true;
+ }
+
++inline oop frame::saved_oop_result(RegisterMap* map) const {
++ oop* result_adr = (oop *)map->location(rax->as_VMReg());
++ guarantee(result_adr != NULL, "bad register save location");
+
+-
+-inline oop frame::saved_oop_result(RegisterMap* map) const {
+- return *((oop*) map->location(rax->as_VMReg()));
++ return (*result_adr);
+ }
+
+ inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
+- *((oop*) map->location(rax->as_VMReg())) = obj;
++ oop* result_adr = (oop *)map->location(rax->as_VMReg());
++ guarantee(result_adr != NULL, "bad register save location");
++
++ *result_adr = obj;
+ }
+
+ #endif // CPU_X86_VM_FRAME_X86_INLINE_HPP
+--- ./hotspot/src/cpu/x86/vm/vm_version_x86.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/cpu/x86/vm/vm_version_x86.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -499,10 +499,12 @@
+ static uint cores_per_cpu() {
+ uint result = 1;
+ if (is_intel()) {
+- if (supports_processor_topology()) {
++ bool supports_topology = supports_processor_topology();
++ if (supports_topology) {
+ result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
+ _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
+- } else {
++ }
++ if (!supports_topology || result == 0) {
+ result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
+ }
+ } else if (is_amd()) {
+--- ./hotspot/src/os/bsd/dtrace/libjvm_db.c Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/bsd/dtrace/libjvm_db.c Fri Apr 10 09:19:25 2015 -0700
+@@ -261,6 +261,9 @@
+ uint64_t base;
+ int err;
+
++ /* Clear *vmp now in case we jump to fail: */
++ memset(vmp, 0, sizeof(VMStructEntry));
++
+ err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
+ CHECK_FAIL(err);
+ err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
+--- ./hotspot/src/os/bsd/vm/os_bsd.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/bsd/vm/os_bsd.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -3711,9 +3711,21 @@
+ }
+ }
+
+-int os::naked_sleep() {
+- // %% make the sleep time an integer flag. for now use 1 millisec.
+- return os::sleep(Thread::current(), 1, false);
++void os::naked_short_sleep(jlong ms) {
++ struct timespec req;
++
++ assert(ms < 1000, "Un-interruptable sleep, short time use only");
++ req.tv_sec = 0;
++ if (ms > 0) {
++ req.tv_nsec = (ms % 1000) * 1000000;
++ }
++ else {
++ req.tv_nsec = 1;
++ }
++
++ nanosleep(&req, NULL);
++
++ return;
+ }
+
+ // Sleep forever; naked call to OS-specific sleep; use with CAUTION
+--- ./hotspot/src/os/linux/vm/os_linux.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/linux/vm/os_linux.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 2015, 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
+@@ -3866,9 +3866,33 @@
+ }
+ }
+
+-int os::naked_sleep() {
+- // %% make the sleep time an integer flag. for now use 1 millisec.
+- return os::sleep(Thread::current(), 1, false);
++//
++// Short sleep, direct OS call.
++//
++// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
++// sched_yield(2) will actually give up the CPU:
++//
++// * Alone on this pariticular CPU, keeps running.
++// * Before the introduction of "skip_buddy" with "compat_yield" disabled
++// (pre 2.6.39).
++//
++// So calling this with 0 is an alternative.
++//
++void os::naked_short_sleep(jlong ms) {
++ struct timespec req;
++
++ assert(ms < 1000, "Un-interruptable sleep, short time use only");
++ req.tv_sec = 0;
++ if (ms > 0) {
++ req.tv_nsec = (ms % 1000) * 1000000;
++ }
++ else {
++ req.tv_nsec = 1;
++ }
++
++ nanosleep(&req, NULL);
++
++ return;
+ }
+
+ // Sleep forever; naked call to OS-specific sleep; use with CAUTION
+@@ -6041,26 +6065,57 @@
+ #define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59)
+ #endif
+
++#if defined(SPARC)
++// This assembly code makes the call to "syscall(__NR_fork)" and then
++// gets the values for "pid" and "is_child" from the correct registers.
++// This was done to make sure the compiler does not change the order
++// of the instructions while optimizing.
++void sparc_fork(int nr_fork, pid_t *pid, int *ischild) {
++ asm volatile (
++ " mov %2, %%o0\n\t"
++ " call syscall, 0\n\t"
++ " nop\n\t"
++ " mov %%o0, %0\n\t"
++ " mov %%o1, %1\n\t"
++ : "=r" (*pid), "=r" (*ischild)
++ : "r" (nr_fork) :
++ );
++}
++#endif
++
+ // Run the specified command in a separate process. Return its exit value,
+ // or -1 on failure (e.g. can't fork a new process).
+ // Unlike system(), this function can be called from signal handler. It
+ // doesn't block SIGINT et al.
+ int os::fork_and_exec(char* cmd) {
+ const char * argv[4] = {"sh", "-c", cmd, NULL};
++ int is_child;
++ pid_t pid;
+
+ // fork() in LinuxThreads/NPTL is not async-safe. It needs to run
+ // pthread_atfork handlers and reset pthread library. All we need is a
+ // separate process to execve. Make a direct syscall to fork process.
+ // On IA64 there's no fork syscall, we have to use fork() and hope for
+ // the best...
+- pid_t pid = NOT_IA64(syscall(__NR_fork);)
++#if defined(SPARC)
++ sparc_fork(__NR_fork, &pid, &is_child);
++#else
++ pid = NOT_IA64(syscall(__NR_fork);)
+ IA64_ONLY(fork();)
+
++ // set the is_child flag by checking the pid
++ if (pid == 0) {
++ is_child = 1;
++ } else {
++ is_child = 0;
++ }
++#endif
++
+ if (pid < 0) {
+ // fork failed
+ return -1;
+
+- } else if (pid == 0) {
++ } else if (is_child) {
+ // child process
+
+ // execve() in LinuxThreads will call pthread_kill_other_threads_np()
+--- ./hotspot/src/os/solaris/dtrace/libjvm_db.c Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/solaris/dtrace/libjvm_db.c Fri Apr 10 09:19:25 2015 -0700
+@@ -261,6 +261,9 @@
+ uint64_t base;
+ int err;
+
++ /* Clear *vmp now in case we jump to fail: */
++ memset(vmp, 0, sizeof(VMStructEntry));
++
+ err = ps_pglobal_lookup(J->P, LIBJVM_SO, "gHotSpotVMStructs", &sym_addr);
+ CHECK_FAIL(err);
+ err = read_pointer(J, sym_addr, &gHotSpotVMStructs);
+--- ./hotspot/src/os/solaris/vm/os_solaris.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/solaris/vm/os_solaris.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -2311,8 +2311,8 @@
+ st->cr();
+ status = true;
+ }
+- ::close(fd);
+ }
++ ::close(fd);
+ }
+ return status;
+ }
+@@ -2336,13 +2336,18 @@
+ "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG",
+ "ILL_COPROC", "ILL_BADSTK" };
+
++const size_t ill_names_length = (sizeof(ill_names)/sizeof(char *));
++
+ const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
+ "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
+ "FPE_FLTINV", "FPE_FLTSUB" };
++const size_t fpe_names_length = (sizeof(fpe_names)/sizeof(char *));
+
+ const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
++const size_t segv_names_length = (sizeof(segv_names)/sizeof(char *));
+
+ const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" };
++const size_t bus_names_length = (sizeof(bus_names)/sizeof(char *));
+
+ void os::print_siginfo(outputStream* st, void* siginfo) {
+ st->print("siginfo:");
+@@ -2361,19 +2366,23 @@
+ assert(c > 0, "unexpected si_code");
+ switch (si->si_signo) {
+ case SIGILL:
+- st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]);
++ st->print(", si_code=%d (%s)", c,
++ c >= ill_names_length ? "" : ill_names[c]);
+ st->print(", si_addr=" PTR_FORMAT, si->si_addr);
+ break;
+ case SIGFPE:
+- st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]);
++ st->print(", si_code=%d (%s)", c,
++ c >= fpe_names_length ? "" : fpe_names[c]);
+ st->print(", si_addr=" PTR_FORMAT, si->si_addr);
+ break;
+ case SIGSEGV:
+- st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]);
++ st->print(", si_code=%d (%s)", c,
++ c >= segv_names_length ? "" : segv_names[c]);
+ st->print(", si_addr=" PTR_FORMAT, si->si_addr);
+ break;
+ case SIGBUS:
+- st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]);
++ st->print(", si_code=%d (%s)", c,
++ c >= bus_names_length ? "" : bus_names[c]);
+ st->print(", si_addr=" PTR_FORMAT, si->si_addr);
+ break;
+ default:
+@@ -3094,7 +3103,7 @@
+ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
+ const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE };
+ const size_t types = sizeof(info_types) / sizeof(info_types[0]);
+- uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT];
++ uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1];
+ uint_t validity[MAX_MEMINFO_CNT];
+
+ size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size);
+@@ -3133,7 +3142,7 @@
+ }
+ }
+
+- if (i != addrs_count) {
++ if (i < addrs_count) {
+ if ((validity[i] & 2) != 0) {
+ page_found->lgrp_id = outdata[types * i];
+ } else {
+@@ -3742,9 +3751,14 @@
+ return os_sleep(millis, interruptible);
+ }
+
+-int os::naked_sleep() {
+- // %% make the sleep time an integer flag. for now use 1 millisec.
+- return os_sleep(1, false);
++void os::naked_short_sleep(jlong ms) {
++ assert(ms < 1000, "Un-interruptable sleep, short time use only");
++
++ // usleep is deprecated and removed from POSIX, in favour of nanosleep, but
++ // Solaris requires -lrt for this.
++ usleep((ms * 1000));
++
++ return;
+ }
+
+ // Sleep forever; naked call to OS-specific sleep; use with CAUTION
+--- ./hotspot/src/os/solaris/vm/perfMemory_solaris.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/solaris/vm/perfMemory_solaris.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2001, 2014, 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
+@@ -623,10 +623,12 @@
+
+ RESTARTABLE(::read(fd, addr, remaining), result);
+ if (result == OS_ERR) {
++ ::close(fd);
+ THROW_MSG_0(vmSymbols::java_io_IOException(), "Read error");
++ } else {
++ remaining-=result;
++ addr+=result;
+ }
+- remaining-=result;
+- addr+=result;
+ }
+
+ RESTARTABLE(::close(fd), result);
+@@ -1129,8 +1131,16 @@
+ FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+
+ // open the shared memory file for the give vmid
+- fd = open_sharedmem_file(rfilename, file_flags, CHECK);
+- assert(fd != OS_ERR, "unexpected value");
++ fd = open_sharedmem_file(rfilename, file_flags, THREAD);
++
++ if (fd == OS_ERR) {
++ return;
++ }
++
++ if (HAS_PENDING_EXCEPTION) {
++ ::close(fd);
++ return;
++ }
+
+ if (*sizep == 0) {
+ size = sharedmem_filesize(fd, CHECK);
+--- ./hotspot/src/os/windows/vm/os_windows.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os/windows/vm/os_windows.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -3421,6 +3421,16 @@
+ return result;
+ }
+
++//
++// Short sleep, direct OS call.
++//
++// ms = 0, means allow others (if any) to run.
++//
++void os::naked_short_sleep(jlong ms) {
++ assert(ms < 1000, "Un-interruptable sleep, short time use only");
++ Sleep(ms);
++}
++
+ // Sleep forever; naked call to OS-specific sleep; use with CAUTION
+ void os::infinite_sleep() {
+ while (true) { // sleep forever ...
+--- ./hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -26,8 +26,8 @@
+ #include "runtime/os.hpp"
+ #include "vm_version_sparc.hpp"
+
+-static bool detect_niagara() {
+- char cpu[128];
++static bool cpuinfo_field_contains(const char* field, const char* value) {
++ char line[1024];
+ bool rv = false;
+
+ FILE* fp = fopen("/proc/cpuinfo", "r");
+@@ -35,9 +35,10 @@
+ return rv;
+ }
+
+- while (!feof(fp)) {
+- if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) {
+- if (strstr(cpu, "Niagara") != NULL) {
++ while (fgets(line, sizeof(line), fp) != NULL) {
++ assert(strlen(line) < sizeof(line) - 1, "buffer line[1024] is too small.");
++ if (strncmp(line, field, strlen(field)) == 0) {
++ if (strstr(line, value) != NULL) {
+ rv = true;
+ }
+ break;
+@@ -45,8 +46,15 @@
+ }
+
+ fclose(fp);
++ return rv;
++}
+
+- return rv;
++static bool detect_niagara() {
++ return cpuinfo_field_contains("cpu", "Niagara");
++}
++
++static bool detect_blkinit() {
++ return cpuinfo_field_contains("cpucaps", "blkinit");
+ }
+
+ int VM_Version::platform_features(int features) {
+@@ -58,5 +66,9 @@
+ features = niagara1_m | T_family_m;
+ }
+
++ if (detect_blkinit()) {
++ features |= blk_init_instructions_m;
++ }
++
+ return features;
+ }
+--- ./hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 2014, 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
+@@ -490,9 +490,11 @@
+ // here if the underlying file has been truncated.
+ // Do not crash the VM in such a case.
+ CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
+- nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
+- if (nm != NULL && nm->has_unsafe_access()) {
+- stub = StubRoutines::handler_for_unsafe_access();
++ if (cb != NULL) {
++ nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
++ if (nm != NULL && nm->has_unsafe_access()) {
++ stub = StubRoutines::handler_for_unsafe_access();
++ }
+ }
+ }
+ else
+@@ -739,6 +741,7 @@
+ err.report_and_die();
+
+ ShouldNotReachHere();
++ return false;
+ }
+
+ void os::print_context(outputStream *st, void *context) {
+--- ./hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -3663,6 +3663,7 @@
+
+ // now perform tests that are based on flag settings
+ if (callee->force_inline()) {
++ if (inline_level() > MaxForceInlineLevel) INLINE_BAILOUT("MaxForceInlineLevel");
+ print_inlining(callee, "force inline by annotation");
+ } else if (callee->should_inline()) {
+ print_inlining(callee, "force inline by CompileOracle");
+--- ./hotspot/src/share/vm/c1/c1_globals.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/c1/c1_globals.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -269,9 +269,6 @@
+ develop(bool, InstallMethods, true, \
+ "Install methods at the end of successful compilations") \
+ \
+- product(intx, CompilationRepeat, 0, \
+- "Number of times to recompile method before returning result") \
+- \
+ develop(intx, NMethodSizeLimit, (64*K)*wordSize, \
+ "Maximum size of a compiled method.") \
+ \
+--- ./hotspot/src/share/vm/classfile/classFileParser.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/classFileParser.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -3747,7 +3747,7 @@
+ }
+
+ // Allocate mirror and initialize static fields
+- java_lang_Class::create_mirror(this_klass, CHECK_(nullHandle));
++ java_lang_Class::create_mirror(this_klass, class_loader, CHECK_(nullHandle));
+
+ ClassLoadingService::notify_class_loaded(instanceKlass::cast(this_klass()),
+ false /* not shared class */);
+--- ./hotspot/src/share/vm/classfile/classLoader.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/classLoader.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2013, 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
+@@ -197,7 +197,7 @@
+ }
+
+
+-ClassFileStream* ClassPathDirEntry::open_stream(const char* name) {
++ClassFileStream* ClassPathDirEntry::open_stream(const char* name, TRAPS) {
+ // construct full path name
+ char path[JVM_MAXPATHLEN];
+ if (jio_snprintf(path, sizeof(path), "%s%s%s", _dir, os::file_separator(), name) == -1) {
+@@ -240,7 +240,7 @@
+ FREE_C_HEAP_ARRAY(char, _zip_name, mtClass);
+ }
+
+-ClassFileStream* ClassPathZipEntry::open_stream(const char* name) {
++ClassFileStream* ClassPathZipEntry::open_stream(const char* name, TRAPS) {
+ // enable call to C land
+ JavaThread* thread = JavaThread::current();
+ ThreadToNativeFromVM ttn(thread);
+@@ -284,24 +284,24 @@
+ }
+ }
+
+-LazyClassPathEntry::LazyClassPathEntry(char* path, struct stat st) : ClassPathEntry() {
++LazyClassPathEntry::LazyClassPathEntry(char* path, const struct stat* st) : ClassPathEntry() {
+ _path = strdup(path);
+- _st = st;
++ _st = *st;
+ _meta_index = NULL;
+ _resolved_entry = NULL;
++ _has_error = false;
+ }
+
+ bool LazyClassPathEntry::is_jar_file() {
+ return ((_st.st_mode & S_IFREG) == S_IFREG);
+ }
+
+-ClassPathEntry* LazyClassPathEntry::resolve_entry() {
++ClassPathEntry* LazyClassPathEntry::resolve_entry(TRAPS) {
+ if (_resolved_entry != NULL) {
+ return (ClassPathEntry*) _resolved_entry;
+ }
+ ClassPathEntry* new_entry = NULL;
+- ClassLoader::create_class_path_entry(_path, _st, &new_entry, false);
+- assert(new_entry != NULL, "earlier code should have caught this");
++ new_entry = ClassLoader::create_class_path_entry(_path, &_st, false, CHECK_NULL);
+ {
+ ThreadCritical tc;
+ if (_resolved_entry == NULL) {
+@@ -314,12 +314,21 @@
+ return (ClassPathEntry*) _resolved_entry;
+ }
+
+-ClassFileStream* LazyClassPathEntry::open_stream(const char* name) {
++ClassFileStream* LazyClassPathEntry::open_stream(const char* name, TRAPS) {
+ if (_meta_index != NULL &&
+ !_meta_index->may_contain(name)) {
+ return NULL;
+ }
+- return resolve_entry()->open_stream(name);
++ if (_has_error) {
++ return NULL;
++ }
++ ClassPathEntry* cpe = resolve_entry(THREAD);
++ if (cpe == NULL) {
++ _has_error = true;
++ return NULL;
++ } else {
++ return cpe->open_stream(name, THREAD);
++ }
+ }
+
+ bool LazyClassPathEntry::is_lazy() {
+@@ -465,20 +474,19 @@
+ }
+ }
+
+-void ClassLoader::create_class_path_entry(char *path, struct stat st, ClassPathEntry **new_entry, bool lazy) {
++ClassPathEntry* ClassLoader::create_class_path_entry(char *path, const struct stat* st, bool lazy, TRAPS) {
+ JavaThread* thread = JavaThread::current();
+ if (lazy) {
+- *new_entry = new LazyClassPathEntry(path, st);
+- return;
++ return new LazyClassPathEntry(path, st);
+ }
+- if ((st.st_mode & S_IFREG) == S_IFREG) {
++ ClassPathEntry* new_entry = NULL;
++ if ((st->st_mode & S_IFREG) == S_IFREG) {
+ // Regular file, should be a zip file
+ // Canonicalized filename
+ char canonical_path[JVM_MAXPATHLEN];
+ if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
+ // This matches the classic VM
+- EXCEPTION_MARK;
+- THROW_MSG(vmSymbols::java_io_IOException(), "Bad pathname");
++ THROW_MSG_(vmSymbols::java_io_IOException(), "Bad pathname", NULL);
+ }
+ char* error_msg = NULL;
+ jzfile* zip;
+@@ -489,7 +497,7 @@
+ zip = (*ZipOpen)(canonical_path, &error_msg);
+ }
+ if (zip != NULL && error_msg == NULL) {
+- *new_entry = new ClassPathZipEntry(zip, path);
++ new_entry = new ClassPathZipEntry(zip, path);
+ if (TraceClassLoading) {
+ tty->print_cr("[Opened %s]", path);
+ }
+@@ -504,16 +512,16 @@
+ msg = NEW_RESOURCE_ARRAY(char, len); ;
+ jio_snprintf(msg, len - 1, "error in opening JAR file <%s> %s", error_msg, path);
+ }
+- EXCEPTION_MARK;
+- THROW_MSG(vmSymbols::java_lang_ClassNotFoundException(), msg);
++ THROW_MSG_(vmSymbols::java_lang_ClassNotFoundException(), msg, NULL);
+ }
+ } else {
+ // Directory
+- *new_entry = new ClassPathDirEntry(path);
++ new_entry = new ClassPathDirEntry(path);
+ if (TraceClassLoading) {
+ tty->print_cr("[Path %s]", path);
+ }
+ }
++ return new_entry;
+ }
+
+
+@@ -572,13 +580,14 @@
+ }
+ }
+
+-void ClassLoader::update_class_path_entry_list(const char *path,
++void ClassLoader::update_class_path_entry_list(char *path,
+ bool check_for_duplicates) {
+ struct stat st;
+- if (os::stat((char *)path, &st) == 0) {
++ if (os::stat(path, &st) == 0) {
+ // File or directory found
+ ClassPathEntry* new_entry = NULL;
+- create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader);
++ Thread* THREAD = Thread::current();
++ new_entry = create_class_path_entry(path, &st, LazyBootClassLoader, CHECK);
+ // The kernel VM adds dynamically to the end of the classloader path and
+ // doesn't reorder the bootclasspath which would break java.lang.Package
+ // (see PackageInfo).
+@@ -895,7 +904,7 @@
+ PerfClassTraceTime::CLASS_LOAD);
+ ClassPathEntry* e = _first_entry;
+ while (e != NULL) {
+- stream = e->open_stream(name);
++ stream = e->open_stream(name, CHECK_(instanceKlassHandle()));
+ if (stream != NULL) {
+ break;
+ }
+@@ -1258,11 +1267,16 @@
+ }
+
+ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
+- resolve_entry()->compile_the_world(loader, CHECK);
++ ClassPathEntry* cpe = resolve_entry(THREAD);
++ if (cpe != NULL) {
++ cpe->compile_the_world(loader, CHECK);
++ }
+ }
+
+ bool LazyClassPathEntry::is_rt_jar() {
+- return resolve_entry()->is_rt_jar();
++ Thread* THREAD = Thread::current();
++ ClassPathEntry* cpe = resolve_entry(THREAD);
++ return (cpe != NULL) ? cpe->is_jar_file() : false;
+ }
+
+ void ClassLoader::compile_the_world() {
+--- ./hotspot/src/share/vm/classfile/classLoader.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/classLoader.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2013, 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
+@@ -63,7 +63,7 @@
+ ClassPathEntry();
+ // Attempt to locate file_name through this class path entry.
+ // Returns a class file parsing stream if successfull.
+- virtual ClassFileStream* open_stream(const char* name) = 0;
++ virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
+ // Debugging
+ NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
+ NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
+@@ -77,7 +77,7 @@
+ bool is_jar_file() { return false; }
+ const char* name() { return _dir; }
+ ClassPathDirEntry(char* dir);
+- ClassFileStream* open_stream(const char* name);
++ ClassFileStream* open_stream(const char* name, TRAPS);
+ // Debugging
+ NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+ NOT_PRODUCT(bool is_rt_jar();)
+@@ -107,7 +107,7 @@
+ const char* name() { return _zip_name; }
+ ClassPathZipEntry(jzfile* zip, const char* zip_name);
+ ~ClassPathZipEntry();
+- ClassFileStream* open_stream(const char* name);
++ ClassFileStream* open_stream(const char* name, TRAPS);
+ void contents_do(void f(const char* name, void* context), void* context);
+ // Debugging
+ NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+@@ -125,13 +125,14 @@
+ char* _path; // dir or file
+ struct stat _st;
+ MetaIndex* _meta_index;
++ bool _has_error;
+ volatile ClassPathEntry* _resolved_entry;
+- ClassPathEntry* resolve_entry();
++ ClassPathEntry* resolve_entry(TRAPS);
+ public:
+ bool is_jar_file();
+ const char* name() { return _path; }
+- LazyClassPathEntry(char* path, struct stat st);
+- ClassFileStream* open_stream(const char* name);
++ LazyClassPathEntry(char* path, const struct stat* st);
++ ClassFileStream* open_stream(const char* name, TRAPS);
+ void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; }
+ virtual bool is_lazy();
+ // Debugging
+@@ -207,14 +208,15 @@
+ static void setup_meta_index();
+ static void setup_bootstrap_search_path();
+ static void load_zip_library();
+- static void create_class_path_entry(char *path, struct stat st, ClassPathEntry **new_entry, bool lazy);
++ static ClassPathEntry* create_class_path_entry(char *path, const struct stat* st,
++ bool lazy, TRAPS);
+
+ // Canonicalizes path names, so strcmp will work properly. This is mainly
+ // to avoid confusing the zip library
+ static bool get_canonical_path(char* orig, char* out, int len);
+ public:
+ // Used by the kernel jvm.
+- static void update_class_path_entry_list(const char *path,
++ static void update_class_path_entry_list(char *path,
+ bool check_for_duplicates);
+ static void print_bootclasspath();
+
+--- ./hotspot/src/share/vm/classfile/javaClasses.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/javaClasses.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -42,6 +42,7 @@
+ #include "oops/methodOop.hpp"
+ #include "oops/symbol.hpp"
+ #include "oops/typeArrayOop.hpp"
++#include "prims/jvmtiRedefineClassesTrace.hpp"
+ #include "runtime/fieldDescriptor.hpp"
+ #include "runtime/handles.inline.hpp"
+ #include "runtime/interfaceSupport.hpp"
+@@ -530,10 +531,10 @@
+ }
+ }
+ }
+- create_mirror(k, CHECK);
++ create_mirror(k, Handle(NULL), CHECK);
+ }
+
+-oop java_lang_Class::create_mirror(KlassHandle k, TRAPS) {
++oop java_lang_Class::create_mirror(KlassHandle k, Handle class_loader, TRAPS) {
+ assert(k->java_mirror() == NULL, "should only assign mirror once");
+ // Use this moment of initialization to cache modifier_flags also,
+ // to support Class.getModifiers(). Instance classes recalculate
+@@ -574,6 +575,9 @@
+ // Initialize static fields
+ instanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, CHECK_NULL);
+ }
++ // set the classLoader field in the java_lang_Class instance
++ assert(class_loader() == k->class_loader(), "should be same");
++ set_class_loader(mirror(), class_loader());
+ return mirror();
+ } else {
+ return NULL;
+@@ -599,6 +603,18 @@
+ java_class->int_field_put(_static_oop_field_count_offset, size);
+ }
+
++void java_lang_Class::set_class_loader(oop java_class, oop loader) {
++ // jdk7 runs Queens in bootstrapping and jdk8-9 has no coordinated pushes yet.
++ if (_class_loader_offset != 0) {
++ java_class->obj_field_put(_class_loader_offset, loader);
++ }
++}
++
++oop java_lang_Class::class_loader(oop java_class) {
++ assert(_class_loader_offset != 0, "must be set");
++ return java_class->obj_field(_class_loader_offset);
++}
++
+ oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
+ // This should be improved by adding a field at the Java level or by
+ // introducing a new VM klass (see comment in ClassFileParser)
+@@ -762,6 +778,12 @@
+ compute_optional_offset(classRedefinedCount_offset,
+ klass_oop, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
+
++ // Needs to be optional because the old build runs Queens during bootstrapping
++ // and jdk8-9 doesn't have coordinated pushes yet.
++ compute_optional_offset(_class_loader_offset,
++ klass_oop, vmSymbols::classClassLoader_name(),
++ vmSymbols::classloader_signature());
++
+ CLASS_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
+ }
+
+@@ -2517,11 +2539,35 @@
+ return mname->obj_field(_vmtarget_offset);
+ }
+
++bool java_lang_invoke_MemberName::is_method(oop mname) {
++ assert(is_instance(mname), "must be MemberName");
++ return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0;
++}
++
+ // Can be executed on VM thread only
+-void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, oop ref) {
+- assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type");
++void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, methodOop old_method,
++ methodOop new_method, bool* trace_name_printed) {
++ assert(is_method(mname), "wrong type");
+ assert(Thread::current()->is_VM_thread(), "not VM thread");
+- mname->address_field_put(_vmtarget_offset, (address)ref);
++
++ methodOop target = (methodOop) mname->obj_field(_vmtarget_offset);
++
++ if (target == old_method) {
++ mname->obj_field_put(_vmtarget_offset, new_method);
++
++ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
++ if (!(*trace_name_printed)) {
++ // RC_TRACE_MESG macro has an embedded ResourceMark
++ RC_TRACE_MESG(("adjust: name=%s",
++ instanceKlass::cast(old_method->method_holder())->external_name()));
++ *trace_name_printed = true;
++ }
++ // RC_TRACE macro has an embedded ResourceMark
++ RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
++ new_method->name()->as_C_string(),
++ new_method->signature()->as_C_string()));
++ }
++ }
+ }
+
+ void java_lang_invoke_MemberName::set_vmtarget(oop mname, oop ref) {
+@@ -2830,6 +2876,7 @@
+ int java_lang_Class::_resolved_constructor_offset;
+ int java_lang_Class::_oop_size_offset;
+ int java_lang_Class::_static_oop_field_count_offset;
++int java_lang_Class::_class_loader_offset;
+ int java_lang_Throwable::backtrace_offset;
+ int java_lang_Throwable::detailMessage_offset;
+ int java_lang_Throwable::cause_offset;
+@@ -3277,3 +3324,4 @@
+ JavaClasses::check_offsets();
+ FilteredFieldsMap::initialize(); // must be done after computing offsets.
+ }
++
+--- ./hotspot/src/share/vm/classfile/javaClasses.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/javaClasses.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -28,6 +28,7 @@
+ #include "classfile/systemDictionary.hpp"
+ #include "jvmtifiles/jvmti.h"
+ #include "oops/oop.hpp"
++#include "oops/methodOop.hpp"
+ #include "runtime/os.hpp"
+ #include "utilities/utf8.hpp"
+
+@@ -224,14 +225,21 @@
+ static int _oop_size_offset;
+ static int _static_oop_field_count_offset;
+
++ static int _class_loader_offset;
++
+ static bool offsets_computed;
+ static int classRedefinedCount_offset;
+
++ static void set_class_loader(oop java_class, oop class_loader);
+ public:
+ static void compute_offsets();
+
+ // Instance creation
+- static oop create_mirror(KlassHandle k, TRAPS);
++ static oop create_mirror(KlassHandle k, Handle class_loader, TRAPS);
++ static oop create_mirror(KlassHandle k, TRAPS) {
++ return create_mirror(k, Handle(), THREAD);
++ }
++
+ static void fixup_mirror(KlassHandle k, TRAPS);
+ static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
+ // Conversion
+@@ -267,6 +275,8 @@
+ static int classRedefinedCount(oop the_class_mirror);
+ static void set_classRedefinedCount(oop the_class_mirror, int value);
+
++ static oop class_loader(oop java_class);
++
+ static int oop_size(oop java_class);
+ static void set_oop_size(oop java_class, int size);
+ static int static_oop_field_count(oop java_class);
+@@ -1014,7 +1024,8 @@
+
+ static oop vmtarget(oop mname);
+ static void set_vmtarget(oop mname, oop target);
+- static void adjust_vmtarget(oop mname, oop target);
++ static void adjust_vmtarget(oop mname, methodOop old_method, methodOop new_method,
++ bool* trace_name_printed);
+
+ static intptr_t vmindex(oop mname);
+ static void set_vmindex(oop mname, intptr_t index);
+@@ -1027,6 +1038,8 @@
+ return obj != NULL && is_subclass(obj->klass());
+ }
+
++ static bool is_method(oop obj);
++
+ // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
+ enum {
+ MN_IS_METHOD = 0x00010000, // method (not constructor)
+--- ./hotspot/src/share/vm/classfile/vmSymbols.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/classfile/vmSymbols.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -547,6 +547,7 @@
+ template(serializePropertiesToByteArray_signature, "()[B") \
+ template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \
+ template(classRedefinedCount_name, "classRedefinedCount") \
++ template(classClassLoader_name, "classLoader") \
+ \
+ /* trace signatures */ \
+ TRACE_TEMPLATES(template) \
+--- ./hotspot/src/share/vm/compiler/compileBroker.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/compiler/compileBroker.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1594,22 +1594,6 @@
+ if (method()->number_of_breakpoints() == 0) {
+ // Compile the method.
+ if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
+-#ifdef COMPILER1
+- // Allow repeating compilations for the purpose of benchmarking
+- // compile speed. This is not useful for customers.
+- if (CompilationRepeat != 0) {
+- int compile_count = CompilationRepeat;
+- while (compile_count > 0) {
+- invoke_compiler_on_method(task);
+- nmethod* nm = method->code();
+- if (nm != NULL) {
+- nm->make_zombie();
+- method->clear_code();
+- }
+- compile_count--;
+- }
+- }
+-#endif /* COMPILER1 */
+ invoke_compiler_on_method(task);
+ } else {
+ // After compilation is disabled, remove remaining methods from queue
+--- ./hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -492,7 +492,7 @@
+ // heap remains parsable.
+ const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
+ const bool softrefs_clear = collector_policy()->all_soft_refs_clear();
+- assert(!limit_exceeded || softrefs_clear, "Should have been cleared");
++
+ if (limit_exceeded && softrefs_clear) {
+ *gc_overhead_limit_was_exceeded = true;
+ size_policy()->set_gc_overhead_limit_exceeded(false);
+--- ./hotspot/src/share/vm/memory/collectorPolicy.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/memory/collectorPolicy.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -642,7 +642,7 @@
+
+ const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded();
+ const bool softrefs_clear = all_soft_refs_clear();
+- assert(!limit_exceeded || softrefs_clear, "Should have been cleared");
++
+ if (limit_exceeded && softrefs_clear) {
+ *gc_overhead_limit_was_exceeded = true;
+ size_policy()->set_gc_overhead_limit_exceeded(false);
+--- ./hotspot/src/share/vm/memory/referenceProcessor.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/memory/referenceProcessor.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -256,7 +256,7 @@
+ // Cleaner references to be temporary, and don't want to deal with
+ // possible incompatibilities arising from making it more visible.
+ phantom_count +=
+- process_discovered_reflist(_discoveredCleanerRefs, NULL, false,
++ process_discovered_reflist(_discoveredCleanerRefs, NULL, true,
+ is_alive, keep_alive, complete_gc, task_executor);
+ }
+
+--- ./hotspot/src/share/vm/oops/arrayKlass.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/arrayKlass.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -124,7 +124,7 @@
+ ResourceMark rm(THREAD);
+ k->initialize_supers(super_klass(), CHECK);
+ k->vtable()->initialize_vtable(false, CHECK);
+- java_lang_Class::create_mirror(k, CHECK);
++ java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), CHECK);
+ }
+
+ objArrayOop arrayKlass::compute_secondary_supers(int num_extra_slots, TRAPS) {
+--- ./hotspot/src/share/vm/oops/cpCacheOop.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/cpCacheOop.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -615,7 +615,9 @@
+ m = f1_as_method();
+ }
+
+- assert(m != NULL && m->is_method(), "sanity check");
++ // Secondary entry can have vfinal flag and a NULL _f2, giving m==NULL here:
++ assert(is_secondary_entry() || (m != NULL && m->is_method()), "sanity check");
++
+ if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
+ // robustness for above sanity checks or method is not in
+ // the interesting class
+--- ./hotspot/src/share/vm/oops/instanceKlass.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/instanceKlass.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -2344,28 +2344,27 @@
+ return NULL;
+ }
+
+-void instanceKlass::add_member_name(int index, Handle mem_name) {
++bool instanceKlass::add_member_name(Handle mem_name) {
+ jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
+ MutexLocker ml(MemberNameTable_lock);
+- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
+ DEBUG_ONLY(No_Safepoint_Verifier nsv);
+
++ // Check if method has been redefined while taking out MemberNameTable_lock, if so
++ // return false. We cannot cache obsolete methods. They will crash when the function
++ // is called!
++ methodOop method = (methodOop) java_lang_invoke_MemberName::vmtarget(mem_name());
++ if (method->is_obsolete()) {
++ return false;
++ } else if (method->is_old()) {
++ // Replace method with redefined version
++ java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
++ }
++
+ if (_member_names == NULL) {
+ _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
+ }
+- _member_names->add_member_name(index, mem_name_wref);
+-}
+-
+-oop instanceKlass::get_member_name(int index) {
+- MutexLocker ml(MemberNameTable_lock);
+- assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
+- DEBUG_ONLY(No_Safepoint_Verifier nsv);
+-
+- if (_member_names == NULL) {
+- return NULL;
+- }
+- oop mem_name =_member_names->get_member_name(index);
+- return mem_name;
++ _member_names->add_member_name(mem_name_wref);
++ return true;
+ }
+
+ // -----------------------------------------------------------------------------------------------------
+--- ./hotspot/src/share/vm/oops/instanceKlass.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/instanceKlass.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -977,8 +977,7 @@
+ // JSR-292 support
+ MemberNameTable* member_names() { return _member_names; }
+ void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
+- void add_member_name(int index, Handle member_name);
+- oop get_member_name(int index);
++ bool add_member_name(Handle member_name);
+
+ public:
+ // JVMTI support
+--- ./hotspot/src/share/vm/oops/methodDataOop.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/methodDataOop.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1203,7 +1203,7 @@
+ // Whole-method sticky bits and flags
+ public:
+ enum {
+- _trap_hist_limit = 17, // decoupled from Deoptimization::Reason_LIMIT
++ _trap_hist_limit = 18, // decoupled from Deoptimization::Reason_LIMIT
+ _trap_hist_mask = max_jubyte,
+ _extra_data_count = 4 // extra DataLayout headers, for trap history
+ }; // Public flag values
+--- ./hotspot/src/share/vm/oops/objArrayKlass.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/objArrayKlass.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -202,6 +202,15 @@
+ }
+ }
+
++// Protect against _bottom_klass being null, when called from Universe::fixup_mirrors
++oop objArrayKlass::class_loader() const {
++ if (bottom_klass() != NULL) {
++ return Klass::cast(bottom_klass())->class_loader();
++ } else {
++ return NULL;
++ }
++}
++
+
+ klassOop objArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
+ objArrayKlassHandle h_this(THREAD, as_klassOop());
+--- ./hotspot/src/share/vm/oops/objArrayKlass.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/oops/objArrayKlass.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -68,7 +68,7 @@
+ // Compute protection domain
+ oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
+ // Compute class loader
+- oop class_loader() const { return Klass::cast(bottom_klass())->class_loader(); }
++ oop class_loader() const;
+
+ private:
+ // Either oop or narrowOop depending on UseCompressedOops.
+--- ./hotspot/src/share/vm/opto/bytecodeInfo.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/bytecodeInfo.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -364,6 +364,13 @@
+ set_msg("not an accessor");
+ return false;
+ }
++
++ // Limit inlining depth in case inlining is forced or
++ // _max_inline_level was increased to compensate for lambda forms.
++ if (inline_level() > MaxForceInlineLevel) {
++ set_msg("MaxForceInlineLevel");
++ return false;
++ }
+ if (inline_level() > _max_inline_level) {
+ if (!callee_method->force_inline() || !IncrementalInline) {
+ set_msg("inlining too deep");
+--- ./hotspot/src/share/vm/opto/c2_globals.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/c2_globals.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -448,6 +448,9 @@
+ product(bool, DoEscapeAnalysis, true, \
+ "Perform escape analysis") \
+ \
++ product(double, EscapeAnalysisTimeout, 20. DEBUG_ONLY(+40.), \
++ "Abort EA when it reaches time limit (in sec)") \
++ \
+ develop(bool, ExitEscapeAnalysisOnTimeout, true, \
+ "Exit or throw assert in EA when it reaches time limit") \
+ \
+--- ./hotspot/src/share/vm/opto/callGenerator.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/callGenerator.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -742,7 +742,7 @@
+ guarantee(!target->is_method_handle_intrinsic(), "should not happen"); // XXX remove
+ const int vtable_index = methodOopDesc::invalid_vtable_index;
+ CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, true, true);
+- assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
++ assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
+ if (cg != NULL && cg->is_inline())
+ return cg;
+ }
+@@ -808,7 +808,7 @@
+ }
+
+ CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, true, true);
+- assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
++ assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
+ if (cg != NULL && cg->is_inline())
+ return cg;
+ }
+--- ./hotspot/src/share/vm/opto/connode.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/connode.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -439,6 +439,102 @@
+ return this;
+ }
+
++uint CastIINode::size_of() const {
++ return sizeof(*this);
++}
++
++uint CastIINode::cmp(const Node &n) const {
++ return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency;
++}
++
++Node *CastIINode::Identity(PhaseTransform *phase) {
++ if (_carry_dependency) {
++ return this;
++ }
++ return ConstraintCastNode::Identity(phase);
++}
++
++const Type *CastIINode::Value(PhaseTransform *phase) const {
++ const Type *res = ConstraintCastNode::Value(phase);
++
++ // Try to improve the type of the CastII if we recognize a CmpI/If
++ // pattern.
++ if (_carry_dependency) {
++ if (in(0) != NULL && in(0)->in(0) != NULL && in(0)->in(0)->is_If()) {
++ assert(in(0)->is_IfFalse() || in(0)->is_IfTrue(), "should be If proj");
++ Node* proj = in(0);
++ if (proj->in(0)->in(1)->is_Bool()) {
++ Node* b = proj->in(0)->in(1);
++ if (b->in(1)->Opcode() == Op_CmpI) {
++ Node* cmp = b->in(1);
++ if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) {
++ const TypeInt* in2_t = phase->type(cmp->in(2))->is_int();
++ const Type* t = TypeInt::INT;
++ BoolTest test = b->as_Bool()->_test;
++ if (proj->is_IfFalse()) {
++ test = test.negate();
++ }
++ BoolTest::mask m = test._test;
++ jlong lo_long = min_jint;
++ jlong hi_long = max_jint;
++ if (m == BoolTest::le || m == BoolTest::lt) {
++ hi_long = in2_t->_hi;
++ if (m == BoolTest::lt) {
++ hi_long -= 1;
++ }
++ } else if (m == BoolTest::ge || m == BoolTest::gt) {
++ lo_long = in2_t->_lo;
++ if (m == BoolTest::gt) {
++ lo_long += 1;
++ }
++ } else if (m == BoolTest::eq) {
++ lo_long = in2_t->_lo;
++ hi_long = in2_t->_hi;
++ } else if (m == BoolTest::ne) {
++ // can't do any better
++ } else {
++ stringStream ss;
++ test.dump_on(&ss);
++ fatal(err_msg_res("unexpected comparison %s", ss.as_string()));
++ }
++ int lo_int = (int)lo_long;
++ int hi_int = (int)hi_long;
++
++ if (lo_long != (jlong)lo_int) {
++ lo_int = min_jint;
++ }
++ if (hi_long != (jlong)hi_int) {
++ hi_int = max_jint;
++ }
++
++ t = TypeInt::make(lo_int, hi_int, Type::WidenMax);
++
++ res = res->filter(t);
++
++ return res;
++ }
++ }
++ }
++ }
++ }
++ return res;
++}
++
++Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) {
++ if (_carry_dependency) {
++ return NULL;
++ }
++ return ConstraintCastNode::Ideal_DU_postCCP(ccp);
++}
++
++#ifndef PRODUCT
++void CastIINode::dump_spec(outputStream *st) const {
++ TypeNode::dump_spec(st);
++ if (_carry_dependency) {
++ st->print(" carry dependency");
++ }
++}
++#endif
+
+ //=============================================================================
+
+--- ./hotspot/src/share/vm/opto/connode.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/connode.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -233,10 +233,25 @@
+ //------------------------------CastIINode-------------------------------------
+ // cast integer to integer (different range)
+ class CastIINode: public ConstraintCastNode {
++ private:
++ // Can this node be removed post CCP or does it carry a required dependency?
++ const bool _carry_dependency;
++
++ protected:
++ virtual uint cmp( const Node &n ) const;
++ virtual uint size_of() const;
++
+ public:
+- CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
++ CastIINode(Node *n, const Type *t, bool carry_dependency = false)
++ : ConstraintCastNode(n,t), _carry_dependency(carry_dependency) {}
+ virtual int Opcode() const;
+ virtual uint ideal_reg() const { return Op_RegI; }
++ virtual Node *Identity( PhaseTransform *phase );
++ virtual const Type *Value( PhaseTransform *phase ) const;
++ virtual Node *Ideal_DU_postCCP( PhaseCCP * );
++#ifndef PRODUCT
++ virtual void dump_spec(outputStream *st) const;
++#endif
+ };
+
+ //------------------------------CastPPNode-------------------------------------
+--- ./hotspot/src/share/vm/opto/doCall.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/doCall.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -735,10 +735,16 @@
+ // each arm of the Phi. If I know something clever about the exceptions
+ // I'm loading the class from, I can replace the LoadKlass with the
+ // klass constant for the exception oop.
+- if( ex_node->is_Phi() ) {
+- ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT );
+- for( uint i = 1; i < ex_node->req(); i++ ) {
+- Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() );
++ if (ex_node->is_Phi()) {
++ ex_klass_node = new (C) PhiNode(ex_node->in(0), TypeKlassPtr::OBJECT);
++ for (uint i = 1; i < ex_node->req(); i++) {
++ Node* ex_in = ex_node->in(i);
++ if (ex_in == top() || ex_in == NULL) {
++ // This path was not taken.
++ ex_klass_node->init_req(i, top());
++ continue;
++ }
++ Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
+ Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+ ex_klass_node->init_req( i, k );
+ }
+--- ./hotspot/src/share/vm/opto/escape.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/escape.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -37,6 +37,8 @@
+
+ ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
+ _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
++ _in_worklist(C->comp_arena()),
++ _next_pidx(0),
+ _collecting(true),
+ _verify(false),
+ _compile(C),
+@@ -120,13 +122,19 @@
+ if (C->root() != NULL) {
+ ideal_nodes.push(C->root());
+ }
++ // Processed ideal nodes are unique on ideal_nodes list
++ // but several ideal nodes are mapped to the phantom_obj.
++ // To avoid duplicated entries on the following worklists
++ // add the phantom_obj only once to them.
++ ptnodes_worklist.append(phantom_obj);
++ java_objects_worklist.append(phantom_obj);
+ for( uint next = 0; next < ideal_nodes.size(); ++next ) {
+ Node* n = ideal_nodes.at(next);
+ // Create PointsTo nodes and add them to Connection Graph. Called
+ // only once per ideal node since ideal_nodes is Unique_Node list.
+ add_node_to_connection_graph(n, &delayed_worklist);
+ PointsToNode* ptn = ptnode_adr(n->_idx);
+- if (ptn != NULL) {
++ if (ptn != NULL && ptn != phantom_obj) {
+ ptnodes_worklist.append(ptn);
+ if (ptn->is_JavaObject()) {
+ java_objects_worklist.append(ptn->as_JavaObject());
+@@ -395,7 +403,7 @@
+ }
+ case Op_CreateEx: {
+ // assume that all exception objects globally escape
+- add_java_object(n, PointsToNode::GlobalEscape);
++ map_ideal_node(n, phantom_obj);
+ break;
+ }
+ case Op_LoadKlass:
+@@ -1016,13 +1024,8 @@
+ // on graph complexity. Observed 8 passes in jvm2008 compiler.compiler.
+ // Set limit to 20 to catch situation when something did go wrong and
+ // bailout Escape Analysis.
+- // Also limit build time to 30 sec (60 in debug VM).
++ // Also limit build time to 20 sec (60 in debug VM), EscapeAnalysisTimeout flag.
+ #define CG_BUILD_ITER_LIMIT 20
+-#ifdef ASSERT
+-#define CG_BUILD_TIME_LIMIT 60.0
+-#else
+-#define CG_BUILD_TIME_LIMIT 30.0
+-#endif
+
+ // Propagate GlobalEscape and ArgEscape escape states and check that
+ // we still have non-escaping objects. The method pushs on _worklist
+@@ -1033,12 +1036,13 @@
+ // Now propagate references to all JavaObject nodes.
+ int java_objects_length = java_objects_worklist.length();
+ elapsedTimer time;
++ bool timeout = false;
+ int new_edges = 1;
+ int iterations = 0;
+ do {
+ while ((new_edges > 0) &&
+- (iterations++ < CG_BUILD_ITER_LIMIT) &&
+- (time.seconds() < CG_BUILD_TIME_LIMIT)) {
++ (iterations++ < CG_BUILD_ITER_LIMIT)) {
++ double start_time = time.seconds();
+ time.start();
+ new_edges = 0;
+ // Propagate references to phantom_object for nodes pushed on _worklist
+@@ -1047,7 +1051,26 @@
+ for (int next = 0; next < java_objects_length; ++next) {
+ JavaObjectNode* ptn = java_objects_worklist.at(next);
+ new_edges += add_java_object_edges(ptn, true);
++
++#define SAMPLE_SIZE 4
++ if ((next % SAMPLE_SIZE) == 0) {
++ // Each 4 iterations calculate how much time it will take
++ // to complete graph construction.
++ time.stop();
++ double stop_time = time.seconds();
++ double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE;
++ double time_until_end = time_per_iter * (double)(java_objects_length - next);
++ if ((start_time + time_until_end) >= EscapeAnalysisTimeout) {
++ timeout = true;
++ break; // Timeout
++ }
++ start_time = stop_time;
++ time.start();
++ }
++#undef SAMPLE_SIZE
++
+ }
++ if (timeout) break;
+ if (new_edges > 0) {
+ // Update escape states on each iteration if graph was updated.
+ if (!find_non_escaped_objects(ptnodes_worklist, non_escaped_worklist)) {
+@@ -1055,9 +1078,12 @@
+ }
+ }
+ time.stop();
++ if (time.seconds() >= EscapeAnalysisTimeout) {
++ timeout = true;
++ break;
++ }
+ }
+- if ((iterations < CG_BUILD_ITER_LIMIT) &&
+- (time.seconds() < CG_BUILD_TIME_LIMIT)) {
++ if ((iterations < CG_BUILD_ITER_LIMIT) && !timeout) {
+ time.start();
+ // Find fields which have unknown value.
+ int fields_length = oop_fields_worklist.length();
+@@ -1070,18 +1096,21 @@
+ }
+ }
+ time.stop();
++ if (time.seconds() >= EscapeAnalysisTimeout) {
++ timeout = true;
++ break;
++ }
+ } else {
+ new_edges = 0; // Bailout
+ }
+ } while (new_edges > 0);
+
+ // Bailout if passed limits.
+- if ((iterations >= CG_BUILD_ITER_LIMIT) ||
+- (time.seconds() >= CG_BUILD_TIME_LIMIT)) {
++ if ((iterations >= CG_BUILD_ITER_LIMIT) || timeout) {
+ Compile* C = _compile;
+ if (C->log() != NULL) {
+ C->log()->begin_elem("connectionGraph_bailout reason='reached ");
+- C->log()->text("%s", (iterations >= CG_BUILD_ITER_LIMIT) ? "iterations" : "time");
++ C->log()->text("%s", timeout ? "time" : "iterations");
+ C->log()->end_elem(" limit'");
+ }
+ assert(ExitEscapeAnalysisOnTimeout, err_msg_res("infinite EA connection graph build (%f sec, %d iterations) with %d nodes and worklist size %d",
+@@ -1098,7 +1127,6 @@
+ #endif
+
+ #undef CG_BUILD_ITER_LIMIT
+-#undef CG_BUILD_TIME_LIMIT
+
+ // Find fields initialized by NULL for non-escaping Allocations.
+ int non_escaped_length = non_escaped_worklist.length();
+@@ -1222,8 +1250,8 @@
+ }
+ }
+ }
+- while(_worklist.length() > 0) {
+- PointsToNode* use = _worklist.pop();
++ for (int l = 0; l < _worklist.length(); l++) {
++ PointsToNode* use = _worklist.at(l);
+ if (PointsToNode::is_base_use(use)) {
+ // Add reference from jobj to field and from field to jobj (field's base).
+ use = PointsToNode::get_use_node(use)->as_Field();
+@@ -1270,6 +1298,8 @@
+ add_field_uses_to_worklist(use->as_Field());
+ }
+ }
++ _worklist.clear();
++ _in_worklist.Reset();
+ return new_edges;
+ }
+
+@@ -1838,7 +1868,7 @@
+ return;
+ }
+ Compile* C = _compile;
+- ptadr = new (C->comp_arena()) LocalVarNode(C, n, es);
++ ptadr = new (C->comp_arena()) LocalVarNode(this, n, es);
+ _nodes.at_put(n->_idx, ptadr);
+ }
+
+@@ -1849,7 +1879,7 @@
+ return;
+ }
+ Compile* C = _compile;
+- ptadr = new (C->comp_arena()) JavaObjectNode(C, n, es);
++ ptadr = new (C->comp_arena()) JavaObjectNode(this, n, es);
+ _nodes.at_put(n->_idx, ptadr);
+ }
+
+@@ -1865,7 +1895,7 @@
+ es = PointsToNode::GlobalEscape;
+ }
+ Compile* C = _compile;
+- FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop);
++ FieldNode* field = new (C->comp_arena()) FieldNode(this, n, es, offset, is_oop);
+ _nodes.at_put(n->_idx, field);
+ }
+
+@@ -1879,7 +1909,7 @@
+ return;
+ }
+ Compile* C = _compile;
+- ptadr = new (C->comp_arena()) ArraycopyNode(C, n, es);
++ ptadr = new (C->comp_arena()) ArraycopyNode(this, n, es);
+ _nodes.at_put(n->_idx, ptadr);
+ // Add edge from arraycopy node to source object.
+ (void)add_edge(ptadr, src);
+--- ./hotspot/src/share/vm/opto/escape.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/escape.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -125,6 +125,8 @@
+ class FieldNode;
+ class ArraycopyNode;
+
++class ConnectionGraph;
++
+ // ConnectionGraph nodes
+ class PointsToNode : public ResourceObj {
+ GrowableArray<PointsToNode*> _edges; // List of nodes this node points to
+@@ -137,6 +139,7 @@
+
+ Node* const _node; // Ideal node corresponding to this PointsTo node.
+ const int _idx; // Cached ideal node's _idx
++ const uint _pidx; // Index of this node
+
+ public:
+ typedef enum {
+@@ -165,17 +168,9 @@
+ } NodeFlags;
+
+
+- PointsToNode(Compile *C, Node* n, EscapeState es, NodeType type):
+- _edges(C->comp_arena(), 2, 0, NULL),
+- _uses (C->comp_arena(), 2, 0, NULL),
+- _node(n),
+- _idx(n->_idx),
+- _type((u1)type),
+- _escape((u1)es),
+- _fields_escape((u1)es),
+- _flags(ScalarReplaceable) {
+- assert(n != NULL && es != UnknownEscape, "sanity");
+- }
++ inline PointsToNode(ConnectionGraph* CG, Node* n, EscapeState es, NodeType type);
++
++ uint pidx() const { return _pidx; }
+
+ Node* ideal_node() const { return _node; }
+ int idx() const { return _idx; }
+@@ -243,14 +238,14 @@
+
+ class LocalVarNode: public PointsToNode {
+ public:
+- LocalVarNode(Compile *C, Node* n, EscapeState es):
+- PointsToNode(C, n, es, LocalVar) {}
++ LocalVarNode(ConnectionGraph *CG, Node* n, EscapeState es):
++ PointsToNode(CG, n, es, LocalVar) {}
+ };
+
+ class JavaObjectNode: public PointsToNode {
+ public:
+- JavaObjectNode(Compile *C, Node* n, EscapeState es):
+- PointsToNode(C, n, es, JavaObject) {
++ JavaObjectNode(ConnectionGraph *CG, Node* n, EscapeState es):
++ PointsToNode(CG, n, es, JavaObject) {
+ if (es > NoEscape)
+ set_scalar_replaceable(false);
+ }
+@@ -262,8 +257,8 @@
+ const bool _is_oop; // Field points to object
+ bool _has_unknown_base; // Has phantom_object base
+ public:
+- FieldNode(Compile *C, Node* n, EscapeState es, int offs, bool is_oop):
+- PointsToNode(C, n, es, Field),
++ FieldNode(ConnectionGraph *CG, Node* n, EscapeState es, int offs, bool is_oop):
++ PointsToNode(CG, n, es, Field),
+ _offset(offs), _is_oop(is_oop),
+ _has_unknown_base(false) {}
+
+@@ -284,8 +279,8 @@
+
+ class ArraycopyNode: public PointsToNode {
+ public:
+- ArraycopyNode(Compile *C, Node* n, EscapeState es):
+- PointsToNode(C, n, es, Arraycopy) {}
++ ArraycopyNode(ConnectionGraph *CG, Node* n, EscapeState es):
++ PointsToNode(CG, n, es, Arraycopy) {}
+ };
+
+ // Iterators for PointsTo node's edges:
+@@ -323,11 +318,14 @@
+
+
+ class ConnectionGraph: public ResourceObj {
++ friend class PointsToNode;
+ private:
+ GrowableArray<PointsToNode*> _nodes; // Map from ideal nodes to
+ // ConnectionGraph nodes.
+
+ GrowableArray<PointsToNode*> _worklist; // Nodes to be processed
++ VectorSet _in_worklist;
++ uint _next_pidx;
+
+ bool _collecting; // Indicates whether escape information
+ // is still being collected. If false,
+@@ -353,6 +351,8 @@
+ }
+ uint nodes_size() const { return _nodes.length(); }
+
++ uint next_pidx() { return _next_pidx++; }
++
+ // Add nodes to ConnectionGraph.
+ void add_local_var(Node* n, PointsToNode::EscapeState es);
+ void add_java_object(Node* n, PointsToNode::EscapeState es);
+@@ -396,15 +396,26 @@
+ int add_java_object_edges(JavaObjectNode* jobj, bool populate_worklist);
+
+ // Put node on worklist if it is (or was) not there.
+- void add_to_worklist(PointsToNode* pt) {
+- _worklist.push(pt);
+- return;
++ inline void add_to_worklist(PointsToNode* pt) {
++ PointsToNode* ptf = pt;
++ uint pidx_bias = 0;
++ if (PointsToNode::is_base_use(pt)) {
++ // Create a separate entry in _in_worklist for a marked base edge
++ // because _worklist may have an entry for a normal edge pointing
++ // to the same node. To separate them use _next_pidx as bias.
++ ptf = PointsToNode::get_use_node(pt)->as_Field();
++ pidx_bias = _next_pidx;
++ }
++ if (!_in_worklist.test_set(ptf->pidx() + pidx_bias)) {
++ _worklist.append(pt);
++ }
+ }
+
+ // Put on worklist all uses of this node.
+- void add_uses_to_worklist(PointsToNode* pt) {
+- for (UseIterator i(pt); i.has_next(); i.next())
+- _worklist.push(i.get());
++ inline void add_uses_to_worklist(PointsToNode* pt) {
++ for (UseIterator i(pt); i.has_next(); i.next()) {
++ add_to_worklist(i.get());
++ }
+ }
+
+ // Put on worklist all field's uses and related field nodes.
+@@ -517,8 +528,8 @@
+ }
+ // Helper functions
+ bool is_oop_field(Node* n, int offset, bool* unsafe);
+- static Node* get_addp_base(Node *addp);
+- static Node* find_second_addp(Node* addp, Node* n);
++ static Node* get_addp_base(Node *addp);
++ static Node* find_second_addp(Node* addp, Node* n);
+ // offset of a field reference
+ int address_offset(Node* adr, PhaseTransform *phase);
+
+@@ -587,4 +598,17 @@
+ #endif
+ };
+
++inline PointsToNode::PointsToNode(ConnectionGraph *CG, Node* n, EscapeState es, NodeType type):
++ _edges(CG->_compile->comp_arena(), 2, 0, NULL),
++ _uses (CG->_compile->comp_arena(), 2, 0, NULL),
++ _node(n),
++ _idx(n->_idx),
++ _pidx(CG->next_pidx()),
++ _type((u1)type),
++ _escape((u1)es),
++ _fields_escape((u1)es),
++ _flags(ScalarReplaceable) {
++ assert(n != NULL && es != UnknownEscape, "sanity");
++}
++
+ #endif // SHARE_VM_OPTO_ESCAPE_HPP
+--- ./hotspot/src/share/vm/opto/graphKit.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/graphKit.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -2746,17 +2746,23 @@
+ }
+
+ Node* cast_obj = NULL;
+- if (data != NULL &&
+- // Counter has never been decremented (due to cast failure).
+- // ...This is a reasonable thing to expect. It is true of
+- // all casts inserted by javac to implement generic types.
+- data->as_CounterData()->count() >= 0) {
+- cast_obj = maybe_cast_profiled_receiver(not_null_obj, data, tk->klass());
+- if (cast_obj != NULL) {
+- if (failure_control != NULL) // failure is now impossible
+- (*failure_control) = top();
+- // adjust the type of the phi to the exact klass:
+- phi->raise_bottom_type(_gvn.type(cast_obj)->meet(TypePtr::NULL_PTR));
++ if (tk->klass_is_exact()) {
++ // The following optimization tries to statically cast the speculative type of the object
++ // (for example obtained during profiling) to the type of the superklass and then do a
++ // dynamic check that the type of the object is what we expect. To work correctly
++ // for checkcast and aastore the type of superklass should be exact.
++ if (data != NULL &&
++ // Counter has never been decremented (due to cast failure).
++ // ...This is a reasonable thing to expect. It is true of
++ // all casts inserted by javac to implement generic types.
++ data->as_CounterData()->count() >= 0) {
++ cast_obj = maybe_cast_profiled_receiver(not_null_obj, data, tk->klass());
++ if (cast_obj != NULL) {
++ if (failure_control != NULL) // failure is now impossible
++ (*failure_control) = top();
++ // adjust the type of the phi to the exact klass:
++ phi->raise_bottom_type(_gvn.type(cast_obj)->meet(TypePtr::NULL_PTR));
++ }
+ }
+ }
+
+--- ./hotspot/src/share/vm/opto/ifg.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/ifg.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -571,15 +571,35 @@
+ if( !n->is_Proj() ||
+ // Could also be a flags-projection of a dead ADD or such.
+ (n2lidx(def) && !liveout.member(n2lidx(def)) ) ) {
+- b->_nodes.remove(j - 1);
+- if( lrgs(r)._def == n ) lrgs(r)._def = 0;
+- n->disconnect_inputs(NULL, C);
+- _cfg._bbs.map(n->_idx,NULL);
+- n->replace_by(C->top());
+- // Since yanking a Node from block, high pressure moves up one
+- hrp_index[0]--;
+- hrp_index[1]--;
+- continue;
++ bool remove = true;
++ if (n->is_MachProj()) {
++ // Don't remove KILL projections if their "defining" nodes have
++ // memory effects (have SCMemProj projection node) -
++ // they are not dead even when their result is not used.
++ // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes.
++ // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list)
++ // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed
++ // in block in such order that KILL MachProj nodes are processed first.
++ uint cnt = def->outcnt();
++ for (uint i = 0; i < cnt; i++) {
++ Node* proj = def->raw_out(i);
++ if (proj->Opcode() == Op_SCMemProj) {
++ remove = false;
++ break;
++ }
++ }
++ }
++ if (remove) {
++ b->_nodes.remove(j - 1);
++ if( lrgs(r)._def == n ) lrgs(r)._def = 0;
++ n->disconnect_inputs(NULL, C);
++ _cfg._bbs.map(n->_idx,NULL);
++ n->replace_by(C->top());
++ // Since yanking a Node from block, high pressure moves up one
++ hrp_index[0]--;
++ hrp_index[1]--;
++ continue;
++ }
+ }
+
+ // Fat-projections kill many registers which cannot be used to
+--- ./hotspot/src/share/vm/opto/ifnode.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/ifnode.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -819,6 +819,11 @@
+
+ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff);
+
++struct RangeCheck {
++ Node* ctl;
++ jint off;
++};
++
+ //------------------------------Ideal------------------------------------------
+ // Return a node which is more "ideal" than the current node. Strip out
+ // control copies
+@@ -860,83 +865,141 @@
+ jint offset1;
+ int flip1 = is_range_check(range1, index1, offset1);
+ if( flip1 ) {
+- Node *first_prev_dom = NULL;
+-
+ // Try to remove extra range checks. All 'up_one_dom' gives up at merges
+ // so all checks we inspect post-dominate the top-most check we find.
+ // If we are going to fail the current check and we reach the top check
+ // then we are guaranteed to fail, so just start interpreting there.
+- // We 'expand' the top 2 range checks to include all post-dominating
++ // We 'expand' the top 3 range checks to include all post-dominating
+ // checks.
+
+- // The top 2 range checks seen
+- Node *prev_chk1 = NULL;
+- Node *prev_chk2 = NULL;
++ // The top 3 range checks seen
++ const int NRC =3;
++ RangeCheck prev_checks[NRC];
++ int nb_checks = 0;
++
+ // Low and high offsets seen so far
+ jint off_lo = offset1;
+ jint off_hi = offset1;
+
+- // Scan for the top 2 checks and collect range of offsets
+- for( int dist = 0; dist < 999; dist++ ) { // Range-Check scan limit
+- if( dom->Opcode() == Op_If && // Not same opcode?
+- prev_dom->in(0) == dom ) { // One path of test does dominate?
+- if( dom == this ) return NULL; // dead loop
++ bool found_immediate_dominator = false;
++
++ // Scan for the top checks and collect range of offsets
++ for (int dist = 0; dist < 999; dist++) { // Range-Check scan limit
++ if (dom->Opcode() == Op_If && // Not same opcode?
++ prev_dom->in(0) == dom) { // One path of test does dominate?
++ if (dom == this) return NULL; // dead loop
+ // See if this is a range check
+ Node *index2, *range2;
+ jint offset2;
+ int flip2 = dom->as_If()->is_range_check(range2, index2, offset2);
+ // See if this is a _matching_ range check, checking against
+ // the same array bounds.
+- if( flip2 == flip1 && range2 == range1 && index2 == index1 &&
+- dom->outcnt() == 2 ) {
++ if (flip2 == flip1 && range2 == range1 && index2 == index1 &&
++ dom->outcnt() == 2) {
++ if (nb_checks == 0 && dom->in(1) == in(1)) {
++ // Found an immediately dominating test at the same offset.
++ // This kind of back-to-back test can be eliminated locally,
++ // and there is no need to search further for dominating tests.
++ assert(offset2 == offset1, "Same test but different offsets");
++ found_immediate_dominator = true;
++ break;
++ }
+ // Gather expanded bounds
+ off_lo = MIN2(off_lo,offset2);
+ off_hi = MAX2(off_hi,offset2);
+- // Record top 2 range checks
+- prev_chk2 = prev_chk1;
+- prev_chk1 = prev_dom;
+- // If we match the test exactly, then the top test covers
+- // both our lower and upper bounds.
+- if( dom->in(1) == in(1) )
+- prev_chk2 = prev_chk1;
++ // Record top NRC range checks
++ prev_checks[nb_checks%NRC].ctl = prev_dom;
++ prev_checks[nb_checks%NRC].off = offset2;
++ nb_checks++;
+ }
+ }
+ prev_dom = dom;
+- dom = up_one_dom( dom );
+- if( !dom ) break;
++ dom = up_one_dom(dom);
++ if (!dom) break;
+ }
+
++ if (!found_immediate_dominator) {
++ // Attempt to widen the dominating range check to cover some later
++ // ones. Since range checks "fail" by uncommon-trapping to the
++ // interpreter, widening a check can make us speculatively enter
++ // the interpreter. If we see range-check deopt's, do not widen!
++ if (!phase->C->allow_range_check_smearing()) return NULL;
+
+- // Attempt to widen the dominating range check to cover some later
+- // ones. Since range checks "fail" by uncommon-trapping to the
+- // interpreter, widening a check can make us speculative enter the
+- // interpreter. If we see range-check deopt's, do not widen!
+- if (!phase->C->allow_range_check_smearing()) return NULL;
+-
+- // Constant indices only need to check the upper bound.
+- // Non-constance indices must check both low and high.
+- if( index1 ) {
+- // Didn't find 2 prior covering checks, so cannot remove anything.
+- if( !prev_chk2 ) return NULL;
+- // 'Widen' the offsets of the 1st and 2nd covering check
+- adjust_check( prev_chk1, range1, index1, flip1, off_lo, igvn );
+- // Do not call adjust_check twice on the same projection
+- // as the first call may have transformed the BoolNode to a ConI
+- if( prev_chk1 != prev_chk2 ) {
+- adjust_check( prev_chk2, range1, index1, flip1, off_hi, igvn );
++ // Didn't find prior covering check, so cannot remove anything.
++ if (nb_checks == 0) {
++ return NULL;
+ }
+- // Test is now covered by prior checks, dominate it out
+- prev_dom = prev_chk2;
+- } else {
+- // Didn't find prior covering check, so cannot remove anything.
+- if( !prev_chk1 ) return NULL;
+- // 'Widen' the offset of the 1st and only covering check
+- adjust_check( prev_chk1, range1, index1, flip1, off_hi, igvn );
+- // Test is now covered by prior checks, dominate it out
+- prev_dom = prev_chk1;
++ // Constant indices only need to check the upper bound.
++ // Non-constant indices must check both low and high.
++ int chk0 = (nb_checks - 1) % NRC;
++ if (index1) {
++ if (nb_checks == 1) {
++ return NULL;
++ } else {
++ // If the top range check's constant is the min or max of
++ // all constants we widen the next one to cover the whole
++ // range of constants.
++ RangeCheck rc0 = prev_checks[chk0];
++ int chk1 = (nb_checks - 2) % NRC;
++ RangeCheck rc1 = prev_checks[chk1];
++ if (rc0.off == off_lo) {
++ adjust_check(rc1.ctl, range1, index1, flip1, off_hi, igvn);
++ prev_dom = rc1.ctl;
++ } else if (rc0.off == off_hi) {
++ adjust_check(rc1.ctl, range1, index1, flip1, off_lo, igvn);
++ prev_dom = rc1.ctl;
++ } else {
++ // If the top test's constant is not the min or max of all
++ // constants, we need 3 range checks. We must leave the
++ // top test unchanged because widening it would allow the
++ // accesses it protects to successfully read/write out of
++ // bounds.
++ if (nb_checks == 2) {
++ return NULL;
++ }
++ int chk2 = (nb_checks - 3) % NRC;
++ RangeCheck rc2 = prev_checks[chk2];
++ // The top range check a+i covers interval: -a <= i < length-a
++ // The second range check b+i covers interval: -b <= i < length-b
++ if (rc1.off <= rc0.off) {
++ // if b <= a, we change the second range check to:
++ // -min_of_all_constants <= i < length-min_of_all_constants
++ // Together top and second range checks now cover:
++ // -min_of_all_constants <= i < length-a
++ // which is more restrictive than -b <= i < length-b:
++ // -b <= -min_of_all_constants <= i < length-a <= length-b
++ // The third check is then changed to:
++ // -max_of_all_constants <= i < length-max_of_all_constants
++ // so 2nd and 3rd checks restrict allowed values of i to:
++ // -min_of_all_constants <= i < length-max_of_all_constants
++ adjust_check(rc1.ctl, range1, index1, flip1, off_lo, igvn);
++ adjust_check(rc2.ctl, range1, index1, flip1, off_hi, igvn);
++ } else {
++ // if b > a, we change the second range check to:
++ // -max_of_all_constants <= i < length-max_of_all_constants
++ // Together top and second range checks now cover:
++ // -a <= i < length-max_of_all_constants
++ // which is more restrictive than -b <= i < length-b:
++ // -b < -a <= i < length-max_of_all_constants <= length-b
++ // The third check is then changed to:
++ // -max_of_all_constants <= i < length-max_of_all_constants
++ // so 2nd and 3rd checks restrict allowed values of i to:
++ // -min_of_all_constants <= i < length-max_of_all_constants
++ adjust_check(rc1.ctl, range1, index1, flip1, off_hi, igvn);
++ adjust_check(rc2.ctl, range1, index1, flip1, off_lo, igvn);
++ }
++ prev_dom = rc2.ctl;
++ }
++ }
++ } else {
++ RangeCheck rc0 = prev_checks[chk0];
++ // 'Widen' the offset of the 1st and only covering check
++ adjust_check(rc0.ctl, range1, index1, flip1, off_hi, igvn);
++ // Test is now covered by prior checks, dominate it out
++ prev_dom = rc0.ctl;
++ }
+ }
+
+-
+ } else { // Scan for an equivalent test
+
+ Node *cmp;
+--- ./hotspot/src/share/vm/opto/library_call.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/library_call.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -201,7 +201,7 @@
+ bool inline_math(vmIntrinsics::ID id);
+ bool inline_exp();
+ bool inline_pow();
+- void finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName);
++ Node* finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName);
+ bool inline_min_max(vmIntrinsics::ID id);
+ Node* generate_min_max(vmIntrinsics::ID id, Node* x, Node* y);
+ // This returns Type::AnyPtr, RawPtr, or OopPtr.
+@@ -1580,7 +1580,7 @@
+ return true;
+ }
+
+-void LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName) {
++Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeFunc* call_type, address funcAddr, const char* funcName) {
+ //-------------------
+ //result=(result.isNaN())? funcAddr():result;
+ // Check: If isNaN() by checking result!=result? then either trap
+@@ -1596,7 +1596,7 @@
+ uncommon_trap(Deoptimization::Reason_intrinsic,
+ Deoptimization::Action_make_not_entrant);
+ }
+- set_result(result);
++ return result;
+ } else {
+ // If this inlining ever returned NaN in the past, we compile a call
+ // to the runtime to properly handle corner cases
+@@ -1626,9 +1626,10 @@
+
+ result_region->init_req(2, control());
+ result_val->init_req(2, value);
+- set_result(result_region, result_val);
++ set_control(_gvn.transform(result_region));
++ return _gvn.transform(result_val);
+ } else {
+- set_result(result);
++ return result;
+ }
+ }
+ }
+@@ -1640,7 +1641,8 @@
+ Node* arg = round_double_node(argument(0));
+ Node* n = _gvn.transform(new (C) ExpDNode(C, control(), arg));
+
+- finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
++ n = finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
++ set_result(n);
+
+ C->set_has_split_ifs(true); // Has chance for split-if optimization
+ return true;
+@@ -1650,27 +1652,48 @@
+ // Inline power instructions, if possible.
+ bool LibraryCallKit::inline_pow() {
+ // Pseudocode for pow
+- // if (x <= 0.0) {
+- // long longy = (long)y;
+- // if ((double)longy == y) { // if y is long
+- // if (y + 1 == y) longy = 0; // huge number: even
+- // result = ((1&longy) == 0)?-DPow(abs(x), y):DPow(abs(x), y);
++ // if (y == 2) {
++ // return x * x;
++ // } else {
++ // if (x <= 0.0) {
++ // long longy = (long)y;
++ // if ((double)longy == y) { // if y is long
++ // if (y + 1 == y) longy = 0; // huge number: even
++ // result = ((1&longy) == 0)?-DPow(abs(x), y):DPow(abs(x), y);
++ // } else {
++ // result = NaN;
++ // }
+ // } else {
+- // result = NaN;
++ // result = DPow(x,y);
+ // }
+- // } else {
+- // result = DPow(x,y);
++ // if (result != result)? {
++ // result = uncommon_trap() or runtime_call();
++ // }
++ // return result;
+ // }
+- // if (result != result)? {
+- // result = uncommon_trap() or runtime_call();
+- // }
+- // return result;
+
+ Node* x = round_double_node(argument(0));
+ Node* y = round_double_node(argument(2));
+
+ Node* result = NULL;
+
++ Node* const_two_node = makecon(TypeD::make(2.0));
++ Node* cmp_node = _gvn.transform(new (C) CmpDNode(y, const_two_node));
++ Node* bool_node = _gvn.transform(new (C) BoolNode(cmp_node, BoolTest::eq));
++ IfNode* if_node = create_and_xform_if(control(), bool_node, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN);
++ Node* if_true = _gvn.transform(new (C) IfTrueNode(if_node));
++ Node* if_false = _gvn.transform(new (C) IfFalseNode(if_node));
++
++ RegionNode* region_node = new (C) RegionNode(3);
++ region_node->init_req(1, if_true);
++
++ Node* phi_node = new (C) PhiNode(region_node, Type::DOUBLE);
++ // special case for x^y where y == 2, we can convert it to x * x
++ phi_node->init_req(1, _gvn.transform(new (C) MulDNode(x, x)));
++
++ // set control to if_false since we will now process the false branch
++ set_control(if_false);
++
+ if (!too_many_traps(Deoptimization::Reason_intrinsic)) {
+ // Short form: skip the fancy tests and just check for NaN result.
+ result = _gvn.transform(new (C) PowDNode(C, control(), x, y));
+@@ -1794,7 +1817,15 @@
+ result = _gvn.transform(phi);
+ }
+
+- finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
++ result = finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
++
++ // control from finish_pow_exp is now input to the region node
++ region_node->set_req(2, control());
++ // the result from finish_pow_exp is now input to the phi node
++ phi_node->init_req(2, result);
++ set_control(_gvn.transform(region_node));
++ record_for_igvn(region_node);
++ set_result(_gvn.transform(phi_node));
+
+ C->set_has_split_ifs(true); // Has chance for split-if optimization
+ return true;
+--- ./hotspot/src/share/vm/opto/loopTransform.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/loopTransform.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -863,6 +863,20 @@
+ return n;
+ }
+
++bool PhaseIdealLoop::cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop) {
++ Node* castii = new (C) CastIINode(incr, TypeInt::INT, true);
++ castii->set_req(0, ctrl);
++ register_new_node(castii, ctrl);
++ for (DUIterator_Fast imax, i = incr->fast_outs(imax); i < imax; i++) {
++ Node* n = incr->fast_out(i);
++ if (n->is_Phi() && n->in(0) == loop) {
++ int nrep = n->replace_edge(incr, castii);
++ return true;
++ }
++ }
++ return false;
++}
++
+ //------------------------------insert_pre_post_loops--------------------------
+ // Insert pre and post loops. If peel_only is set, the pre-loop can not have
+ // more iterations added. It acts as a 'peel' only, no lower-bound RCE, no
+@@ -1060,6 +1074,24 @@
+ }
+ }
+
++ // Nodes inside the loop may be control dependent on a predicate
++ // that was moved before the preloop. If the back branch of the main
++ // or post loops becomes dead, those nodes won't be dependent on the
++ // test that guards that loop nest anymore which could lead to an
++ // incorrect array access because it executes independently of the
++ // test that was guarding the loop nest. We add a special CastII on
++ // the if branch that enters the loop, between the input induction
++ // variable value and the induction variable Phi to preserve correct
++ // dependencies.
++
++ // CastII for the post loop:
++ bool inserted = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
++ assert(inserted, "no castII inserted");
++
++ // CastII for the main loop:
++ inserted = cast_incr_before_loop(pre_incr, min_taken, main_head);
++ assert(inserted, "no castII inserted");
++
+ // Step B4: Shorten the pre-loop to run only 1 iteration (for now).
+ // RCE and alignment may change this later.
+ Node *cmp_end = pre_end->cmp_node();
+--- ./hotspot/src/share/vm/opto/loopnode.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/loopnode.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -602,6 +602,8 @@
+ return ctrl;
+ }
+
++ bool cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop);
++
+ public:
+ bool has_node( Node* n ) const { return _nodes[n->_idx] != NULL; }
+ // check if transform created new nodes that need _ctrl recorded
+--- ./hotspot/src/share/vm/opto/loopopts.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/loopopts.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -234,8 +234,13 @@
+ // for lower and upper bounds.
+ ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj();
+ if (exclude_loop_predicate &&
+- is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate))
++ (is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate) ||
++ is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_range_check))) {
++ // If this is a range check (IfNode::is_range_check), do not
++ // reorder because Compile::allow_range_check_smearing might have
++ // changed the check.
+ return; // Let IGVN transformation change control dependence.
++ }
+
+ IdealLoopTree *old_loop = get_loop(dp);
+
+@@ -888,23 +893,23 @@
+ int n_op = n->Opcode();
+
+ // Check for an IF being dominated by another IF same test
+- if( n_op == Op_If ) {
++ if (n_op == Op_If) {
+ Node *bol = n->in(1);
+ uint max = bol->outcnt();
+ // Check for same test used more than once?
+- if( n_op == Op_If && max > 1 && bol->is_Bool() ) {
++ if (max > 1 && bol->is_Bool()) {
+ // Search up IDOMs to see if this IF is dominated.
+ Node *cutoff = get_ctrl(bol);
+
+ // Now search up IDOMs till cutoff, looking for a dominating test
+ Node *prevdom = n;
+ Node *dom = idom(prevdom);
+- while( dom != cutoff ) {
+- if( dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom ) {
++ while (dom != cutoff) {
++ if (dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom) {
+ // Replace the dominated test with an obvious true or false.
+ // Place it on the IGVN worklist for later cleanup.
+ C->set_major_progress();
+- dominated_by( prevdom, n, false, true );
++ dominated_by(prevdom, n, false, true);
+ #ifndef PRODUCT
+ if( VerifyLoopOptimizations ) verify();
+ #endif
+@@ -1393,7 +1398,8 @@
+ // loop. Happens if people set a loop-exit flag; then test the flag
+ // in the loop to break the loop, then test is again outside of the
+ // loop to determine which way the loop exited.
+- if( use->is_If() || use->is_CMove() ) {
++ // Loop predicate If node connects to Bool node through Opaque1 node.
++ if (use->is_If() || use->is_CMove() || C->is_predicate_opaq(use)) {
+ // Since this code is highly unlikely, we lazily build the worklist
+ // of such Nodes to go split.
+ if( !split_if_set )
+@@ -2754,11 +2760,11 @@
+ // Hit! Refactor use to use the post-incremented tripcounter.
+ // Compute a post-increment tripcounter.
+ Node *opaq = new (C) Opaque2Node( C, cle->incr() );
+- register_new_node( opaq, u_ctrl );
++ register_new_node(opaq, exit);
+ Node *neg_stride = _igvn.intcon(-cle->stride_con());
+ set_ctrl(neg_stride, C->root());
+ Node *post = new (C) AddINode( opaq, neg_stride);
+- register_new_node( post, u_ctrl );
++ register_new_node(post, exit);
+ _igvn.rehash_node_delayed(use);
+ for (uint j = 1; j < use->req(); j++) {
+ if (use->in(j) == phi)
+--- ./hotspot/src/share/vm/opto/parse.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/parse.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -528,8 +528,9 @@
+
+ float dynamic_branch_prediction(float &cnt);
+ float branch_prediction(float &cnt, BoolTest::mask btest, int target_bci);
+- bool seems_never_taken(float prob);
+- bool seems_stable_comparison(BoolTest::mask btest, Node* c);
++ bool seems_never_taken(float prob) const;
++ bool path_is_suitable_for_uncommon_trap(float prob) const;
++ bool seems_stable_comparison() const;
+
+ void do_ifnull(BoolTest::mask btest, Node* c);
+ void do_if(BoolTest::mask btest, Node* c);
+--- ./hotspot/src/share/vm/opto/parse2.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/parse2.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -884,7 +884,7 @@
+ // some branches (e.g., _213_javac.Assembler.eliminate) validly produce
+ // very small but nonzero probabilities, which if confused with zero
+ // counts would keep the program recompiling indefinitely.
+-bool Parse::seems_never_taken(float prob) {
++bool Parse::seems_never_taken(float prob) const {
+ return prob < PROB_MIN;
+ }
+
+@@ -895,53 +895,12 @@
+ // if a path is never taken, its controlling comparison is
+ // already acting in a stable fashion. If the comparison
+ // seems stable, we will put an expensive uncommon trap
+-// on the untaken path. To be conservative, and to allow
+-// partially executed counted loops to be compiled fully,
+-// we will plant uncommon traps only after pointer comparisons.
+-bool Parse::seems_stable_comparison(BoolTest::mask btest, Node* cmp) {
+- for (int depth = 4; depth > 0; depth--) {
+- // The following switch can find CmpP here over half the time for
+- // dynamic language code rich with type tests.
+- // Code using counted loops or array manipulations (typical
+- // of benchmarks) will have many (>80%) CmpI instructions.
+- switch (cmp->Opcode()) {
+- case Op_CmpP:
+- // A never-taken null check looks like CmpP/BoolTest::eq.
+- // These certainly should be closed off as uncommon traps.
+- if (btest == BoolTest::eq)
+- return true;
+- // A never-failed type check looks like CmpP/BoolTest::ne.
+- // Let's put traps on those, too, so that we don't have to compile
+- // unused paths with indeterminate dynamic type information.
+- if (ProfileDynamicTypes)
+- return true;
+- return false;
+-
+- case Op_CmpI:
+- // A small minority (< 10%) of CmpP are masked as CmpI,
+- // as if by boolean conversion ((p == q? 1: 0) != 0).
+- // Detect that here, even if it hasn't optimized away yet.
+- // Specifically, this covers the 'instanceof' operator.
+- if (btest == BoolTest::ne || btest == BoolTest::eq) {
+- if (_gvn.type(cmp->in(2))->singleton() &&
+- cmp->in(1)->is_Phi()) {
+- PhiNode* phi = cmp->in(1)->as_Phi();
+- int true_path = phi->is_diamond_phi();
+- if (true_path > 0 &&
+- _gvn.type(phi->in(1))->singleton() &&
+- _gvn.type(phi->in(2))->singleton()) {
+- // phi->region->if_proj->ifnode->bool->cmp
+- BoolNode* bol = phi->in(0)->in(1)->in(0)->in(1)->as_Bool();
+- btest = bol->_test._test;
+- cmp = bol->in(1);
+- continue;
+- }
+- }
+- }
+- return false;
+- }
++// on the untaken path.
++bool Parse::seems_stable_comparison() const {
++ if (C->too_many_traps(method(), bci(), Deoptimization::Reason_unstable_if)) {
++ return false;
+ }
+- return false;
++ return true;
+ }
+
+ //-------------------------------repush_if_args--------------------------------
+@@ -1166,6 +1125,14 @@
+ }
+ }
+
++bool Parse::path_is_suitable_for_uncommon_trap(float prob) const {
++ // Don't want to speculate on uncommon traps when running with -Xcomp
++ if (!UseInterpreter) {
++ return false;
++ }
++ return (seems_never_taken(prob) && seems_stable_comparison());
++}
++
+ //----------------------------adjust_map_after_if------------------------------
+ // Adjust the JVM state to reflect the result of taking this path.
+ // Basically, it means inspecting the CmpNode controlling this
+@@ -1179,33 +1146,9 @@
+
+ bool is_fallthrough = (path == successor_for_bci(iter().next_bci()));
+
+- if (seems_never_taken(prob) && seems_stable_comparison(btest, c)) {
+- // If this might possibly turn into an implicit null check,
+- // and the null has never yet been seen, we need to generate
+- // an uncommon trap, so as to recompile instead of suffering
+- // with very slow branches. (We'll get the slow branches if
+- // the program ever changes phase and starts seeing nulls here.)
+- //
+- // We do not inspect for a null constant, since a node may
+- // optimize to 'null' later on.
+- //
+- // Null checks, and other tests which expect inequality,
+- // show btest == BoolTest::eq along the non-taken branch.
+- // On the other hand, type tests, must-be-null tests,
+- // and other tests which expect pointer equality,
+- // show btest == BoolTest::ne along the non-taken branch.
+- // We prune both types of branches if they look unused.
++ if (path_is_suitable_for_uncommon_trap(prob)) {
+ repush_if_args();
+- // We need to mark this branch as taken so that if we recompile we will
+- // see that it is possible. In the tiered system the interpreter doesn't
+- // do profiling and by the time we get to the lower tier from the interpreter
+- // the path may be cold again. Make sure it doesn't look untaken
+- if (is_fallthrough) {
+- profile_not_taken_branch(!ProfileInterpreter);
+- } else {
+- profile_taken_branch(iter().get_dest(), !ProfileInterpreter);
+- }
+- uncommon_trap(Deoptimization::Reason_unreached,
++ uncommon_trap(Deoptimization::Reason_unstable_if,
+ Deoptimization::Action_reinterpret,
+ NULL,
+ (is_fallthrough ? "taken always" : "taken never"));
+--- ./hotspot/src/share/vm/opto/phaseX.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/phaseX.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1323,15 +1323,27 @@
+ }
+ }
+
+- if( use->is_Cmp() ) { // Enable CMP/BOOL optimization
++ uint use_op = use->Opcode();
++ if(use->is_Cmp()) { // Enable CMP/BOOL optimization
+ add_users_to_worklist(use); // Put Bool on worklist
+- // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
+- // phi merging either 0 or 1 onto the worklist
+ if (use->outcnt() > 0) {
+ Node* bol = use->raw_out(0);
+ if (bol->outcnt() > 0) {
+ Node* iff = bol->raw_out(0);
+- if (iff->outcnt() == 2) {
++ if (use_op == Op_CmpI &&
++ iff->is_CountedLoopEnd()) {
++ CountedLoopEndNode* cle = iff->as_CountedLoopEnd();
++ if (cle->limit() == n && cle->phi() != NULL) {
++ // If an opaque node feeds into the limit condition of a
++ // CountedLoop, we need to process the Phi node for the
++ // induction variable when the opaque node is removed:
++ // the range of values taken by the Phi is now known and
++ // so its type is also known.
++ _worklist.push(cle->phi());
++ }
++ } else if (iff->outcnt() == 2) {
++ // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
++ // phi merging either 0 or 1 onto the worklist
+ Node* ifproj0 = iff->raw_out(0);
+ Node* ifproj1 = iff->raw_out(1);
+ if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
+@@ -1343,9 +1355,26 @@
+ }
+ }
+ }
++ if (use_op == Op_CmpI) {
++ Node* in1 = use->in(1);
++ for (uint i = 0; i < in1->outcnt(); i++) {
++ if (in1->raw_out(i)->Opcode() == Op_CastII) {
++ Node* castii = in1->raw_out(i);
++ if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
++ Node* ifnode = castii->in(0)->in(0);
++ if (ifnode->in(1) != NULL && ifnode->in(1)->is_Bool() && ifnode->in(1)->in(1) == use) {
++ // Reprocess a CastII node that may depend on an
++ // opaque node value when the opaque node is
++ // removed. In case it carries a dependency we can do
++ // a better job of computing its type.
++ _worklist.push(castii);
++ }
++ }
++ }
++ }
++ }
+ }
+
+- uint use_op = use->Opcode();
+ // If changed Cast input, check Phi users for simple cycles
+ if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
+ for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
+--- ./hotspot/src/share/vm/opto/subnode.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/subnode.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1066,12 +1066,10 @@
+
+ //------------------------------dump_spec-------------------------------------
+ // Print special per-node info
+-#ifndef PRODUCT
+ void BoolTest::dump_on(outputStream *st) const {
+ const char *msg[] = {"eq","gt","??","lt","ne","le","??","ge"};
+ st->print(msg[_test]);
+ }
+-#endif
+
+ //=============================================================================
+ uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); }
+--- ./hotspot/src/share/vm/opto/subnode.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/opto/subnode.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -273,9 +273,7 @@
+ mask commute( ) const { return mask("038147858"[_test]-'0'); }
+ mask negate( ) const { return mask(_test^4); }
+ bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le); }
+-#ifndef PRODUCT
+ void dump_on(outputStream *st) const;
+-#endif
+ };
+
+ //------------------------------BoolNode---------------------------------------
+--- ./hotspot/src/share/vm/prims/jvm.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/prims/jvm.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -597,12 +597,12 @@
+
+ // Make shallow object copy
+ const int size = obj->size();
+- oop new_obj = NULL;
++ oop new_obj_oop = NULL;
+ if (obj->is_javaArray()) {
+ const int length = ((arrayOop)obj())->length();
+- new_obj = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
++ new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
+ } else {
+- new_obj = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
++ new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
+ }
+ // 4839641 (4840070): We must do an oop-atomic copy, because if another thread
+ // is modifying a reference field in the clonee, a non-oop-atomic copy might
+@@ -614,24 +614,39 @@
+ // The same is true of StubRoutines::object_copy and the various oop_copy
+ // variants, and of the code generated by the inline_native_clone intrinsic.
+ assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned");
+- Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj,
++ Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj_oop,
+ (size_t)align_object_size(size) / HeapWordsPerLong);
+ // Clear the header
+- new_obj->init_mark();
++ new_obj_oop->init_mark();
+
+ // Store check (mark entire object and let gc sort it out)
+ BarrierSet* bs = Universe::heap()->barrier_set();
+ assert(bs->has_write_region_opt(), "Barrier set does not have write_region");
+- bs->write_region(MemRegion((HeapWord*)new_obj, size));
++ bs->write_region(MemRegion((HeapWord*)new_obj_oop, size));
++
++ Handle new_obj(THREAD, new_obj_oop);
++ // Special handling for MemberNames. Since they contain Method* metadata, they
++ // must be registered so that RedefineClasses can fix metadata contained in them.
++ if (java_lang_invoke_MemberName::is_instance(new_obj()) &&
++ java_lang_invoke_MemberName::is_method(new_obj())) {
++ methodOop method = (methodOop)java_lang_invoke_MemberName::vmtarget(new_obj());
++ // MemberName may be unresolved, so doesn't need registration until resolved.
++ if (method != NULL) {
++ // add_member_name() can safepoint: use Handle for method and new_obj:
++ methodHandle m(THREAD, method);
++ instanceKlass::cast(m->method_holder())->add_member_name(new_obj);
++ }
++ }
+
+ // Caution: this involves a java upcall, so the clone should be
+ // "gc-robust" by this stage.
+ if (klass->has_finalizer()) {
+ assert(obj->is_instance(), "should be instanceOop");
+- new_obj = instanceKlass::register_finalizer(instanceOop(new_obj), CHECK_NULL);
++ new_obj_oop = instanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
++ new_obj = Handle(THREAD, new_obj_oop);
+ }
+
+- return JNIHandles::make_local(env, oop(new_obj));
++ return JNIHandles::make_local(env, new_obj());
+ JVM_END
+
+ // java.lang.Compiler ////////////////////////////////////////////////////
+@@ -4611,7 +4626,7 @@
+
+ JVM_ENTRY(void, JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size))
+ {
+- memset(info, 0, sizeof(info_size));
++ memset(info, 0, info_size);
+
+ info->jvm_version = Abstract_VM_Version::jvm_version();
+ info->update_version = 0; /* 0 in HotSpot Express VM */
+--- ./hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -68,11 +68,11 @@
+
+ ~JvmtiConstantPoolReconstituter() {
+ if (_symmap != NULL) {
+- os::free(_symmap, mtClass);
++ delete _symmap;
+ _symmap = NULL;
+ }
+ if (_classmap != NULL) {
+- os::free(_classmap, mtClass);
++ delete _classmap;
+ _classmap = NULL;
+ }
+ }
+--- ./hotspot/src/share/vm/prims/methodHandles.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/prims/methodHandles.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -29,6 +29,7 @@
+ #include "interpreter/oopMapCache.hpp"
+ #include "memory/allocation.inline.hpp"
+ #include "memory/oopFactory.hpp"
++#include "oops/methodOop.hpp"
+ #include "prims/jvmtiRedefineClassesTrace.hpp"
+ #include "prims/methodHandles.hpp"
+ #include "runtime/compilationPolicy.hpp"
+@@ -252,9 +253,13 @@
+ // If relevant, the vtable or itable value is stored as vmindex.
+ // This is done eagerly, since it is readily available without
+ // constructing any new objects.
+- instanceKlass::cast(m->method_holder())->add_member_name(m->method_idnum(), mname);
+
+- return mname();
++ if (instanceKlass::cast(m->method_holder())->add_member_name(mname)) {
++ return mname();
++ } else {
++ // Redefinition caused this to fail. Return NULL (and an exception?)
++ return NULL;
++ }
+ }
+
+ Handle MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, TRAPS) {
+@@ -993,62 +998,27 @@
+ }
+ }
+
+-void MemberNameTable::add_member_name(int index, jweak mem_name_wref) {
++void MemberNameTable::add_member_name(jweak mem_name_wref) {
+ assert_locked_or_safepoint(MemberNameTable_lock);
+- this->at_put_grow(index, mem_name_wref);
++ this->push(mem_name_wref);
+ }
+
+-// Return a member name oop or NULL.
+-oop MemberNameTable::get_member_name(int index) {
+- assert_locked_or_safepoint(MemberNameTable_lock);
+- jweak ref = this->at(index);
+- oop mem_name = JNIHandles::resolve(ref);
+- return mem_name;
+-}
+
+-oop MemberNameTable::find_member_name_by_method(methodOop old_method) {
+- assert_locked_or_safepoint(MemberNameTable_lock);
+- oop found = NULL;
+- int len = this->length();
+-
+- for (int idx = 0; idx < len; idx++) {
+- oop mem_name = JNIHandles::resolve(this->at(idx));
+- if (mem_name == NULL) {
+- continue;
+- }
+- methodOop method = (methodOop)java_lang_invoke_MemberName::vmtarget(mem_name);
+- if (method == old_method) {
+- found = mem_name;
+- break;
+- }
+- }
+- return found;
+-}
+-
+-// It is called at safepoint only
++// It is called at safepoint only for RedefineClasses
+ void MemberNameTable::adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
+ int methods_length, bool *trace_name_printed) {
+ assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
+- // search the MemberNameTable for uses of either obsolete or EMCP methods
++ // For each redefined method
+ for (int j = 0; j < methods_length; j++) {
+ methodOop old_method = old_methods[j];
+ methodOop new_method = new_methods[j];
+- oop mem_name = find_member_name_by_method(old_method);
+- if (mem_name != NULL) {
+- java_lang_invoke_MemberName::adjust_vmtarget(mem_name, new_method);
+-
+- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+- if (!(*trace_name_printed)) {
+- // RC_TRACE_MESG macro has an embedded ResourceMark
+- RC_TRACE_MESG(("adjust: name=%s",
+- Klass::cast(old_method->method_holder())->external_name()));
+- *trace_name_printed = true;
+- }
+- // RC_TRACE macro has an embedded ResourceMark
+- RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
+- new_method->name()->as_C_string(),
+- new_method->signature()->as_C_string()));
+- }
++ // search the MemberNameTable for uses of either obsolete or EMCP methods
++ for (int idx = 0; idx < length(); idx++) {
++ oop mem_name = JNIHandles::resolve(this->at(idx));
++ if (mem_name != NULL) {
++ java_lang_invoke_MemberName::adjust_vmtarget(mem_name, old_method, new_method,
++ trace_name_printed);
++ }
+ }
+ }
+ }
+--- ./hotspot/src/share/vm/prims/methodHandles.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/prims/methodHandles.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -238,8 +238,7 @@
+ MemberNameTable(int methods_cnt);
+ ~MemberNameTable();
+
+- void add_member_name(int index, jweak mem_name_ref);
+- oop get_member_name(int index);
++ void add_member_name(jweak mem_name_ref);
+
+ public:
+ // RedefineClasses() API support:
+@@ -247,8 +246,6 @@
+ // to refer to new_method.
+ void adjust_method_entries(methodOop* old_methods, methodOop* new_methods,
+ int methods_length, bool *trace_name_printed);
+- private:
+- oop find_member_name_by_method(methodOop old_method);
+ };
+
+ #endif // SHARE_VM_PRIMS_METHODHANDLES_HPP
+--- ./hotspot/src/share/vm/prims/whitebox.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/prims/whitebox.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2012, 2015, 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
+@@ -133,6 +133,10 @@
+ return MemTracker::wbtest_wait_for_data_merge();
+ WB_END
+
++WB_ENTRY(jboolean, WB_NMTIsDetailSupported(JNIEnv* env))
++ return MemTracker::tracking_level() == MemTracker::NMT_detail;
++WB_END
++
+ WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
+ MutexLockerEx mu(Compile_lock);
+ CodeCache::mark_all_nmethods_for_deoptimization();
+@@ -213,6 +217,7 @@
+ {CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory },
+ {CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
+ {CC"NMTWaitForDataMerge", CC"()Z", (void*)&WB_NMTWaitForDataMerge},
++ {CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported},
+ {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
+ };
+
+--- ./hotspot/src/share/vm/runtime/arguments.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/arguments.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -266,6 +266,7 @@
+ { "Tier1MaxInlineSize", JDK_Version::jdk_update(7,40), JDK_Version::jdk(8) },
+ { "Tier1LoopOptsCount", JDK_Version::jdk_update(7,40), JDK_Version::jdk(8) },
+ { "UseSpinning", JDK_Version::jdk_update(7,40), JDK_Version::jdk(8) },
++ { "CompilationRepeat", JDK_Version::jdk_update(7,80), JDK_Version::jdk(9) },
+ #ifdef PRODUCT
+ { "DesiredMethodLimit",
+ JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
+@@ -2064,7 +2065,7 @@
+ "G1ConcMarkStepDurationMillis");
+ status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
+ "G1ConcRSHotCardLimit");
+- status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
++ status = status && verify_interval(G1ConcRSLogCacheSize, 0, 27,
+ "G1ConcRSLogCacheSize");
+ }
+ #endif
+@@ -2080,19 +2081,9 @@
+ 1, 100, "TLABWasteTargetPercent");
+
+ status = status && verify_object_alignment();
+-
+-#ifdef SPARC
+- if (UseConcMarkSweepGC || UseG1GC) {
+- // Issue a stern warning if the user has explicitly set
+- // UseMemSetInBOT (it is known to cause issues), but allow
+- // use for experimentation and debugging.
+- if (VM_Version::is_sun4v() && UseMemSetInBOT) {
+- assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error");
+- warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability"
+- " on sun4v; please understand that you are using at your own risk!");
+- }
+- }
+-#endif // SPARC
++#ifdef COMPILER1
++ status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize");
++#endif
+
+ // check native memory tracking flags
+ if (PrintNMTStatistics && MemTracker::tracking_level() == MemTracker::NMT_off) {
+@@ -2495,6 +2486,23 @@
+ #endif
+ // -D
+ } else if (match_option(option, "-D", &tail)) {
++ if (CheckEndorsedAndExtDirs) {
++ if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
++ // abort if -Djava.endorsed.dirs is set
++ jio_fprintf(defaultStream::output_stream(),
++ "-Djava.endorsed.dirs will not be supported in a future release.\n"
++ "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
++ return JNI_EINVAL;
++ }
++ if (match_option(option, "-Djava.ext.dirs=", &tail)) {
++ // abort if -Djava.ext.dirs is set
++ jio_fprintf(defaultStream::output_stream(),
++ "-Djava.ext.dirs will not be supported in a future release.\n"
++ "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
++ return JNI_EINVAL;
++ }
++ }
++
+ if (!add_property(tail)) {
+ return JNI_ENOMEM;
+ }
+@@ -2884,6 +2892,146 @@
+ return JNI_OK;
+ }
+
++static bool has_jar_files(const char* directory) {
++ DIR* dir = os::opendir(directory);
++ if (dir == NULL) return false;
++
++ struct dirent *entry;
++ char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
++ bool hasJarFile = false;
++ while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
++ const char* name = entry->d_name;
++ const char* ext = name + strlen(name) - 4;
++ hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
++ }
++ FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
++ os::closedir(dir);
++ return hasJarFile ;
++}
++
++// returns the number of directories in the given path containing JAR files
++// If the skip argument is not NULL, it will skip that directory
++static int check_non_empty_dirs(const char* path, const char* type, const char* skip) {
++ const char separator = *os::path_separator();
++ const char* const end = path + strlen(path);
++ int nonEmptyDirs = 0;
++ while (path < end) {
++ const char* tmp_end = strchr(path, separator);
++ if (tmp_end == NULL) {
++ if ((skip == NULL || strcmp(path, skip) != 0) && has_jar_files(path)) {
++ nonEmptyDirs++;
++ jio_fprintf(defaultStream::output_stream(),
++ "Non-empty %s directory: %s\n", type, path);
++ }
++ path = end;
++ } else {
++ char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
++ memcpy(dirpath, path, tmp_end - path);
++ dirpath[tmp_end - path] = '\0';
++ if ((skip == NULL || strcmp(dirpath, skip) != 0) && has_jar_files(dirpath)) {
++ nonEmptyDirs++;
++ jio_fprintf(defaultStream::output_stream(),
++ "Non-empty %s directory: %s\n", type, dirpath);
++ }
++ FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
++ path = tmp_end + 1;
++ }
++ }
++ return nonEmptyDirs;
++}
++
++// Returns true if endorsed standards override mechanism and extension mechanism
++// are not used.
++static bool check_endorsed_and_ext_dirs() {
++ if (!CheckEndorsedAndExtDirs)
++ return true;
++
++ char endorsedDir[JVM_MAXPATHLEN];
++ char extDir[JVM_MAXPATHLEN];
++ const char* fileSep = os::file_separator();
++ jio_snprintf(endorsedDir, sizeof(endorsedDir), "%s%slib%sendorsed",
++ Arguments::get_java_home(), fileSep, fileSep);
++ jio_snprintf(extDir, sizeof(extDir), "%s%slib%sext",
++ Arguments::get_java_home(), fileSep, fileSep);
++
++ // check endorsed directory
++ int nonEmptyDirs = check_non_empty_dirs(Arguments::get_endorsed_dir(), "endorsed", NULL);
++
++ // check the extension directories but skip the default lib/ext directory
++ nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs(), "extension", extDir);
++
++ // List of JAR files installed in the default lib/ext directory.
++ // -XX:+CheckEndorsedAndExtDirs checks if any non-JDK file installed
++ static const char* jdk_ext_jars[] = {
++ "access-bridge-32.jar",
++ "access-bridge-64.jar",
++ "access-bridge.jar",
++ "cldrdata.jar",
++ "dnsns.jar",
++ "jaccess.jar",
++ "jfxrt.jar",
++ "localedata.jar",
++ "nashorn.jar",
++ "sunec.jar",
++ "sunjce_provider.jar",
++ "sunmscapi.jar",
++ "sunpkcs11.jar",
++ "ucrypto.jar",
++ "zipfs.jar",
++ NULL
++ };
++
++ // check if the default lib/ext directory has any non-JDK jar files; if so, error
++ DIR* dir = os::opendir(extDir);
++ if (dir != NULL) {
++ int num_ext_jars = 0;
++ struct dirent *entry;
++ char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(extDir), mtInternal);
++ while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
++ const char* name = entry->d_name;
++ const char* ext = name + strlen(name) - 4;
++ if (ext > name && (os::file_name_strcmp(ext, ".jar") == 0)) {
++ bool is_jdk_jar = false;
++ const char* jarfile = NULL;
++ for (int i=0; (jarfile = jdk_ext_jars[i]) != NULL; i++) {
++ if (os::file_name_strcmp(name, jarfile) == 0) {
++ is_jdk_jar = true;
++ break;
++ }
++ }
++ if (!is_jdk_jar) {
++ jio_fprintf(defaultStream::output_stream(),
++ "%s installed in <JAVA_HOME>/lib/ext\n", name);
++ num_ext_jars++;
++ }
++ }
++ }
++ FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
++ os::closedir(dir);
++ if (num_ext_jars > 0) {
++ nonEmptyDirs += 1;
++ }
++ }
++
++ // check if the default lib/endorsed directory exists; if so, error
++ dir = os::opendir(endorsedDir);
++ if (dir != NULL) {
++ jio_fprintf(defaultStream::output_stream(), "<JAVA_HOME>/lib/endorsed exists\n");
++ os::closedir(dir);
++ nonEmptyDirs += 1;
++ }
++
++ if (nonEmptyDirs > 0) {
++ jio_fprintf(defaultStream::output_stream(),
++ "Endorsed standards override mechanism and extension mechanism "
++ "will not be supported in a future release.\n"
++ "Refer to JEP 220 for details (http://openjdk.java.net/jeps/220).\n");
++ return false;
++ }
++
++ return true;
++}
++
+ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
+ // This must be done after all -D arguments have been processed.
+ scp_p->expand_endorsed();
+@@ -2893,6 +3041,10 @@
+ Arguments::set_sysclasspath(scp_p->combined_path());
+ }
+
++ if (!check_endorsed_and_ext_dirs()) {
++ return JNI_ERR;
++ }
++
+ // This must be done after all arguments have been processed.
+ // java_compiler() true means set to "NONE" or empty.
+ if (java_compiler() && !xdebug_mode()) {
+--- ./hotspot/src/share/vm/runtime/arguments.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/arguments.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -543,6 +543,7 @@
+ static char *get_sysclasspath() { return _sun_boot_class_path->value(); }
+ static char* get_meta_index_path() { return _meta_index_path; }
+ static char* get_meta_index_dir() { return _meta_index_dir; }
++ static char* get_ext_dirs() { return _java_ext_dirs->value(); }
+
+ // Operation modi
+ static Mode mode() { return _mode; }
+--- ./hotspot/src/share/vm/runtime/deoptimization.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/deoptimization.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1796,7 +1796,8 @@
+ "div0_check",
+ "age",
+ "predicate",
+- "loop_limit_check"
++ "loop_limit_check",
++ "unstable_if"
+ };
+ const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
+ // Note: Keep this in sync. with enum DeoptAction.
+--- ./hotspot/src/share/vm/runtime/deoptimization.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/deoptimization.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -59,6 +59,7 @@
+ Reason_age, // nmethod too old; tier threshold reached
+ Reason_predicate, // compiler generated predicate failed
+ Reason_loop_limit_check, // compiler generated loop limits check failed
++ Reason_unstable_if, // a branch predicted always false was taken
+ Reason_LIMIT,
+ // Note: Keep this enum in sync. with _trap_reason_name.
+ Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc
+@@ -311,6 +312,8 @@
+ return reason;
+ else if (reason == Reason_div0_check) // null check due to divide-by-zero?
+ return Reason_null_check; // recorded per BCI as a null check
++ else if (reason == Reason_unstable_if)
++ return Reason_intrinsic;
+ else
+ return Reason_none;
+ }
+--- ./hotspot/src/share/vm/runtime/globals.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/globals.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -1154,6 +1154,9 @@
+ product(bool, CheckJNICalls, false, \
+ "Verify all arguments to JNI calls") \
+ \
++ product(bool, CheckEndorsedAndExtDirs, false, \
++ "Verify the endorsed and extension directories are not used") \
++ \
+ product(bool, UseFastJNIAccessors, true, \
+ "Use optimized versions of Get<Primitive>Field") \
+ \
+@@ -2866,6 +2869,9 @@
+ product(intx, MaxRecursiveInlineLevel, 1, \
+ "maximum number of nested recursive calls that are inlined") \
+ \
++ develop(intx, MaxForceInlineLevel, 100, \
++ "maximum number of nested @ForceInline calls that are inlined") \
++ \
+ product_pd(intx, InlineSmallCode, \
+ "Only inline already compiled methods if their code size is " \
+ "less than this") \
+--- ./hotspot/src/share/vm/runtime/objectMonitor.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/objectMonitor.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -421,6 +421,15 @@
+ jt->java_suspend_self();
+ }
+ Self->set_current_pending_monitor(NULL);
++
++ // We cleared the pending monitor info since we've just gotten past
++ // the enter-check-for-suspend dance and we now own the monitor free
++ // and clear, i.e., it is no longer pending. The ThreadBlockInVM
++ // destructor can go to a safepoint at the end of this block. If we
++ // do a thread dump during that safepoint, then this thread will show
++ // as having "-locked" the monitor, but the OS and java.lang.Thread
++ // states will still report that the thread is blocked trying to
++ // acquire it.
+ }
+
+ Atomic::dec_ptr(&_count);
+@@ -1603,6 +1612,25 @@
+ // post monitor waited event. Note that this is past-tense, we are done waiting.
+ if (JvmtiExport::should_post_monitor_waited()) {
+ JvmtiExport::post_monitor_waited(jt, this, ret == OS_TIMEOUT);
++
++ if (node._notified != 0 && _succ == Self) {
++ // In this part of the monitor wait-notify-reenter protocol it
++ // is possible (and normal) for another thread to do a fastpath
++ // monitor enter-exit while this thread is still trying to get
++ // to the reenter portion of the protocol.
++ //
++ // The ObjectMonitor was notified and the current thread is
++ // the successor which also means that an unpark() has already
++ // been done. The JVMTI_EVENT_MONITOR_WAITED event handler can
++ // consume the unpark() that was done when the successor was
++ // set because the same ParkEvent is shared between Java
++ // monitors and JVM/TI RawMonitors (for now).
++ //
++ // We redo the unpark() to ensure forward progress, i.e., we
++ // don't want all pending threads hanging (parked) with none
++ // entering the unlocked monitor.
++ node._event->unpark();
++ }
+ }
+
+ // Without the fix for 8028280, it is possible for the above call:
+--- ./hotspot/src/share/vm/runtime/os.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/os.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -420,7 +420,10 @@
+ static intx current_thread_id();
+ static int current_process_id();
+ static int sleep(Thread* thread, jlong ms, bool interruptable);
+- static int naked_sleep();
++ // Short standalone OS sleep suitable for slow path spin loop.
++ // Ignores Thread.interrupt() (so keep it short).
++ // ms = 0, will sleep for the least amount of time allowed by the OS.
++ static void naked_short_sleep(jlong ms);
+ static void infinite_sleep(); // never returns, use with CAUTION
+ static void yield(); // Yields to all threads with same priority
+ enum YieldResult {
+--- ./hotspot/src/share/vm/runtime/park.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/park.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -59,58 +59,22 @@
+
+ // Start by trying to recycle an existing but unassociated
+ // ParkEvent from the global free list.
+- for (;;) {
+- ev = FreeList ;
+- if (ev == NULL) break ;
+- // 1: Detach - sequester or privatize the list
+- // Tantamount to ev = Swap (&FreeList, NULL)
+- if (Atomic::cmpxchg_ptr (NULL, &FreeList, ev) != ev) {
+- continue ;
++ // Using a spin lock since we are part of the mutex impl.
++ // 8028280: using concurrent free list without memory management can leak
++ // pretty badly it turns out.
++ Thread::SpinAcquire(&ListLock, "ParkEventFreeListAllocate");
++ {
++ ev = FreeList;
++ if (ev != NULL) {
++ FreeList = ev->FreeNext;
+ }
+-
+- // We've detached the list. The list in-hand is now
+- // local to this thread. This thread can operate on the
+- // list without risk of interference from other threads.
+- // 2: Extract -- pop the 1st element from the list.
+- ParkEvent * List = ev->FreeNext ;
+- if (List == NULL) break ;
+- for (;;) {
+- // 3: Try to reattach the residual list
+- guarantee (List != NULL, "invariant") ;
+- ParkEvent * Arv = (ParkEvent *) Atomic::cmpxchg_ptr (List, &FreeList, NULL) ;
+- if (Arv == NULL) break ;
+-
+- // New nodes arrived. Try to detach the recent arrivals.
+- if (Atomic::cmpxchg_ptr (NULL, &FreeList, Arv) != Arv) {
+- continue ;
+- }
+- guarantee (Arv != NULL, "invariant") ;
+- // 4: Merge Arv into List
+- ParkEvent * Tail = List ;
+- while (Tail->FreeNext != NULL) Tail = Tail->FreeNext ;
+- Tail->FreeNext = Arv ;
+- }
+- break ;
+ }
++ Thread::SpinRelease(&ListLock);
+
+ if (ev != NULL) {
+ guarantee (ev->AssociatedWith == NULL, "invariant") ;
+ } else {
+ // Do this the hard way -- materialize a new ParkEvent.
+- // In rare cases an allocating thread might detach a long list --
+- // installing null into FreeList -- and then stall or be obstructed.
+- // A 2nd thread calling Allocate() would see FreeList == null.
+- // The list held privately by the 1st thread is unavailable to the 2nd thread.
+- // In that case the 2nd thread would have to materialize a new ParkEvent,
+- // even though free ParkEvents existed in the system. In this case we end up
+- // with more ParkEvents in circulation than we need, but the race is
+- // rare and the outcome is benign. Ideally, the # of extant ParkEvents
+- // is equal to the maximum # of threads that existed at any one time.
+- // Because of the race mentioned above, segments of the freelist
+- // can be transiently inaccessible. At worst we may end up with the
+- // # of ParkEvents in circulation slightly above the ideal.
+- // Note that if we didn't have the TSM/immortal constraint, then
+- // when reattaching, above, we could trim the list.
+ ev = new ParkEvent () ;
+ guarantee ((intptr_t(ev) & 0xFF) == 0, "invariant") ;
+ }
+@@ -124,13 +88,14 @@
+ if (ev == NULL) return ;
+ guarantee (ev->FreeNext == NULL , "invariant") ;
+ ev->AssociatedWith = NULL ;
+- for (;;) {
+- // Push ev onto FreeList
+- // The mechanism is "half" lock-free.
+- ParkEvent * List = FreeList ;
+- ev->FreeNext = List ;
+- if (Atomic::cmpxchg_ptr (ev, &FreeList, List) == List) break ;
++ // Note that if we didn't have the TSM/immortal constraint, then
++ // when reattaching we could trim the list.
++ Thread::SpinAcquire(&ListLock, "ParkEventFreeListRelease");
++ {
++ ev->FreeNext = FreeList;
++ FreeList = ev;
+ }
++ Thread::SpinRelease(&ListLock);
+ }
+
+ // Override operator new and delete so we can ensure that the
+@@ -164,56 +129,21 @@
+
+ // Start by trying to recycle an existing but unassociated
+ // Parker from the global free list.
+- for (;;) {
+- p = FreeList ;
+- if (p == NULL) break ;
+- // 1: Detach
+- // Tantamount to p = Swap (&FreeList, NULL)
+- if (Atomic::cmpxchg_ptr (NULL, &FreeList, p) != p) {
+- continue ;
++ // 8028280: using concurrent free list without memory management can leak
++ // pretty badly it turns out.
++ Thread::SpinAcquire(&ListLock, "ParkerFreeListAllocate");
++ {
++ p = FreeList;
++ if (p != NULL) {
++ FreeList = p->FreeNext;
+ }
+-
+- // We've detached the list. The list in-hand is now
+- // local to this thread. This thread can operate on the
+- // list without risk of interference from other threads.
+- // 2: Extract -- pop the 1st element from the list.
+- Parker * List = p->FreeNext ;
+- if (List == NULL) break ;
+- for (;;) {
+- // 3: Try to reattach the residual list
+- guarantee (List != NULL, "invariant") ;
+- Parker * Arv = (Parker *) Atomic::cmpxchg_ptr (List, &FreeList, NULL) ;
+- if (Arv == NULL) break ;
+-
+- // New nodes arrived. Try to detach the recent arrivals.
+- if (Atomic::cmpxchg_ptr (NULL, &FreeList, Arv) != Arv) {
+- continue ;
+- }
+- guarantee (Arv != NULL, "invariant") ;
+- // 4: Merge Arv into List
+- Parker * Tail = List ;
+- while (Tail->FreeNext != NULL) Tail = Tail->FreeNext ;
+- Tail->FreeNext = Arv ;
+- }
+- break ;
+ }
++ Thread::SpinRelease(&ListLock);
+
+ if (p != NULL) {
+ guarantee (p->AssociatedWith == NULL, "invariant") ;
+ } else {
+ // Do this the hard way -- materialize a new Parker..
+- // In rare cases an allocating thread might detach
+- // a long list -- installing null into FreeList --and
+- // then stall. Another thread calling Allocate() would see
+- // FreeList == null and then invoke the ctor. In this case we
+- // end up with more Parkers in circulation than we need, but
+- // the race is rare and the outcome is benign.
+- // Ideally, the # of extant Parkers is equal to the
+- // maximum # of threads that existed at any one time.
+- // Because of the race mentioned above, segments of the
+- // freelist can be transiently inaccessible. At worst
+- // we may end up with the # of Parkers in circulation
+- // slightly above the ideal.
+ p = new Parker() ;
+ }
+ p->AssociatedWith = t ; // Associate p with t
+@@ -227,11 +157,12 @@
+ guarantee (p->AssociatedWith != NULL, "invariant") ;
+ guarantee (p->FreeNext == NULL , "invariant") ;
+ p->AssociatedWith = NULL ;
+- for (;;) {
+- // Push p onto FreeList
+- Parker * List = FreeList ;
+- p->FreeNext = List ;
+- if (Atomic::cmpxchg_ptr (p, &FreeList, List) == List) break ;
++
++ Thread::SpinAcquire(&ListLock, "ParkerFreeListRelease");
++ {
++ p->FreeNext = FreeList;
++ FreeList = p;
+ }
++ Thread::SpinRelease(&ListLock);
+ }
+
+--- ./hotspot/src/share/vm/runtime/thread.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/thread.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -4412,9 +4412,7 @@
+ ++ctr ;
+ if ((ctr & 0xFFF) == 0 || !os::is_MP()) {
+ if (Yields > 5) {
+- // Consider using a simple NakedSleep() instead.
+- // Then SpinAcquire could be called by non-JVM threads
+- Thread::current()->_ParkEvent->park(1) ;
++ os::naked_short_sleep(1);
+ } else {
+ os::NakedYield() ;
+ ++Yields ;
+--- ./hotspot/src/share/vm/runtime/vframe.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/vframe.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -197,6 +197,7 @@
+ continue;
+ }
+ if (monitor->owner() != NULL) {
++ // the monitor is associated with an object, i.e., it is locked
+
+ // First, assume we have the monitor locked. If we haven't found an
+ // owned monitor before and this is the first frame, then we need to
+@@ -207,7 +208,11 @@
+ if (!found_first_monitor && frame_count == 0) {
+ markOop mark = monitor->owner()->mark();
+ if (mark->has_monitor() &&
+- mark->monitor() == thread()->current_pending_monitor()) {
++ ( // we have marked ourself as pending on this monitor
++ mark->monitor() == thread()->current_pending_monitor() ||
++ // we are not the owner of this monitor
++ !mark->monitor()->is_entered(thread())
++ )) {
+ lock_state = "waiting to lock";
+ }
+ }
+--- ./hotspot/src/share/vm/runtime/vmStructs.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/runtime/vmStructs.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -2433,6 +2433,7 @@
+ declare_constant(Deoptimization::Reason_age) \
+ declare_constant(Deoptimization::Reason_predicate) \
+ declare_constant(Deoptimization::Reason_loop_limit_check) \
++ declare_constant(Deoptimization::Reason_unstable_if) \
+ declare_constant(Deoptimization::Reason_LIMIT) \
+ declare_constant(Deoptimization::Reason_RECORDED_LIMIT) \
+ \
+--- ./hotspot/src/share/vm/services/runtimeService.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/services/runtimeService.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -44,6 +44,7 @@
+ PerfCounter* RuntimeService::_thread_interrupt_signaled_count = NULL;
+ PerfCounter* RuntimeService::_interrupted_before_count = NULL;
+ PerfCounter* RuntimeService::_interrupted_during_count = NULL;
++double RuntimeService::_last_safepoint_sync_time_sec = 0.0;
+
+ void RuntimeService::init() {
+ // Make sure the VM version is initialized
+@@ -123,6 +124,7 @@
+
+ // update the time stamp to begin recording safepoint time
+ _safepoint_timer.update();
++ _last_safepoint_sync_time_sec = 0.0;
+ if (UsePerfData) {
+ _total_safepoints->inc();
+ if (_app_timer.is_updated()) {
+@@ -135,6 +137,9 @@
+ if (UsePerfData) {
+ _sync_time_ticks->inc(_safepoint_timer.ticks_since_update());
+ }
++ if (PrintGCApplicationStoppedTime) {
++ _last_safepoint_sync_time_sec = last_safepoint_time_sec();
++ }
+ }
+
+ void RuntimeService::record_safepoint_end() {
+@@ -150,8 +155,10 @@
+ gclog_or_tty->date_stamp(PrintGCDateStamps);
+ gclog_or_tty->stamp(PrintGCTimeStamps);
+ gclog_or_tty->print_cr("Total time for which application threads "
+- "were stopped: %3.7f seconds",
+- last_safepoint_time_sec());
++ "were stopped: %3.7f seconds, "
++ "Stopping threads took: %3.7f seconds",
++ last_safepoint_time_sec(),
++ _last_safepoint_sync_time_sec);
+ }
+
+ // update the time stamp to begin recording app time
+--- ./hotspot/src/share/vm/services/runtimeService.hpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/services/runtimeService.hpp Fri Apr 10 09:19:25 2015 -0700
+@@ -40,6 +40,7 @@
+
+ static TimeStamp _safepoint_timer;
+ static TimeStamp _app_timer;
++ static double _last_safepoint_sync_time_sec;
+
+ public:
+ static void init();
+--- ./hotspot/src/share/vm/utilities/ostream.cpp Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/src/share/vm/utilities/ostream.cpp Fri Apr 10 09:19:25 2015 -0700
+@@ -356,7 +356,6 @@
+
+ #define EXTRACHARLEN 32
+ #define CURRENTAPPX ".current"
+-#define FILENAMEBUFLEN 1024
+ // convert YYYY-MM-DD HH:MM:SS to YYYY-MM-DD_HH-MM-SS
+ char* get_datetime_string(char *buf, size_t len) {
+ os::local_time_string(buf, len);
+@@ -390,7 +389,6 @@
+ buffer_length = strlen(log_name) + 1;
+ }
+
+- // const char* star = strchr(basename, '*');
+ const char* pts = strstr(basename, "%p");
+ int pid_pos = (pts == NULL) ? -1 : (pts - nametail);
+
+@@ -583,9 +581,16 @@
+ _bytes_written = 0L;
+ _file_name = make_log_name(file_name, NULL);
+
++ if (_file_name == NULL) {
++ warning("Cannot open file %s: file name is too long.\n", file_name);
++ _need_close = false;
++ UseGCLogFileRotation = false;
++ return;
++ }
++
+ // gc log file rotation
+ if (UseGCLogFileRotation && NumberOfGCLogFiles > 1) {
+- char tempbuf[FILENAMEBUFLEN];
++ char tempbuf[JVM_MAXPATHLEN];
+ jio_snprintf(tempbuf, sizeof(tempbuf), "%s.%d" CURRENTAPPX, _file_name, _cur_file_num);
+ _file = fopen(tempbuf, "w");
+ } else {
+@@ -617,10 +622,10 @@
+ // concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log
+ // must be synchronized.
+ void gcLogFileStream::rotate_log(bool force, outputStream* out) {
+- char time_msg[FILENAMEBUFLEN];
++ char time_msg[O_BUFLEN];
+ char time_str[EXTRACHARLEN];
+- char current_file_name[FILENAMEBUFLEN];
+- char renamed_file_name[FILENAMEBUFLEN];
++ char current_file_name[JVM_MAXPATHLEN];
++ char renamed_file_name[JVM_MAXPATHLEN];
+
+ if (!should_rotate(force)) {
+ return;
+@@ -659,12 +664,15 @@
+ // have a form of extended_filename.<i>.current where i is the current rotation
+ // file number. After it reaches max file size, the file will be saved and renamed
+ // with .current removed from its tail.
+- size_t filename_len = strlen(_file_name);
+ if (_file != NULL) {
+- jio_snprintf(renamed_file_name, filename_len + EXTRACHARLEN, "%s.%d",
++ jio_snprintf(renamed_file_name, JVM_MAXPATHLEN, "%s.%d",
+ _file_name, _cur_file_num);
+- jio_snprintf(current_file_name, filename_len + EXTRACHARLEN, "%s.%d" CURRENTAPPX,
+- _file_name, _cur_file_num);
++ int result = jio_snprintf(current_file_name, JVM_MAXPATHLEN,
++ "%s.%d" CURRENTAPPX, _file_name, _cur_file_num);
++ if (result >= JVM_MAXPATHLEN) {
++ warning("Cannot create new log file name: %s: file name is too long.\n", current_file_name);
++ return;
++ }
+
+ const char* msg = force ? "GC log rotation request has been received."
+ : "GC log file has reached the maximum size.";
+@@ -703,19 +711,23 @@
+
+ _cur_file_num++;
+ if (_cur_file_num > NumberOfGCLogFiles - 1) _cur_file_num = 0;
+- jio_snprintf(current_file_name, filename_len + EXTRACHARLEN, "%s.%d" CURRENTAPPX,
++ int result = jio_snprintf(current_file_name, JVM_MAXPATHLEN, "%s.%d" CURRENTAPPX,
+ _file_name, _cur_file_num);
++ if (result >= JVM_MAXPATHLEN) {
++ warning("Cannot create new log file name: %s: file name is too long.\n", current_file_name);
++ return;
++ }
++
+ _file = fopen(current_file_name, "w");
+
+ if (_file != NULL) {
+ _bytes_written = 0L;
+ _need_close = true;
+ // reuse current_file_name for time_msg
+- jio_snprintf(current_file_name, filename_len + EXTRACHARLEN,
++ jio_snprintf(current_file_name, JVM_MAXPATHLEN,
+ "%s.%d", _file_name, _cur_file_num);
+ jio_snprintf(time_msg, sizeof(time_msg), "%s GC log file created %s\n",
+- os::local_time_string((char *)time_str, sizeof(time_str)),
+- current_file_name);
++ os::local_time_string((char *)time_str, sizeof(time_str)), current_file_name);
+ write(time_msg, strlen(time_msg));
+
+ if (out != NULL) {
+@@ -804,7 +816,7 @@
+
+ void defaultStream::init_log() {
+ // %%% Need a MutexLocker?
+- const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
++ const char* log_name = LogFile != NULL ? LogFile : "hotspot_%p.log";
+ fileStream* file = open_file(log_name);
+
+ if (file != NULL) {
+@@ -1236,14 +1248,55 @@
+
+ #ifndef PRODUCT
+ void test_loggc_filename() {
++ int pid;
++ char tms[32];
++ char i_result[JVM_MAXPATHLEN];
+ const char* o_result;
++ get_datetime_string(tms, sizeof(tms));
++ pid = os::current_process_id();
++
++ // test.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "test.log", tms);
++ o_result = make_log_name_internal("test.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
++
++ // test-%t-%p.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "test-%s-pid%u.log", tms, pid);
++ o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
++
++ // test-%t%p.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "test-%spid%u.log", tms, pid);
++ o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
++
++ // %p%t.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "pid%u%s.log", pid, tms);
++ o_result = make_log_name_internal("%p%t.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
++
++ // %p-test.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "pid%u-test.log", pid);
++ o_result = make_log_name_internal("%p-test.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
++
++ // %t.log
++ jio_snprintf(i_result, JVM_MAXPATHLEN, "%s.log", tms);
++ o_result = make_log_name_internal("%t.log", NULL, pid, tms);
++ assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)");
++ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+
+ {
+ // longest filename
+ char longest_name[JVM_MAXPATHLEN];
+ memset(longest_name, 'a', sizeof(longest_name));
+ longest_name[JVM_MAXPATHLEN - 1] = '\0';
+- o_result = make_log_name((const char*)&longest_name, NULL);
++ o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms);
+ assert(strcmp(longest_name, o_result) == 0, err_msg("longest name does not match. expected '%s' but got '%s'", longest_name, o_result));
+ FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+ }
+@@ -1254,29 +1307,30 @@
+ int too_long_length = sizeof(too_long_name);
+ memset(too_long_name, 'a', too_long_length);
+ too_long_name[too_long_length - 1] = '\0';
+- o_result = make_log_name((const char*)&too_long_name, NULL);
++ o_result = make_log_name_internal((const char*)&too_long_name, NULL, pid, tms);
+ assert(o_result == NULL, err_msg("Too long file name should return NULL, but got '%s'", o_result));
+ }
+
+ {
++ // too long with timestamp
++ char longest_name[JVM_MAXPATHLEN];
++ memset(longest_name, 'a', JVM_MAXPATHLEN);
++ longest_name[JVM_MAXPATHLEN - 3] = '%';
++ longest_name[JVM_MAXPATHLEN - 2] = 't';
++ longest_name[JVM_MAXPATHLEN - 1] = '\0';
++ o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms);
++ assert(o_result == NULL, err_msg("Too long file name after timestamp expansion should return NULL, but got '%s'", o_result));
++ }
++
++ {
+ // too long with pid
+ char longest_name[JVM_MAXPATHLEN];
+ memset(longest_name, 'a', JVM_MAXPATHLEN);
+ longest_name[JVM_MAXPATHLEN - 3] = '%';
+ longest_name[JVM_MAXPATHLEN - 2] = 'p';
+ longest_name[JVM_MAXPATHLEN - 1] = '\0';
+- o_result = make_log_name((const char*)&longest_name, NULL);
+- assert(o_result == NULL, err_msg("Too long file name after %%p pid expansion should return NULL, but got '%s'", o_result));
+- }
+-
+- {
+- // too long with pid (star)
+- char longest_name[JVM_MAXPATHLEN];
+- memset(longest_name, 'a', JVM_MAXPATHLEN);
+- longest_name[JVM_MAXPATHLEN - 2] = '*';
+- longest_name[JVM_MAXPATHLEN - 1] = '\0';
+- o_result = make_log_name((const char*)&longest_name, NULL);
+- assert(o_result == NULL, err_msg("Too long file name after star (pid) expansion should return NULL, but got '%s'", o_result));
++ o_result = make_log_name_internal((const char*)&longest_name, NULL, pid, tms);
++ assert(o_result == NULL, err_msg("Too long file name after pid expansion should return NULL, but got '%s'", o_result));
+ }
+ }
+
+--- ./hotspot/test/Makefile Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/test/Makefile Fri Apr 10 09:19:25 2015 -0700
+@@ -173,8 +173,8 @@
+ JTREG_TESTDIRS = $(TESTDIRS)
+ endif
+
+-# Default JTREG to run (win32 script works for everybody)
+-JTREG = $(JT_HOME)/win32/bin/jtreg
++# Default JTREG to run
++JTREG = $(JT_HOME)/bin/jtreg
+
+ # Option to tell jtreg to not run tests marked with "ignore"
+ ifeq ($(PLATFORM), windows)
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/exceptions/CatchInlineExceptions.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,81 @@
++/*
++ * Copyright (c) 2014, 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 8059299
++ * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr
++ * @run main/othervm -Xbatch CatchInlineExceptions
++ */
++
++class Exception1 extends Exception {};
++class Exception2 extends Exception {};
++
++public class CatchInlineExceptions {
++ private static int counter0;
++ private static int counter1;
++ private static int counter2;
++ private static int counter;
++
++ static void foo(int i) throws Exception {
++ if ((i & 1023) == 2) {
++ counter0++;
++ throw new Exception2();
++ }
++ }
++
++ static void test(int i) throws Exception {
++ try {
++ foo(i);
++ }
++ catch (Exception e) {
++ if (e instanceof Exception1) {
++ counter1++;
++ } else if (e instanceof Exception2) {
++ counter2++;
++ }
++ counter++;
++ throw e;
++ }
++ }
++
++ public static void main(String[] args) throws Throwable {
++ for (int i = 0; i < 15000; i++) {
++ try {
++ test(i);
++ } catch (Exception e) {
++ // expected
++ }
++ }
++ if (counter1 != 0) {
++ throw new RuntimeException("Failed: counter1(" + counter1 + ") != 0");
++ }
++ if (counter2 != counter0) {
++ throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter0(" + counter0 + ")");
++ }
++ if (counter2 != counter) {
++ throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter(" + counter + ")");
++ }
++ System.out.println("TEST PASSED");
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandlesNoASM.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,246 @@
++/*
++ * Copyright (c) 2014, 2015, 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 8042235
++ * @summary redefining method used by multiple MethodHandles crashes VM
++ * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandlesNoASM.java
++ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic RedefineMethodUsedByMultipleMethodHandlesNoASM
++ */
++
++import java.io.*;
++import java.lang.instrument.*;
++import java.lang.invoke.*;
++import java.lang.invoke.MethodHandles.Lookup;
++import java.lang.management.*;
++import java.lang.reflect.*;
++import java.nio.file.*;
++import java.security.*;
++import java.util.jar.*;
++
++import javax.tools.*;
++
++public class RedefineMethodUsedByMultipleMethodHandlesNoASM {
++
++ static class Foo {
++ public static Object getName() {
++ int fooInt = 1;
++ if (true) {
++ // We "just know" that this creates bytecodes:
++ // bipush 0x7 0x10 0x7
++ // ishl 0x78
++ fooInt <<= 0x7;
++ }
++ return "foo" + fooInt;
++ }
++ }
++
++ public static void main(String[] args) throws Throwable {
++
++ Lookup lookup = MethodHandles.lookup();
++ Method fooMethod = Foo.class.getDeclaredMethod("getName");
++
++ // fooMH2 displaces fooMH1 from the MemberNamesTable
++ MethodHandle fooMH1 = lookup.unreflect(fooMethod);
++ MethodHandle fooMH2 = lookup.unreflect(fooMethod);
++
++ System.out.println("Foo.getName() = " + Foo.getName());
++ System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
++ System.out.println("fooMH2.invoke = " + fooMH2.invokeExact());
++
++ // Redefining Foo.getName() causes vmtarget to be updated
++ // in fooMH2 but not fooMH1
++ redefineFoo();
++
++ // Full GC causes fooMH1.vmtarget to be deallocated
++ System.gc();
++
++ // Calling fooMH1.vmtarget crashes the VM on JDK8, on JDK7 we see
++ // the wrong method invoked, we execute the old code.
++ Object newResult = fooMH1.invokeExact();
++ System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
++ if (!((String) newResult).equals("foo32")) {
++ throw new RuntimeException("failed, fooMH1 invoke gets '" + newResult + "'");
++ }
++ }
++
++ /**
++ * Adds the class file bytes for {@code c} to {@code jar}.
++ */
++ static void add(JarOutputStream jar, Class<?> c) throws IOException {
++ String classAsPath = c.getName().replace('.', '/') + ".class";
++ jar.putNextEntry(new JarEntry(classAsPath));
++ InputStream stream = c.getClassLoader().getResourceAsStream(classAsPath);
++
++ int b;
++ while ((b = stream.read()) != -1) {
++ jar.write(b);
++ }
++ }
++
++ static void redefineFoo() throws Exception {
++ Manifest manifest = new Manifest();
++ manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
++ Attributes mainAttrs = manifest.getMainAttributes();
++ mainAttrs.putValue("Agent-Class", FooAgent.class.getName());
++ mainAttrs.putValue("Can-Redefine-Classes", "true");
++ mainAttrs.putValue("Can-Retransform-Classes", "true");
++
++ Path jar = Files.createTempFile("myagent", ".jar");
++ try {
++ JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
++ add(jarStream, FooAgent.class);
++ add(jarStream, FooTransformer.class);
++ jarStream.close();
++ runAgent(jar);
++ } finally {
++ Files.deleteIfExists(jar);
++ }
++ }
++
++ public static void runAgent(Path agent) throws Exception {
++ String vmName = ManagementFactory.getRuntimeMXBean().getName();
++ int p = vmName.indexOf('@');
++ assert p != -1 : "VM name not in <pid>@<host> format: " + vmName;
++ String pid = vmName.substring(0, p);
++ ClassLoader cl = ToolProvider.getSystemToolClassLoader();
++ Class<?> c = Class.forName("com.sun.tools.attach.VirtualMachine", true, cl);
++ Method attach = c.getDeclaredMethod("attach", String.class);
++ Method loadAgent = c.getDeclaredMethod("loadAgent", String.class);
++ Method detach = c.getDeclaredMethod("detach");
++ Object vm = attach.invoke(null, pid);
++ loadAgent.invoke(vm, agent.toString());
++ detach.invoke(vm);
++ }
++
++ public static class FooAgent {
++
++ public static void agentmain(@SuppressWarnings("unused") String args, Instrumentation inst) throws Exception {
++ assert inst.isRedefineClassesSupported();
++ assert inst.isRetransformClassesSupported();
++ inst.addTransformer(new FooTransformer(), true);
++ Class<?>[] classes = inst.getAllLoadedClasses();
++ for (int i = 0; i < classes.length; i++) {
++ Class<?> c = classes[i];
++ if (c == Foo.class) {
++ inst.retransformClasses(new Class[]{c});
++ }
++ }
++ }
++ }
++
++
++ /**
++ * This method will only be called on the class Foo, above, and that class
++ * only has the method getName().
++ * Avoid using the objectweb ASM library as we do in jdk8, by
++ * looking for a specific bytecode pattern (which this method does not really
++ * understand).
++ */
++ static class FooTransformer implements ClassFileTransformer {
++
++ @Override
++ public byte[] transform(ClassLoader cl, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
++ byte[] classfileBuffer) throws IllegalClassFormatException {
++
++
++ if (Foo.class.equals(classBeingRedefined)) {
++
++ try {
++ System.out.println("redefining " + classBeingRedefined);
++ ByteArrayOutputStream baos = new ByteArrayOutputStream();
++ InputStream is = new ByteArrayInputStream(classfileBuffer);
++ copyWithSubstitution(is, new byte[] {(byte)0x10,(byte)0x07,(byte)0x78},
++ new byte[] {(byte)0x10,(byte)0x05,(byte)0x78},
++ baos);
++ return baos.toByteArray();
++ } catch(Exception e) {
++ e.printStackTrace();
++ }
++ }
++ return classfileBuffer;
++ }
++
++ /**
++ * Copy bytes from a Reader to an OutputStream. If a sequence of bytes
++ * matches the given oldBytes byte array, write the newBytes array instead.
++ */
++ public void copyWithSubstitution(InputStream is, byte[] oldBytes, byte [] newBytes, OutputStream out) throws Exception {
++
++ byte[] buffer = new byte[oldBytes.length];
++
++ while (is.available() > 0) {
++ int i = 0xff & is.read();
++ if (i != oldBytes[0]) {
++ out.write(i);
++ continue;
++ }
++ int pos = 0;
++ while (pos < oldBytes.length && oldBytes[pos] == (byte) i) {
++ buffer[pos] = (byte) i;
++ pos++;
++ i = is.read();
++ }
++ // We have read as much as matches oldBytes, plus one byte (now in i).
++ // Write out:
++ // buffer it if did not match fully
++ // new bytes if it was a full match
++ if (pos > 0) {
++ if (pos == oldBytes.length) {
++ System.out.println("copyWithSubstitution: replacing: ");
++ printBytesOn(System.out, buffer);
++ System.out.println("copyWithSubstitution: with:");
++ printBytesOn(System.out, newBytes);
++ out.write(newBytes, 0, newBytes.length);
++ } else {
++ out.write(buffer, 0, pos);
++ }
++ }
++ // Does not handle two sequential occurrences of oldBytes.
++ out.write(i);
++ }
++ out.close();
++ }
++
++
++ public static void printBytesOn(PrintStream out, byte[] bytes) {
++ int numColumns = 16;
++ int column = 0;
++ for (int i = 0; i < bytes.length; i++) {
++ if (column == 0) {
++ out.print(i);
++ out.print("\t");
++ }
++ out.print("0x" + Integer.toHexString(255 & bytes[i])
++ /* + " (" + (char) bytes[i] + */ + "\t");
++ column++;
++ if (column == numColumns) {
++ out.println();
++ column = 0;
++ }
++ }
++ out.println();
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,58 @@
++/*
++ * Copyright (c) 2014, 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 8054478
++ * @summary dead backbranch in main loop results in erroneous array access
++ * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -XX:+TieredCompilation -Xcomp TestDeadBackbranchArrayAccess
++ *
++ */
++
++public class TestDeadBackbranchArrayAccess {
++ static char[] pattern0 = {0};
++ static char[] pattern1 = {1};
++
++ static void test(char[] array) {
++ if (pattern1 == null) return;
++
++ int i = 0;
++ int pos = 0;
++ char c = array[pos];
++
++ while (i >= 0 && (c == pattern0[i] || c == pattern1[i])) {
++ i--;
++ pos--;
++ if (pos != -1) {
++ c = array[pos];
++ }
++ }
++ }
++
++ public static void main(String[] args) {
++ for (int i = 0; i < 1000000; i++) {
++ test(new char[1]);
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/loopopts/TestLogSum.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,111 @@
++/*
++ * Copyright (c) 2014, 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 8046516
++ * @summary Segmentation fault in JVM (easily reproducible)
++ * @run main/othervm -XX:-TieredCompilation -Xbatch TestLogSum
++ * @author jackkamm@gmail.com
++ */
++
++import java.util.Arrays;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
++public class TestLogSum {
++ public static void main(String[] args) {
++ double sum;
++
++ for (int i = 0; i < 6; i++) {
++ for (int n = 2; n < 30; n++) {
++ for (int j = 1; j <= n; j++) {
++ for (int k = 1; k <= j; k++) {
++ // System.out.println(computeSum(k, j));
++ sum = computeSum(k, j);
++ }
++ }
++ }
++ }
++ }
++
++ private static Map<List<Integer>, Double> cache = new HashMap<List<Integer>, Double>();
++ public static double computeSum(int x, int y) {
++ List<Integer> key = Arrays.asList(new Integer[] {x, y});
++
++ if (!cache.containsKey(key)) {
++
++ // explicitly creating/updating a double[] array, instead of using the LogSumArray wrapper object, will prevent the error
++ LogSumArray toReturn = new LogSumArray(x);
++
++ // changing loop indices will prevent the error
++ // in particular, for(z=0; z<x-1; z++), and then using z+1 in place of z, will not produce error
++ for (int z = 1; z < x+1; z++) {
++ double logSummand = Math.log(z + x + y);
++ toReturn.addLogSummand(logSummand);
++ }
++
++ // returning the value here without cacheing it will prevent the segfault
++ cache.put(key, toReturn.retrieveLogSum());
++ }
++ return cache.get(key);
++ }
++
++ /*
++ * Given a bunch of logarithms log(X),log(Y),log(Z),...
++ * This class is used to compute the log of the sum, log(X+Y+Z+...)
++ */
++ private static class LogSumArray {
++ private double[] logSummandArray;
++ private int currSize;
++
++ private double maxLogSummand;
++
++ public LogSumArray(int maxEntries) {
++ this.logSummandArray = new double[maxEntries];
++
++ this.currSize = 0;
++ this.maxLogSummand = Double.NEGATIVE_INFINITY;
++ }
++
++ public void addLogSummand(double logSummand) {
++ logSummandArray[currSize] = logSummand;
++ currSize++;
++ // removing this line will prevent the error
++ maxLogSummand = Math.max(maxLogSummand, logSummand);
++ }
++
++ public double retrieveLogSum() {
++ if (maxLogSummand == Double.NEGATIVE_INFINITY) return Double.NEGATIVE_INFINITY;
++
++ assert currSize <= logSummandArray.length;
++
++ double factorSum = 0;
++ for (int i = 0; i < currSize; i++) {
++ factorSum += Math.exp(logSummandArray[i] - maxLogSummand);
++ }
++
++ return Math.log(factorSum) + maxLogSummand;
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,403 @@
++/*
++ * Copyright (c) 2014, 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 8066103
++ * @summary C2's range check smearing allows out of bound array accesses
++ * @run main/othervm -ea -Xmixed -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearing
++ *
++ */
++
++import java.lang.annotation.*;
++import java.lang.reflect.*;
++import java.util.*;
++
++public class TestRangeCheckSmearing {
++ @Retention(RetentionPolicy.RUNTIME)
++ @interface Args { int[] value(); }
++
++ // first range check is i + max of all constants
++ @Args({0, 8})
++ static int m1(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+9];
++ if (allaccesses) {
++ res += array[i+8];
++ res += array[i+7];
++ res += array[i+6];
++ res += array[i+5];
++ res += array[i+4];
++ res += array[i+3];
++ res += array[i+2];
++ res += array[i+1];
++ }
++ return res;
++ }
++
++ // first range check is i + min of all constants
++ @Args({0, -9})
++ static int m2(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+1];
++ if (allaccesses) {
++ res += array[i+2];
++ res += array[i+3];
++ res += array[i+4];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ // first range check is not i + min/max of all constants
++ @Args({0, 8})
++ static int m3(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ if (allaccesses) {
++ res += array[i+2];
++ res += array[i+1];
++ res += array[i+4];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({0, -9})
++ static int m4(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ if (allaccesses) {
++ res += array[i+4];
++ res += array[i+1];
++ res += array[i+2];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({0, -3})
++ static int m5(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+2];
++ if (allaccesses) {
++ res += array[i+1];
++ res += array[i+4];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({0, 6})
++ static int m6(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+4];
++ if (allaccesses) {
++ res += array[i+2];
++ res += array[i+1];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({0, 6})
++ static int m7(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+2];
++ res += array[i+4];
++ if (allaccesses) {
++ res += array[i+1];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({0, -3})
++ static int m8(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+4];
++ res += array[i+2];
++ if (allaccesses) {
++ res += array[i+1];
++ res += array[i+5];
++ res += array[i+6];
++ res += array[i+7];
++ res += array[i+8];
++ res += array[i+9];
++ }
++ return res;
++ }
++
++ @Args({6, 15})
++ static int m9(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ if (allaccesses) {
++ res += array[i-2];
++ res += array[i-1];
++ res += array[i-4];
++ res += array[i-5];
++ res += array[i-6];
++ }
++ return res;
++ }
++
++ @Args({3, 12})
++ static int m10(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ if (allaccesses) {
++ res += array[i-2];
++ res += array[i-1];
++ res += array[i-3];
++ res += array[i+4];
++ res += array[i+5];
++ res += array[i+6];
++ }
++ return res;
++ }
++
++ @Args({3, -3})
++ static int m11(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i-2];
++ if (allaccesses) {
++ res += array[i+5];
++ res += array[i+6];
++ }
++ return res;
++ }
++
++ @Args({3, 6})
++ static int m12(int[] array, int i, boolean allaccesses) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+6];
++ if (allaccesses) {
++ res += array[i-2];
++ res += array[i-3];
++ }
++ return res;
++ }
++
++ // check that identical range check is replaced by dominating one
++ // only when correct
++ @Args({0})
++ static int m13(int[] array, int i, boolean ignore) {
++ int res = 0;
++ res += array[i+3];
++ res += array[i+3];
++ return res;
++ }
++
++ @Args({2, 0})
++ static int m14(int[] array, int i, boolean ignore) {
++ int res = 0;
++
++ res += array[i];
++ res += array[i-2];
++ res += array[i]; // If range check below were to be removed first this cannot be considered identical to first range check
++ res += array[i-1]; // range check removed so i-1 array access depends on previous check
++
++ return res;
++ }
++
++ static int[] m15_dummy = new int[10];
++ @Args({2, 0})
++ static int m15(int[] array, int i, boolean ignore) {
++ int res = 0;
++ res += array[i];
++
++ // When the loop is optimized out we don't want the
++ // array[i-1] access which is dependent on array[i]'s
++ // range check to become dependent on the identical range
++ // check above.
++
++ int[] array2 = m15_dummy;
++ int j = 0;
++ for (; j < 10; j++);
++ if (j == 10) {
++ array2 = array;
++ }
++
++ res += array2[i-2];
++ res += array2[i];
++ res += array2[i-1]; // range check removed so i-1 array access depends on previous check
++
++ return res;
++ }
++
++ @Args({2, 0})
++ static int m16(int[] array, int i, boolean ignore) {
++ int res = 0;
++
++ res += array[i];
++ res += array[i-1];
++ res += array[i-1];
++ res += array[i-2];
++
++ return res;
++ }
++
++ @Args({2, 0})
++ static int m17(int[] array, int i, boolean ignore) {
++ int res = 0;
++
++ res += array[i];
++ res += array[i-2];
++ res += array[i-2];
++ res += array[i+2];
++ res += array[i+2];
++ res += array[i-1];
++ res += array[i-1];
++
++ return res;
++ }
++
++ static public void main(String[] args) {
++ new TestRangeCheckSmearing().doTests();
++ }
++ boolean success = true;
++ boolean exception = false;
++ final int[] array = new int[10];
++ final HashMap<String,Method> tests = new HashMap<>();
++ {
++ final Class<?> TEST_PARAM_TYPES[] = { int[].class, int.class, boolean.class };
++ for (Method m : this.getClass().getDeclaredMethods()) {
++ if (m.getName().matches("m[0-9]+")) {
++ assert(Modifier.isStatic(m.getModifiers())) : m;
++ assert(m.getReturnType() == int.class) : m;
++ assert(Arrays.equals(m.getParameterTypes(), TEST_PARAM_TYPES)) : m;
++ tests.put(m.getName(), m);
++ }
++ }
++ }
++
++ void invokeTest(Method m, int[] array, int index, boolean z) {
++ try {
++ m.invoke(null, array, index, z);
++ } catch (ReflectiveOperationException roe) {
++ Throwable ex = roe.getCause();
++ if (ex instanceof ArrayIndexOutOfBoundsException)
++ throw (ArrayIndexOutOfBoundsException) ex;
++ throw new AssertionError(roe);
++ }
++ }
++
++ void doTest(String name) {
++ Method m = tests.get(name);
++ tests.remove(name);
++ int[] args = m.getAnnotation(Args.class).value();
++ int index0 = args[0], index1;
++ boolean exceptionRequired = true;
++ if (args.length == 2) {
++ index1 = args[1];
++ } else {
++ // no negative test for this one
++ assert(args.length == 1);
++ assert(name.equals("m13"));
++ exceptionRequired = false;
++ index1 = index0;
++ }
++ // Get the method compiled.
++ // valid access
++ for (int i = 0; i < 20000; i++) {
++ invokeTest(m, array, index0, true);
++ }
++
++ exception = false;
++ boolean test_success = true;
++ try {
++ invokeTest(m, array, index1, false);
++ } catch(ArrayIndexOutOfBoundsException aioob) {
++ exception = true;
++ System.out.println("ArrayIndexOutOfBoundsException thrown in "+name);
++ }
++ if (!exception) {
++ System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
++ }
++
++ if (exception != exceptionRequired) {
++ System.out.println((exceptionRequired?"exception required but not thrown":"not exception required but thrown") + " in "+name);
++ test_success = false;
++ }
++
++ if (!test_success) {
++ success = false;
++ System.out.println("TEST FAILED: "+name);
++ }
++
++ }
++ void doTests() {
++ doTest("m1");
++ doTest("m2");
++ doTest("m3");
++ doTest("m4");
++ doTest("m5");
++ doTest("m6");
++ doTest("m7");
++ doTest("m8");
++ doTest("m9");
++ doTest("m10");
++ doTest("m11");
++ doTest("m12");
++ doTest("m13");
++ doTest("m14");
++ doTest("m15");
++ doTest("m16");
++ doTest("m17");
++ if (!success) {
++ throw new RuntimeException("Some tests failed");
++ }
++ assert(tests.isEmpty()) : tests;
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/compiler/rangechecks/TestRangeCheckSmearingLoopOpts.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,76 @@
++/*
++ * Copyright (c) 2014, 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 8048170
++ * @summary Following range check smearing, range check cannot be replaced by dominating identical test.
++ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckSmearingLoopOpts
++ *
++ */
++public class TestRangeCheckSmearingLoopOpts {
++
++ static int dummy;
++
++ static int m1(int[] array, int i) {
++ for (;;) {
++ for (;;) {
++ if (array[i] < 0) { // range check (i+0) dominates equivalent check below
++ break;
++ }
++ i++;
++ }
++
++ // A control flow that stops IfNode::up_one_dom()
++ if ((i % 2)== 0) {
++ if ((array[i] % 2) == 0) {
++ dummy = i;
++ }
++ }
++
++ // IfNode::Ideal will rewrite some range checks if Compile::allow_range_check_smearing
++ if (array[i-1] == 9) { // range check (i-1) unchanged
++ int res = array[i-3]; // range check (i-3) unchanged
++ res += array[i]; // range check (i+0) unchanged
++ res += array[i-2]; // removed redundant range check
++ // the previous access might be hoisted by
++ // PhaseIdealLoop::split_if_with_blocks_post because
++ // it appears to have the same guard, but it also
++ // depends on the previous guards
++ return res;
++ }
++ i++;
++ }
++ }
++
++ static public void main(String[] args) {
++ int[] array = { 0, 1, 2, -3, 4, 5, -2, 7, 8, 9, -1 };
++ for (int i = 0; i < 20000; i++) {
++ m1(array, 0);
++ }
++ array[0] = -1;
++ try {
++ m1(array, 0);
++ } catch(ArrayIndexOutOfBoundsException aioobe) {}
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/runtime/CheckEndorsedAndExtDirs/EndorsedExtDirs.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,96 @@
++/*
++ * Copyright (c) 2014, 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 8064667
++ * @summary Sanity test for -XX:+CheckEndorsedAndExtDirs
++ * @library /testlibrary
++ * @run main/othervm EndorsedExtDirs
++ */
++
++import com.oracle.java.testlibrary.*;
++import java.io.File;
++import java.io.IOException;
++import java.nio.file.DirectoryStream;
++import java.nio.file.Files;
++import java.nio.file.Path;
++import java.nio.file.Paths;
++import java.util.ArrayList;
++import java.util.List;
++
++public class EndorsedExtDirs {
++ static final String cpath = System.getProperty("test.classes", ".");
++ public static void main(String arg[]) throws Exception {
++ fatalError("-XX:+CheckEndorsedAndExtDirs", "-Djava.endorsed.dirs=foo");
++ fatalError("-XX:+CheckEndorsedAndExtDirs", "-Djava.ext.dirs=bar");
++ testNonEmptySystemExtDirs();
++ }
++
++ static void testNonEmptySystemExtDirs() throws Exception {
++ String home = System.getProperty("java.home");
++ Path ext = Paths.get(home, "lib", "ext");
++ String extDirs = System.getProperty("java.ext.dirs");
++ String[] dirs = extDirs.split(File.pathSeparator);
++ long count = 0;
++ for (String d : dirs) {
++ Path path = Paths.get(d);
++ if (Files.notExists(path) || path.equals(ext)) continue;
++ try (DirectoryStream<Path> jars =
++ Files.newDirectoryStream(path, "*.jar"))
++ {
++ for (Path j : jars) {
++ count++;
++ }
++ }
++ }
++ if (count > 0) {
++ fatalError("-XX:+CheckEndorsedAndExtDirs");
++ }
++ }
++
++ static ProcessBuilder newProcessBuilder(String... args) {
++ List<String> commands = new ArrayList<>();
++ String java = System.getProperty("java.home") + "/bin/java";
++ commands.add(java);
++ for (String s : args) {
++ commands.add(s);
++ }
++ commands.add("-cp");
++ commands.add(cpath);
++ commands.add("EndorsedExtDirs");
++
++ System.out.println("Process " + commands);
++ return new ProcessBuilder(commands);
++ }
++
++ static void fatalError(String... args) throws Exception {
++ fatalError(newProcessBuilder(args));
++ }
++
++ static void fatalError(ProcessBuilder pb) throws Exception {
++ OutputAnalyzer output = new OutputAnalyzer(pb.start());
++ output.shouldContain("Could not create the Java Virtual Machine");
++ output.shouldHaveExitValue(1);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/runtime/LoadClass/LoadClassNegative.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,51 @@
++/*
++ * Copyright (c) 2013, 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
++ * @key regression
++ * @bug 8020675
++ * @summary make sure there is no fatal error if a class is loaded from an invalid jar file which is in the bootclasspath
++ * @library /testlibrary
++ * @build TestForName
++ * @build LoadClassNegative
++ * @run main LoadClassNegative
++ */
++
++import java.io.File;
++import com.oracle.java.testlibrary.*;
++
++public class LoadClassNegative {
++
++ public static void main(String args[]) throws Exception {
++ String bootCP = "-Xbootclasspath/a:" + System.getProperty("test.src")
++ + File.separator + "dummy.jar";
++ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
++ bootCP,
++ "TestForName");
++
++ OutputAnalyzer output = new OutputAnalyzer(pb.start());
++ output.shouldContain("ClassNotFoundException");
++ output.shouldHaveExitValue(0);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/runtime/LoadClass/ShowClassLoader.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,45 @@
++/*
++ * Copyright (c) 2014, 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
++ * @key regression
++ * @bug 8058927
++ * @summary Make sure array class has the right class loader
++ * @run main ShowClassLoader
++ */
++
++public class ShowClassLoader {
++
++ public static void main(String[] args) {
++ Object[] oa = new Object[0];
++ ShowClassLoader[] sa = new ShowClassLoader[0];
++
++ System.out.println("Classloader for Object[] is " + oa.getClass().getClassLoader());
++ System.out.println("Classloader for SCL[] is " + sa.getClass().getClassLoader() );
++
++ if (sa.getClass().getClassLoader() == null) {
++ throw new RuntimeException("Wrong class loader");
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/runtime/LoadClass/TestForName.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,33 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++public class TestForName {
++ public static void main(String[] args) {
++ try {
++ Class cls = Class.forName("xxx");
++ System.out.println("Class = " + cls.getName());
++ } catch (ClassNotFoundException cnfe) {
++ cnfe.printStackTrace();
++ }
++ }
++}
+--- ./hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2015, 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
+@@ -45,6 +45,13 @@
+ String pid = Integer.toString(ProcessTools.getProcessId());
+ ProcessBuilder pb = new ProcessBuilder();
+
++ boolean has_nmt_detail = wb.NMTIsDetailSupported();
++ if (has_nmt_detail) {
++ System.out.println("NMT detail support detected.");
++ } else {
++ System.out.println("NMT detail support not detected.");
++ }
++
+ Thread reserveThread = new Thread() {
+ public void run() {
+ addr = wb.NMTReserveMemory(reserveSize);
+@@ -58,7 +65,9 @@
+ pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
+ output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Test (reserved=512KB, committed=0KB)");
+- output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
++ if (has_nmt_detail) {
++ output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
++ }
+
+ Thread commitThread = new Thread() {
+ public void run() {
+@@ -72,7 +81,9 @@
+
+ output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Test (reserved=512KB, committed=128KB)");
+- output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
++ if (has_nmt_detail) {
++ output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
++ }
+
+ Thread uncommitThread = new Thread() {
+ public void run() {
+--- ./hotspot/test/runtime/NMT/VirtualAllocTestType.java Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/test/runtime/NMT/VirtualAllocTestType.java Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2015, 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
+@@ -46,13 +46,23 @@
+ String pid = Integer.toString(ProcessTools.getProcessId());
+ ProcessBuilder pb = new ProcessBuilder();
+
++ boolean has_nmt_detail = wb.NMTIsDetailSupported();
++ if (has_nmt_detail) {
++ System.out.println("NMT detail support detected.");
++ } else {
++ System.out.println("NMT detail support not detected.");
++ }
++
+ addr = wb.NMTReserveMemory(reserveSize);
+ mergeData();
++ pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
+
+- pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
+ output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Test (reserved=256KB, committed=0KB)");
+- output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
++ if (has_nmt_detail) {
++ output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
++ }
++
+
+ wb.NMTCommitMemory(addr, commitSize);
+
+@@ -60,7 +70,9 @@
+
+ output = new OutputAnalyzer(pb.start());
+ output.shouldContain("Test (reserved=256KB, committed=128KB)");
+- output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
++ if (has_nmt_detail) {
++ output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
++ }
+
+ wb.NMTUncommitMemory(addr, commitSize);
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java Fri Apr 10 09:19:25 2015 -0700
+@@ -0,0 +1,534 @@
++/*
++ * Copyright (c) 2014, 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 8036823
++ * @bug 8046287
++ * @summary Creates two threads contending for the same lock and checks
++ * whether jstack reports "locked" by more than one thread.
++ *
++ * @library /testlibrary
++ * @run main/othervm TestThreadDumpMonitorContention
++ */
++
++import java.io.BufferedReader;
++import java.io.InputStreamReader;
++import java.lang.management.ManagementFactory;
++import java.lang.management.RuntimeMXBean;
++import java.util.ArrayList;
++import java.util.List;
++import java.util.regex.Matcher;
++import java.util.regex.Pattern;
++
++import com.oracle.java.testlibrary.*;
++
++public class TestThreadDumpMonitorContention {
++ // jstack tends to be closely bound to the VM that we are running
++ // so use getTestJDKTool() instead of getCompileJDKTool() or even
++ // getJDKTool() which can fall back to "compile.jdk".
++ final static String JSTACK = JDKToolFinder.getTestJDKTool("jstack");
++ final static String PID = getPid();
++
++ // looking for header lines with these patterns:
++ // "ContendingThread-1" #19 prio=5 os_prio=64 tid=0x000000000079c000 nid=0x23 runnable [0xffff80ffb8b87000]
++ // "ContendingThread-2" #21 prio=5 os_prio=64 tid=0x0000000000780000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
++ // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
++ final static Pattern HEADER_PREFIX_PATTERN = Pattern.compile(
++ "^\"ContendingThread-.*");
++ final static Pattern HEADER_WAITING_PATTERN1 = Pattern.compile(
++ "^\"ContendingThread-.* waiting for monitor entry .*");
++ final static Pattern HEADER_WAITING_PATTERN2 = Pattern.compile(
++ "^\"ContendingThread-.* waiting on condition .*");
++ final static Pattern HEADER_RUNNABLE_PATTERN = Pattern.compile(
++ "^\"ContendingThread-.* runnable .*");
++
++ // looking for thread state lines with these patterns:
++ // java.lang.Thread.State: RUNNABLE
++ // java.lang.Thread.State: BLOCKED (on object monitor)
++ final static Pattern THREAD_STATE_PREFIX_PATTERN = Pattern.compile(
++ " *java\\.lang\\.Thread\\.State: .*");
++ final static Pattern THREAD_STATE_BLOCKED_PATTERN = Pattern.compile(
++ " *java\\.lang\\.Thread\\.State: BLOCKED \\(on object monitor\\)");
++ final static Pattern THREAD_STATE_RUNNABLE_PATTERN = Pattern.compile(
++ " *java\\.lang\\.Thread\\.State: RUNNABLE");
++
++ // looking for duplicates of this pattern:
++ // - locked <0x000000076ac59e20> (a TestThreadDumpMonitorContention$1)
++ final static Pattern LOCK_PATTERN = Pattern.compile(
++ ".* locked \\<.*\\(a TestThreadDumpMonitorContention.*");
++
++ // sanity checking header and thread state lines associated
++ // with this pattern:
++ // - waiting to lock <0x000000076ac59e20> (a TestThreadDumpMonitorContention$1)
++ final static Pattern WAITING_PATTERN = Pattern.compile(
++ ".* waiting to lock \\<.*\\(a TestThreadDumpMonitorContention.*");
++
++ final static Object barrier = new Object();
++ volatile static boolean done = false;
++
++ static int barrier_cnt = 0;
++ static int blank_line_match_cnt = 0;
++ static int error_cnt = 0;
++ static boolean have_header_line = false;
++ static boolean have_thread_state_line = false;
++ static String header_line = null;
++ static int header_prefix_match_cnt = 0;
++ static int locked_line_match_cnt = 0;
++ static String[] locked_match_list = new String[2];
++ static int n_samples = 15;
++ static int sum_both_running_cnt = 0;
++ static int sum_both_waiting_cnt = 0;
++ static int sum_contended_cnt = 0;
++ static int sum_locked_hdr_runnable_cnt = 0;
++ static int sum_locked_hdr_waiting1_cnt = 0;
++ static int sum_locked_hdr_waiting2_cnt = 0;
++ static int sum_locked_thr_state_blocked_cnt = 0;
++ static int sum_locked_thr_state_runnable_cnt = 0;
++ static int sum_one_waiting_cnt = 0;
++ static int sum_uncontended_cnt = 0;
++ static int sum_waiting_hdr_waiting1_cnt = 0;
++ static int sum_waiting_thr_state_blocked_cnt = 0;
++ static String thread_state_line = null;
++ static boolean verbose = false;
++ static int waiting_line_match_cnt = 0;
++
++ public static void main(String[] args) throws Exception {
++ if (args.length != 0) {
++ int arg_i = 0;
++ if (args[arg_i].equals("-v")) {
++ verbose = true;
++ arg_i++;
++ }
++
++ try {
++ n_samples = Integer.parseInt(args[arg_i]);
++ } catch (NumberFormatException nfe) {
++ System.err.println(nfe);
++ usage();
++ }
++ }
++
++ Runnable runnable = new Runnable() {
++ public void run() {
++ synchronized (barrier) {
++ // let the main thread know we're running
++ barrier_cnt++;
++ barrier.notify();
++ }
++ while (!done) {
++ synchronized (this) { }
++ }
++ }
++ };
++ Thread[] thread_list = new Thread[2];
++ thread_list[0] = new Thread(runnable, "ContendingThread-1");
++ thread_list[1] = new Thread(runnable, "ContendingThread-2");
++ synchronized (barrier) {
++ thread_list[0].start();
++ thread_list[1].start();
++
++ // Wait until the contending threads are running so that
++ // we don't sample any thread init states.
++ while (barrier_cnt < 2) {
++ barrier.wait();
++ }
++ }
++
++ doSamples();
++
++ done = true;
++
++ thread_list[0].join();
++ thread_list[1].join();
++
++ if (error_cnt == 0) {
++ System.out.println("Test PASSED.");
++ } else {
++ System.out.println("Test FAILED.");
++ throw new AssertionError("error_cnt=" + error_cnt);
++ }
++ }
++
++ // Reached a blank line which is the end of the
++ // stack trace without matching either LOCK_PATTERN
++ // or WAITING_PATTERN. Rare, but it's not an error.
++ //
++ // Example:
++ // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
++ // java.lang.Thread.State: RUNNABLE
++ // at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
++ // at java.lang.Thread.run(Thread.java:745)
++ //
++ static boolean checkBlankLine(String line) {
++ if (line.length() == 0) {
++ blank_line_match_cnt++;
++ have_header_line = false;
++ have_thread_state_line = false;
++ return true;
++ }
++
++ return false;
++ }
++
++ // Process the locked line here if we found one.
++ //
++ // Example 1:
++ // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f runnable [0xfffffd7fc1111000]
++ // java.lang.Thread.State: RUNNABLE
++ // at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
++ // - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
++ // at java.lang.Thread.run(Thread.java:745)
++ //
++ // Example 2:
++ // "ContendingThread-1" #21 prio=5 os_prio=64 tid=0x00000000007b9000 nid=0x2f waiting for monitor entry [0xfffffd7fc1111000]
++ // java.lang.Thread.State: BLOCKED (on object monitor)
++ // at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
++ // - locked <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
++ // at java.lang.Thread.run(Thread.java:745)
++ //
++ // Example 3:
++ // "ContendingThread-2" #24 prio=5 os_prio=64 tid=0x0000000000ec8800 nid=0x31 waiting on condition [0xfffffd7bbfffe000]
++ // java.lang.Thread.State: RUNNABLE
++ // JavaThread state: _thread_blocked
++ // Thread: 0x0000000000ec8800 [0x31] State: _at_safepoint _has_called_back 0 _at_poll_safepoint 0
++ // JavaThread state: _thread_blocked
++ // at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
++ // - locked <0xfffffd7e6d03eb28> (a TestThreadDumpMonitorContention$1)
++ // at java.lang.Thread.run(Thread.java:745)
++ //
++ static boolean checkLockedLine(String line) {
++ Matcher matcher = LOCK_PATTERN.matcher(line);
++ if (matcher.matches()) {
++ if (verbose) {
++ System.out.println("locked_line='" + line + "'");
++ }
++ locked_match_list[locked_line_match_cnt] = new String(line);
++ locked_line_match_cnt++;
++
++ matcher = HEADER_RUNNABLE_PATTERN.matcher(header_line);
++ if (matcher.matches()) {
++ sum_locked_hdr_runnable_cnt++;
++ } else {
++ // It's strange, but a locked line can also
++ // match the HEADER_WAITING_PATTERN{1,2}.
++ matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
++ if (matcher.matches()) {
++ sum_locked_hdr_waiting1_cnt++;
++ } else {
++ matcher = HEADER_WAITING_PATTERN2.matcher(header_line);
++ if (matcher.matches()) {
++ sum_locked_hdr_waiting2_cnt++;
++ } else {
++ System.err.println();
++ System.err.println("ERROR: header line does " +
++ "not match runnable or waiting patterns.");
++ System.err.println("ERROR: header_line='" +
++ header_line + "'");
++ System.err.println("ERROR: locked_line='" + line +
++ "'");
++ error_cnt++;
++ }
++ }
++ }
++
++ matcher = THREAD_STATE_RUNNABLE_PATTERN.matcher(thread_state_line);
++ if (matcher.matches()) {
++ sum_locked_thr_state_runnable_cnt++;
++ } else {
++ // It's strange, but a locked line can also
++ // match the THREAD_STATE_BLOCKED_PATTERN.
++ matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(
++ thread_state_line);
++ if (matcher.matches()) {
++ sum_locked_thr_state_blocked_cnt++;
++ } else {
++ System.err.println();
++ System.err.println("ERROR: thread state line does not " +
++ "match runnable or waiting patterns.");
++ System.err.println("ERROR: " + "thread_state_line='" +
++ thread_state_line + "'");
++ System.err.println("ERROR: locked_line='" + line + "'");
++ error_cnt++;
++ }
++ }
++
++ // Have everything we need from this thread stack
++ // that matches the LOCK_PATTERN.
++ have_header_line = false;
++ have_thread_state_line = false;
++ return true;
++ }
++
++ return false;
++ }
++
++ // Process the waiting line here if we found one.
++ //
++ // Example:
++ // "ContendingThread-2" #22 prio=5 os_prio=64 tid=0x00000000007b9800 nid=0x30 waiting for monitor entry [0xfffffd7fc1010000]
++ // java.lang.Thread.State: BLOCKED (on object monitor)
++ // at TestThreadDumpMonitorContention$1.run(TestThreadDumpMonitorContention.java:140)
++ // - waiting to lock <0xfffffd7e6a2912f8> (a TestThreadDumpMonitorContention$1)
++ // at java.lang.Thread.run(Thread.java:745)
++ //
++ static boolean checkWaitingLine(String line) {
++ Matcher matcher = WAITING_PATTERN.matcher(line);
++ if (matcher.matches()) {
++ waiting_line_match_cnt++;
++ if (verbose) {
++ System.out.println("waiting_line='" + line + "'");
++ }
++
++ matcher = HEADER_WAITING_PATTERN1.matcher(header_line);
++ if (matcher.matches()) {
++ sum_waiting_hdr_waiting1_cnt++;
++ } else {
++ System.err.println();
++ System.err.println("ERROR: header line does " +
++ "not match a waiting pattern.");
++ System.err.println("ERROR: header_line='" + header_line + "'");
++ System.err.println("ERROR: waiting_line='" + line + "'");
++ error_cnt++;
++ }
++
++ matcher = THREAD_STATE_BLOCKED_PATTERN.matcher(thread_state_line);
++ if (matcher.matches()) {
++ sum_waiting_thr_state_blocked_cnt++;
++ } else {
++ System.err.println();
++ System.err.println("ERROR: thread state line " +
++ "does not match a waiting pattern.");
++ System.err.println("ERROR: thread_state_line='" +
++ thread_state_line + "'");
++ System.err.println("ERROR: waiting_line='" + line + "'");
++ error_cnt++;
++ }
++
++ // Have everything we need from this thread stack
++ // that matches the WAITING_PATTERN.
++ have_header_line = false;
++ have_thread_state_line = false;
++ return true;
++ }
++
++ return false;
++ }
++
++ static void doSamples() throws Exception {
++ for (int count = 0; count < n_samples; count++) {
++ blank_line_match_cnt = 0;
++ header_prefix_match_cnt = 0;
++ locked_line_match_cnt = 0;
++ waiting_line_match_cnt = 0;
++ // verbose mode or an error has a lot of output so add more space
++ if (verbose || error_cnt > 0) System.out.println();
++ System.out.println("Sample #" + count);
++
++ // We don't use the ProcessTools, OutputBuffer or
++ // OutputAnalyzer classes from the testlibrary because
++ // we have a complicated multi-line parse to perform
++ // on a narrow subset of the JSTACK output.
++ //
++ // - we only care about stack traces that match
++ // HEADER_PREFIX_PATTERN; only two should match
++ // - we care about at most three lines from each stack trace
++ // - if both stack traces match LOCKED_PATTERN, then that's
++ // a failure and we report it
++ // - for a stack trace that matches LOCKED_PATTERN, we verify:
++ // - the header line matches HEADER_RUNNABLE_PATTERN
++ // or HEADER_WAITING_PATTERN{1,2}
++ // - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
++ // or THREAD_STATE_RUNNABLE_PATTERN
++ // - we report any mismatches as failures
++ // - for a stack trace that matches WAITING_PATTERN, we verify:
++ // - the header line matches HEADER_WAITING_PATTERN1
++ // - the thread state line matches THREAD_STATE_BLOCKED_PATTERN
++ // - we report any mismatches as failures
++ // - the stack traces that match HEADER_PREFIX_PATTERN may
++ // not match either LOCKED_PATTERN or WAITING_PATTERN
++ // because we might observe the thread outside of
++ // monitor operations; this is not considered a failure
++ //
++ // When we do observe LOCKED_PATTERN or WAITING_PATTERN,
++ // then we are checking the header and thread state patterns
++ // that occurred earlier in the current stack trace that
++ // matched HEADER_PREFIX_PATTERN. We don't use data from
++ // stack traces that don't match HEADER_PREFIX_PATTERN and
++ // we don't mix data between the two stack traces that do
++ // match HEADER_PREFIX_PATTERN.
++ //
++ Process process = new ProcessBuilder(JSTACK, PID)
++ .redirectErrorStream(true).start();
++
++ BufferedReader reader = new BufferedReader(new InputStreamReader(
++ process.getInputStream()));
++ String line;
++ while ((line = reader.readLine()) != null) {
++ Matcher matcher = null;
++
++ // process the header line here
++ if (!have_header_line) {
++ matcher = HEADER_PREFIX_PATTERN.matcher(line);
++ if (matcher.matches()) {
++ header_prefix_match_cnt++;
++ if (verbose) {
++ System.out.println();
++ System.out.println("header='" + line + "'");
++ }
++ header_line = new String(line);
++ have_header_line = true;
++ continue;
++ }
++ continue; // skip until have a header line
++ }
++
++ // process the thread state line here
++ if (!have_thread_state_line) {
++ matcher = THREAD_STATE_PREFIX_PATTERN.matcher(line);
++ if (matcher.matches()) {
++ if (verbose) {
++ System.out.println("thread_state='" + line + "'");
++ }
++ thread_state_line = new String(line);
++ have_thread_state_line = true;
++ continue;
++ }
++ continue; // skip until we have a thread state line
++ }
++
++ // process the locked line here if we find one
++ if (checkLockedLine(line)) {
++ continue;
++ }
++
++ // process the waiting line here if we find one
++ if (checkWaitingLine(line)) {
++ continue;
++ }
++
++ // process the blank line here if we find one
++ if (checkBlankLine(line)) {
++ continue;
++ }
++ }
++ process.waitFor();
++
++ if (header_prefix_match_cnt != 2) {
++ System.err.println();
++ System.err.println("ERROR: should match exactly two headers.");
++ System.err.println("ERROR: header_prefix_match_cnt=" +
++ header_prefix_match_cnt);
++ error_cnt++;
++ }
++
++ if (locked_line_match_cnt == 2) {
++ if (locked_match_list[0].equals(locked_match_list[1])) {
++ System.err.println();
++ System.err.println("ERROR: matching lock lines:");
++ System.err.println("ERROR: line[0]'" +
++ locked_match_list[0] + "'");
++ System.err.println("ERROR: line[1]'" +
++ locked_match_list[1] + "'");
++ error_cnt++;
++ }
++ }
++
++ if (locked_line_match_cnt == 1) {
++ // one thread has the lock
++ if (waiting_line_match_cnt == 1) {
++ // and the other contended for it
++ sum_contended_cnt++;
++ } else {
++ // and the other is just running
++ sum_uncontended_cnt++;
++ }
++ } else if (waiting_line_match_cnt == 1) {
++ // one thread is waiting
++ sum_one_waiting_cnt++;
++ } else if (waiting_line_match_cnt == 2) {
++ // both threads are waiting
++ sum_both_waiting_cnt++;
++ } else {
++ // both threads are running
++ sum_both_running_cnt++;
++ }
++
++ // slight delay between jstack launches
++ Thread.sleep(500);
++ }
++
++ if (error_cnt != 0) {
++ // skip summary info since there were errors
++ return;
++ }
++
++ System.out.println("INFO: Summary for all samples:");
++ System.out.println("INFO: both_running_cnt=" + sum_both_running_cnt);
++ System.out.println("INFO: both_waiting_cnt=" + sum_both_waiting_cnt);
++ System.out.println("INFO: contended_cnt=" + sum_contended_cnt);
++ System.out.println("INFO: one_waiting_cnt=" + sum_one_waiting_cnt);
++ System.out.println("INFO: uncontended_cnt=" + sum_uncontended_cnt);
++ System.out.println("INFO: locked_hdr_runnable_cnt=" +
++ sum_locked_hdr_runnable_cnt);
++ System.out.println("INFO: locked_hdr_waiting1_cnt=" +
++ sum_locked_hdr_waiting1_cnt);
++ System.out.println("INFO: locked_hdr_waiting2_cnt=" +
++ sum_locked_hdr_waiting2_cnt);
++ System.out.println("INFO: locked_thr_state_blocked_cnt=" +
++ sum_locked_thr_state_blocked_cnt);
++ System.out.println("INFO: locked_thr_state_runnable_cnt=" +
++ sum_locked_thr_state_runnable_cnt);
++ System.out.println("INFO: waiting_hdr_waiting1_cnt=" +
++ sum_waiting_hdr_waiting1_cnt);
++ System.out.println("INFO: waiting_thr_state_blocked_cnt=" +
++ sum_waiting_thr_state_blocked_cnt);
++
++ if (sum_contended_cnt == 0) {
++ System.err.println("WARNING: the primary scenario for 8036823" +
++ " has not been exercised by this test run.");
++ }
++ }
++
++ // This helper relies on RuntimeMXBean.getName() returning a string
++ // that looks like this: 5436@mt-haku
++ //
++ // The testlibrary has tryFindJvmPid(), but that uses a separate
++ // process which is much more expensive for finding out your own PID.
++ //
++ static String getPid() {
++ RuntimeMXBean runtimebean = ManagementFactory.getRuntimeMXBean();
++ String vmname = runtimebean.getName();
++ int i = vmname.indexOf('@');
++ if (i != -1) {
++ vmname = vmname.substring(0, i);
++ }
++ return vmname;
++ }
++
++ static void usage() {
++ System.err.println("Usage: " +
++ "java TestThreadDumpMonitorContention [-v] [n_samples]");
++ System.exit(1);
++ }
++}
+--- ./hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Mon Jan 05 11:51:17 2015 -0800
++++ ./hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java Fri Apr 10 09:19:25 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2012, 2015 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 @@
+ public native void NMTUncommitMemory(long addr, long size);
+ public native void NMTReleaseMemory(long addr, long size);
+ public native boolean NMTWaitForDataMerge();
++ public native boolean NMTIsDetailSupported();
++
+
+ // Compiler
+ public native void deoptimizeAll();
+--- ./jaxp/.hgtags Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/.hgtags Fri Apr 10 09:20:34 2015 -0700
+@@ -528,6 +528,10 @@
+ fec38133453a8d70d4c528595ae1cab47909c4bd jdk7u72-b14
+ e8ab19435208726b1334ba8e7928ea154e0959b3 jdk7u72-b30
+ d8246774af472f617033202d2c58c7572da08dcd jdk7u72-b31
++5746a9dc6d98c5eaab46abe75046b2fcec2615cf jdk7u72-b32
++abfb7aff6d5e8751329f190606f174716e071142 jdk7u72-b33
++ad3595ac75f0439da4e06ace8e304505ab42a332 jdk7u72-b34
++5b30e9e24618919b163bee78f80cd72953c9efd0 jdk7u72-b35
+ 4173f90038ff1764576d08efa34109a7895f106b jdk7u75-b00
+ b9eaa7d194dd5e23bd2d53be4d57b25fdcb08e31 jdk7u75-b01
+ 98eaae4f301779861be3f9a8b0854ec83074615a jdk7u75-b02
+@@ -559,3 +563,37 @@
+ 7167fcf821b00424c0464086f4047a7209dc9e59 jdk7u76-b12
+ 6262c3d41bb13f58338c4bc7946468ba70825046 jdk7u76-b13
+ d3907dca5ffc798076f44cc63f01f7beb41343a9 jdk7u76-b30
++ddfc89ace6cc33a2d50d5faf100e83b05c9bc89f jdk7u76-b31
++3cc58d4693ba7c2207265a50ae47f59610b3bb95 jdk7u76-b32
++908a056c8d8fa65864cbf5745a050f675be35288 jdk7u79-b00
++186146d5ce15b9478e520d9a44eb520572a66214 jdk7u79-b01
++acb3bc40a605ab2502c46b92c63a6954bf7c4426 jdk7u79-b02
++8d582e90be853e4fff06decc0d1f3bc384f28565 jdk7u79-b03
++9d2f3145e62f4a65541ffaf818d4f200258a54ee jdk7u79-b06
++c078b41da91eeef6f2a7a9740603ffa597282cf2 jdk7u79-b07
++5a9ebb8b61b6b97b0f7a56ff822ff3780f848f9b jdk7u79-b08
++96f58e926ff3e058094ad98bb8d01c4583e50f1f jdk7u79-b09
++74b91551a3812d6bbb6d75c969b13d0df60fc292 jdk7u79-b10
++953714f7b347a3253188e88df32a6de98d035d68 jdk7u79-b11
++c7d64c66bd125b22b0dd03f0191e400b254171ee jdk7u79-b12
++73bc7d77706a857d71459e9869cc87c734818d7e jdk7u79-b13
++42032dfbad5ff5d9c9378cb25530e5fa1f226b9a jdk7u79-b14
++cc39af7b95bb2e96b512b09ecb6dc55bbced4cb6 jdk7u79-b30
++6abf26813c3bd6047d5425e41dbc9dd1fd51cc63 jdk7u79-b15
++7215972c2c30d0fa469a459a3e4fcee6bc93991d jdk7u80-b00
++4c959b6a32057ec18c9c722ada3d0d0c716a51c4 jdk7u80-b01
++25a1b88d7a473e067471e00a5457236736e9a2e0 jdk7u80-b02
++1853995499cef61fc16e0e4b840276223314669b jdk7u80-b03
++3f6f053831796f654ad8fd77a6e4f99163742649 jdk7u80-b04
++b93c3e02132fd13971aea6df3c5f6fcd4c3b1780 jdk7u80-b05
++d220098f4f327db250263b6c2b460fecec19331a jdk7u80-b06
++535bdb640a91a8562b96799cefe9de94724ed761 jdk7u80-b07
++3999f9baa3f0a28f82c6a7a073ad2f7a8e12866d jdk7u80-b08
++76c9692a8e0a5c083840ca71a82711d1c6407230 jdk7u80-b09
++a2175451904c4a58441ddb8433cee13bc5f0e81c jdk7u80-b10
++7a4d5aa53c358761036c8f9c0aa0730991f03c8a jdk7u80-b11
++b16012262d1fa91f2d09631f923130f35b8e34a0 jdk7u80-b12
++99e388ae0080339b5369ff7b2b1e2c0c0c17be6a jdk7u80-b13
++127be49051292a2f1af3375f7c433fa19e1b8898 jdk7u80-b14
++1b435d2f2050ac43a7f89aadd0fdaa9bf0441e3d jdk7u80-b30
++acfe75cb9d7a723fbaae0bf7e1b0fb3429df4ff8 jdk7u80-b15
+--- ./jaxp/THIRD_PARTY_README Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/THIRD_PARTY_README Fri Apr 10 09:20:34 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./jaxp/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/bcel/internal/classfile/DescendingVisitor.java Fri Apr 10 09:20:34 2015 -0700
+@@ -213,6 +213,10 @@
+ public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {
+ stack.push(obj);
+ obj.accept(visitor);
++
++ LocalVariable[] vars = obj.getLocalVariableTypeTable();
++ for(int i=0; i < vars.length; i++)
++ vars[i].accept(this);
+ stack.pop();
+ }
+
+--- ./jaxp/src/com/sun/org/apache/bcel/internal/generic/MethodGen.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/bcel/internal/generic/MethodGen.java Fri Apr 10 09:20:34 2015 -0700
+@@ -87,6 +87,7 @@
+ private boolean strip_attributes;
+
+ private ArrayList variable_vec = new ArrayList();
++ private ArrayList type_vec = new ArrayList();
+ private ArrayList line_number_vec = new ArrayList();
+ private ArrayList exception_vec = new ArrayList();
+ private ArrayList throws_vec = new ArrayList();
+@@ -260,7 +261,7 @@
+ }
+ } else if (a instanceof LocalVariableTypeTable) {
+ LocalVariable[] lv = ((LocalVariableTypeTable) a).getLocalVariableTypeTable();
+- removeLocalVariables();
++ removeLocalVariableTypes();
+ for (int k = 0; k < lv.length; k++) {
+ LocalVariable l = lv[k];
+ InstructionHandle start = il.findHandle(l.getStartPC());
+@@ -272,7 +273,7 @@
+ if (null == end) {
+ end = il.getEnd();
+ }
+- addLocalVariable(l.getName(), Type.getType(l.getSignature()), l
++ addLocalVariableType(l.getName(), Type.getType(l.getSignature()), l
+ .getIndex(), start, end);
+ }
+ } else
+@@ -406,6 +407,31 @@
+ return lg;
+ }
+
++ /*
++ * If the range of the variable has not been set yet, it will be set to be
++ * val id from the start to the end of the instruction list.
++ *
++ * @return array of declared local variable types sorted by index
++ */
++ private LocalVariableGen[] getLocalVariableTypes() {
++ int size = type_vec.size();
++ LocalVariableGen[] lg = new LocalVariableGen[size];
++ type_vec.toArray(lg);
++
++ for(int i=0; i < size; i++) {
++ if(lg[i].getStart() == null)
++ lg[i].setStart(il.getStart());
++
++ if(lg[i].getEnd() == null)
++ lg[i].setEnd(il.getEnd());
++ }
++
++ if(size > 1)
++ sort(lg, 0, size - 1);
++
++ return lg;
++ }
++
+ /**
+ * @return `LocalVariableTable' attribute of all the local variables of this method.
+ */
+@@ -422,6 +448,68 @@
+ }
+
+ /**
++ * @return `LocalVariableTypeTable' attribute of all the local variable
++ * types of this method.
++ */
++ public LocalVariableTypeTable getLocalVariableTypeTable(ConstantPoolGen cp) {
++ LocalVariableGen[] lg = getLocalVariableTypes();
++ int size = lg.length;
++ LocalVariable[] lv = new LocalVariable[size];
++
++ for(int i=0; i < size; i++)
++ lv[i] = lg[i].getLocalVariable(cp);
++
++ return new LocalVariableTypeTable(cp.addUtf8("LocalVariableTypeTable"),
++ 2 + lv.length * 10, lv, cp.getConstantPool());
++ }
++
++ /**
++ * Adds a local variable type to this method.
++ *
++ * @param name variable name
++ * @param type variable type
++ * @param slot the index of the local variable, if type is long or double, the next available
++ * index is slot+2
++ * @param start from where the variable is valid
++ * @param end until where the variable is valid
++ * @return new local variable object
++ * @see LocalVariable
++ */
++ private LocalVariableGen addLocalVariableType(String name, Type type, int slot,
++ InstructionHandle start,
++ InstructionHandle end) {
++ byte t = type.getType();
++
++ if(t != Constants.T_ADDRESS) {
++ int add = type.getSize();
++
++ if(slot + add > max_locals)
++ max_locals = slot + add;
++
++ LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end);
++ int i;
++
++ if((i = type_vec.indexOf(l)) >= 0) // Overwrite if necessary
++ type_vec.set(i, l);
++ else
++ type_vec.add(l);
++
++ return l;
++ } else {
++ throw new IllegalArgumentException("Can not use " + type +
++ " as type for local variable");
++
++ }
++ }
++
++ /**
++ * Remove all local variable types.
++ */
++ private void removeLocalVariableTypes() {
++ type_vec.clear();
++ }
++
++ /**
+ * Give an instruction a line number corresponding to the source code line.
+ *
+ * @param ih instruction to tag
+@@ -637,12 +725,17 @@
+
+ LineNumberTable lnt = null;
+ LocalVariableTable lvt = null;
++ LocalVariableTypeTable lvtt = null;
+
+- /* Create LocalVariableTable and LineNumberTable attributes (for debuggers, e.g.)
++ /* Create LocalVariableTable, LocalvariableTypeTable, and LineNumberTable
++ * attributes (for debuggers, e.g.)
+ */
+ if((variable_vec.size() > 0) && !strip_attributes)
+ addCodeAttribute(lvt = getLocalVariableTable(cp));
+
++ if((type_vec.size() > 0) && !strip_attributes)
++ addCodeAttribute(lvtt = getLocalVariableTypeTable(cp));
++
+ if((line_number_vec.size() > 0) && !strip_attributes)
+ addCodeAttribute(lnt = getLineNumberTable(cp));
+
+@@ -691,6 +784,7 @@
+
+ // Undo effects of adding attributes
+ if(lvt != null) removeCodeAttribute(lvt);
++ if(lvtt != null) removeCodeAttribute(lvtt);
+ if(lnt != null) removeCodeAttribute(lnt);
+ if(code != null) removeAttribute(code);
+ if(et != null) removeAttribute(et);
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Fri Apr 10 09:20:34 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2011, 2015, 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
+@@ -151,6 +151,16 @@
+ */
+ public static final String SP_MAX_ELEMENT_DEPTH = "jdk.xml.maxElementDepth";
+
++ /**
++ * JDK TransformerFactory and Transformer attribute that specifies a class
++ * loader that will be used for extension functions class loading
++ * Value: a "null", the default value, means that the default EF class loading
++ * path will be used.
++ * Instance of ClassLoader: the specified instance of ClassLoader will be used
++ * for extension functions loading during translation process
++ */
++ public static final String JDK_EXTENSION_CLASSLOADER = "jdk.xml.transform.extensionClassLoader";
++
+ //legacy System Properties
+ public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
+ public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_de.java,v 1.2.4.1 2005/09/13 10:08:18 pvedula Exp $
++ * $Id: XSLTErrorResources_de.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -1016,7 +1016,7 @@
+ "Systemeigenschaft \"org.xml.sax.parser\" nicht angegeben"},
+
+ { ER_PARSER_ARG_CANNOT_BE_NULL,
+- "Parser-Argument darf nicht null sein"},
++ "Parserargument darf nicht null sein"},
+
+ { ER_FEATURE,
+ "Feature: {0}"},
+@@ -1213,7 +1213,7 @@
+ "Funktionsname darf nicht null sein."},
+
+ { ER_XPATH_RESOLVER_NEGATIVE_ARITY,
+- "Anzahl von Argumenten darf nicht negativ sein."},
++ "Argumentanzahl darf nicht negativ sein."},
+ // Warnings...
+
+ { WG_FOUND_CURLYBRACE,
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (Stiller Modus)]"},
+ { "optionLF", " [-LF (Nur Zeilenvorsch\u00FCbe bei Ausgabe verwenden {Standard ist CR/LF})]"},
+ { "optionCR", " [-CR (Nur Zeilenschaltungen bei Ausgabe verwenden {Standard ist CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (Escape-Zeichen {Standard ist <>&\"\'\r\n}]"},
++ { "optionESCAPE", " [-ESCAPE (Escapezeichen {Standard ist <>&\"'\r\n}]"},
+ { "optionINDENT", " [-INDENT (Steuern, wie viele Leerzeichen der Einzug enthalten soll {Standard ist 0})]"},
+ { "optionTT", " [-TT (Vorlagen verfolgen, wenn diese aufgerufen werden.)]"},
+ { "optionTG", " [-TG (Jedes Generierungsereignis verfolgen.)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_es.java,v 1.2.4.1 2005/09/13 10:16:43 pvedula Exp $
++ * $Id: XSLTErrorResources_es.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (Modo Silencioso)]"},
+ { "optionLF", " [-LF (Utilizar saltos de l\u00EDnea s\u00F3lo en la salida {el valor por defecto es CR/LF})]"},
+ { "optionCR", " [-CR (Utilizar retornos de carro s\u00F3lo en la salida {el valor por defecto es CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (Caracteres para introducir escape {el valor por defecto es <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (Caracteres para introducir escape {el valor por defecto es <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (Control del n\u00FAmero de espacios para el sangrado {el valor por defecto es 0})]"},
+ { "optionTT", " [-TT (Rastrear las plantillas como si se estuviesen llamando.)]"},
+ { "optionTG", " [-TG (Rastrear cada evento de generaci\u00F3n.)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_fr.java,v 1.2.4.1 2005/09/13 10:20:30 pvedula Exp $
++ * $Id: XSLTErrorResources_fr.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -931,7 +931,7 @@
+ "Gestionnaire de contenu NULL"},
+
+ { ER_NULL_ERROR_HANDLER,
+- "Gestionnaire d'erreur NULL"},
++ "Gestionnaire d'erreurs NULL"},
+
+ { ER_CANNOT_CALL_PARSE,
+ "impossible d'appeler l'analyse si le gestionnaire de contenu n'est pas d\u00E9fini"},
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (Mode silencieux)]"},
+ { "optionLF", " [-LF (Utiliser les retours \u00E0 la ligne uniquement en sortie {valeur par d\u00E9faut : CR/LF})]"},
+ { "optionCR", " [-CR (Utiliser les retours chariot uniquement en sortie {valeur par d\u00E9faut : CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (Avec caract\u00E8res d'espacement {valeur par d\u00E9faut : <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (Avec caract\u00E8res d'espacement {valeur par d\u00E9faut : <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (Contr\u00F4ler le nombre d'espaces \u00E0 mettre en retrait {valeur par d\u00E9faut : 0})]"},
+ { "optionTT", " [-TT (G\u00E9n\u00E9rer une trace des mod\u00E8les pendant qu'ils sont appel\u00E9s.)]"},
+ { "optionTG", " [-TG (G\u00E9n\u00E9rer une trace de chaque \u00E9v\u00E9nement de g\u00E9n\u00E9ration.)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_it.java,v 1.2.4.1 2005/09/13 10:23:57 pvedula Exp $
++ * $Id: XSLTErrorResources_it.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (modalit\u00E0 silenziosa)]"},
+ { "optionLF", " [-LF (usa avanzamenti riga solo nell'output {il valore predefinito \u00E8 CR/LF})]"},
+ { "optionCR", " [-CR (usa ritorni a capo solo nell'output {il valore predefinito \u00E8 CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (caratteri da sottoporre a escape {il valore predefinito \u00E8 <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (caratteri da sottoporre a escape {il valore predefinito \u00E8 <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (determina il numero di spazi da indentare {il valore predefinito \u00E8 0})]"},
+ { "optionTT", " [-TT (tiene traccia dei modelli mentre vengono richiamati.)]"},
+ { "optionTG", " [-TG (tiene traccia di ogni evento di generazione.)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_ja.java,v 1.2.4.1 2005/09/13 10:34:30 pvedula Exp $
++ * $Id: XSLTErrorResources_ja.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -775,7 +775,7 @@
+ "\u5165\u529BDOM\u30CE\u30FC\u30C9\u306BDTMLiaison\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093...\u304B\u308F\u308A\u306Bcom.sun.org.apache.xpath.internal.DOM2Helper\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+
+ { ER_CALL_TO_EXT_FAILED,
+- "\u62E1\u5F35\u8981\u7D20\u306E\u547C\u51FA\u3057\u306B\u5931\u6557\u3057\u307E\u3057\u305F: {0}"},
++ "\u62E1\u5F35\u8981\u7D20\u306E\u547C\u51FA\u3057\u304C\u5931\u6557\u3057\u307E\u3057\u305F: {0}"},
+
+ { ER_PREFIX_MUST_RESOLVE,
+ "\u63A5\u982D\u8F9E\u306F\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306B\u89E3\u6C7A\u3055\u308C\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059: {0}"},
+@@ -1337,8 +1337,8 @@
+ // Note to translators: The following messages provide usage information
+ // for the Xalan Process command line. "Process" is the name of a Java class,
+ // and should not be translated.
+- { "xslProc_option", "Xalan-J\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30D7\u30ED\u30BB\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u30AA\u30D7\u30B7\u30E7\u30F3:"},
+- { "xslProc_option", "Xalan-J\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30D7\u30ED\u30BB\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u30AA\u30D7\u30B7\u30E7\u30F3:"},
++ { "xslProc_option", "Xalan-J\u30B3\u30DE\u30F3\u30C9\u884C\u30D7\u30ED\u30BB\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u30AA\u30D7\u30B7\u30E7\u30F3:"},
++ { "xslProc_option", "Xalan-J\u30B3\u30DE\u30F3\u30C9\u884C\u30D7\u30ED\u30BB\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u30AA\u30D7\u30B7\u30E7\u30F3:"},
+ { "xslProc_invalid_xsltc_option", "\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306FXSLTC\u30E2\u30FC\u30C9\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"},
+ { "xslProc_invalid_xalan_option", "\u30AA\u30D7\u30B7\u30E7\u30F3{0}\u306F-XSLTC\u3068\u3068\u3082\u306B\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059\u3002"},
+ { "xslProc_no_input", "\u30A8\u30E9\u30FC: \u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u307E\u305F\u306F\u5165\u529Bxml\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u4F7F\u7528\u65B9\u6CD5\u306E\u6307\u793A\u306B\u3064\u3044\u3066\u306F\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u4ED8\u3051\u305A\u306B\u3053\u306E\u30B3\u30DE\u30F3\u30C9\u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (\u6291\u5236\u30E2\u30FC\u30C9)]"},
+ { "optionLF", " [-LF (\u51FA\u529B\u3067\u306E\u307F\u6539\u884C\u3092\u4F7F\u7528{\u30C7\u30D5\u30A9\u30EB\u30C8\u306FCR/LF})]"},
+ { "optionCR", " [-CR (\u51FA\u529B\u3067\u306E\u307F\u6539\u884C\u3092\u4F7F\u7528{\u30C7\u30D5\u30A9\u30EB\u30C8\u306FCR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (\u30A8\u30B9\u30B1\u30FC\u30D7\u3059\u308B\u6587\u5B57{\u30C7\u30D5\u30A9\u30EB\u30C8\u306F<>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (\u30A8\u30B9\u30B1\u30FC\u30D7\u3059\u308B\u6587\u5B57{\u30C7\u30D5\u30A9\u30EB\u30C8\u306F<>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (\u30A4\u30F3\u30C7\u30F3\u30C8\u3059\u308B\u7A7A\u767D\u6587\u5B57\u6570\u3092\u5236\u5FA1{\u30C7\u30D5\u30A9\u30EB\u30C8\u306F0})]"},
+ { "optionTT", " [-TT (\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u304C\u547C\u3073\u51FA\u3055\u308C\u305F\u3068\u304D\u306B\u30C8\u30EC\u30FC\u30B9\u3059\u308B\u3002)]"},
+ { "optionTG", " [-TG (\u5404\u751F\u6210\u30A4\u30D9\u30F3\u30C8\u3092\u30C8\u30EC\u30FC\u30B9\u3059\u308B\u3002)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_ko.java,v 1.2.4.1 2005/09/13 11:03:57 pvedula Exp $
++ * $Id: XSLTErrorResources_ko.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:58 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q(\uC790\uB3D9 \uBAA8\uB4DC)]"},
+ { "optionLF", " [-LF(\uCD9C\uB825\uC5D0\uB9CC \uC904 \uBC14\uAFC8 \uC0AC\uC6A9 {\uAE30\uBCF8\uAC12: CR/LF})]"},
+ { "optionCR", " [-CR(\uCD9C\uB825\uC5D0\uB9CC \uCE90\uB9AC\uC9C0 \uB9AC\uD134 \uC0AC\uC6A9 {\uAE30\uBCF8\uAC12: CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE(\uC774\uC2A4\uCF00\uC774\uD504 \uBB38\uC790 {\uAE30\uBCF8\uAC12: <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE(\uC774\uC2A4\uCF00\uC774\uD504 \uBB38\uC790 {\uAE30\uBCF8\uAC12: <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT(\uB4E4\uC5EC \uC4F8 \uACF5\uBC31 \uC218 \uC81C\uC5B4 {\uAE30\uBCF8\uAC12: 0})]"},
+ { "optionTT", " [-TT(\uD15C\uD50C\uB9AC\uD2B8 \uD638\uCD9C \uC2DC \uCD94\uC801)]"},
+ { "optionTG", " [-TG(\uAC01 \uC0DD\uC131 \uC774\uBCA4\uD2B8 \uCD94\uC801)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,9 +17,8 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-
+ /*
+- * $Id: XSLTErrorResources_pt_BR.java 3023 2011-03-01 00:53:34Z joehw $
++ * $Id: XSLTErrorResources_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -631,7 +630,7 @@
+ "Falha ao processar a folha de estilos!"},
+
+ { ER_COULDNT_PARSE_DOC,
+- "N\u00E3o foi poss\u00EDvel fazer parse do documento {0}!"},
++ "N\u00E3o foi poss\u00EDvel fazer parsing do documento {0}!"},
+
+ { ER_COULDNT_FIND_FRAGMENT,
+ "N\u00E3o foi poss\u00EDvel localizar o fragmento: {0}"},
+@@ -673,7 +672,7 @@
+ "result-ns n\u00E3o \u00E9 mais suportado! Em vez disso, use xsl:output."},
+
+ { ER_DEFAULTSPACE_NOT_SUPPORTED,
+- "default-space n\u00E3o \u00E9 mais suportado! Em vez disso, use xsl:strip-space ou xsl:preserve-space."},
++ "padr\u00E3o-space n\u00E3o \u00E9 mais suportado! Em vez disso, use xsl:strip-space ou xsl:preserve-space."},
+
+ { ER_INDENTRESULT_NOT_SUPPORTED,
+ "indent-result n\u00E3o \u00E9 mais suportado! Em vez disso, use xsl:output."},
+@@ -908,10 +907,10 @@
+ "2 ou 3"},
+
+ { ER_COULD_NOT_LOAD_RESOURCE,
+- "N\u00E3o foi poss\u00EDvel carregar {0} (verificar CLASSPATH); usando agora apenas os defaults"},
++ "N\u00E3o foi poss\u00EDvel carregar {0} (verificar CLASSPATH); usando agora apenas os padr\u00F5es"},
+
+ { ER_CANNOT_INIT_DEFAULT_TEMPLATES,
+- "N\u00E3o \u00E9 poss\u00EDvel inicializar os modelos default"},
++ "N\u00E3o \u00E9 poss\u00EDvel inicializar os modelos padr\u00E3o"},
+
+ { ER_RESULT_NULL,
+ "O resultado n\u00E3o deve ser nulo"},
+@@ -935,7 +934,7 @@
+ "Handler de erro nulo"},
+
+ { ER_CANNOT_CALL_PARSE,
+- "o parse n\u00E3o poder\u00E1 ser chamado se o ContentHandler n\u00E3o tiver sido definido"},
++ "o parsing n\u00E3o poder\u00E1 ser chamado se o ContentHandler n\u00E3o tiver sido definido"},
+
+ { ER_NO_PARENT_FOR_FILTER,
+ "Nenhum pai para o filtro"},
+@@ -969,7 +968,7 @@
+ //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc.
+ //NOTE: Not only the key name but message has also been changed.
+ { ER_VALUE_SHOULD_BE_NUMBER,
+- "O valor para {0} deve conter um n\u00FAmero pass\u00EDvel de parse"},
++ "O valor para {0} deve conter um n\u00FAmero pass\u00EDvel de parsing"},
+
+ { ER_VALUE_SHOULD_EQUAL,
+ "O valor para {0} deve ser igual a sim ou n\u00E3o"},
+@@ -1187,7 +1186,7 @@
+ "O valor do par\u00E2metro {0} deve ser um Objeto Java v\u00E1lido"},
+
+ { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT,
+- "O atributo result-prefix de um elemento xsl:namespace-alias tem o valor '#default', mas n\u00E3o h\u00E1 declara\u00E7\u00E3o do namespace default no escopo do elemento"},
++ "O atributo result-prefix de um elemento xsl:namespace-alias tem o valor '#padr\u00E3o', mas n\u00E3o h\u00E1 declara\u00E7\u00E3o do namespace padr\u00E3o no escopo do elemento"},
+
+ { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX,
+ "O atributo result-prefix de um elemento xsl:namespace-alias tem o valor ''{0}'', mas n\u00E3o h\u00E1 declara\u00E7\u00E3o de namespace para o prefixo ''{0}'' no escopo do elemento."},
+@@ -1254,7 +1253,7 @@
+ "Conflitos de especificidade encontrados: {0} Ser\u00E1 usado o \u00FAltimo encontrado na folha de estilos."},
+
+ { WG_PARSING_AND_PREPARING,
+- "========= Fazendo parse e preparando {0} =========="},
++ "========= Fazendo parsing e preparando {0} =========="},
+
+ { WG_ATTR_TEMPLATE,
+ "Modelo do Atributo, {0}"},
+@@ -1272,7 +1271,7 @@
+ "Namespace de XSLT n\u00E3o encontrado ou incorreto. "},
+
+ { WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED,
+- "\u00C9 permitida somente uma declara\u00E7\u00E3o de xsl:decimal-format default."},
++ "\u00C9 permitida somente uma declara\u00E7\u00E3o de xsl:decimal-format padr\u00E3o."},
+
+ { WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE,
+ "os nomes de xsl:decimal-format devem ser exclusivos. O nome \"{0}\" foi duplicado."},
+@@ -1364,16 +1363,16 @@
+ { "optionV", " [-E (N\u00E3o expandir refer\u00EAncias da entidade)]"},
+ { "optionQC", " [-QC (Advert\u00EAncias de Conflitos do Padr\u00E3o Silencioso)]"},
+ { "optionQ", " [-Q (Modo Silencioso)]"},
+- { "optionLF", " [-LF (Usar alimenta\u00E7\u00F5es de linha somente na sa\u00EDda {o default \u00E9 CR/LF})]"},
+- { "optionCR", " [-CR (Use retornos de carro somente na sa\u00EDda {o default \u00E9 CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (Quais caracteres devem ser identificados como escape {o default \u00E9 <>&\"\'\\r\\n}]"},
+- { "optionINDENT", " [-INDENT (Controla quantos espa\u00E7os devem ser recuados {o default \u00E9 0})]"},
++ { "optionLF", " [-LF (Usar alimenta\u00E7\u00F5es de linha somente na sa\u00EDda {o padr\u00E3o \u00E9 CR/LF})]"},
++ { "optionCR", " [-CR (Use retornos de carro somente na sa\u00EDda {o padr\u00E3o \u00E9 CR/LF})]"},
++ { "optionESCAPE", " [-ESCAPE (Quais caracteres devem ser identificados como escape {o padr\u00E3o \u00E9 <>&\"'\\r\\n}]"},
++ { "optionINDENT", " [-INDENT (Controla quantos espa\u00E7os devem ser recuados {o padr\u00E3o \u00E9 0})]"},
+ { "optionTT", " [-TT (Rastreia os modelos \u00E0 medida que s\u00E3o chamados.)]"},
+ { "optionTG", " [-TG (Rastreia cada evento de gera\u00E7\u00E3o.)]"},
+ { "optionTS", " [-TS (Rastreia cada evento de sele\u00E7\u00E3o.)]"},
+ { "optionTTC", " [-TTC (Rastreia os filhos do modelo \u00E0 medida que s\u00E3o processados.)]"},
+ { "optionTCLASS", " [-TCLASS (Classe TraceListener para extens\u00F5es de rastreamento.)]"},
+- { "optionVALIDATE", " [-VALIDATE (Define se ocorre valida\u00E7\u00E3o. Por default, a valida\u00E7\u00E3o fica desativada.)]"},
++ { "optionVALIDATE", " [-VALIDATE (Define se ocorre valida\u00E7\u00E3o. Por padr\u00E3o, a valida\u00E7\u00E3o fica desativada.)]"},
+ { "optionEDUMP", " [-EDUMP {nome do arquivo opcional} (Execute um dump de pilha em caso de erro.)]"},
+ { "optionXML", " [-XML (Use o formatador XML e adicione o cabe\u00E7alho XML.)]"},
+ { "optionTEXT", " [-TEXT (Use o formatador de Texto simples.)]"},
+@@ -1402,7 +1401,7 @@
+ { "optionXO", " [-XO [transletName] (atribui o nome ao translet gerado)]"},
+ { "optionXD", " [-XD destinationDirectory (especificar um diret\u00F3rio de destino para translet)]"},
+ { "optionXJ", " [-XJ jarfile (empacotar classes do translet em um arquivo jar com o nome <jarfile>)]"},
+- { "optionXP", " [-XP package (especifica um prefixo de nome do pacote para todas as classes translet geradas)]"},
++ { "optionXP", " [-XP pacote (especifica um prefixo de nome do pacote para todas as classes translet geradas)]"},
+
+ //AddITIONAL STRINGS that need L10n
+ // Note to translators: The following message describes usage of a particular
+@@ -1448,5 +1447,4 @@
+ public static final String QUERY_HEADER = "PATTERN ";
+
+
+-
+-}
++ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_sv.java,v 1.2.4.1 2005/09/13 11:12:11 pvedula Exp $
++ * $Id: XSLTErrorResources_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -501,7 +501,7 @@
+ "{0} m\u00E5ste ha ett namnattribut."},
+
+ {ER_TEMPLATE_NOT_FOUND,
+- "Kunde inte hitta mallen med namnet: {0}"},
++ "Hittade inte mallen med namnet: {0}"},
+
+ {ER_CANT_RESOLVE_NAME_AVT,
+ "Kunde inte matcha namn-AVT i xsl:call-template."},
+@@ -516,10 +516,10 @@
+ "Felaktigt v\u00E4rde i niv\u00E5attribut: {0}"},
+
+ {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
+- "Namn p\u00E5 processing-instruction kan inte vara 'xml'"},
++ "Namn p\u00E5 bearbetningsinstruktion kan inte vara 'xml'"},
+
+ { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
+- "Namn p\u00E5 processing-instruction m\u00E5ste vara ett giltigt NCName: {0}"},
++ "Namn p\u00E5 bearbetningsinstruktion m\u00E5ste vara ett giltigt NCName: {0}"},
+
+ { ER_NEED_MATCH_ATTRIB,
+ "{0} m\u00E5ste ha ett matchningsattribut n\u00E4r det anger ett l\u00E4ge."},
+@@ -594,7 +594,7 @@
+ "Fick IO-undantag med formatmallfil: {0}"},
+
+ { ER_NO_HREF_ATTRIB,
+- "(StylesheetHandler) Kunde inte hitta href-attribut f\u00F6r {0}"},
++ "(StylesheetHandler) Hittade inte href-attribut f\u00F6r {0}"},
+
+ { ER_STYLESHEET_INCLUDES_ITSELF,
+ "(StylesheetHandler) {0} inkluderar, direkt eller indirekt, sig sj\u00E4lv!"},
+@@ -633,7 +633,7 @@
+ "Kunde inte tolka dokumentet {0}!"},
+
+ { ER_COULDNT_FIND_FRAGMENT,
+- "Kunde inte hitta fragment: {0}"},
++ "Hittade inte fragment: {0}"},
+
+ { ER_NODE_NOT_ELEMENT,
+ "Nod som pekades p\u00E5 av fragment-identifierare var inte ett element: {0}"},
+@@ -802,7 +802,7 @@
+ "Ogiltigt funktionsanrop: rekursiva key()-anrop \u00E4r inte till\u00E5tna"},
+
+ { ER_REFERENCING_ITSELF,
+- "Variabel {0} h\u00E4nvisar, direkt eller indirekt, till sig sj\u00E4lv!"},
++ "Variabeln {0} refererar, direkt eller indirekt, till sig sj\u00E4lv!"},
+
+ { ER_ILLEGAL_DOMSOURCE_INPUT,
+ "Indatanoden till en DOMSource f\u00F6r newTemplates f\u00E5r inte vara null!"},
+@@ -1001,7 +1001,7 @@
+ "F\u00F6rs\u00F6ker formatera ett tal som \u00E4r st\u00F6rre \u00E4n det st\u00F6rsta l\u00E5nga heltalet"},
+
+ { ER_CANNOT_FIND_SAX1_DRIVER,
+- "Kan inte hitta SAX1-drivrutinen klass {0}"},
++ "Hittar inte SAX1-drivrutinen klass {0}"},
+
+ { ER_SAX1_DRIVER_NOT_LOADED,
+ "SAX1-drivrutinen klass {0} hittades, men kan inte laddas"},
+@@ -1064,7 +1064,7 @@
+ // 'RedundentExprEliminator' is the name of a class, and should not be
+ // translated.
+ { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR,
+- "Programmerarverifiering i RedundentExprEliminator: {0}"},
++ "Programmerarens utsaga i RedundentExprEliminator: {0}"},
+
+ { ER_NOT_ALLOWED_IN_POSITION,
+ "{0} \u00E4r inte till\u00E5ten i denna position i formatmallen!"},
+@@ -1229,7 +1229,7 @@
+ "Xalan hanterar \u00E4nnu inte spr\u00E5knamnet i funktionen format-number."},
+
+ { WG_LOCALE_NOT_FOUND,
+- "Varning: Kunde inte hitta spr\u00E5kinst\u00E4llning f\u00F6r xml:lang={0}"},
++ "Varning: Hittade inte spr\u00E5kinst\u00E4llning f\u00F6r xml:lang={0}"},
+
+ { WG_CANNOT_MAKE_URL_FROM,
+ "Kan inte skapa URL fr\u00E5n: {0}"},
+@@ -1238,7 +1238,7 @@
+ "Kan inte ladda beg\u00E4rt dokument: {0}"},
+
+ { WG_CANNOT_FIND_COLLATOR,
+- "Hittade inte uppsamlare f\u00F6r <sort xml:lang={0}"},
++ "Hittade inte kollationering f\u00F6r <sort xml:lang={0}"},
+
+ { WG_FUNCTIONS_SHOULD_USE_URL,
+ "Gammal syntax: funktionsinstruktionen b\u00F6r anv\u00E4nda url:en {0}"},
+@@ -1250,7 +1250,7 @@
+ "kodning underst\u00F6ds inte: {0}, anv\u00E4nder Java {1}"},
+
+ { WG_SPECIFICITY_CONFLICTS,
+- "Specificitetkonflikter hittades: {0} Senast hittade i formatmall kommer att anv\u00E4ndas."},
++ "Specifika konflikter hittades: {0} Senast hittade i formatmall kommer att anv\u00E4ndas."},
+
+ { WG_PARSING_AND_PREPARING,
+ "========= Tolkar och f\u00F6rbereder {0} =========="},
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (Tyst l\u00E4ge)]"},
+ { "optionLF", " [-LF (Anv\u00E4nd radmatningar endast f\u00F6r utdata {standard \u00E4r CR/LF})]"},
+ { "optionCR", " [-CR (Anv\u00E4nd radmatningar endast f\u00F6r utdata {standard \u00E4r CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (Vilka tecken \u00E4r skiftningstecken {standard \u00E4r <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (Vilka tecken \u00E4r skiftningstecken {standard \u00E4r <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (Best\u00E4m antal blanksteg f\u00F6r indrag {standard \u00E4r 0})]"},
+ { "optionTT", " [-TT (Sp\u00E5ra mallar vid anrop.)]"},
+ { "optionTG", " [-TG (Sp\u00E5ra varje generationsh\u00E4ndelse.)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_zh_CN.java,v 1.2.4.1 2005/09/13 11:14:39 pvedula Exp $
++ * $Id: XSLTErrorResources_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -630,7 +630,7 @@
+ "\u65E0\u6CD5\u5904\u7406\u6837\u5F0F\u8868!"},
+
+ { ER_COULDNT_PARSE_DOC,
+- "\u65E0\u6CD5\u5BF9{0}\u6587\u6863\u8FDB\u884C\u8BED\u6CD5\u5206\u6790!"},
++ "\u65E0\u6CD5\u89E3\u6790{0}\u6587\u6863!"},
+
+ { ER_COULDNT_FIND_FRAGMENT,
+ "\u627E\u4E0D\u5230\u7247\u6BB5: {0}"},
+@@ -968,7 +968,7 @@
+ //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc.
+ //NOTE: Not only the key name but message has also been changed.
+ { ER_VALUE_SHOULD_BE_NUMBER,
+- "{0}\u7684\u503C\u5E94\u5305\u542B\u53EF\u8BED\u6CD5\u5206\u6790\u7684\u6570\u5B57"},
++ "{0}\u7684\u503C\u5E94\u5305\u542B\u53EF\u89E3\u6790\u7684\u6570\u5B57"},
+
+ { ER_VALUE_SHOULD_EQUAL,
+ "{0}\u7684\u503C\u5E94\u7B49\u4E8E\u201C\u662F\u201D\u6216\u201C\u5426\u201D"},
+@@ -1016,7 +1016,7 @@
+ "\u672A\u6307\u5B9A\u7CFB\u7EDF\u5C5E\u6027 org.xml.sax.parser"},
+
+ { ER_PARSER_ARG_CANNOT_BE_NULL,
+- "\u8BED\u6CD5\u5206\u6790\u5668\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A\u503C"},
++ "\u89E3\u6790\u5668\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A\u503C"},
+
+ { ER_FEATURE,
+ "\u529F\u80FD: {0}"},
+@@ -1253,7 +1253,7 @@
+ "\u53D1\u73B0\u7279\u5F81\u51B2\u7A81: \u5C06\u4F7F\u7528\u4E0A\u6B21\u5728\u6837\u5F0F\u8868\u4E2D\u627E\u5230\u7684{0}\u3002"},
+
+ { WG_PARSING_AND_PREPARING,
+- "========= \u8BED\u6CD5\u5206\u6790\u548C\u51C6\u5907{0} =========="},
++ "========= \u89E3\u6790\u548C\u51C6\u5907{0} =========="},
+
+ { WG_ATTR_TEMPLATE,
+ "\u5C5E\u6027\u6A21\u677F{0}"},
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (\u65E0\u63D0\u793A\u6A21\u5F0F)]"},
+ { "optionLF", " [-LF (\u4EC5\u5728\u8F93\u51FA\u65F6\u4F7F\u7528\u6362\u884C\u7B26 {\u9ED8\u8BA4\u503C\u4E3A CR/LF})]"},
+ { "optionCR", " [-CR (\u4EC5\u5728\u8F93\u51FA\u65F6\u4F7F\u7528\u56DE\u8F66 {\u9ED8\u8BA4\u503C\u4E3A CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (\u8981\u8F6C\u79FB\u7684\u5B57\u7B26 {\u9ED8\u8BA4\u503C\u4E3A <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (\u8981\u8F6C\u79FB\u7684\u5B57\u7B26 {\u9ED8\u8BA4\u503C\u4E3A <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (\u63A7\u5236\u8981\u7F29\u8FDB\u7684\u7A7A\u683C\u6570 {\u9ED8\u8BA4\u503C\u4E3A 0})]"},
+ { "optionTT", " [-TT (\u5728\u8C03\u7528\u6A21\u677F\u65F6\u8DDF\u8E2A\u6A21\u677F\u3002)]"},
+ { "optionTG", " [-TG (\u8DDF\u8E2A\u6BCF\u4E2A\u751F\u6210\u4E8B\u4EF6\u3002)]"},
+@@ -1379,7 +1379,7 @@
+ { "optionHTML", " [-HTML (\u4F7F\u7528 HTML \u683C\u5F0F\u8BBE\u7F6E\u5DE5\u5177\u3002)]"},
+ { "optionPARAM", " [-PARAM \u540D\u79F0\u8868\u8FBE\u5F0F (\u8BBE\u7F6E\u6837\u5F0F\u8868\u53C2\u6570)]"},
+ { "noParsermsg1", "XSL \u8FDB\u7A0B\u672A\u6210\u529F\u3002"},
+- { "noParsermsg2", "** \u627E\u4E0D\u5230\u8BED\u6CD5\u5206\u6790\u5668 **"},
++ { "noParsermsg2", "** \u627E\u4E0D\u5230\u89E3\u6790\u5668 **"},
+ { "noParsermsg3", "\u8BF7\u68C0\u67E5\u60A8\u7684\u7C7B\u8DEF\u5F84\u3002"},
+ { "noParsermsg4", "\u5982\u679C\u6CA1\u6709 IBM \u63D0\u4F9B\u7684 XML Parser for Java, \u5219\u53EF\u4EE5\u4ECE"},
+ { "noParsermsg5", "IBM AlphaWorks \u8FDB\u884C\u4E0B\u8F7D, \u7F51\u5740\u4E3A: http://www.alphaworks.ibm.com/formula/xml"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XSLTErrorResources_zh_TW.java,v 1.2.4.1 2005/09/13 11:19:31 pvedula Exp $
++ * $Id: XSLTErrorResources_zh_TW.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+ */
+ package com.sun.org.apache.xalan.internal.res;
+
+@@ -1365,7 +1365,7 @@
+ { "optionQ", " [-Q (\u975C\u97F3\u6A21\u5F0F)]"},
+ { "optionLF", " [-LF (\u8F38\u51FA\u4E0A\u50C5\u4F7F\u7528\u63DB\u884C\u5B57\u5143 {\u9810\u8A2D\u70BA CR/LF})]"},
+ { "optionCR", " [-CR (\u8F38\u51FA\u4E0A\u50C5\u4F7F\u7528\u6B78\u4F4D\u5B57\u5143 {\u9810\u8A2D\u70BA CR/LF})]"},
+- { "optionESCAPE", " [-ESCAPE (\u8981\u9041\u96E2\u7684\u5B57\u5143 {\u9810\u8A2D\u70BA <>&\"\'\\r\\n}]"},
++ { "optionESCAPE", " [-ESCAPE (\u8981\u9041\u96E2\u7684\u5B57\u5143 {\u9810\u8A2D\u70BA <>&\"'\\r\\n}]"},
+ { "optionINDENT", " [-INDENT (\u63A7\u5236\u8981\u7E2E\u6392\u7684\u7A7A\u9593 {\u9810\u8A2D\u70BA 0})]"},
+ { "optionTT", " [-TT (\u8FFD\u8E64\u547C\u53EB\u7684\u6A23\u677F\u3002)]"},
+ { "optionTG", " [-TG (\u8FFD\u8E64\u6BCF\u500B\u7522\u751F\u4E8B\u4EF6\u3002)]"},
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java Fri Apr 10 09:20:34 2015 -0700
+@@ -104,6 +104,9 @@
+ protected final static String EXSLT_STRINGS =
+ "http://exslt.org/strings";
+
++ protected final static String XALAN_CLASSPACKAGE_NAMESPACE =
++ "xalan://";
++
+ // Namespace format constants
+ protected final static int NAMESPACE_FORMAT_JAVA = 0;
+ protected final static int NAMESPACE_FORMAT_CLASS = 1;
+@@ -900,8 +903,22 @@
+ if (_className != null && _className.length() > 0) {
+ final int nArgs = _arguments.size();
+ try {
+- if (_clazz == null) {
+- _clazz = ObjectFactory.findProviderClass(_className, true);
++ if (_clazz == null) {
++ final boolean isSecureProcessing = getXSLTC().isSecureProcessing();
++ final boolean isExtensionFunctionEnabled = getXSLTC()
++ .getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
++
++ //Check if FSP and SM - only then proceed with loading
++ if (namespace != null && isSecureProcessing
++ && isExtensionFunctionEnabled
++ && (namespace.equals(JAVA_EXT_XALAN)
++ || namespace.equals(JAVA_EXT_XSLTC)
++ || namespace.equals(JAVA_EXT_XALAN_OLD)
++ || namespace.startsWith(XALAN_CLASSPACKAGE_NAMESPACE))) {
++ _clazz = getXSLTC().loadExternalFunction(_className);
++ } else {
++ _clazz = ObjectFactory.findProviderClass(_className, true);
++ }
+
+ if (_clazz == null) {
+ final ErrorMsg msg =
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Fri Apr 10 09:20:34 2015 -0700
+@@ -23,24 +23,6 @@
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler;
+
+-import java.io.BufferedOutputStream;
+-import java.io.ByteArrayOutputStream;
+-import java.io.File;
+-import java.io.FileOutputStream;
+-import java.io.IOException;
+-import java.io.InputStream;
+-import java.net.URL;
+-import java.util.Date;
+-import java.util.Enumeration;
+-import java.util.Hashtable;
+-import java.util.Map;
+-import java.util.Properties;
+-import java.util.Vector;
+-import java.util.jar.JarEntry;
+-import java.util.jar.JarOutputStream;
+-import java.util.jar.Manifest;
+-import javax.xml.XMLConstants;
+-
+ import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+ import com.sun.org.apache.xalan.internal.XalanConstants;
+ import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+@@ -50,7 +32,27 @@
+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
+ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
+ import com.sun.org.apache.xml.internal.dtm.DTM;
+-
++import java.io.BufferedOutputStream;
++import java.io.ByteArrayOutputStream;
++import java.io.File;
++import java.io.FileOutputStream;
++import java.io.IOException;
++import java.io.InputStream;
++import java.net.URL;
++import java.security.AccessController;
++import java.security.PrivilegedAction;
++import java.util.Collections;
++import java.util.Date;
++import java.util.Enumeration;
++import java.util.HashMap;
++import java.util.Hashtable;
++import java.util.Map;
++import java.util.Properties;
++import java.util.Vector;
++import java.util.jar.JarEntry;
++import java.util.jar.JarOutputStream;
++import java.util.jar.Manifest;
++import javax.xml.XMLConstants;
+ import org.xml.sax.InputSource;
+ import org.xml.sax.XMLReader;
+
+@@ -153,11 +155,25 @@
+ private final FeatureManager _featureManager;
+
+ /**
++ * Extension function class loader variables
++ */
++
++ /* Class loader reference that will be used for external extension functions loading */
++ private ClassLoader _extensionClassLoader;
++
++ /**
++ * HashMap with the loaded classes
++ */
++ private final Map<String, Class> _externalExtensionFunctions;
++
++ /**
+ * XSLTC compiler constructor
+ */
+ public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
+ _parser = new Parser(this, useServicesMechanism);
+ _featureManager = featureManager;
++ _extensionClassLoader = null;
++ _externalExtensionFunctions = new HashMap<>();
+ }
+
+ /**
+@@ -207,6 +223,8 @@
+ return _accessExternalDTD;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ return _xmlSecurityManager;
++ } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
++ return _extensionClassLoader;
+ }
+ return null;
+ }
+@@ -222,6 +240,11 @@
+ _accessExternalDTD = (String)value;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ _xmlSecurityManager = (XMLSecurityManager)value;
++ } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
++ _extensionClassLoader = (ClassLoader) value;
++ /* Clear the external extension functions HashMap if extension class
++ loader was changed */
++ _externalExtensionFunctions.clear();
+ }
+ }
+
+@@ -256,6 +279,41 @@
+ _bcelClasses = new Vector();
+ }
+
++ private void setExternalExtensionFunctions(String name, Class clazz) {
++ if (_isSecureProcessing && clazz != null && !_externalExtensionFunctions.containsKey(name)) {
++ _externalExtensionFunctions.put(name, clazz);
++ }
++ }
++
++ /*
++ * Function loads an external extension functions.
++ * The filtering of function types (external,internal) takes place in FunctionCall class
++ *
++ */
++ Class loadExternalFunction(String name) throws ClassNotFoundException {
++ Class loaded = null;
++ //Check if the function is not loaded already
++ if (_externalExtensionFunctions.containsKey(name)) {
++ loaded = _externalExtensionFunctions.get(name);
++ } else if (_extensionClassLoader != null) {
++ loaded = Class.forName(name, true, _extensionClassLoader);
++ setExternalExtensionFunctions(name, loaded);
++ }
++ if (loaded == null) {
++ throw new ClassNotFoundException(name);
++ }
++ //Return loaded class
++ return (Class) loaded;
++ }
++
++ /*
++ * Returns unmodifiable view of HashMap with loaded external extension
++ * functions - will be needed for the TransformerImpl
++ */
++ public Map<String, Class> getExternalExtensionFunctions() {
++ return Collections.unmodifiableMap(_externalExtensionFunctions);
++ }
++
+ /**
+ * Initializes the compiler to produce a new translet
+ */
+@@ -283,6 +341,7 @@
+ -1, // LEVEL_MULTIPLE
+ -1 // LEVEL_ANY
+ };
++ _externalExtensionFunctions.clear();
+ }
+
+ /**
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java Fri Apr 10 09:20:34 2015 -0700
+@@ -602,6 +602,9 @@
+ {ErrorMsg.JAXP_INVALID_ATTR_ERR,
+ "TransformerFactory does not recognise attribute ''{0}''."},
+
++ {ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR,
++ "Incorrect value specified for ''{0}'' attribute."},
++
+ /*
+ * Note to translators: "setResult()" and "startDocument()" are Java
+ * method names that should not be translated.
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_de.java,v 1.2.4.1 2005/09/15 10:02:28 pvedula Exp $
++ * $Id: ErrorMessages_de.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "Stylesheet-Ziel \"{0}\" konnte nicht gelesen werden, weil der \"{1}\"-Zugriff wegen einer von der Eigenschaft accessExternalStylesheet festgelegten Einschr\u00E4nkung nicht zul\u00E4ssig ist."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "WARNING: \"{0}\"\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "FATAL ERROR: \"{0}\"\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "ERROR: \"{0}\"\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "Das Feature \"{0}\" kann nicht f\u00FCr diese TransformerFactory festgelegt werden."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: Feature kann nicht auf \"false\" gesetzt werden, wenn Security Manager vorhanden ist."}
++ "FEATURE_SECURE_PROCESSING: Feature kann nicht auf \"false\" gesetzt werden, wenn Security Manager vorhanden ist."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Interner XSLTC-Fehler: Der generierte Bytecode enth\u00E4lt einen Try-Catch-Finally-Block. Outline nicht m\u00F6glich."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Interner XSLTC-Fehler: Die Marker OutlineableChunkStart und OutlineableChunkEnd m\u00FCssen ausgeglichen und ordnungsgem\u00E4\u00DF platziert sein."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Interner XSLTC-Fehler: Eine Anweisung, die Teil eines Bytecodeblocks war, f\u00FCr den ein Outline erstellt wurde, wird nach wie vor in der Originalmethode referenziert."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Interner XSLTC-Fehler: Eine Methode im Translet \u00FCberschreitet die Java Virtual Machine-L\u00E4ngeneinschr\u00E4nkung einer Methode von 64 KB. Ursache hierf\u00FCr sind in der Regel sehr gro\u00DFe Vorlagen in einem Stylesheet. Versuchen Sie, das Stylesheet mit kleineren Vorlagen umzustrukturieren."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Wenn die Java-Sicherheit aktiviert ist, ist die Unterst\u00FCtzung f\u00FCr das Deserialisieren von TemplatesImpl deaktiviert. Dies kann durch Setzen der Systemeigenschaft jdk.xml.enableTemplatesImplDeserialization auf \"True\" au\u00DFer Kraft gesetzt werden."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_es.java,v 1.2.4.1 2005/09/15 10:03:56 pvedula Exp $
++ * $Id: ErrorMessages_es.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "No se ha podido leer el destino de hoja de estilos ''{0}'', porque no se permite el acceso ''{1}'' debido a una restricci\u00F3n definida por la propiedad accessExternalStylesheet."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "ADVERTENCIA: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "ERROR FATAL: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "ERROR: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "No se puede definir la funci\u00F3n ''{0}''en esta f\u00E1brica del transformador."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: no se puede definir la funci\u00F3n en false cuando est\u00E1 presente el gestor de seguridad."}
++ "FEATURE_SECURE_PROCESSING: no se puede definir la funci\u00F3n en false cuando est\u00E1 presente el gestor de seguridad."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Error interno de XSLTC: el c\u00F3digo de bytes generado contiene un bloque try-catch-finally y no se puede delimitar."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Error interno de XSLTC: los marcadores OutlineableChunkStart y OutlineableChunkEnd deben estar equilibrados y correctamente anidados."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Error interno de XSLTC: todav\u00EDa se hace referencia a una instrucci\u00F3n que formaba parte de un bloque de c\u00F3digo de bytes delimitado en el m\u00E9todo original."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Error interno de XSLTC: un m\u00E9todo en el translet excede la limitaci\u00F3n de Java Virtual Machine de longitud de un m\u00E9todo de 64 kilobytes. Normalmente, esto lo causan plantillas en una hoja de estilos demasiado grandes. Pruebe a reestructurar la hoja de estilos para utilizar plantillas m\u00E1s peque\u00F1as."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Cuando la seguridad de Java est\u00E1 activada, el soporte para anular la serializaci\u00F3n de TemplatesImpl est\u00E1 desactivado. Esto se puede sustituir definiendo la propiedad del sistema jdk.xml.enableTemplatesImplDeserialization en true."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_fr.java,v 1.2.4.1 2005/09/15 10:04:47 pvedula Exp $
++ * $Id: ErrorMessages_fr.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "Impossible de lire la cible de feuille de style ''{0}'' car l''acc\u00E8s \u00E0 ''{1}'' n''est pas autoris\u00E9 en raison d''une restriction d\u00E9finie par la propri\u00E9t\u00E9 accessExternalStylesheet."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "AVERTISSEMENT : ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "ERREUR FATALE : ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "ERREUR : ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "Impossible de d\u00E9finir la fonctionnalit\u00E9 ''{0}'' sur cette propri\u00E9t\u00E9 TransformerFactory."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING : impossible de d\u00E9finir la fonctionnalit\u00E9 sur False en pr\u00E9sence du gestionnaire de s\u00E9curit\u00E9."}
++ "FEATURE_SECURE_PROCESSING : impossible de d\u00E9finir la fonctionnalit\u00E9 sur False en pr\u00E9sence du gestionnaire de s\u00E9curit\u00E9."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Erreur XSLTC interne : le code ex\u00E9cutable g\u00E9n\u00E9r\u00E9 contient un bloc try-catch-finally et ne peut pas \u00EAtre d\u00E9limit\u00E9."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Erreur XSLTC interne : les marqueurs OutlineableChunkStart et OutlineableChunkEnd doivent \u00EAtre \u00E9quilibr\u00E9s et correctement imbriqu\u00E9s."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Erreur XSLTC interne : une instruction ayant fait partie d'un bloc de code ex\u00E9cutable d\u00E9limit\u00E9 est toujours r\u00E9f\u00E9renc\u00E9e dans la m\u00E9thode d'origine."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Erreur XSLTC interne : une m\u00E9thode dans le translet d\u00E9passe la limite de la JVM concernant la longueur d'une m\u00E9thode de 64 kilo-octets. En g\u00E9n\u00E9ral, ceci est d\u00FB \u00E0 de tr\u00E8s grands mod\u00E8les dans une feuille de style. Essayez de restructurer la feuille de style pour utiliser des mod\u00E8les plus petits."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Lorsque la s\u00E9curit\u00E9 Java est activ\u00E9e, la prise en charge de la d\u00E9s\u00E9rialisation de TemplatesImpl est d\u00E9sactiv\u00E9e. La d\u00E9finition de la propri\u00E9t\u00E9 syst\u00E8me jdk.xml.enableTemplatesImplDeserialization sur True permet de remplacer ce param\u00E8tre."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_it.java,v 1.2.4.1 2005/09/15 10:07:02 pvedula Exp $
++ * $Id: ErrorMessages_it.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "Impossibile leggere la destinazione del foglio di stile ''{0}''. Accesso ''{1}'' non consentito a causa della limitazione definita dalla propriet\u00E0 accessExternalStylesheet."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "Avvertenza: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "ERRORE IRREVERSIBILE: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "ERRORE: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "Impossibile impostare la funzione ''{0}'' in questo TransformerFactory."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: impossibile impostare la funzione su false se \u00E8 presente Security Manager."}
++ "FEATURE_SECURE_PROCESSING: impossibile impostare la funzione su false se \u00E8 presente Security Manager."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Errore XSLTC interno: il bytecode generato contiene un blocco try-catch-finally e non pu\u00F2 essere di tipo outlined."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Errore XSLTC interno: gli indicatori OutlineableChunkStart e OutlineableChunkEnd devono essere bilanciati e nidificati correttamente."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Errore XSLTC interno: a un'istruzione che faceva parte di un blocco di bytecode di tipo outlined viene ancora fatto riferimento nel metodo originale."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Errore XSLTC interno: un metodo nel translet supera la limitazione Java Virtual Machine relativa alla lunghezza per un metodo di 64 kilobyte. Ci\u00F2 \u00E8 generalmente causato dalle grandi dimensioni dei modelli in un foglio di stile. Provare a ristrutturare il foglio di stile per utilizzare modelli di dimensioni inferiori."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Quando la sicurezza Java \u00E8 abilitata, il supporto per la deserializzazione TemplatesImpl \u00E8 disabilitato. \u00C8 possibile ignorare questa condizione impostando su true la propriet\u00E0 di sistema jdk.xml.enableTemplatesImplDeserialization."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_ja.java,v 1.2.4.1 2005/09/15 10:08:16 pvedula Exp $
++ * $Id: ErrorMessages_ja.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "accessExternalStylesheet\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u8A2D\u5B9A\u3055\u308C\u305F\u5236\u9650\u306B\u3088\u308A''{1}''\u30A2\u30AF\u30BB\u30B9\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u30FB\u30BF\u30FC\u30B2\u30C3\u30C8''{0}''\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002"},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -682,7 +682,7 @@
+ * documentation.
+ */
+ {ErrorMsg.COMPILE_USAGE_STR,
+- "SYNOPSIS\n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile [-o <output>]\n [-d <directory>] [-j <jarfile>] [-p <package>]\n [-n] [-x] [-u] [-v] [-h] { <stylesheet> | -i }\n\nOPTIONS\n -o <output> \u540D\u524D<output>\u3092\u751F\u6210\u6E08translet\u306B\n \u5272\u308A\u5F53\u3066\u308B\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001translet\u540D\u306F\n <stylesheet>\u540D\u306B\u7531\u6765\u3057\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n \u8907\u6570\u306E\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u5834\u5408\u306F\u7121\u8996\u3055\u308C\u307E\u3059\u3002\n -d <directory> translet\u306E\u5B9B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6307\u5B9A\u3059\u308B\n -j <jarfile> <jarfile>\u3067\u6307\u5B9A\u3055\u308C\u308B\u540D\u524D\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306Btranslet\u30AF\u30E9\u30B9\u3092\n \u30D1\u30C3\u30B1\u30FC\u30B8\u3059\u308B\n -p <package> \u751F\u6210\u3055\u308C\u308B\u3059\u3079\u3066\u306Etranslet\u30AF\u30E9\u30B9\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\n \u63A5\u982D\u8F9E\u3092\u6307\u5B9A\u3059\u308B\u3002\n -n \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30A4\u30F3\u30E9\u30A4\u30F3\u5316\u3092\u6709\u52B9\u306B\u3059\u308B(\u5E73\u5747\u3057\u3066\u30C7\u30D5\u30A9\u30EB\u30C8\u52D5\u4F5C\u306E\u65B9\u304C\n \u512A\u308C\u3066\u3044\u307E\u3059)\u3002\n -x \u8FFD\u52A0\u306E\u30C7\u30D0\u30C3\u30B0\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u51FA\u529B\u3092\u30AA\u30F3\u306B\u3059\u308B\n -u <stylesheet>\u5F15\u6570\u3092URL\u3068\u3057\u3066\u89E3\u91C8\u3059\u308B\n -i \u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092stdin\u304B\u3089\u8AAD\u307F\u8FBC\u3080\u3053\u3068\u3092\u30B3\u30F3\u30D1\u30A4\u30E9\u306B\u5F37\u5236\u3059\u308B\n -v \u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3059\u308B\n -h \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u6587\u3092\u51FA\u529B\u3059\u308B\n"},
++ "\u5F62\u5F0F\n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile [-o <output>]\n [-d <directory>] [-j <jarfile>] [-p <package>]\n [-n] [-x] [-u] [-v] [-h] { <stylesheet> | -i }\n\nOPTIONS\n -o <output> \u540D\u524D<output>\u3092\u751F\u6210\u6E08translet\u306B\n \u5272\u308A\u5F53\u3066\u308B\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001translet\u540D\u306F\n <stylesheet>\u540D\u306B\u7531\u6765\u3057\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n \u8907\u6570\u306E\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u5834\u5408\u306F\u7121\u8996\u3055\u308C\u307E\u3059\u3002\n -d <directory> translet\u306E\u5B9B\u5148\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6307\u5B9A\u3059\u308B\n -j <jarfile> <jarfile>\u3067\u6307\u5B9A\u3055\u308C\u308B\u540D\u524D\u306Ejar\u30D5\u30A1\u30A4\u30EB\u306Btranslet\u30AF\u30E9\u30B9\u3092\n \u30D1\u30C3\u30B1\u30FC\u30B8\u3059\u308B\n -p <package> \u751F\u6210\u3055\u308C\u308B\u3059\u3079\u3066\u306Etranslet\u30AF\u30E9\u30B9\u306E\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\n \u63A5\u982D\u8F9E\u3092\u6307\u5B9A\u3059\u308B\u3002\n -n \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30A4\u30F3\u30E9\u30A4\u30F3\u5316\u3092\u6709\u52B9\u306B\u3059\u308B(\u5E73\u5747\u3057\u3066\u30C7\u30D5\u30A9\u30EB\u30C8\u52D5\u4F5C\u306E\u65B9\u304C\n \u512A\u308C\u3066\u3044\u307E\u3059)\u3002\n -x \u8FFD\u52A0\u306E\u30C7\u30D0\u30C3\u30B0\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u51FA\u529B\u3092\u30AA\u30F3\u306B\u3059\u308B\n -u <stylesheet>\u5F15\u6570\u3092URL\u3068\u3057\u3066\u89E3\u91C8\u3059\u308B\n -i \u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092stdin\u304B\u3089\u8AAD\u307F\u8FBC\u3080\u3053\u3068\u3092\u30B3\u30F3\u30D1\u30A4\u30E9\u306B\u5F37\u5236\u3059\u308B\n -v \u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u3092\u51FA\u529B\u3059\u308B\n -h \u3053\u306E\u4F7F\u7528\u65B9\u6CD5\u306E\u6587\u3092\u51FA\u529B\u3059\u308B\n"},
+
+ /*
+ * Note to translators: This message contains usage information for a
+@@ -694,7 +694,7 @@
+ * documentation.
+ */
+ {ErrorMsg.TRANSFORM_USAGE_STR,
+- "SYNOPSIS \n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Transform [-j <jarfile>]\n [-x] [-n <iterations>] {-u <document_url> | <document>}\n <class> [<param1>=<value1> ...]\n\n translet <class>\u3092\u4F7F\u7528\u3057\u3066\u3001<document>\u3067\u6307\u5B9A\u3055\u308C\u308B\n XML\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u5909\u63DB\u3059\u308B\u3002translet <class>\u306F\n \u30E6\u30FC\u30B6\u30FC\u306ECLASSPATH\u5185\u304B\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u6307\u5B9A\u3055\u308C\u305F<jarfile>\u5185\u306B\u3042\u308A\u307E\u3059\u3002\nOPTIONS\n -j <jarfile> translet\u3092\u30ED\u30FC\u30C9\u3059\u308Bjarfile\u3092\u6307\u5B9A\u3059\u308B\n -x \u8FFD\u52A0\u306E\u30C7\u30D0\u30C3\u30B0\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u51FA\u529B\u3092\u30AA\u30F3\u306B\u3059\u308B\n -n <iterations> \u5909\u63DB\u3092<iterations>\u56DE\u5B9F\u884C\u3057\u3001\n \u30D7\u30ED\u30D5\u30A1\u30A4\u30EB\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n -u <document_url> XML\u5165\u529B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092URL\u3068\u3057\u3066\u6307\u5B9A\u3059\u308B\n"},
++ "\u5F62\u5F0F \n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Transform [-j <jarfile>]\n [-x] [-n <iterations>] {-u <document_url> | <document>}\n <class> [<param1>=<value1> ...]\n\n translet <class>\u3092\u4F7F\u7528\u3057\u3066\u3001<document>\u3067\u6307\u5B9A\u3055\u308C\u308B\n XML\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u5909\u63DB\u3059\u308B\u3002translet <class>\u306F\n \u30E6\u30FC\u30B6\u30FC\u306ECLASSPATH\u5185\u304B\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u6307\u5B9A\u3055\u308C\u305F<jarfile>\u5185\u306B\u3042\u308A\u307E\u3059\u3002\nOPTIONS\n -j <jarfile> translet\u3092\u30ED\u30FC\u30C9\u3059\u308Bjarfile\u3092\u6307\u5B9A\u3059\u308B\n -x \u8FFD\u52A0\u306E\u30C7\u30D0\u30C3\u30B0\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u51FA\u529B\u3092\u30AA\u30F3\u306B\u3059\u308B\n -n <iterations> \u5909\u63DB\u3092<iterations>\u56DE\u5B9F\u884C\u3057\u3001\n \u30D7\u30ED\u30D5\u30A1\u30A4\u30EA\u30F3\u30B0\u60C5\u5831\u3092\u8868\u793A\u3059\u308B\n -u <document_url> XML\u5165\u529B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092URL\u3068\u3057\u3066\u6307\u5B9A\u3059\u308B\n"},
+
+
+
+@@ -761,14 +761,14 @@
+ * line option that was not recognized.
+ */
+ {ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR,
+- "\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002"},
++ "\u30B3\u30DE\u30F3\u30C9\u884C\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002"},
+
+ /*
+ * Note to translators: The substitution text is the name of a command-
+ * line option.
+ */
+ {ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR,
+- "\u30B3\u30DE\u30F3\u30C9\u30E9\u30A4\u30F3\u30FB\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306B\u5FC5\u9808\u306E\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},
++ "\u30B3\u30DE\u30F3\u30C9\u884C\u30AA\u30D7\u30B7\u30E7\u30F3''{0}''\u306B\u5FC5\u9808\u306E\u5F15\u6570\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "\u8B66\u544A: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "\u81F4\u547D\u7684\u30A8\u30E9\u30FC: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "\u30A8\u30E9\u30FC: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "\u6A5F\u80FD''{0}''\u3092\u3053\u306ETransformerFactory\u306B\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002"},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: \u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u304C\u5B58\u5728\u3059\u308B\u3068\u304D\u3001\u6A5F\u80FD\u3092false\u306B\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002"}
++ "FEATURE_SECURE_PROCESSING: \u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u30FB\u30DE\u30CD\u30FC\u30B8\u30E3\u304C\u5B58\u5728\u3059\u308B\u3068\u304D\u3001\u6A5F\u80FD\u3092false\u306B\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "\u5185\u90E8XSLTC\u30A8\u30E9\u30FC: \u751F\u6210\u3055\u308C\u305F\u30D0\u30A4\u30C8\u30FB\u30B3\u30FC\u30C9\u306F\u3001try-catch-finally\u30D6\u30ED\u30C3\u30AF\u3092\u542B\u3093\u3067\u3044\u308B\u305F\u3081\u3001\u30A2\u30A6\u30C8\u30E9\u30A4\u30F3\u5316\u3067\u304D\u307E\u305B\u3093\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "\u5185\u90E8XSLTC\u30A8\u30E9\u30FC: OutlineableChunkStart\u30DE\u30FC\u30AB\u30FC\u3068OutlineableChunkEnd\u30DE\u30FC\u30AB\u30FC\u306F\u3001\u5BFE\u306B\u306A\u3063\u3066\u304A\u308A\u3001\u304B\u3064\u6B63\u3057\u304F\u30CD\u30B9\u30C8\u3055\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "\u5185\u90E8XSLTC\u30A8\u30E9\u30FC: \u30A2\u30A6\u30C8\u30E9\u30A4\u30F3\u5316\u3055\u308C\u305F\u30D0\u30A4\u30C8\u30FB\u30B3\u30FC\u30C9\u306E\u30D6\u30ED\u30C3\u30AF\u306E\u4E00\u90E8\u3067\u3042\u3063\u305F\u547D\u4EE4\u306F\u3001\u5143\u306E\u30E1\u30BD\u30C3\u30C9\u306E\u4E2D\u3067\u307E\u3060\u53C2\u7167\u3055\u308C\u3066\u3044\u307E\u3059\u3002"
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "\u5185\u90E8XSLTC\u30A8\u30E9\u30FC: \u30C8\u30E9\u30F3\u30B9\u30EC\u30C3\u30C8\u5185\u306E\u30E1\u30BD\u30C3\u30C9\u304C\u3001Java\u4EEE\u60F3\u30DE\u30B7\u30F3\u306E\u5236\u9650(1\u30E1\u30BD\u30C3\u30C9\u306E\u9577\u3055\u306F\u6700\u592764\u30AD\u30ED\u30D0\u30A4\u30C8)\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\u4E00\u822C\u7684\u306B\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u5185\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u308B\u3053\u3068\u304C\u539F\u56E0\u3068\u3057\u3066\u8003\u3048\u3089\u308C\u307E\u3059\u3002\u5C0F\u3055\u3044\u30B5\u30A4\u30BA\u306E\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u4F7F\u7528\u3057\u3066\u3001\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u3092\u518D\u69CB\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Java\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u304C\u6709\u52B9\u5316\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u3001TemplatesImpl\u306E\u30C7\u30B7\u30EA\u30A2\u30E9\u30A4\u30BA\u306E\u30B5\u30DD\u30FC\u30C8\u306F\u7121\u52B9\u5316\u3055\u308C\u307E\u3059\u3002\u3053\u308C\u306F\u3001jdk.xml.enableTemplatesImplDeserialization\u30B7\u30B9\u30C6\u30E0\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3092true\u306B\u8A2D\u5B9A\u3057\u3066\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3067\u304D\u307E\u3059\u3002"}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_ko.java,v 1.2.4.1 2005/09/15 10:10:07 pvedula Exp $
++ * $Id: ErrorMessages_ko.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:58 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "accessExternalStylesheet \uC18D\uC131\uC73C\uB85C \uC124\uC815\uB41C \uC81C\uD55C\uC73C\uB85C \uC778\uD574 ''{1}'' \uC561\uC138\uC2A4\uAC00 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC73C\uBBC0\uB85C \uC2A4\uD0C0\uC77C\uC2DC\uD2B8 \uB300\uC0C1 ''{0}''\uC744(\uB97C) \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "\uACBD\uACE0: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "\uCE58\uBA85\uC801\uC778 \uC624\uB958: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "\uC624\uB958: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "\uC774 TransformerFactory\uC5D0\uC11C ''{0}'' \uAE30\uB2A5\uC744 \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: \uBCF4\uC548 \uAD00\uB9AC\uC790\uAC00 \uC788\uC744 \uACBD\uC6B0 \uAE30\uB2A5\uC744 false\uB85C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."}
++ "FEATURE_SECURE_PROCESSING: \uBCF4\uC548 \uAD00\uB9AC\uC790\uAC00 \uC788\uC744 \uACBD\uC6B0 \uAE30\uB2A5\uC744 false\uB85C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "\uB0B4\uBD80 XSLTC \uC624\uB958: \uC0DD\uC131\uB41C \uBC14\uC774\uD2B8 \uCF54\uB4DC\uAC00 try-catch-finally \uBE14\uB85D\uC744 \uD3EC\uD568\uD558\uBBC0\uB85C outlined \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "\uB0B4\uBD80 XSLTC \uC624\uB958: OutlineableChunkStart \uBC0F OutlineableChunkEnd \uD45C\uC2DC\uC790\uC758 \uC9DD\uC774 \uB9DE\uC544\uC57C \uD558\uACE0 \uC62C\uBC14\uB974\uAC8C \uC911\uCCA9\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "\uB0B4\uBD80 XSLTC \uC624\uB958: outlined \uCC98\uB9AC\uB41C \uBC14\uC774\uD2B8 \uCF54\uB4DC \uBE14\uB85D\uC5D0 \uC18D\uD55C \uBA85\uB839\uC774 \uC5EC\uC804\uD788 \uC6D0\uB798 \uBA54\uC18C\uB4DC\uC5D0\uC11C \uCC38\uC870\uB429\uB2C8\uB2E4."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "\uB0B4\uBD80 XSLTC \uC624\uB958: translet\uC758 \uBA54\uC18C\uB4DC\uAC00 Java Virtual Machine\uC758 \uBA54\uC18C\uB4DC \uAE38\uC774 \uC81C\uD55C\uC778 64KB\uB97C \uCD08\uACFC\uD569\uB2C8\uB2E4. \uB300\uAC1C \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uC758 \uD15C\uD50C\uB9AC\uD2B8\uAC00 \uB9E4\uC6B0 \uD06C\uAE30 \uB54C\uBB38\uC5D0 \uBC1C\uC0DD\uD569\uB2C8\uB2E4. \uB354 \uC791\uC740 \uD15C\uD50C\uB9AC\uD2B8\uB97C \uC0AC\uC6A9\uD558\uB3C4\uB85D \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uB97C \uC7AC\uAD6C\uC131\uD574 \uBCF4\uC2ED\uC2DC\uC624."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Java \uBCF4\uC548\uC774 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uB41C \uACBD\uC6B0 TemplatesImpl \uC9C1\uB82C\uD654 \uD574\uC81C\uC5D0 \uB300\uD55C \uC9C0\uC6D0\uC774 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uB429\uB2C8\uB2E4. jdk.xml.enableTemplatesImplDeserialization \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 true\uB85C \uC124\uC815\uD558\uBA74 \uC774\uB97C \uBB34\uD6A8\uD654\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,10 +17,10 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
++/*
++ * $Id: ErrorMessages_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
++ */
+
+-/*
+- * $Id: ErrorMessages_pt_BR.java 3023 2011-03-01 00:53:34Z joehw $
+- */
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+
+ import java.util.ListResourceBundle;
+@@ -214,7 +214,7 @@
+ * the expression.
+ */
+ {ErrorMsg.XPATH_PARSER_ERR,
+- "Erro durante o parse da express\u00E3o XPath ''{0}''."},
++ "Erro durante o parsing da express\u00E3o XPath ''{0}''."},
+
+ /*
+ * Note to translators: An element in the stylesheet requires a
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "N\u00E3o foi poss\u00EDvel ler o alvo ''{0}'' da folha de estilos, porque o acesso a ''{1}'' n\u00E3o \u00E9 permitido em virtude da restri\u00E7\u00E3o definida pela propriedade accessExternalStylesheet."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -475,7 +475,7 @@
+ * encountered in the stylesheet but is not recognized.
+ */
+ {ErrorMsg.ELEMENT_PARSE_ERR,
+- "N\u00E3o foi poss\u00EDvel fazer parse do elemento ''{0}''"},
++ "N\u00E3o foi poss\u00EDvel fazer parsing do elemento ''{0}''"},
+
+ /*
+ * Note to translators: "use", "<key>", "node", "node-set", "string"
+@@ -519,7 +519,7 @@
+ * contains the expression that was in error.
+ */
+ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR,
+- "N\u00E3o \u00E9 poss\u00EDvel fazer parse do modelo do valor do atributo ''{0}''."},
++ "N\u00E3o \u00E9 poss\u00EDvel fazer parsing do modelo do valor do atributo ''{0}''."},
+
+ /*
+ * Note to translators: ???
+@@ -682,7 +682,7 @@
+ * documentation.
+ */
+ {ErrorMsg.COMPILE_USAGE_STR,
+- "SINOPSE\n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile [-o <sa\u00EDda>]\n [-d <diret\u00F3rio>] [-j <jarfile>] [-p <pacote>]\n [-n] [-x] [-u] [-v] [-h] { <folha de estilos> | -i }\n\nOP\u00C7\u00D5ES\n -o <sa\u00EDda> atribui o nome <sa\u00EDda> ao translet\n gerado. Por default, o nome translet\n origina-se do nome <folha de estilos>. Esta op\u00E7\u00E3o\n \u00E9 ignorada caso sejam compiladas v\u00E1rias folhas de estilos.\n -d <diret\u00F3rio> especifica um diret\u00F3rio de destino para translet\n -j <arquivo jar> empacota as classes translet em um arquivo jar do\n nome especificado como <arquivo jar>\n -p <pacote> especifica um prefixo de nome do pacote para todas as classes\n translet geradas.\n -n permite a inclus\u00E3o do modelo na linha (comportamento default melhor\n em m\u00E9dia).\n -x ativa a sa\u00EDda de mensagens de depura\u00E7\u00E3o adicionais\n -u interpreta os argumentos <folha de estilos> como URLs\n -i obriga o compilador a ler a folha de estilos de stdin\n -v imprime a vers\u00E3o do compilador\n -h imprime esta instru\u00E7\u00E3o de uso\n"},
++ "SINOPSE\n java com.sun.org.apache.xalan.internal.xsltc.cmdline.Compile [-o <sa\u00EDda>]\n [-d <diret\u00F3rio>] [-j <jarfile>] [-p <pacote>]\n [-n] [-x] [-u] [-v] [-h] { <folha de estilos> | -i }\n\nOP\u00C7\u00D5ES\n -o <sa\u00EDda> atribui o nome <sa\u00EDda> ao translet\n gerado. Por padr\u00E3o, o nome translet\n origina-se do nome <folha de estilos>. Esta op\u00E7\u00E3o\n \u00E9 ignorada caso sejam compiladas v\u00E1rias folhas de estilos.\n -d <diret\u00F3rio> especifica um diret\u00F3rio de destino para translet\n -j <arquivo jar> empacota as classes translet em um arquivo jar do\n nome especificado como <arquivo jar>\n -p <pacote> especifica um prefixo de nome do pacote para todas as classes\n translet geradas.\n -n permite a inclus\u00E3o do modelo na linha (comportamento padr\u00E3o melhor\n em m\u00E9dia).\n -x ativa a sa\u00EDda de mensagens de depura\u00E7\u00E3o adicionais\n -u interpreta os argumentos <folha de estilos> como URLs\n -i obriga o compilador a ler a folha de estilos de stdin\n -v imprime a vers\u00E3o do compilador\n -h imprime esta instru\u00E7\u00E3o de uso\n"},
+
+ /*
+ * Note to translators: This message contains usage information for a
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "ADVERT\u00CANCIA: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "ERRO FATAL: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "ERRO: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "N\u00E3o \u00E9 poss\u00EDvel definir o recurso ''{0}'' nesta TransformerFactory."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: N\u00E3o \u00E9 poss\u00EDvel definir o recurso como falso quando o gerenciador de seguran\u00E7a est\u00E1 presente."}
++ "FEATURE_SECURE_PROCESSING: N\u00E3o \u00E9 poss\u00EDvel definir o recurso como falso quando o gerenciador de seguran\u00E7a est\u00E1 presente."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Erro interno de XSLTC: o byte code gerado cont\u00E9m um bloco try-catch-finally e n\u00E3o pode ser outlined."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Erro interno de XSLTC: os marcadores OutlineableChunkStart e OutlineableChunkEnd devem ser balanceados e aninhados corretamente."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Erro interno de XSLTC: ainda h\u00E1 refer\u00EAncia no m\u00E9todo original a uma instru\u00E7\u00E3o que fazia parte de um bloco de byte code que foi outlined."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Erro interno de XSLTC: um m\u00E9todo no translet excede a limita\u00E7\u00E3o da M\u00E1quina Virtual Java quanto ao tamanho de um m\u00E9todo de de 64 kilobytes. Em geral, essa situa\u00E7\u00E3o \u00E9 causada por modelos de uma folha de estilos que s\u00E3o muito grandes. Tente reestruturar sua folha de estilos de forma a usar modelos menores."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "Quando a seguran\u00E7a do Java est\u00E1 ativada, o suporte para desserializar TemplatesImpl fica desativado. Essa situa\u00E7\u00E3o pode ser corrigida definindo a propriedade do sistema jdk.xml.enableTemplatesImplDeserialization como true."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,10 +17,10 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
++/*
++ * $Id: ErrorMessages_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
++ */
+
+-/*
+- * $Id: ErrorMessages_sv.java 3023 2011-03-01 00:53:34Z joehw $
+- */
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+
+ import java.util.ListResourceBundle;
+@@ -413,7 +413,7 @@
+ * encountered.
+ */
+ {ErrorMsg.INTERNAL_ERR,
+- "Irreparabelt XSLTC-internfel: ''{0}''"},
++ "O\u00E5terkalleligt internt XSLTC-fel: ''{0}''"},
+
+ /*
+ * Note to translators: The stylesheet contained an element that was
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "Kunde inte l\u00E4sa formatmallen ''{0}'', eftersom ''{1}''-\u00E5tkomst inte till\u00E5ts p\u00E5 grund av begr\u00E4nsning som anges av egenskapen accessExternalStylesheet."},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "VARNING: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "O\u00C5TERKALLELIGT FEL: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "FEL: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -882,7 +882,7 @@
+ * substitution text contains the actual value of the attribute.
+ */
+ {ErrorMsg.INVALID_QNAME_ERR,
+- "Ett attribut vars v\u00E4rde m\u00E5ste vara ett QName eller en blankteckenseparerad lista med QNames hade v\u00E4rdet ''{0}''"},
++ "Ett attribut vars v\u00E4rde m\u00E5ste vara ett QName eller en blankteckenavgr\u00E4nsad lista med QNames hade v\u00E4rdet ''{0}''"},
+
+ /*
+ * Note to translators: An attribute whose value is required to
+@@ -916,7 +916,58 @@
+ "Kan inte st\u00E4lla in funktionen ''{0}'' i denna TransformerFactory."},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: Funktionen kan inte anges till false om s\u00E4kerhetshanteraren anv\u00E4nds."}
++ "FEATURE_SECURE_PROCESSING: Funktionen kan inte anges till false om s\u00E4kerhetshanteraren anv\u00E4nds."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "Internt XSLTC-fel: den genererade bytekoden inneh\u00E5ller ett try-catch-finally-block och kan inte g\u00F6ras till en disposition."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "Internt XSLTC-fel: mark\u00F6rerna OutlineableChunkStart och OutlineableChunkEnd m\u00E5ste vara balanserade och korrekt kapslade."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "Internt XSLTC-fel: originalmetoden refererar fortfarande till en instruktion som var en del av ett bytekodsblock som gjordes till en disposition."
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "Internt XSLTC-fel: en metod i transleten \u00F6verstiger Java Virtual Machines l\u00E4ngdbegr\u00E4nsning f\u00F6r en metod p\u00E5 64 kilobytes. Det h\u00E4r orsakas vanligen av mycket stora mallar i en formatmall. F\u00F6rs\u00F6k att omstrukturera formatmallen att anv\u00E4nda mindre mallar."
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "N\u00E4r Java-s\u00E4kerheten \u00E4r aktiverad \u00E4r st\u00F6det f\u00F6r avserialisering av TemplatesImpl avaktiverat. Du kan \u00E5sidos\u00E4tta det h\u00E4r genom att st\u00E4lla in systemegenskapen jdk.xml.enableTemplatesImplDeserialization till sant."}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_zh_CN.java,v 1.2.4.1 2005/09/15 10:15:21 pvedula Exp $
++ * $Id: ErrorMessages_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -214,7 +214,7 @@
+ * the expression.
+ */
+ {ErrorMsg.XPATH_PARSER_ERR,
+- "\u5BF9 XPath \u8868\u8FBE\u5F0F ''{0}'' \u8FDB\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u51FA\u9519\u3002"},
++ "\u89E3\u6790 XPath \u8868\u8FBE\u5F0F ''{0}'' \u65F6\u51FA\u9519\u3002"},
+
+ /*
+ * Note to translators: An element in the stylesheet requires a
+@@ -406,7 +406,7 @@
+ * XSLTC to process the XML input document had a configuration problem.
+ */
+ {ErrorMsg.SAX_PARSER_CONFIG_ERR,
+- "JAXP \u8BED\u6CD5\u5206\u6790\u5668\u672A\u6B63\u786E\u914D\u7F6E"},
++ "JAXP \u89E3\u6790\u5668\u672A\u6B63\u786E\u914D\u7F6E"},
+
+ /*
+ * Note to translators: The substitution text names the internal error
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "\u7531\u4E8E accessExternalStylesheet \u5C5E\u6027\u8BBE\u7F6E\u7684\u9650\u5236\u800C\u4E0D\u5141\u8BB8 ''{1}'' \u8BBF\u95EE, \u56E0\u6B64\u65E0\u6CD5\u8BFB\u53D6\u6837\u5F0F\u8868\u76EE\u6807 ''{0}''\u3002"},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -475,7 +475,7 @@
+ * encountered in the stylesheet but is not recognized.
+ */
+ {ErrorMsg.ELEMENT_PARSE_ERR,
+- "\u65E0\u6CD5\u5BF9\u5143\u7D20 ''{0}'' \u8FDB\u884C\u8BED\u6CD5\u5206\u6790"},
++ "\u65E0\u6CD5\u89E3\u6790\u5143\u7D20 ''{0}''"},
+
+ /*
+ * Note to translators: "use", "<key>", "node", "node-set", "string"
+@@ -519,7 +519,7 @@
+ * contains the expression that was in error.
+ */
+ {ErrorMsg.ATTR_VAL_TEMPLATE_ERR,
+- "\u65E0\u6CD5\u5BF9\u5C5E\u6027\u503C\u6A21\u677F ''{0}'' \u8FDB\u884C\u8BED\u6CD5\u5206\u6790\u3002"},
++ "\u65E0\u6CD5\u89E3\u6790\u5C5E\u6027\u503C\u6A21\u677F ''{0}''\u3002"},
+
+ /*
+ * Note to translators: ???
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "\u8B66\u544A: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "\u81F4\u547D\u9519\u8BEF: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "\u9519\u8BEF: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "\u65E0\u6CD5\u5BF9\u6B64 TransformerFactory \u8BBE\u7F6E\u529F\u80FD ''{0}''\u3002"},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: \u5B58\u5728 Security Manager \u65F6, \u65E0\u6CD5\u5C06\u6B64\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u5047\u201D\u3002"}
++ "FEATURE_SECURE_PROCESSING: \u5B58\u5728 Security Manager \u65F6, \u65E0\u6CD5\u5C06\u6B64\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u5047\u201D\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "\u5185\u90E8 XSLTC \u9519\u8BEF: \u751F\u6210\u7684\u5B57\u8282\u4EE3\u7801\u5305\u542B try-catch-finally \u5757, \u65E0\u6CD5\u8FDB\u884C Outlined\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "\u5185\u90E8 XSLTC \u9519\u8BEF: OutlineableChunkStart \u548C OutlineableChunkEnd \u6807\u8BB0\u5FC5\u987B\u914D\u5BF9\u5E76\u4E14\u6B63\u786E\u5D4C\u5957\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "\u5185\u90E8 XSLTC \u9519\u8BEF: \u5C5E\u4E8E\u5DF2\u8FDB\u884C Outlined \u7684\u5B57\u8282\u4EE3\u7801\u5757\u7684\u6307\u4EE4\u5728\u539F\u59CB\u65B9\u6CD5\u4E2D\u4ECD\u88AB\u5F15\u7528\u3002"
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "\u5185\u90E8 XSLTC \u9519\u8BEF: translet \u4E2D\u7684\u65B9\u6CD5\u8D85\u8FC7\u4E86 Java \u865A\u62DF\u673A\u7684\u65B9\u6CD5\u957F\u5EA6\u9650\u5236 64 KB\u3002\u8FD9\u901A\u5E38\u662F\u7531\u4E8E\u6837\u5F0F\u8868\u4E2D\u7684\u6A21\u677F\u975E\u5E38\u5927\u9020\u6210\u7684\u3002\u8BF7\u5C1D\u8BD5\u4F7F\u7528\u8F83\u5C0F\u7684\u6A21\u677F\u91CD\u65B0\u6784\u5EFA\u6837\u5F0F\u8868\u3002"
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "\u542F\u7528\u4E86 Java \u5B89\u5168\u65F6, \u5C06\u7981\u7528\u5BF9\u53CD\u5E8F\u5217\u5316 TemplatesImpl \u7684\u652F\u6301\u3002\u53EF\u4EE5\u901A\u8FC7\u5C06 jdk.xml.enableTemplatesImplDeserialization \u7CFB\u7EDF\u5C5E\u6027\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u6765\u8986\u76D6\u6B64\u8BBE\u7F6E\u3002"}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_zh_TW.java,v 1.2.4.1 2005/09/15 10:16:08 pvedula Exp $
++ * $Id: ErrorMessages_zh_TW.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
+@@ -453,7 +453,7 @@
+ * Note to translators: access to the stylesheet target is denied
+ */
+ {ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
+- "Could not read stylesheet target ''{0}'', because ''{1}'' access is not allowed."},
++ "\u7121\u6CD5\u8B80\u53D6\u6A23\u5F0F\u8868\u76EE\u6A19 ''{0}''\uFF0C\u56E0\u70BA accessExternalStylesheet \u5C6C\u6027\u8A2D\u5B9A\u7684\u9650\u5236\uFF0C\u6240\u4EE5\u4E0D\u5141\u8A31 ''{1}'' \u5B58\u53D6\u3002"},
+
+ /*
+ * Note to translators: This message represents an internal error in
+@@ -777,7 +777,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
+- "\u8B66\u544A: ''{0}''\n :{1}"},
++ "WARNING: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -793,7 +793,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
+- "\u56B4\u91CD\u932F\u8AA4: ''{0}''\n :{1}"},
++ "FATAL ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -809,7 +809,7 @@
+ * it the same amount as the first in English.
+ */
+ {ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
+- "\u932F\u8AA4: ''{0}''\n :{1}"},
++ "ERROR: ''{0}''\n :{1}"},
+
+ /*
+ * Note to translators: This message is used to indicate the severity
+@@ -916,7 +916,58 @@
+ "\u7121\u6CD5\u5728\u6B64 TransformerFactory \u4E0A\u8A2D\u5B9A\u529F\u80FD ''{0}''\u3002"},
+
+ {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+- "FEATURE_SECURE_PROCESSING: \u5B89\u5168\u7BA1\u7406\u7A0B\u5F0F\u5B58\u5728\u6642\uFF0C\u7121\u6CD5\u5C07\u529F\u80FD\u8A2D\u70BA\u507D\u3002"}
++ "FEATURE_SECURE_PROCESSING: \u5B89\u5168\u7BA1\u7406\u7A0B\u5F0F\u5B58\u5728\u6642\uFF0C\u7121\u6CD5\u5C07\u529F\u80FD\u8A2D\u70BA\u507D\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method, and "try-catch-finally block"
++ * refers to the Java keywords with those names. "Outlined" is a
++ * technical term internal to XSLTC and should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_TRY_CATCH,
++ "\u5167\u90E8 XSLTC \u932F\u8AA4: \u7522\u751F\u7684\u4F4D\u5143\u7D44\u78BC\u5305\u542B try-catch-finally \u5340\u584A\uFF0C\u7121\u6CD5\u52A0\u4EE5 outlined."},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The terms "OutlineableChunkStart" and
++ * "OutlineableChunkEnd" are the names of classes internal to XSLTC and
++ * should not be translated. The message indicates that for every
++ * "start" there must be a corresponding "end", and vice versa, and
++ * that if one of a pair of "start" and "end" appears between another
++ * pair of corresponding "start" and "end", then the other half of the
++ * pair must also be between that same enclosing pair.
++ */
++ {ErrorMsg.OUTLINE_ERR_UNBALANCED_MARKERS,
++ "\u5167\u90E8 XSLTC \u932F\u8AA4: OutlineableChunkStart \u548C OutlineableChunkEnd \u6A19\u8A18\u5FC5\u9808\u6210\u5C0D\u51FA\u73FE\uFF0C\u4E26\u4F7F\u7528\u6B63\u78BA\u7684\u5DE2\u72C0\u7D50\u69CB\u3002"},
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The term "byte code" is a Java technical term for the
++ * executable code in a Java method. The "method" that is being
++ * referred to is a Java method in a translet that XSLTC is generating
++ * in processing a stylesheet. The "instruction" that is being
++ * referred to is one of the instrutions in the Java byte code in that
++ * method. "Outlined" is a technical term internal to XSLTC and
++ * should not be translated.
++ */
++ {ErrorMsg.OUTLINE_ERR_DELETED_TARGET,
++ "\u5167\u90E8 XSLTC \u932F\u8AA4: \u539F\u59CB\u65B9\u6CD5\u4E2D\u4ECD\u7136\u53C3\u7167\u5C6C\u65BC outlined \u4F4D\u5143\u7D44\u78BC\u5340\u584A\u4E00\u90E8\u5206\u7684\u6307\u793A\u3002"
++ },
++
++
++ /*
++ * Note to translators: This message describes an internal error in the
++ * processor. The "method" that is being referred to is a Java method
++ * in a translet that XSLTC is generating.
++ *
++ */
++ {ErrorMsg.OUTLINE_ERR_METHOD_TOO_BIG,
++ "\u5167\u90E8 XSLTC \u932F\u8AA4: translet \u4E2D\u7684\u65B9\u6CD5\u8D85\u904E Java \u865B\u64EC\u6A5F\u5668\u5C0D\u65BC\u65B9\u6CD5\u9577\u5EA6 64 KB \u7684\u9650\u5236\u3002\u9019\u901A\u5E38\u662F\u56E0\u70BA\u6A23\u5F0F\u8868\u4E2D\u6709\u975E\u5E38\u5927\u7684\u6A23\u677F\u3002\u8ACB\u5617\u8A66\u91CD\u65B0\u7D44\u7E54\u60A8\u7684\u6A23\u5F0F\u8868\u4EE5\u4F7F\u7528\u8F03\u5C0F\u7684\u6A23\u677F\u3002"
++ },
++
++ {ErrorMsg.DESERIALIZE_TRANSLET_ERR, "\u555F\u7528 Java \u5B89\u5168\u6642\uFF0C\u6703\u505C\u7528\u9084\u539F\u5E8F\u5217\u5316 TemplatesImpl \u7684\u652F\u63F4\u3002\u5C07 jdk.xml.enableTemplatesImplDeserialization \u7CFB\u7D71\u5C6C\u6027\u8A2D\u70BA\u771F\u5373\u53EF\u8986\u5BEB\u6B64\u8A2D\u5B9A\u3002"}
++
+ };
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java Fri Apr 10 09:20:34 2015 -0700
+@@ -117,6 +117,7 @@
+ public static final String JAXP_NO_SOURCE_ERR = "JAXP_NO_SOURCE_ERR";
+ public static final String JAXP_COMPILE_ERR = "JAXP_COMPILE_ERR";
+ public static final String JAXP_INVALID_ATTR_ERR = "JAXP_INVALID_ATTR_ERR";
++ public static final String JAXP_INVALID_ATTR_VALUE_ERR = "JAXP_INVALID_ATTR_VALUE_ERR";
+ public static final String JAXP_SET_RESULT_ERR = "JAXP_SET_RESULT_ERR";
+ public static final String JAXP_NO_TRANSLET_ERR = "JAXP_NO_TRANSLET_ERR";
+ public static final String JAXP_NO_HANDLER_ERR = "JAXP_NO_HANDLER_ERR";
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java Fri Apr 10 09:20:34 2015 -0700
+@@ -270,8 +270,8 @@
+ if (Double.isNaN(start))
+ return(EMPTYSTRING);
+
+- final int strlen = value.length();
+- int istart = (int)Math.round(start) - 1;
++ final int strlen = value.length();
++ int istart = (int)Math.round(start) - 1;
+
+ if (istart > strlen)
+ return(EMPTYSTRING);
+@@ -292,10 +292,11 @@
+ public static String substringF(String value, double start, double length) {
+ if (Double.isInfinite(start) ||
+ Double.isNaN(start) ||
+- Double.isNaN(length))
++ Double.isNaN(length) ||
++ length < 0)
+ return(EMPTYSTRING);
+
+- int istart = (int)Math.round(start) - 1;
++ int istart = (int)Math.round(start) - 1;
+ final int isum;
+ if (Double.isInfinite(length))
+ isum = Integer.MAX_VALUE;
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_pt_BR.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,10 +17,10 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
++/*
++ * $Id: ErrorMessages_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
++ */
+
+-/*
+- * $Id: ErrorMessages_pt_BR.java 3023 2011-03-01 00:53:34Z joehw $
+- */
+ package com.sun.org.apache.xalan.internal.xsltc.runtime;
+
+ import java.util.ListResourceBundle;
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -17,10 +17,10 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
++/*
++ * $Id: ErrorMessages_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
++ */
+
+-/*
+- * $Id: ErrorMessages_sv.java 3023 2011-03-01 00:53:34Z joehw $
+- */
+ package com.sun.org.apache.xalan.internal.xsltc.runtime;
+
+ import java.util.ListResourceBundle;
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: ErrorMessages_zh_CN.java,v 1.2.4.1 2005/09/14 05:52:21 pvedula Exp $
++ * $Id: ErrorMessages_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+
+ package com.sun.org.apache.xalan.internal.xsltc.runtime;
+@@ -212,7 +212,7 @@
+ * DTD.
+ */
+ {BasisLibrary.PARSER_DTD_SUPPORT_ERR,
+- "\u4F7F\u7528\u7684 SAX \u8BED\u6CD5\u5206\u6790\u5668\u4E0D\u4F1A\u5904\u7406 DTD \u58F0\u660E\u4E8B\u4EF6\u3002"},
++ "\u4F7F\u7528\u7684 SAX \u89E3\u6790\u5668\u4E0D\u4F1A\u5904\u7406 DTD \u58F0\u660E\u4E8B\u4EF6\u3002"},
+
+ /*
+ * Note to translators: The following message indicates that the XML
+@@ -221,7 +221,7 @@
+ * declarations.
+ */
+ {BasisLibrary.NAMESPACES_SUPPORT_ERR,
+- "\u4F7F\u7528\u7684 SAX \u8BED\u6CD5\u5206\u6790\u5668\u4E0D\u652F\u6301 XML \u540D\u79F0\u7A7A\u95F4\u3002"},
++ "\u4F7F\u7528\u7684 SAX \u89E3\u6790\u5668\u4E0D\u652F\u6301 XML \u540D\u79F0\u7A7A\u95F4\u3002"},
+
+ /*
+ * Note to translators: The substitution text is the URI that was in
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesImpl.java Fri Apr 10 09:20:34 2015 -0700
+@@ -24,28 +24,27 @@
+ package com.sun.org.apache.xalan.internal.xsltc.trax;
+
+ import com.sun.org.apache.xalan.internal.XalanConstants;
++import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
++import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
++import com.sun.org.apache.xalan.internal.xsltc.DOM;
++import com.sun.org.apache.xalan.internal.xsltc.Translet;
++import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
++import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
++import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
+ import java.io.IOException;
+ import java.io.ObjectInputStream;
+ import java.io.ObjectOutputStream;
+ import java.io.Serializable;
+-import java.util.Properties;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+-
++import java.util.Map;
++import java.util.Properties;
+ import javax.xml.XMLConstants;
+ import javax.xml.transform.Templates;
+ import javax.xml.transform.Transformer;
+ import javax.xml.transform.TransformerConfigurationException;
+ import javax.xml.transform.URIResolver;
+
+-import com.sun.org.apache.xalan.internal.xsltc.DOM;
+-import com.sun.org.apache.xalan.internal.xsltc.Translet;
+-import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
+-import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
+-import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
+-import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+-
+ /**
+ * @author Morten Jorgensen
+ * @author G. Todd Millerj
+@@ -131,8 +130,30 @@
+ private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+
+ static final class TransletClassLoader extends ClassLoader {
++
++ private final Map<String,Class> _loadedExternalExtensionFunctions;
++
+ TransletClassLoader(ClassLoader parent) {
+ super(parent);
++ _loadedExternalExtensionFunctions = null;
++ }
++
++ TransletClassLoader(ClassLoader parent,Map<String, Class> mapEF) {
++ super(parent);
++ _loadedExternalExtensionFunctions = mapEF;
++ }
++
++ public Class<?> loadClass(String name) throws ClassNotFoundException {
++ Class<?> ret = null;
++ // The _loadedExternalExtensionFunctions will be empty when the
++ // SecurityManager is not set and the FSP is turned off
++ if (_loadedExternalExtensionFunctions != null) {
++ ret = _loadedExternalExtensionFunctions.get(name);
++ }
++ if (ret == null) {
++ ret = super.loadClass(name);
++ }
++ return ret;
+ }
+
+ /**
+@@ -330,7 +351,7 @@
+ TransletClassLoader loader = (TransletClassLoader)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+- return new TransletClassLoader(ObjectFactory.findClassLoader());
++ return new TransletClassLoader(ObjectFactory.findClassLoader(),_tfactory.getExternalExtensionsMap());
+ }
+ });
+
+--- ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Fri Apr 10 09:20:34 2015 -0700
+@@ -27,12 +27,12 @@
+ import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+ import com.sun.org.apache.xalan.internal.utils.FeatureManager;
+ import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
++import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
+ import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
+ import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+ import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
+ import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
+ import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
+-import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
+ import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
+ import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
+ import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
+@@ -50,6 +50,7 @@
+ import java.net.URL;
+ import java.util.Enumeration;
+ import java.util.Hashtable;
++import java.util.Map;
+ import java.util.Properties;
+ import java.util.Vector;
+ import java.util.zip.ZipEntry;
+@@ -57,7 +58,6 @@
+ import javax.xml.XMLConstants;
+ import javax.xml.parsers.SAXParser;
+ import javax.xml.parsers.SAXParserFactory;
+-
+ import javax.xml.transform.ErrorListener;
+ import javax.xml.transform.Source;
+ import javax.xml.transform.Templates;
+@@ -239,6 +239,13 @@
+
+ private final FeatureManager _featureManager;
+
++ private ClassLoader _extensionClassLoader = null;
++
++ // Unmodifiable view of external extension function from xslt compiler
++ // It will be populated by user-specified extension functions during the
++ // type checking
++ private Map<String, Class> _xsltcExtensionFunctions;
++
+ /**
+ * javax.xml.transform.sax.TransformerFactory implementation.
+ */
+@@ -270,6 +277,12 @@
+
+ //Parser's security manager
+ _xmlSecurityManager = new XMLSecurityManager(true);
++ //Unmodifiable hash map with loaded external extension functions
++ _xsltcExtensionFunctions = null;
++ }
++
++ public Map<String,Class> getExternalExtensionsMap() {
++ return _xsltcExtensionFunctions;
+ }
+
+ /**
+@@ -330,6 +343,8 @@
+ return Boolean.FALSE;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ return _xmlSecurityManager;
++ } else if (name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
++ return _extensionClassLoader;
+ }
+
+ /** Check to see if the property is managed by the security manager **/
+@@ -444,6 +459,16 @@
+ return;
+ }
+ }
++ else if ( name.equals(XalanConstants.JDK_EXTENSION_CLASSLOADER)) {
++ if (value instanceof ClassLoader) {
++ _extensionClassLoader = (ClassLoader) value;
++ return;
++ } else {
++ final ErrorMsg err
++ = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_VALUE_ERR, "Extension Functions ClassLoader");
++ throw new IllegalArgumentException(err.toString());
++ }
++ }
+
+ if (_xmlSecurityManager != null &&
+ _xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
+@@ -878,7 +903,6 @@
+ // Reset the per-session attributes to their default values
+ // after each newTemplates() call.
+ resetTransientAttributes();
+-
+ return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);
+ }
+ }
+@@ -895,8 +919,10 @@
+ xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet);
+ xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
+ xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager);
++ xsltc.setProperty(XalanConstants.JDK_EXTENSION_CLASSLOADER, _extensionClassLoader);
+ xsltc.init();
+-
++ if (!_isNotSecureProcessing)
++ _xsltcExtensionFunctions = xsltc.getExternalExtensionFunctions();
+ // Set a document loader (for xsl:include/import) if defined
+ if (_uriResolver != null) {
+ xsltc.setSourceLoader(this);
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+ FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+@@ -55,7 +27,7 @@
+ SYNTAX_ERR = Ung\u00FCltige Zeichenfolge angegeben.
+ VALIDATION_ERR = Aufruf einer Methode wie insertBefore oder removeChild w\u00FCrde die Dokumentgrammatik des Knotens ung\u00FCltig machen.
+ WRONG_DOCUMENT_ERR = Ein Knoten wird in einem anderen Dokument verwendet als dem, von dem er erstellt wurde.
+-TYPE_MISMATCH_ERR = Der Wertetyp f\u00FCr diesen Parameternamen ist nicht mit dem erwarteten Wertetyp kompatibel.
++TYPE_MISMATCH_ERR = Der Werttyp f\u00FCr diesen Parameternamen ist nicht mit dem erwarteten Werttyp kompatibel.
+
+ #error messages or exceptions
+ FEATURE_NOT_SUPPORTED = Parameter {0} wird erkannt, aber der angeforderte Wert kann nicht festgelegt werden.
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = Ung\u00FCltiges XML-Zeichen (Unicode: 0x{0}) wurde bei der Normalisierung im DOM gefunden.
+-UndeclaredEntRefInAttrValue = Attribut \"{0}\" Wert \"{1}\" referenzierte eine nicht deklarierte Entit\u00E4t.
++UndeclaredEntRefInAttrValue = Attribut "{0}" Wert "{1}" referenzierte eine nicht deklarierte Entit\u00E4t.
+ NullLocalElementName = Lokaler Nullname wurde bei der Namespace-Normalisierung von Element {0} gefunden.
+ NullLocalAttrName = Lokaler Nullname wurde bei der Namespace-Normalisierung von Attribut {0} gefunden.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = Der Klassenname der Dokument-Factory \"{0}\", mit dem der DOM-Baum erstellt wurde, hat nicht den Typ org.w3c.dom.Document.
+-MissingDocumentClassName = Der Klassenname der Dokument-Factory \"{0}\", mit dem der DOM-Baum erstellt wurde, konnte nicht gefunden werden.
+-CannotCreateDocumentClass = Die Klasse mit dem Namen \"{0}\" konnte nicht als org.w3c.dom.Document erstellt werden.
++InvalidDocumentClassName = Der Klassenname der Dokument-Factory "{0}", mit dem der DOM-Baum erstellt wurde, hat nicht den Typ org.w3c.dom.Document.
++MissingDocumentClassName = Der Klassenname der Dokument-Factory "{0}", mit dem der DOM-Baum erstellt wurde, konnte nicht gefunden werden.
++CannotCreateDocumentClass = Die Klasse mit dem Namen "{0}" konnte nicht als org.w3c.dom.Document erstellt werden.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = Eigenschaft "{0}" muss vor der Eigenschaft "{1}" festgelegt werden.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_es.properties 3019 2011-02-28 19:57:14Z joehw $
++# @version $Id: DOMMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+ FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = Se ha encontrado un car\u00E1cter XML (Unicode: 0x{0}) no v\u00E1lido en DOM durante la normalizaci\u00F3n.
+-UndeclaredEntRefInAttrValue = El atributo \"{0}\" con valor \"{1}\" ha hecho referencia a una entidad que no se declar\u00F3.
++UndeclaredEntRefInAttrValue = El atributo "{0}" con valor "{1}" ha hecho referencia a una entidad que no se declar\u00F3.
+ NullLocalElementName = Se ha encontrado un nombre local nulo durante la normalizaci\u00F3n del espacio de nombres del elemento {0}.
+ NullLocalAttrName = Se ha encontrado un nombre local nulo durante la normalizaci\u00F3n del espacio de nombres del atributo {0}.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = El nombre de clase de la f\u00E1brica de documentos \"{0}\" utilizado para construir el \u00E1rbol DOM no es del tipo org.w3c.dom.Document.
+-MissingDocumentClassName = No se ha encontrado el nombre de clase de la f\u00E1brica de documentos \"{0}\" utilizado para construir el \u00E1rbol DOM.
+-CannotCreateDocumentClass = No se ha podido construir la clase con el nombre \"{0}\" como un org.w3c.dom.Document.
++InvalidDocumentClassName = El nombre de clase de la f\u00E1brica de documentos "{0}" utilizado para construir el \u00E1rbol DOM no es del tipo org.w3c.dom.Document.
++MissingDocumentClassName = No se ha encontrado el nombre de clase de la f\u00E1brica de documentos "{0}" utilizado para construir el \u00E1rbol DOM.
++CannotCreateDocumentClass = No se ha podido construir la clase con el nombre "{0}" como un org.w3c.dom.Document.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = La propiedad ''{0}'' debe definirse antes de definir la propiedad ''{1}''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+ FormatFailed = Une erreur interne est survenue lors du formatage du message suivant :\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = Un caract\u00E8re XML non valide (Unicode : 0x{0}) a \u00E9t\u00E9 trouv\u00E9 dans le DOM au cours de la normalisation.
+-UndeclaredEntRefInAttrValue = La valeur de l''attribut \"{0}\", \"{1}\", r\u00E9f\u00E9ren\u00E7ait une entit\u00E9 non d\u00E9clar\u00E9e.
++UndeclaredEntRefInAttrValue = La valeur de l''attribut "{0}", "{1}", r\u00E9f\u00E9ren\u00E7ait une entit\u00E9 non d\u00E9clar\u00E9e.
+ NullLocalElementName = Un nom local NULL a \u00E9t\u00E9 d\u00E9tect\u00E9 au cours de la normalisation de l''espace de noms de l''\u00E9l\u00E9ment {0}.
+ NullLocalAttrName = Un nom local NULL a \u00E9t\u00E9 d\u00E9tect\u00E9 au cours de la normalisation de l''espace de noms de l''attribut {0}.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = Le nom de classe de la fabrique de documents \"{0}\" utilis\u00E9e pour construire l''arborescence DOM n''est pas de type org.w3c.dom.Document.
+-MissingDocumentClassName = Le nom de classe de la fabrique de documents \"{0}\" utilis\u00E9e pour construire l''arborescence DOM est introuvable.
+-CannotCreateDocumentClass = La classe nomm\u00E9e \"{0}\" n''a pas pu \u00EAtre construite en tant que org.w3c.dom.Document.
++InvalidDocumentClassName = Le nom de classe de la fabrique de documents "{0}" utilis\u00E9e pour construire l''arborescence DOM n''est pas de type org.w3c.dom.Document.
++MissingDocumentClassName = Le nom de classe de la fabrique de documents "{0}" utilis\u00E9e pour construire l''arborescence DOM est introuvable.
++CannotCreateDocumentClass = La classe nomm\u00E9e "{0}" n''a pas pu \u00EAtre construite en tant que org.w3c.dom.Document.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = La propri\u00E9t\u00E9 ''{0}'' doit \u00EAtre d\u00E9finie avant la propri\u00E9t\u00E9 ''{1}''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id$
++# @version $Id: DOMMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+ FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = \u00C8 stato trovato un carattere XML non valido (Unicode: 0x{0}) in DOM durante la normalizzazione.
+-UndeclaredEntRefInAttrValue = L''attributo \"{0}\" con valore \"{1}\" fa riferimento a un''entit\u00E0 non dichiarata.
++UndeclaredEntRefInAttrValue = L''attributo "{0}" con valore "{1}" fa riferimento a un''entit\u00E0 non dichiarata.
+ NullLocalElementName = \u00C8 stato rilevato un nome locale nullo durante la normalizzazione dello spazio di nomi dell''elemento {0}.
+ NullLocalAttrName = \u00C8 stato rilevato un nome locale nullo durante la normalizzazione dello spazio di nomi dell''attributo {0}.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = Il nome classe del document factory \"{0}\" utilizzato per creare la struttura DOM non \u00E8 di tipo org.w3c.dom.Document.
+-MissingDocumentClassName = Impossibile trovare il nome classe del document factory \"{0}\" utilizzato per creare la struttura DOM.
+-CannotCreateDocumentClass = Impossibile creare la classe denominata \"{0}\" come org.w3c.dom.Document.
++InvalidDocumentClassName = Il nome classe del document factory "{0}" utilizzato per creare la struttura DOM non \u00E8 di tipo org.w3c.dom.Document.
++MissingDocumentClassName = Impossibile trovare il nome classe del document factory "{0}" utilizzato per creare la struttura DOM.
++CannotCreateDocumentClass = Impossibile creare la classe denominata "{0}" come org.w3c.dom.Document.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = Impostare la propriet\u00E0 ''{0}'' prima di impostare la propriet\u00E0 ''{1}''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+ FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = \u6B63\u898F\u5316\u4E2D\u306BDOM\u5185\u306B\u7121\u52B9\u306AXML\u6587\u5B57(Unicode: 0x{0})\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002
+-UndeclaredEntRefInAttrValue = \u5C5E\u6027\"{0}\"\u306E\u5024\"{1}\"\u3067\u53C2\u7167\u3055\u308C\u3066\u3044\u308B\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++UndeclaredEntRefInAttrValue = \u5C5E\u6027"{0}"\u306E\u5024"{1}"\u3067\u53C2\u7167\u3055\u308C\u3066\u3044\u308B\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+ NullLocalElementName = \u8981\u7D20{0}\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306E\u6B63\u898F\u5316\u4E2D\u306Bnull\u306E\u30ED\u30FC\u30AB\u30EB\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002
+ NullLocalAttrName = \u5C5E\u6027{0}\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306E\u6B63\u898F\u5316\u4E2D\u306Bnull\u306E\u30ED\u30FC\u30AB\u30EB\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = DOM\u30C4\u30EA\u30FC\u306E\u69CB\u7BC9\u306B\u4F7F\u7528\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\"{0}\"\u306E\u30AF\u30E9\u30B9\u540D\u304C\u30BF\u30A4\u30D7org.w3c.dom.Document\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+-MissingDocumentClassName = DOM\u30C4\u30EA\u30FC\u306E\u69CB\u7BC9\u306B\u4F7F\u7528\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA\"{0}\"\u306E\u30AF\u30E9\u30B9\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002
+-CannotCreateDocumentClass = \"{0}\"\u3068\u3044\u3046\u540D\u524D\u306E\u30AF\u30E9\u30B9\u3092org.w3c.dom.Document\u3068\u3057\u3066\u69CB\u7BC9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
++InvalidDocumentClassName = DOM\u30C4\u30EA\u30FC\u306E\u69CB\u7BC9\u306B\u4F7F\u7528\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA"{0}"\u306E\u30AF\u30E9\u30B9\u540D\u304C\u30BF\u30A4\u30D7org.w3c.dom.Document\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++MissingDocumentClassName = DOM\u30C4\u30EA\u30FC\u306E\u69CB\u7BC9\u306B\u4F7F\u7528\u3055\u308C\u308B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30FB\u30D5\u30A1\u30AF\u30C8\u30EA"{0}"\u306E\u30AF\u30E9\u30B9\u540D\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002
++CannotCreateDocumentClass = "{0}"\u3068\u3044\u3046\u540D\u524D\u306E\u30AF\u30E9\u30B9\u3092org.w3c.dom.Document\u3068\u3057\u3066\u69CB\u7BC9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = \u30D7\u30ED\u30D1\u30C6\u30A3''{1}''\u3092\u8A2D\u5B9A\u3059\u308B\u524D\u306B\u30D7\u30ED\u30D1\u30C6\u30A3''{0}''\u3092\u8A2D\u5B9A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = \uC815\uADDC\uD654 \uC911 DOM\uC5D0\uC11C \uBD80\uC801\uD569\uD55C XML \uBB38\uC790(\uC720\uB2C8\uCF54\uB4DC: 0x{0})\uAC00 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+-UndeclaredEntRefInAttrValue = \uC18D\uC131 \"{0}\" \uAC12 \"{1}\"\uC774(\uAC00) \uC120\uC5B8\uB418\uC9C0 \uC54A\uC740 \uC5D4\uD2F0\uD2F0\uB97C \uCC38\uC870\uD588\uC2B5\uB2C8\uB2E4.
++UndeclaredEntRefInAttrValue = \uC18D\uC131 "{0}" \uAC12 "{1}"\uC774(\uAC00) \uC120\uC5B8\uB418\uC9C0 \uC54A\uC740 \uC5D4\uD2F0\uD2F0\uB97C \uCC38\uC870\uD588\uC2B5\uB2C8\uB2E4.
+ NullLocalElementName = {0} \uC694\uC18C\uC758 \uB124\uC784\uC2A4\uD398\uC774\uC2A4 \uC815\uADDC\uD654 \uC911 \uB110 \uB85C\uCEEC \uC774\uB984\uC774 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ NullLocalAttrName = {0} \uC18D\uC131\uC758 \uB124\uC784\uC2A4\uD398\uC774\uC2A4 \uC815\uADDC\uD654 \uC911 \uB110 \uB85C\uCEEC \uC774\uB984\uC774 \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = DOM \uD2B8\uB9AC \uC0DD\uC131\uC5D0 \uC0AC\uC6A9\uB41C \uBB38\uC11C \uD329\uD1A0\uB9AC \"{0}\"\uC758 \uD074\uB798\uC2A4 \uC774\uB984\uC740 org.w3c.dom.Document \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+-MissingDocumentClassName = DOM \uD2B8\uB9AC \uC0DD\uC131\uC5D0 \uC0AC\uC6A9\uB41C \uBB38\uC11C \uD329\uD1A0\uB9AC \"{0}\"\uC758 \uD074\uB798\uC2A4 \uC774\uB984\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+-CannotCreateDocumentClass = \uC774\uB984\uC774 \"{0}\"\uC778 \uD074\uB798\uC2A4\uB97C org.w3c.dom.Document\uB85C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
++InvalidDocumentClassName = DOM \uD2B8\uB9AC \uC0DD\uC131\uC5D0 \uC0AC\uC6A9\uB41C \uBB38\uC11C \uD329\uD1A0\uB9AC "{0}"\uC758 \uD074\uB798\uC2A4 \uC774\uB984\uC740 org.w3c.dom.Document \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4.
++MissingDocumentClassName = DOM \uD2B8\uB9AC \uC0DD\uC131\uC5D0 \uC0AC\uC6A9\uB41C \uBB38\uC11C \uD329\uD1A0\uB9AC "{0}"\uC758 \uD074\uB798\uC2A4 \uC774\uB984\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
++CannotCreateDocumentClass = \uC774\uB984\uC774 "{0}"\uC778 \uD074\uB798\uC2A4\uB97C org.w3c.dom.Document\uB85C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = ''{1}'' \uC18D\uC131\uC744 \uC124\uC815\uD558\uAE30 \uC804\uC5D0 ''{0}'' \uC18D\uC131\uC744 \uC124\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+ FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = Um caractere XML inv\u00E1lido (Unicode: 0x {0}) foi encontrado no DOM durante a normaliza\u00E7\u00E3o.
+-UndeclaredEntRefInAttrValue = O atributo \"{0}\" valor \"{1}\" mencionou uma entidade que n\u00E3o foi declarada.
++UndeclaredEntRefInAttrValue = O atributo "{0}" valor "{1}" mencionou uma entidade que n\u00E3o foi declarada.
+ NullLocalElementName = Um nome de local nulo foi encontrado durante a normaliza\u00E7\u00E3o do namespace do elemento {0}.
+ NullLocalAttrName = Um nome de local nulo foi encontrado durante a normaliza\u00E7\u00E3o do namespace do atributo {0}.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = O nome da classe do factory do documento \"{0}\" usado para construir a \u00E1rvore DOM n\u00E3o \u00E9 do tipo org.w3c.dom.Document.
+-MissingDocumentClassName = N\u00E3o foi poss\u00EDvel encontrar o nome da classe do factory do documento \"{0}\" usado para construir a \u00E1rvore DOM.
+-CannotCreateDocumentClass = N\u00E3o foi poss\u00EDvel construir a classe com o nome \"{0}\" como um org.w3c.dom.Document.
++InvalidDocumentClassName = O nome da classe do factory do documento "{0}" usado para construir a \u00E1rvore DOM n\u00E3o \u00E9 do tipo org.w3c.dom.Document.
++MissingDocumentClassName = N\u00E3o foi poss\u00EDvel encontrar o nome da classe do factory do documento "{0}" usado para construir a \u00E1rvore DOM.
++CannotCreateDocumentClass = N\u00E3o foi poss\u00EDvel construir a classe com o nome "{0}" como um org.w3c.dom.Document.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = A propriedade ''{0}'' deve ser estabelecida antes da defini\u00E7\u00E3o da propriedade ''{1}''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+ FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = Ett ogiltigt XML-tecken (Unicode: 0x{0}) hittades i DOM vid normalisering.
+-UndeclaredEntRefInAttrValue = Attributet \"{0}\" med v\u00E4rdet \"{1}\" refererade en enhet som inte har deklarerats.
++UndeclaredEntRefInAttrValue = Attributet "{0}" med v\u00E4rdet "{1}" refererade en enhet som inte har deklarerats.
+ NullLocalElementName = Ett lokalt namn med null-v\u00E4rde p\u00E5tr\u00E4ffades vid namnrymdsnormalisering av elementet {0}.
+ NullLocalAttrName = Ett lokalt namn med null-v\u00E4rde p\u00E5tr\u00E4ffades vid namnrymdsnormalisering av attributet {0}.
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = Klassnamnet p\u00E5 dokumentfabrik \"{0}\" som anv\u00E4nds vid konstruktion av DOM-tr\u00E4det \u00E4r inte typ org.w3c.dom.Document.
+-MissingDocumentClassName = Hittade inte klassnamnet p\u00E5 dokumentfabrik \"{0}\" som anv\u00E4nds vid konstruktion av DOM-tr\u00E4det.
+-CannotCreateDocumentClass = Klassen \"{0}\" kunde inte konstrueras som org.w3c.dom.Document.
++InvalidDocumentClassName = Klassnamnet p\u00E5 dokumentfabrik "{0}" som anv\u00E4nds vid konstruktion av DOM-tr\u00E4det \u00E4r inte typ org.w3c.dom.Document.
++MissingDocumentClassName = Hittade inte klassnamnet p\u00E5 dokumentfabrik "{0}" som anv\u00E4nds vid konstruktion av DOM-tr\u00E4det.
++CannotCreateDocumentClass = Klassen "{0}" kunde inte konstrueras som org.w3c.dom.Document.
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = Egenskapen ''{0}'' m\u00E5ste anges f\u00F6re inst\u00E4llning av egenskapen ''{1}''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+ FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = \u8FDB\u884C\u89C4\u8303\u5316\u65F6, \u5728 DOM \u4E2D\u627E\u5230\u7684 XML \u5B57\u7B26 (Unicode: 0x{0}) \u65E0\u6548\u3002
+-UndeclaredEntRefInAttrValue = \u5C5E\u6027 \"{0}\" \u503C \"{1}\" \u5F15\u7528\u4E86\u672A\u58F0\u660E\u7684\u5B9E\u4F53\u3002
++UndeclaredEntRefInAttrValue = \u5C5E\u6027 "{0}" \u503C "{1}" \u5F15\u7528\u4E86\u672A\u58F0\u660E\u7684\u5B9E\u4F53\u3002
+ NullLocalElementName = \u5BF9\u5143\u7D20{0}\u8FDB\u884C\u540D\u79F0\u7A7A\u95F4\u89C4\u8303\u5316\u65F6\u9047\u5230\u4E86\u7A7A\u672C\u5730\u540D\u79F0\u3002
+ NullLocalAttrName = \u5BF9\u5C5E\u6027{0}\u8FDB\u884C\u540D\u79F0\u7A7A\u95F4\u89C4\u8303\u5316\u65F6\u9047\u5230\u4E86\u7A7A\u672C\u5730\u540D\u79F0\u3002
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = \u7528\u4E8E\u6784\u9020 DOM \u6811\u7684\u6587\u6863\u5DE5\u5382 \"{0}\" \u7684\u7C7B\u540D\u4E0D\u662F org.w3c.dom.Document \u7C7B\u578B\u3002
+-MissingDocumentClassName = \u627E\u4E0D\u5230\u7528\u4E8E\u6784\u9020 DOM \u6811\u7684\u6587\u6863\u5DE5\u5382 \"{0}\" \u7684\u7C7B\u540D\u3002
+-CannotCreateDocumentClass = \u540D\u4E3A \"{0}\" \u7684\u7C7B\u65E0\u6CD5\u6784\u9020\u4E3A org.w3c.dom.Document\u3002
++InvalidDocumentClassName = \u7528\u4E8E\u6784\u9020 DOM \u6811\u7684\u6587\u6863\u5DE5\u5382 "{0}" \u7684\u7C7B\u540D\u4E0D\u662F org.w3c.dom.Document \u7C7B\u578B\u3002
++MissingDocumentClassName = \u627E\u4E0D\u5230\u7528\u4E8E\u6784\u9020 DOM \u6811\u7684\u6587\u6863\u5DE5\u5382 "{0}" \u7684\u7C7B\u540D\u3002
++CannotCreateDocumentClass = \u540D\u4E3A "{0}" \u7684\u7C7B\u65E0\u6CD5\u6784\u9020\u4E3A org.w3c.dom.Document\u3002
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = \u5FC5\u987B\u5728\u8BBE\u7F6E\u5C5E\u6027 ''{1}'' \u4E4B\u524D\u8BBE\u7F6E\u5C5E\u6027 ''{0}''\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # DOM implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DOMMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DOMMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+ FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+@@ -71,14 +43,14 @@
+
+ #Error codes used in DOM Normalizer
+ InvalidXMLCharInDOM = \u6B63\u898F\u5316\u671F\u9593\u5728 DOM \u4E2D\u627E\u5230\u7121\u6548\u7684 XML \u5B57\u5143 (Unicode: 0x{0})\u3002
+-UndeclaredEntRefInAttrValue = \u5C6C\u6027 \"{0}\" \u503C \"{1}\" \u53C3\u7167\u672A\u5BA3\u544A\u7684\u500B\u9AD4\u3002
++UndeclaredEntRefInAttrValue = \u5C6C\u6027 "{0}" \u503C "{1}" \u53C3\u7167\u672A\u5BA3\u544A\u7684\u5BE6\u9AD4\u3002
+ NullLocalElementName = \u5143\u7D20 {0} \u547D\u540D\u7A7A\u9593\u6B63\u898F\u5316\u671F\u9593\uFF0C\u51FA\u73FE\u7A7A\u503C\u5340\u57DF\u540D\u7A31\u3002
+ NullLocalAttrName = \u5C6C\u6027 {0} \u547D\u540D\u7A7A\u9593\u6B63\u898F\u5316\u671F\u9593\uFF0C\u51FA\u73FE\u7A7A\u503C\u5340\u57DF\u540D\u7A31\u3002
+
+ #Error codes used in DOMParser
+-InvalidDocumentClassName = \u7528\u65BC\u5EFA\u69CB DOM \u6A39\u72C0\u7D50\u69CB\u7684\u6587\u4EF6\u8655\u7406\u7AD9 \"{0}\" \u985E\u5225\u540D\u7A31\u4E26\u975E\u985E\u578B org.w3c.dom.Document\u3002
+-MissingDocumentClassName = \u627E\u4E0D\u5230\u7528\u65BC\u5EFA\u69CB DOM \u6A39\u72C0\u7D50\u69CB\u7684\u6587\u4EF6\u8655\u7406\u7AD9 \"{0}\" \u985E\u5225\u540D\u7A31\u3002
+-CannotCreateDocumentClass = \u540D\u7A31\u70BA \"{0}\" \u7684\u985E\u5225\u7121\u6CD5\u5EFA\u69CB\u70BA org.w3c.dom.Document\u3002
++InvalidDocumentClassName = \u7528\u65BC\u5EFA\u69CB DOM \u6A39\u72C0\u7D50\u69CB\u7684\u6587\u4EF6\u8655\u7406\u7AD9 "{0}" \u985E\u5225\u540D\u7A31\u4E26\u975E\u985E\u578B org.w3c.dom.Document\u3002
++MissingDocumentClassName = \u627E\u4E0D\u5230\u7528\u65BC\u5EFA\u69CB DOM \u6A39\u72C0\u7D50\u69CB\u7684\u6587\u4EF6\u8655\u7406\u7AD9 "{0}" \u985E\u5225\u540D\u7A31\u3002
++CannotCreateDocumentClass = \u540D\u7A31\u70BA "{0}" \u7684\u985E\u5225\u7121\u6CD5\u5EFA\u69CB\u70BA org.w3c.dom.Document\u3002
+
+ # Error codes used by JAXP DocumentBuilder
+ jaxp-order-not-supported = \u8A2D\u5B9A\u5C6C\u6027 ''{1}'' \u4E4B\u524D\uFF0C\u5FC5\u9808\u8A2D\u5B9A\u5C6C\u6027 ''{0}''\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+ FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+
+ FieldCannotBeNull={0} kann nicht mit "Null"-Parameter aufgerufen werden.
+-UnknownField={0} mit unbekanntem Feld aufgerufen\:{1}
++UnknownField={0} mit unbekanntem Feld aufgerufen:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=Jahr \= {0}, Monat \= {1}, Tag \= {2}, Stunde\= {3}, Minute \= {4}, Sekunde \= {5}, fractionalSecond \= {6}, Zeitzone \= {7} ist keine g\u00FCltige Darstellung eines XML-Wertes f\u00FCr einen gregorianischen Kalender.
++InvalidXGCValue-milli=Jahr = {0}, Monat = {1}, Tag = {2}, Stunde= {3}, Minute = {4}, Sekunde = {5}, fractionalSecond = {6}, Zeitzone = {7} ist keine g\u00FCltige Darstellung eines XML-Wertes f\u00FCr einen gregorianischen Kalender.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=Jahr \= {0}, Monat \= {1}, Tag \= {2}, Stunde\= {3}, Minute \= {4}, Sekunde \= {5}, fractionalSecond \= {6}, Zeitzone \= {7} ist keine g\u00FCltige Darstellung eines XML-Wertes f\u00FCr einen gregorianischen Kalender.
++InvalidXGCValue-fractional=Jahr = {0}, Monat = {1}, Tag = {2}, Stunde= {3}, Minute = {4}, Sekunde = {5}, fractionalSecond = {6}, Zeitzone = {7} ist keine g\u00FCltige Darstellung eines XML-Wertes f\u00FCr einen gregorianischen Kalender.
+
+ InvalidXGCFields=Ung\u00FCltige Gruppe von Feldern f\u00FCr XMLGregorianCalendar festgelegt
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+ FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+
+ FieldCannotBeNull=no se puede llamar a {0} con un par\u00E1metro ''nulo''.
+-UnknownField=se ha llamado a {0} con un campo desconocido\:{1}
++UnknownField=se ha llamado a {0} con un campo desconocido:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=A\u00F1o \= {0}, Mes \= {1}, D\u00EDa \= {2}, Hora \= {3}, Minuto \= {4}, Segundo \= {5}, Segundo Fraccionario \= {6}, Zona Horaria \= {7} , no es una representaci\u00F3n v\u00E1lida de un valor del calendario gregoriano XML.
++InvalidXGCValue-milli=A\u00F1o = {0}, Mes = {1}, D\u00EDa = {2}, Hora = {3}, Minuto = {4}, Segundo = {5}, Segundo Fraccionario = {6}, Zona Horaria = {7} , no es una representaci\u00F3n v\u00E1lida de un valor del calendario gregoriano XML.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=A\u00F1o \= {0}, Mes \= {1}, D\u00EDa \= {2}, Hora \= {3}, Minuto \= {4}, Segundo \= {5}, Segundo Fraccionario \= {6}, Zona Horaria \= {7} , no es una representaci\u00F3n v\u00E1lida de un valor del calendario gregoriano XML.
++InvalidXGCValue-fractional=A\u00F1o = {0}, Mes = {1}, D\u00EDa = {2}, Hora = {3}, Minuto = {4}, Segundo = {5}, Segundo Fraccionario = {6}, Zona Horaria = {7} , no es una representaci\u00F3n v\u00E1lida de un valor del calendario gregoriano XML.
+
+ InvalidXGCFields=Juego de campos no v\u00E1lido definido para el calendario gregoriano XML
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+ FormatFailed = Une erreur interne est survenue lors du formatage du message suivant :\n
+
+ FieldCannotBeNull=Impossible d''appeler {0} avec le param\u00E8tre ''null''.
+-UnknownField={0} a \u00E9t\u00E9 appel\u00E9 avec un champ inconnu \: {1}
++UnknownField={0} a \u00E9t\u00E9 appel\u00E9 avec un champ inconnu : {1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=Ann\u00E9e \= {0}, Mois \= {1}, Jour \= {2}, Heure \= {3}, Minute \= {4}, Seconde \= {5}, Fraction de seconde \= {6}, Fuseau horaire \= {7} ne repr\u00E9sentent pas des valeurs de calendrier gr\u00E9gorien XML valides.
++InvalidXGCValue-milli=Ann\u00E9e = {0}, Mois = {1}, Jour = {2}, Heure = {3}, Minute = {4}, Seconde = {5}, Fraction de seconde = {6}, Fuseau horaire = {7} ne repr\u00E9sentent pas des valeurs de calendrier gr\u00E9gorien XML valides.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=Ann\u00E9e \= {0}, Mois \= {1}, Jour \= {2}, Heure \= {3}, Minute \= {4}, Seconde \= {5}, Fraction de seconde \= {6}, Fuseau horaire \= {7} ne repr\u00E9sentent pas des valeurs de calendrier gr\u00E9gorien XML valides.
++InvalidXGCValue-fractional=Ann\u00E9e = {0}, Mois = {1}, Jour = {2}, Heure = {3}, Minute = {4}, Seconde = {5}, Fraction de seconde = {6}, Fuseau horaire = {7} ne repr\u00E9sentent pas des valeurs de calendrier gr\u00E9gorien XML valides.
+
+ InvalidXGCFields=Ensemble de champs non valide pour XMLGregorianCalendar
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+ FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+
+ FieldCannotBeNull=Impossibile richiamare {0} con un parametro ''null''.
+-UnknownField={0} richiamato con un campo sconosciuto\:{1}
++UnknownField={0} richiamato con un campo sconosciuto:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=Anno \= {0}, mese \= {1}, giorno \= {2}, ora \= {3}, minuto \= {4}, secondo \= {5}, frazione di secondo \= {6}, fuso orario \= {7} non \u00E8 una rappresentazione valida di un valore di calendario gregoriano XML.
++InvalidXGCValue-milli=Anno = {0}, mese = {1}, giorno = {2}, ora = {3}, minuto = {4}, secondo = {5}, frazione di secondo = {6}, fuso orario = {7} non \u00E8 una rappresentazione valida di un valore di calendario gregoriano XML.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=Anno \= {0}, mese \= {1}, giorno \= {2}, ora \= {3}, minuto \= {4}, secondo \= {5}, frazione di secondo \= {6}, fuso orario \= {7} non \u00E8 una rappresentazione valida di un valore di calendario gregoriano XML.
++InvalidXGCValue-fractional=Anno = {0}, mese = {1}, giorno = {2}, ora = {3}, minuto = {4}, secondo = {5}, frazione di secondo = {6}, fuso orario = {7} non \u00E8 una rappresentazione valida di un valore di calendario gregoriano XML.
+
+ InvalidXGCFields=Impostato set di campi non valido per XMLGregorianCalendar
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+ FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+
+ FieldCannotBeNull={0}\u306F''null''\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u306F\u547C\u3073\u51FA\u305B\u307E\u305B\u3093\u3002
+-UnknownField={0}\u306F\u4E0D\u660E\u306A\u30D5\u30A3\u30FC\u30EB\u30C9\u3067\u547C\u3073\u51FA\u3055\u308C\u307E\u3057\u305F\: {1}
++UnknownField={0}\u306F\u4E0D\u660E\u306A\u30D5\u30A3\u30FC\u30EB\u30C9\u3067\u547C\u3073\u51FA\u3055\u308C\u307E\u3057\u305F: {1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=\u5E74\={0}\u3001\u6708\={1}\u3001\u65E5\={2}\u3001\u6642\={3}\u3001\u5206\={4}\u3001\u79D2\={5}\u3001\u5C0F\u6570\u79D2\={6}\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\={7}\u306F\u3001XML\u30B0\u30EC\u30B4\u30EA\u30AA\u66A6\u306E\u5024\u306E\u6709\u52B9\u306A\u8868\u73FE\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++InvalidXGCValue-milli=\u5E74={0}\u3001\u6708={1}\u3001\u65E5={2}\u3001\u6642={3}\u3001\u5206={4}\u3001\u79D2={5}\u3001\u5C0F\u6570\u79D2={6}\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3={7}\u306F\u3001XML\u30B0\u30EC\u30B4\u30EA\u30AA\u66A6\u306E\u5024\u306E\u6709\u52B9\u306A\u8868\u73FE\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=\u5E74\={0}\u3001\u6708\={1}\u3001\u65E5\={2}\u3001\u6642\={3}\u3001\u5206\={4}\u3001\u79D2\={5}\u3001\u5C0F\u6570\u79D2\={6}\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\={7}\u306F\u3001XML\u30B0\u30EC\u30B4\u30EA\u30AA\u66A6\u306E\u5024\u306E\u6709\u52B9\u306A\u8868\u73FE\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++InvalidXGCValue-fractional=\u5E74={0}\u3001\u6708={1}\u3001\u65E5={2}\u3001\u6642={3}\u3001\u5206={4}\u3001\u79D2={5}\u3001\u5C0F\u6570\u79D2={6}\u3001\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3={7}\u306F\u3001XML\u30B0\u30EC\u30B4\u30EA\u30AA\u66A6\u306E\u5024\u306E\u6709\u52B9\u306A\u8868\u73FE\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+
+ InvalidXGCFields=XMLGregorianCalendar\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BB\u30C3\u30C8\u304C\u7121\u52B9\u3067\u3059
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+
+ FieldCannotBeNull={0}\uC740(\uB294) ''null'' \uB9E4\uAC1C\uBCC0\uC218\uB85C \uD638\uCD9C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+-UnknownField={0}\uC774(\uAC00) \uC54C \uC218 \uC5C6\uB294 \uD544\uB4DC\uB85C \uD638\uCD9C\uB428\:{1}
++UnknownField={0}\uC774(\uAC00) \uC54C \uC218 \uC5C6\uB294 \uD544\uB4DC\uB85C \uD638\uCD9C\uB428:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=\uC5F0\uB3C4 \= {0}, \uC6D4 \= {1}, \uB0A0\uC9DC \= {2}, \uC2DC\uAC04 \= {3}, \uBD84 \= {4}, \uCD08 \= {5}, \uC18C\uC218\uC810 \uC774\uD558 \uCD08 \= {6}, \uC2DC\uAC04\uB300 \= {7}\uC740(\uB294) XML \uC591\uB825 \uAC12\uC5D0 \uBD80\uC801\uD569\uD55C \uD615\uC2DD\uC785\uB2C8\uB2E4.
++InvalidXGCValue-milli=\uC5F0\uB3C4 = {0}, \uC6D4 = {1}, \uB0A0\uC9DC = {2}, \uC2DC\uAC04 = {3}, \uBD84 = {4}, \uCD08 = {5}, \uC18C\uC218\uC810 \uC774\uD558 \uCD08 = {6}, \uC2DC\uAC04\uB300 = {7}\uC740(\uB294) XML \uC591\uB825 \uAC12\uC5D0 \uBD80\uC801\uD569\uD55C \uD615\uC2DD\uC785\uB2C8\uB2E4.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=\uC5F0\uB3C4 \= {0}, \uC6D4 \= {1}, \uB0A0\uC9DC \= {2}, \uC2DC\uAC04 \= {3}, \uBD84 \= {4}, \uCD08 \= {5}, \uC18C\uC218\uC810 \uC774\uD558 \uCD08 \= {6}, \uC2DC\uAC04\uB300 \= {7}\uC740(\uB294) XML \uC591\uB825 \uAC12\uC5D0 \uBD80\uC801\uD569\uD55C \uD615\uC2DD\uC785\uB2C8\uB2E4.
++InvalidXGCValue-fractional=\uC5F0\uB3C4 = {0}, \uC6D4 = {1}, \uB0A0\uC9DC = {2}, \uC2DC\uAC04 = {3}, \uBD84 = {4}, \uCD08 = {5}, \uC18C\uC218\uC810 \uC774\uD558 \uCD08 = {6}, \uC2DC\uAC04\uB300 = {7}\uC740(\uB294) XML \uC591\uB825 \uAC12\uC5D0 \uBD80\uC801\uD569\uD55C \uD615\uC2DD\uC785\uB2C8\uB2E4.
+
+ InvalidXGCFields=XMLGregorianCalendar\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uD544\uB4DC \uC9D1\uD569\uC774 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+ FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+
+ FieldCannotBeNull={0} n\u00E3o pode ser chamado com o par\u00E2metro ''null''.
+-UnknownField={0} chamado com um campo desconhecido\:{1}
++UnknownField={0} chamado com um campo desconhecido:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=Ano \= {0}, M\u00EAs \= {1}, Dia \= {2}, Hora \= {3}, Minuto \= {4}, Segundo \= {5}, fractionalSecond \= {6}, Fuso hor\u00E1rio \= {7} , n\u00E3o \u00E9 uma representa\u00E7\u00E3o v\u00E1lida de um valor do Calend\u00E1rio Gregoriano XML.
++InvalidXGCValue-milli=Ano = {0}, M\u00EAs = {1}, Dia = {2}, Hora = {3}, Minuto = {4}, Segundo = {5}, fractionalSecond = {6}, Fuso hor\u00E1rio = {7} , n\u00E3o \u00E9 uma representa\u00E7\u00E3o v\u00E1lida de um valor do Calend\u00E1rio Gregoriano XML.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=Ano \= {0}, M\u00EAs \= {1}, Dia \= {2}, Hora \= {3}, Minuto \= {4}, Segundo \= {5}, fractionalSecond \= {6}, Fuso hor\u00E1rio \= {7} , n\u00E3o \u00E9 uma representa\u00E7\u00E3o v\u00E1lida de um valor do Calend\u00E1rio Gregoriano XML.
++InvalidXGCValue-fractional=Ano = {0}, M\u00EAs = {1}, Dia = {2}, Hora = {3}, Minuto = {4}, Segundo = {5}, fractionalSecond = {6}, Fuso hor\u00E1rio = {7} , n\u00E3o \u00E9 uma representa\u00E7\u00E3o v\u00E1lida de um valor do Calend\u00E1rio Gregoriano XML.
+
+ InvalidXGCFields=Conjunto inv\u00E1lido de conjunto de campos para XMLGregorianCalendar
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+ FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+
+ FieldCannotBeNull={0} kan inte anropas med null-parameter.
+-UnknownField={0} anropades med ok\u00E4nt f\u00E4lt\:{1}
++UnknownField={0} anropades med ok\u00E4nt f\u00E4lt:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=\u00C5r \= {0}, m\u00E5nad \= {1}, dag \= {2}, timme \= {3}, minut \= {4}, sekund \= {5}, br\u00E5kdelssekund \= {6}, tidszon \= {7} \u00E4r ogiltigt v\u00E4rde f\u00F6r gregoriansk kalender i XML.
++InvalidXGCValue-milli=\u00C5r = {0}, m\u00E5nad = {1}, dag = {2}, timme = {3}, minut = {4}, sekund = {5}, br\u00E5kdelssekund = {6}, tidszon = {7} \u00E4r ogiltigt v\u00E4rde f\u00F6r gregoriansk kalender i XML.
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=\u00C5r \= {0}, m\u00E5nad \= {1}, dag \= {2}, timme \= {3}, minut \= {4}, sekund \= {5}, br\u00E5kdelssekund \= {6}, tidszon \= {7} \u00E4r ogiltigt v\u00E4rde f\u00F6r gregoriansk kalender i XML.
++InvalidXGCValue-fractional=\u00C5r = {0}, m\u00E5nad = {1}, dag = {2}, timme = {3}, minut = {4}, sekund = {5}, br\u00E5kdelssekund = {6}, tidszon = {7} \u00E4r ogiltigt v\u00E4rde f\u00F6r gregoriansk kalender i XML.
+
+ InvalidXGCFields=Ogiltig upps\u00E4ttning med f\u00E4lt angivet i XMLGregorianCalendar
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+ FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+
+ FieldCannotBeNull=\u65E0\u6CD5\u4F7F\u7528 ''null'' \u53C2\u6570\u8C03\u7528{0}\u3002
+-UnknownField=\u4F7F\u7528\u672A\u77E5\u5B57\u6BB5\u8C03\u7528\u4E86{0}\: {1}
++UnknownField=\u4F7F\u7528\u672A\u77E5\u5B57\u6BB5\u8C03\u7528\u4E86{0}: {1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=\u5E74 \= {0}, \u6708 \= {1}, \u65E5 \= {2}, \u5C0F\u65F6 \= {3}, \u5206 \= {4}, \u79D2 \= {5}, \u5C0F\u6570\u79D2 \= {6}, \u65F6\u533A \= {7} \u4E0D\u662F XML \u683C\u91CC\u5386\u503C\u7684\u6709\u6548\u8868\u793A\u3002
++InvalidXGCValue-milli=\u5E74 = {0}, \u6708 = {1}, \u65E5 = {2}, \u5C0F\u65F6 = {3}, \u5206 = {4}, \u79D2 = {5}, \u5C0F\u6570\u79D2 = {6}, \u65F6\u533A = {7} \u4E0D\u662F XML \u683C\u91CC\u5386\u503C\u7684\u6709\u6548\u8868\u793A\u3002
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=\u5E74 \= {0}, \u6708 \= {1}, \u65E5 \= {2}, \u5C0F\u65F6 \= {3}, \u5206 \= {4}, \u79D2 \= {5}, \u5C0F\u6570\u79D2 \= {6}, \u65F6\u533A \= {7} \u4E0D\u662F XML \u683C\u91CC\u5386\u503C\u7684\u6709\u6548\u8868\u793A\u3002
++InvalidXGCValue-fractional=\u5E74 = {0}, \u6708 = {1}, \u65E5 = {2}, \u5C0F\u65F6 = {3}, \u5206 = {4}, \u79D2 = {5}, \u5C0F\u6570\u79D2 = {6}, \u65F6\u533A = {7} \u4E0D\u662F XML \u683C\u91CC\u5386\u503C\u7684\u6709\u6548\u8868\u793A\u3002
+
+ InvalidXGCFields=\u4E3A XMLGregorianCalendar \u8BBE\u7F6E\u7684\u5B57\u6BB5\u96C6\u65E0\u6548
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,46 +1,18 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Datatype API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: DatatypeMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: DatatypeMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+ FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+
+ FieldCannotBeNull=\u7121\u6CD5\u4F7F\u7528 ''null'' \u53C3\u6578\u547C\u53EB {0}
+-UnknownField=\u4F7F\u7528\u4E0D\u660E\u7684\u6B04\u4F4D\u547C\u53EB {0}\:{1}
++UnknownField=\u4F7F\u7528\u4E0D\u660E\u7684\u6B04\u4F4D\u547C\u53EB {0}:{1}
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-milli=\u5E74 \= {0}\u3001\u6708 \= {1}\uFF0C\u65E5 \= {2}\uFF0C\u5C0F\u6642 \= {3}\uFF0C\u5206\u9418\uFF0C \= {4}\uFF0C\u79D2 \= {5}\uFF0C\u5C0F\u6578\u79D2 \= {6}\uFF0C\u6642\u5340\uFF0C \= {7}\uFF0C\u4E0D\u662F XML \u516C\u66C6\u503C\u7684\u6709\u6548\u8868\u793A\u6CD5\u3002
++InvalidXGCValue-milli=\u5E74 = {0}\u3001\u6708 = {1}\uFF0C\u65E5 = {2}\uFF0C\u5C0F\u6642 = {3}\uFF0C\u5206\u9418\uFF0C = {4}\uFF0C\u79D2 = {5}\uFF0C\u5C0F\u6578\u79D2 = {6}\uFF0C\u6642\u5340\uFF0C = {7}\uFF0C\u4E0D\u662F XML \u516C\u66C6\u503C\u7684\u6709\u6548\u8868\u793A\u6CD5\u3002
+ #There are two similar keys 'InvalidXMLGreogorianCalendarValue' . Suffix (year, month) has been added and are used as per the context.
+-InvalidXGCValue-fractional=\u5E74 \= {0}\u3001\u6708 \= {1}\uFF0C\u65E5 \= {2}\uFF0C\u5C0F\u6642 \= {3}\uFF0C\u5206\u9418\uFF0C \= {4}\uFF0C\u79D2 \= {5}\uFF0C\u5C0F\u6578\u79D2 \= {6}\uFF0C\u6642\u5340\uFF0C \= {7}\uFF0C\u4E0D\u662F XML \u516C\u66C6\u503C\u7684\u6709\u6548\u8868\u793A\u6CD5\u3002
++InvalidXGCValue-fractional=\u5E74 = {0}\u3001\u6708 = {1}\uFF0C\u65E5 = {2}\uFF0C\u5C0F\u6642 = {3}\uFF0C\u5206\u9418\uFF0C = {4}\uFF0C\u79D2 = {5}\uFF0C\u5C0F\u6578\u79D2 = {6}\uFF0C\u6642\u5340\uFF0C = {7}\uFF0C\u4E0D\u662F XML \u516C\u66C6\u503C\u7684\u6709\u6548\u8868\u793A\u6CD5\u3002
+
+ InvalidXGCFields=XMLGregorianCalendar \u8A2D\u5B9A\u4E86\u7121\u6548\u7684\u6B04\u4F4D\u96C6
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+@@ -39,8 +11,8 @@
+ # SchemaFactory error messages
+ SchemaLanguageNull = Angegebene Schemasprache darf nicht null sein.
+ SchemaLanguageLengthZero = Angegebene Schemasprache darf nicht null Zeichen lang sein.
+-SchemaSourceArrayNull = Quell-Array-Parameter darf nicht null sein.
+-SchemaSourceArrayMemberNull = Quell-Array-Parameter darf keine Nullelemente enthalten.
++SchemaSourceArrayNull = Quellarrayparameter darf nicht null sein.
++SchemaSourceArrayMemberNull = Quellarrayparameter darf keine Nullelemente enthalten.
+ SchemaFactorySourceUnrecognized = Quellparameter des Typs "{0}" ist in dieser SchemaFactory unbekannt.
+
+ # Validator error messages
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+@@ -45,7 +17,7 @@
+
+ # Validator error messages
+ SourceParameterNull = Le param\u00E8tre source ne peut pas \u00EAtre NULL.
+-SourceNotAccepted = Le param\u00E8tre source de type ''{0}'' n''est pas accept\u00E9 par ce contr\u00F4le de validation (validator).
++SourceNotAccepted = Le param\u00E8tre source de type ''{0}'' n''est pas accept\u00E9 par ce valideur.
+ SourceResultMismatch = Le param\u00E8tre source de type ''{0}'' n''est pas compatible avec le param\u00E8tre de r\u00E9sultat de type ''{1}''.
+
+ # TypeInfoProvider error messages
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+@@ -45,7 +17,7 @@
+
+ # Validator error messages
+ SourceParameterNull = Il parametro di origine non pu\u00F2 essere nullo.
+-SourceNotAccepted = Il parametro di origine di tipo ''{0}'' non \u00E8 accettato da questo convalidatore.
++SourceNotAccepted = Il parametro di origine di tipo ''{0}'' non \u00E8 accettato da questo validator.
+ SourceResultMismatch = Il parametro di origine di tipo ''{0}'' non \u00E8 compatibile con il parametro dei risultati di tipo ''{1}''.
+
+ # TypeInfoProvider error messages
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces JAXP Validation API implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: JAXPValidationMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: JAXPValidationMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+@@ -48,7 +20,7 @@
+ true-not-supported = Status "True" f\u00FCr Feature "{0}" wird nicht unterst\u00FCtzt.
+ false-not-supported = Status "False" f\u00FCr Feature "{0}" wird nicht unterst\u00FCtzt.
+ feature-read-only = Feature "{0}" ist schreibgesch\u00FCtzt.
+-jaxp-secureprocessing-feature = FEATURE_SECURE_PROCESSING: Feature kann nicht auf \"false\" gesetzt werden, wenn Security Manager vorhanden ist.
++jaxp-secureprocessing-feature = FEATURE_SECURE_PROCESSING: Feature kann nicht auf "false" gesetzt werden, wenn Security Manager vorhanden ist.
+
+ # property messages
+ property-not-supported = Eigenschaft "{0}" wird nicht unterst\u00FCtzt.
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=Eigenschaft "{0}" sollte aufgerufen werden, nachdem das startDocument-Ereignis ausgel\u00F6st wurde
+ nullparameter=Namensparameter f\u00FCr "{0}" ist null
+-errorHandlerNotSet=Warnung\: Validierung wurde eingeschaltet, aber es wurde kein org.xml.sax.ErrorHandler festgelegt. Dies ist wahrscheinlich nicht beabsichtigt. Parser druckt die ersten {0} Fehler mit einem Standard-ErrorHandler. Rufen Sie die Methode "setErrorHandler" auf, um dies zu beheben.
+-errorHandlerDebugMsg=Fehler\: URI \= "{0}", Zeile \= "{1}", \: {2}
++errorHandlerNotSet=Warnung: Validierung wurde eingeschaltet, aber es wurde kein org.xml.sax.ErrorHandler festgelegt. Dies ist wahrscheinlich nicht beabsichtigt. Parser druckt die ersten {0} Fehler mit einem Standard-ErrorHandler. Rufen Sie die Methode "setErrorHandler" auf, um dies zu beheben.
++errorHandlerDebugMsg=Fehler: URI = "{0}", Zeile = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=La propiedad "{0}" debe llamarse despu\u00E9s de que se haya devuelto el evento startDocument
+ nullparameter=el par\u00E1metro de nombre para "{0}" es nulo
+-errorHandlerNotSet=Advertencia\: se activ\u00F3 la validaci\u00F3n pero no se defini\u00F3 un org.xml.sax.ErrorHandler, lo cual probablemente sea un resultado no deseado. El analizador utilizar\u00E1 un ErrorHandler por defecto para imprimir los primeros {0} errores. Llame al m\u00E9todo ''setErrorHandler'' para solucionarlo.
+-errorHandlerDebugMsg=Error\: URI \= "{0}", L\u00EDnea \= "{1}", \: {2}
++errorHandlerNotSet=Advertencia: se activ\u00F3 la validaci\u00F3n pero no se defini\u00F3 un org.xml.sax.ErrorHandler, lo cual probablemente sea un resultado no deseado. El analizador utilizar\u00E1 un ErrorHandler por defecto para imprimir los primeros {0} errores. Llame al m\u00E9todo ''setErrorHandler'' para solucionarlo.
++errorHandlerDebugMsg=Error: URI = "{0}", L\u00EDnea = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=La propri\u00E9t\u00E9 "{0}" doit \u00EAtre appel\u00E9e apr\u00E8s qu''un \u00E9v\u00E9nement startDocument est g\u00E9n\u00E9r\u00E9
+ nullparameter=le param\u00E8tre de nom pour "{0}" est NULL
+-errorHandlerNotSet=Avertissement \: la validation a \u00E9t\u00E9 activ\u00E9e mais aucun \u00E9l\u00E9ment org.xml.sax.ErrorHandler n''a \u00E9t\u00E9 d\u00E9fini, ce qui devrait probablement \u00EAtre le cas. L''analyseur utilisera un gestionnaire d''erreurs par d\u00E9faut pour imprimer les {0} premi\u00E8res erreurs. Appelez la m\u00E9thode ''setErrorHandler'' pour r\u00E9soudre ce probl\u00E8me.
+-errorHandlerDebugMsg=Erreur \: URI \= "{0}", ligne \= "{1}", \: {2}
++errorHandlerNotSet=Avertissement : la validation a \u00E9t\u00E9 activ\u00E9e mais aucun \u00E9l\u00E9ment org.xml.sax.ErrorHandler n''a \u00E9t\u00E9 d\u00E9fini, ce qui devrait probablement \u00EAtre le cas. L''analyseur utilisera un gestionnaire d''erreurs par d\u00E9faut pour imprimer les {0} premi\u00E8res erreurs. Appelez la m\u00E9thode ''setErrorHandler'' pour r\u00E9soudre ce probl\u00E8me.
++errorHandlerDebugMsg=Erreur : URI = "{0}", ligne = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=Richiamare la propriet\u00E0 "{0}" dopo l''esecuzione dell''evento startDocument
+ nullparameter=il parametro del nome per "{0}" \u00E8 nullo
+-errorHandlerNotSet=Avvertenza\: la convalida \u00E8 stata attivata, ma org.xml.sax.ErrorHandler non \u00E8 stato impostato, il che potrebbe essere un errore. Il parser utilizzer\u00E0 un ErrorHandler predefinito per visualizzare i primi {0} errori. Richiamare il metodo ''setErrorHandler'' per correggere questo problema.
+-errorHandlerDebugMsg=Errore\: URI \= "{0}", riga \= "{1}", \: {2}
++errorHandlerNotSet=Avvertenza: la convalida \u00E8 stata attivata, ma org.xml.sax.ErrorHandler non \u00E8 stato impostato, il che potrebbe essere un errore. Il parser utilizzer\u00E0 un ErrorHandler predefinito per visualizzare i primi {0} errori. Richiamare il metodo ''setErrorHandler'' per correggere questo problema.
++errorHandlerDebugMsg=Errore: URI = "{0}", riga = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=startDocument\u30A4\u30D9\u30F3\u30C8\u304C\u30B9\u30ED\u30FC\u3055\u308C\u305F\u5F8C\u3001\u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u3092\u547C\u3073\u51FA\u3059\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
+ nullparameter="{0}"\u306E\u540D\u524D\u30D1\u30E9\u30E1\u30FC\u30BF\u304Cnull\u3067\u3059
+-errorHandlerNotSet=\u8B66\u544A\: \u691C\u8A3C\u306F\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u304C\u3001org.xml.sax.ErrorHandler\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5FC5\u8981\u3068\u3055\u308C\u3066\u3044\u308B\u30CF\u30F3\u30C9\u30E9\u306F\u3053\u306E\u30CF\u30F3\u30C9\u30E9\u3067\u306F\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30D1\u30FC\u30B5\u30FC\u3067\u306F\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306EErrorHandler\u3092\u4F7F\u7528\u3057\u3066\u6700\u521D\u306E{0}\u30A8\u30E9\u30FC\u304C\u51FA\u529B\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u554F\u984C\u3092\u4FEE\u6B63\u3059\u308B\u306B\u306F\u3001''setErrorHandler''\u30E1\u30BD\u30C3\u30C9\u3092\u547C\u3073\u51FA\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+-errorHandlerDebugMsg=\u30A8\u30E9\u30FC\: URI \= "{0}"\u3001\u884C \= "{1}"\u3001\: {2}
++errorHandlerNotSet=\u8B66\u544A: \u691C\u8A3C\u306F\u30AA\u30F3\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u304C\u3001org.xml.sax.ErrorHandler\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5FC5\u8981\u3068\u3055\u308C\u3066\u3044\u308B\u30CF\u30F3\u30C9\u30E9\u306F\u3053\u306E\u30CF\u30F3\u30C9\u30E9\u3067\u306F\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u30D1\u30FC\u30B5\u30FC\u3067\u306F\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306EErrorHandler\u3092\u4F7F\u7528\u3057\u3066\u6700\u521D\u306E{0}\u30A8\u30E9\u30FC\u304C\u51FA\u529B\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u554F\u984C\u3092\u4FEE\u6B63\u3059\u308B\u306B\u306F\u3001''setErrorHandler''\u30E1\u30BD\u30C3\u30C9\u3092\u547C\u3073\u51FA\u3057\u3066\u304F\u3060\u3055\u3044\u3002
++errorHandlerDebugMsg=\u30A8\u30E9\u30FC: URI = "{0}"\u3001\u884C = "{1}"\u3001: {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+@@ -39,7 +11,7 @@
+
+ # JAXP messages
+ schema-not-supported = \uC9C0\uC815\uB41C \uC2A4\uD0A4\uB9C8 \uC5B8\uC5B4\uB294 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+-jaxp-order-not-supported = ''{1}'' \uC18D\uC131\uC744 \uC124\uC815\uD558\uAE30 \uC804\uC5D0 ''{0}'' \uC18D\uC131\uC744 \uC124\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
++jaxp-order-not-supported = ''{1}'' \uC18D\uC131\uC744 \uC124\uC815\uD558\uAE30 \uC804\uC5D0 ''{0}'' \uC18D\uC131\uC744 \uC124\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.
+ schema-already-specified = \uB110\uC774 \uC544\uB2CC \uC2A4\uD0A4\uB9C8 \uAC1D\uCCB4\uAC00 \uC774\uBBF8 \uC9C0\uC815\uB41C \uACBD\uC6B0 ''{0}'' \uC18D\uC131\uC744 \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+
+ # feature messages
+@@ -60,5 +32,5 @@
+
+ start-document-not-called="{0}" \uC18D\uC131\uC740 startDocument \uC774\uBCA4\uD2B8\uAC00 \uBC1C\uC0DD\uB41C \uD6C4 \uD638\uCD9C\uD574\uC57C \uD569\uB2C8\uB2E4.
+ nullparameter="{0}"\uC5D0 \uB300\uD55C \uC774\uB984 \uB9E4\uAC1C\uBCC0\uC218\uAC00 \uB110\uC785\uB2C8\uB2E4.
+-errorHandlerNotSet=\uACBD\uACE0\: \uAC80\uC99D\uC774 \uC124\uC815\uB418\uC5C8\uC9C0\uB9CC org.xml.sax.ErrorHandler\uAC00 \uC801\uC808\uD788 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uAD6C\uBB38 \uBD84\uC11D\uAE30\uAC00 \uAE30\uBCF8 ErrorHandler\uB97C \uC0AC\uC6A9\uD558\uC5EC \uCC98\uC74C {0}\uAC1C\uC758 \uC624\uB958\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4. \uC774 \uC624\uB958\uB97C \uC218\uC815\uD558\uB824\uBA74 ''setErrorHandler'' \uBA54\uC18C\uB4DC\uB97C \uD638\uCD9C\uD558\uC2ED\uC2DC\uC624.
+-errorHandlerDebugMsg=\uC624\uB958\: URI \= "{0}", \uD589 \= "{1}", \: {2}
++errorHandlerNotSet=\uACBD\uACE0: \uAC80\uC99D\uC774 \uC124\uC815\uB418\uC5C8\uC9C0\uB9CC org.xml.sax.ErrorHandler\uAC00 \uC801\uC808\uD788 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uAD6C\uBB38 \uBD84\uC11D\uAE30\uAC00 \uAE30\uBCF8 ErrorHandler\uB97C \uC0AC\uC6A9\uD558\uC5EC \uCC98\uC74C {0}\uAC1C\uC758 \uC624\uB958\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4. \uC774 \uC624\uB958\uB97C \uC218\uC815\uD558\uB824\uBA74 ''setErrorHandler'' \uBA54\uC18C\uB4DC\uB97C \uD638\uCD9C\uD558\uC2ED\uC2DC\uC624.
++errorHandlerDebugMsg=\uC624\uB958: URI = "{0}", \uD589 = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+@@ -54,11 +26,11 @@
+ property-not-supported = A propriedade ''{0}'' n\u00E3o \u00E9 suportada.
+ property-not-recognized = A propriedade ''{0}'' n\u00E3o \u00E9 reconhecida.
+ property-read-only = A propriedade ''{0}'' \u00E9 somente para leitura.
+-property-not-parsing-supported = A propriedade ''{0}'' n\u00E3o \u00E9 suportada durante o parse.
++property-not-parsing-supported = A propriedade ''{0}'' n\u00E3o \u00E9 suportada durante o parsing.
+ dom-node-read-not-supported = N\u00E3o \u00E9 poss\u00EDvel ler a propriedade do n\u00F3 de DOM. N\u00E3o existe uma \u00E1rvore de DOM.
+ incompatible-class = O valor especificado para a propriedade ''{0}'' n\u00E3o pode ser transmitido para ''{1}''.
+
+ start-document-not-called=A propriedade "{0}" deve ser chamada ap\u00F3s o evento startDocument ser lan\u00E7ado
+ nullparameter=o par\u00E2metro de nome de "{0}" \u00E9 nulo
+-errorHandlerNotSet=Advert\u00EAncia\: A valida\u00E7\u00E3o foi ativada, mas um org.xml.sax.ErrorHandler n\u00E3o foi definido, provavelmente porque n\u00E3o era necess\u00E1rio. O parser usar\u00E1 um ErrorHandler default para imprimir os primeiros {0} erros. Chame o m\u00E9todo ''setErrorHandler'' para corrigir o problema.
+-errorHandlerDebugMsg=Erro\: URI \= "{0}", Linha \= "{1}", \: {2}
++errorHandlerNotSet=Advert\u00EAncia: A valida\u00E7\u00E3o foi ativada, mas um org.xml.sax.ErrorHandler n\u00E3o foi definido, provavelmente porque n\u00E3o era necess\u00E1rio. O parser usar\u00E1 um ErrorHandler padr\u00E3o para imprimir os primeiros {0} erros. Chame o m\u00E9todo ''setErrorHandler'' para corrigir o problema.
++errorHandlerDebugMsg=Erro: URI = "{0}", Linha = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=Egenskapen "{0}" b\u00F6r anropas efter startDocument-h\u00E4ndelsen utl\u00F6ses
+ nullparameter=namnparametern f\u00F6r "{0}" \u00E4r null
+-errorHandlerNotSet=Varning\: valideringen startades, men det fanns ingen angiven org.xml.sax.ErrorHandler. Parser anv\u00E4nder ErrorHandler av standardtyp vid utskrift av de f\u00F6rsta {0} felen. Korrigera felet genom anrop av setErrorHandler-metoden.
+-errorHandlerDebugMsg=Fel\: URI \= "{0}", Rad \= "{1}", \: {2}
++errorHandlerNotSet=Varning: valideringen startades, men det fanns ingen angiven org.xml.sax.ErrorHandler. Parser anv\u00E4nder ErrorHandler av standardtyp vid utskrift av de f\u00F6rsta {0} felen. Korrigera felet genom anrop av setErrorHandler-metoden.
++errorHandlerDebugMsg=Fel: URI = "{0}", Rad = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+@@ -54,11 +26,11 @@
+ property-not-supported = \u4E0D\u652F\u6301\u5C5E\u6027 ''{0}''\u3002
+ property-not-recognized = \u65E0\u6CD5\u8BC6\u522B\u5C5E\u6027 ''{0}''\u3002
+ property-read-only = \u5C5E\u6027 ''{0}'' \u4E3A\u53EA\u8BFB\u3002
+-property-not-parsing-supported = \u6267\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u4E0D\u652F\u6301\u5C5E\u6027 ''{0}''\u3002
++property-not-parsing-supported = \u89E3\u6790\u65F6\u4E0D\u652F\u6301\u5C5E\u6027 ''{0}''\u3002
+ dom-node-read-not-supported = \u65E0\u6CD5\u8BFB\u53D6 DOM \u8282\u70B9\u5C5E\u6027\u3002\u4E0D\u5B58\u5728 DOM \u6811\u3002
+ incompatible-class = \u4E3A\u5C5E\u6027 ''{0}'' \u6307\u5B9A\u7684\u503C\u4E0D\u80FD\u8F6C\u6362\u4E3A{1}\u3002
+
+ start-document-not-called=\u5E94\u5728\u629B\u51FA startDocument \u4E8B\u4EF6\u540E\u8C03\u7528\u5C5E\u6027 "{0}"
+ nullparameter="{0}" \u7684\u540D\u79F0\u53C2\u6570\u4E3A\u7A7A\u503C
+-errorHandlerNotSet=\u8B66\u544A\: \u5DF2\u542F\u7528\u9A8C\u8BC1, \u4F46\u672A\u8BBE\u7F6E org.xml.sax.ErrorHandler, \u8FD9\u53EF\u80FD\u4E0D\u662F\u9884\u671F\u7ED3\u679C\u3002\u8BED\u6CD5\u5206\u6790\u5668\u5C06\u4F7F\u7528\u9ED8\u8BA4 ErrorHandler \u6765\u8F93\u51FA\u524D {0} \u4E2A\u9519\u8BEF\u3002\u8BF7\u8C03\u7528 ''setErrorHandler'' \u65B9\u6CD5\u4EE5\u89E3\u51B3\u6B64\u95EE\u9898\u3002
+-errorHandlerDebugMsg=\u9519\u8BEF\: URI \= "{0}", \u884C \= "{1}", \: {2}
++errorHandlerNotSet=\u8B66\u544A: \u5DF2\u542F\u7528\u9A8C\u8BC1, \u4F46\u672A\u8BBE\u7F6E org.xml.sax.ErrorHandler, \u8FD9\u53EF\u80FD\u4E0D\u662F\u9884\u671F\u7ED3\u679C\u3002\u89E3\u6790\u5668\u5C06\u4F7F\u7528\u9ED8\u8BA4 ErrorHandler \u6765\u8F93\u51FA\u524D {0} \u4E2A\u9519\u8BEF\u3002\u8BF7\u8C03\u7528 ''setErrorHandler'' \u65B9\u6CD5\u4EE5\u89E3\u51B3\u6B64\u95EE\u9898\u3002
++errorHandlerDebugMsg=\u9519\u8BEF: URI = "{0}", \u884C = "{1}", : {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces
+ # SAX implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: SAXMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: SAXMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+@@ -60,5 +32,5 @@
+
+ start-document-not-called=\u767C\u751F startDocument \u4E8B\u4EF6\u4E4B\u5F8C\uFF0C\u61C9\u547C\u53EB\u5C6C\u6027 "{0}"\u3002
+ nullparameter="{0}" \u7684\u540D\u7A31\u53C3\u6578\u70BA\u7A7A\u503C
+-errorHandlerNotSet=\u8B66\u544A\: \u5DF2\u958B\u555F\u9A57\u8B49\uFF0C\u4F46\u662F\u672A\u8A2D\u5B9A org.xml.sax.ErrorHandler\uFF0C\u9019\u53EF\u80FD\u4E0D\u662F\u6240\u8981\u7684\u72C0\u614B\u3002\u5256\u6790\u5668\u5C07\u4F7F\u7528\u9810\u8A2D\u7684 ErrorHandler \u4F86\u5217\u5370\u7B2C\u4E00\u500B {0} \u932F\u8AA4\u3002\u8ACB\u547C\u53EB ''setErrorHandler'' \u65B9\u6CD5\u4F86\u4FEE\u6B63\u6B64\u554F\u984C\u3002
+-errorHandlerDebugMsg=\u932F\u8AA4\: URI \= "{0}"\uFF0C\u884C \= "{1}"\uFF0C\: {2}
++errorHandlerNotSet=\u8B66\u544A: \u5DF2\u958B\u555F\u9A57\u8B49\uFF0C\u4F46\u662F\u672A\u8A2D\u5B9A org.xml.sax.ErrorHandler\uFF0C\u9019\u53EF\u80FD\u4E0D\u662F\u6240\u8981\u7684\u72C0\u614B\u3002\u5256\u6790\u5668\u5C07\u4F7F\u7528\u9810\u8A2D\u7684 ErrorHandler \u4F86\u5217\u5370\u7B2C\u4E00\u500B {0} \u932F\u8AA4\u3002\u8ACB\u547C\u53EB ''setErrorHandler'' \u65B9\u6CD5\u4F86\u4FEE\u6B63\u6B64\u554F\u984C\u3002
++errorHandlerDebugMsg=\u932F\u8AA4: URI = "{0}"\uFF0C\u884C = "{1}"\uFF0C: {2}
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+ FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+@@ -39,10 +11,10 @@
+ HrefMissing = "href"-Attribut eines "include"-Elements fehlt.
+ RecursiveInclude = Rekursives "include" ermittelt. Dokument "{0}" wurde bereits verarbeitet.
+ InvalidParseValue = Ung\u00FCltiger Wert f\u00FCr "parse"-Attribut bei "include"-Element: "{0}".
+-XMLParseError = Fehler beim Versuch, XML-Datei zu parsen (href="{0}"). Grund: {1}
++XMLParseError = Fehler beim Versuch, XML-Datei zu parsen (href=''{0}''). Ursache: {1}
+ XMLResourceError = Include-Vorgang nicht erfolgreich. Zur\u00FCck zu Fallback. Ressourcenfehler beim Lesen der Datei als XML (href="{0}"). Grund: {1}
+ TextResourceError = Include-Vorgang nicht erfolgreich. Zur\u00FCck zu Fallback. Ressourcenfehler beim Lesen der Datei als Text (href="{0}"). Grund: {1}
+-NO_XPointerSchema = Schema f\u00FCr \"{0}\" wird standardm\u00E4\u00DFig nicht unterst\u00FCtzt. Definieren Sie Ihr eigenes Schema f\u00FCr {0}. Siehe http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = Schema f\u00FCr "{0}" wird standardm\u00E4\u00DFig nicht unterst\u00FCtzt. Definieren Sie Ihr eigenes Schema f\u00FCr {0}. Siehe http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = Keine Subressource von XPointer-Prozessor f\u00FCr Zeiger {0} identifiziert.
+ NonDuplicateNotation = Mehrere Notationen mit dem Namen "{0}" wurden verwendet, die aber nicht als Duplikate ermittelt wurden.
+ NonDuplicateUnparsedEntity = Mehrere nicht geparste Entit\u00E4ten mit dem Namen "{0}" wurden verwendet, die aber nicht als Duplikate ermittelt wurden.
+@@ -55,7 +27,7 @@
+ UnexpandedEntityReferenceIllegal = Der Ersatz eines "include"-Elements, das als Dokumentelement im Quell-Infoset der obersten Ebene angezeigt wird, darf keine nicht erweiterten Entit\u00E4tsreferenzen enthalten.
+ HrefFragmentIdentifierIllegal = Fragment-IDs d\u00FCrfen nicht verwendet werden. Der "href"-Attributwert "{0}" ist nicht zul\u00E4ssig.
+ HrefSyntacticallyInvalid = "href"-Attributwert "{0}" hat eine ung\u00FCltige Syntax. Nach Anwenden der Escape-Regeln ist der Wert kein syntaktisch korrekter URI oder IRI.
+-XPointerStreamability = Es wurde ein xpointer angegeben, der auf eine Stelle im Quell-Infoset verweist. Auf diese Stelle kann aufgrund des Streaming-Charakters des Prozessors nicht zugegriffen werden.
++XPointerStreamability = Es wurde ein xpointer angegeben, der auf eine Stelle im Quell-Infoset verweist. Auf diese Stelle kann aufgrund des Streamingcharakters des Prozessors nicht zugegriffen werden.
+
+ XPointerResolutionUnsuccessful = XPointer-Aufl\u00F6sung nicht erfolgreich.
+
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+ FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+@@ -39,10 +11,10 @@
+ HrefMissing = Falta el atributo 'href' de un elemento 'include'.
+ RecursiveInclude = Se ha detectado un elemento include recursivo. El documento ''{0}'' ya se ha procesado.
+ InvalidParseValue = Valor no v\u00E1lido para el atributo ''parse'' en el elemento ''include'': ''{0}''.
+-XMLParseError = Error al intentar analizar el archivo XML (href=''{0}''). Motivo: {1}
++XMLParseError = Error al intentar analizar el archivo XML (href=''{0}''). Motivo: {1}
+ XMLResourceError = Fallo de la operaci\u00F3n include, conversi\u00F3n a fallback. Error del recurso al leer el archivo como XML (href=''{0}''). Motivo: {1}
+ TextResourceError = Fallo de la operaci\u00F3n include, conversi\u00F3n a fallback. Error del recurso al leer el archivo como texto (href=''{0}''). Motivo: {1}
+-NO_XPointerSchema = El esquema para \"{0}\" no est\u00E1 soportado por defecto. Defina su propio esquema para {0}. Consulte http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = El esquema para "{0}" no est\u00E1 soportado por defecto. Defina su propio esquema para {0}. Consulte http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = El procesador XPointer no ha identificado el subrecurso para el puntero {0}.
+ NonDuplicateNotation = Se han utilizado varias notaciones con el nombre''{0}'', pero no se ha determinado que sean duplicados.
+ NonDuplicateUnparsedEntity = Se han utilizado varias entidades no analizadas con el nombre''{0}'', pero no se ha determinado que sean duplicados.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+ FormatFailed = Une erreur interne est survenue lors du formatage du message suivant :\n
+@@ -42,7 +14,7 @@
+ XMLParseError = Erreur lors de la tentative d''analyse du fichier XML (href=''{0}''). Raison : {1}
+ XMLResourceError = Echec de l''op\u00E9ration Include, r\u00E9tablissement de l''\u00E9l\u00E9ment fallback. Erreur de ressource lors de la lecture du fichier en tant que XML (href=''{0}''). Raison : {1}
+ TextResourceError = Echec de l''op\u00E9ration Include, r\u00E9tablissement de l''\u00E9l\u00E9ment fallback. Erreur de ressource lors de la lecture du fichier en tant que texte (href=''{0}''). Raison : {1}
+-NO_XPointerSchema = Par d\u00E9faut, le sch\u00E9ma pour \"{0}\" n''est pas pris en charge. D\u00E9finissez votre propre sch\u00E9ma pour {0}. Reportez-vous \u00E0 l''adresse http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = Par d\u00E9faut, le sch\u00E9ma pour "{0}" n''est pas pris en charge. D\u00E9finissez votre propre sch\u00E9ma pour {0}. Reportez-vous \u00E0 l''adresse http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = Aucune sous-ressource n''est identifi\u00E9e par le processeur XPointer pour le pointeur {0}.
+ NonDuplicateNotation = Plusieurs notations portant le nom ''{0}'' ont \u00E9t\u00E9 utilis\u00E9es, mais elles n''ont pas \u00E9t\u00E9 consid\u00E9r\u00E9es comme des doublons.
+ NonDuplicateUnparsedEntity = Plusieurs entit\u00E9s non analys\u00E9es portant le nom ''{0}'' ont \u00E9t\u00E9 utilis\u00E9es, mais elles n''ont pas \u00E9t\u00E9 consid\u00E9r\u00E9es comme des doublons.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+ FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+@@ -39,10 +11,10 @@
+ HrefMissing = Manca l'attributo 'href' di un elemento 'include'.
+ RecursiveInclude = Inclusione ricorsiva rilevata. Il documento ''{0}'' \u00E8 gi\u00E0 stato elaborato.
+ InvalidParseValue = Valore non valido per l''attributo ''parse'' nell''elemento ''include'': ''{0}''.
+-XMLParseError = Errore nel tentativo di analizzare il file XML (href=''{0}''). Motivo: {1}
++XMLParseError = Errore durante il tentativo di analizzare il file XML (href=''{0}''). Causa: {1}
+ XMLResourceError = Operazione di inclusione non riuscita. Verr\u00E0 ripristinato il fallback. Errore di risorsa durante la lettura del file come XML (href=''{0}''). Motivo: {1}
+ TextResourceError = Operazione di inclusione non riuscita. Verr\u00E0 ripristinato il fallback. Errore di risorsa durante la lettura del file come testo (href=''{0}''). Motivo: {1}
+-NO_XPointerSchema = Lo schema per \"{0}\" non \u00E8 supportato per impostazione predefinita. Definire il proprio schema per {0}. Vedere http://apache.org/xml/properties/xpointer-schema.
++NO_XPointerSchema = Lo schema per "{0}" non \u00E8 supportato per impostazione predefinita. Definire il proprio schema per {0}. Vedere http://apache.org/xml/properties/xpointer-schema.
+ NO_SubResourceIdentified = Nessuna risorsa secondaria identificata dal processore XPointer per il puntatore {0}.
+ NonDuplicateNotation = Sono state utilizzate pi\u00F9 notazioni con il nome ''{0}'', ma \u00E8 stato determinato che non sono duplicati.
+ NonDuplicateUnparsedEntity = Sono state utilizzate pi\u00F9 entit\u00E0 non analizzate con il nome ''{0}'', ma \u00E8 stato determinato che non sono duplicati.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+ FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+@@ -42,7 +14,7 @@
+ XMLParseError = XML\u30D5\u30A1\u30A4\u30EB\u306E\u89E3\u6790\u8A66\u884C\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F(href=''{0}'')\u3002\u7406\u7531: {1}
+ XMLResourceError = \u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u64CD\u4F5C\u304C\u5931\u6557\u3057\u3001\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306B\u623B\u308A\u307E\u3059\u3002\u30D5\u30A1\u30A4\u30EB\u3092XML\u3068\u3057\u3066\u8AAD\u53D6\u308A\u4E2D\u306B\u30EA\u30BD\u30FC\u30B9\u30FB\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F(href=''{0}'')\u3002\u7406\u7531: {1}
+ TextResourceError = \u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u64CD\u4F5C\u304C\u5931\u6557\u3057\u3001\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306B\u623B\u308A\u307E\u3059\u3002\u30D5\u30A1\u30A4\u30EB\u3092\u30C6\u30AD\u30B9\u30C8\u3068\u3057\u3066\u8AAD\u53D6\u308A\u4E2D\u306B\u30EA\u30BD\u30FC\u30B9\u30FB\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F(href=''{0}'')\u3002\u7406\u7531: {1}
+-NO_XPointerSchema = \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\"{0}\"\u306E\u30B9\u30AD\u30FC\u30DE\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002{0}\u306B\u5BFE\u3057\u3066\u72EC\u81EA\u306E\u30B9\u30AD\u30FC\u30DE\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002http://apache.org/xml/properties/xpointer-schema\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044
++NO_XPointerSchema = \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001"{0}"\u306E\u30B9\u30AD\u30FC\u30DE\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002{0}\u306B\u5BFE\u3057\u3066\u72EC\u81EA\u306E\u30B9\u30AD\u30FC\u30DE\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002http://apache.org/xml/properties/xpointer-schema\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044
+ NO_SubResourceIdentified = \u30DD\u30A4\u30F3\u30BF{0}\u306EXPointer\u30D7\u30ED\u30BB\u30C3\u30B5\u3067\u306F\u30B5\u30D6\u30EA\u30BD\u30FC\u30B9\u306F\u8B58\u5225\u3055\u308C\u307E\u305B\u3093\u3002
+ NonDuplicateNotation = \u540D\u524D\u304C''{0}''\u306E\u8907\u6570\u306E\u8868\u8A18\u6CD5\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u308C\u3089\u306E\u8868\u8A18\u6CD5\u306F\u91CD\u8907\u3068\u307F\u306A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+ NonDuplicateUnparsedEntity = \u540D\u524D\u304C''{0}''\u306E\u8907\u6570\u306E\u672A\u89E3\u6790\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u308C\u3089\u306E\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u306F\u91CD\u8907\u3068\u307F\u306A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+@@ -39,10 +11,10 @@
+ HrefMissing = 'include' \uC694\uC18C\uC758 'href' \uC18D\uC131\uC774 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ RecursiveInclude = \uC21C\uD658 include\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. ''{0}'' \uBB38\uC11C\uAC00 \uC774\uBBF8 \uCC98\uB9AC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ InvalidParseValue = ''include'' \uC694\uC18C\uC5D0 ''parse'' \uC18D\uC131\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uAC12\uC774 \uC788\uC74C: ''{0}''.
+-XMLParseError = XML \uD30C\uC77C(href=''{0}'')\uC758 \uAD6C\uBB38\uC744 \uBD84\uC11D\uD558\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\uC6D0\uC778: {1}
++XMLParseError = XML \uD30C\uC77C(href=''{0}'')\uC758 \uAD6C\uBB38\uC744 \uBD84\uC11D\uD558\uB824\uACE0 \uC2DC\uB3C4\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC6D0\uC778: {1}
+ XMLResourceError = Include \uC791\uC5C5\uC744 \uC2E4\uD328\uD558\uC5EC fallback\uC73C\uB85C \uBCF5\uC6D0\uD558\uB294 \uC911\uC785\uB2C8\uB2E4. \uD30C\uC77C\uC744 XML(href=''{0}'')\uB85C \uC77D\uB294 \uC911 \uB9AC\uC18C\uC2A4 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC6D0\uC778: {1}
+ TextResourceError = Include \uC791\uC5C5\uC744 \uC2E4\uD328\uD558\uC5EC fallback\uC73C\uB85C \uBCF5\uC6D0\uD558\uB294 \uC911\uC785\uB2C8\uB2E4. \uD30C\uC77C\uC744 \uD14D\uC2A4\uD2B8(href=''{0}'')\uB85C \uC77D\uB294 \uC911 \uB9AC\uC18C\uC2A4 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC6D0\uC778: {1}
+-NO_XPointerSchema = \uAE30\uBCF8\uC801\uC73C\uB85C \"{0}\"\uC5D0 \uB300\uD55C \uC2A4\uD0A4\uB9C8\uB294 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. {0}\uC5D0 \uB300\uD574 \uACE0\uC720\uD55C \uC2A4\uD0A4\uB9C8\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624. http://apache.org/xml/properties/xpointer-schema\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
++NO_XPointerSchema = \uAE30\uBCF8\uC801\uC73C\uB85C "{0}"\uC5D0 \uB300\uD55C \uC2A4\uD0A4\uB9C8\uB294 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. {0}\uC5D0 \uB300\uD574 \uACE0\uC720\uD55C \uC2A4\uD0A4\uB9C8\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624. http://apache.org/xml/properties/xpointer-schema\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.
+ NO_SubResourceIdentified = {0} \uD3EC\uC778\uD130\uC5D0 \uB300\uD55C XPointer \uD504\uB85C\uC138\uC11C\uAC00 \uC2DD\uBCC4\uD55C \uD558\uC704 \uB9AC\uC18C\uC2A4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
+ NonDuplicateNotation = \uC774\uB984\uC774 ''{0}''\uC774\uC9C0\uB9CC \uC911\uBCF5\uB41C \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC9C0 \uC54A\uC740 \uD45C\uAE30\uBC95\uC774 \uC5EC\uB7EC \uAC1C \uC0AC\uC6A9\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ NonDuplicateUnparsedEntity = \uC774\uB984\uC774 ''{0}''\uC774\uC9C0\uB9CC \uC911\uBCF5\uB41C \uAC83\uC73C\uB85C \uD655\uC778\uB418\uC9C0 \uC54A\uC558\uC73C\uBA70 \uAD6C\uBB38\uC774 \uBD84\uC11D\uB418\uC9C0 \uC54A\uC740 \uC5D4\uD2F0\uD2F0\uAC00 \uC5EC\uB7EC \uAC1C \uC0AC\uC6A9\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+ FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+@@ -39,10 +11,10 @@
+ HrefMissing = O atributo 'href' de um elemento 'include' n\u00E3o foi encontrado.
+ RecursiveInclude = Inclus\u00E3o recursiva detectada. O documento ''{0}'' j\u00E1 foi processado.
+ InvalidParseValue = Valor inv\u00E1lido para o atributo ''parse'' no elemento ''include'': ''{0}''.
+-XMLParseError = Erro ao tentar fazer parse do arquivo XML (href=''{0}''). Motivo: {1}
++XMLParseError = Erro ao tentar fazer parse do arquivo XML (href=''{0}''). Motivo: {1}
+ XMLResourceError = Falha na opera\u00E7\u00E3o de inclus\u00E3o; revertendo para fallback. Erro do recurso ao ler o arquivo como XML (href=''{0}''). Motivo: {1}
+ TextResourceError = Falha na opera\u00E7\u00E3o de inclus\u00E3o; revertendo para fallback. Erro do recurso ao ler o arquivo como texto (href=''{0}''). Motivo: {1}
+-NO_XPointerSchema = Por default, o esquema para \"{0}\" n\u00E3o \u00E9 suportado. Defina seu pr\u00F3prio esquema para {0}. Consulte http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = Por padr\u00E3o, o esquema para "{0}" n\u00E3o \u00E9 suportado. Defina seu pr\u00F3prio esquema para {0}. Consulte http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = Nenhum Sub-recurso foi identificado pelo Processador XPointer do Ponteiro {0}.
+ NonDuplicateNotation = Foram usadas v\u00E1rias nota\u00E7\u00F5es que tinham o nome ''{0}'', mas n\u00E3o foram determinadas como duplica\u00E7\u00F5es.
+ NonDuplicateUnparsedEntity = Foram usadas v\u00E1rias entidades que tinham o nome ''{0}'', mas n\u00E3o foram determinadas como duplica\u00E7\u00F5es.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,37 +1,9 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+ FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+
+ # Messages for erroneous input
+-NoFallback = Ett \''include\'' med href \''{0}\'' utf\u00F6rdes inte, hittade inget \u00E5terskapningselement (''fallback'').
++NoFallback = Ett ''include'' med href ''{0}'' utf\u00F6rdes inte, hittade inget \u00E5terskapningselement (''fallback'').
+ MultipleFallbacks = [underordnade] i ett 'include'-element f\u00E5r inte inneh\u00E5lla fler \u00E4n ett 'fallback'-element.
+ FallbackParent = Ett 'fallback'-element hittades utan n\u00E5got 'include' som \u00F6verordnat element.
+ IncludeChild = Element fr\u00E5n namnrymd ''http://www.w3.org/2001/XInclude'', ut\u00F6ver ''fallback'', \u00E4r inte till\u00E5tna som underordnade i ''include''-element. Hittade d\u00E4remot ''{0}''.
+@@ -42,7 +14,7 @@
+ XMLParseError = Fel vid f\u00F6rs\u00F6k att tolka XML-fil (href=''{0}''). Orsak: {1}
+ XMLResourceError = Inkluderings\u00E5tg\u00E4rden utf\u00F6rdes inte, \u00E5terst\u00E4ller genom att \u00E5terskapa. Resursfel vid l\u00E4sning av fil som XML (href=''{0}''). Orsak: {1}
+ TextResourceError = Inkluderings\u00E5tg\u00E4rden utf\u00F6rdes inte, \u00E5terst\u00E4ller genom att \u00E5terskapa. Resursfel vid l\u00E4sning av fil som text (href=''{0}''). Orsak: {1}
+-NO_XPointerSchema = Schema f\u00F6r \"{0}\" st\u00F6ds inte som standard. Definiera ett eget schema f\u00F6r {0}.Se http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = Schema f\u00F6r "{0}" st\u00F6ds inte som standard. Definiera ett eget schema f\u00F6r {0}.Se http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = Ingen Subresource har identifierats av XPointer-processorn f\u00F6r pekare {0}.
+ NonDuplicateNotation = Flera noteringar anv\u00E4nds med namnet ''{0}'', men som inte fastst\u00E4lls som dubbletter.
+ NonDuplicateUnparsedEntity = Flera otolkade enheter anv\u00E4nds med namnet ''{0}'', men som inte fastst\u00E4lls som dubbletter.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+ FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+@@ -39,13 +11,13 @@
+ HrefMissing = \u7F3A\u5C11 'include' \u5143\u7D20\u7684 'href' \u5C5E\u6027\u3002
+ RecursiveInclude = \u68C0\u6D4B\u5230\u9012\u5F52 include\u3002\u5DF2\u5904\u7406\u6587\u6863 ''{0}''\u3002
+ InvalidParseValue = ''include'' \u5143\u7D20\u7684 ''parse'' \u5C5E\u6027\u7684\u503C\u65E0\u6548: ''{0}''\u3002
+-XMLParseError = \u5C1D\u8BD5\u5BF9 XML \u6587\u4EF6 (href=''{0}'') \u8FDB\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u51FA\u9519\u3002\u539F\u56E0: {1}
++XMLParseError = \u5C1D\u8BD5\u89E3\u6790 XML \u6587\u4EF6 (href=''{0}'') \u65F6\u51FA\u9519\u3002\u539F\u56E0: {1}
+ XMLResourceError = Include \u64CD\u4F5C\u5931\u8D25, \u5E76\u8FD8\u539F\u4E3A fallback\u3002\u4EE5 XML (href=''{0}'') \u683C\u5F0F\u8BFB\u53D6\u6587\u4EF6\u65F6\u51FA\u73B0\u8D44\u6E90\u9519\u8BEF\u3002\u539F\u56E0: {1}
+ TextResourceError = Include \u64CD\u4F5C\u5931\u8D25, \u5E76\u8FD8\u539F\u4E3A fallback\u3002\u4EE5\u6587\u672C (href=''{0}'') \u683C\u5F0F\u8BFB\u53D6\u6587\u4EF6\u65F6\u51FA\u73B0\u8D44\u6E90\u9519\u8BEF\u3002\u539F\u56E0: {1}
+-NO_XPointerSchema = \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u4E0D\u652F\u6301 \"{0}\" \u7684\u65B9\u6848\u3002\u8BF7\u4E3A{0}\u5B9A\u4E49\u60A8\u81EA\u5DF1\u7684\u65B9\u6848\u3002\u8BF7\u8BBF\u95EE http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u4E0D\u652F\u6301 "{0}" \u7684\u65B9\u6848\u3002\u8BF7\u4E3A{0}\u5B9A\u4E49\u60A8\u81EA\u5DF1\u7684\u65B9\u6848\u3002\u8BF7\u8BBF\u95EE http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = \u65E0\u6CD5\u901A\u8FC7 XPointer Processor for Pointer {0} \u8BC6\u522B Subresource\u3002
+ NonDuplicateNotation = \u4F7F\u7528\u4E86\u591A\u4E2A\u540D\u4E3A ''{0}'' \u7684\u8BB0\u53F7, \u4F46\u672A\u5C06\u8FD9\u4E9B\u8BB0\u53F7\u786E\u5B9A\u4E3A\u91CD\u590D\u9879\u3002
+-NonDuplicateUnparsedEntity = \u4F7F\u7528\u4E86\u591A\u4E2A\u540D\u4E3A ''{0}'' \u7684\u672A\u8FDB\u884C\u8BED\u6CD5\u5206\u6790\u7684\u5B9E\u4F53, \u4F46\u672A\u5C06\u8FD9\u4E9B\u5B9E\u4F53\u786E\u5B9A\u4E3A\u91CD\u590D\u9879\u3002
++NonDuplicateUnparsedEntity = \u4F7F\u7528\u4E86\u591A\u4E2A\u540D\u4E3A ''{0}'' \u7684\u672A\u89E3\u6790\u5B9E\u4F53, \u4F46\u672A\u5C06\u8FD9\u4E9B\u5B9E\u4F53\u786E\u5B9A\u4E3A\u91CD\u590D\u9879\u3002
+ XpointerMissing = \u7F3A\u5C11 href \u5C5E\u6027\u65F6, \u5FC5\u987B\u5B58\u5728 xpointer \u5C5E\u6027\u3002
+ AcceptMalformed = 'include' \u5143\u7D20\u7684 'accept' \u5C5E\u6027\u7684\u503C\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u8303\u56F4 #x20 \u81F3 #x7E \u4EE5\u5916\u7684\u5B57\u7B26\u3002
+ AcceptLanguageMalformed = 'include' \u5143\u7D20\u7684 'accept-language' \u5C5E\u6027\u7684\u503C\u4E2D\u4E0D\u5141\u8BB8\u4F7F\u7528\u8303\u56F4 #x20 \u81F3 #x7E \u4EE5\u5916\u7684\u5B57\u7B26\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+ FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+@@ -39,20 +11,20 @@
+ HrefMissing = \u907A\u6F0F 'include' \u5143\u7D20\u7684 'href' \u5C6C\u6027\u3002
+ RecursiveInclude = \u5075\u6E2C\u5230\u905E\u8FF4\u5305\u542B\u3002\u5DF2\u7D93\u8655\u7406\u6587\u4EF6 ''{0}''\u3002
+ InvalidParseValue = ''include'' \u5143\u7D20\u4E0A ''parse'' \u5C6C\u6027\u7684\u7121\u6548\u503C: ''{0}''\u3002
+-XMLParseError = \u5617\u8A66\u5256\u6790 XML \u6A94\u6848\u6642\u767C\u751F\u932F\u8AA4 (href=''{0}'')\u3002\u539F\u56E0: {1}
++XMLParseError = \u5617\u8A66\u5256\u6790 XML \u6A94\u6848 (href=''{0}'') \u6642\u767C\u751F\u932F\u8AA4\u3002\u539F\u56E0: {1}
+ XMLResourceError = \u5305\u542B\u4F5C\u696D\u5931\u6557\uFF0C\u56DE\u5FA9\u81F3\u5F8C\u63F4\u3002\u4EE5 XML (href=''{0}'') \u65B9\u5F0F\u8B80\u53D6\u6A94\u6848\u6642\u767C\u751F\u8CC7\u6E90\u932F\u8AA4\u3002\u539F\u56E0: {1}
+ TextResourceError = \u5305\u542B\u4F5C\u696D\u5931\u6557\uFF0C\u56DE\u5FA9\u81F3\u5F8C\u63F4\u3002\u4EE5\u6587\u5B57 (href=''{0}'') \u65B9\u5F0F\u8B80\u53D6\u6A94\u6848\u6642\u767C\u751F\u8CC7\u6E90\u932F\u8AA4\u3002\u539F\u56E0: {1}
+-NO_XPointerSchema = \u9810\u8A2D\u4E0D\u652F\u63F4 \"{0}\" \u7684\u7DB1\u8981\u3002\u8ACB\u70BA {0} \u5B9A\u7FA9\u60A8\u81EA\u5DF1\u7684\u7DB1\u8981\u3002\u8ACB\u53C3\u95B1 http://apache.org/xml/properties/xpointer-schema
++NO_XPointerSchema = \u9810\u8A2D\u4E0D\u652F\u63F4 "{0}" \u7684\u7DB1\u8981\u3002\u8ACB\u70BA {0} \u5B9A\u7FA9\u60A8\u81EA\u5DF1\u7684\u7DB1\u8981\u3002\u8ACB\u53C3\u95B1 http://apache.org/xml/properties/xpointer-schema
+ NO_SubResourceIdentified = XPointer \u8655\u7406\u5668\u672A\u80FD\u70BA\u6307\u6A19 {0} \u8B58\u5225\u4EFB\u4F55\u5B50\u8CC7\u6E90\u3002
+ NonDuplicateNotation = \u4F7F\u7528\u540D\u7A31\u70BA ''{0}'' \u7684\u591A\u500B\u8868\u793A\u6CD5\uFF0C\u4F46\u662F\u672A\u80FD\u5224\u65B7\u9019\u4E9B\u8868\u793A\u6CD5\u91CD\u8907\u3002
+-NonDuplicateUnparsedEntity = \u4F7F\u7528\u540D\u7A31\u70BA ''{0}'' \u7684\u591A\u500B\u672A\u5256\u6790\u500B\u9AD4\uFF0C\u4F46\u662F\u672A\u80FD\u5224\u65B7\u9019\u4E9B\u500B\u9AD4\u91CD\u8907\u3002
++NonDuplicateUnparsedEntity = \u4F7F\u7528\u540D\u7A31\u70BA ''{0}'' \u7684\u591A\u500B\u672A\u5256\u6790\u5BE6\u9AD4\uFF0C\u4F46\u662F\u672A\u80FD\u5224\u65B7\u9019\u4E9B\u5BE6\u9AD4\u91CD\u8907\u3002
+ XpointerMissing = \u6C92\u6709 href \u5C6C\u6027\u6642\uFF0C\u5FC5\u9808\u6709 xpointer \u5C6C\u6027\u3002
+ AcceptMalformed = 'include' \u5143\u7D20\u7684 'accept' \u5C6C\u6027\u503C\u4E2D\uFF0C\u4E0D\u5141\u8A31\u7BC4\u570D #x20 \u81F3 #x7E \u4E4B\u5916\u7684\u5B57\u5143\u3002
+ AcceptLanguageMalformed = 'include' \u5143\u7D20\u7684 'accept-language' \u5C6C\u6027\u503C\u4E2D\uFF0C\u4E0D\u5141\u8A31\u7BC4\u570D #x20 \u81F3 #x7E \u4E4B\u5916\u7684\u5B57\u5143\u3002
+ RootElementRequired = \u683C\u5F0F\u6B63\u78BA\u7684\u6587\u4EF6\u9700\u8981\u6839\u5143\u7D20\u3002
+ MultipleRootElements = \u683C\u5F0F\u6B63\u78BA\u7684\u6587\u4EF6\u4E0D\u53EF\u5305\u542B\u591A\u500B\u6839\u5143\u7D20\u3002
+ ContentIllegalAtTopLevel = \u53D6\u4EE3 'include' \u5143\u7D20\u4F5C\u70BA\u6700\u4E0A\u5C64\u4F86\u6E90 infoset \u7684\u6587\u4EF6\u5143\u7D20\u4E0D\u80FD\u5305\u542B\u5B57\u5143\u3002
+-UnexpandedEntityReferenceIllegal = \u53D6\u4EE3 'include' \u5143\u7D20\u4F5C\u70BA\u6700\u4E0A\u5C64\u4F86\u6E90 infoset \u7684\u6587\u4EF6\u5143\u7D20\u4E0D\u80FD\u5305\u542B\u672A\u5C55\u958B\u7684\u500B\u9AD4\u53C3\u7167\u3002
++UnexpandedEntityReferenceIllegal = \u53D6\u4EE3 'include' \u5143\u7D20\u4F5C\u70BA\u6700\u4E0A\u5C64\u4F86\u6E90 infoset \u7684\u6587\u4EF6\u5143\u7D20\u4E0D\u80FD\u5305\u542B\u672A\u5C55\u958B\u7684\u5BE6\u9AD4\u53C3\u7167\u3002
+ HrefFragmentIdentifierIllegal = \u4E0D\u53EF\u4F7F\u7528\u7247\u6BB5 ID\u3002\u4E0D\u5141\u8A31 ''href'' \u5C6C\u6027\u503C ''{0}''\u3002
+ HrefSyntacticallyInvalid = ''href'' \u5C6C\u6027\u503C ''{0}'' \u53E5\u6CD5\u7121\u6548\u3002\u5957\u7528\u9041\u96E2\u898F\u5247\u4E4B\u5F8C\uFF0C\u503C\u70BA\u53E5\u6CD5\u6B63\u78BA\u7684 URI \u6216 IRI\u3002
+ XPointerStreamability = \u6307\u5B9A xpointer \u6307\u5411\u4F86\u6E90 infoset \u4E2D\u7684\u4F4D\u7F6E\u3002\u7531\u65BC\u8655\u7406\u5668\u4E32\u6D41\u7279\u6027\uFF0C\u56E0\u6B64\u7121\u6CD5\u5B58\u53D6\u6B64\u4F4D\u7F6E\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+ FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = Identity Constraint-Fehler (cvc-identity-constraint.4.2.1): Element \"{0}\" hat einen Schl\u00FCssel ohne Wert.
+- DuplicateField = Doppelte \u00DCbereinstimmung in Geltungsbereich f\u00FCr Feld \"{0}\".
+- DuplicateKey = Doppelter Schl\u00FCsselwert [{0}] f\u00FCr Identity Constraint des Elements \"{1}\" deklariert.
+- DuplicateUnique = Doppelter eindeutiger Wert [{0}] f\u00FCr Identity Constraint des Elements \"{1}\" deklariert.
+- FieldMultipleMatch = Identity Constraint-Fehler: Feld \"{0}\" entspricht mehreren Werten im Geltungsbereich seines Selectors. Felder m\u00FCssen eindeutigen Werten entsprechen.
+- FixedDiffersFromActual = Content dieses Elements entspricht nicht dem Wert des \"fixed\"-Attributs in der Elementdeklaration im Schema.
+- KeyMatchesNillable = Identity Constraint-Fehler (cvc-identity-constraint.4.2.3): Element \"{0}\" hat einen Schl\u00FCssel, der einem Element entspricht, bei dem "nillable" auf "true" gesetzt wurde.
+- KeyNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <key name=\"{1}\"> Identity Constraint f\u00FCr Element \"{0}\".
++ AbsentKeyValue = Identity Constraint-Fehler (cvc-identity-constraint.4.2.1): Element "{0}" hat einen Schl\u00FCssel ohne Wert.
++ DuplicateField = Doppelte \u00DCbereinstimmung in Geltungsbereich f\u00FCr Feld "{0}".
++ DuplicateKey = Doppelter Schl\u00FCsselwert [{0}] f\u00FCr Identity Constraint des Elements "{1}" deklariert.
++ DuplicateUnique = Doppelter eindeutiger Wert [{0}] f\u00FCr Identity Constraint des Elements "{1}" deklariert.
++ FieldMultipleMatch = Identity Constraint-Fehler: Feld "{0}" entspricht mehreren Werten im Geltungsbereich seines Selectors. Felder m\u00FCssen eindeutigen Werten entsprechen.
++ FixedDiffersFromActual = Content dieses Elements entspricht nicht dem Wert des "fixed"-Attributs in der Elementdeklaration im Schema.
++ KeyMatchesNillable = Identity Constraint-Fehler (cvc-identity-constraint.4.2.3): Element "{0}" hat einen Schl\u00FCssel, der einem Element entspricht, bei dem "nillable" auf "true" gesetzt wurde.
++ KeyNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <key name="{1}"> Identity Constraint f\u00FCr Element "{0}".
+ KeyNotFound = Schl\u00FCssel "{0}" mit Wert "{1}" nicht gefunden f\u00FCr Identity Constraint des Elements "{2}".
+- KeyRefNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <keyref name=\"{1}\"> Identity Constraint f\u00FCr Element \"{0}\".
+- KeyRefOutOfScope = Identity Constraint-Fehler: Identity Constraint \"{0}\" hat eine keyref, die zu einem Key- oder Unique-Constraint au\u00DFerhalb des Geltungsbereichs verweist.
+- KeyRefReferNotFound = Schl\u00FCsselreferenzdeklaration \"{0}\" verweist auf einen unbekannten Schl\u00FCssel mit dem Namen \"{1}\".
+- UniqueNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <unique> Identity Constraint f\u00FCr Element \"{0}\".
+- UnknownField = Interner Identity Constraint-Fehler. Unbekanntes Feld \"{0}\".
++ KeyRefNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <keyref name="{1}"> Identity Constraint f\u00FCr Element "{0}".
++ KeyRefOutOfScope = Identity Constraint-Fehler: Identity Constraint "{0}" hat eine keyref, die zu einem Key- oder Unique-Constraint au\u00DFerhalb des Geltungsbereichs verweist.
++ KeyRefReferNotFound = Schl\u00FCsselreferenzdeklaration "{0}" verweist auf einen unbekannten Schl\u00FCssel mit dem Namen "{1}".
++ UniqueNotEnoughValues = Nicht gen\u00FCgend Werte angegeben f\u00FCr <unique> Identity Constraint f\u00FCr Element "{0}".
++ UnknownField = Interner Identity Constraint-Fehler. Unbekanntes Feld "{0}".
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: Schemadokument "{0}" konnte nicht gelesen werden, weil der "{1}"-Zugriff wegen der von der Eigenschaft accessExternalSchema festgelegten Einschr\u00E4nkung nicht zul\u00E4ssig ist.
+ schema_reference.4 = schema_reference.4: Schemadokument "{0}" konnte nicht gelesen werden, da 1) das Dokument nicht gefunden werden konnte; 2) das Dokument nicht gelesen werden konnte; 3) das Root-Element des Dokuments nicht <xsd:schema> ist.
+ src-annotation = src-annotation: <annotation>-Elemente k\u00F6nnen nur <appinfo>- und <documentation>-Elemente enthalten, aber es wurde "{0}" gefunden.
+ src-attribute.1 = src-attribute.1: Die Eigenschaften "default" und "fixed" k\u00F6nnen nicht beide in der Attributdeklaration "{0}" vorhanden sein. Verwenden Sie nur eine dieser Eigenschaften.
+@@ -181,7 +153,7 @@
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: Der Contenttyp eines abgeleiteten Typs und der seiner Basis m\u00FCssen beide "mixed" oder "element-only" sein. Typ "{0}" ist "mixed", aber sein Basistyp nicht.
+ cos-element-consistent = cos-element-consistent: Fehler bei Typ "{0}". Mehrere Elemente mit Namen "{1}" und unterschiedlichen Typen kommen in der Modellgruppe vor.
+ cos-list-of-atomic = cos-list-of-atomic: In der Definition von Listentyp "{0}" ist Typ "{1}" ein ung\u00FCltiger Listenelementtyp, da er nicht atomar ist ("{1}" ist entweder ein Listentyp oder ein Vereinigungsmengentyp, der eine Liste enth\u00E4lt).
+- cos-nonambig = cos-nonambig: {0} und {1} (oder Elemente aus ihrer Substitutionsgruppe) verletzen \"Unique Particle Attribution\". Bei der Validierung f\u00FCr dieses Schema w\u00FCrde eine Mehrdeutigkeit f\u00FCr diese beiden Partikel erstellt.
++ cos-nonambig = cos-nonambig: {0} und {1} (oder Elemente aus ihrer Substitutionsgruppe) verletzen "Unique Particle Attribution". Bei der Validierung f\u00FCr dieses Schema w\u00FCrde eine Mehrdeutigkeit f\u00FCr diese beiden Partikel erstellt.
+ cos-particle-restrict.a = cos-particle-restrict.a: Abgeleitetes Partikel ist leer, und die Basis kann nicht geleert werden.
+ cos-particle-restrict.b = cos-particle-restrict.b: Basispartikel ist leer, aber das abgeleitete Partikel ist nicht leer.
+ cos-particle-restrict.2 = cos-particle-restrict.2: Unzul\u00E4ssige Partikeleinschr\u00E4nkung: "{0}".
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ BadMessageKey = No se ha encontrado el mensaje de error correspondiente a la clave de mensaje.
+ FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = Error de restricci\u00F3n de identidad (cvc-identity-constraint.4.2.1): el elemento \"{0}\" tiene una clave sin valor.
+- DuplicateField = Coincidencia duplicada en \u00E1mbito del campo \"{0}\".
+- DuplicateKey = Valor de clave duplicado [{0}] declarado para la restricci\u00F3n de identidad del elemento \"{1}\".
+- DuplicateUnique = Valor \u00FAnico duplicado [{0}] declarado para la restricci\u00F3n de identidad del elemento \"{1}\".
+- FieldMultipleMatch = Error de restricci\u00F3n de identidad: el campo \"{0}\" coincide con m\u00E1s de un valor en el \u00E1mbito de su selector; los campos deben coincidir con valores \u00FAnicos.
+- FixedDiffersFromActual = El contenido de este elemento no es equivalente al valor del atributo \"fixed\" en la declaraci\u00F3n del elemento del esquema.
+- KeyMatchesNillable = Error de restricci\u00F3n de identidad (cvc-identity-constraint.4.2.3): el elemento \"{0}\" tiene una clave que coincide con un elemento cuyo valor de Permite Nill est\u00E1 definido en true.
+- KeyNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <key name=\"{1}\"> especificada para el elemento \"{0}\".
++ AbsentKeyValue = Error de restricci\u00F3n de identidad (cvc-identity-constraint.4.2.1): el elemento "{0}" tiene una clave sin valor.
++ DuplicateField = Coincidencia duplicada en \u00E1mbito del campo "{0}".
++ DuplicateKey = Valor de clave duplicado [{0}] declarado para la restricci\u00F3n de identidad del elemento "{1}".
++ DuplicateUnique = Valor \u00FAnico duplicado [{0}] declarado para la restricci\u00F3n de identidad del elemento "{1}".
++ FieldMultipleMatch = Error de restricci\u00F3n de identidad: el campo "{0}" coincide con m\u00E1s de un valor en el \u00E1mbito de su selector; los campos deben coincidir con valores \u00FAnicos.
++ FixedDiffersFromActual = El contenido de este elemento no es equivalente al valor del atributo "fixed" en la declaraci\u00F3n del elemento del esquema.
++ KeyMatchesNillable = Error de restricci\u00F3n de identidad (cvc-identity-constraint.4.2.3): el elemento "{0}" tiene una clave que coincide con un elemento cuyo valor de Permite Nill est\u00E1 definido en true.
++ KeyNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <key name="{1}"> especificada para el elemento "{0}".
+ KeyNotFound = No se ha encontrado la clave ''{0}'' con el valor ''{1}'' para la restricci\u00F3n de identidad del elemento ''{2}''.
+- KeyRefNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <keyref name=\"{1}\"> especificada para el elemento \"{0}\".
+- KeyRefOutOfScope = Error de restricci\u00F3n de identidad: la restricci\u00F3n de identidad \"{0}\" tiene una referencia de clave que hace referencia a una clave o elemento \u00FAnico que se encuentra fuera de \u00E1mbito.
+- KeyRefReferNotFound = La declaraci\u00F3n de referencia de clave \"{0}\" hace referencia a una clave desconocida con el nombre \"{1}\".
+- UniqueNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <unique> especificada para el elemento \"{0}\".
+- UnknownField = Error de restricci\u00F3n de identidad interno; campo desconocido \"{0}\".
++ KeyRefNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <keyref name="{1}"> especificada para el elemento "{0}".
++ KeyRefOutOfScope = Error de restricci\u00F3n de identidad: la restricci\u00F3n de identidad "{0}" tiene una referencia de clave que hace referencia a una clave o elemento \u00FAnico que se encuentra fuera de \u00E1mbito.
++ KeyRefReferNotFound = La declaraci\u00F3n de referencia de clave "{0}" hace referencia a una clave desconocida con el nombre "{1}".
++ UniqueNotEnoughValues = No se han especificado suficientes valores para la restricci\u00F3n de identidad <unique> especificada para el elemento "{0}".
++ UnknownField = Error de restricci\u00F3n de identidad interno; campo desconocido "{0}".
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: El valor ''{2}'' del atributo ''{1}'' del elemento ''{0}'' no es v\u00E1lido con respecto a su tipo, ''{3}''.
+- cvc-attribute.4 = cvc-attribute.4: El valor ''{2}'' del atributo ''{1}'' del elemento ''{0}'' no es v\u00E1lido con respecto a su ''{''value constraint''}'' fija. El atributo debe tener un valor de ''{3}''.
++ cvc-attribute.4 = cvc-attribute.4: El valor ''{2}'' del atributo ''{1}'' del elemento ''{0}'' no es v\u00E1lido con respecto a su '{'value constraint'}' fija. El atributo debe tener un valor de ''{3}''.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: El elemento ''{0}'' no debe tener ning\u00FAn car\u00E1cter ni ning\u00FAn elemento de informaci\u00F3n de elemento [secundarios], porque el tipo de contenido de tipo est\u00E1 vac\u00EDo.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: El elemento ''{0}'' no debe tener ning\u00FAn elemento [secundarios] y el valor debe ser v\u00E1lido.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: El elemento ''{0}'' no debe tener ning\u00FAn car\u00E1cter [secundarios], porque el tipo de contenido del tipo es s\u00F3lo de elemento.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: No est\u00E1 permitido que el atributo ''{1}'' aparezca en el elemento ''{0}''.
+ cvc-complex-type.4 = cvc-complex-type.4: El atributo ''{1}'' debe aparecer en el elemento ''{0}''.
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: En el elemento ''{0}'', el atributo ''{1}'' es un identificador de comod\u00EDn, pero ya existe un identificador de comod\u00EDn ''{2}''. S\u00F3lo puede existir uno.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: En el elemento ''{0}'', el atributo ''{1}'' es un identificador de comod\u00EDn, pero ya existe un atributo ''{2}'' derivado del identificador entre los ''{''attribute uses''}''.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: En el elemento ''{0}'', el atributo ''{1}'' es un identificador de comod\u00EDn, pero ya existe un atributo ''{2}'' derivado del identificador entre los '{'attribute uses'}'.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' no es un valor v\u00E1lido para ''{1}''.
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' no es un valor v\u00E1lido de tipo de lista ''{1}''.
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' no es un valor v\u00E1lido de tipo de uni\u00F3n ''{1}''.
+ cvc-elt.1 = cvc-elt.1: No se ha encontrado la declaraci\u00F3n del elemento ''{0}''.
+- cvc-elt.2 = cvc-elt.2: El valor de ''{''abstract''}'' en la declaraci\u00F3n de elemento para ''{0}'' debe ser false.
+- cvc-elt.3.1 = cvc-elt.3.1: El atributo ''{1}'' no debe aparecer en el elemento ''{0}'', porque la propiedad ''{''nillable''}'' de ''{0}'' tiene el valor false.
++ cvc-elt.2 = cvc-elt.2: El valor de '{'abstract'}' en la declaraci\u00F3n de elemento para ''{0}'' debe ser false.
++ cvc-elt.3.1 = cvc-elt.3.1: El atributo ''{1}'' no debe aparecer en el elemento ''{0}'', porque la propiedad '{'nillable'}' de ''{0}'' tiene el valor false.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: El elemento ''{0}'' no debe tener ning\u00FAn car\u00E1cter ni informaci\u00F3n de elemento [secundarios], porque se ha especificado ''{1}''.
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: No debe haber ning\u00FAn valor fijo de ''{''value constraint''}'' para el elemento ''{0}'', porque se ha especificado ''{1}''.
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: No debe haber ning\u00FAn valor fijo de '{'value constraint'}' para el elemento ''{0}'', porque se ha especificado ''{1}''.
+ cvc-elt.4.1 = cvc-elt.4.1: El valor ''{2}'' del atributo ''{1}'' del elemento ''{0}'' no es un QName v\u00E1lido.
+ cvc-elt.4.2 = cvc-elt.4.2: No se puede resolver ''{1}'' en una definici\u00F3n de tipo para el elemento ''{0}''.
+ cvc-elt.4.3 = cvc-elt.4.3: El tipo ''{1}'' no se ha derivado de forma v\u00E1lida de la definici\u00F3n de tipo ''{2}'' del elemento ''{0}''.
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: ''{''value constraint''}'' ''{2}'' del elemento ''{0}'' no es un valor por defecto v\u00E1lido para el tipo ''{1}''.
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: '{'value constraint'}' ''{2}'' del elemento ''{0}'' no es un valor por defecto v\u00E1lido para el tipo ''{1}''.
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: El elemento ''{0}'' no debe tener ning\u00FAn elemento de informaci\u00F3n de elemento [secundarios].
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: El valor ''{1}'' del elemento ''{0}'' no coincide con el valor de ''{''value constraint''}'' fijo ''{2}''.
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: El valor ''{1}'' del elemento ''{0}'' no coincide con el valor de ''{''value constraint''}'' ''{2}''.
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: El valor ''{1}'' del elemento ''{0}'' no coincide con el valor de '{'value constraint'}' fijo ''{2}''.
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: El valor ''{1}'' del elemento ''{0}'' no coincide con el valor de '{'value constraint'}' ''{2}''.
+ cvc-enumeration-valid = cvc-enumeration-valid: El valor ''{0}'' no es de faceta v\u00E1lida con respecto a la enumeraci\u00F3n ''{1}''. Debe ser un valor de la enumeraci\u00F3n.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: El valor ''{0}'' tiene {1} d\u00EDgitos fraccionarios, pero el n\u00FAmero de d\u00EDgitos fraccionarios se ha limitado a {2}.
+ cvc-id.1 = cvc-id.1: No hay ning\u00FAn enlace de identificador/IDREF para IDREF ''{0}''.
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: fallo al leer el documento de esquema ''{0}'' porque no se permite el acceso ''{1}'' debido a una restricci\u00F3n definida por la propiedad accessExternalSchema.
+ schema_reference.4 = schema_reference.4: Fallo al leer el documento de esquema ''{0}'', porque 1) no se ha encontrado el documento; 2) no se ha podido leer el documento; 3) el elemento ra\u00EDz del documento no es <xsd:schema>.
+ src-annotation = src-annotation: Los elementos de <annotation> s\u00F3lo pueden contener elementos de <appinfo> y <documentation>, pero se ha encontrado ''{0}''.
+ src-attribute.1 = src-attribute.1: Las propiedades ''default'' y ''fixed'' no pueden estar presentes de forma simult\u00E1nea en la declaraci\u00F3n de atributo ''{0}''. Utilice s\u00F3lo una de ellas.
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: Error en el grupo de atributos ''{0}''. Se han especificado usos de atributo duplicados con el mismo nombre y espacio de nombres de destino. El nombre del uso de atributo duplicado es ''{1}''.
+ ag-props-correct.3 = ag-props-correct.3: Error en el grupo de atributos ''{0}''. Dos declaraciones de atributo, ''{1}'' y ''{2}'', tienen tipos que se derivan del identificador.
+ a-props-correct.2 = a-props-correct.2: Valor de restricci\u00F3n de valor ''{1}'' no v\u00E1lido en el atributo ''{0}''.
+- a-props-correct.3 = a-props-correct.3: El atributo ''{0}'' no puede utilizar ''fixed'' ni ''default'', porque el valor de ''{''type definition''}'' del atributo es el identificador o se deriva del identificador.
+- au-props-correct.2 = au-props-correct.2: En la declaraci\u00F3n de atributo de ''{0}'', se ha especificado un valor fijo de ''{1}''. Por lo tanto, si el uso del atributo que hace referencia a ''{0}'' tambi\u00E9n tiene un valor de ''{''value constraint''}'', debe fijarse y el valor debe ser ''{1}''.
++ a-props-correct.3 = a-props-correct.3: El atributo ''{0}'' no puede utilizar ''fixed'' ni ''default'', porque el valor de '{'type definition'}' del atributo es el identificador o se deriva del identificador.
++ au-props-correct.2 = au-props-correct.2: En la declaraci\u00F3n de atributo de ''{0}'', se ha especificado un valor fijo de ''{1}''. Por lo tanto, si el uso del atributo que hace referencia a ''{0}'' tambi\u00E9n tiene un valor de '{'value constraint'}', debe fijarse y el valor debe ser ''{1}''.
+ cos-all-limited.1.2 = cos-all-limited.1.2:Debe aparecer un grupo de modelos 'all' en una part\u00EDcula con '{'min occurs'}' = '{'max occurs'}' = 1 y dicha part\u00EDcula debe formar parte de un par que constituya el valor de '{'content type'}' de una definici\u00F3n de tipo complejo.
+- cos-all-limited.2 = cos-all-limited.2: El valor de ''{''max occurs''}'' de un elemento de un grupo de modelos ''all'' debe ser 0 o 1. El valor ''{0}'' del elemento ''{1}'' no es v\u00E1lido.
++ cos-all-limited.2 = cos-all-limited.2: El valor de '{'max occurs'}' de un elemento de un grupo de modelos ''all'' debe ser 0 o 1. El valor ''{0}'' del elemento ''{1}'' no es v\u00E1lido.
+ cos-applicable-facets = cos-applicable-facets: El tipo {1} no permite la faceta ''{0}''.
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: El tipo ''{0}'' se ha derivado por extensi\u00F3n del tipo ''{1}''. Sin embargo, el atributo ''final'' de ''{1}'' proh\u00EDbe la derivaci\u00F3n por extensi\u00F3n.
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: El tipo de contenido de un tipo derivado y el de su base deben ser mixtos o ser ambos s\u00F3lo de elemento. El tipo ''{0}'' es de s\u00F3lo elemento, pero su tipo base no lo es.
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: El tipo de contenido de un tipo derivado y el de su base deben ser mixtos o ser ambos s\u00F3lo de elemento. El tipo ''{0}'' es mixto, pero su tipo base no lo es.
+ cos-element-consistent = cos-element-consistent: Error para el tipo ''{0}''. Aparecen en el grupo de modelos varios elementos con el nombre ''{1}'' y con tipos diferentes.
+ cos-list-of-atomic = cos-list-of-atomic: En la definici\u00F3n de tipo de lista ''{0}'', el tipo ''{1}'' es un tipo de elemento de lista no v\u00E1lido porque no es at\u00F3mico (''{1}'' es un tipo de lista o un tipo de uni\u00F3n que contiene una lista).
+- cos-nonambig = cos-nonambig: {0} y {1} (o los elementos de su grupo de sustituci\u00F3n) violan la \"atribuci\u00F3n de part\u00EDcula \u00FAnica\". Durante la validaci\u00F3n a partir de este esquema, se crear\u00E1 ambig\u00FCedad para estas dos part\u00EDculas.
++ cos-nonambig = cos-nonambig: {0} y {1} (o los elementos de su grupo de sustituci\u00F3n) violan la "atribuci\u00F3n de part\u00EDcula \u00FAnica". Durante la validaci\u00F3n a partir de este esquema, se crear\u00E1 ambig\u00FCedad para estas dos part\u00EDculas.
+ cos-particle-restrict.a = cos-particle-restrict.a: La part\u00EDcula derivada est\u00E1 vac\u00EDa y la base no se puede vaciar.
+ cos-particle-restrict.b = cos-particle-restrict.b: La part\u00EDcula base est\u00E1 vac\u00EDa, pero la part\u00EDcula derivada no.
+ cos-particle-restrict.2 = cos-particle-restrict.2: Restricci\u00F3n de part\u00EDcula prohibida: ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: El tipo ''{1}'' es at\u00F3mico, por lo que su ''{''base type definition''}'', ''{0}'', debe ser una definici\u00F3n de tipo simple at\u00F3mico o un tipo de dato primitivo incorporado.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: El tipo ''{1}'' es at\u00F3mico, por lo que su '{'base type definition'}', ''{0}'', debe ser una definici\u00F3n de tipo simple at\u00F3mico o un tipo de dato primitivo incorporado.
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: En la definici\u00F3n de tipo de lista ''{0}'', el tipo ''{1}'' es un tipo de elemento no v\u00E1lido porque es un tipo de lista o un tipo de uni\u00F3n que contiene una lista.
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: El componente ''{''final''}'' de ''{''item type definition''}'', ''{0}'', contiene ''list''. Significa que ''{0}'' no se puede utilizar como un tipo de elemento para el tipo de lista ''{1}''.
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: El componente ''{''final''}'' de ''{''member type definitions''}'', ''{0}'', contiene ''union''. Significa que ''{0}'' no se puede utilizar como un tipo de miembro para el tipo de uni\u00F3n ''{1}''.
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: El componente '{'final'}' de '{'item type definition'}', ''{0}'', contiene ''list''. Significa que ''{0}'' no se puede utilizar como un tipo de elemento para el tipo de lista ''{1}''.
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: El componente '{'final'}' de '{'member type definitions'}', ''{0}'', contiene ''union''. Significa que ''{0}'' no se puede utilizar como un tipo de miembro para el tipo de uni\u00F3n ''{1}''.
+ cos-valid-default.2.1 = cos-valid-default.2.1: El elemento ''{0}'' contiene una restricci\u00F3n de valor y debe tener un modelo de contenido mixto o simple.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: Como el elemento ''{0}'' tiene una ''{''value constraint''}'' y su definici\u00F3n de tipo tiene un ''{''content type''}'' mixto, la part\u00EDcula de ''{''content type''}'' debe poder vaciarse.
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: Como el elemento ''{0}'' tiene una '{'value constraint'}' y su definici\u00F3n de tipo tiene un '{'content type'}' mixto, la part\u00EDcula de '{'content type'}' debe poder vaciarse.
+ c-props-correct.2 = c-props-correct.2: La cardinalidad de los campos de la referencia de clave ''{0}'' y la clave ''{1}'' deben coincidir.
+ ct-props-correct.3 = ct-props-correct.3: Se han detectado definiciones circulares para el tipo complejo ''{0}''. Significa que ''{0}'' est\u00E1 contenido en su propia jerarqu\u00EDa de tipos, lo que es un error.
+ ct-props-correct.4 = ct-props-correct.4: Error para el tipo ''{0}''. Se han especificado usos de atributo duplicados con el mismo nombre y espacio de nombres de destino. El nombre del uso de atributo duplicado es ''{1}''.
+ ct-props-correct.5 = ct-props-correct.5: Error para el tipo ''{0}''. Dos declaraciones de atributo, ''{1}'' y ''{2}'','' tienen tipos que se derivan del identificador.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: El tipo ''{0}'' se ha derivado por restricci\u00F3n del tipo ''{1}''. Sin embargo, ''{1}'' tiene una propiedad ''{''final''}'' que proh\u00EDbe la derivaci\u00F3n por restricci\u00F3n.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: El tipo ''{0}'' se ha derivado por restricci\u00F3n del tipo ''{1}''. Sin embargo, ''{1}'' tiene una propiedad '{'final'}' que proh\u00EDbe la derivaci\u00F3n por restricci\u00F3n.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: Error para el tipo ''{0}''. El uso de atributo ''{1}'' en este tipo tiene un valor ''use'' de ''{2}'', que es incoherente con el valor de ''required'' en un uso de atributo coincidente del tipo base.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: Error para el tipo ''{0}''. El uso de atributo ''{1}'' en este tipo tiene el tipo ''{2}'', que no se ha derivado de forma v\u00E1lida de ''{3}'', el tipo de uso de atributo coincidente del tipo base.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: Error para el tipo ''{0}''. El uso de atributo ''{1}'' en este tipo tiene una restricci\u00F3n de valor efectivo que no es fija y la restricci\u00F3n de valor efectivo del uso de atributo coincidente en el tipo base es fija.
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: El tipo NOTATION ''{0}'', utilizado por {2} ''{1}'', debe tener un valor de faceta de enumeraci\u00F3n que especifique los elementos de notaci\u00F3n que utiliza este tipo.
+ enumeration-valid-restriction = enumeration-valid-restriction: El valor de enumeraci\u00F3n ''{0}'' no se encuentra en el espacio reservado para el valor del tipo base, {1}.
+ e-props-correct.2 = e-props-correct.2: Valor de restricci\u00F3n de valor ''{1}'' no v\u00E1lido en el elemento ''{0}''.
+- e-props-correct.4 = e-props-correct.4: El valor de ''{''type definition''}'' del elemento ''{0}'' no se ha derivado de forma v\u00E1lida del valor de ''{''type definition''}'' de substitutionHead ''{1}'' o la propiedad ''{''substitution group exclusions''}'' de ''{1}'' no permite esta derivaci\u00F3n.
+- e-props-correct.5 = e-props-correct.5: Un valor de ''{''value constraint''}'' no debe estar presente en el elemento ''{0}'', porque la ''{''type definition''}'' del elemento o el ''{''content type''}'' de ''{''type definition''}'' es un identificador o se deriva del identificador.
++ e-props-correct.4 = e-props-correct.4: El valor de '{'type definition'}' del elemento ''{0}'' no se ha derivado de forma v\u00E1lida del valor de '{'type definition'}' de substitutionHead ''{1}'' o la propiedad '{'substitution group exclusions'}' de ''{1}'' no permite esta derivaci\u00F3n.
++ e-props-correct.5 = e-props-correct.5: Un valor de '{'value constraint'}' no debe estar presente en el elemento ''{0}'', porque la '{'type definition'}' del elemento o el '{'content type'}' de '{'type definition'}' es un identificador o se deriva del identificador.
+ e-props-correct.6 = e-props-correct.6: Se ha detectado un grupo de sustituci\u00F3n circular para el elemento ''{0}''.
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: En la definici\u00F3n de {2}, el valor ''{0}'' para la faceta ''fractionDigits'' no es v\u00E1lido porque debe ser menor o igual que el valor de ''fractionDigits'' que se ha definido en ''{1}'' en uno de los tipos de ascendientes.
+ fractionDigits-totalDigits = fractionDigits-totalDigits: En la definici\u00F3n de {2}, el valor ''{0}'' para la faceta ''fractionDigits'' no es v\u00E1lido porque debe ser menor o igual que el valor de ''totalDigits'', que es ''{1}''.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: Error para el tipo ''{2}''. El valor de maxInclusive =''{0}'' debe ser mayor o igual que el valor de minInclusive del tipo base ''{1}''.
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: Error para el tipo ''{2}''. El valor de maxInclusive =''{0}'' debe ser mayor que el valor de minExclusive del tipo base ''{1}''.
+ maxLength-valid-restriction = maxLength-valid-restriction: En la definici\u00F3n de {2}, el valor de maxLength = ''{0}'' debe ser menor o igual que el del tipo base ''{1}''.
+- mg-props-correct.2 = mg-props-correct.2: Se han detectado definiciones circulares para el grupo ''{0}''. El seguimiento recurrente de los valores ''{''term''}'' de las part\u00EDculas provoca una part\u00EDcula cuyo valor de ''{''term''}'' es el mismo grupo.
++ mg-props-correct.2 = mg-props-correct.2: Se han detectado definiciones circulares para el grupo ''{0}''. El seguimiento recurrente de los valores '{'term'}' de las part\u00EDculas provoca una part\u00EDcula cuyo valor de '{'term'}' es el mismo grupo.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: En la definici\u00F3n de {2}, el valor de minExclusive = ''{0}'' debe ser menor o igual que el valor de maxExclusive = ''{1}''.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: En la definici\u00F3n de {2}, el valor de minExclusive = ''{0}''debe ser menor que el valor de maxInclusive = ''{1}''.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: Error para el tipo ''{2}''. El valor de minExclusive =''{0}'' debe ser mayor o igual que el valor de minExclusive del tipo base ''{1}''.
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: En la definici\u00F3n de {2}, el valor de minLength = ''{0}'' debe ser menor que el valor de maxLength = ''{1}''.
+ minLength-valid-restriction = minLength-valid-restriction: En la definici\u00F3n de {2}, el valor de minLength = ''{0}'' debe ser mayor o igual que el del tipo base, ''{1}''.
+ no-xmlns = no-xmlns: El valor de {name} de una declaraci\u00F3n de atributo no debe coincidir con 'xmlns'.
+- no-xsi = no-xsi: El valor de ''{''target namespace''}'' de una declaraci\u00F3n de atributo no debe coincidir con ''{0}''.
++ no-xsi = no-xsi: El valor de '{'target namespace'}' de una declaraci\u00F3n de atributo no debe coincidir con ''{0}''.
+ p-props-correct.2.1 = p-props-correct.2.1: En la declaraci\u00F3n de ''{0}'', el valor de ''minOccurs'' es ''{1}'', pero no debe ser superior al valor de ''maxOccurs'', que es ''{2}''.
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: No existe ninguna asignaci\u00F3n funcional completa entre las part\u00EDculas.
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: El rango de incidencia del grupo, ({0},{1}), no es una restricci\u00F3n v\u00E1lida del rango de incidencia del grupo base, ({2},{3}).
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: Los elementos tienen nombres y espacios de nombres de destino distintos: El elemento''{0}'' en el espacio de nombres ''{1}'' y el elemento ''{2}'' en el espacio de nombres ''{3}''.
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: Error para la part\u00EDcula cuyo valor de ''{''term''}'' es la declaraci\u00F3n de elemento ''{0}''. El valor de ''{''nillable''}'' de la declaraci\u00F3n de elemento es true, pero la part\u00EDcula correspondiente en el tipo base tiene una declaraci\u00F3n de elemento cuyo valor de ''{''nillable''}'' es false.
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: Error para la part\u00EDcula cuyo valor de ''{''term''}'' es la declaraci\u00F3n de elemento ''{0}''. Su rango de incidencia, ({1},{2}), no es una restricci\u00F3n v\u00E1lida del rango, ({3},{4}, de la part\u00EDcula correspondiente en el tipo base.
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: Error para la part\u00EDcula cuyo valor de '{'term'}' es la declaraci\u00F3n de elemento ''{0}''. El valor de '{'nillable'}' de la declaraci\u00F3n de elemento es true, pero la part\u00EDcula correspondiente en el tipo base tiene una declaraci\u00F3n de elemento cuyo valor de '{'nillable'}' es false.
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: Error para la part\u00EDcula cuyo valor de '{'term'}' es la declaraci\u00F3n de elemento ''{0}''. Su rango de incidencia, ({1},{2}), no es una restricci\u00F3n v\u00E1lida del rango, ({3},{4}, de la part\u00EDcula correspondiente en el tipo base.
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: El elemento ''{0}'' no es fijo, pero el elemento correspondiente en el tipo base es fijo con el valor ''{1}''.
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: El elemento ''{0}'' es fijo con el valor ''{1}'', pero el elemento correspondiente en el tipo base es fijo con el valor ''{2}''.
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: Las restricciones de identidad del elemento ''{0}'' no son un subjuego de las de la base.
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: Las sustituciones no permitidas del elemento ''{0}'' no son un subjuego de las de la base.
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: El tipo de elemento ''{0}'', ''{1}'', no est\u00E1 derivado del tipo del elemento base, ''{2}''.
+ rcase-NSCompat.1 = rcase-NSCompat.1: El elemento ''{0}'' tiene un espacio de nombres ''{1}'' que no est\u00E1 permitido por el comod\u00EDn de la base.
+- rcase-NSCompat.2 = rcase-NSCompat.2: Error para la part\u00EDcula cuyo valor de ''{''term''}'' es la declaraci\u00F3n de elemento ''{0}''. Su rango de incidencia, ({1},{2}), no es una restricci\u00F3n v\u00E1lida del rango, ({3},{4}, de la part\u00EDcula correspondiente en el tipo base.
++ rcase-NSCompat.2 = rcase-NSCompat.2: Error para la part\u00EDcula cuyo valor de '{'term'}' es la declaraci\u00F3n de elemento ''{0}''. Su rango de incidencia, ({1},{2}), no es una restricci\u00F3n v\u00E1lida del rango, ({3},{4}, de la part\u00EDcula correspondiente en el tipo base.
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: No existe ninguna asignaci\u00F3n funcional completa entre las part\u00EDculas.
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: El rango de incidencia del grupo, ({0},{1}), no es una restricci\u00F3n v\u00E1lida del rango de comod\u00EDn de la base, ({2},{3}).
+ rcase-NSSubset.1 = rcase-NSSubset.1: El comod\u00EDn no es un subjuego del comod\u00EDn correspondiente de la base.
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: Un esquema no puede contener dos componentes globales con el mismo nombre; \u00E9ste contiene dos incidencias de ''{0}''.
+ st-props-correct.2 = st-props-correct.2: Se han detectado definiciones circulares para el tipo simple ''{0}''. Significa que ''{0}'' est\u00E1 contenido en su propia jerarqu\u00EDa de tipos, lo que es un error.
+- st-props-correct.3 = st-props-correct.3: Error para el tipo ''{0}''. El valor de ''{''final''}'' de ''{''base type definition''}'', ''{1}'', proh\u00EDbe la derivaci\u00F3n por restricci\u00F3n.
++ st-props-correct.3 = st-props-correct.3: Error para el tipo ''{0}''. El valor de '{'final'}' de '{'base type definition'}', ''{1}'', proh\u00EDbe la derivaci\u00F3n por restricci\u00F3n.
+ totalDigits-valid-restriction = totalDigits-valid-restriction: En la definici\u00F3n de {2}, el valor ''{0}'' para la faceta ''totalDigits'' no es v\u00E1lido porque debe ser menor o igual que el valor de ''totalDigits'' que se ha definido en ''{1}'' en uno de los tipos de ascendientes.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: En la definici\u00F3n de {0}, el valor ''{1}'' para la faceta ''whitespace'' no es v\u00E1lido porque el valor de ''whitespace'' se ha definido en ''collapse'' en uno de los tipos de ascendientes.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: En la definici\u00F3n de {0}, el valor ''preserve'' para la faceta ''whitespace'' no es v\u00E1lido porque el valor de ''whitespace'' se ha definido en ''replace'' en uno de los tipos de ascendientes.
+@@ -309,8 +281,8 @@
+ c-selector-xpath = c-selector-xpath: El valor de selector = ''{0}'' no es v\u00E1lido; los valores de Xpath en el selector no pueden contener atributos.
+ EmptyTargetNamespace = EmptyTargetNamespace: En el documento de esquema ''{0}'', el valor del atributo ''targetNamespace'' no puede ser una cadena vac\u00EDa.
+ FacetValueFromBase = FacetValueFromBase: En la declaraci\u00F3n de tipo ''{0}'', el valor ''{1}'' de la faceta ''{2}'' debe proceder del espacio reservado para el valor del tipo base, ''{3}''.
+- FixedFacetValue = FixedFacetValue: En la definici\u00F3n de {3}, el valor ''{1}'' para la faceta ''{0}'' no es v\u00E1lido porque el valor de ''{0}'' se ha definido en ''{2}'' en uno de los tipos de ascendientes y ''{''fixed''}'' = true.
+- InvalidRegex = InvalidRegex: El valor del patr\u00F3n ''{0}'' no es una expresi\u00F3n normal v\u00E1lida. El error registrado ha sido: ''{1}'' en la columna ''{2}''.
++ FixedFacetValue = FixedFacetValue: En la definici\u00F3n de {3}, el valor ''{1}'' para la faceta ''{0}'' no es v\u00E1lido porque el valor de ''{0}'' se ha definido en ''{2}'' en uno de los tipos de ascendientes y '{'fixed'}' = true.
++ InvalidRegex = InvalidRegex: El valor del patr\u00F3n ''{0}'' no es una expresi\u00F3n regular v\u00E1lida. El error registrado ha sido: ''{1}'' en la columna ''{2}''.
+ maxOccurLimit = La configuraci\u00F3n actual del analizador no permite que la definici\u00F3n del valor del atributo maxOccurs sea mayor que {0}.
+ PublicSystemOnNotation = PublicSystemOnNotation: Al menos un valor de ''public'' y ''system'' debe aparecer en el elemento ''notation''.
+ SchemaLocation = SchemaLocation: El valor de schemaLocation = ''{0}'' debe tener un n\u00FAmero par de URI.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+ FormatFailed = Une erreur interne est survenue lors du formatage du message suivant :\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = Erreur de contrainte d''identit\u00E9 (cvc-identity-constraint.4.2.1) : l''\u00E9l\u00E9ment \"{0}\" a une cl\u00E9 sans valeur.
+- DuplicateField = Correspondance en double dans la port\u00E9e du champ \"{0}\".
+- DuplicateKey = Valeur de cl\u00E9 en double [{0}] d\u00E9clar\u00E9e pour la contrainte d''identit\u00E9 de l''\u00E9l\u00E9ment \"{1}\".
+- DuplicateUnique = Valeur unique en double [{0}] d\u00E9clar\u00E9e pour la contrainte d''identit\u00E9 de l''\u00E9l\u00E9ment \"{1}\".
+- FieldMultipleMatch = Erreur de contrainte d''identit\u00E9 : le champ \"{0}\" concorde avec plusieurs valeurs dans la port\u00E9e de son s\u00E9lecteur. Les champs doivent concorder avec des valeurs uniques.
+- FixedDiffersFromActual = Le contenu de l'\u00E9l\u00E9ment n'\u00E9quivaut pas \u00E0 la valeur de l'attribut \"fixed\" dans la d\u00E9claration de l'\u00E9l\u00E9ment du sch\u00E9ma.
+- KeyMatchesNillable = Erreur de contrainte d''identit\u00E9 (cvc-identity-constraint.4.2.3) : l''\u00E9l\u00E9ment \"{0}\" a une cl\u00E9 qui concorde avec un \u00E9l\u00E9ment dont l''attribut nillable a la valeur True.
+- KeyNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <key name=\"{1}\"> de l''\u00E9l\u00E9ment \"{0}\" est insuffisant.
++ AbsentKeyValue = Erreur de contrainte d''identit\u00E9 (cvc-identity-constraint.4.2.1) : l''\u00E9l\u00E9ment "{0}" a une cl\u00E9 sans valeur.
++ DuplicateField = Correspondance en double dans la port\u00E9e du champ "{0}".
++ DuplicateKey = Valeur de cl\u00E9 en double [{0}] d\u00E9clar\u00E9e pour la contrainte d''identit\u00E9 de l''\u00E9l\u00E9ment "{1}".
++ DuplicateUnique = Valeur unique en double [{0}] d\u00E9clar\u00E9e pour la contrainte d''identit\u00E9 de l''\u00E9l\u00E9ment "{1}".
++ FieldMultipleMatch = Erreur de contrainte d''identit\u00E9 : le champ "{0}" concorde avec plusieurs valeurs dans la port\u00E9e de son s\u00E9lecteur ; les champs doivent concorder avec des valeurs uniques.
++ FixedDiffersFromActual = Le contenu de l'\u00E9l\u00E9ment n'\u00E9quivaut pas \u00E0 la valeur de l'attribut "fixed" dans la d\u00E9claration de l'\u00E9l\u00E9ment du sch\u00E9ma.
++ KeyMatchesNillable = Erreur de contrainte d''identit\u00E9 (cvc-identity-constraint.4.2.3) : l''\u00E9l\u00E9ment "{0}" a une cl\u00E9 qui concorde avec un \u00E9l\u00E9ment dont l''attribut nillable a la valeur True.
++ KeyNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <key name="{1}"> de l''\u00E9l\u00E9ment "{0}" est insuffisant.
+ KeyNotFound = La cl\u00E9 ''{0}'' ayant la valeur ''{1}'' est introuvable pour la contrainte d''identit\u00E9 de l''\u00E9l\u00E9ment ''{2}''.
+- KeyRefNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <keyref name=\"{1}\"> de l''\u00E9l\u00E9ment \"{0}\" est insuffisant.
+- KeyRefOutOfScope = Erreur de contrainte d''identit\u00E9 : la contrainte d''identit\u00E9 \"{0}\" comporte une r\u00E9f\u00E9rence keyref se rapportant \u00E0 une cl\u00E9 ou \u00E0 une valeur unique hors port\u00E9e.
+- KeyRefReferNotFound = La d\u00E9claration de r\u00E9f\u00E9rence de cl\u00E9 \"{0}\" se rapporte \u00E0 une cl\u00E9 inconnue portant le nom \"{1}\".
+- UniqueNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <unique> de l''\u00E9l\u00E9ment \"{0}\" est insuffisant.
+- UnknownField = Erreur de contrainte d''identit\u00E9 interne ; champ inconnu \"{0}\".
++ KeyRefNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <keyref name="{1}"> de l''\u00E9l\u00E9ment "{0}" est insuffisant.
++ KeyRefOutOfScope = Erreur de contrainte d''identit\u00E9 : la contrainte d''identit\u00E9 "{0}" comporte une r\u00E9f\u00E9rence keyref se rapportant \u00E0 une cl\u00E9 ou \u00E0 une valeur unique hors port\u00E9e.
++ KeyRefReferNotFound = La d\u00E9claration de r\u00E9f\u00E9rence de cl\u00E9 "{0}" se rapporte \u00E0 une cl\u00E9 inconnue portant le nom "{1}".
++ UniqueNotEnoughValues = Le nombre de valeurs indiqu\u00E9es pour la contrainte d''identit\u00E9 <unique> de l''\u00E9l\u00E9ment "{0}" est insuffisant.
++ UnknownField = Erreur de contrainte d''identit\u00E9 interne ; champ inconnu "{0}".
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,12 +35,12 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3 : La valeur ''{2}'' de l''attribut ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas valide par rapport \u00E0 son type, ''{3}''.
+- cvc-attribute.4 = cvc-attribute.4 : La valeur ''{2}'' de l''attribut ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas valide par rapport \u00E0 son attribut ''{''value constraint''}'' fixe. L''attribut doit avoir une valeur de ''{3}''.
++ cvc-attribute.4 = cvc-attribute.4 : La valeur ''{2}'' de l''attribut ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas valide par rapport \u00E0 son attribut '{'value constraint'}' fixe. L''attribut doit avoir une valeur de ''{3}''.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1 : L''\u00E9l\u00E9ment ''{0}'' ne doit comporter aucun enfant ([children]) de type caract\u00E8re ou \u00E9l\u00E9ment d''information, car le type de contenu du type est vide.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2 : L''\u00E9l\u00E9ment ''{0}'' ne doit comporter aucun enfant ([children]) de type \u00E9l\u00E9ment et la valeur doit \u00EAtre valide.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3 : L''\u00E9l\u00E9ment ''{0}'' ne doit comporter aucun enfant ([children]) de type caract\u00E8re, car le type porte le type de contenu "element-only".
+ cvc-complex-type.2.4.a = cvc-complex-type.2.4.a : Contenu non valide trouv\u00E9 \u00E0 partir de l''\u00E9l\u00E9ment ''{0}''. L''une des valeurs ''{1}'' est attendue.
+- cvc-complex-type.2.4.b = cvc-complex-type.2.4.b : Le contenu de l''\u00E9l\u00E9ment "{0}" n''est pas complet. L''une des valeurs "{1}" est attendue.
++ cvc-complex-type.2.4.b = cvc-complex-type.2.4.b : Le contenu de l''\u00E9l\u00E9ment ''{0}'' n''est pas complet. L''un des \u00E9l\u00E9ments ''{1}'' est attendu.
+ cvc-complex-type.2.4.c = cvc-complex-type.2.4.c : Le caract\u00E8re g\u00E9n\u00E9rique concordant est strict, mais aucune d\u00E9claration ne peut \u00EAtre trouv\u00E9e pour l''\u00E9l\u00E9ment ''{0}''.
+ cvc-complex-type.2.4.d = cvc-complex-type.2.4.d : Contenu non valide trouv\u00E9 \u00E0 partir de l''\u00E9l\u00E9ment ''{0}''. Aucun \u00E9l\u00E9ment enfant n''est attendu \u00E0 cet endroit.
+ cvc-complex-type.2.4.e = cvc-complex-type.2.4.d : Contenu non valide trouv\u00E9 \u00E0 partir de l''\u00E9l\u00E9ment ''{0}''. Aucun \u00E9l\u00E9ment enfant ''{1}'' n''est attendu \u00E0 cet endroit.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2 : L''attribut ''{1}'' n''est pas autoris\u00E9 dans l''\u00E9l\u00E9ment ''{0}''.
+ cvc-complex-type.4 = cvc-complex-type.4 : L''attribut ''{1}'' doit figurer dans l''\u00E9l\u00E9ment ''{0}''.
+ cvc-complex-type.5.1 = cvc-complex-type.5.1 : Dans l''\u00E9l\u00E9ment ''{0}'', l''attribut ''{1}'' est un ID g\u00E9n\u00E9rique. Or, il existe d\u00E9j\u00E0 un ID g\u00E9n\u00E9rique ''{2}''. Il ne peut en exister qu''un seul.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2 : Dans l''\u00E9l\u00E9ment ''{0}'', l''attribut ''{1}'' est un ID g\u00E9n\u00E9rique. Or, il existe d\u00E9j\u00E0 un attribut ''{2}'' d\u00E9riv\u00E9 de l''ID dans ''{''attribute uses''}''.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2 : Dans l''\u00E9l\u00E9ment ''{0}'', l''attribut ''{1}'' est un ID g\u00E9n\u00E9rique. Or, il existe d\u00E9j\u00E0 un attribut ''{2}'' d\u00E9riv\u00E9 de l''ID dans '{'attribute uses'}'.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1 : ''{0}'' n''est pas une valeur valide pour ''{1}''.
+- cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2 : ''{0}'' n''est pas une valeur valide pour le type de liste ''{1}''.
+- cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3 : ''{0}'' n''est pas une valeur valide pour le type d''union ''{1}''.
++ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2 : ''{0}'' n''est pas une valeur valide du type de liste ''{1}''.
++ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3 : ''{0}'' n''est pas une valeur valide du type d''union ''{1}''.
+ cvc-elt.1 = cvc-elt.1 : D\u00E9claration de l''\u00E9l\u00E9ment ''{0}'' introuvable.
+- cvc-elt.2 = cvc-elt.2 : La valeur de l''attribut ''{''abstract''}'' dans la d\u00E9claration de l''\u00E9l\u00E9ment pour ''{0}'' doit \u00EAtre False.
+- cvc-elt.3.1 = cvc-elt.3.1 : L''attribut ''{1}'' ne doit pas figurer dans l''\u00E9l\u00E9ment ''{0}'', car la propri\u00E9t\u00E9 ''{''nillable''}'' de ''{0}'' est False.
++ cvc-elt.2 = cvc-elt.2 : La valeur de l''attribut '{'abstract'}' dans la d\u00E9claration de l''\u00E9l\u00E9ment pour ''{0}'' doit \u00EAtre False.
++ cvc-elt.3.1 = cvc-elt.3.1 : L''attribut ''{1}'' ne doit pas figurer dans l''\u00E9l\u00E9ment ''{0}'', car la propri\u00E9t\u00E9 '{'nillable'}' de ''{0}'' est False.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1 : L''\u00E9l\u00E9ment ''{0}'' ne doit comporter aucun enfant ([children]) de type caract\u00E8re ou \u00E9l\u00E9ment d''information, car ''{1}'' est indiqu\u00E9.
+- cvc-elt.3.2.2 = cvc-elt.3.2.2 : Il ne doit y avoir aucun attribut ''{''value constraint''}'' fixe pour l''\u00E9l\u00E9ment ''{0}'', car ''{1}'' est indiqu\u00E9.
++ cvc-elt.3.2.2 = cvc-elt.3.2.2 : Il ne doit y avoir aucun attribut '{'value constraint'}' fixe pour l''\u00E9l\u00E9ment ''{0}'', car ''{1}'' est indiqu\u00E9.
+ cvc-elt.4.1 = cvc-elt.4.1 : La valeur ''{2}'' de l''attribut ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas un QName valide.
+ cvc-elt.4.2 = cvc-elt.4.2 : Impossible de r\u00E9soudre ''{1}'' en une d\u00E9finition de type pour l''\u00E9l\u00E9ment ''{0}''.
+ cvc-elt.4.3 = cvc-elt.4.3 : La d\u00E9rivation du type ''{1}'' \u00E0 partir de la d\u00E9finition de type ''{2}'' de l''\u00E9l\u00E9ment "{0}" n''est pas valide.
+- cvc-elt.5.1.1 = cvc-elt.5.1.1 : L''attribut ''{''value constraint''}'' ''{2}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas une valeur par d\u00E9faut valide pour le type ''{1}''.
++ cvc-elt.5.1.1 = cvc-elt.5.1.1 : L''attribut '{'value constraint'}' ''{2}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas une valeur par d\u00E9faut valide pour le type ''{1}''.
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1 : L''\u00E9l\u00E9ment ''{0}'' ne doit comporter aucun enfant ([children]) de type \u00E9l\u00E9ment d''information.
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1 : La valeur ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' ne concorde pas avec la valeur ''{2}'' de l''attribut ''{''value constraint''}'' fixe.
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2 : La valeur ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' ne concorde pas avec la valeur ''{2}'' de l''attribut ''{''value constraint''}''.
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1 : La valeur ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' ne concorde pas avec la valeur de l''attribut '{'value constraint'}' fixe ''{2}''.
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2 : La valeur ''{1}'' de l''\u00E9l\u00E9ment ''{0}'' ne concorde pas avec la valeur de l''attribut '{'value constraint'}' ''{2}''.
+ cvc-enumeration-valid = cvc-enumeration-valid : La valeur ''{0}'' n''est pas un facet valide par rapport \u00E0 l''\u00E9num\u00E9ration ''{1}''. Il doit s''agir d''une valeur provenant de l''\u00E9num\u00E9ration.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid : La valeur ''{0}'' poss\u00E8de {1} chiffres apr\u00E8s la virgule, mais le nombre de chiffres apr\u00E8s la virgule ne doit pas d\u00E9passer {2}.
+ cvc-id.1 = cvc-id.1 : Aucune liaison ID/IDREF pour l''IDREF ''{0}''.
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference : \u00E9chec de la lecture du document de sch\u00E9ma ''{0}'', car l''acc\u00E8s ''{1}'' n''est pas autoris\u00E9 en raison d''une restriction d\u00E9finie par la propri\u00E9t\u00E9 accessExternalSchema.
+ schema_reference.4 = schema_reference.4 : Echec de la lecture du document de sch\u00E9ma ''{0}'' pour les raisons suivantes : 1) Le document est introuvable ; 2) Le document n''a pas pu \u00EAtre lu ; 3) L''\u00E9l\u00E9ment racine du document n''est pas <xsd:schema>.
+ src-annotation = src-annotation : Les \u00E9l\u00E9ments <annotation> ne peuvent contenir que des \u00E9l\u00E9ments <appinfo> et <documentation>, mais ''{0}'' a \u00E9t\u00E9 trouv\u00E9.
+ src-attribute.1 = src-attribute.1 : Les propri\u00E9t\u00E9s ''default'' et ''fixed'' ne peuvent pas figurer simultan\u00E9ment dans la d\u00E9claration d''attribut ''{0}''. Utilisez uniquement l''une d''entre elles.
+@@ -130,7 +102,7 @@
+ src-ct.4 = src-ct.4 : Erreur de repr\u00E9sentation de la d\u00E9finition de type complexe pour le type ''{0}''. L''intersection de caract\u00E8res g\u00E9n\u00E9riques ne peut pas \u00EAtre exprim\u00E9e.
+ src-ct.5 = src-ct.5 : Erreur de repr\u00E9sentation de la d\u00E9finition de type complexe pour le type ''{0}''. L''union de caract\u00E8res g\u00E9n\u00E9riques ne peut pas \u00EAtre exprim\u00E9e.
+ src-element.1 = src-element.1 : Les propri\u00E9t\u00E9s ''default'' et ''fixed'' ne peuvent pas figurer simultan\u00E9ment dans la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. Utilisez uniquement l''une d''entre elles.
+- src-element.2.1 = src-element.2.1 : 'ref' ou 'name' doit figurer dans les d\u00E9clarations d''\u00E9l\u00E9ment local.
++ src-element.2.1 = src-element.2.1 : 'ref' ou 'name' doit figurer dans les d\u00E9clarations d'\u00E9l\u00E9ment local.
+ src-element.2.2 = src-element.2.2 : Puisque ''{0}'' contient l''attribut ''ref'', son contenu doit concorder avec (annotation?). Cependant, ''{1}'' a \u00E9t\u00E9 trouv\u00E9.
+ src-element.3 = src-element.3 : L''\u00E9l\u00E9ment ''{0}'' pr\u00E9sente un attribut ''type'' et un enfant ''anonymous type''. Seul un d''entre eux est autoris\u00E9 dans un \u00E9l\u00E9ment.
+ src-import.1.1 = src-import.1.1 : L''attribut namespace "{0}" d''un \u00E9l\u00E9ment d''information d''\u00E9l\u00E9ment <import> ne doit pas \u00EAtre identique \u00E0 l''attribut targetNamespace du sch\u00E9ma dans lequel il figure.
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2 : Erreur dans le groupe d''attributs ''{0}''. Des occurrences d''attributs en double avec un nom et un espace de noms cible identiques sont indiqu\u00E9es. Le nom de l''occurrence d''attribut en double est ''{1}''.
+ ag-props-correct.3 = ag-props-correct.3 : Erreur dans le groupe d''attributs ''{0}''. Deux d\u00E9clarations d''attribut, ''{1}'' et ''{2}'', ont des types d\u00E9riv\u00E9s de l''ID.
+ a-props-correct.2 = a-props-correct.2 : Valeur de contrainte de valeur ''{1}'' non valide dans l''attribut ''{0}''.
+- a-props-correct.3 = a-props-correct.3 : L''attribut ''{0}'' ne peut pas utiliser ''fixed'' ou ''default'', car sa valeur ''{''type definition''}'' est identique \u00E0 l''ID ou en est d\u00E9riv\u00E9e.
+- au-props-correct.2 = au-props-correct.2 : Dans la d\u00E9claration d''attribut de ''{0}'', la valeur fixe ''{1}'' a \u00E9t\u00E9 indiqu\u00E9e. Par cons\u00E9quent, si l''occurrence de l''attribut faisant r\u00E9f\u00E9rence \u00E0 ''{0}'' comporte \u00E9galement ''{''value constraint''}'', celle-ci doit \u00EAtre fixe et sa valeur doit \u00EAtre ''{1}''.
++ a-props-correct.3 = a-props-correct.3 : L''attribut ''{0}'' ne peut pas utiliser ''fixed'' ou ''default'', car sa valeur '{'type definition'}' est identique \u00E0 l''ID ou en est d\u00E9riv\u00E9e.
++ au-props-correct.2 = au-props-correct.2 : Dans la d\u00E9claration d''attribut de ''{0}'', la valeur fixe ''{1}'' a \u00E9t\u00E9 indiqu\u00E9e. Par cons\u00E9quent, si l''occurrence de l''attribut faisant r\u00E9f\u00E9rence \u00E0 ''{0}'' comporte \u00E9galement '{'value constraint'}', celle-ci doit \u00EAtre fixe et sa valeur doit \u00EAtre ''{1}''.
+ cos-all-limited.1.2 = cos-all-limited.1.2 : Un groupe de mod\u00E8les 'all' doit figurer dans une particule o\u00F9 '{'min occurs'}' = '{'max occurs'}' = 1. Cette particule doit en outre faire partie d'une paire constituant la valeur '{'content type'}' d'une d\u00E9finition de type complexe.
+- cos-all-limited.2 = cos-all-limited.2 : La valeur ''{''max occurs''}'' d''un \u00E9l\u00E9ment dans un groupe de mod\u00E8les ''all'' doit \u00EAtre 0 ou 1. La valeur ''{0}'' pour l''\u00E9l\u00E9ment ''{1}'' n''est pas valide.
++ cos-all-limited.2 = cos-all-limited.2 : La valeur '{'max occurs'}' d''un \u00E9l\u00E9ment dans un groupe de mod\u00E8les ''all'' doit \u00EAtre 0 ou 1. La valeur ''{0}'' pour l''\u00E9l\u00E9ment ''{1}'' n''est pas valide.
+ cos-applicable-facets = cos-applicable-facets : Le facet ''{0}'' n''est pas autoris\u00E9 pour le type {1}.
+ cos-ct-extends.1.1 = cos-ct-extends.1.1 : Le type ''{0}'' est d\u00E9riv\u00E9 par l''extension du type ''{1}''. Toutefois, l''attribut ''final'' de ''{1}'' n''autorise pas la d\u00E9rivation par extension.
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a : Le type de contenu d''un type d\u00E9riv\u00E9 et celui de sa base doivent tous les deux \u00EAtre mixtes (mixed) ou \u00E9l\u00E9ment uniquement (element-only). Le type ''{0}'' est \u00E9l\u00E9ment uniquement, mais le type de sa base ne l''est pas.
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b : Le type de contenu d''un type d\u00E9riv\u00E9 et celui de sa base doivent tous les deux \u00EAtre mixtes (mixed) ou \u00E9l\u00E9ment uniquement (element-only). Le type ''{0}'' est mixte, mais le type de sa base ne l''est pas.
+ cos-element-consistent = cos-element-consistent : Erreur dans le type ''{0}''. Plusieurs \u00E9l\u00E9ments portant le nom ''{1}'', de divers types, figurent dans le groupe de mod\u00E8les.
+- cos-list-of-atomic = cos-list-of-atomic : Dans la d\u00E9finition du type de liste ''{0}'', le type ''{1}'' est un type d''\u00E9l\u00E9ment de liste non valide car il n''est pas non d\u00E9composable (''{1}'' est un type de liste ou un type d''union contenant une liste).
++ cos-list-of-atomic = cos-list-of-atomic : Dans la d\u00E9finition du type de liste ''{0}'', le type ''{1}'' est un type d''\u00E9l\u00E9ment de liste non valide car il n''est pas atomique (''{1}'' est un type de liste ou un type d''union contenant une liste).
+ cos-nonambig = cos-nonambig : {0} et {1} (ou des \u00E9l\u00E9ments de leur groupe de substitution) violent la r\u00E8gle d''attribution de particule unique (Unique Particle Attribution). Au cours de la validation par rapport \u00E0 ce sch\u00E9ma, ces deux particules peuvent devenir ambigu\u00EBs.
+ cos-particle-restrict.a = cos-particle-restrict.a : La particule d\u00E9riv\u00E9e est vide et la base ne peut pas \u00EAtre vide.
+ cos-particle-restrict.b = cos-particle-restrict.b : La particule de base est vide, mais la particule d\u00E9riv\u00E9e ne l'est pas.
+ cos-particle-restrict.2 = cos-particle-restrict.2 : Restriction de particule interdite : ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1 : Le type ''{1}'' \u00E9tant non d\u00E9composable, sa valeur ''{''base type definition''}'', ''{0}'', doit \u00EAtre une d\u00E9finition de type simple non d\u00E9composable ou un type de donn\u00E9es primitif int\u00E9gr\u00E9.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1 : Le type ''{1}'' \u00E9tant non d\u00E9composable, sa valeur '{'base type definition'}', ''{0}'', doit \u00EAtre une d\u00E9finition de type simple atomique ou un type de donn\u00E9es primitif int\u00E9gr\u00E9.
+ cos-st-restricts.2.1 = cos-st-restricts.2.1 : Dans la d\u00E9finition du type de liste ''{0}'', le type ''{1}'' est un type d''\u00E9l\u00E9ment non valide car il s''agit d''un type de liste ou un type d''union contenant une liste.
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1 : Le composant ''{''final''}'' de la valeur ''{''item type definition''}'', ''{0}'', contient ''list''. Cela signifie que la valeur ''{0}'' ne peut pas \u00EAtre utilis\u00E9e en tant que type d''\u00E9l\u00E9ment pour le type de liste ''{1}''.
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1 : Le composant ''{''final''}'' de la valeur ''{''member type definitions''}'', ''{0}'', contient ''union''. Cela signifie que la valeur ''{0}'' ne peut pas \u00EAtre utilis\u00E9e en tant que type de membre pour le type d''union ''{1}''.
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1 : Le composant '{'final'}' de la valeur '{'item type definition'}', ''{0}'', contient ''list''. Cela signifie que la valeur ''{0}'' ne peut pas \u00EAtre utilis\u00E9e en tant que type d''\u00E9l\u00E9ment pour le type de liste ''{1}''.
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1 : Le composant '{'final'}' de la valeur '{'member type definitions'}', ''{0}'', contient ''union''. Cela signifie que la valeur ''{0}'' ne peut pas \u00EAtre utilis\u00E9e en tant que type de membre pour le type d''union ''{1}''.
+ cos-valid-default.2.1 = cos-valid-default.2.1 : L''\u00E9l\u00E9ment ''{0}'' comporte une contrainte de valeur et doit disposer d''un mod\u00E8le de contenu mixte ou simple.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2 : Puisque l''\u00E9l\u00E9ment ''{0}'' comporte une valeur ''{''value constraint''}'' et que sa d\u00E9finition de type a la valeur ''{''content type''}'' mixte, la particule de ''{''content type''}'' doit pouvoir \u00EAtre vide.
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2 : Puisque l''\u00E9l\u00E9ment ''{0}'' comporte une valeur '{'value constraint'}' et que sa d\u00E9finition de type a la valeur '{'content type'}' mixte, la particule de '{'content type'}' doit pouvoir \u00EAtre vide.
+ c-props-correct.2 = c-props-correct.2 : La cardinalit\u00E9 des champs pour les valeurs keyref ''{0}'' et key ''{1}'' doit concorder.
+ ct-props-correct.3 = ct-props-correct.3 : D\u00E9finitions circulaires d\u00E9tect\u00E9es pour le type complexe ''{0}''. Cela signifie que ''{0}'' est contenu dans sa propre hi\u00E9rarchie des types, ce qui est une erreur.
+ ct-props-correct.4 = ct-props-correct.4 : Erreur dans le type ''{0}''. Des occurrences d''attributs en double avec un nom et un espace de noms cible identiques sont indiqu\u00E9es. Le nom de l''occurrence d''attribut en double est ''{1}''.
+ ct-props-correct.5 = ct-props-correct.5 : Erreur dans le type ''{0}''. Deux d\u00E9clarations d''attribut, ''{1}'' et ''{2}'', ont des types d\u00E9riv\u00E9s de l''ID.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1 : Le type ''{0}'' a \u00E9t\u00E9 d\u00E9riv\u00E9 par restriction du type ''{1}''. Cependant, ''{1}'' comporte une propri\u00E9t\u00E9 ''{''final''}'' interdisant la d\u00E9rivation par restriction.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1 : Le type ''{0}'' a \u00E9t\u00E9 d\u00E9riv\u00E9 par restriction du type ''{1}''. Cependant, ''{1}'' comporte une propri\u00E9t\u00E9 '{'final'}' interdisant la d\u00E9rivation par restriction.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1 : Erreur dans le type ''{0}''. L''occurrence d''attribut ''{1}'' dans ce type comporte une valeur ''use'' de ''{2}'', ce qui est incoh\u00E9rent avec la valeur ''required'' dans une occurrence d''attribut correspondante dans le type de base.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2 : Erreur dans le type ''{0}''. L''occurrence d''attribut ''{1}'' dans ce type comporte le type ''{2}'', dont la d\u00E9rivation \u00E0 partir de ''{3}'', le type de l''occurrence d''attribut correspondante dans le type de base, n''est pas valide.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a : Erreur dans le type ''{0}''. L''occurrence d''attribut ''{1}'' dans ce type comporte une contrainte de valeur effective qui n''est pas fixe, et la contrainte de valeur effective de l''occurrence d''attribut correspondante dans le type de base est fixe.
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation : Le type NOTATION, ''{0}'' utilis\u00E9 par {2} ''{1}'', doit comporter une valeur de facet d''\u00E9num\u00E9ration indiquant les \u00E9l\u00E9ments de notation utilis\u00E9s par ce type.
+ enumeration-valid-restriction = enumeration-valid-restriction : La valeur d''\u00E9num\u00E9ration ''{0}'' n''est pas comprise l''espace de valeurs du type de base, {1}.
+ e-props-correct.2 = e-props-correct.2 : Valeur de contrainte de valeur ''{1}'' non valide dans l''\u00E9l\u00E9ment ''{0}''.
+- e-props-correct.4 = e-props-correct.4 : La valeur ''{''type definition''}'' de l''\u00E9l\u00E9ment ''{0}'' n''est pas d\u00E9riv\u00E9e de fa\u00E7on valide \u00E0 partir de la valeur ''{''type definition''}'' de l''\u00E9l\u00E9ment substitutionHead ''{1}'', ou la propri\u00E9t\u00E9 ''{''substitution group exclusions''}'' de ''{1}'' n''accepte pas cette d\u00E9rivation.
+- e-props-correct.5 = e-props-correct.5 : Une valeur ''{''value constraint''}'' ne doit pas figurer dans l''\u00E9l\u00E9ment ''{0}'', car sa valeur ''{''type definition''}'' ou le ''{''content type''}'' de sa valeur ''{''type definition''}'' est identique \u00E0 l''ID ou en est d\u00E9riv\u00E9.
++ e-props-correct.4 = e-props-correct.4 : La valeur '{'type definition'}' de l''\u00E9l\u00E9ment ''{0}'' n''est pas d\u00E9riv\u00E9e de fa\u00E7on valide \u00E0 partir de la valeur '{'type definition'}' de l''\u00E9l\u00E9ment substitutionHead ''{1}'', ou la propri\u00E9t\u00E9 '{'substitution group exclusions'}' de ''{1}'' n''accepte pas cette d\u00E9rivation.
++ e-props-correct.5 = e-props-correct.5 : Une valeur '{'value constraint'}' ne doit pas figurer dans l''\u00E9l\u00E9ment ''{0}'', car sa valeur '{'type definition'}' ou le '{'content type'}' de sa valeur '{'type definition'}' est identique \u00E0 l''ID ou en est d\u00E9riv\u00E9.
+ e-props-correct.6 = e-props-correct.6 : Groupe de substitution circulaire d\u00E9tect\u00E9 pour \u00E9l\u00E9ment ''{0}''.
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction : Dans la d\u00E9finition de {2}, la valeur ''{0}'' pour le facet ''fractionDigits'' n''est pas valide car elle doit \u00EAtre <= \u00E0 la valeur de ''fractionDigits'', qui a \u00E9t\u00E9 d\u00E9finie sur ''{1}'' dans l''un des types d''anc\u00EAtre.
+ fractionDigits-totalDigits = fractionDigits-totalDigits : Dans la d\u00E9finition de {2}, la valeur ''{0}'' pour le facet ''fractionDigits'' n''est pas valide car elle doit \u00EAtre <= \u00E0 la valeur de ''totalDigits'', d\u00E9finie sur ''{1}''.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3 : Erreur dans le type ''{2}''. La valeur maxInclusive ''{0}'' doit \u00EAtre >= \u00E0 la valeur minInclusive du type de base ''{1}''.
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4 : Erreur dans le type ''{2}''. La valeur maxInclusive ''{0}'' doit \u00EAtre > \u00E0 la valeur minExclusive du type de base ''{1}''.
+ maxLength-valid-restriction = maxLength-valid-restriction : Dans la d\u00E9finition de {2}, la valeur maxLength ''{0}'' doit \u00EAtre <= \u00E0 celle du type de base ''{1}''.
+- mg-props-correct.2 = mg-props-correct.2 : D\u00E9finitions circulaires d\u00E9tect\u00E9es pour le groupe ''{0}''. Le suivi r\u00E9cursif des valeurs ''{''term''}'' des particules conduit \u00E0 une particule o\u00F9 ''{''term''}'' est le groupe proprement dit.
++ mg-props-correct.2 = mg-props-correct.2 : D\u00E9finitions circulaires d\u00E9tect\u00E9es pour le groupe ''{0}''. Le suivi r\u00E9cursif des valeurs '{'term'}' des particules conduit \u00E0 une particule o\u00F9 '{'term'}' est le groupe proprement dit.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive : Dans la d\u00E9finition de {2}, la valeur minExclusive ''{0}'' doit \u00EAtre <= \u00E0 la valeur maxExclusive ''{1}''.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive : Dans la d\u00E9finition de {2}, la valeur minExclusive ''{0}'' doit \u00EAtre < \u00E0 la valeur maxInclusive ''{1}''.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1 : Erreur dans le type ''{2}''. La valeur minExclusive ''{0}'' doit \u00EAtre >= \u00E0 la valeur minExclusive du type de base ''{1}''.
+@@ -252,23 +224,23 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: Dans la d\u00E9finition de {2}, la valeur de minLength ''{0}'' doit \u00EAtre < \u00E0 la valeur de maxLength ''{1}''.
+ minLength-valid-restriction = minLength-valid-restriction : Dans la d\u00E9finition de {2}, la valeur de minLength ''{0}'' doit \u00EAtre >= \u00E0 celle du type de base, ''{1}''.
+ no-xmlns = no-xmlns : La valeur {name} d'une d\u00E9claration d'attribut ne doit pas \u00EAtre identique \u00E0 'xmlns'.
+- no-xsi = no-xsi : La valeur ''{''target namespace''}'' d''une d\u00E9claration d''attribut ne doit pas \u00EAtre identique \u00E0 ''{0}''.
++ no-xsi = no-xsi : La valeur '{'target namespace'}' d''une d\u00E9claration d''attribut ne doit pas \u00EAtre identique \u00E0 ''{0}''.
+ p-props-correct.2.1 = p-props-correct.2.1 : Dans la d\u00E9claration de ''{0}'', la valeur de ''minOccurs'' est ''{1}'', mais elle ne doit pas \u00EAtre sup\u00E9rieure \u00E0 la valeur de ''maxOccurs'', qui est ''{2}''.
+ rcase-MapAndSum.1 = rcase-MapAndSum.1 : Aucune mise en correspondance fonctionnelle compl\u00E8te entre les particules.
+ rcase-MapAndSum.2 = rcase-MapAndSum.2 : La plage d''occurrences du groupe, ({0},{1}), n''est pas une restriction valide de la plage d''occurrences du groupe de base, ({2},{3}).
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1 : Les \u00E9l\u00E9ments ont des noms (name) et des espaces de noms cible (target namespace) diff\u00E9rents : \u00E9l\u00E9ment "{0}" dans l''espace de noms "{1}" et \u00E9l\u00E9ment ''{2}'' dans l''espace de noms ''{3}''.
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2 : Erreur dans la particule o\u00F9 la valeur ''{''term''}'' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. La valeur ''{''nillable''}'' de la d\u00E9claration d''\u00E9l\u00E9ment est True, mais la particule correspondante dans le type de base comporte une d\u00E9claration d''\u00E9l\u00E9ment o\u00F9 la valeur ''{''nillable''}'' est False.
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3 : Erreur dans la particule o\u00F9 la valeur ''{''term''}'' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. Sa plage d''occurrences, ({1},{2}), n''est pas une restriction valide de la plage ({3},{4}) de la particule correspondante dans le type de base.
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2 : Erreur dans la particule o\u00F9 la valeur '{'term'}' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. La valeur '{'nillable'}' de la d\u00E9claration d''\u00E9l\u00E9ment est True, mais la particule correspondante dans le type de base comporte une d\u00E9claration d''\u00E9l\u00E9ment o\u00F9 la valeur '{'nillable'}' est False.
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3 : Erreur dans la particule o\u00F9 la valeur '{'term'}' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. Sa plage d''occurrences, ({1},{2}), n''est pas une restriction valide de la plage ({3},{4}) de la particule correspondante dans le type de base.
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a : L''\u00E9l\u00E9ment ''{0}'' n''est pas fixe, mais l''\u00E9l\u00E9ment correspondant dans le type de base est fixe avec la valeur ''{1}''.
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b : L''\u00E9l\u00E9ment ''{0}'' est fixe avec la valeur ''{1}'', mais l''\u00E9l\u00E9ment correspondant dans le type de base est fixe avec la valeur ''{2}''.
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5 : Les contraintes d''identit\u00E9 de l''\u00E9l\u00E9ment "{0}" ne sont pas un sous-ensemble de celles de la base.
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6 : Les substitutions non autoris\u00E9es pour l''\u00E9l\u00E9ment ''{0}'' ne sont pas un sur-ensemble de celles de la base.
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7 : Le type de l''\u00E9l\u00E9ment ''{0}'', ''{1}'', n''est pas d\u00E9riv\u00E9 du type de l''\u00E9l\u00E9ment de base, ''{2}''.
+ rcase-NSCompat.1 = rcase-NSCompat.1 : L''\u00E9l\u00E9ment ''{0}'' comporte un espace de noms ''{1}'' non autoris\u00E9 par le caract\u00E8re g\u00E9n\u00E9rique de la base.
+- rcase-NSCompat.2 = rcase-NSCompat.2 : Erreur dans la particule o\u00F9 la valeur ''{''term''}'' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. Sa plage d''occurrences, ({1},{2}), n''est pas une restriction valide de la plage ({3},{4}) de la particule correspondante dans le type de base.
++ rcase-NSCompat.2 = rcase-NSCompat.2 : Erreur dans la particule o\u00F9 la valeur '{'term'}' est la d\u00E9claration d''\u00E9l\u00E9ment ''{0}''. Sa plage d''occurrences, ({1},{2}), n''est pas une restriction valide de la plage ({3},{4}) de la particule correspondante dans le type de base.
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1 : Aucune mise en correspondance fonctionnelle compl\u00E8te entre les particules.
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2 : La plage d''occurrences du groupe, ({0},{1}), n''est pas une restriction valide de la plage \u00E0 caract\u00E8re g\u00E9n\u00E9rique de la base, ({2},{3}).
+- rcase-NSSubset.1 = rcase-NSSubset.1 : Le caract\u00E8re g\u00E9n\u00E9rique n'est pas un sous-ensemble de caract\u00E8res g\u00E9n\u00E9riques correspondant dans la base.
++ rcase-NSSubset.1 = rcase-NSSubset.1 : Le caract\u00E8re g\u00E9n\u00E9rique n'est pas un sous-ensemble du caract\u00E8re g\u00E9n\u00E9rique correspondant dans la base.
+ rcase-NSSubset.2 = rcase-NSSubset.2 : La plage d''occurrences du caract\u00E8re g\u00E9n\u00E9rique, ({0},{1}), n''est pas une restriction valide de celle de la base, ({2},{3}).
+ rcase-NSSubset.3 = rcase-NSSubset.3 : Le contenu de processus de caract\u00E8re g\u00E9n\u00E9rique, ''{0}'', est plus faible que celui figurant dans la base, ''{1}''.
+ rcase-Recurse.1 = rcase-Recurse.1 : La plage d''occurrences du groupe, ({0},{1}), n''est pas une restriction valide de la plage d''occurrences du groupe de base, ({2},{3}).
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2 : Un sch\u00E9ma ne peut pas contenir deux composants globaux de m\u00EAme nom ; celui-ci contient deux occurrences de ''{0}''.
+ st-props-correct.2 = st-props-correct.2 : D\u00E9finitions circulaires d\u00E9tect\u00E9es pour le type simple ''{0}''. Cela signifie que ''{0}'' est contenu dans sa propre hi\u00E9rarchie des types, ce qui est une erreur.
+- st-props-correct.3 = st-props-correct.3 : Erreur dans le type ''{0}''. La valeur ''{''final''}'' de ''{''base type definition''}'', ''{1}'', n''accepte pas la d\u00E9rivation par restriction.
++ st-props-correct.3 = st-props-correct.3 : Erreur dans le type ''{0}''. La valeur '{'final'}' de '{'base type definition'}', ''{1}'', n''accepte pas la d\u00E9rivation par restriction.
+ totalDigits-valid-restriction = totalDigits-valid-restriction : Dans la d\u00E9finition de {2}, la valeur ''{0}'' pour le facet ''totalDigits'' n''est pas valide car elle doit \u00EAtre <= \u00E0 la valeur de ''totalDigits'', qui a \u00E9t\u00E9 d\u00E9finie sur ''{1}'' dans l''un des types d''anc\u00EAtre.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1 : Dans la d\u00E9finition de {0}, la valeur ''{1}'' du facet ''whitespace'' n''est pas valide car elle a \u00E9t\u00E9 d\u00E9finie sur ''collapse'' dans l''un des types d''anc\u00EAtre.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2 : Dans la d\u00E9finition de {0}, la valeur ''preserve'' du facet ''whitespace'' n''est pas valide car la valeur de ''whitespace'' a \u00E9t\u00E9 d\u00E9finie sur ''replace'' dans l''un des types d''anc\u00EAtre.
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath : La valeur de s\u00E9lecteur ''{0}'' n''est pas valide ; les XPath de s\u00E9lecteur ne peuvent pas contenir d''attributs.
+ EmptyTargetNamespace = EmptyTargetNamespace : Dans le document de sch\u00E9ma ''{0}'', la valeur de l''attribut ''targetNamespace'' ne peut pas \u00EAtre une cha\u00EEne vide.
+ FacetValueFromBase = FacetValueFromBase : Dans la d\u00E9claration de type ''{0}'', la valeur ''{1}'' du facet ''{2}'' doit \u00EAtre issue de l''espace de valeurs du type de base, ''{3}''.
+- FixedFacetValue = FixedFacetValue : Dans la d\u00E9finition de {3}, la valeur ''{1}'' du facet ''{0}'' n''est pas valide, car la valeur de ''{0}'' a \u00E9t\u00E9 d\u00E9finie sur ''{2}'' dans l''un des types d''anc\u00EAtre, et ''{''fixed''}'' = true.
++ FixedFacetValue = FixedFacetValue : Dans la d\u00E9finition de {3}, la valeur ''{1}'' du facet ''{0}'' n''est pas valide, car la valeur de ''{0}'' a \u00E9t\u00E9 d\u00E9finie sur ''{2}'' dans l''un des types d''anc\u00EAtre, et '{'fixed'}' = true.
+ InvalidRegex = InvalidRegex : La valeur de mod\u00E8le ''{0}'' n''est pas une expression r\u00E9guli\u00E8re valide. L''erreur signal\u00E9e est ''{1}'', au niveau de la colonne ''{2}''.
+ maxOccurLimit = La configuration en cours de l''analyseur ne permet pas de d\u00E9finir une valeur d''attribut maxOccurs sur une valeur sup\u00E9rieure \u00E0 {0}.
+ PublicSystemOnNotation = PublicSystemOnNotation : Au moins une des valeurs ''public'' et ''system'' doit figurer dans l'\u00E9l\u00E9ment ''notation''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+ FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+@@ -43,19 +15,19 @@
+ # Identity constraints
+
+ AbsentKeyValue = Errore del vincolo di identit\u00E0 (cvc-identity-constraint.4.2.1): l''elemento "{0}" ha una chiave senza alcun valore.
+- DuplicateField = Corrispondenza duplicata nell''ambito per il campo \"{0}\".
++ DuplicateField = Corrispondenza duplicata nell''ambito per il campo "{0}".
+ DuplicateKey = Valore chiave duplicato [{0}] dichiarato per il vincolo di identit\u00E0 dell''elemento "{1}".
+ DuplicateUnique = Valore univoco duplicato [{0}] dichiarato per il vincolo di identit\u00E0 dell''elemento "{1}".
+ FieldMultipleMatch = Errore del vincolo di identit\u00E0: il campo "{0}" corrisponde a pi\u00F9 valori nell''ambito del proprio selettore; i campi devono corrispondere a valori univoci.
+- FixedDiffersFromActual = Il contenuto di questo elemento non equivale al valore dell'attributo \"fixed\" nella dichiarazione dell'elemento nello schema.
++ FixedDiffersFromActual = Il contenuto di questo elemento non equivale al valore dell'attributo "fixed" nella dichiarazione dell'elemento nello schema.
+ KeyMatchesNillable = Errore del vincolo di identit\u00E0 (cvc-identity-constraint.4.2.3): l''elemento "{0}" ha una chiave corrispondente a un elemento con un valore annullabile impostato su true.
+- KeyNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <key name=\"{1}\"> specificato per l''elemento \"{0}\".
++ KeyNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <key name="{1}"> specificato per l''elemento "{0}".
+ KeyNotFound = Chiave "{0}"con valore "{1}" non trovata per il vincolo di identit\u00E0 dell''elemento "{2}".
+- KeyRefNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <keyref name=\"{1}\"> specificato per l''elemento \"{0}\".
+- KeyRefOutOfScope = Errore del vincolo di identit\u00E0: il vincolo di identit\u00E0 \"{0}\" ha un keyref che fa riferimento a una chiave o a un valore univoco fuori ambito.
+- KeyRefReferNotFound = La dichiarazione \"{0}\" del riferimento chiave fa riferimento a una chiave sconosciuta denominata \"{1}\".
+- UniqueNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <unique> specificato per l''elemento \"{0}\".
+- UnknownField = Errore interno del vincolo di identit\u00E0; campo \"{0}\" sconosciuto
++ KeyRefNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <keyref name="{1}"> specificato per l''elemento "{0}".
++ KeyRefOutOfScope = Errore del vincolo di identit\u00E0: il vincolo di identit\u00E0 "{0}" ha un keyref che fa riferimento a una chiave o a un valore univoco fuori ambito.
++ KeyRefReferNotFound = La dichiarazione "{0}" del riferimento chiave fa riferimento a una chiave sconosciuta denominata "{1}".
++ UniqueNotEnoughValues = Valori insufficienti forniti per il vincolo di identit\u00E0 <unique> specificato per l''elemento "{0}".
++ UnknownField = Errore interno del vincolo di identit\u00E0; campo "{0}" sconosciuto
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: il valore ''{2}'' dell''attributo ''{1}'' sull''elemento ''{0}'' non \u00E8 valido rispetto al suo tipo ''{3}''.
+- cvc-attribute.4 = cvc-attribute.4: il valore ''{2}'' dell''attributo ''{1}'' sull''elemento ''{0}'' non \u00E8 valido rispetto al suo ''{''value constraint''}'' fisso. L''attributo deve avere un valore pari a ''{3}''.
++ cvc-attribute.4 = cvc-attribute.4: il valore ''{2}'' dell''attributo ''{1}'' sull''elemento ''{0}'' non \u00E8 valido rispetto al suo '{'value constraint'}' fisso. L''attributo deve avere un valore pari a ''{3}''.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: l''elemento "{0}" non deve avere [children] di voci di informazioni di carattere o elemento perch\u00E9 il tipo di contenuto \u00E8 vuoto.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: l''elemento "{0}" non deve avere [children] di tipo elemento e il valore deve essere valido.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: l''elemento "{0}" non deve avere [children] di tipo carattere perch\u00E9 il tipo di contenuto \u00E8 di soli elementi.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: l''attributo "{1}" non \u00E8 consentito nell''elemento "{0}".
+ cvc-complex-type.4 = cvc-complex-type.4: l''attributo ''{1}'' deve apparire sull''elemento "{0}".
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: nell''elemento "{0}", l''attributo "{1}" \u00E8 un ID Wild ma esiste gi\u00E0 un ID Wild "{2}". Pu\u00F2 esisterne solo uno.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: nell''elemento "{0}", l''attributo "{1}" \u00E8 un ID Wild ma esiste gi\u00E0 un attributo "{2}" derivato dall''ID tra ''{''attribute uses''}''.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: nell''elemento "{0}", l''attributo "{1}" \u00E8 un ID Wild ma esiste gi\u00E0 un attributo "{2}" derivato dall''ID tra '{'attribute uses'}'.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: "{0}" non \u00E8 un valore valido per "{1}".
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: "{0}" non \u00E8 un valore valido per il tipo di lista "{1}".
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: "{0}" non \u00E8 un valore valido per il tipo di unione "{1}".
+ cvc-elt.1 = cvc-elt.1: impossibile trovare la dichiarazione dell''elemento "{0}".
+- cvc-elt.2 = cvc-elt.2: il valore di ''{''abstract''}'' nella dichiarazione di elemento per "{0}" deve essere false.
+- cvc-elt.3.1 = cvc-elt.3.1: l''attributo "{1}" non deve apparire sull''elemento "{0}" perch\u00E9 la propriet\u00E0 ''{''nillable''}'' di "{0}" \u00E8 false.
++ cvc-elt.2 = cvc-elt.2: il valore di '{'abstract'}' nella dichiarazione di elemento per "{0}" deve essere false.
++ cvc-elt.3.1 = cvc-elt.3.1: l''attributo "{1}" non deve apparire sull''elemento "{0}" perch\u00E9 la propriet\u00E0 '{'nillable'}' di "{0}" \u00E8 false.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: l''elemento "{0}" non deve avere [children] di informazioni di tipo carattere o elemento perch\u00E9 \u00E8 specificato "{1}".
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: non deve esistere alcun ''{''value constraint''}'' fisso per l''elemento "{0}" perch\u00E9 \u00E8 specificato "{1}".
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: non deve esistere alcun '{'value constraint'}' fisso per l''elemento "{0}" perch\u00E9 \u00E8 specificato "{1}".
+ cvc-elt.4.1 = cvc-elt.4.1: il valore "{2}" dell''attributo "{1}" per l''elemento "{0}" non \u00E8 un QName valido.
+ cvc-elt.4.2 = cvc-elt.4.2: impossibile risolvere "{1}" in una definizione tipo per l''elemento "{0}".
+ cvc-elt.4.3 = cvc-elt.4.3: tipo "{1}" non derivato in modo valido dalla definizione tipo ''{2}'' dell''elemento "{0}".
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: ''{''value constraint''}'' "{2}" dell''elemento "{0}" non \u00E8 un valore predefinito valido per il tipo "{1}".
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: '{'value constraint'}' "{2}" dell''elemento "{0}" non \u00E8 un valore predefinito valido per il tipo "{1}".
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: l''elemento "{0}" non deve avere [children] di voci di informazioni di elemento.
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: il valore "{1}" dell''elemento "{0}" non corrisponde al valore fisso di ''{''value constraint''}'' "{2}".
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: il valore "{1}" dell''elemento "{0}" non corrisponde al valore di ''{''value constraint''}'' "{2}".
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: il valore "{1}" dell''elemento "{0}" non corrisponde al valore fisso di '{'value constraint'}' "{2}".
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: il valore "{1}" dell''elemento "{0}" non corrisponde al valore di '{'value constraint'}' "{2}".
+ cvc-enumeration-valid = cvc-enumeration-valid: il valore "{0}" non \u00E8 valido come facet rispetto all''enumerazione "{1}". Deve essere un valore dell''enumerazione.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: il valore ''{0}'' ha {1} cifre di frazione, ma il numero di cifre di frazione \u00E8 stato limitato a {2}.
+ cvc-id.1 = cvc-id.1: non esiste alcuna associazione ID/IDREF per l''IDREF "{0}".
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: lettura del documento di schema ''{0}'' non riuscita. Accesso ''{1}'' non consentito a causa della limitazione definita dalla propriet\u00E0 accessExternalSchema.
+ schema_reference.4 = schema_reference.4: lettura del documento di schema "{0}" non riuscita perch\u00E9 1) non \u00E8 stato possibile trovare il documento; 2) non \u00E8 stato possibile leggere il documento; 3) l''elemento radice del documento non \u00E8 <xsd:schema>.
+ src-annotation = src-annotation: possono essere contenuti soltanto elementi <appinfo> e <documentation>, ma \u00E8 stato trovato ''{0}''.
+ src-attribute.1 = src-attribute.1: le propriet\u00E0 ''default'' e ''fixed'' non possono essere entrambi presenti nella dichiarazione di attributo ''{0}''. Utilizzarne solo una.
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: errore per il gruppo di attributi "{0}". Sono specificati usi di attributi duplicati con lo stesso nome e spazio di nomi di destinazione. Il nome dell''uso dell''attributo duplicato \u00E8 "{1}".
+ ag-props-correct.3 = ag-props-correct.3: errore per il gruppo di attributi "{0}". Due dichiarazioni di attributo, "{1}" e "{2}" hanno tipi derivati dall''ID.
+ a-props-correct.2 = a-props-correct.2: valore di vincolo di valore "{1}" non valido nell''attributo "{0}".
+- a-props-correct.3 = a-props-correct.3: l''attributo ''{0}'' non pu\u00F2 utilizzare il valore ''fixed'' o ''default'' poich\u00E9 la ''{''type definition''}'' dell''attributo \u00E8 un ID o \u00E8 derivata dall''ID.
+- au-props-correct.2 = au-props-correct.2: nella dichiarazione di attributo di ''{0}'' \u00E8 stato specificato un valore fisso ''{1}''. Se, pertanto, l''uso dell''attributo che fa riferimento a ''{0}'' ha anche un valore ''{''value constraint''}'', deve essere fisso e il suo valore deve essere ''{1}''.
++ a-props-correct.3 = a-props-correct.3: l''attributo ''{0}'' non pu\u00F2 utilizzare il valore ''fixed'' o ''default'' poich\u00E9 la '{'type definition'}' dell''attributo \u00E8 un ID o \u00E8 derivata dall''ID.
++ au-props-correct.2 = au-props-correct.2: nella dichiarazione di attributo di ''{0}'' \u00E8 stato specificato un valore fisso ''{1}''. Se, pertanto, l''uso dell''attributo che fa riferimento a ''{0}'' ha anche un valore '{'value constraint'}', deve essere fisso e il suo valore deve essere ''{1}''.
+ cos-all-limited.1.2 = cos-all-limited.1.2: deve apparire un gruppo di modelli 'all' in una parte con '{'min occurs'}' = '{'max occurs'}' = 1 e la parte deve far parte di una coppia che costituisca il '{'content type'}' di una definizione di tipo complesso.
+- cos-all-limited.2 = cos-all-limited.2: il valore ''{''max occurs''}'' di un elemento in un gruppo di modelli ''all'' deve essere 0 o 1. Il valore ''{0}'' per l''elemento ''{1}'' non \u00E8 valido.
++ cos-all-limited.2 = cos-all-limited.2: il valore '{'max occurs'}' di un elemento in un gruppo di modelli ''all'' deve essere 0 o 1. Il valore ''{0}'' per l''elemento ''{1}'' non \u00E8 valido.
+ cos-applicable-facets = cos-applicable-facets: facet ''{0}'' non consentito dal tipo {1}.
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: il tipo ''{0}'' \u00E8 stato derivato mediante estensione dal tipo ''{1}'', ma l''attributo "final" di ''{1}'' impedisce la derivazione mediante estensione.
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: Il tipo di contenuto di un tipo derivato e quello della rispettiva base devono essere entrambi misti o di soli elementi. Il tipo ''{0}'' \u00E8 di soli elementi, mentre la rispettiva base non lo \u00E8.
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: Il tipo di contenuto di un tipo derivato e quello della rispettiva base devono essere entrambi misti o di soli elementi. Il tipo ''{0}'' \u00E8 misto, mentre la rispettiva base non lo \u00E8.
+ cos-element-consistent = cos-element-consistent: errore per il tipo "{0}". Nel gruppo di modelli appaiono pi\u00F9 elementi con nome "{1}" e tipi diversi.
+ cos-list-of-atomic = cos-list-of-atomic: nella definizione del tipo di lista ''{0}'', il tipo ''{1}'' non \u00E8 valido poich\u00E9 non \u00E8 indivisibile (''{1}'' \u00E8 un tipo di lista o un tipo di unione che contiene una lista).
+- cos-nonambig = cos-nonambig: {0} e {1} (o gli elementi derivanti dal gruppo di sostituzione) violano \"Unique Particle Attribution\". Durante la convalida su questo schema, si creerebbe un''ambiguit\u00E0 per le due parti.
++ cos-nonambig = cos-nonambig: {0} e {1} (o gli elementi derivanti dal gruppo di sostituzione) violano "Unique Particle Attribution". Durante la convalida su questo schema, si creerebbe un''ambiguit\u00E0 per le due parti.
+ cos-particle-restrict.a = cos-particle-restrict.a: la parte derivata \u00E8 vuota, mente la base non \u00E8 svuotabile.
+ cos-particle-restrict.b = cos-particle-restrict.b: la parte della base \u00E8 vuota, mente la parte derivata non lo \u00E8.
+ cos-particle-restrict.2 = cos-particle-restrict.2: limitazione di parte vietata: ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: il tipo ''{1}'' \u00E8 indivisibile, quindi la ''{''base type definition''}'' "{0}" deve essere una definizione di tipo semplice indivisibile o un tipo di dati predefinito incorporato.
+- cos-st-restricts.2.1 = cos-st-restricts.2.1: nella definizione del tipo di lista ''{0}'', il tipo ''{1}'' non \u00E8 valido poich\u00E9 \u00E8 un tipo di lista o un tipo di unione che contiene una lista).
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: il componente ''{''final''}'' di ''{''item type definition''}'' ''{0}'' contiene ''list'', pertanto ''{0}'' non pu\u00F2 essere utilizzato come tipo di elemento per il tipo di lista ''{1}''.
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: il componente ''{''final''}'' di ''{''member type definitions''}'' ''{0}'' contiene ''union'', pertanto ''{0}'' non pu\u00F2 essere utilizzato come tipo di membro per il tipo di unione ''{1}''.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: il tipo ''{1}'' \u00E8 indivisibile, quindi la '{'base type definition'}' "{0}" deve essere una definizione di tipo semplice indivisibile o un tipo di dati predefinito incorporato.
++ cos-st-restricts.2.1 = cos-st-restricts.2.1: nella definizione del tipo di lista ''{0}'', il tipo ''{1}'' non \u00E8 valido poich\u00E9 \u00E8 un tipo di lista o un tipo di unione che contiene una lista.
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: il componente '{'final'}' di '{'item type definition'}' ''{0}'' contiene ''list'', pertanto ''{0}'' non pu\u00F2 essere utilizzato come tipo di elemento per il tipo di lista ''{1}''.
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: il componente '{'final'}' di '{'member type definitions'}' ''{0}'' contiene ''union'', pertanto ''{0}'' non pu\u00F2 essere utilizzato come tipo di membro per il tipo di unione ''{1}''.
+ cos-valid-default.2.1 = cos-valid-default.2.1: l''elemento "{0}" ha un vincolo di valore e deve avere un modello di contenuto misto o semplice.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: l''elemento ''{0}'' ha un ''{''value constraint''}'' e la rispettiva definizione del tipo contiene ''{''content type''}'' misto, quindi la parte di ''{''content type''}'' deve essere svuotabile.
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: l''elemento ''{0}'' ha un '{'value constraint'}' e la rispettiva definizione del tipo contiene '{'content type'}' misto, quindi la parte di '{'content type'}' deve essere svuotabile.
+ c-props-correct.2 = c-props-correct.2: la cardinalit\u00E0 dei campi per il keyref "{0}" e per la chiave "{1}" deve corrispondere.
+ ct-props-correct.3 = ct-props-correct.3: sono state rilevate definizioni circolari per il tipo complesso ''{0}''. Ci\u00F2 significa che ''{0}'' si trova all''interno della sua stessa gerarchia di tipi, il che \u00E8 errato.
+ ct-props-correct.4 = ct-props-correct.4: errore per il tipo "{0}". Sono specificati usi di attributi duplicati con lo stesso nome e spazio di nomi di destinazione. Il nome dell''uso dell''attributo duplicato \u00E8 "{1}".
+ ct-props-correct.5 = ct-props-correct.5: errore per il tipo "{0}". Due dichiarazioni di attributo, "{1}" e "{2}" hanno tipi derivati dall''ID.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: il tipo ''{0}'' \u00E8 stato derivato mediante limitazione dal tipo ''{1}'', ma ''{1}'' ha una propriet\u00E0 ''{''final''}'' che impedisce la derivazione mediante limitazione.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: il tipo ''{0}'' \u00E8 stato derivato mediante limitazione dal tipo ''{1}'', ma ''{1}'' ha una propriet\u00E0 '{'final'}' che impedisce la derivazione mediante limitazione.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: errore per il tipo "{0}". Un uso dell''attributo ''{1}'' in questo tipo ha un valore "use" ''{2}'' che \u00E8 incoerente con il valore di ''required'' in un uso corrispondente dell''attributo nel tipo di base.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.12: errore per il tipo "{0}". Un uso dell''attributo ''{1}'' in questo tipo ha un valore tipo ''{2}'' che \u00E8 stato derivato in modo valido da ''{3}'', ovvero dal tipo di uso corrispondente dell''attributo nel tipo di base.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: errore per il tipo "{0}". L''uso dell''attributo ''{1}'' in questo tipo ha un vincolo di valore effettivo che \u00E8 fisso, mentre il vincolo di valore effettivo dell''uso dell''attributo corrispondente nel tipo di base \u00E8 fisso.
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: il tipo NOTATION ''{0}'' utilizzato da {2} ''{1}'' deve avere un valore di facet di enumerazione che specifica gli elementi di notazione utilizzati da questo tipo.
+ enumeration-valid-restriction = enumeration-valid-restriction: il valore di enumerazione "{0}" non \u00E8 nello spazio dei valori del tipo di base {1}.
+ e-props-correct.2 = e-props-correct.2: valore di vincolo di valore "{1}" non valido nell''elemento "{0}".
+- e-props-correct.4 = e-props-correct.4: ''{''type definition''}'' dell''elemento "{0}" non \u00E8 stata derivata in modo valido da ''{''type definition''}'' di substitutionHead "{1}" o la propriet\u00E0 ''{''substitution group exclusions''}'' di ''{1}'' non consente questa derivazione.
+- e-props-correct.5 = e-props-correct.5: non deve esistere ''{''value constraint''}'' sull''elemento "{0}" perch\u00E9 ''{''type definition''}'' dell''elemento o ''{''content type''}'' di ''{''type definition''}'' \u00E8 un ID o \u00E8 derivato da un ID.
++ e-props-correct.4 = e-props-correct.4: '{'type definition'}' dell''elemento "{0}" non \u00E8 stata derivata in modo valido da '{'type definition'}' di substitutionHead "{1}" o la propriet\u00E0 '{'substitution group exclusions'}' di ''{1}'' non consente questa derivazione.
++ e-props-correct.5 = e-props-correct.5: non deve esistere '{'value constraint'}' sull''elemento "{0}" perch\u00E9 '{'type definition'}' dell''elemento o '{'content type'}' di '{'type definition'}' \u00E8 un ID o \u00E8 derivato da un ID.
+ e-props-correct.6 = e-props-correct.6: gruppo di sostituzione circolare rilevato per l''elemento "{0}".
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: nella definizione di {2}, il valore ''{0}'' per il facet ''fractionDigits'' non \u00E8 valido. Deve essere <= rispetto al valore per ''fractionDigits'', impostato su ''{1}'' in uno dei tipi di predecessore.
+ fractionDigits-totalDigits = fractionDigits-totalDigits: nella definizione di {2}, il valore ''{0}'' per il facet ''fractionDigits'' non \u00E8 valido. Il valore deve essere <= rispetto al valore per ''totalDigits'', impostato su ''{1}''.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: errore per il tipo ''{2}''. Il valore maxInclusive ="{0}" deve essere >= minInclusive del tipo di base "{1}".
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: errore per il tipo ''{2}''. Il valore maxInclusive ="{0}" deve essere > minExclusive del tipo di base "{1}".
+ maxLength-valid-restriction = maxLength-valid-restriction: nella definizione di {2}, il valore maxLength = "{0}" deve essere <= rispetto a quello del tipo di base "{1}".
+- mg-props-correct.2 = mg-props-correct.2: definizioni circolari rilevate per il gruppo ''{0}''. Se si seguono in maniera ricorsiva i valori ''{''term''}'' delle parti, se ne avr\u00E0 una il cui ''{''term''}'' \u00E8 il gruppo stesso.
++ mg-props-correct.2 = mg-props-correct.2: definizioni circolari rilevate per il gruppo ''{0}''. Se si seguono in maniera ricorsiva i valori '{'term'}' delle parti, se ne avr\u00E0 una il cui '{'term'}' \u00E8 il gruppo stesso.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: nella definizione di {2}, il valore minExclusive = ''{0}'' deve essere <= rispetto al valore maxExclusive = ''{1}''.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: nella definizione di {2}, il valore minExclusive = ''{0}'' deve essere <= rispetto al valore maxInclusive = ''{1}''.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: errore per il tipo ''{2}''. Il valore minExclusive ="{0}" deve essere >= minExclusive del tipo di base "{1}".
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: nella definizione di {2}, il valore minLength = ''{0}'' deve essere < rispetto al valore maxLength = ''{1}''.
+ minLength-valid-restriction = minLength-valid-restriction: nella definizione di {2}, minLength = ''{0}'' deve essere >= rispetto a quello del tipo di base ''{1}''.
+ no-xmlns = no-xmlns: il {'name'} di una dichiarazione di attributo non deve corrispondere a 'xmlns'.
+- no-xsi = no-xsi: il ''{''target namespace''}'' di una dichiarazione di attributo non deve corrispondere a "{0}".
++ no-xsi = no-xsi: il '{'target namespace'}' di una dichiarazione di attributo non deve corrispondere a "{0}".
+ p-props-correct.2.1 = p-props-correct.2.1: nella dichiarazione di ''{0}'', il valore di ''minOccurs'' \u00E8 ''{1}'', ma non deve essere maggiore del valore di ''maxOccurs'', che \u00E8 ''{2}''.
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: non esiste un mapping funzionale completo tra le parti.
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: l''intervallo di ricorrenza ({0},{1}) del gruppo non \u00E8 una limitazione valida dell''intervallo di ricorrenza ({2},{3}) del gruppo di base.
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: alcuni elementi hanno nomi e spazi di nomi di destinazione che non sono uguali: l''elemento "{0}" nello spazio di nomi "{1}" e l''elemento "{2}" nello spazio di nomi "{3}".
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: errore per la parte il cui ''{''term''}'' \u00E8 la dichiarazione di elemento ''{0}''. Il valore ''{''nillable''}'' della dichiarazione di elemento \u00E8 impostato su true, ma la parte corrispondente nel tipo di base contiene una dichiarazione di elemento per la quale ''{''nillable''}'' \u00E8 impostato su false.
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: errore per la parte il cui ''{''term''}'' \u00E8 la dichiarazione di elemento ''{0}''. L''intervallo di ricorrenza ({1},{2}) non \u00E8 una limitazione valida dell''intervallo ({3},{4}) della parte corrispondente nel tipo di base.
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: errore per la parte il cui '{'term'}' \u00E8 la dichiarazione di elemento ''{0}''. Il valore '{'nillable'}' della dichiarazione di elemento \u00E8 impostato su true, ma la parte corrispondente nel tipo di base contiene una dichiarazione di elemento per la quale '{'nillable'}' \u00E8 impostato su false.
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: errore per la parte il cui '{'term'}' \u00E8 la dichiarazione di elemento ''{0}''. L''intervallo di ricorrenza ({1},{2}) non \u00E8 una limitazione valida dell''intervallo ({3},{4}) della parte corrispondente nel tipo di base.
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: l''elemento "{0}" non \u00E8 fisso, ma l''elemento corrispondente nel tipo di base \u00E8 fisso con il valore ''{1}''.
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: l''elemento "{0}" \u00E8 fisso con il valore ''{1}'', ma l''elemento corrispondente nel tipo di base \u00E8 fisso con il valore ''{2}''.
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: i vincoli di identit\u00E0 per l''elemento "{0}" non sono un subset di quelli nella base.
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: le sostituzioni non consentite per l''elemento "{0}" non sono un superset di quelle nella base.
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: il tipo "{1}" dell''elemento "{0}" non deriva dal tipo dell''elemento di base "{2}".
+ rcase-NSCompat.1 = rcase-NSCompat.1: l''elemento "{0}" ha uno spazio di nomi "{1}" che non \u00E8 consentito dal carattere jolly nella base.
+- rcase-NSCompat.2 = rcase-NSCompat.2: errore per la parte il cui ''{''term''}'' \u00E8 la dichiarazione di elemento ''{0}''. L''intervallo di ricorrenza ({1},{2}) non \u00E8 una limitazione valida dell''intervallo ({3},{4}) della parte corrispondente nel tipo di base.
++ rcase-NSCompat.2 = rcase-NSCompat.2: errore per la parte il cui '{'term'}' \u00E8 la dichiarazione di elemento ''{0}''. L''intervallo di ricorrenza ({1},{2}) non \u00E8 una limitazione valida dell''intervallo ({3},{4}) della parte corrispondente nel tipo di base.
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: non esiste un mapping funzionale completo tra le parti.
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: l''intervallo di ricorrenza ({0},{1}) del gruppo non \u00E8 una limitazione valida dell''intervallo ({2},{3}) del carattere jolly di base.
+ rcase-NSSubset.1 = rcase-NSSubset.1: il carattere jolly non \u00E8 un subset del carattere jolly corrispondente nella base.
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: uno schema non pu\u00F2 contenere due componenti globali con lo stesso nome; questo contiene due ricorrenze di "{0}".
+ st-props-correct.2 = st-props-correct.2: sono state rilevate definizioni circolari per il tipo semplice ''{0}''. Ci\u00F2 significa che ''{0}'' si trova all''interno della sua stessa gerarchia di tipi, il che \u00E8 errato.
+- st-props-correct.3 = st-props-correct.3: errore per il tipo ''{0}''. Il valore di ''{''final''}'' per ''{''base type definition''}'', ''{1}'', impedisce la derivazione mediante limitazione.
++ st-props-correct.3 = st-props-correct.3: errore per il tipo ''{0}''. Il valore di '{'final'}' per '{'base type definition'}', ''{1}'', impedisce la derivazione mediante limitazione.
+ totalDigits-valid-restriction = totalDigits-valid-restriction: nella definizione di {2}, il valore ''{0}'' per il facet ''totalDigits'' non \u00E8 valido. Deve essere <= rispetto al valore per ''totalDigits'', impostato su ''{1}'' in uno dei tipi di predecessore.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: nella definizione di {0}, il valore ''{1}'' per il facet ''whitespace'' non \u00E8 valido. Il valore per ''whitespace'' \u00E8 stato impostato su ''collapse'' in uno dei tipi di predecessore.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: nella definizione di {0}, il valore ''preserve'' per il facet ''whitespace'' non \u00E8 valido. Il valore per ''whitespace'' \u00E8 stato impostato su ''replace'' in uno dei tipi di predecessore.
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath: il valore del selettore = "{0}" non \u00E8 valido; gli XPath del selettore non possono contenere attributi.
+ EmptyTargetNamespace = EmptyTargetNamespace: nel documento di schema ''{0}'' il valore dell''attributo ''targetNamespace'' non pu\u00F2 essere una stringa vuota.
+ FacetValueFromBase = FacetValueFromBase: nella dichiarazione del tipo ''{0}'' il valore ''{1}'' del facet ''{2}'' deve provenire dallo spazio di valori del tipo di base ''{3}''.
+- FixedFacetValue = FixedFacetValue: nella definizione di {3}, il valore ''{1}'' per il facet ''{0}'' non \u00E8 valido. Il valore per ''{0}'' \u00E8 stato impostato su ''{2}'' in uno dei tipi di predecessore e ''{''fixed''}'' = true.
++ FixedFacetValue = FixedFacetValue: nella definizione di {3}, il valore ''{1}'' per il facet ''{0}'' non \u00E8 valido. Il valore per ''{0}'' \u00E8 stato impostato su ''{2}'' in uno dei tipi di predecessore e '{'fixed'}' = true.
+ InvalidRegex = InvalidRegex: il valore di pattern "{0}" non \u00E8 un''espressione regolare valida. Errore segnalato ''{1}'' nella colonna ''{2}''.
+ maxOccurLimit = La configurazione corrente del parser non consente che un valore di attributo maxOccurs sia impostato su un valore maggiore del valore {0}.
+ PublicSystemOnNotation = PublicSystemOnNotation: almeno uno tra ''public'' e ''system'' deve essere presente nell'elemento ''notation''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+ FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC(cvc-identity-constraint.4.2.1): \u8981\u7D20\"{0}\"\u306B\u5024\u306E\u306A\u3044\u30AD\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
+- DuplicateField = \u30D5\u30A3\u30FC\u30EB\u30C9\"{0}\"\u306E\u30B9\u30B3\u30FC\u30D7\u5185\u3067\u4E00\u81F4\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
+- DuplicateKey = \u8981\u7D20\"{1}\"\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u3067\u5BA3\u8A00\u3055\u308C\u305Fkey\u306E\u5024[{0}]\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
+- DuplicateUnique = \u8981\u7D20\"{1}\"\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u3067\u5BA3\u8A00\u3055\u308C\u305Funique\u306E\u5024[{0}]\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
+- FieldMultipleMatch = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30D5\u30A3\u30FC\u30EB\u30C9\"{0}\"\u304C\u30BB\u30EC\u30AF\u30BF\u306E\u30B9\u30B3\u30FC\u30D7\u5185\u306E\u8907\u6570\u306E\u5024\u3068\u4E00\u81F4\u3057\u3066\u3044\u307E\u3059\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u306Funique\u306E\u5024\u3068\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- FixedDiffersFromActual = \u3053\u306E\u8981\u7D20\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u306F\u3001\u30B9\u30AD\u30FC\u30DE\u5185\u306E\u8981\u7D20\u5BA3\u8A00\u3067\u306E\"fixed\"\u5C5E\u6027\u306E\u5024\u3068\u7570\u306A\u308A\u307E\u3059\u3002
+- KeyMatchesNillable = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC(cvc-identity-constraint.4.2.3): \u8981\u7D20\"{0}\"\u306B\u306F\u3001nillable\u304Ctrue\u3067\u3042\u308B\u8981\u7D20\u3068\u4E00\u81F4\u3059\u308B\u30AD\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
+- KeyNotEnoughValues = \u8981\u7D20\"{0}\"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<key name=\"{1}\">\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++ AbsentKeyValue = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC(cvc-identity-constraint.4.2.1): \u8981\u7D20"{0}"\u306B\u5024\u306E\u306A\u3044\u30AD\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
++ DuplicateField = \u30D5\u30A3\u30FC\u30EB\u30C9"{0}"\u306E\u30B9\u30B3\u30FC\u30D7\u5185\u3067\u4E00\u81F4\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
++ DuplicateKey = \u8981\u7D20"{1}"\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u3067\u5BA3\u8A00\u3055\u308C\u305Fkey\u306E\u5024[{0}]\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
++ DuplicateUnique = \u8981\u7D20"{1}"\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u3067\u5BA3\u8A00\u3055\u308C\u305Funique\u306E\u5024[{0}]\u304C\u91CD\u8907\u3057\u3066\u3044\u307E\u3059\u3002
++ FieldMultipleMatch = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30D5\u30A3\u30FC\u30EB\u30C9"{0}"\u304C\u30BB\u30EC\u30AF\u30BF\u306E\u30B9\u30B3\u30FC\u30D7\u5185\u306E\u8907\u6570\u306E\u5024\u3068\u4E00\u81F4\u3057\u3066\u3044\u307E\u3059\u3002\u30D5\u30A3\u30FC\u30EB\u30C9\u306Funique\u306E\u5024\u3068\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ FixedDiffersFromActual = \u3053\u306E\u8981\u7D20\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u306F\u3001\u30B9\u30AD\u30FC\u30DE\u5185\u306E\u8981\u7D20\u5BA3\u8A00\u3067\u306E"fixed"\u5C5E\u6027\u306E\u5024\u3068\u7570\u306A\u308A\u307E\u3059\u3002
++ KeyMatchesNillable = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC(cvc-identity-constraint.4.2.3): \u8981\u7D20"{0}"\u306B\u306F\u3001nillable\u304Ctrue\u3067\u3042\u308B\u8981\u7D20\u3068\u4E00\u81F4\u3059\u308B\u30AD\u30FC\u304C\u3042\u308A\u307E\u3059\u3002
++ KeyNotEnoughValues = \u8981\u7D20"{0}"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<key name="{1}">\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+ KeyNotFound = \u8981\u7D20''{2}''\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u3067\u3001\u5024''{1}''\u306E\u30AD\u30FC''{0}''\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+- KeyRefNotEnoughValues = \u8981\u7D20\"{0}\"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<keyref name=\"{1}\">\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+- KeyRefOutOfScope = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\"{0}\"\u306B\u3001\u30B9\u30B3\u30FC\u30D7\u5916\u306Ekey\u3084unique\u3092\u53C2\u7167\u3057\u3066\u3044\u308Bkeyref\u304C\u3042\u308A\u307E\u3059\u3002
+- KeyRefReferNotFound = \u30AD\u30FC\u53C2\u7167\u306E\u5BA3\u8A00\"{0}\"\u304C\u3001\"{1}\"\u3068\u3044\u3046\u540D\u524D\u306E\u4E0D\u660E\u306A\u30AD\u30FC\u3092\u53C2\u7167\u3057\u3066\u3044\u307E\u3059\u3002
+- UniqueNotEnoughValues = \u8981\u7D20\"{0}\"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<unique>\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+- UnknownField = \u5185\u90E8\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30D5\u30A3\u30FC\u30EB\u30C9\"{0}\"\u304C\u4E0D\u660E\u3067\u3059\u3002
++ KeyRefNotEnoughValues = \u8981\u7D20"{0}"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<keyref name="{1}">\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++ KeyRefOutOfScope = \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04"{0}"\u306B\u3001\u30B9\u30B3\u30FC\u30D7\u5916\u306Ekey\u3084unique\u3092\u53C2\u7167\u3057\u3066\u3044\u308Bkeyref\u304C\u3042\u308A\u307E\u3059\u3002
++ KeyRefReferNotFound = \u30AD\u30FC\u53C2\u7167\u306E\u5BA3\u8A00"{0}"\u304C\u3001"{1}"\u3068\u3044\u3046\u540D\u524D\u306E\u4E0D\u660E\u306A\u30AD\u30FC\u3092\u53C2\u7167\u3057\u3066\u3044\u307E\u3059\u3002
++ UniqueNotEnoughValues = \u8981\u7D20"{0}"\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B<unique>\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306B\u3001\u5341\u5206\u306A\u5024\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++ UnknownField = \u5185\u90E8\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u30A8\u30E9\u30FC: \u30D5\u30A3\u30FC\u30EB\u30C9"{0}"\u304C\u4E0D\u660E\u3067\u3059\u3002
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: \u8981\u7D20''{0}''\u306E\u5C5E\u6027''{1}''\u306E\u5024''{2}''\u306F\u3001\u305D\u306E\u30BF\u30A4\u30D7''{3}''\u306B\u5BFE\u3057\u3066\u7121\u52B9\u3067\u3059\u3002
+- cvc-attribute.4 = cvc-attribute.4: \u8981\u7D20''{0}''\u306E\u5C5E\u6027''{1}''\u306E\u5024''{2}''\u306F\u3001\u56FA\u5B9A\u306E''{''value constraint''}''\u306B\u5BFE\u3057\u3066\u7121\u52B9\u3067\u3059\u3002\u5C5E\u6027\u306E\u5024\u306F''{3}''\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ cvc-attribute.4 = cvc-attribute.4: \u8981\u7D20''{0}''\u306E\u5C5E\u6027''{1}''\u306E\u5024''{2}''\u306F\u3001\u56FA\u5B9A\u306E'{'value constraint'}'\u306B\u5BFE\u3057\u3066\u7121\u52B9\u3067\u3059\u3002\u5C5E\u6027\u306E\u5024\u306F''{3}''\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: \u30BF\u30A4\u30D7\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u304C\u7A7A\u767D\u3067\u3042\u308B\u305F\u3081\u3001\u8981\u7D20''{0}''\u306B\u306F\u6587\u5B57\u3084\u8981\u7D20\u60C5\u5831\u30A2\u30A4\u30C6\u30E0[children]\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: \u8981\u7D20''{0}''\u306F\u8981\u7D20[children]\u3092\u542B\u307E\u305A\u3001\u6709\u52B9\u306A\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: \u30BF\u30A4\u30D7\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u304C\u8981\u7D20\u306E\u307F\u3067\u3042\u308B\u305F\u3081\u3001\u8981\u7D20''{0}''\u306B\u306F\u6587\u5B57[children]\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: \u8981\u7D20''{0}''\u306B\u5C5E\u6027''{1}''\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ cvc-complex-type.4 = cvc-complex-type.4: \u8981\u7D20''{0}''\u306B\u5C5E\u6027''{1}''\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: \u8981\u7D20''{0}''\u3067\u306F\u5C5E\u6027''{1}''\u304CWild ID\u3067\u3059\u304C\u3001\u3059\u3067\u306BWild ID ''{2}''\u304C\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002\u8A31\u53EF\u3055\u308C\u308BWild ID\u306F1\u3064\u306E\u307F\u3067\u3059\u3002
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: \u8981\u7D20''{0}''\u3067\u306F\u5C5E\u6027''{1}''\u304CWild ID\u3067\u3059\u304C\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u5C5E\u6027''{2}''\u304C''{''attribute uses''}''\u306B\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: \u8981\u7D20''{0}''\u3067\u306F\u5C5E\u6027''{1}''\u304CWild ID\u3067\u3059\u304C\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u5C5E\u6027''{2}''\u304C'{'attribute uses'}'\u306B\u3059\u3067\u306B\u5B58\u5728\u3057\u3066\u3044\u307E\u3059\u3002
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}''\u306F''{1}''\u306E\u6709\u52B9\u306A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}''\u306F\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7''{1}''\u306E\u6709\u52B9\u306A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}''\u306F\u5171\u7528\u4F53\u30BF\u30A4\u30D7''{1}''\u306E\u6709\u52B9\u306A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cvc-elt.1 = cvc-elt.1: \u8981\u7D20''{0}''\u306E\u5BA3\u8A00\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+- cvc-elt.2 = cvc-elt.2: ''{0}''\u306B\u5BFE\u3059\u308B\u8981\u7D20\u5BA3\u8A00\u306E\u5024''{''abstract''}''\u306F\u3001false\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- cvc-elt.3.1 = cvc-elt.3.1: \u5C5E\u6027''{1}''\u306F\u8981\u7D20''{0}''\u306B\u8868\u793A\u3055\u308C\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u3001''{''nillable''}''\u30D7\u30ED\u30D1\u30C6\u30A3(''{0}'')\u304Cfalse\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
++ cvc-elt.2 = cvc-elt.2: ''{0}''\u306B\u5BFE\u3059\u308B\u8981\u7D20\u5BA3\u8A00\u306E\u5024'{'abstract'}'\u306F\u3001false\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ cvc-elt.3.1 = cvc-elt.3.1: \u5C5E\u6027''{1}''\u306F\u8981\u7D20''{0}''\u306B\u8868\u793A\u3055\u308C\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u3001'{'nillable'}'\u30D7\u30ED\u30D1\u30C6\u30A3(''{0}'')\u304Cfalse\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: ''{1}''\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u8981\u7D20''{0}''\u306B\u306F\u6587\u5B57\u3084\u8981\u7D20\u60C5\u5831[children]\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: \u56FA\u5B9A\u306E''{''value constraint''}''\u3092\u8981\u7D20''{0}''\u306B\u5BFE\u3057\u3066\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002''{1}''\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: \u56FA\u5B9A\u306E'{'value constraint'}'\u3092\u8981\u7D20''{0}''\u306B\u5BFE\u3057\u3066\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002''{1}''\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ cvc-elt.4.1 = cvc-elt.4.1: \u8981\u7D20''{0}''\u306E\u5C5E\u6027''{1}''\u306E\u5024''{2}''\u306F\u6709\u52B9\u306AQName\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cvc-elt.4.2 = cvc-elt.4.2: ''{1}''\u3092\u8981\u7D20''{0}''\u306E\u30BF\u30A4\u30D7\u5B9A\u7FA9\u306B\u89E3\u6C7A\u3067\u304D\u307E\u305B\u3093\u3002
+ cvc-elt.4.3 = cvc-elt.4.3: \u30BF\u30A4\u30D7''{1}''\u306F\u3001\u8981\u7D20''{0}''\u306E\u30BF\u30A4\u30D7\u5B9A\u7FA9''{2}''\u304B\u3089\u6B63\u5E38\u306B\u5C0E\u51FA\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: ''{''value constraint''}'' ''{2}''(\u8981\u7D20''{0}'')\u306F\u3001\u30BF\u30A4\u30D7''{1}''\u306E\u6709\u52B9\u306A\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: '{'value constraint'}' ''{2}''(\u8981\u7D20''{0}'')\u306F\u3001\u30BF\u30A4\u30D7''{1}''\u306E\u6709\u52B9\u306A\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: \u8981\u7D20''{0}''\u306B\u306F\u8981\u7D20\u60C5\u5831\u30A2\u30A4\u30C6\u30E0[children]\u3092\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u8981\u7D20''{0}''\u306E\u5024''{1}''\u304C\u3001\u56FA\u5B9A\u306E''{''value constraint''}''\u5024''{2}''\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u8981\u7D20''{0}''\u306E\u5024''{1}''\u304C\u3001''{''value constraint''}''\u5024''{2}''\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u8981\u7D20''{0}''\u306E\u5024''{1}''\u304C\u3001\u56FA\u5B9A\u306E'{'value constraint'}'\u5024''{2}''\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u8981\u7D20''{0}''\u306E\u5024''{1}''\u304C\u3001'{'value constraint'}'\u5024''{2}''\u306B\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002
+ cvc-enumeration-valid = cvc-enumeration-valid: \u5024''{0}''\u306F\u3001\u5217\u6319''{1}''\u306B\u5BFE\u3057\u3066\u30D5\u30A1\u30BB\u30C3\u30C8\u304C\u6709\u52B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u5217\u6319\u304B\u3089\u306E\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: \u5024''{0}''\u306E\u5C0F\u6570\u306E\u6841\u6570\u306F{1}\u3067\u3059\u304C\u3001\u5C0F\u6570\u306E\u6841\u6570\u306F{2}\u306B\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ cvc-id.1 = cvc-id.1: IDREF ''{0}''\u306EID/IDREF\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: accessExternalSchema\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u8A2D\u5B9A\u3055\u308C\u305F\u5236\u9650\u306B\u3088\u308A''{1}''\u30A2\u30AF\u30BB\u30B9\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u30B9\u30AD\u30FC\u30DE\u30FB\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8''{0}''\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
+ schema_reference.4 = schema_reference.4: 1)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u304C\u898B\u3064\u304B\u3089\u306A\u304B\u3063\u305F\u30012)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u8AAD\u307F\u53D6\u308C\u306A\u304B\u3063\u305F\u30013)\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30EB\u30FC\u30C8\u8981\u7D20\u304C<xsd:schema>\u3067\u306F\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u30B9\u30AD\u30FC\u30DE\u30FB\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8''{0}''\u306E\u8AAD\u53D6\u308A\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
+ src-annotation = src-annotation: <annotation>\u8981\u7D20\u306B\u542B\u3081\u308B\u3053\u3068\u304C\u3067\u304D\u308B\u306E\u306F<appinfo>\u8981\u7D20\u304A\u3088\u3073<documentation>\u8981\u7D20\u306E\u307F\u3067\u3059\u304C\u3001''{0}''\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u3002
+ src-attribute.1 = src-attribute.1: ''default''\u3068''fixed''\u306E\u4E21\u65B9\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u5C5E\u6027\u5BA3\u8A00''{0}''\u306B\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\u3044\u305A\u308C\u304B\u4E00\u65B9\u306E\u307F\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: \u5C5E\u6027\u30B0\u30EB\u30FC\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002\u540C\u3058\u540D\u524D\u304A\u3088\u3073\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u3092\u6301\u3064\u91CD\u8907\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u91CD\u8907\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306E\u540D\u524D\u306F''{1}''\u3067\u3059\u3002
+ ag-props-correct.3 = ag-props-correct.3: \u5C5E\u6027\u30B0\u30EB\u30FC\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u30022\u3064\u306E\u5C5E\u6027\u5BA3\u8A00''{1}''\u3068''{2}''\u306BID\u304B\u3089\u5C0E\u51FA\u3057\u305F\u30BF\u30A4\u30D7\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+ a-props-correct.2 = a-props-correct.2: \u5C5E\u6027''{0}''\u306E\u5024\u5236\u7D04\u306E\u5024''{1}''\u304C\u7121\u52B9\u3067\u3059\u3002
+- a-props-correct.3 = a-props-correct.3: \u5C5E\u6027''{0}''\u3067\u306F''fixed''\u3082''default''\u3082\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u3001\u5C5E\u6027\u306E''{''type definition''}''\u304CID\u3067\u3042\u308B\u304B\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
+- au-props-correct.2 = au-props-correct.2: ''{0}''\u306E\u5C5E\u6027\u5BA3\u8A00\u3067\u306F\u3001\u56FA\u5B9A\u5024''{1}''\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u305D\u306E\u305F\u3081\u3001''{0}''\u3092\u53C2\u7167\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306B''{''value constraint''}''\u3082\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\u306F\u3001\u305D\u308C\u3092\u56FA\u5B9A\u3057\u3001\u305D\u306E\u5024\u3092''{1}''\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ a-props-correct.3 = a-props-correct.3: \u5C5E\u6027''{0}''\u3067\u306F''fixed''\u3082''default''\u3082\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u3001\u5C5E\u6027\u306E'{'type definition'}'\u304CID\u3067\u3042\u308B\u304B\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
++ au-props-correct.2 = au-props-correct.2: ''{0}''\u306E\u5C5E\u6027\u5BA3\u8A00\u3067\u306F\u3001\u56FA\u5B9A\u5024''{1}''\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u305D\u306E\u305F\u3081\u3001''{0}''\u3092\u53C2\u7167\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306B'{'value constraint'}'\u3082\u542B\u307E\u308C\u3066\u3044\u308B\u5834\u5408\u306F\u3001\u305D\u308C\u3092\u56FA\u5B9A\u3057\u3001\u305D\u306E\u5024\u3092''{1}''\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cos-all-limited.1.2 = cos-all-limited.1.2: 'all'\u306E\u30E2\u30C7\u30EB\u30FB\u30B0\u30EB\u30FC\u30D7\u306F'{'min occurs'}' = '{'max occurs'}' = 1\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u542B\u307E\u308C\u308B\u5FC5\u8981\u304C\u3042\u308A\u3001\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306F\u8907\u5408\u578B\u5B9A\u7FA9\u306E'{'content type'}'\u3092\u69CB\u6210\u3059\u308B1\u7D44\u306E\u4E00\u90E8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- cos-all-limited.2 = cos-all-limited.2: ''all''\u306E\u30E2\u30C7\u30EB\u30FB\u30B0\u30EB\u30FC\u30D7\u306E\u8981\u7D20\u306E''{''max occurs''}''\u306F0\u304B1\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u8981\u7D20''{1}''\u306E\u5024''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002
++ cos-all-limited.2 = cos-all-limited.2: ''all''\u306E\u30E2\u30C7\u30EB\u30FB\u30B0\u30EB\u30FC\u30D7\u306E\u8981\u7D20\u306E'{'max occurs'}'\u306F0\u304B1\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u8981\u7D20''{1}''\u306E\u5024''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002
+ cos-applicable-facets = cos-applicable-facets: \u30BF\u30A4\u30D7{1}\u306B\u30D5\u30A1\u30BB\u30C3\u30C8''{0}''\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: \u30BF\u30A4\u30D7''{0}''\u306F\u30BF\u30A4\u30D7''{1}''\u306E\u62E1\u5F35\u306B\u3088\u3063\u3066\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002\u305F\u3060\u3057\u3001''{1}''\u306E''final''\u5C5E\u6027\u306B\u3088\u3063\u3066\u3001\u62E1\u5F35\u306B\u3088\u308B\u5C0E\u51FA\u304C\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: \u5C0E\u51FA\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u3068\u305D\u306E\u30D9\u30FC\u30B9\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u306F\u4E21\u65B9\u3068\u3082\u6DF7\u5408\u578B\u306B\u3059\u308B\u304B\u3001\u8981\u7D20\u306E\u307F\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u30BF\u30A4\u30D7''{0}''\u306F\u8981\u7D20\u306E\u307F\u3067\u3059\u304C\u3001\u305D\u306E\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306F\u8981\u7D20\u306E\u307F\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: \u5C0E\u51FA\u3055\u308C\u305F\u30BF\u30A4\u30D7\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u3068\u305D\u306E\u30D9\u30FC\u30B9\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30BF\u30A4\u30D7\u306F\u4E21\u65B9\u3068\u3082\u6DF7\u5408\u578B\u306B\u3059\u308B\u304B\u3001\u8981\u7D20\u306E\u307F\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u30BF\u30A4\u30D7''{0}''\u306F\u6DF7\u5408\u578B\u3067\u3059\u304C\u3001\u305D\u306E\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306F\u6DF7\u5408\u578B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cos-element-consistent = cos-element-consistent: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002''{1}''\u3068\u3044\u3046\u540D\u524D\u306E\u7570\u306A\u308B\u30BF\u30A4\u30D7\u306E\u8907\u6570\u306E\u8981\u7D20\u304C\u30E2\u30C7\u30EB\u30FB\u30B0\u30EB\u30FC\u30D7\u306B\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+ cos-list-of-atomic = cos-list-of-atomic: \u30BF\u30A4\u30D7''{1}''\u306F\u30A2\u30C8\u30DF\u30C3\u30AF\u3067\u306F\u306A\u3044\u305F\u3081(''{1}''\u306F\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7\u304B\u3001\u30EA\u30B9\u30C8\u3092\u542B\u3080\u5171\u7528\u4F53\u30BF\u30A4\u30D7\u3067\u3042\u308B\u305F\u3081)\u3001\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7''{0}''\u306E\u5B9A\u7FA9\u3067\u306F\u7121\u52B9\u306A\u30EA\u30B9\u30C8\u8981\u7D20\u30BF\u30A4\u30D7\u3067\u3059\u3002
+- cos-nonambig = cos-nonambig: {0}\u3068{1} (\u307E\u305F\u306F\u7F6E\u63DB\u30B0\u30EB\u30FC\u30D7\u306E\u8981\u7D20)\u304C\"Unique Particle Attribution\"\u306B\u9055\u53CD\u3057\u3066\u3044\u307E\u3059\u3002\u3053\u306E\u30B9\u30AD\u30FC\u30DE\u306B\u5BFE\u3059\u308B\u691C\u8A3C\u6642\u306B\u3001\u3053\u308C\u30892\u3064\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u3042\u3044\u307E\u3044\u3055\u304C\u751F\u3058\u308B\u3068\u8003\u3048\u3089\u308C\u307E\u3059\u3002
++ cos-nonambig = cos-nonambig: {0}\u3068{1} (\u307E\u305F\u306F\u7F6E\u63DB\u30B0\u30EB\u30FC\u30D7\u306E\u8981\u7D20)\u304C"Unique Particle Attribution"\u306B\u9055\u53CD\u3057\u3066\u3044\u307E\u3059\u3002\u3053\u306E\u30B9\u30AD\u30FC\u30DE\u306B\u5BFE\u3059\u308B\u691C\u8A3C\u6642\u306B\u3001\u3053\u308C\u30892\u3064\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u3042\u3044\u307E\u3044\u3055\u304C\u751F\u3058\u308B\u3068\u8003\u3048\u3089\u308C\u307E\u3059\u3002
+ cos-particle-restrict.a = cos-particle-restrict.a: \u5C0E\u51FA\u3055\u308C\u305F\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u304C\u7A7A\u3067\u3042\u308A\u3001\u30D9\u30FC\u30B9\u306F\u7A7A\u306B\u3067\u304D\u307E\u305B\u3093\u3002
+ cos-particle-restrict.b = cos-particle-restrict.b: \u30D9\u30FC\u30B9\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306F\u7A7A\u3067\u3059\u304C\u3001\u5C0E\u51FA\u3055\u308C\u305F\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306F\u7A7A\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ cos-particle-restrict.2 = cos-particle-restrict.2: \u7981\u6B62\u3055\u308C\u305F\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u5236\u9650: ''{0}''\u3002
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: \u30BF\u30A4\u30D7''{1}''\u306F\u30A2\u30C8\u30DF\u30C3\u30AF\u3067\u3042\u308B\u305F\u3081\u3001\u305D\u306E''{''base type definition''}'' ''{0}''\u306F\u30A2\u30C8\u30DF\u30C3\u30AF\u306E\u5358\u7D14\u578B\u5B9A\u7FA9\u304B\u30D7\u30EA\u30DF\u30C6\u30A3\u30D6\u306E\u7D44\u8FBC\u307F\u30C7\u30FC\u30BF\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: \u30BF\u30A4\u30D7''{1}''\u306F\u30A2\u30C8\u30DF\u30C3\u30AF\u3067\u3042\u308B\u305F\u3081\u3001\u305D\u306E'{'base type definition'}' ''{0}''\u306F\u30A2\u30C8\u30DF\u30C3\u30AF\u306E\u5358\u7D14\u578B\u5B9A\u7FA9\u304B\u30D7\u30EA\u30DF\u30C6\u30A3\u30D6\u306E\u7D44\u8FBC\u307F\u30C7\u30FC\u30BF\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: \u30BF\u30A4\u30D7''{1}''\u306F\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7\u304B\u3001\u30EA\u30B9\u30C8\u3092\u542B\u3080\u5171\u7528\u4F53\u30BF\u30A4\u30D7\u3067\u3042\u308B\u305F\u3081\u3001\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7''{0}''\u306E\u5B9A\u7FA9\u3067\u306F\u7121\u52B9\u306A\u30A2\u30A4\u30C6\u30E0\u30FB\u30BF\u30A4\u30D7\u3067\u3059\u3002
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: ''{''item type definition''}'' ''{0}''\u306E''{''final''}''\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u306F\u3001''list''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u3064\u307E\u308A\u3001''{0}''\u306F\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7''{1}''\u306E\u30A2\u30A4\u30C6\u30E0\u30FB\u30BF\u30A4\u30D7\u3068\u3057\u3066\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: ''{''member type definitions''}'' ''{0}''\u306E''{''final''}''\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u306F\u3001''union''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u3064\u307E\u308A\u3001''{0}''\u306F\u5171\u7528\u4F53\u30BF\u30A4\u30D7''{1}''\u306E\u30E1\u30F3\u30D0\u30FC\u30FB\u30BF\u30A4\u30D7\u3068\u3057\u3066\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\u306E'{'final'}'\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u306F\u3001''list''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u3064\u307E\u308A\u3001''{0}''\u306F\u30EA\u30B9\u30C8\u30FB\u30BF\u30A4\u30D7''{1}''\u306E\u30A2\u30A4\u30C6\u30E0\u30FB\u30BF\u30A4\u30D7\u3068\u3057\u3066\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\u306E'{'final'}'\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u306B\u306F\u3001''union''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u3064\u307E\u308A\u3001''{0}''\u306F\u5171\u7528\u4F53\u30BF\u30A4\u30D7''{1}''\u306E\u30E1\u30F3\u30D0\u30FC\u30FB\u30BF\u30A4\u30D7\u3068\u3057\u3066\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
+ cos-valid-default.2.1 = cos-valid-default.2.1: \u8981\u7D20''{0}''\u306B\u306F\u5024\u5236\u7D04\u304C\u542B\u307E\u308C\u3066\u304A\u308A\u3001\u6DF7\u5408\u307E\u305F\u306F\u5358\u7D14\u30B3\u30F3\u30C6\u30F3\u30C4\u30FB\u30E2\u30C7\u30EB\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u8981\u7D20''{0}''\u306B\u306F''{''value constraint''}''\u304C\u542B\u307E\u308C\u3066\u304A\u308A\u3001\u305D\u306E\u30BF\u30A4\u30D7\u5B9A\u7FA9\u306B\u306F\u6DF7\u5408''{''content type''}''\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u305F\u3081\u3001''{''content type''}''\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306F\u7A7A\u306B\u3067\u304D\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u8981\u7D20''{0}''\u306B\u306F'{'value constraint'}'\u304C\u542B\u307E\u308C\u3066\u304A\u308A\u3001\u305D\u306E\u30BF\u30A4\u30D7\u5B9A\u7FA9\u306B\u306F\u6DF7\u5408'{'content type'}'\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u305F\u3081\u3001'{'content type'}'\u306E\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306F\u7A7A\u306B\u3067\u304D\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ c-props-correct.2 = c-props-correct.2: keyref ''{0}''\u3068key ''{1}''\u306B\u5BFE\u3059\u308B\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30AB\u30FC\u30C7\u30A3\u30CA\u30EA\u30C6\u30A3\u304C\u76F8\u4E92\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ ct-props-correct.3 = ct-props-correct.3: \u8907\u5408\u578B''{0}''\u3067\u5FAA\u74B0\u5B9A\u7FA9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u3064\u307E\u308A\u3001''{0}''\u304C\u305D\u308C\u81EA\u4F53\u306E\u30BF\u30A4\u30D7\u968E\u5C64\u306B\u542B\u307E\u308C\u3066\u3044\u308B\u305F\u3081\u30A8\u30E9\u30FC\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002
+ ct-props-correct.4 = ct-props-correct.4: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002\u540C\u3058\u540D\u524D\u304A\u3088\u3073\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u3092\u6301\u3064\u91CD\u8907\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u91CD\u8907\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306E\u540D\u524D\u306F''{1}''\u3067\u3059\u3002
+ ct-props-correct.5 = ct-props-correct.5: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u30022\u3064\u306E\u5C5E\u6027\u5BA3\u8A00''{1}''\u3068''{2}''\u306BID\u304B\u3089\u5C0E\u51FA\u3057\u305F\u30BF\u30A4\u30D7\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: \u30BF\u30A4\u30D7''{0}''\u306F\u30BF\u30A4\u30D7''{1}''\u306E\u5236\u9650\u306B\u3088\u3063\u3066\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002\u305F\u3060\u3057\u3001''{1}''\u306E''{''final''}''\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u3088\u3063\u3066\u3001\u5236\u9650\u306B\u3088\u308B\u5C0E\u51FA\u304C\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: \u30BF\u30A4\u30D7''{0}''\u306F\u30BF\u30A4\u30D7''{1}''\u306E\u5236\u9650\u306B\u3088\u3063\u3066\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002\u305F\u3060\u3057\u3001''{1}''\u306E'{'final'}'\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u3088\u3063\u3066\u3001\u5236\u9650\u306B\u3088\u308B\u5C0E\u51FA\u304C\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5C5E\u6027\u4F7F\u7528''{1}''\u306B\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306E\u5024''required''\u3068\u4E00\u8CAB\u6027\u304C\u306A\u3044''{2}''\u306E''use''\u5024\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5C5E\u6027\u4F7F\u7528''{1}''\u306B\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306E\u30BF\u30A4\u30D7''{3}''\u304B\u3089\u6B63\u5E38\u306B\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u306F\u306A\u3044\u30BF\u30A4\u30D7''{2}''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5C5E\u6027\u4F7F\u7528''{1}''\u306B\u306F\u3001\u56FA\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u6709\u52B9\u306A\u5024\u5236\u7D04\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u5C5E\u6027\u4F7F\u7528\u306E\u6709\u52B9\u306A\u5024\u5236\u7D04\u306F\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: {2} ''{1}''\u3067\u4F7F\u7528\u3055\u308C\u308BNOTATION\u30BF\u30A4\u30D7''{0}''\u306B\u306F\u3001\u3053\u306E\u30BF\u30A4\u30D7\u3067\u4F7F\u7528\u3055\u308C\u308B\u8868\u8A18\u6CD5\u8981\u7D20\u3092\u6307\u5B9A\u3059\u308B\u5217\u6319\u30D5\u30A1\u30BB\u30C3\u30C8\u5024\u304C\u542B\u307E\u308C\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ enumeration-valid-restriction = enumeration-valid-restriction: \u5217\u6319\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5024\u7A7A\u9593{1}\u306B\u5B58\u5728\u3057\u307E\u305B\u3093\u3002
+ e-props-correct.2 = e-props-correct.2: \u8981\u7D20''{0}''\u306E\u5024\u5236\u7D04\u306E\u5024''{1}''\u304C\u7121\u52B9\u3067\u3059\u3002
+- e-props-correct.4 = e-props-correct.4: \u8981\u7D20''{0}''\u306E''{''type definition''}''\u304CsubstitutionHead ''{1}''\u306E''{''type definition''}''\u304B\u3089\u6B63\u5E38\u306B\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u306A\u3044\u304B\u3001''{1}''\u306E''{''substitution group exclusions''}''\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u3053\u306E\u5C0E\u51FA\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+- e-props-correct.5 = e-props-correct.5: \u8981\u7D20\u306E''{''type definition''}''\u307E\u305F\u306F''{''type definition''}''\u306E''{''content type''}''\u306FID\u3067\u3042\u308B\u304B\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3042\u308B\u305F\u3081\u3001\u8981\u7D20''{0}''\u306B''{''value constraint''}''\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
++ e-props-correct.4 = e-props-correct.4: \u8981\u7D20''{0}''\u306E'{'type definition'}'\u304CsubstitutionHead ''{1}''\u306E'{'type definition'}'\u304B\u3089\u6B63\u5E38\u306B\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u306A\u3044\u304B\u3001''{1}''\u306E'{'substitution group exclusions'}'\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u3053\u306E\u5C0E\u51FA\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++ e-props-correct.5 = e-props-correct.5: \u8981\u7D20\u306E'{'type definition'}'\u307E\u305F\u306F'{'type definition'}'\u306E'{'content type'}'\u306FID\u3067\u3042\u308B\u304B\u3001ID\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u3042\u308B\u305F\u3081\u3001\u8981\u7D20''{0}''\u306B'{'value constraint'}'\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ e-props-correct.6 = e-props-correct.6: \u8981\u7D20''{0}''\u3067\u5FAA\u74B0\u7F6E\u63DB\u30B0\u30EB\u30FC\u30D7\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: \u30D5\u30A1\u30BB\u30C3\u30C8''fractionDigits''\u306E\u5024''{0}''\u306F\u3001\u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''{1}''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B''fractionDigits''\u306E\u5024\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308B\u305F\u3081\u3001{2}\u306E\u5B9A\u7FA9\u3067\u306F\u7121\u52B9\u3067\u3059\u3002
+ fractionDigits-totalDigits = fractionDigits-totalDigits: \u30D5\u30A1\u30BB\u30C3\u30C8''fractionDigits''\u306E\u5024''{0}''\u306F\u3001''totalDigits''\u306E\u5024''{1}''\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308B\u305F\u3081\u3001{2}\u306E\u5B9A\u7FA9\u3067\u306F\u7121\u52B9\u3067\u3059\u3002
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: \u30BF\u30A4\u30D7''{2}''\u306E\u30A8\u30E9\u30FC\u3002maxInclusive\u306E\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{1}''\u306EminInclusive\u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: \u30BF\u30A4\u30D7''{2}''\u306E\u30A8\u30E9\u30FC\u3002maxInclusive\u306E\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{1}''\u306EminExclusive\u3088\u308A\u5927\u304D\u304F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ maxLength-valid-restriction = maxLength-valid-restriction: {2}\u306E\u5B9A\u7FA9\u3067\u306F\u3001maxLength\u306E\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{1}''\u306E\u5024\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- mg-props-correct.2 = mg-props-correct.2: \u30B0\u30EB\u30FC\u30D7''{0}''\u3067\u5FAA\u74B0\u5B9A\u7FA9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E''{''term''}''\u5024\u3092\u518D\u5E30\u7684\u306B\u305F\u3069\u308B\u3068\u3001''{''term''}''\u304C\u30B0\u30EB\u30FC\u30D7\u81EA\u4F53\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u9054\u3057\u307E\u3059\u3002
++ mg-props-correct.2 = mg-props-correct.2: \u30B0\u30EB\u30FC\u30D7''{0}''\u3067\u5FAA\u74B0\u5B9A\u7FA9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E'{'term'}'\u5024\u3092\u518D\u5E30\u7684\u306B\u305F\u3069\u308B\u3068\u3001'{'term'}'\u304C\u30B0\u30EB\u30FC\u30D7\u81EA\u4F53\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u9054\u3057\u307E\u3059\u3002
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: {2}\u306E\u5B9A\u7FA9\u3067\u306F\u3001minExclusive\u306E\u5024''{0}''\u306FmaxExclusive\u306E\u5024''{1}''\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: {2}\u306E\u5B9A\u7FA9\u3067\u306F\u3001minExclusive\u306E\u5024''{0}''\u306FmaxInclusive\u306E\u5024''{1}''\u3088\u308A\u5C0F\u3055\u304F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: \u30BF\u30A4\u30D7''{2}''\u306E\u30A8\u30E9\u30FC\u3002minExclusive\u306E\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{1}''\u306EminExclusive\u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: {2}\u306E\u5B9A\u7FA9\u3067\u306F\u3001minLength\u306E\u5024''{0}''\u306FmaxLength\u306E\u5024''{1}''\u3088\u308A\u5C0F\u3055\u304F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ minLength-valid-restriction = minLength-valid-restriction: {2}\u306E\u5B9A\u7FA9\u3067\u306F\u3001minLength\u306E\u5024''{0}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{1}''\u306E\u5024\u4EE5\u4E0A\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+ no-xmlns = no-xmlns: \u5C5E\u6027\u5BA3\u8A00\u306E{name}\u3092'xmlns'\u3068\u540C\u4E00\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+- no-xsi = no-xsi: \u5C5E\u6027\u5BA3\u8A00\u306E''{''target namespace''}''\u3092''{0}''\u3068\u540C\u4E00\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
++ no-xsi = no-xsi: \u5C5E\u6027\u5BA3\u8A00\u306E'{'target namespace'}'\u3092''{0}''\u3068\u540C\u4E00\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ p-props-correct.2.1 = p-props-correct.2.1: ''{0}''\u306E\u5BA3\u8A00\u3067\u306F\u3001''minOccurs''\u306E\u5024\u306F''{1}''\u3067\u3059\u304C\u3001''maxOccurs''\u306E\u5024''{2}''\u3088\u308A\u5927\u304D\u304F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: \u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u9593\u306B\u5B8C\u5168\u306A\u6A5F\u80FD\u30DE\u30C3\u30D4\u30F3\u30B0\u304C\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: \u30B0\u30EB\u30FC\u30D7\u306E\u51FA\u73FE\u7BC4\u56F2({0},{1})\u304C\u30D9\u30FC\u30B9\u30FB\u30B0\u30EB\u30FC\u30D7\u306E\u51FA\u73FE\u7BC4\u56F2({2},{3})\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: \u8981\u7D20\u306B\u7570\u306A\u308B\u540D\u524D\u3084\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u304C\u542B\u307E\u308C\u307E\u3059: \u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9''{1}''\u306E\u8981\u7D20''{0}''\u304A\u3088\u3073\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9''{3}''\u306E\u8981\u7D20''{2}''\u3067\u3059\u3002
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: ''{''term''}''\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u8981\u7D20\u5BA3\u8A00\u306E''{''nillable''}''\u306Ftrue\u3067\u3059\u304C\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u306F''{''nillable''}''\u304Cfalse\u306E\u8981\u7D20\u5BA3\u8A00\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: ''{''term''}''\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u51FA\u73FE\u7BC4\u56F2({1},{2})\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u7BC4\u56F2({3},{4}\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: '{'term'}'\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u8981\u7D20\u5BA3\u8A00\u306E'{'nillable'}'\u306Ftrue\u3067\u3059\u304C\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306B\u306F'{'nillable'}'\u304Cfalse\u306E\u8981\u7D20\u5BA3\u8A00\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: '{'term'}'\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u51FA\u73FE\u7BC4\u56F2({1},{2})\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u7BC4\u56F2({3},{4}\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: \u8981\u7D20''{0}''\u306F\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u304C\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u8981\u7D20\u306F\u5024''{1}''\u3067\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: \u8981\u7D20''{0}''\u306F\u5024''{1}''\u3067\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u8981\u7D20\u306F\u5024''{2}''\u3067\u56FA\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: \u8981\u7D20''{0}''\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u304C\u30D9\u30FC\u30B9\u306E\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u5236\u7D04\u306E\u30B5\u30D6\u30BB\u30C3\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: \u8981\u7D20''{0}''\u306Edisallowed substitutions\u306F\u30D9\u30FC\u30B9\u306Edisallowed substitutions\u306E\u30B9\u30FC\u30D1\u30FC\u30BB\u30C3\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: \u8981\u7D20''{0}''\u306E\u30BF\u30A4\u30D7''{1}''\u306F\u3001\u30D9\u30FC\u30B9\u8981\u7D20\u306E\u30BF\u30A4\u30D7''{2}''\u304B\u3089\u5C0E\u51FA\u3055\u308C\u305F\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NSCompat.1 = rcase-NSCompat.1: \u8981\u7D20''{0}''\u306B\u3001\u30D9\u30FC\u30B9\u306E\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u3067\u8A31\u53EF\u3055\u308C\u3066\u3044\u306A\u3044\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9''{1}''\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002
+- rcase-NSCompat.2 = rcase-NSCompat.2: ''{''term''}''\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u51FA\u73FE\u7BC4\u56F2({1},{2})\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u7BC4\u56F2({3},{4}\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
++ rcase-NSCompat.2 = rcase-NSCompat.2: '{'term'}'\u304C\u8981\u7D20\u5BA3\u8A00''{0}''\u3067\u3042\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u30A8\u30E9\u30FC\u3002\u51FA\u73FE\u7BC4\u56F2({1},{2})\u306F\u3001\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u306E\u5BFE\u5FDC\u3059\u308B\u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u306E\u7BC4\u56F2({3},{4}\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: \u30D1\u30FC\u30C6\u30A3\u30AF\u30EB\u9593\u306B\u5B8C\u5168\u306A\u6A5F\u80FD\u30DE\u30C3\u30D4\u30F3\u30B0\u304C\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: \u30B0\u30EB\u30FC\u30D7\u306E\u51FA\u73FE\u7BC4\u56F2({0},{1})\u304C\u30D9\u30FC\u30B9\u306E\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u306E\u7BC4\u56F2({2},{3})\u306E\u6709\u52B9\u306A\u5236\u9650\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ rcase-NSSubset.1 = rcase-NSSubset.1: \u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u304C\u3001\u30D9\u30FC\u30B9\u306E\u5BFE\u5FDC\u3059\u308B\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u306E\u30B5\u30D6\u30BB\u30C3\u30C8\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: \u30B9\u30AD\u30FC\u30DE\u306B\u306F\u540C\u3058\u540D\u524D\u3092\u6301\u30642\u3064\u306E\u30B0\u30ED\u30FC\u30D0\u30EB\u30FB\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u306E\u30B9\u30AD\u30FC\u30DE\u306B\u306F''{0}''\u304C2\u3064\u3042\u308A\u307E\u3059\u3002
+ st-props-correct.2 = st-props-correct.2: \u5358\u7D14\u578B''{0}''\u3067\u5FAA\u74B0\u5B9A\u7FA9\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u3064\u307E\u308A\u3001''{0}''\u304C\u305D\u308C\u81EA\u4F53\u306E\u30BF\u30A4\u30D7\u968E\u5C64\u306B\u542B\u307E\u308C\u3066\u3044\u308B\u305F\u3081\u30A8\u30E9\u30FC\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u3002
+- st-props-correct.3 = st-props-correct.3: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002''{''base type definition''}''\u306E''{''final''}''\u306E\u5024''{1}''\u306F\u3001\u5236\u9650\u306B\u3088\u3063\u3066\u5C0E\u51FA\u3092\u7981\u6B62\u3057\u3066\u3044\u307E\u3059\u3002
++ st-props-correct.3 = st-props-correct.3: \u30BF\u30A4\u30D7''{0}''\u306E\u30A8\u30E9\u30FC\u3002'{'base type definition'}'\u306E'{'final'}'\u306E\u5024''{1}''\u306F\u3001\u5236\u9650\u306B\u3088\u3063\u3066\u5C0E\u51FA\u3092\u7981\u6B62\u3057\u3066\u3044\u307E\u3059\u3002
+ totalDigits-valid-restriction = totalDigits-valid-restriction: \u30D5\u30A1\u30BB\u30C3\u30C8''totalDigits''\u306E\u5024''{0}''\u306F\u3001\u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''{1}''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B''totalDigits''\u306E\u5024\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308B\u305F\u3081\u3001{2}\u306E\u5B9A\u7FA9\u3067\u306F\u7121\u52B9\u3067\u3059\u3002
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: \u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''whitespace''\u306E\u5024\u304C''collapse''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001{0}\u306E\u5B9A\u7FA9\u3067\u306F\u30D5\u30A1\u30BB\u30C3\u30C8''whitespace''\u306E\u5024''{1}''\u306F\u7121\u52B9\u3067\u3059\u3002
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: \u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''whitespace''\u306E\u5024\u304C''replace''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001{0}\u306E\u5B9A\u7FA9\u3067\u306F\u30D5\u30A1\u30BB\u30C3\u30C8''whitespace''\u306E\u5024''preserve''\u306F\u7121\u52B9\u3067\u3059\u3002
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath: selector\u306E\u5024''{0}''\u306F\u7121\u52B9\u3067\u3059\u3002selector\u306EXPath\u306B\u306F\u5C5E\u6027\u3092\u542B\u3081\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ EmptyTargetNamespace = EmptyTargetNamespace: \u30B9\u30AD\u30FC\u30DE\u30FB\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8''{0}''\u3067\u306F\u3001''targetNamespace''\u5C5E\u6027\u306E\u5024\u3092\u7A7A\u306E\u6587\u5B57\u5217\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
+ FacetValueFromBase = FacetValueFromBase: \u30BF\u30A4\u30D7''{0}''\u306E\u5BA3\u8A00\u3067\u306F\u3001\u30D5\u30A1\u30BB\u30C3\u30C8''{2}''\u306E\u5024''{1}''\u306F\u30D9\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7''{3}''\u306E\u5024\u7A7A\u9593\u304B\u3089\u306E\u3082\u306E\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+- FixedFacetValue = FixedFacetValue: {3}\u306E\u5B9A\u7FA9\u3067\u306F\u30D5\u30A1\u30BB\u30C3\u30C8''{0}''\u306E\u5024''{1}''\u306F\u7121\u52B9\u3067\u3059\u3002\u3053\u308C\u306F\u3001''{0}''\u306E\u5024\u304C\u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''{2}''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u304A\u308A\u3001''{''fixed''}'' = true\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
++ FixedFacetValue = FixedFacetValue: {3}\u306E\u5B9A\u7FA9\u3067\u306F\u30D5\u30A1\u30BB\u30C3\u30C8''{0}''\u306E\u5024''{1}''\u306F\u7121\u52B9\u3067\u3059\u3002\u3053\u308C\u306F\u3001''{0}''\u306E\u5024\u304C\u7956\u5148\u30BF\u30A4\u30D7\u306E\u3044\u305A\u308C\u304B\u3067''{2}''\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u304A\u308A\u3001'{'fixed'}' = true\u3067\u3042\u308B\u305F\u3081\u3067\u3059\u3002
+ InvalidRegex = InvalidRegex: pattern\u306E\u5024''{0}''\u306F\u7121\u52B9\u306A\u6B63\u898F\u8868\u73FE\u3067\u3059\u3002\u5217''{2}''\u3067''{1}''\u30A8\u30E9\u30FC\u304C\u5831\u544A\u3055\u308C\u307E\u3057\u305F\u3002
+ maxOccurLimit = \u73FE\u5728\u306E\u30D1\u30FC\u30B5\u30FC\u306E\u69CB\u6210\u3067\u306F\u3001maxOccurs\u5C5E\u6027\u306B\u5024{0}\u3088\u308A\u5927\u304D\u3044\u5024\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002
+ PublicSystemOnNotation = PublicSystemOnNotation: \u8981\u7D20''notation''\u306B\u306F''public''\u304A\u3088\u3073''system''\u306E\u5C11\u306A\u304F\u3068\u30821\u3064\u304C\u5FC5\u8981\u3067\u3059\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958(cvc-identity-constraint.4.2.1): \"{0}\" \uC694\uC18C\uC5D0 \uAC12\uC774 \uC5C6\uB294 \uD0A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
+- DuplicateField = \"{0}\" \uD544\uB4DC \uBC94\uC704\uC5D0 \uC911\uBCF5 \uC0AC\uD56D\uC774 \uC788\uC2B5\uB2C8\uB2E4.
+- DuplicateKey = \uC911\uBCF5 \uD0A4 \uAC12 [{0}]\uC774(\uAC00) \"{1}\" \uC694\uC18C\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC120\uC5B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+- DuplicateUnique = \uC911\uBCF5 \uACE0\uC720 \uAC12 [{0}]\uC774(\uAC00) \"{1}\" \uC694\uC18C\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC120\uC5B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+- FieldMultipleMatch = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: \"{0}\" \uD544\uB4DC\uAC00 \uD574\uB2F9 \uC120\uD0DD\uAE30 \uBC94\uC704 \uB0B4\uC5D0 \uD3EC\uD568\uB41C \uC5EC\uB7EC \uAC12\uACFC \uC77C\uCE58\uD569\uB2C8\uB2E4. \uD544\uB4DC\uB294 \uACE0\uC720 \uAC12\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4.
+- FixedDiffersFromActual = \uC774 \uC694\uC18C\uC758 \uCF58\uD150\uCE20\uAC00 \uC2A4\uD0A4\uB9C8\uC758 \uC694\uC18C \uC120\uC5B8\uC5D0 \uC788\uB294 \"fixed\" \uC18D\uC131\uAC12\uACFC \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+- KeyMatchesNillable = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958(cvc-identity-constraint.4.2.3): \"{0}\" \uC694\uC18C\uC5D0 nillable\uC774 true\uB85C \uC124\uC815\uB41C \uC694\uC18C\uC640 \uC77C\uCE58\uD558\uB294 \uD0A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
+- KeyNotEnoughValues = \"{0}\" \uC694\uC18C\uC758 <key name=\"{1}\"> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
++ AbsentKeyValue = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958(cvc-identity-constraint.4.2.1): "{0}" \uC694\uC18C\uC5D0 \uAC12\uC774 \uC5C6\uB294 \uD0A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
++ DuplicateField = "{0}" \uD544\uB4DC \uBC94\uC704\uC5D0 \uC911\uBCF5 \uC0AC\uD56D\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++ DuplicateKey = \uC911\uBCF5 \uD0A4 \uAC12 [{0}]\uC774(\uAC00) "{1}" \uC694\uC18C\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC120\uC5B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
++ DuplicateUnique = \uC911\uBCF5 \uACE0\uC720 \uAC12 [{0}]\uC774(\uAC00) "{1}" \uC694\uC18C\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC120\uC5B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
++ FieldMultipleMatch = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: "{0}" \uD544\uB4DC\uAC00 \uD574\uB2F9 \uC120\uD0DD\uAE30 \uBC94\uC704 \uB0B4\uC5D0 \uD3EC\uD568\uB41C \uC5EC\uB7EC \uAC12\uACFC \uC77C\uCE58\uD569\uB2C8\uB2E4. \uD544\uB4DC\uB294 \uACE0\uC720 \uAC12\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4.
++ FixedDiffersFromActual = \uC774 \uC694\uC18C\uC758 \uCF58\uD150\uCE20\uAC00 \uC2A4\uD0A4\uB9C8\uC758 \uC694\uC18C \uC120\uC5B8\uC5D0 \uC788\uB294 "fixed" \uC18D\uC131\uAC12\uACFC \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
++ KeyMatchesNillable = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958(cvc-identity-constraint.4.2.3): "{0}" \uC694\uC18C\uC5D0 nillable\uC774 true\uB85C \uC124\uC815\uB41C \uC694\uC18C\uC640 \uC77C\uCE58\uD558\uB294 \uD0A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
++ KeyNotEnoughValues = "{0}" \uC694\uC18C\uC758 <key name="{1}"> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
+ KeyNotFound = ''{2}'' \uC694\uC18C\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uAC12\uC774 ''{1}''\uC778 ''{0}'' \uD0A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+- KeyRefNotEnoughValues = \"{0}\" \uC694\uC18C\uC758 <keyref name=\"{1}\"> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
+- KeyRefOutOfScope = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: ID \uC81C\uC57D \uC870\uAC74 \"{0}\"\uC758 keyref\uAC00 \uBC94\uC704\uC5D0\uC11C \uBC97\uC5B4\uB09C \uD0A4 \uB610\uB294 \uACE0\uC720 \uD56D\uBAA9\uC744 \uCC38\uC870\uD569\uB2C8\uB2E4.
+- KeyRefReferNotFound = \uD0A4 \uCC38\uC870 \uC120\uC5B8 \"{0}\"\uC740(\uB294) \uC774\uB984\uC774 \"{1}\"\uC778 \uC54C \uC218 \uC5C6\uB294 \uD0A4\uB97C \uCC38\uC870\uD569\uB2C8\uB2E4.
+- UniqueNotEnoughValues = \"{0}\" \uC694\uC18C\uC758 <unique> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
+- UnknownField = \uB0B4\uBD80 ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: \"{0}\"\uC740(\uB294) \uC54C \uC218 \uC5C6\uB294 \uD544\uB4DC\uC785\uB2C8\uB2E4.
++ KeyRefNotEnoughValues = "{0}" \uC694\uC18C\uC758 <keyref name="{1}"> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
++ KeyRefOutOfScope = ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: ID \uC81C\uC57D \uC870\uAC74 "{0}"\uC758 keyref\uAC00 \uBC94\uC704\uC5D0\uC11C \uBC97\uC5B4\uB09C \uD0A4 \uB610\uB294 \uACE0\uC720 \uD56D\uBAA9\uC744 \uCC38\uC870\uD569\uB2C8\uB2E4.
++ KeyRefReferNotFound = \uD0A4 \uCC38\uC870 \uC120\uC5B8 "{0}"\uC740(\uB294) \uC774\uB984\uC774 "{1}"\uC778 \uC54C \uC218 \uC5C6\uB294 \uD0A4\uB97C \uCC38\uC870\uD569\uB2C8\uB2E4.
++ UniqueNotEnoughValues = "{0}" \uC694\uC18C\uC758 <unique> ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD574 \uC9C0\uC815\uB41C \uAC12\uC774 \uBD80\uC871\uD569\uB2C8\uB2E4.
++ UnknownField = \uB0B4\uBD80 ID \uC81C\uC57D \uC870\uAC74 \uC624\uB958: "{0}"\uC740(\uB294) \uC54C \uC218 \uC5C6\uB294 \uD544\uB4DC\uC785\uB2C8\uB2E4.
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uC18D\uC131\uC5D0 \uB300\uD55C ''{2}'' \uAC12\uC774 ''{3}'' \uC720\uD615\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+- cvc-attribute.4 = cvc-attribute.4: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uC18D\uC131\uC5D0 \uB300\uD55C ''{2}'' \uAC12\uC774 \uACE0\uC815\uB41C ''{''value constraint''}''\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC18D\uC131\uC758 \uAC12\uC740 ''{3}''\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ cvc-attribute.4 = cvc-attribute.4: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uC18D\uC131\uC5D0 \uB300\uD55C ''{2}'' \uAC12\uC774 \uACE0\uC815\uB41C '{'value constraint'}'\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC18D\uC131\uC758 \uAC12\uC740 ''{3}''\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: \uC720\uD615\uC758 \uCF58\uD150\uCE20 \uC720\uD615\uC774 \uBE44\uC5B4 \uC788\uC73C\uBBC0\uB85C ''{0}'' \uC694\uC18C\uC5D0\uB294 \uBB38\uC790 \uB610\uB294 \uC694\uC18C \uC815\uBCF4 \uD56D\uBAA9 [children]\uC774 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: ''{0}'' \uC694\uC18C\uC5D0\uB294 \uC694\uC18C [children]\uC774 \uC5C6\uC5B4\uC57C \uD558\uBA70 \uAC12\uC774 \uC801\uD569\uD574\uC57C \uD569\uB2C8\uB2E4.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: \uC720\uD615\uC758 \uCF58\uD150\uCE20 \uC720\uD615\uC774 \uC694\uC18C \uC804\uC6A9\uC774\uBBC0\uB85C ''{0}'' \uC694\uC18C\uC5D0\uB294 \uBB38\uC790 [children]\uC774 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: ''{1}'' \uC18D\uC131\uC740 ''{0}'' \uC694\uC18C\uC5D0 \uB098\uD0C0\uB0A0 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ cvc-complex-type.4 = cvc-complex-type.4: ''{1}'' \uC18D\uC131\uC740 ''{0}'' \uC694\uC18C\uC5D0 \uB098\uD0C0\uB098\uC57C \uD569\uB2C8\uB2E4.
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: ''{0}'' \uC694\uC18C\uC5D0\uC11C ''{1}'' \uC18D\uC131\uC774 \uB300\uCCB4 ID\uC774\uC9C0\uB9CC \uB300\uCCB4 ID ''{2}''\uC774(\uAC00) \uC774\uBBF8 \uC788\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: ''{0}'' \uC694\uC18C\uC5D0\uC11C ''{1}'' \uC18D\uC131\uC774 \uB300\uCCB4 ID\uC774\uC9C0\uB9CC ''{''attribute uses''}'' \uC911 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C ''{2}'' \uC18D\uC131\uC774 \uC774\uBBF8 \uC788\uC2B5\uB2C8\uB2E4.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: ''{0}'' \uC694\uC18C\uC5D0\uC11C ''{1}'' \uC18D\uC131\uC774 \uB300\uCCB4 ID\uC774\uC9C0\uB9CC '{'attribute uses'}' \uC911 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C ''{2}'' \uC18D\uC131\uC774 \uC774\uBBF8 \uC788\uC2B5\uB2C8\uB2E4.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}''\uC740(\uB294) ''{1}''\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}''\uC740(\uB294) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC758 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}''\uC740(\uB294) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC758 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cvc-elt.1 = cvc-elt.1: ''{0}'' \uC694\uC18C\uC758 \uC120\uC5B8\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+- cvc-elt.2 = cvc-elt.2: ''{0}''\uC5D0 \uB300\uD55C \uC694\uC18C \uC120\uC5B8\uC5D0\uC11C ''{''abstract''}''\uC758 \uAC12\uC740 false\uC5EC\uC57C \uD569\uB2C8\uB2E4.
+- cvc-elt.3.1 = cvc-elt.3.1: ''{0}''\uC758 ''{''nillable''}'' \uC18D\uC131\uC774 false\uC774\uBBC0\uB85C ''{1}'' \uC18D\uC131\uC740 ''{0}'' \uC694\uC18C\uC5D0 \uB098\uD0C0\uB098\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
++ cvc-elt.2 = cvc-elt.2: ''{0}''\uC5D0 \uB300\uD55C \uC694\uC18C \uC120\uC5B8\uC5D0\uC11C '{'abstract'}'\uC758 \uAC12\uC740 false\uC5EC\uC57C \uD569\uB2C8\uB2E4.
++ cvc-elt.3.1 = cvc-elt.3.1: ''{0}''\uC758 '{'nillable'}' \uC18D\uC131\uC774 false\uC774\uBBC0\uB85C ''{1}'' \uC18D\uC131\uC740 ''{0}'' \uC694\uC18C\uC5D0 \uB098\uD0C0\uB098\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: ''{1}''\uC774(\uAC00) \uC9C0\uC815\uB418\uC5C8\uC73C\uBBC0\uB85C ''{0}'' \uC694\uC18C\uC5D0\uB294 \uBB38\uC790 \uB610\uB294 \uC694\uC18C \uC815\uBCF4 [children]\uC774 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: ''{1}''\uC774(\uAC00) \uC9C0\uC815\uB418\uC5C8\uC73C\uBBC0\uB85C ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD574 \uACE0\uC815\uB41C ''{''value constraint''}''\uAC00 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: ''{1}''\uC774(\uAC00) \uC9C0\uC815\uB418\uC5C8\uC73C\uBBC0\uB85C ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD574 \uACE0\uC815\uB41C '{'value constraint'}'\uAC00 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cvc-elt.4.1 = cvc-elt.4.1: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uC18D\uC131\uC5D0 \uB300\uD55C ''{2}'' \uAC12\uC740 \uC801\uD569\uD55C QName\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cvc-elt.4.2 = cvc-elt.4.2: ''{1}''\uC744(\uB97C) ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD55C \uC720\uD615 \uC815\uC758\uB85C \uBD84\uC11D\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ cvc-elt.4.3 = cvc-elt.4.3: ''{1}'' \uC720\uD615\uC740 ''{0}'' \uC694\uC18C\uC758 \uC720\uD615 \uC815\uC758 ''{2}''\uC5D0\uC11C \uC801\uD569\uD558\uAC8C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: ''{0}'' \uC694\uC18C\uC758 ''{''value constraint''}'' ''{2}''\uC740(\uB294) ''{1}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAE30\uBCF8\uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: ''{0}'' \uC694\uC18C\uC758 '{'value constraint'}' ''{2}''\uC740(\uB294) ''{1}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAE30\uBCF8\uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: ''{0}'' \uC694\uC18C\uC5D0\uB294 \uC694\uC18C \uC815\uBCF4 \uD56D\uBAA9 [children]\uC774 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uAC12\uC774 \uACE0\uC815\uB41C ''{''value constraint''}'' \uAC12 ''{2}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uAC12\uC774 ''{''value constraint''}'' \uAC12 ''{2}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uAC12\uC774 \uACE0\uC815\uB41C '{'value constraint'}' \uAC12 ''{2}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: ''{0}'' \uC694\uC18C\uC758 ''{1}'' \uAC12\uC774 '{'value constraint'}' \uAC12 ''{2}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+ cvc-enumeration-valid = cvc-enumeration-valid: ''{0}'' \uAC12\uC740 ''{1}'' \uBAA9\uB85D\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uBA74\uC774 \uC544\uB2D9\uB2C8\uB2E4. \uBAA9\uB85D\uC758 \uAC12\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: ''{0}'' \uAC12\uC758 \uC18C\uC218\uC810 \uC774\uD558 \uC790\uB9BF\uC218\uAC00 {1}\uC774\uC9C0\uB9CC \uC18C\uC218\uC810 \uC774\uD558 \uC790\uB9BF\uC218\uB294 {2}(\uC73C)\uB85C \uC81C\uD55C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ cvc-id.1 = cvc-id.1: IDREF ''{0}''\uC5D0 \uB300\uD55C ID/IDREF \uBC14\uC778\uB529\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: accessExternalSchema \uC18D\uC131\uC73C\uB85C \uC124\uC815\uB41C \uC81C\uD55C\uC73C\uB85C \uC778\uD574 ''{1}'' \uC561\uC138\uC2A4\uAC00 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC73C\uBBC0\uB85C \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}'' \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+ schema_reference.4 = schema_reference.4: \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}'' \uC77D\uAE30\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uC6D0\uC778: 1) \uBB38\uC11C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. 2) \uBB38\uC11C\uB97C \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. 3) \uBB38\uC11C\uC758 \uB8E8\uD2B8 \uC694\uC18C\uAC00 <xsd:schema>\uAC00 \uC544\uB2D9\uB2C8\uB2E4.
+ src-annotation = src-annotation: <annotation> \uC694\uC18C\uC5D0\uB294 <appinfo> \uBC0F <documentation> \uC694\uC18C\uB9CC \uD3EC\uD568\uB420 \uC218 \uC788\uC9C0\uB9CC ''{0}''\uC774(\uAC00) \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ src-attribute.1 = src-attribute.1: ''default'' \uBC0F ''fixed'' \uC18D\uC131\uC740 \uC18D\uC131 \uC120\uC5B8 ''{0}''\uC5D0 \uD568\uAED8 \uC874\uC7AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uD558\uB098\uB9CC \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624.
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: \uC18D\uC131 \uADF8\uB8F9 ''{0}''\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774\uB984 \uBC0F \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uB3D9\uC77C\uD55C \uC911\uBCF5 \uC18D\uC131 \uC0AC\uC6A9\uC774 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC911\uBCF5 \uC18D\uC131 \uC0AC\uC6A9\uC758 \uC774\uB984\uC740 ''{1}''\uC785\uB2C8\uB2E4.
+ ag-props-correct.3 = ag-props-correct.3: \uC18D\uC131 \uADF8\uB8F9 ''{0}''\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uB450 \uAC1C\uC758 \uC18D\uC131 \uC120\uC5B8 ''{1}'' \uBC0F ''{2}''\uC5D0 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uC720\uD615\uC774 \uC788\uC2B5\uB2C8\uB2E4.
+ a-props-correct.2 = a-props-correct.2: ''{0}'' \uC18D\uC131\uC758 \uAC12 \uC81C\uC57D \uC870\uAC74 \uAC12 ''{1}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+- a-props-correct.3 = a-props-correct.3: \uC18D\uC131\uC758 ''{''type definition''}''\uC774 ID\uC774\uAC70\uB098 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774\uBBC0\uB85C ''{0}'' \uC18D\uC131\uC740 ''fixed'' \uB610\uB294 ''default''\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+- au-props-correct.2 = au-props-correct.2: ''{0}''\uC758 \uC18D\uC131 \uC120\uC5B8\uC5D0\uC11C \uACE0\uC815\uB41C \uAC12 ''{1}''\uC774(\uAC00) \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uCC38\uC870\uD558\uB294 \uC18D\uC131 \uC0AC\uC6A9\uC5D0\uB3C4 ''{''value constraint''}''\uAC00 \uC788\uC744 \uACBD\uC6B0 \uACE0\uC815\uB418\uC5B4\uC57C \uD558\uBA70 \uAC12\uC740 ''{1}''\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ a-props-correct.3 = a-props-correct.3: \uC18D\uC131\uC758 '{'type definition'}'\uC774 ID\uC774\uAC70\uB098 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774\uBBC0\uB85C ''{0}'' \uC18D\uC131\uC740 ''fixed'' \uB610\uB294 ''default''\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
++ au-props-correct.2 = au-props-correct.2: ''{0}''\uC758 \uC18D\uC131 \uC120\uC5B8\uC5D0\uC11C \uACE0\uC815\uB41C \uAC12 ''{1}''\uC774(\uAC00) \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uCC38\uC870\uD558\uB294 \uC18D\uC131 \uC0AC\uC6A9\uC5D0\uB3C4 '{'value constraint'}'\uAC00 \uC788\uC744 \uACBD\uC6B0 \uACE0\uC815\uB418\uC5B4\uC57C \uD558\uBA70 \uAC12\uC740 ''{1}''\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cos-all-limited.1.2 = cos-all-limited.1.2: 'all' \uBAA8\uB378 \uADF8\uB8F9\uC774 '{'min occurs'}' = '{'max occurs'}' = 1\uC778 \uC870\uAC01\uC5D0 \uB098\uD0C0\uB098\uC57C \uD558\uBA70 \uD574\uB2F9 \uC870\uAC01\uC740 \uBCF5\uD569 \uC720\uD615 \uC815\uC758\uC758 '{'content type'}'\uC744 \uAD6C\uC131\uD558\uB294 \uC30D\uC758 \uC77C\uBD80\uC5EC\uC57C \uD569\uB2C8\uB2E4.
+- cos-all-limited.2 = cos-all-limited.2: ''all'' \uBAA8\uB378 \uADF8\uB8F9\uC5D0 \uD3EC\uD568\uB41C \uC694\uC18C\uC758 ''{''max occurs''}''\uB294 0 \uB610\uB294 1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. ''{1}'' \uC694\uC18C\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
++ cos-all-limited.2 = cos-all-limited.2: ''all'' \uBAA8\uB378 \uADF8\uB8F9\uC5D0 \uD3EC\uD568\uB41C \uC694\uC18C\uC758 '{'max occurs'}'\uB294 0 \uB610\uB294 1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. ''{1}'' \uC694\uC18C\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+ cos-applicable-facets = cos-applicable-facets: {1} \uC720\uD615\uC5D0\uC11C\uB294 ''{0}'' \uBA74\uC774 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: ''{0}'' \uC720\uD615\uC740 ''{1}'' \uC720\uD615\uC5D0\uC11C \uD655\uC7A5\uC5D0 \uC758\uD574 \uD30C\uC0DD\uB418\uC5C8\uC9C0\uB9CC ''{1}''\uC758 ''final'' \uC18D\uC131\uC740 \uD655\uC7A5\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD569\uB2C8\uB2E4.
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: \uD30C\uC0DD\uB41C \uC720\uD615\uACFC \uD574\uB2F9 \uAE30\uBCF8 \uC720\uD615\uC758 \uCF58\uD150\uCE20 \uC720\uD615\uC740 \uBAA8\uB450 \uD63C\uD569\uB418\uAC70\uB098 \uBAA8\uB450 \uC694\uC18C \uC804\uC6A9\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. ''{0}'' \uC720\uD615\uC740 \uC694\uC18C \uC804\uC6A9\uC774\uC9C0\uB9CC \uD574\uB2F9 \uAE30\uBCF8 \uC720\uD615\uC740 \uC694\uC18C \uC804\uC6A9\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: \uD30C\uC0DD\uB41C \uC720\uD615\uACFC \uD574\uB2F9 \uAE30\uBCF8 \uC720\uD615\uC758 \uCF58\uD150\uCE20 \uC720\uD615\uC740 \uBAA8\uB450 \uD63C\uD569\uB418\uAC70\uB098 \uBAA8\uB450 \uC694\uC18C \uC804\uC6A9\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. ''{0}'' \uC720\uD615\uC740 \uD63C\uD569\uB418\uC5B4 \uC788\uC9C0\uB9CC \uD574\uB2F9 \uAE30\uBCF8 \uC720\uD615\uC740 \uD63C\uD569\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+ cos-element-consistent = cos-element-consistent: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774\uB984\uC774 ''{1}''\uC774\uBA70 \uC720\uD615\uC774 \uB2E4\uB978 \uC5EC\uB7EC \uC694\uC18C\uAC00 \uBAA8\uB378 \uADF8\uB8F9\uC5D0 \uB098\uD0C0\uB0A9\uB2C8\uB2E4.
+ cos-list-of-atomic = cos-list-of-atomic: \uBAA9\uB85D \uC720\uD615 ''{0}''\uC758 \uC815\uC758\uC5D0\uC11C ''{1}'' \uC720\uD615\uC740 \uAE30\uBCF8 \uB2E8\uC704\uAC00 \uC544\uB2C8\uBBC0\uB85C \uBD80\uC801\uD569\uD55C \uBAA9\uB85D \uC694\uC18C \uC720\uD615\uC785\uB2C8\uB2E4. ''{1}''\uC774(\uAC00) \uBAA9\uB85D \uC720\uD615\uC774\uAC70\uB098 \uBAA9\uB85D\uC744 \uD3EC\uD568\uD558\uB294 \uD569\uC9D1\uD569 \uC720\uD615\uC785\uB2C8\uB2E4.
+- cos-nonambig = cos-nonambig: {0} \uBC0F {1}(\uB610\uB294 \uD574\uB2F9 \uB300\uCCB4 \uADF8\uB8F9\uC758 \uC694\uC18C)\uC774(\uAC00) \"Unique Particle Attribution\"\uC744 \uC704\uBC18\uD569\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0 \uB300\uD55C \uAC80\uC99D \uC911 \uC774\uB7EC\uD55C \uB450 \uC870\uAC01\uC774 \uBAA8\uD638\uD574\uC9C8 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
++ cos-nonambig = cos-nonambig: {0} \uBC0F {1}(\uB610\uB294 \uD574\uB2F9 \uB300\uCCB4 \uADF8\uB8F9\uC758 \uC694\uC18C)\uC774(\uAC00) "Unique Particle Attribution"\uC744 \uC704\uBC18\uD569\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0 \uB300\uD55C \uAC80\uC99D \uC911 \uC774\uB7EC\uD55C \uB450 \uC870\uAC01\uC774 \uBAA8\uD638\uD574\uC9C8 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
+ cos-particle-restrict.a = cos-particle-restrict.a: \uD30C\uC0DD\uB41C \uC870\uAC01\uC774 \uBE44\uC5B4 \uC788\uC73C\uBBC0\uB85C \uAE30\uBCF8 \uC870\uAC01\uC744 \uBE44\uC6B8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ cos-particle-restrict.b = cos-particle-restrict.b: \uAE30\uBCF8 \uC870\uAC01\uC740 \uBE44\uC5B4 \uC788\uC9C0\uB9CC \uD30C\uC0DD\uB41C \uC870\uAC01\uC740 \uBE44\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+ cos-particle-restrict.2 = cos-particle-restrict.2: \uAE08\uC9C0\uB41C \uC870\uAC01 \uC81C\uD55C \uC0AC\uD56D: ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: ''{1}'' \uC720\uD615\uC774 \uAE30\uBCF8 \uB2E8\uC704\uC774\uBBC0\uB85C \uD574\uB2F9 ''{''base type definition''}'' ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uB2E8\uC21C \uC720\uD615 \uC815\uC758 \uB610\uB294 \uB0B4\uC7A5\uB41C \uAE30\uBCF8 \uB370\uC774\uD130 \uC720\uD615\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: ''{1}'' \uC720\uD615\uC774 \uAE30\uBCF8 \uB2E8\uC704\uC774\uBBC0\uB85C \uD574\uB2F9 '{'base type definition'}' ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uB2E8\uC21C \uC720\uD615 \uC815\uC758 \uB610\uB294 \uB0B4\uC7A5\uB41C \uAE30\uBCF8 \uB370\uC774\uD130 \uC720\uD615\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: \uBAA9\uB85D \uC720\uD615 ''{0}''\uC758 \uC815\uC758\uC5D0\uC11C ''{1}'' \uC720\uD615\uC740 \uBAA9\uB85D \uC720\uD615\uC774\uAC70\uB098 \uBAA9\uB85D\uC744 \uD3EC\uD568\uD558\uB294 \uD569\uC9D1\uD569 \uC720\uD615\uC774\uBBC0\uB85C \uBD80\uC801\uD569\uD55C \uD56D\uBAA9 \uC720\uD615\uC785\uB2C8\uB2E4.
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: ''{''item type definition''}'' ''{0}''\uC758 ''{''final''}'' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: ''{''member type definitions''}'' ''{0}''\uC758 ''{''final''}'' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''list''\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uBAA9\uB85D \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uD56D\uBAA9 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}''\uC758 '{'final'}' \uAD6C\uC131 \uC694\uC18C\uC5D0 ''union''\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC744(\uB97C) \uD569\uC9D1\uD569 \uC720\uD615 ''{1}''\uC5D0 \uB300\uD55C \uBA64\uBC84 \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ cos-valid-default.2.1 = cos-valid-default.2.1: ''{0}'' \uC694\uC18C\uC5D0 \uAC12 \uC81C\uC57D \uC870\uAC74\uC774 \uC788\uC73C\uBBC0\uB85C \uD63C\uD569 \uB610\uB294 \uB2E8\uC21C \uCF58\uD150\uCE20 \uBAA8\uB378\uC774 \uD3EC\uD568\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: ''{0}'' \uC694\uC18C\uC5D0 ''{''value constraint''}''\uAC00 \uC788\uC73C\uBA70 \uD574\uB2F9 \uC720\uD615 \uC815\uC758\uC5D0 \uD63C\uD569 ''{''content type''}''\uC774 \uC788\uC73C\uBBC0\uB85C ''{''content type''}''\uC758 \uC870\uAC01\uC744 \uBE44\uC6B8 \uC218 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: ''{0}'' \uC694\uC18C\uC5D0 '{'value constraint'}'\uAC00 \uC788\uC73C\uBA70 \uD574\uB2F9 \uC720\uD615 \uC815\uC758\uC5D0 \uD63C\uD569 '{'content type'}'\uC774 \uC788\uC73C\uBBC0\uB85C '{'content type'}'\uC758 \uC870\uAC01\uC744 \uBE44\uC6B8 \uC218 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ c-props-correct.2 = c-props-correct.2: keyref ''{0}''\uACFC(\uC640) \uD0A4 ''{1}''\uC5D0 \uB300\uD55C \uD544\uB4DC \uAE30\uC218\uB294 \uC11C\uB85C \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4.
+ ct-props-correct.3 = ct-props-correct.3: \uBCF5\uD569 \uC720\uD615 ''{0}''\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC740(\uB294) \uACE0\uC720\uD55C \uC720\uD615 \uACC4\uCE35\uC5D0 \uD3EC\uD568\uB41C \uAC83\uC774\uBA70 \uC774\uB294 \uC624\uB958\uC785\uB2C8\uB2E4.
+ ct-props-correct.4 = ct-props-correct.4: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774\uB984 \uBC0F \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uB3D9\uC77C\uD55C \uC911\uBCF5 \uC18D\uC131 \uC0AC\uC6A9\uC774 \uC9C0\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC911\uBCF5 \uC18D\uC131 \uC0AC\uC6A9\uC758 \uC774\uB984\uC740 ''{1}''\uC785\uB2C8\uB2E4.
+ ct-props-correct.5 = ct-props-correct.5: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uB450 \uAC1C\uC758 \uC18D\uC131 \uC120\uC5B8 ''{1}'' \uBC0F ''{2}''\uC5D0 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uC720\uD615\uC774 \uC788\uC2B5\uB2C8\uB2E4.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: ''{0}'' \uC720\uD615\uC740 ''{1}'' \uC720\uD615\uC5D0\uC11C \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD574 \uD30C\uC0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uC9C0\uB9CC ''{1}''\uC5D0\uB294 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD558\uB294 ''{''final''}'' \uC18D\uC131\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: ''{0}'' \uC720\uD615\uC740 ''{1}'' \uC720\uD615\uC5D0\uC11C \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD574 \uD30C\uC0DD\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD558\uC9C0\uB9CC ''{1}''\uC5D0\uB294 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD558\uB294 '{'final'}' \uC18D\uC131\uC774 \uC788\uC2B5\uB2C8\uB2E4.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774 \uC720\uD615\uC758 \uC18D\uC131 \uC0AC\uC6A9 ''{1}''\uC5D0 \uB300\uD55C ''use'' \uAC12\uC774 ''{2}''\uC785\uB2C8\uB2E4. \uC774\uB294 \uAE30\uBCF8 \uC720\uD615\uC758 \uC77C\uCE58\uD558\uB294 \uC18D\uC131 \uC0AC\uC6A9\uC5D0 \uB300\uD55C \uAC12\uC778 ''required''\uC640 \uB2E4\uB985\uB2C8\uB2E4.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774 \uC720\uD615\uC758 \uC18D\uC131 \uC0AC\uC6A9 ''{1}''\uC5D0 \uB300\uD55C \uC720\uD615\uC774 ''{2}''\uC785\uB2C8\uB2E4. \uC774\uB294 \uAE30\uBCF8 \uC720\uD615\uC758 \uC77C\uCE58\uD558\uB294 \uC18D\uC131 \uC0AC\uC6A9\uC5D0 \uB300\uD55C \uC720\uD615\uC778 ''{3}''\uC5D0\uC11C \uC801\uD569\uD558\uAC8C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774 \uC720\uD615\uC758 \uC18D\uC131 \uC0AC\uC6A9 ''{1}''\uC5D0\uB294 \uACE0\uC815\uB418\uC9C0 \uC54A\uC740 \uC720\uD6A8\uD55C \uAC12 \uC81C\uC57D \uC870\uAC74\uC774 \uC788\uC73C\uBA70, \uAE30\uBCF8 \uC720\uD615\uC758 \uC77C\uCE58\uD558\uB294 \uC18D\uC131 \uC0AC\uC6A9\uC5D0 \uB300\uD55C \uC720\uD6A8\uD55C \uAC12 \uC81C\uC57D \uC870\uAC74\uC740 \uACE0\uC815\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: {2} ''{1}''\uC5D0 \uC0AC\uC6A9\uB418\uB294 NOTATION \uC720\uD615 ''{0}''\uC5D0\uB294 \uC774 \uC720\uD615\uC5D0 \uC0AC\uC6A9\uB418\uB294 \uD45C\uAE30\uBC95 \uC694\uC18C\uB97C \uC9C0\uC815\uD558\uB294 \uBAA9\uB85D \uBA74 \uAC12\uC774 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ enumeration-valid-restriction = enumeration-valid-restriction: \uBAA9\uB85D \uAC12 ''{0}''\uC774(\uAC00) \uAE30\uBCF8 \uC720\uD615 {1}\uC758 \uAC12 \uACF5\uAC04\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4.
+ e-props-correct.2 = e-props-correct.2: ''{0}'' \uC694\uC18C\uC758 \uAC12 \uC81C\uC57D \uC870\uAC74 \uAC12 ''{1}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+- e-props-correct.4 = e-props-correct.4: ''{0}'' \uC694\uC18C\uC758 ''{''type definition''}''\uC774 substitutionHead ''{1}''\uC758 ''{''type definition''}''\uC5D0\uC11C \uC801\uD569\uD558\uAC8C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2C8\uAC70\uB098 ''{1}''\uC758 ''{''substitution group exclusions''}'' \uC18D\uC131\uC774 \uC774 \uD30C\uC0DD\uC744 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
+- e-props-correct.5 = e-props-correct.5: \uC694\uC18C\uC758 ''{''type definition''}'' \uB610\uB294 ''{''type definition''}''\uC758 ''{''content type''}''\uC774 ID\uC774\uAC70\uB098 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774\uBBC0\uB85C ''{''value constraint''}''\uB294 ''{0}'' \uC694\uC18C\uC5D0 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
++ e-props-correct.4 = e-props-correct.4: ''{0}'' \uC694\uC18C\uC758 '{'type definition'}'\uC774 substitutionHead ''{1}''\uC758 '{'type definition'}'\uC5D0\uC11C \uC801\uD569\uD558\uAC8C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2C8\uAC70\uB098 ''{1}''\uC758 '{'substitution group exclusions'}' \uC18D\uC131\uC774 \uC774 \uD30C\uC0DD\uC744 \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
++ e-props-correct.5 = e-props-correct.5: \uC694\uC18C\uC758 '{'type definition'}' \uB610\uB294 '{'type definition'}'\uC758 '{'content type'}'\uC774 ID\uC774\uAC70\uB098 ID\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774\uBBC0\uB85C '{'value constraint'}'\uB294 ''{0}'' \uC694\uC18C\uC5D0 \uC5C6\uC5B4\uC57C \uD569\uB2C8\uB2E4.
+ e-props-correct.6 = e-props-correct.6: ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD55C \uC21C\uD658 \uB300\uCCB4 \uADF8\uB8F9\uC774 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4..
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''fractionDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{1}''(\uC73C)\uB85C \uC124\uC815\uB41C ''fractionDigits''\uC5D0 \uB300\uD55C \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+ fractionDigits-totalDigits = fractionDigits-totalDigits: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''fractionDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 ''totalDigits''\uC5D0 \uB300\uD55C \uAC12\uC778 ''{1}''\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: ''{2}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. maxInclusive \uAC12 = ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uC720\uD615 ''{1}''\uC758 minInclusive\uBCF4\uB2E4 \uD06C\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: ''{2}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. maxInclusive \uAC12 = ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uC720\uD615 ''{1}''\uC758 minExclusive\uBCF4\uB2E4 \uCEE4\uC57C \uD569\uB2C8\uB2E4.
+ maxLength-valid-restriction = maxLength-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C maxLength \uAC12 = ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uC720\uD615 ''{1}''\uC758 \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+- mg-props-correct.2 = mg-props-correct.2: ''{0}'' \uADF8\uB8F9\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC21C\uD658\uC801\uC73C\uB85C \uB4A4\uC5D0 \uC624\uB294 ''{''term''}'' \uC870\uAC01 \uAC12\uC774 ''{''term''}''\uC774 \uADF8\uB8F9 \uC790\uC2E0\uC778 \uC870\uAC01\uC5D0 \uB3C4\uB2EC\uD569\uB2C8\uB2E4.
++ mg-props-correct.2 = mg-props-correct.2: ''{0}'' \uADF8\uB8F9\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC21C\uD658\uC801\uC73C\uB85C \uB4A4\uC5D0 \uC624\uB294 '{'term'}' \uC870\uAC01 \uAC12\uC774 '{'term'}'\uC774 \uADF8\uB8F9 \uC790\uC2E0\uC778 \uC870\uAC01\uC5D0 \uB3C4\uB2EC\uD569\uB2C8\uB2E4.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: {2}\uC758 \uC815\uC758\uC5D0\uC11C minExclusive \uAC12 = ''{0}''\uC740(\uB294) maxExclusive \uAC12 = ''{1}''\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: {2}\uC758 \uC815\uC758\uC5D0\uC11C minExclusive \uAC12 = ''{0}''\uC740(\uB294) maxInclusive \uAC12 = ''{1}''\uBCF4\uB2E4 \uC791\uC544\uC57C \uD569\uB2C8\uB2E4.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: ''{2}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. minExclusive \uAC12 = ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uC720\uD615 ''{1}''\uC758 minExclusive\uBCF4\uB2E4 \uD06C\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: {2}\uC758 \uC815\uC758\uC5D0\uC11C minLength \uAC12 = ''{0}''\uC740(\uB294) maxLength \uAC12 = ''{1}''\uBCF4\uB2E4 \uC791\uC544\uC57C \uD569\uB2C8\uB2E4.
+ minLength-valid-restriction = minLength-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C minLength = ''{0}''\uC740(\uB294) \uAE30\uBCF8 \uC720\uD615 ''{1}''\uC758 \uAC12\uBCF4\uB2E4 \uD06C\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+ no-xmlns = no-xmlns: \uC18D\uC131 \uC120\uC5B8\uC758 {name}\uC740 'xmlns'\uC640 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
+- no-xsi = no-xsi: \uC18D\uC131 \uC120\uC5B8\uC758 ''{''target namespace''}''\uB294 ''{0}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
++ no-xsi = no-xsi: \uC18D\uC131 \uC120\uC5B8\uC758 '{'target namespace'}'\uB294 ''{0}''\uACFC(\uC640) \uC77C\uCE58\uD558\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
+ p-props-correct.2.1 = p-props-correct.2.1: ''{0}''\uC758 \uC120\uC5B8\uC5D0\uC11C ''minOccurs'' \uAC12\uC774 ''{1}''\uC774\uC9C0\uB9CC \uC774 \uAC12\uC740 ''maxOccurs'' \uAC12 ''{2}''\uBCF4\uB2E4 \uD06C\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: \uC870\uAC01 \uAC04 \uC804\uCCB4 \uAE30\uB2A5 \uB9E4\uD551\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: \uADF8\uB8F9\uC758 \uBC1C\uC0DD \uBC94\uC704({0},{1})\uAC00 \uAE30\uBCF8 \uADF8\uB8F9\uC758 \uBC1C\uC0DD \uBC94\uC704({2},{3})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: \uC694\uC18C\uC5D0 \uB3D9\uC77C\uD558\uC9C0 \uC54A\uC740 \uC774\uB984 \uBC0F \uB300\uC0C1 \uB124\uC784\uC2A4\uD398\uC774\uC2A4(''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 ''{0}'' \uC694\uC18C \uBC0F ''{3}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC758 ''{2}'' \uC694\uC18C)\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: ''{''term''}''\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC694\uC18C \uC120\uC5B8\uC758 ''{''nillable''}''\uC774 true\uC774\uC9C0\uB9CC \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uC870\uAC01\uC5D0 ''{''nillable''}''\uC774 false\uC778 \uC694\uC18C \uC120\uC5B8\uC774 \uC788\uC2B5\uB2C8\uB2E4.
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: ''{''term''}''\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uBC18\uBCF5 \uBC94\uC704({1},{2})\uAC00 \uAE30\uBCF8 \uC720\uD615\uC5D0 \uC788\uB294 \uD574\uB2F9 \uC870\uAC01\uC758 \uBC94\uC704({3},{4})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: '{'term'}'\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uC694\uC18C \uC120\uC5B8\uC758 '{'nillable'}'\uC774 true\uC774\uC9C0\uB9CC \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uC870\uAC01\uC5D0 '{'nillable'}'\uC774 false\uC778 \uC694\uC18C \uC120\uC5B8\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: '{'term'}'\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uBC18\uBCF5 \uBC94\uC704({1},{2})\uAC00 \uAE30\uBCF8 \uC720\uD615\uC5D0 \uC788\uB294 \uD574\uB2F9 \uC870\uAC01\uC758 \uBC94\uC704({3},{4})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: ''{0}'' \uC694\uC18C\uB294 \uACE0\uC815\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC9C0\uB9CC \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uC694\uC18C\uB294 ''{1}'' \uAC12\uC73C\uB85C \uACE0\uC815\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: ''{0}'' \uC694\uC18C\uB294 ''{1}'' \uAC12\uC73C\uB85C \uACE0\uC815\uB418\uC5B4 \uC788\uC9C0\uB9CC \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uC694\uC18C\uB294 ''{2}'' \uAC12\uC73C\uB85C \uACE0\uC815\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD55C ID \uC81C\uC57D \uC870\uAC74\uC740 \uAE30\uBCF8 \uC720\uD615\uC758 ID \uC81C\uC57D \uC870\uAC74\uC5D0 \uB300\uD55C \uBD80\uBD84 \uC9D1\uD569\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: ''{0}'' \uC694\uC18C\uC5D0 \uB300\uD574 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uB294 \uB300\uCCB4\uB294 \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uB300\uCCB4\uC5D0 \uB300\uD55C \uB300\uC9D1\uD569\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: ''{0}'' \uC694\uC18C\uC758 \uC720\uD615 ''{1}''\uC740(\uB294) \uAE30\uBCF8 \uC694\uC18C\uC758 \uC720\uD615 ''{2}''\uC5D0\uC11C \uD30C\uC0DD\uB41C \uAC83\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NSCompat.1 = rcase-NSCompat.1: ''{0}'' \uC694\uC18C\uC5D0\uB294 \uAE30\uBCF8 \uC720\uD615\uC758 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790\uC5D0\uC11C \uD5C8\uC6A9\uD558\uC9C0 \uC54A\uB294 ''{1}'' \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC788\uC2B5\uB2C8\uB2E4.
+- rcase-NSCompat.2 = rcase-NSCompat.2: ''{''term''}''\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uBC18\uBCF5 \uBC94\uC704({1},{2})\uAC00 \uAE30\uBCF8 \uC720\uD615\uC5D0 \uC788\uB294 \uD574\uB2F9 \uC870\uAC01\uC758 \uBC94\uC704({3},{4})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
++ rcase-NSCompat.2 = rcase-NSCompat.2: '{'term'}'\uC774 \uC694\uC18C \uC120\uC5B8 ''{0}''\uC778 \uC870\uAC01\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uBC18\uBCF5 \uBC94\uC704({1},{2})\uAC00 \uAE30\uBCF8 \uC720\uD615\uC5D0 \uC788\uB294 \uD574\uB2F9 \uC870\uAC01\uC758 \uBC94\uC704({3},{4})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: \uC870\uAC01 \uAC04 \uC804\uCCB4 \uAE30\uB2A5 \uB9E4\uD551\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: \uADF8\uB8F9\uC758 \uBC1C\uC0DD \uBC94\uC704({0},{1})\uAC00 \uAE30\uBCF8 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790\uC758 \uBC94\uC704({2},{3})\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC81C\uD55C \uC0AC\uD56D\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ rcase-NSSubset.1 = rcase-NSSubset.1: \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790\uAC00 \uAE30\uBCF8 \uC720\uD615\uC758 \uD574\uB2F9 \uC640\uC77C\uB4DC \uCE74\uB4DC \uBB38\uC790\uC5D0 \uB300\uD55C \uBD80\uBD84 \uC9D1\uD569\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB3D9\uC77C\uD55C \uC774\uB984\uC744 \uAC00\uC9C4 \uB450 \uAC1C\uC758 \uC804\uC5ED \uAD6C\uC131 \uC694\uC18C\uAC00 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uC2A4\uD0A4\uB9C8\uC5D0\uB294 \uB450 \uAC1C\uC758 ''{0}''\uC774(\uAC00) \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.
+ st-props-correct.2 = st-props-correct.2: \uB2E8\uC21C \uC720\uD615 ''{0}''\uC5D0 \uB300\uD55C \uC21C\uD658 \uC815\uC758\uAC00 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uB530\uB77C\uC11C ''{0}''\uC740(\uB294) \uACE0\uC720\uD55C \uC720\uD615 \uACC4\uCE35\uC5D0 \uD3EC\uD568\uB41C \uAC83\uC774\uBA70 \uC774\uB294 \uC624\uB958\uC785\uB2C8\uB2E4.
+- st-props-correct.3 = st-props-correct.3: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. ''{''base type definition''}'' ''{1}''\uC758 ''{''final''}'' \uAC12\uC740 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD569\uB2C8\uB2E4.
++ st-props-correct.3 = st-props-correct.3: ''{0}'' \uC720\uD615\uC5D0 \uB300\uD574 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. '{'base type definition'}' ''{1}''\uC758 '{'final'}' \uAC12\uC740 \uC81C\uD55C \uC0AC\uD56D\uC5D0 \uC758\uD55C \uD30C\uC0DD\uC744 \uAE08\uC9C0\uD569\uB2C8\uB2E4.
+ totalDigits-valid-restriction = totalDigits-valid-restriction: {2}\uC758 \uC815\uC758\uC5D0\uC11C ''totalDigits'' \uBA74\uC5D0 \uB300\uD55C ''{0}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC774 \uAC12\uC740 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{1}''(\uC73C)\uB85C \uC124\uC815\uB41C ''totalDigits''\uC5D0 \uB300\uD55C \uAC12\uBCF4\uB2E4 \uC791\uAC70\uB098 \uAC19\uC544\uC57C \uD569\uB2C8\uB2E4.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: {0}\uC758 \uC815\uC758\uC5D0\uC11C ''whitespace'' \uBA74\uC5D0 \uB300\uD55C ''{1}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. ''whitespace''\uC5D0 \uB300\uD55C \uAC12\uC774 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''collapse''\uB85C \uC124\uC815\uB418\uC5C8\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: {0}\uC758 \uC815\uC758\uC5D0\uC11C ''whitespace'' \uBA74\uC5D0 \uB300\uD55C ''preserve'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. ''whitespace''\uC5D0 \uB300\uD55C \uAC12\uC774 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''replace''\uB85C \uC124\uC815\uB418\uC5C8\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath: \uC120\uD0DD\uAE30 \uAC12 = ''{0}''\uC774(\uAC00) \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC120\uD0DD\uAE30 XPath\uC5D0\uB294 \uC18D\uC131\uC774 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ EmptyTargetNamespace = EmptyTargetNamespace: \uC2A4\uD0A4\uB9C8 \uBB38\uC11C ''{0}''\uC758 ''targetNamespace'' \uC18D\uC131\uAC12\uC740 \uBE48 \uBB38\uC790\uC5F4\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FacetValueFromBase = FacetValueFromBase: ''{0}'' \uC720\uD615\uC758 \uC120\uC5B8\uC5D0\uC11C ''{2}'' \uBA74\uC758 ''{1}'' \uAC12\uC740 \uAE30\uBCF8 \uC720\uD615 ''{3}''\uC758 \uAC12 \uACF5\uBC31\uC5D0\uC11C \uC640\uC57C \uD569\uB2C8\uB2E4.
+- FixedFacetValue = FixedFacetValue: {3}\uC758 \uC815\uC758\uC5D0\uC11C ''{0}'' \uBA74\uC5D0 \uB300\uD55C ''{1}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. ''{0}''\uC5D0 \uB300\uD55C \uAC12\uC774 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{2}''(\uC73C)\uB85C \uC124\uC815\uB418\uC5C8\uC73C\uBA70 ''{''fixed''}'' = true\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.
++ FixedFacetValue = FixedFacetValue: {3}\uC758 \uC815\uC758\uC5D0\uC11C ''{0}'' \uBA74\uC5D0 \uB300\uD55C ''{1}'' \uAC12\uC774 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. ''{0}''\uC5D0 \uB300\uD55C \uAC12\uC774 \uC870\uC0C1 \uC720\uD615 \uC911 \uD558\uB098\uC5D0\uC11C ''{2}''(\uC73C)\uB85C \uC124\uC815\uB418\uC5C8\uC73C\uBA70 '{'fixed'}' = true\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.
+ InvalidRegex = InvalidRegex: \uD328\uD134 \uAC12 ''{0}''\uC740(\uB294) \uC801\uD569\uD55C \uC815\uADDC \uD45C\uD604\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4. ''{2}'' \uC5F4\uC5D0\uC11C ''{1}'' \uC624\uB958\uAC00 \uBCF4\uACE0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+ maxOccurLimit = \uAD6C\uBB38 \uBD84\uC11D\uAE30\uC758 \uD604\uC7AC \uAD6C\uC131\uC5D0\uC11C maxOccurs \uC18D\uC131\uAC12\uC744 {0} \uAC12\uBCF4\uB2E4 \uD06C\uAC8C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ PublicSystemOnNotation = PublicSystemOnNotation: \uD558\uB098 \uC774\uC0C1\uC758 ''public''\uACFC ''system''\uC774 ''notation'' \uC694\uC18C\uC5D0 \uB098\uD0C0\uB098\uC57C \uD569\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+ FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = Erro de Restri\u00E7\u00E3o de identidade (cvc-identity-constraint.4.2.1): o elemento \"{0}\" tem uma chave sem valor.
+- DuplicateField = Correspond\u00EAncia duplicada no escopo do campo \"{0}\".
+- DuplicateKey = Valor da chave duplicado [{0}] declarado para a restri\u00E7\u00E3o de identidade do elemento \"{1}\".
+- DuplicateUnique = Valor exclusivo duplicado [{0}] declarado para a restri\u00E7\u00E3o de identidade do elemento \"{1}\".
+- FieldMultipleMatch = Erro de restri\u00E7\u00E3o de identidade: o campo \"{0}\" corresponde a mais de um valor no escopo deste seletor; os campos devem corresponder a valores exclusivos.
+- FixedDiffersFromActual = O conte\u00FAdo deste elemento n\u00E3o \u00E9 equivalente ao valor do atributo \"fixed\" na declara\u00E7\u00E3o do elemento do esquema.
+- KeyMatchesNillable = Erro de restri\u00E7\u00E3o de identidade (cvc-identity-constraint.4.2.3): o elemento \"{0}\" tem uma chave que corresponde a um elemento o qual tem anul\u00E1vel definido como verdadeiro.
+- KeyNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade de <key name=\"{1}\"> especificada para o elemento \"{0}\".
++ AbsentKeyValue = Erro de Restri\u00E7\u00E3o de identidade (cvc-identity-constraint.4.2.1): o elemento "{0}" tem uma chave sem valor.
++ DuplicateField = Correspond\u00EAncia duplicada no escopo do campo "{0}".
++ DuplicateKey = Valor da chave duplicado [{0}] declarado para a restri\u00E7\u00E3o de identidade do elemento "{1}".
++ DuplicateUnique = Valor exclusivo duplicado [{0}] declarado para a restri\u00E7\u00E3o de identidade do elemento "{1}".
++ FieldMultipleMatch = Erro de restri\u00E7\u00E3o de identidade: o campo "{0}" corresponde a mais de um valor no escopo deste seletor; os campos devem corresponder a valores exclusivos.
++ FixedDiffersFromActual = O conte\u00FAdo deste elemento n\u00E3o \u00E9 equivalente ao valor do atributo "fixed" na declara\u00E7\u00E3o do elemento do esquema.
++ KeyMatchesNillable = Erro de restri\u00E7\u00E3o de identidade (cvc-identity-constraint.4.2.3): o elemento "{0}" tem uma chave que corresponde a um elemento o qual tem anul\u00E1vel definido como verdadeiro.
++ KeyNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade de <key name="{1}"> especificada para o elemento "{0}".
+ KeyNotFound = Chave ''{0}'' com valor ''{1}'' n\u00E3o encontrada para a restri\u00E7\u00E3o de identidade do elemento ''{2}''.
+- KeyRefNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade de <keyref name=\"{1}\"> especificada para o elemento \"{0}\".
+- KeyRefOutOfScope = Erro de restri\u00E7\u00E3o de identidade: a restri\u00E7\u00E3o de identidade \"{0}\" tem uma keyref que se refere a uma chave exclusiva a qual est\u00E1 fora do escopo.
+- KeyRefReferNotFound = A declara\u00E7\u00E3o de refer\u00EAncia da chave \"{0}\" refere-se a uma chave com o nome \"{1}\".
+- UniqueNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade <unique> especificada para o elemento \"{0}\".
+- UnknownField = Erro interno de restri\u00E7\u00E3o de identidade; campo desconhecido \"{0}\".
++ KeyRefNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade de <keyref name="{1}"> especificada para o elemento "{0}".
++ KeyRefOutOfScope = Erro de restri\u00E7\u00E3o de identidade: a restri\u00E7\u00E3o de identidade "{0}" tem uma keyref que se refere a uma chave exclusiva a qual est\u00E1 fora do escopo.
++ KeyRefReferNotFound = A declara\u00E7\u00E3o de refer\u00EAncia da chave "{0}" refere-se a uma chave com o nome "{1}".
++ UniqueNotEnoughValues = N\u00E3o h\u00E1 valores suficientes especificados para a restri\u00E7\u00E3o de identidade <unique> especificada para o elemento "{0}".
++ UnknownField = Erro interno de restri\u00E7\u00E3o de identidade; campo desconhecido "{0}".
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: O valor ''{2}'' do atributo ''{1}'' no elemento ''{0}'' n\u00E3o \u00E9 v\u00E1lido em rela\u00E7\u00E3o ao seu tipo, ''{3}''.
+- cvc-attribute.4 = cvc-attribute.4: O valor ''{2}'' do atributo ''{1}'' no elemento ''{0}'' n\u00E3o \u00E9 v\u00E1lido em rela\u00E7\u00E3o \u00E0 sua ''{''value constraint''}'' fixa. O atributo deve ter um valor ''{3}''.
++ cvc-attribute.4 = cvc-attribute.4: O valor ''{2}'' do atributo ''{1}'' no elemento ''{0}'' n\u00E3o \u00E9 v\u00E1lido em rela\u00E7\u00E3o \u00E0 sua '{'value constraint'}' fixa. O atributo deve ter um valor ''{3}''.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: O elemento ''{0}'' n\u00E3o deve ter um caractere ou um item com informa\u00E7\u00F5es do elemento [children] porque o tipo de conte\u00FAdo do tipo \u00E9 vazio.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: O elemento ''{0}'' n\u00E3o deve ter um elemento [children] e o valor deve ser v\u00E1lido.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: O elemento ''{0}'' n\u00E3o pode ter um caractere [children] porque o tipo de conte\u00FAdo do tipo \u00E9 somente elemento.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: O atributo ''{1}'' n\u00E3o pode aparecer no elemento ''{0}''.
+ cvc-complex-type.4 = cvc-complex-type.4: O atributo ''{1}'' deve aparecer no elemento ''{0}''.
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: No elemento ''{0}'', o atributo ''{1}'' \u00E9 um ID Curinga, mas j\u00E1 existe um ID Curinga ''{2}''. Pode haver somente um.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: No elemento, ''{0}'', o atributo ''{1}'' \u00E9 um ID Curinga, mas j\u00E1 existe um atributo ''{2}'' obtido do ID entre os ''{''attribute uses''}''.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: No elemento, ''{0}'', o atributo ''{1}'' \u00E9 um ID Curinga, mas j\u00E1 existe um atributo ''{2}'' obtido do ID entre os '{'attribute uses'}'.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' n\u00E3o \u00E9 um valor v\u00E1lido para ''{1}''.
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' n\u00E3o \u00E9 um valor v\u00E1lido do tipo de lista ''{1}''.
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' n\u00E3o \u00E9 um valor v\u00E1lido do tipo de uni\u00E3o ''{1}''.
+ cvc-elt.1 = cvc-elt.1: N\u00E3o pode localizar a declara\u00E7\u00E3o do elemento ''{0}''.
+ cvc-elt.2 = cvc-elt.2: O valor de "{"abstract"}" na declara\u00E7\u00E3o do elemento para ''{0}'' deve ser falso.
+- cvc-elt.3.1 = cvc-elt.3.1: O atributo ''{1}'' n\u00E3o deve aparecer no elemento ''{0}'' porque a propriedade ''{''nillable''}'' de ''{0}'' \u00E9 falsa.
++ cvc-elt.3.1 = cvc-elt.3.1: O atributo ''{1}'' n\u00E3o deve aparecer no elemento ''{0}'' porque a propriedade '{'nillable'}' de ''{0}'' \u00E9 falsa.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: O elemento ''{0}'' n\u00E3o pode ter informa\u00E7\u00F5es de caractere ou de elemento [children] porque ''{1}'' foi especificado.
+ cvc-elt.3.2.2 = cvc-elt.3.2.2: N\u00E3o deve haver "{"value constraint"}" fixo para o elemento ''{0}'' porque ''{1}'' foi especificado.
+ cvc-elt.4.1 = cvc-elt.4.1: O valor ''{2}'' do atributo ''{1}'' do elemento ''{0}'' n\u00E3o \u00E9 um QName v\u00E1lido.
+ cvc-elt.4.2 = cvc-elt.4.2: N\u00E3o \u00E9 poss\u00EDvel resolver ''{1}'' para uma defini\u00E7\u00E3o de tipo de elemento ''{0}''.
+ cvc-elt.4.3 = cvc-elt.4.3: O tipo ''{1}'' n\u00E3o \u00E9 obtido de forma v\u00E1lida da defini\u00E7\u00E3o do tipo, ''{2}'', do elemento ''{0}''.
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: "{"value constraint"}" ''{2}'' do elemento ''{0}'' n\u00E3o \u00E9 um valor default v\u00E1lido para o tipo ''{1}''.
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: "{"value constraint"}" ''{2}'' do elemento ''{0}'' n\u00E3o \u00E9 um valor padr\u00E3o v\u00E1lido para o tipo ''{1}''.
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: O elemento ''{0}'' n\u00E3o deve ter item de informa\u00E7\u00F5es do elemento [children].
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: O valor ''{1}'' do elemento ''{0}'' n\u00E3o corresponde ao valor fixo de ''{''value constraint''}'' ''{2}''.
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: O valor ''{1}'' do elemento ''{0}'' n\u00E3o corresponde ao valor de ''{''value constraint''}'' ''{2}'' .
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: O valor ''{1}'' do elemento ''{0}'' n\u00E3o corresponde ao valor fixo de '{'value constraint'}' ''{2}''.
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: O valor ''{1}'' do elemento ''{0}'' n\u00E3o corresponde ao valor de '{'value constraint'}' ''{2}'' .
+ cvc-enumeration-valid = cvc-enumeration-valid: O valor ''{0}'' n\u00E3o tem um aspecto v\u00E1lido em rela\u00E7\u00E3o \u00E0 enumera\u00E7\u00E3o ''{1}''. Deve ser um valor da enumera\u00E7\u00E3o.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: O valor ''{0}'' tem {1} d\u00EDgitos fracion\u00E1rios, mas o n\u00FAmero de d\u00EDgitos fracion\u00E1rios foi limitado a {2}.
+ cvc-id.1 = cvc-id.1: N\u00E3o h\u00E1 associa\u00E7\u00E3o de ID/IDREF para IDREF ''{0}''.
+@@ -114,11 +86,11 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: falha ao ler o documento de esquema ''{0}'' porque o acesso a ''{1}'' n\u00E3o \u00E9 permitido em decorr\u00EAncia de uma restri\u00E7\u00E3o definida pela propriedade accessExternalSchema.
+ schema_reference.4 = schema_reference.4: Falha ao ler o documento do esquema ''{0}'' porque 1) n\u00E3o foi poss\u00EDvel encontrar o documento; 2) n\u00E3o foi poss\u00EDvel ler o documento; 3) o elemento-raiz do documento n\u00E3o \u00E9 <xsd:schema>.
+ src-annotation = src-annotation: os elementos de <annotation> podem conter somente os elementos <appinfo> e <documentation>, mas foi encontrado ''{0}''.
+- src-attribute.1 = src-attribute.1: As propriedades ''default'' e ''fixed'' n\u00E3o podem estar presentes na declara\u00E7\u00E3o do atributo ''{0}''. Use somente uma delas.
+- src-attribute.2 = src-attribute.2: : A propriedade ''default'' est\u00E1 presente no atributo ''{0}''. Dessa forma, o valor de ''use'' deve ser ''optional''.
++ src-attribute.1 = src-attribute.1: As propriedades ''padr\u00E3o'' e ''fixed'' n\u00E3o podem estar presentes na declara\u00E7\u00E3o do atributo ''{0}''. Use somente uma delas.
++ src-attribute.2 = src-attribute.2: : A propriedade ''padr\u00E3o'' est\u00E1 presente no atributo ''{0}''. Dessa forma, o valor de ''use'' deve ser ''optional''.
+ src-attribute.3.1 = src-attribute.3.1: 'ref' ou 'name' deve estar presente na declara\u00E7\u00E3o do atributo de local.
+ src-attribute.3.2 = src-attribute.3.2: O conte\u00FAdo deve corresponder a (annotation?) da refer\u00EAncia do atributo ''{0}''.
+ src-attribute.4 = src-attribute.4: O atributo ''{0}'' tem um atributo ''type'' e um ''simpleType'' filho an\u00F4nimo. Somente um deles \u00E9 permitido para um atributo.
+@@ -129,7 +101,7 @@
+ src-ct.2.2 = src-ct.2.2: Erro de Representa\u00E7\u00E3o de Defini\u00E7\u00E3o do Tipo Complexo do tipo ''{0}''. Quando um complexType com simpleContent \u00E9 restrito a um complexType com conte\u00FAdo misto e part\u00EDcula esvazi\u00E1vel, ent\u00E3o deve haver um <simpleType> entre os filhos de <restriction>.
+ src-ct.4 = src-ct.4: Erro de Representa\u00E7\u00E3o de Defini\u00E7\u00E3o de Tipo Complexo do tipo ''{0}''. A intersec\u00E7\u00E3o de curingas n\u00E3o \u00E9 express\u00EDvel.
+ src-ct.5 = src-ct.5: Erro de Representa\u00E7\u00E3o da Defini\u00E7\u00E3o do Tipo Complexo do tipo ''{0}''. A uni\u00E3o de curingas n\u00E3o \u00E9 express\u00EDvel.
+- src-element.1 = src-element.1: As propriedades ''default'' e ''fixed'' n\u00E3o podem estar presentes na declara\u00E7\u00E3o do elemento ''{0}''. Use somente uma delas.
++ src-element.1 = src-element.1: As propriedades ''padr\u00E3o'' e ''fixed'' n\u00E3o podem estar presentes na declara\u00E7\u00E3o do elemento ''{0}''. Use somente uma delas.
+ src-element.2.1 = src-attribute.2.1: 'ref' ou 'name' deve estar presente na declara\u00E7\u00E3o de elemento do local.
+ src-element.2.2 = src-element.2.2: Como ''{0}'' cont\u00E9m o atributo ''ref'', seu conte\u00FAdo deve ser correspondente (annotation?). No entanto, ''{1}'' foi encontrado.
+ src-element.3 = src-element.3: O elemento ''{0}'' tem um atributo ''type'' e um filho ''anonymous type''. Somente um deles \u00E9 permitido para um elemento.
+@@ -171,8 +143,8 @@
+ ag-props-correct.2 = ag-props-correct.2: Erro do grupo de atributos ''{0}''. Os usos do atributo duplicado com o mesmo nome e namespace de destino foram especificados. O nome de uso do atributo duplicado \u00E9 ''{1}''.
+ ag-props-correct.3 = ag-props-correct.3: Erro do grupo de atributos ''{0}''. Duas declara\u00E7\u00F5es de atributo ''{1}'' e ''{2}'' t\u00EAm tipos que s\u00E3o obtidos do ID.
+ a-props-correct.2 = a-props-correct.2: Valor de restri\u00E7\u00E3o inv\u00E1lido ''{1}'' no atributo ''{0}''.
+- a-props-correct.3 = a-props-correct.3: O atributo ''{0}'' n\u00E3o pode usar ''fixed'' ou ''default'' porque o ''{''type definition''}'' do atributo \u00E9 ID ou \u00E9 obtida do ID.
+- au-props-correct.2 = au-props-correct.2: Na declara\u00E7\u00E3o do atributo de ''{0}'', foi especificado um valor fixo de ''{1}''. Dessa forma, se o uso do atributo que faz refer\u00EAncia a ''{0}'' tamb\u00E9m tiver uma ''{''value constraint''}'', ele deve ser corrigido e seu valor deve ser ''{1}''.
++ a-props-correct.3 = a-props-correct.3: O atributo ''{0}'' n\u00E3o pode usar ''fixed'' ou ''padr\u00E3o'' porque o '{'type definition'}' do atributo \u00E9 ID ou \u00E9 obtida do ID.
++ au-props-correct.2 = au-props-correct.2: Na declara\u00E7\u00E3o do atributo de ''{0}'', foi especificado um valor fixo de ''{1}''. Dessa forma, se o uso do atributo que faz refer\u00EAncia a ''{0}'' tamb\u00E9m tiver uma '{'value constraint'}', ele deve ser corrigido e seu valor deve ser ''{1}''.
+ cos-all-limited.1.2 = cos-all-limited.1.2: Um grupo de modelos 'all' deve ser exibido em uma part\u00EDcula com '{'min occurs'}' = '{'max occurs'}' = 1 e essa part\u00EDcula deve fazer parte de um par que constitui o '{'content type'}' de uma defini\u00E7\u00E3o de tipo complexa.
+ cos-all-limited.2 = cos-all-limited.2: O "{"max occurs"}" de um elemento em um grupo de modelos ''all'' deve ser 0 ou 1. O valor ''{0}'' do elemento ''{1}'' \u00E9 inv\u00E1lido.
+ cos-applicable-facets = cos-applicable-facets: O aspecto ''{0}'' n\u00E3o \u00E9 permitido pelo tipo {1}.
+@@ -181,21 +153,21 @@
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: O tipo de conte\u00FAdo de um tipo derivado e sua base devem ser mistos ou ambos devem ser somente de elemento. O tipo ''{0}'' \u00E9 misto, mas seu tipo de base n\u00E3o \u00E9.
+ cos-element-consistent = cos-element-consistent: Erro do tipo ''{0}''. V\u00E1rios elementos com o nome ''{1}'' com diferentes tipos aparecem no grupo de modelos.
+ cos-list-of-atomic = cos-list-of-atomic: Na defini\u00E7\u00E3o do tipo de lista ''{0}'', o tipo ''{1}'' \u00E9 um tipo de elemento da lista inv\u00E1lido porque n\u00E3o \u00E9 at\u00F4mico (''{1}'' \u00E9 um tipo de lista ou um tipo de uni\u00E3o que cont\u00E9m uma lista).
+- cos-nonambig = cos-nonambig: {0} e {1} (ou elementos de seu grupo de substitui\u00E7\u00E3o) violam a \"Unique Particle Attribution\". Durante a valida\u00E7\u00E3o deste esquema, a ambiguidade ser\u00E1 criada para essas duas part\u00EDculas.
++ cos-nonambig = cos-nonambig: {0} e {1} (ou elementos de seu grupo de substitui\u00E7\u00E3o) violam a "Unique Particle Attribution". Durante a valida\u00E7\u00E3o deste esquema, a ambiguidade ser\u00E1 criada para essas duas part\u00EDculas.
+ cos-particle-restrict.a = cos-particle-restrict.a: A part\u00EDcula obtida est\u00E1 vazia e a base n\u00E3o pode ser esvaziada.
+ cos-particle-restrict.b = cos-particle-restrict.b: A part\u00EDcula base est\u00E1 vazia, mas a part\u00EDcula obtida n\u00E3o est\u00E1.
+ cos-particle-restrict.2 = cos-particle-restrict.2: Restri\u00E7\u00E3o de part\u00EDcula proibida: ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: O tipo ''{1}'' \u00E9 at\u00F4mico. Dessa forma, sua ''{''base type definition''}'', ''{0}'', deve ser uma defini\u00E7\u00E3o de tipo simples at\u00F4mico ou um tipo de dados primitivo criado.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: O tipo ''{1}'' \u00E9 at\u00F4mico. Dessa forma, sua '{'base type definition'}', ''{0}'', deve ser uma defini\u00E7\u00E3o de tipo simples at\u00F4mico ou um tipo de dados primitivo criado.
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: Na defini\u00E7\u00E3o do tipo de lista ''{0}'', o tipo ''{1}'' \u00E9 um tipo de item inv\u00E1lido porque \u00E9 um tipo de lista ou um tipo de uni\u00E3o que cont\u00E9m uma lista.
+ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: O componente "{"final"}" da "{"item type definition"}" ''{0}'' cont\u00E9m ''list''. Isso significa que ''{0}'' n\u00E3o pode ser usado como um tipo de item do tipo de lista ''{1}''.
+ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: O componente "{"final"}" de "{"member type definitions"}", ''{0}'', cont\u00E9m ''union''. Isso significa que ''{0}'' n\u00E3o pode ser usado como um tipo de membro do tipo de uni\u00E3o ''{1}''.
+- cos-valid-default.2.1 = cos-valid-default.2.1: O elemento ''{0}'' tem uma restri\u00E7\u00E3o de valor e deve ter um modelo de conte\u00FAdo simples ou misto.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: Como o elemento ''{0}'' tem uma ''{''value constraint''}'' e sua defini\u00E7\u00E3o de tipo tem {''content type''}'' misto, ent\u00E3o a part\u00EDcula do ''{''content type''}'' deve ser esvazi\u00E1vel.
++ cos-valid-default.2.1 = cos-valid-padr\u00E3o.2.1: O elemento ''{0}'' tem uma restri\u00E7\u00E3o de valor e deve ter um modelo de conte\u00FAdo simples ou misto.
++ cos-valid-default.2.2.2 = cos-valid-padr\u00E3o.2.2.2: Como o elemento ''{0}'' tem uma '{'value constraint'}' e sua defini\u00E7\u00E3o de tipo tem {''content type'}' misto, ent\u00E3o a part\u00EDcula do '{'content type'}' deve ser esvazi\u00E1vel.
+ c-props-correct.2 = c-props-correct.2: A cardinalidade dos Campos de keyref ''{0}'' e chave ''{1}'' deve ser correspondente.
+ ct-props-correct.3 = ct-props-correct.3: Defini\u00E7\u00F5es circulares detectadas para o tipo complexo ''{0}''. Isso significa que ''{0}'' est\u00E1 contido em sua pr\u00F3pria hierarquia de tipo, o que \u00E9 um erro.
+ ct-props-correct.4 = ct-props-correct.4: Erro do tipo ''{0}''. Os usos do atributo duplicado com o mesmo nome e namespace de destino foram especificados. O nome do uso do atributo duplicado \u00E9 ''{1}''.
+ ct-props-correct.5 = ct-props-correct.5: Erro do tipo ''{0}''. Duas declara\u00E7\u00F5es do atributo ''{1}'' e ''{2}'' t\u00EAm tipos que s\u00E3o obtidos do ID.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: O tipo ''{0}'' foi obtido por meio da restri\u00E7\u00E3o do tipo ''{1}''. No entanto, ''{1}'' tem uma propriedade ''{''final''}'' que pro\u00EDbe a deriva\u00E7\u00E3o por restri\u00E7\u00E3o.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: O tipo ''{0}'' foi obtido por meio da restri\u00E7\u00E3o do tipo ''{1}''. No entanto, ''{1}'' tem uma propriedade '{'final'}' que pro\u00EDbe a deriva\u00E7\u00E3o por restri\u00E7\u00E3o.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: Erro do tipo ''{0}''. O uso do atributo ''{1}'' neste tipo tem um valor de ''uso'' de ''{2}'', que \u00E9 inconsistente com o valor ''obrigat\u00F3rio'' em um uso de atributo correspondente no tipo de base.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: Erro do tipo ''{0}''. O uso do atributo ''{1}'' neste tipo tem o tipo ''{2}'', que \u00E9 obtido de forma v\u00E1lida de "{3}", o tipo de uso do atributo correspondente no tipo de base.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: Erro do tipo ''{0}''. O uso do atributo ''{1}'' neste tipo tem uma restri\u00E7\u00E3o de valor efetivo que n\u00E3o \u00E9 fixa e a restri\u00E7\u00E3o de valor efetivo do atributo correspondente no tipo de base \u00E9 fixa.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: Erro do tipo ''{2}''. O valor maxInclusive =''{0}'' deve ser > = minInclusive do tipo de base ''{1}''.
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: Erro do tipo ''{2}''. O valor maxInclusive =''{0}'' deve ser > minInclusive do tipo de base ''{1}''.
+ maxLength-valid-restriction = maxLength-valid-restriction: Na defini\u00E7\u00E3o de {2}, o valor maxLength = ''{0}'' deve ser <= que o do tipo de base ''{1}''.
+- mg-props-correct.2 = mg-props-correct.2: Defini\u00E7\u00F5es circulares detectadas para o grupo ''{0}''. Seguir de forma recursiva dos valores de ''{''term''}'' das part\u00EDculas conduz a uma part\u00EDcula cujo ''{''term''}'' \u00E9 o pr\u00F3prio grupo.
++ mg-props-correct.2 = mg-props-correct.2: Defini\u00E7\u00F5es circulares detectadas para o grupo ''{0}''. Seguir de forma recursiva dos valores de '{'term'}' das part\u00EDculas conduz a uma part\u00EDcula cujo '{'term'}' \u00E9 o pr\u00F3prio grupo.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: Na defini\u00E7\u00E3o de {2}, o valor minExclusive = ''{0}'' deve ser <= que o valor maxExclusive = ''{1}''.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: Na defini\u00E7\u00E3o de {2}, o valor minExclusive = ''{0}'' deve ser <= que o valor maxInclusive = ''{1}''.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: Erro do tipo ''{2}''. O valor minExclusive =''{0}'' deve ser >= minExclusive do tipo de base ''{1}''.
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: Um esquema n\u00E3o pode conter dois componentes globais com o mesmo nome; este esquema cont\u00E9m duas ocorr\u00EAncias de ''{0}''.
+ st-props-correct.2 = st-props-correct.2: Defini\u00E7\u00F5es circulares detectadas para o tipo simples {0}''. Isso significa que ''{0}'' est\u00E1 contido em sua pr\u00F3pria hierarquia de tipo, o que \u00E9 um erro.
+- st-props-correct.3 = st-props-correct.3: Erro do tipo ''{0}''. O valor de ''{''final''}'' da ''{''base type definition''}'', ''{1}'', pro\u00EDbe a obten\u00E7\u00E3o por restri\u00E7\u00E3o.
++ st-props-correct.3 = st-props-correct.3: Erro do tipo ''{0}''. O valor de '{'final'}' da '{'base type definition'}', ''{1}'', pro\u00EDbe a obten\u00E7\u00E3o por restri\u00E7\u00E3o.
+ totalDigits-valid-restriction = totalDigits-valid-restriction: Na defini\u00E7\u00E3o de {2}, o valor ''{0}'' do "totalDigits"'' do aspecto \u00E9 inv\u00E1lido porque ele deve ser <= ao valor de ''totalDigits", que foi definido como ''{1}'' em um dos tipos de ancestrais.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: Na defini\u00E7\u00E3o de {0}, o valor ''{1}'' do aspecto ''whitespace'' \u00E9 inv\u00E1lido porque o valor para ''whitespace'' foi definido como ''colapse'' em um dos tipos de ancestrais.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: Na defini\u00E7\u00E3o de {0}, o valor do aspecto ''preserve'' \u00E9 inv\u00E1lido para o aspecto "whitespace" porque o valor para ''whitespace'' foi definido como ''replace'' em um dos tipos de ancestrais.
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath: O valor do seletor = ''{0}'' n\u00E3o \u00E9 v\u00E1lido; os xpaths do seletor n\u00E3o podem conter atributos.
+ EmptyTargetNamespace = EmptyTargetNamespace: No documento do esquema ''{0}'', o valor do atributo ''targetNamespace'' n\u00E3o pode ser uma string vazia.
+ FacetValueFromBase = FacetValueFromBase: Na declara\u00E7\u00E3o do tipo ''{0}'', o valor ''{1}'' do aspecto ''{2}'' deve ser proveniente do espa\u00E7o de valor do tipo de base, ''{3}''.
+- FixedFacetValue = FixedFacetValue: Na defini\u00E7\u00E3o de {3}, o valor ''{1}'' do aspecto ''{0}'' \u00E9 inv\u00E1lido porque o valor de ''{0}'' foi enviado para ''{2}'' em um dos tipos de ancestrais e ''{''fixed''}'' = true.
++ FixedFacetValue = FixedFacetValue: Na defini\u00E7\u00E3o de {3}, o valor ''{1}'' do aspecto ''{0}'' \u00E9 inv\u00E1lido porque o valor de ''{0}'' foi enviado para ''{2}'' em um dos tipos de ancestrais e '{'fixed'}' = true.
+ InvalidRegex = InvalidRegex: O valor do padr\u00E3o ''{0}'' n\u00E3o \u00E9 uma express\u00E3o regular v\u00E1lida. O erro reportado foi: ''{1}'' na coluna ''{2}''.
+ maxOccurLimit = A configura\u00E7\u00E3o atual do parser n\u00E3o permite que o valor de um atributo maxOccurs seja definido como maior que o valor {0}.
+ PublicSystemOnNotation = PublicSystemOnNotation: Pelo menos ''public'' e ''system'' devem aparecer no elemento ''notation''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+ FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = Fel vid id-begr\u00E4nsning (cvc-identity-constraint.4.2.1): elementet \"{0}\" har en nyckel som saknar v\u00E4rde.
+- DuplicateField = Dubblettmatchning inom omfattningen av f\u00E4ltet \"{0}\".
+- DuplicateKey = Duplicerat nyckelv\u00E4rde [{0}] har deklarerats f\u00F6r id-begr\u00E4nsning av elementet \"{1}\".
+- DuplicateUnique = Duplicerat unikt v\u00E4rde [{0}] har deklarerats f\u00F6r id-begr\u00E4nsning av elementet \"{1}\".
+- FieldMultipleMatch = Fel vid id-begr\u00E4nsning: f\u00E4ltet \"{0}\" matchar fler \u00E4n ett v\u00E4rde inom omfattningen av v\u00E4ljaren; f\u00E4lt m\u00E5ste matcha unika v\u00E4rden.
+- FixedDiffersFromActual = Elementets inneh\u00E5ll motsvarar inte v\u00E4rdet av attributet som anges som \"fixed\" i elementdeklarationen i schemat.
+- KeyMatchesNillable = Fel vid id-begr\u00E4nsning (cvc-identity-constraint.4.2.3): elementet \"{0}\" har en nyckel som matchar ett element med nullbart v\u00E4rde angivet som true.
+- KeyNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <key name=\"{1}\"> som id-begr\u00E4nsning f\u00F6r elementet \"{0}\".
++ AbsentKeyValue = Fel vid id-begr\u00E4nsning (cvc-identity-constraint.4.2.1): elementet "{0}" har en nyckel som saknar v\u00E4rde.
++ DuplicateField = Dubblettmatchning inom omfattningen av f\u00E4ltet "{0}".
++ DuplicateKey = Duplicerat nyckelv\u00E4rde [{0}] har deklarerats f\u00F6r id-begr\u00E4nsning av elementet "{1}".
++ DuplicateUnique = Duplicerat unikt v\u00E4rde [{0}] har deklarerats f\u00F6r id-begr\u00E4nsning av elementet "{1}".
++ FieldMultipleMatch = Fel vid id-begr\u00E4nsning: f\u00E4ltet "{0}" matchar fler \u00E4n ett v\u00E4rde inom omfattningen av v\u00E4ljaren; f\u00E4lt m\u00E5ste matcha unika v\u00E4rden.
++ FixedDiffersFromActual = Elementets inneh\u00E5ll motsvarar inte v\u00E4rdet av attributet som anges som "fixed" i elementdeklarationen i schemat.
++ KeyMatchesNillable = Fel vid id-begr\u00E4nsning (cvc-identity-constraint.4.2.3): elementet "{0}" har en nyckel som matchar ett element med nullbart v\u00E4rde angivet som true.
++ KeyNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <key name="{1}"> som id-begr\u00E4nsning f\u00F6r elementet "{0}".
+ KeyNotFound = Nyckeln ''{0}'' med v\u00E4rdet ''{1}'' hittades inte f\u00F6r id-begr\u00E4nsning f\u00F6r element ''{2}''.
+- KeyRefNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <keyref name=\"{1}\"> som id-begr\u00E4nsning f\u00F6r elementet \"{0}\".
+- KeyRefOutOfScope = Fel vid id-begr\u00E4nsning: id-begr\u00E4nsning \"{0}\" har en nyckelreferens som refererar till nyckel eller unikt v\u00E4rde utanf\u00F6r definitionsomr\u00E5det.
+- KeyRefReferNotFound = Nyckelreferensdeklarationen \"{0}\" refererar till ok\u00E4nd nyckel med namnet \"{1}\".
+- UniqueNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <unique> som id-begr\u00E4nsning f\u00F6r elementet \"{0}\".
+- UnknownField = Fel vid intern id-begr\u00E4nsning; ok\u00E4nt f\u00E4lt \"{0}\".
++ KeyRefNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <keyref name="{1}"> som id-begr\u00E4nsning f\u00F6r elementet "{0}".
++ KeyRefOutOfScope = Fel vid id-begr\u00E4nsning: id-begr\u00E4nsning "{0}" har en nyckelreferens som refererar till nyckel eller unikt v\u00E4rde utanf\u00F6r definitionsomr\u00E5det.
++ KeyRefReferNotFound = Nyckelreferensdeklarationen "{0}" refererar till ok\u00E4nd nyckel med namnet "{1}".
++ UniqueNotEnoughValues = Det finns inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden angivna f\u00F6r <unique> som id-begr\u00E4nsning f\u00F6r elementet "{0}".
++ UnknownField = Fel vid intern id-begr\u00E4nsning; ok\u00E4nt f\u00E4lt "{0}".
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: V\u00E4rdet ''{2}'' f\u00F6r attributet ''{1}'' i elementet ''{0}'' har ogiltig typ, ''{3}''.
+- cvc-attribute.4 = cvc-attribute.4: V\u00E4rdet \''{2}\'' f\u00F6r attributet \''{1}\'' i elementet \''{0}\'' har ogiltig fast \''{\''v\u00E4rdebegr\u00E4nsning\''}\''. Attributet m\u00E5ste ha v\u00E4rdet \''{3}\''.
++ cvc-attribute.4 = cvc-attribute.4: V\u00E4rdet ''{2}'' f\u00F6r attributet ''{1}'' i elementet ''{0}'' har ogiltig fast '{'v\u00E4rdebegr\u00E4nsning'}'. Attributet m\u00E5ste ha v\u00E4rdet ''{3}''.
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: Elementet ''{0}'' f\u00E5r inte ha [underordnade] objekt med tecken- eller elementinformation, eftersom inneh\u00E5llstyp \u00E4r tomt.
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: Elementet ''{0}'' f\u00E5r inte ha [underordnade] element och v\u00E4rdet m\u00E5ste vara giltigt.
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: Elementet ''{0}'' f\u00E5r inte ha [underordnade] tecken, eftersom inneh\u00E5llstyp \u00E4r endast element.
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: Attributet ''{1}'' \u00E4r inte till\u00E5tet i elementet ''{0}''.
+ cvc-complex-type.4 = cvc-complex-type.4: Attributet ''{1}'' m\u00E5ste anger i elementet ''{0}''.
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: I elementet ''{0}'' \u00E4r attributet ''{1}'' ett joker-id. Joker-id ''{2}'' finns redan och endast ett id kan anv\u00E4ndas.
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: I elementet ''{0}'' \u00E4r attributet ''{1}'' ett joker-id. Det finns redan ett attribut ''{2}'' som tas fr\u00E5n id bland \''{\''attributanv\u00E4ndningar\''}\''.
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: I elementet ''{0}'' \u00E4r attributet ''{1}'' ett joker-id. Det finns redan ett attribut ''{2}'' som tas fr\u00E5n id bland '{'attributanv\u00E4ndningar'}'.
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' \u00E4r inte n\u00E5got giltigt v\u00E4rde f\u00F6r ''{1}''.
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' \u00E4r inte n\u00E5got giltigt v\u00E4rde f\u00F6r listtyp ''{1}''.
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' \u00E4r inte n\u00E5got giltigt v\u00E4rde f\u00F6r uniontyp ''{1}''.
+ cvc-elt.1 = cvc-elt.1: Kan inte hitta deklarationen f\u00F6r elementet ''{0}''.
+- cvc-elt.2 = cvc-elt.2: V\u00E4rdet f\u00F6r \''{\''abstrakt\''}\'' i elementdeklarationen f\u00F6r ''{0}'' m\u00E5ste anges som false.
+- cvc-elt.3.1 = cvc-elt.3.1: Attributet ''{1}'' f\u00E5r inte anges i elementet ''{0}'', eftersom \''{\''nullbar\''}\'' egenskap f\u00F6r ''{0}'' har angetts som false.
++ cvc-elt.2 = cvc-elt.2: V\u00E4rdet f\u00F6r '{'abstrakt'}' i elementdeklarationen f\u00F6r ''{0}'' m\u00E5ste anges som false.
++ cvc-elt.3.1 = cvc-elt.3.1: Attributet ''{1}'' f\u00E5r inte anges i elementet ''{0}'', eftersom '{'nullbar'}' egenskap f\u00F6r ''{0}'' har angetts som false.
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: Elementet ''{0}'' f\u00E5r inte inneh\u00E5lla [underordnade] med tecken- eller elementinformation eftersom ''{1}'' har angetts.
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: Det f\u00E5r inte finnas n\u00E5gon fast \''{\''v\u00E4rdebegr\u00E4nsning\''}\'' f\u00F6r elementet ''{0}'' eftersom ''{1}'' har angetts.
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: Det f\u00E5r inte finnas n\u00E5gon fast '{'v\u00E4rdebegr\u00E4nsning'}' f\u00F6r elementet ''{0}'' eftersom ''{1}'' har angetts.
+ cvc-elt.4.1 = cvc-elt.4.1: V\u00E4rdet ''{2}'' f\u00F6r attributet ''{1}'' i elementet ''{0}'' \u00E4r inte n\u00E5got giltigt QName.
+ cvc-elt.4.2 = cvc-elt.4.2: Kan inte matcha ''{1}'' med typdefinition f\u00F6r elementet ''{0}''.
+ cvc-elt.4.3 = cvc-elt.4.3: Typ ''{1}'' \u00E4r inte giltigt att tas fr\u00E5n typdefinitionen ''{2}'' i elementet ''{0}''.
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: \''{\''v\u00E4rdebegr\u00E4nsning\''}\'' ''{2}'' i elementet ''{0}'' \u00E4r inte n\u00E5got giltigt standardv\u00E4rde f\u00F6r typ ''{1}''.
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: '{'v\u00E4rdebegr\u00E4nsning'}' ''{2}'' i elementet ''{0}'' \u00E4r inte n\u00E5got giltigt standardv\u00E4rde f\u00F6r typ ''{1}''.
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: Elementet ''{0}'' f\u00E5r inte ha [underordnade] objekt med elementinformation.
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: V\u00E4rdet ''{1}'' i elementet ''{0}'' matchar inte v\u00E4rdet med fast ''{''v\u00E4rdebegr\u00E4nsning''}'', ''{2}''.
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: V\u00E4rdet ''{1}'' i elementet ''{0}'' matchar inte v\u00E4rdet med ''{''v\u00E4rdebegr\u00E4nsning''}'', ''{2}''.
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: V\u00E4rdet ''{1}'' i elementet ''{0}'' matchar inte v\u00E4rdet med fast '{'v\u00E4rdebegr\u00E4nsning'}', ''{2}''.
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: V\u00E4rdet ''{1}'' i elementet ''{0}'' matchar inte v\u00E4rdet med '{'v\u00E4rdebegr\u00E4nsning'}', ''{2}''.
+ cvc-enumeration-valid = cvc-enumeration-valid: V\u00E4rdet ''{0}'' \u00E4r ogiltigt med aktuell uppr\u00E4kning ''{1}''. V\u00E4rdet m\u00E5ste ing\u00E5 i uppr\u00E4kningen.
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: V\u00E4rdet ''{0}'' har {1} br\u00E5ktalssiffror, men antalet br\u00E5ktalssiffror \u00E4r begr\u00E4nsat till {2}.
+ cvc-id.1 = cvc-id.1: Det finns ingen ID/IDREF-bindning f\u00F6r IDREF ''{0}''.
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: Kunde inte l\u00E4sa schemadokumentet ''{0}'' eftersom ''{1}''-\u00E5tkomst inte till\u00E5ts p\u00E5 grund av begr\u00E4nsning som anges av egenskapen accessExternalSchema.
+ schema_reference.4 = schema_reference.4: L\u00E4sning av schemadokument ''{0}'' utf\u00F6rdes inte p\u00E5 grund av 1) det g\u00E5r inte att hitta dokumentet; 2) det g\u00E5r inte att l\u00E4sa dokumentet; 3) dokumentets rotelement \u00E4r inte <xsd:schema>.
+ src-annotation = src-annotation: element f\u00F6r <anteckningar> f\u00E5r endast inneh\u00E5lla element f\u00F6r <appinfo> och <dokumentation>, men ''{0}'' hittades.
+ src-attribute.1 = src-attribute.1: B\u00E5da egenskaperna ''default'' och ''fixed'' kan inte samtidigt ing\u00E5 i attributdeklarationen ''{0}''. Anv\u00E4nd en av dem.
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: Ett fel intr\u00E4ffade f\u00F6r attributgruppen ''{0}''. Duplicerad attributanv\u00E4ndning med samma namn och namnrymd. Namnet p\u00E5 dubbletten \u00E4r ''{1}''.
+ ag-props-correct.3 = ag-props-correct.3: Ett fel intr\u00E4ffade f\u00F6r attributgruppen ''{0}''. Tv\u00E5 attributdeklarationer, ''{1}'' och ''{2}'' har angetts med typer som h\u00E4rleds fr\u00E5n ID.
+ a-props-correct.2 = a-props-correct.2: Ogiltigt v\u00E4rde f\u00F6r begr\u00E4nsning, ''{1}'', i attributet ''{0}''.
+- a-props-correct.3 = a-props-correct.3: Attributet ''{0}'' f\u00E5r inte anv\u00E4nda ''fixed'' eller ''default'', eftersom attributets \''{\''typdefinition\''}\'' \u00E4r ID eller h\u00E4rleds fr\u00E5n ID.
+- au-props-correct.2 = au-props-correct.2: Det fasta v\u00E4rdet ''{1}'' har angetts i attributdeklarationen ''{0}''. Om attributet som refererar till ''{0}'' \u00E4ven inneh\u00E5ller en \''{\''v\u00E4rdebegr\u00E4nsning\''}\'' m\u00E5ste du l\u00F6sa detta och ange v\u00E4rdet ''{1}''.
++ a-props-correct.3 = a-props-correct.3: Attributet ''{0}'' f\u00E5r inte anv\u00E4nda ''fixed'' eller ''default'', eftersom attributets '{'typdefinition'}' \u00E4r ID eller h\u00E4rleds fr\u00E5n ID.
++ au-props-correct.2 = au-props-correct.2: Det fasta v\u00E4rdet ''{1}'' har angetts i attributdeklarationen ''{0}''. Om attributet som refererar till ''{0}'' \u00E4ven inneh\u00E5ller en '{'v\u00E4rdebegr\u00E4nsning'}' m\u00E5ste du l\u00F6sa detta och ange v\u00E4rdet ''{1}''.
+ cos-all-limited.1.2 = cos-all-limited.1.2: En 'all'-modellgrupp m\u00E5ste anges i en partikel med '{'min f\u00F6rekomster'}' = '{'max f\u00F6rekomster'}' = 1 och partikeln m\u00E5ste vara en del i ett par som utg\u00F6r '{'inneh\u00E5llstyp'}' i en komplex typdefinition.
+- cos-all-limited.2 = cos-all-limited.2: V\u00E4rdet f\u00F6r \''{\''max f\u00F6rekomster\''}\'' i ett element i en ''all''-modellgrupp m\u00E5ste vara 0 eller 1. V\u00E4rdet ''{0}'' f\u00F6r elementet ''{1}'' \u00E4r ogiltigt.
++ cos-all-limited.2 = cos-all-limited.2: V\u00E4rdet f\u00F6r '{'max f\u00F6rekomster'}' i ett element i en ''all''-modellgrupp m\u00E5ste vara 0 eller 1. V\u00E4rdet ''{0}'' f\u00F6r elementet ''{1}'' \u00E4r ogiltigt.
+ cos-applicable-facets = cos-applicable-facets: Aspekten (facet) ''{0}'' \u00E4r inte till\u00E5ten med typ {1}.
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: Typ ''{0}'' h\u00E4rleds fr\u00E5n ett till\u00E4gg fr\u00E5n typ ''{1}''. Attributet ''final'' i ''{1}'' till\u00E5ter dock inte h\u00E4rledning av till\u00E4gg.
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: Inneh\u00E5llstyp f\u00F6r h\u00E4rledd typ och f\u00F6r basen m\u00E5ste b\u00E5da vara blandade eller endast element. Typ ''{0}'' \u00E4r endast element, men d\u00E4remot inte basen.
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: Inneh\u00E5llstyp f\u00F6r h\u00E4rledd typ och f\u00F6r basen m\u00E5ste b\u00E5da vara blandade eller endast element. Typ ''{0}'' \u00E4r blandat, men d\u00E4remot inte basen.
+ cos-element-consistent = cos-element-consistent: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Flera element med namnet ''{1}'', med olika typer, har angetts i modellgruppen.
+ cos-list-of-atomic = cos-list-of-atomic: I definitionen av listtyp ''{0}'' \u00E4r typ ''{1}'' en ogiltig typ av listelement eftersom den inte \u00E4r atomisk (''{1}'' \u00E4r antingen en listtyp eller en uniontyp som inneh\u00E5ller en lista).
+- cos-nonambig = cos-nonambig: {0} och {1} (eller element fr\u00E5n ers\u00E4ttningsgruppen) bryter mot \"Unique Particle Attribution\". Detta skapar tvetydighet f\u00F6r partiklarna vid validering gentemot detta schema.
++ cos-nonambig = cos-nonambig: {0} och {1} (eller element fr\u00E5n ers\u00E4ttningsgruppen) bryter mot "Unique Particle Attribution". Detta skapar tvetydighet f\u00F6r partiklarna vid validering gentemot detta schema.
+ cos-particle-restrict.a = cos-particle-restrict.a: H\u00E4rledd partikel \u00E4r tom och basen \u00E4r inte t\u00F6mningsbar.
+ cos-particle-restrict.b = cos-particle-restrict.b: Baspartikeln \u00E4r tom, men den h\u00E4rledda partikeln \u00E4r inte det.
+ cos-particle-restrict.2 = cos-particle-restrict.2: F\u00F6rbjuden partikelbegr\u00E4nsning: ''{0}''.
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: Typ ''{1}'' \u00E4r atomisk och d\u00E4rf\u00F6r m\u00E5ste \''{\''bastypdefinitionen\''}\'', ''{0}'', anges som atomisk enkel typ eller inbyggd primitiv datatyp.
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: Typ ''{1}'' \u00E4r atomisk och d\u00E4rf\u00F6r m\u00E5ste '{'bastypdefinitionen'}', ''{0}'', anges som atomisk enkel typ eller inbyggd primitiv datatyp.
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: I definitionen av listtyp ''{0}'' \u00E4r typ ''{1}'' en ogiltig objekttyp eftersom det \u00E4r antingen en listtyp eller en uniontyp som inneh\u00E5ller en lista.
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: Den \''{\''sista\''}\'' komponenten i \''{\''objekttypdefinitionen\''}\'', ''{0}'', inneh\u00E5ller ''list''. Detta betyder att ''{0}'' inte kan anv\u00E4ndas som objekttyp f\u00F6r listtyp ''{1}''.
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: Den ''{''sista''}'' komponenten i \''{\''medlemtypdefinitionerna\''}\'', ''{0}'', inneh\u00E5ller ''union''. Detta betyder att ''{0}'' inte kan anv\u00E4ndas som medlemstyp f\u00F6r uniontyp ''{1}''.
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: Den '{'sista'}' komponenten i '{'objekttypdefinitionen'}', ''{0}'', inneh\u00E5ller ''list''. Detta betyder att ''{0}'' inte kan anv\u00E4ndas som objekttyp f\u00F6r listtyp ''{1}''.
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: Den '{'sista'}' komponenten i '{'medlemtypdefinitionerna'}', ''{0}'', inneh\u00E5ller ''union''. Detta betyder att ''{0}'' inte kan anv\u00E4ndas som medlemstyp f\u00F6r uniontyp ''{1}''.
+ cos-valid-default.2.1 = cos-valid-default.2.1: Elementet ''{0}'' har en v\u00E4rdebegr\u00E4nsning och m\u00E5ste ha en blandad eller enkel inneh\u00E5llsmodell.
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: Eftersom elementet ''{0}'' har en \''{\''v\u00E4rdebegr\u00E4nsning\''}\'' och typdefinitionen har blandad \''{\''inneh\u00E5llstyp\''}\'' s\u00E5 m\u00E5ste partikeln av \''{\''inneh\u00E5llstyp\''}\'' vara t\u00F6mningsbar.
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: Eftersom elementet ''{0}'' har en '{'v\u00E4rdebegr\u00E4nsning'}' och typdefinitionen har blandad '{'inneh\u00E5llstyp'}' s\u00E5 m\u00E5ste partikeln av '{'inneh\u00E5llstyp'}' vara t\u00F6mningsbar.
+ c-props-correct.2 = c-props-correct.2: Kardinalitet av f\u00E4lt med nyckelreferens ''{0}'' och nyckel ''{1}'' m\u00E5ste matcha varandra.
+ ct-props-correct.3 = ct-props-correct.3: Cirkul\u00E4ra definitioner har identifierats f\u00F6r komplex typ ''{0}''. Detta inneb\u00E4r att ''{0}'' ing\u00E5r i sin egen typhierarki, vilket \u00E4r fel.
+ ct-props-correct.4 = ct-props-correct.4: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Duplicerad attributanv\u00E4ndning med samma namn och namnrymd. Namnet p\u00E5 dubbletten \u00E4r ''{1}''.
+ ct-props-correct.5 = ct-props-correct.5: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Tv\u00E5 attributdeklarationer, ''{1}'' och ''{2}'', anv\u00E4nds med typer som h\u00E4rleds fr\u00E5n ID.
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: Typ ''{0}'' h\u00E4rleddes genom begr\u00E4nsning fr\u00E5n typ ''{1}''. ''{1}'' har d\u00E4remot en \''{\''slutlig\''}\'' egenskap som f\u00F6rbjuder h\u00E4rledning via begr\u00E4nsning.
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: Typ ''{0}'' h\u00E4rleddes genom begr\u00E4nsning fr\u00E5n typ ''{1}''. ''{1}'' har d\u00E4remot en '{'slutlig'}' egenskap som f\u00F6rbjuder h\u00E4rledning via begr\u00E4nsning.
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Attributanv\u00E4ndning ''{1}'' i denna typ har ''use''-v\u00E4rdet ''{2}'' vilket inte \u00E4r konsekvent med v\u00E4rdet f\u00F6r ''required'' i matchande attributanv\u00E4ndning i bastypen.
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Attributanv\u00E4ndning ''{1}'' i denna typ har typ ''{2}'', som inte f\u00E5r h\u00E4rledas fr\u00E5n ''{3}'', typ i matchande attributanv\u00E4ndning i bastypen.
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Attributanv\u00E4ndning ''{1}'' i denna typ har en effektiv v\u00E4rdebegr\u00E4nsning som inte \u00E4r fast, medan den effektiva v\u00E4rdebegr\u00E4nsningen i matchande attributanv\u00E4ndning i bastypen \u00E4r fast.
+@@ -210,11 +182,11 @@
+ derivation-ok-restriction.5.3.2 = derivation-ok-restriction.5.3.2: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Inneh\u00E5llstypen f\u00F6r denna typ \u00E4r tom, men inneh\u00E5llstypen f\u00F6r basen, ''{1}'', \u00E4r inte tom eller t\u00F6mningsbar.
+ derivation-ok-restriction.5.4.1.2 = derivation-ok-restriction.5.4.1.2: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Inneh\u00E5llstypen f\u00F6r denna typ \u00E4r blandad, medan inneh\u00E5llstypen f\u00F6r basen, ''{1}'', inte \u00E4r det.
+ derivation-ok-restriction.5.4.2 = derivation-ok-restriction.5.4.2: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. Typpartikeln \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r partikeln i basen.
+- enumeration-required-notation = enumeration-required-notation: NOTATION-typ, ''{0}'' anv\u00E4nds av {2} ''{1}'', m\u00E5ste anges med uppr\u00E4kningsv\u00E4rde som specificerar de notationselement som anv\u00E4nds av denna typ.
++ enumeration-required-notation = enumeration-required-notation: NOTATION-typ, ''{0}'' anv\u00E4nds av {2} ''{1}'', m\u00E5ste anges med uppr\u00E4kningsaspektv\u00E4rde som specificerar de notationselement som anv\u00E4nds av denna typ.
+ enumeration-valid-restriction = enumeration-valid-restriction: Uppr\u00E4kningsv\u00E4rdet ''{0}'' finns inte i bastypens, {1}, v\u00E4rdeutrymme.
+ e-props-correct.2 = e-props-correct.2: Ogiltigt v\u00E4rde f\u00F6r begr\u00E4nsningsv\u00E4rde ''{1}'' i elementet ''{0}''.
+- e-props-correct.4 = e-props-correct.4: \''{\''Typdefinition\''}\'' f\u00F6r elementet ''{0}'' har en ogiltig h\u00E4rledning fr\u00E5n \''{\''typdefinitionen\''}\'' f\u00F6r substitutionHead ''{1}'' eller s\u00E5 till\u00E5ts inte denna h\u00E4rledning av egenskapen ''{1}'' f\u00F6r \''{\''ers\u00E4ttningsgruppexkluderingar\''}\''.
+- e-props-correct.5 = e-props-correct.5: En \''{\''v\u00E4rdebegr\u00E4nsning\''}\'' f\u00E5r inte finnas med i elementet ''{0}'' eftersom elementets \''{\''typdefinition\''}\'' eller \''{\''typdefinitionens\''}\'' \''{\''inneh\u00E5llstyp\''}\'' \u00E4r ID, eller h\u00E4rleds fr\u00E5n ID.
++ e-props-correct.4 = e-props-correct.4: '{'Typdefinition'}' f\u00F6r elementet ''{0}'' har en ogiltig h\u00E4rledning fr\u00E5n '{'typdefinitionen'}' f\u00F6r substitutionHead ''{1}'' eller s\u00E5 till\u00E5ts inte denna h\u00E4rledning av egenskapen ''{1}'' f\u00F6r '{'ers\u00E4ttningsgruppexkluderingar'}'.
++ e-props-correct.5 = e-props-correct.5: En '{'v\u00E4rdebegr\u00E4nsning'}' f\u00E5r inte finnas med i elementet ''{0}'' eftersom elementets '{'typdefinition'}' eller '{'typdefinitionens'}' '{'inneh\u00E5llstyp'}' \u00E4r ID, eller h\u00E4rleds fr\u00E5n ID.
+ e-props-correct.6 = e-props-correct.6: Cirkul\u00E4r ers\u00E4ttningsgrupp identifierades f\u00F6r elementet ''{0}''.
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: I definitionen f\u00F6r {2} \u00E4r v\u00E4rdet ''{0}'' f\u00F6r ''fractionDigits'' ogiltigt eftersom det m\u00E5ste vara mindre \u00E4n eller lika med v\u00E4rdet f\u00F6r ''fractionDigits'' som har angetts som ''{1}'' i n\u00E5gon typ f\u00F6r \u00F6verordnad.
+ fractionDigits-totalDigits = fractionDigits-totalDigits: I definitionen av {2} \u00E4r v\u00E4rdet ''{0}'' f\u00F6r ''fractionDigits'' ogiltigt eftersom v\u00E4rdet m\u00E5ste vara mindre \u00E4n eller lika med v\u00E4rdet f\u00F6r ''totalDigits'' som \u00E4r ''{1}''.
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: Ett fel intr\u00E4ffade f\u00F6r typ ''{2}''. maxInclusive-v\u00E4rdet ''{0}'' m\u00E5ste vara st\u00F6rre \u00E4n eller lika med minInclusive i bastyp ''{1}''.
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: Ett fel intr\u00E4ffade f\u00F6r typ ''{2}''. maxInclusive-v\u00E4rdet ''{0}'' m\u00E5ste vara st\u00F6rre \u00E4n minExclusive i bastyp ''{1}''.
+ maxLength-valid-restriction = maxLength-valid-restriction: I definitionen f\u00F6r {2} m\u00E5ste maxLength-v\u00E4rdet ''{0}'' vara mindre \u00E4n eller lika med v\u00E4rdet i bastyp ''{1}''.
+- mg-props-correct.2 = mg-props-correct.2: Cirkul\u00E4ra definitioner identifierades f\u00F6r gruppen ''{0}''. Rekursivt efterf\u00F6ljande v\u00E4rdena f\u00F6r \''{\''term\''}\'' i partiklarna leder till en partikel vars \''{\''term\''}\'' \u00E4r den ursprungliga gruppen.
++ mg-props-correct.2 = mg-props-correct.2: Cirkul\u00E4ra definitioner identifierades f\u00F6r gruppen ''{0}''. Rekursivt efterf\u00F6ljande v\u00E4rdena f\u00F6r '{'term'}' i partiklarna leder till en partikel vars '{'term'}' \u00E4r den ursprungliga gruppen.
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: I definitionen f\u00F6r {2} m\u00E5ste minExclusive-v\u00E4rdet ''{0}'' vara mindre \u00E4n eller lika med maxExclusive-v\u00E4rdet ''{1}''.
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: I definitionen f\u00F6r {2} m\u00E5ste minExclusive-v\u00E4rdet ''{0}'' vara mindre \u00E4n maxInclusive-v\u00E4rdet ''{1}''.
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: Ett fel intr\u00E4ffade f\u00F6r typ ''{2}''. minExclusive-v\u00E4rdet ''{0}'' m\u00E5ste vara st\u00F6rre \u00E4n eller lika med minExclusive i bastyp ''{1}''.
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: I definitionen f\u00F6r {2} m\u00E5ste minLength-v\u00E4rdet ''{0}'' vara mindre \u00E4n maxLength-v\u00E4rdet ''{1}''.
+ minLength-valid-restriction = minLength-valid-restriction: I definitionen f\u00F6r {2} m\u00E5ste minLength-v\u00E4rdet ''{0}'' vara st\u00F6rre \u00E4n eller lika med v\u00E4rdet i bastyp ''{1}''.
+ no-xmlns = no-xmlns: Ett {namn} p\u00E5 en attributdeklaration f\u00E5r inte matcha 'xmlns'.
+- no-xsi = no-xsi: En \''{\''m\u00E5lnamnrymd\''}\'' i en attributdeklaration f\u00E5r inte matcha ''{0}''.
++ no-xsi = no-xsi: En '{'m\u00E5lnamnrymd'}' i en attributdeklaration f\u00E5r inte matcha ''{0}''.
+ p-props-correct.2.1 = p-props-correct.2.1: I deklarationen ''{0}'' \u00E4r v\u00E4rdet f\u00F6r ''minOccurs'' ''{1}'', men det f\u00E5r inte vara st\u00F6rre \u00E4n v\u00E4rdet f\u00F6r ''maxOccurs'' (som \u00E4r ''{2}'').
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: Det finns ingen fullst\u00E4ndigt fungerande mappning mellan partiklarna.
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: Gruppens f\u00F6rekomstintervall ({0},{1}) \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r basgruppens f\u00F6rekomstintervall, ({2},{3}).
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: Element har namn och m\u00E5lnamnrymder som inte \u00E4r desamma: Elementet ''{0}'' i namnrymd ''{1}'' och elementet ''{2}'' i namnrymd ''{3}''.
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: Ett fel intr\u00E4ffade f\u00F6r partikeln vars \''{\''term\''}\'' \u00E4r elementdeklarationen ''{0}''. Elementdeklarationens v\u00E4rde som \u00E4r \''{\''nullbart\''}\'' har angetts som true, men motsvarande partikel i bastypen har en elementdeklaration vars v\u00E4rde som \u00E4r \''{\''nullbart\''}\'' har angetts som false.
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: Ett fel intr\u00E4ffade f\u00F6r partikeln vars \''{\''term\''}\'' \u00E4r elementdeklarationen ''{0}''. F\u00F6rekomstintervallet, ({1},{2}), \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r intervallet, ({3},{4}, i motsvarande partikel i bastypen.
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: Ett fel intr\u00E4ffade f\u00F6r partikeln vars '{'term'}' \u00E4r elementdeklarationen ''{0}''. Elementdeklarationens v\u00E4rde som \u00E4r '{'nullbart'}' har angetts som true, men motsvarande partikel i bastypen har en elementdeklaration vars v\u00E4rde som \u00E4r '{'nullbart'}' har angetts som false.
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: Ett fel intr\u00E4ffade f\u00F6r partikeln vars '{'term'}' \u00E4r elementdeklarationen ''{0}''. F\u00F6rekomstintervallet, ({1},{2}), \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r intervallet, ({3},{4}, i motsvarande partikel i bastypen.
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: Elementet ''{0}'' har inte n\u00E5got fast v\u00E4rde, men motsvarande element i bastypen har angetts med det fasta v\u00E4rdet ''{1}''.
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: Elementet ''{0}'' har det fasta v\u00E4rdet ''{1}'', men motsvarande element i bastypen har angetts med det fasta v\u00E4rdet ''{2}''.
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: Identitetsbegr\u00E4nsningarna f\u00F6r elementet ''{0}'' \u00E4r inte n\u00E5gon del av de som finns i basen.
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: De avaktiverade ers\u00E4ttningarna f\u00F6r elementet ''{0}'' \u00E4r inte inneslutna i basen.
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: Elementtyp ''{0}'', ''{1}'' h\u00E4rleds inte fr\u00E5n typ av baselement, ''{2}''.
+ rcase-NSCompat.1 = rcase-NSCompat.1: Elementet ''{0}'' har namnrymden ''{1}'' som inte \u00E4r till\u00E5tet av jokertecknet i basen.
+- rcase-NSCompat.2 = rcase-NSCompat.2: Ett fel intr\u00E4ffade f\u00F6r partikeln vars \''{\''term\''}\'' \u00E4r elementdeklarationen ''{0}''. F\u00F6rekomstintervallet, ({1},{2}), \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r intervallet, ({3},{4}, i motsvarande partikel i bastypen.
++ rcase-NSCompat.2 = rcase-NSCompat.2: Ett fel intr\u00E4ffade f\u00F6r partikeln vars '{'term'}' \u00E4r elementdeklarationen ''{0}''. F\u00F6rekomstintervallet, ({1},{2}), \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r intervallet, ({3},{4}, i motsvarande partikel i bastypen.
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: Det finns ingen fullst\u00E4ndigt fungerande mappning mellan partiklarna.
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: Gruppens f\u00F6rekomstintervall ({0},{1}) \u00E4r inte n\u00E5gon giltig begr\u00E4nsning f\u00F6r basjokertecknets intervall, ({2},{3}).
+ rcase-NSSubset.1 = rcase-NSSubset.1: Jokertecknet \u00E4r inte n\u00E5gon del av motsvarande jokertecken i basen.
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: Ett schema kan inte inneh\u00E5lla tv\u00E5 globala komponenter med samma namn. Detta schema har tv\u00E5 f\u00F6rekomster av ''{0}''.
+ st-props-correct.2 = st-props-correct.2: Cirkul\u00E4ra definitioner har identifierats f\u00F6r enkel typ ''{0}''. Detta inneb\u00E4r att ''{0}'' ing\u00E5r i sin egen typhierarki, vilket \u00E4r fel.
+- st-props-correct.3 = st-props-correct.3: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. V\u00E4rdet f\u00F6r \''{\''slutgiltigt\''}\'' i \''{\''bastypdefinitionen\''}\'', ''{1}'', f\u00F6rbjuder h\u00E4rledning med begr\u00E4nsning.
++ st-props-correct.3 = st-props-correct.3: Ett fel intr\u00E4ffade f\u00F6r typ ''{0}''. V\u00E4rdet f\u00F6r '{'slutgiltigt'}' i '{'bastypdefinitionen'}', ''{1}'', f\u00F6rbjuder h\u00E4rledning med begr\u00E4nsning.
+ totalDigits-valid-restriction = totalDigits-valid-restriction: I definitionen f\u00F6r {2} \u00E4r v\u00E4rdet ''{0}'' f\u00F6r ''totalDigits'' ogiltigt eftersom det m\u00E5ste vara mindre \u00E4n eller lika med v\u00E4rdet f\u00F6r ''totalDigits'' som har angetts som ''{1}'' i n\u00E5gon typ f\u00F6r \u00F6verordnad.
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: I definitionen f\u00F6r {0} \u00E4r v\u00E4rdet ''{1}'' f\u00F6r ''whitespace'' ogiltigt, eftersom v\u00E4rdet f\u00F6r ''whitespace'' har angetts som ''collapse'' i n\u00E5gon typ f\u00F6r \u00F6verordnad.
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: I definitionen f\u00F6r {0} \u00E4r v\u00E4rdet ''preserve'' f\u00F6r ''whitespace'' ogiltigt, eftersom v\u00E4rdet f\u00F6r ''whitespace'' har angetts som ''replace'' i n\u00E5gon typ f\u00F6r \u00F6verordnad.
+@@ -309,7 +281,7 @@
+ c-selector-xpath = c-selector-xpath: V\u00E4ljarv\u00E4rdet ''{0}'' \u00E4r ogiltigt; xpath f\u00F6r v\u00E4ljare f\u00E5r inte inneh\u00E5lla attribut.
+ EmptyTargetNamespace = EmptyTargetNamespace: I schemadokumentet ''{0}'' f\u00E5r v\u00E4rdet f\u00F6r attributet ''targetNamespace'' inte vara en tom str\u00E4ng.
+ FacetValueFromBase = FacetValueFromBase: I deklarationen av typ ''{0}'' m\u00E5ste v\u00E4rdet ''{1}'' f\u00F6r aspekt ''{2}'' komma fr\u00E5n v\u00E4rdeutrymmet i bastypen ''{3}''.
+- FixedFacetValue = FixedFacetValue: I definitionen f\u00F6r {3} \u00E4r v\u00E4rdet ''{1}'' f\u00F6r aspekten ''{0}'' ogiltigt eftersom v\u00E4rdet f\u00F6r ''{0}'' har angetts som ''{2}'' i n\u00E5gon av typerna f\u00F6r \u00F6verordnade samtidigt som \''{\''fast\''}\'' = true.
++ FixedFacetValue = FixedFacetValue: I definitionen f\u00F6r {3} \u00E4r v\u00E4rdet ''{1}'' f\u00F6r aspekten ''{0}'' ogiltigt eftersom v\u00E4rdet f\u00F6r ''{0}'' har angetts som ''{2}'' i n\u00E5gon av typerna f\u00F6r \u00F6verordnade samtidigt som '{'fast'}' = true.
+ InvalidRegex = InvalidRegex: M\u00F6nsterv\u00E4rdet ''{0}'' \u00E4r inte n\u00E5got giltigt regulj\u00E4rt uttryck. Det rapporterade felet \u00E4r: ''{1}'' i kolumn ''{2}''.
+ maxOccurLimit = Den aktuella konfigurationen f\u00F6r parsern till\u00E5ter inte att attributv\u00E4rdet f\u00F6r Occurs anges som st\u00F6rre \u00E4n v\u00E4rdet {0}.
+ PublicSystemOnNotation = PublicSystemOnNotation: \u00C5tminstone ett av ''public'' och ''system'' m\u00E5ste anges i elementets ''notation''.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+ FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF (cvc-identity-constraint.4.2.1): \u5143\u7D20 \"{0}\" \u7684\u4E00\u4E2A\u5173\u952E\u5B57\u6CA1\u6709\u503C\u3002
+- DuplicateField = \u5B57\u6BB5 \"{0}\" \u5728\u4F5C\u7528\u57DF\u5185\u6709\u91CD\u590D\u5339\u914D\u3002
+- DuplicateKey = \u4E3A\u5143\u7D20 \"{1}\" \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u58F0\u660E\u7684\u5173\u952E\u5B57\u503C [{0}] \u91CD\u590D\u3002
+- DuplicateUnique = \u4E3A\u5143\u7D20 \"{1}\" \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u58F0\u660E\u7684\u552F\u4E00\u503C [{0}] \u91CD\u590D\u3002
+- FieldMultipleMatch = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF: \u5B57\u6BB5 \"{0}\" \u4E0E\u5176\u9009\u62E9\u5668\u4F5C\u7528\u57DF\u5185\u7684\u591A\u4E2A\u503C\u5339\u914D; \u5B57\u6BB5\u5FC5\u987B\u4E0E\u552F\u4E00\u503C\u5339\u914D\u3002
+- FixedDiffersFromActual = \u6B64\u5143\u7D20\u7684\u5185\u5BB9\u4E0E\u65B9\u6848\u4E2D\u5143\u7D20\u58F0\u660E\u7684 \"fixed\" \u5C5E\u6027\u7684\u503C\u4E0D\u76F8\u540C\u3002
+- KeyMatchesNillable = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF (cvc-identity-constraint.4.2.3): \u5143\u7D20 \"{0}\" \u5177\u6709\u4E00\u4E2A\u4E0E nillable \u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u7684\u5143\u7D20\u5339\u914D\u7684\u5173\u952E\u5B57\u3002
+- KeyNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <key name=\"{1}\"> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
++ AbsentKeyValue = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF (cvc-identity-constraint.4.2.1): \u5143\u7D20 "{0}" \u7684\u4E00\u4E2A\u5173\u952E\u5B57\u6CA1\u6709\u503C\u3002
++ DuplicateField = \u5B57\u6BB5 "{0}" \u5728\u4F5C\u7528\u57DF\u5185\u6709\u91CD\u590D\u5339\u914D\u3002
++ DuplicateKey = \u4E3A\u5143\u7D20 "{1}" \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u58F0\u660E\u7684\u5173\u952E\u5B57\u503C [{0}] \u91CD\u590D\u3002
++ DuplicateUnique = \u4E3A\u5143\u7D20 "{1}" \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u58F0\u660E\u7684\u552F\u4E00\u503C [{0}] \u91CD\u590D\u3002
++ FieldMultipleMatch = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF: \u5B57\u6BB5 "{0}" \u4E0E\u5176\u9009\u62E9\u5668\u4F5C\u7528\u57DF\u5185\u7684\u591A\u4E2A\u503C\u5339\u914D; \u5B57\u6BB5\u5FC5\u987B\u4E0E\u552F\u4E00\u503C\u5339\u914D\u3002
++ FixedDiffersFromActual = \u6B64\u5143\u7D20\u7684\u5185\u5BB9\u4E0E\u65B9\u6848\u4E2D\u5143\u7D20\u58F0\u660E\u7684 "fixed" \u5C5E\u6027\u7684\u503C\u4E0D\u76F8\u540C\u3002
++ KeyMatchesNillable = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF (cvc-identity-constraint.4.2.3): \u5143\u7D20 "{0}" \u5177\u6709\u4E00\u4E2A\u4E0E nillable \u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u7684\u5143\u7D20\u5339\u914D\u7684\u5173\u952E\u5B57\u3002
++ KeyNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <key name="{1}"> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
+ KeyNotFound = \u6CA1\u6709\u4E3A\u5143\u7D20 ''{2}'' \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u627E\u5230\u503C\u4E3A ''{1}'' \u7684\u5173\u952E\u5B57 ''{0}''\u3002
+- KeyRefNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <keyref name=\"{1}\"> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
+- KeyRefOutOfScope = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF: \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6 \"{0}\" \u5177\u6709\u4E00\u4E2A\u5F15\u7528\u4E86\u4F5C\u7528\u57DF\u4E4B\u5916\u7684\u5173\u952E\u5B57\u6216\u552F\u4E00\u503C\u7684 keyref\u3002
+- KeyRefReferNotFound = \u5173\u952E\u5B57\u5F15\u7528\u58F0\u660E \"{0}\" \u5F15\u7528\u4E86\u540D\u4E3A \"{1}\" \u7684\u672A\u77E5\u5173\u952E\u5B57\u3002
+- UniqueNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <unique> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
+- UnknownField = \u5185\u90E8\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF; \u5B57\u6BB5 \"{0}\" \u672A\u77E5\u3002
++ KeyRefNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <keyref name="{1}"> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
++ KeyRefOutOfScope = \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF: \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6 "{0}" \u5177\u6709\u4E00\u4E2A\u5F15\u7528\u4E86\u4F5C\u7528\u57DF\u4E4B\u5916\u7684\u5173\u952E\u5B57\u6216\u552F\u4E00\u503C\u7684 keyref\u3002
++ KeyRefReferNotFound = \u5173\u952E\u5B57\u5F15\u7528\u58F0\u660E "{0}" \u5F15\u7528\u4E86\u540D\u4E3A "{1}" \u7684\u672A\u77E5\u5173\u952E\u5B57\u3002
++ UniqueNotEnoughValues = \u5BF9\u4E8E\u4E3A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <unique> \u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6, \u6CA1\u6709\u4E3A\u5B83\u6307\u5B9A\u8DB3\u591F\u7684\u503C\u3002
++ UnknownField = \u5185\u90E8\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u9519\u8BEF; \u5B57\u6BB5 "{0}" \u672A\u77E5\u3002
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u7684\u503C ''{2}'' \u4E0E\u5176\u7C7B\u578B ''{3}'' \u4E0D\u5339\u914D\u3002
+- cvc-attribute.4 = cvc-attribute.4: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u7684\u503C ''{2}'' \u4E0E\u5176\u56FA\u5B9A\u7684 ''{''value constraint''}'' \u4E0D\u5339\u914D\u3002\u8BE5\u5C5E\u6027\u7684\u503C\u5FC5\u987B\u4E3A ''{3}''\u3002
++ cvc-attribute.4 = cvc-attribute.4: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u7684\u503C ''{2}'' \u4E0E\u5176\u56FA\u5B9A\u7684 '{'value constraint'}' \u4E0D\u5339\u914D\u3002\u8BE5\u5C5E\u6027\u7684\u503C\u5FC5\u987B\u4E3A ''{3}''\u3002
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: \u5143\u7D20 ''{0}'' \u5FC5\u987B\u4E0D\u542B\u5B57\u7B26\u6216\u5143\u7D20\u4FE1\u606F\u9879 [\u5B50\u7EA7], \u56E0\u4E3A\u8BE5\u7C7B\u578B\u7684\u5185\u5BB9\u7C7B\u578B\u4E3A\u7A7A\u3002
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: \u5143\u7D20 ''{0}'' \u5FC5\u987B\u4E0D\u542B\u5143\u7D20 [\u5B50\u7EA7], \u5E76\u4E14\u5176\u503C\u5FC5\u987B\u6709\u6548\u3002
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: \u5143\u7D20 ''{0}'' \u5FC5\u987B\u4E0D\u542B\u5B57\u7B26 [\u5B50\u7EA7], \u56E0\u4E3A\u8BE5\u7C7B\u578B\u7684\u5185\u5BB9\u7C7B\u578B\u4E3A\u201C\u4EC5\u5143\u7D20\u201D\u3002
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: \u5143\u7D20 ''{0}'' \u4E2D\u4E0D\u5141\u8BB8\u51FA\u73B0\u5C5E\u6027 ''{1}''\u3002
+ cvc-complex-type.4 = cvc-complex-type.4: \u5143\u7D20 ''{0}'' \u4E2D\u5FC5\u987B\u5305\u542B\u5C5E\u6027 ''{1}''\u3002
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u662F\u4E00\u4E2A\u901A\u7528 ID\u3002\u4F46\u5DF2\u5B58\u5728\u901A\u7528 ID ''{2}''\u3002\u53EA\u80FD\u6709\u4E00\u4E2A\u901A\u7528 ID\u3002
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u662F\u4E00\u4E2A\u901A\u7528 ID\u3002\u4F46\u5DF2\u6709\u4E00\u4E2A\u5C5E\u6027 ''{2}'' \u662F\u4ECE ''{''attribute uses''}'' \u4E2D\u7684 ID \u6D3E\u751F\u7684\u3002
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: \u5728\u5143\u7D20 ''{0}'' \u4E2D, \u5C5E\u6027 ''{1}'' \u662F\u4E00\u4E2A\u901A\u7528 ID\u3002\u4F46\u5DF2\u6709\u4E00\u4E2A\u5C5E\u6027 ''{2}'' \u662F\u4ECE '{'attribute uses'}' \u4E2D\u7684 ID \u6D3E\u751F\u7684\u3002
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' \u4E0D\u662F ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' \u4E0D\u662F\u5217\u8868\u7C7B\u578B ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' \u4E0D\u662F\u8054\u5408\u7C7B\u578B ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-elt.1 = cvc-elt.1: \u627E\u4E0D\u5230\u5143\u7D20 ''{0}'' \u7684\u58F0\u660E\u3002
+- cvc-elt.2 = cvc-elt.2: ''{0}'' \u7684\u5143\u7D20\u58F0\u660E\u4E2D ''{''abstract''}'' \u7684\u503C\u5FC5\u987B\u4E3A\u201C\u5047\u201D\u3002
+- cvc-elt.3.1 = cvc-elt.3.1: \u5143\u7D20 ''{0}'' \u4E2D\u4E0D\u80FD\u5305\u542B\u5C5E\u6027 ''{1}'', \u56E0\u4E3A ''{0}'' \u7684 ''{''nillable''}'' \u5C5E\u6027\u4E3A\u201C\u5047\u201D\u3002
++ cvc-elt.2 = cvc-elt.2: ''{0}'' \u7684\u5143\u7D20\u58F0\u660E\u4E2D '{'abstract'}' \u7684\u503C\u5FC5\u987B\u4E3A\u201C\u5047\u201D\u3002
++ cvc-elt.3.1 = cvc-elt.3.1: \u5143\u7D20 ''{0}'' \u4E2D\u4E0D\u80FD\u5305\u542B\u5C5E\u6027 ''{1}'', \u56E0\u4E3A ''{0}'' \u7684 '{'nillable'}' \u5C5E\u6027\u4E3A\u201C\u5047\u201D\u3002
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: \u5143\u7D20 ''{0}'' \u5FC5\u987B\u4E0D\u542B\u5B57\u7B26\u6216\u5143\u7D20\u4FE1\u606F [\u5B50\u7EA7], \u56E0\u4E3A\u5DF2\u6307\u5B9A ''{1}''\u3002
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: \u5143\u7D20 ''{0}'' \u4E0D\u80FD\u5305\u542B\u56FA\u5B9A\u7684 ''{''value constraint''}'', \u56E0\u4E3A\u5DF2\u6307\u5B9A ''{1}''\u3002
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: \u5143\u7D20 ''{0}'' \u4E0D\u80FD\u5305\u542B\u56FA\u5B9A\u7684 '{'value constraint'}', \u56E0\u4E3A\u5DF2\u6307\u5B9A ''{1}''\u3002
+ cvc-elt.4.1 = cvc-elt.4.1: \u5143\u7D20 ''{0}'' \u7684\u5C5E\u6027 ''{1}'' \u7684\u503C ''{2}'' \u4E0D\u662F\u6709\u6548\u7684\u9650\u5B9A\u540D\u3002
+ cvc-elt.4.2 = cvc-elt.4.2: \u65E0\u6CD5\u5C06 ''{1}'' \u89E3\u6790\u4E3A\u5143\u7D20 ''{0}'' \u7684\u7C7B\u578B\u5B9A\u4E49\u3002
+ cvc-elt.4.3 = cvc-elt.4.3: \u7C7B\u578B ''{1}'' \u4E0D\u662F\u4ECE\u5143\u7D20 ''{0}'' \u7684\u7C7B\u578B\u5B9A\u4E49 ''{2}'' \u6709\u6548\u6D3E\u751F\u7684\u3002
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: \u5143\u7D20 ''{0}'' \u7684 ''{''value constraint''}'' ''{2}'' \u4E0D\u662F\u7C7B\u578B ''{1}'' \u7684\u6709\u6548\u9ED8\u8BA4\u503C\u3002
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: \u5143\u7D20 ''{0}'' \u7684 '{'value constraint'}' ''{2}'' \u4E0D\u662F\u7C7B\u578B ''{1}'' \u7684\u6709\u6548\u9ED8\u8BA4\u503C\u3002
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: \u5143\u7D20 ''{0}'' \u5FC5\u987B\u4E0D\u542B\u5143\u7D20\u4FE1\u606F\u9879 [\u5B50\u7EA7]\u3002
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0E\u56FA\u5B9A\u7684 ''{''value constraint''}'' \u503C ''{2}'' \u4E0D\u5339\u914D\u3002
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0E ''{''value constraint''}'' \u503C ''{2}'' \u4E0D\u5339\u914D\u3002
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0E\u56FA\u5B9A\u7684 '{'value constraint'}' \u503C ''{2}'' \u4E0D\u5339\u914D\u3002
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0E '{'value constraint'}' \u503C ''{2}'' \u4E0D\u5339\u914D\u3002
+ cvc-enumeration-valid = cvc-enumeration-valid: \u5BF9\u4E8E\u679A\u4E3E ''{1}'', \u503C ''{0}'' \u4E0D\u5177\u6709\u9762\u6709\u6548\u6027\u3002\u5B83\u5FC5\u987B\u662F\u6765\u81EA\u679A\u4E3E\u7684\u503C\u3002
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: \u503C ''{0}'' \u5177\u6709 {1} \u4F4D\u5C0F\u6570, \u4F46\u5C0F\u6570\u4F4D\u6570\u5DF2\u9650\u5236\u4E3A {2}\u3002
+ cvc-id.1 = cvc-id.1: IDREF ''{0}'' \u6CA1\u6709 ID/IDREF \u7ED1\u5B9A\u3002
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: \u7531\u4E8E accessExternalSchema \u5C5E\u6027\u8BBE\u7F6E\u7684\u9650\u5236\u800C\u4E0D\u5141\u8BB8 ''{1}'' \u8BBF\u95EE, \u56E0\u6B64\u65E0\u6CD5\u8BFB\u53D6\u65B9\u6848\u6587\u6863 ''{0}''\u3002
+ schema_reference.4 = schema_reference.4: \u65E0\u6CD5\u8BFB\u53D6\u65B9\u6848\u6587\u6863 ''{0}'', \u539F\u56E0\u4E3A 1) \u65E0\u6CD5\u627E\u5230\u6587\u6863; 2) \u65E0\u6CD5\u8BFB\u53D6\u6587\u6863; 3) \u6587\u6863\u7684\u6839\u5143\u7D20\u4E0D\u662F <xsd:schema>\u3002
+ src-annotation = src-annotation: <annotation> \u5143\u7D20\u53EA\u80FD\u5305\u542B <appinfo> \u548C <documentation> \u5143\u7D20, \u4F46\u53D1\u73B0\u4E86 ''{0}''\u3002
+ src-attribute.1 = src-attribute.1: \u5C5E\u6027\u58F0\u660E ''{0}'' \u4E2D\u4E0D\u80FD\u540C\u65F6\u5B58\u5728\u7279\u6027 ''default'' \u548C ''fixed''\u3002\u5E94\u53EA\u4F7F\u7528\u5176\u4E2D\u4E00\u4E2A\u3002
+@@ -171,31 +143,31 @@
+ ag-props-correct.2 = ag-props-correct.2: \u5C5E\u6027\u7EC4 ''{0}'' \u9519\u8BEF\u3002\u6307\u5B9A\u4E86\u5177\u6709\u76F8\u540C\u540D\u79F0\u548C\u76EE\u6807\u540D\u79F0\u7A7A\u95F4\u7684\u91CD\u590D\u5C5E\u6027\u7528\u6CD5\u3002\u91CD\u590D\u5C5E\u6027\u7528\u6CD5\u7684\u540D\u79F0\u4E3A ''{1}''\u3002
+ ag-props-correct.3 = ag-props-correct.3: \u5C5E\u6027\u7EC4 ''{0}'' \u9519\u8BEF\u3002\u4E24\u4E2A\u5C5E\u6027\u58F0\u660E ''{1}'' \u548C ''{2}'' \u5177\u6709\u7684\u7C7B\u578B\u662F\u4ECE ID \u6D3E\u751F\u7684\u3002
+ a-props-correct.2 = a-props-correct.2: \u5C5E\u6027 ''{0}'' \u4E2D\u7684\u503C\u7EA6\u675F\u6761\u4EF6\u7684\u503C ''{1}'' \u65E0\u6548\u3002
+- a-props-correct.3 = a-props-correct.3: \u5C5E\u6027 ''{0}'' \u4E0D\u80FD\u4F7F\u7528 ''fixed'' \u6216 ''default'', \u56E0\u4E3A\u5176 ''{''type definition''}'' \u4E3A ID, \u6216\u8005\u662F\u4ECE ID \u6D3E\u751F\u7684\u3002
+- au-props-correct.2 = au-props-correct.2: \u5728 ''{0}'' \u7684\u5C5E\u6027\u58F0\u660E\u4E2D, \u6307\u5B9A\u4E86\u56FA\u5B9A\u503C ''{1}''\u3002\u56E0\u6B64\u5982\u679C\u5F15\u7528 ''{0}'' \u7684\u5C5E\u6027\u7528\u6CD5\u540C\u65F6\u5177\u6709 ''{''value constraint''}'', \u5219\u5B83\u5FC5\u987B\u662F\u56FA\u5B9A\u7684, \u5E76\u4E14\u5176\u503C\u5FC5\u987B\u4E3A ''{1}''\u3002
++ a-props-correct.3 = a-props-correct.3: \u5C5E\u6027 ''{0}'' \u4E0D\u80FD\u4F7F\u7528 ''fixed'' \u6216 ''default'', \u56E0\u4E3A\u5176 '{'type definition'}' \u4E3A ID, \u6216\u8005\u662F\u4ECE ID \u6D3E\u751F\u7684\u3002
++ au-props-correct.2 = au-props-correct.2: \u5728 ''{0}'' \u7684\u5C5E\u6027\u58F0\u660E\u4E2D, \u6307\u5B9A\u4E86\u56FA\u5B9A\u503C ''{1}''\u3002\u56E0\u6B64\u5982\u679C\u5F15\u7528 ''{0}'' \u7684\u5C5E\u6027\u7528\u6CD5\u540C\u65F6\u5177\u6709 '{'value constraint'}', \u5219\u5B83\u5FC5\u987B\u662F\u56FA\u5B9A\u7684, \u5E76\u4E14\u5176\u503C\u5FC5\u987B\u4E3A ''{1}''\u3002
+ cos-all-limited.1.2 = cos-all-limited.1.2: '{'min occurs'}' = '{'max occurs'}' = 1 \u7684\u7C92\u5B50\u4E2D\u5FC5\u987B\u5305\u542B 'all' \u6A21\u578B\u7EC4, \u8BE5\u7C92\u5B50\u5FC5\u987B\u662F\u7EC4\u6210\u590D\u6742\u7C7B\u578B\u5B9A\u4E49\u7684 '{'content type'}' \u5BF9\u7684\u4E00\u90E8\u5206\u3002
+- cos-all-limited.2 = cos-all-limited.2: \u5728 ''all'' \u6A21\u578B\u7EC4\u4E2D\u5143\u7D20\u7684 ''{''max occurs''}'' \u5FC5\u987B\u4E3A 0 \u6216 1\u3002\u5143\u7D20 ''{1}'' \u7684\u503C ''{0}'' \u65E0\u6548\u3002
++ cos-all-limited.2 = cos-all-limited.2: \u5728 ''all'' \u6A21\u578B\u7EC4\u4E2D\u5143\u7D20\u7684 '{'max occurs'}' \u5FC5\u987B\u4E3A 0 \u6216 1\u3002\u5143\u7D20 ''{1}'' \u7684\u503C ''{0}'' \u65E0\u6548\u3002
+ cos-applicable-facets = cos-applicable-facets: \u7C7B\u578B {1} \u4E0D\u5141\u8BB8\u9762 ''{0}''\u3002
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: \u7C7B\u578B ''{0}'' \u662F\u4ECE\u7C7B\u578B ''{1}'' \u7684\u6269\u5C55\u6D3E\u751F\u7684\u3002\u4F46\u662F, ''{1}'' \u7684 ''final'' \u5C5E\u6027\u7981\u6B62\u7531\u6269\u5C55\u6D3E\u751F\u3002
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: \u6D3E\u751F\u7C7B\u578B\u53CA\u5176\u57FA\u7C7B\u578B\u7684\u5185\u5BB9\u7C7B\u578B\u90FD\u5FC5\u987B\u4E3A\u201C\u6DF7\u5408\u201D\u6216\u201C\u4EC5\u5143\u7D20\u201D\u3002\u7C7B\u578B ''{0}'' \u4E3A\u201C\u4EC5\u5143\u7D20\u201D, \u4F46\u5176\u57FA\u7C7B\u578B\u4E0D\u662F\u3002
+ cos-ct-extends.1.4.3.2.2.1.b = cos-ct-extends.1.4.3.2.2.1.b: \u6D3E\u751F\u7C7B\u578B\u53CA\u5176\u57FA\u7C7B\u578B\u7684\u5185\u5BB9\u7C7B\u578B\u90FD\u5FC5\u987B\u4E3A\u201C\u6DF7\u5408\u201D\u6216\u201C\u4EC5\u5143\u7D20\u201D\u3002\u7C7B\u578B ''{0}'' \u4E3A\u201C\u6DF7\u5408\u201D, \u4F46\u5176\u57FA\u7C7B\u578B\u4E0D\u662F\u3002
+ cos-element-consistent = cos-element-consistent: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u6A21\u578B\u7EC4\u4E2D\u5B58\u5728\u540D\u79F0\u4E3A ''{1}'' \u4E14\u5177\u6709\u4E0D\u540C\u7C7B\u578B\u7684\u591A\u4E2A\u5143\u7D20\u3002
+ cos-list-of-atomic = cos-list-of-atomic: \u5728\u5217\u8868\u7C7B\u578B ''{0}'' \u7684\u5B9A\u4E49\u4E2D, \u7C7B\u578B ''{1}'' \u662F\u65E0\u6548\u7684\u5217\u8868\u5143\u7D20\u7C7B\u578B, \u56E0\u4E3A\u5B83\u4E0D\u662F\u539F\u5B50 (''{1}'' \u65E2\u4E0D\u662F\u5217\u8868\u7C7B\u578B, \u4E5F\u4E0D\u662F\u5305\u542B\u5217\u8868\u7684\u8054\u5408\u7C7B\u578B)\u3002
+- cos-nonambig = cos-nonambig: {0} \u548C {1} (\u6216\u6765\u81EA\u5176\u66FF\u4EE3\u7EC4\u7684\u5143\u7D20) \u8FDD\u53CD\u4E86 \"\u552F\u4E00\u7C92\u5B50\u5C5E\u6027\"\u3002\u6839\u636E\u6B64\u65B9\u6848\u8FDB\u884C\u9A8C\u8BC1\u671F\u95F4, \u8FD9\u4E24\u4E2A\u7C92\u5B50\u4F1A\u9020\u6210\u6B67\u4E49\u3002
++ cos-nonambig = cos-nonambig: {0} \u548C {1} (\u6216\u6765\u81EA\u5176\u66FF\u4EE3\u7EC4\u7684\u5143\u7D20) \u8FDD\u53CD\u4E86 "\u552F\u4E00\u7C92\u5B50\u5C5E\u6027"\u3002\u6839\u636E\u6B64\u65B9\u6848\u8FDB\u884C\u9A8C\u8BC1\u671F\u95F4, \u8FD9\u4E24\u4E2A\u7C92\u5B50\u4F1A\u9020\u6210\u6B67\u4E49\u3002
+ cos-particle-restrict.a = cos-particle-restrict.a: \u6D3E\u751F\u7684\u7C92\u5B50\u4E3A\u7A7A, \u800C\u57FA\u7C92\u5B50\u4E0D\u53EF\u4E3A\u7A7A\u3002
+ cos-particle-restrict.b = cos-particle-restrict.b: \u57FA\u7C92\u5B50\u4E3A\u7A7A, \u4F46\u6D3E\u751F\u7C92\u5B50\u4E0D\u4E3A\u7A7A\u3002
+ cos-particle-restrict.2 = cos-particle-restrict.2: \u7981\u6B62\u7C92\u5B50\u9650\u5236: ''{0}''\u3002
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: \u7C7B\u578B ''{1}'' \u4E3A\u539F\u5B50, \u56E0\u6B64\u5176 ''{''base type definition''}'' ''{0}'' \u5FC5\u987B\u4E3A\u539F\u5B50\u7B80\u5355\u7C7B\u578B\u5B9A\u4E49\u6216\u5185\u7F6E\u57FA\u5143\u6570\u636E\u7C7B\u578B\u3002
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: \u7C7B\u578B ''{1}'' \u4E3A\u539F\u5B50, \u56E0\u6B64\u5176 '{'base type definition'}' ''{0}'' \u5FC5\u987B\u4E3A\u539F\u5B50\u7B80\u5355\u7C7B\u578B\u5B9A\u4E49\u6216\u5185\u7F6E\u57FA\u5143\u6570\u636E\u7C7B\u578B\u3002
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: \u5728\u5217\u8868\u7C7B\u578B ''{0}'' \u7684\u5B9A\u4E49\u4E2D, \u7C7B\u578B ''{1}'' \u662F\u65E0\u6548\u7684\u9879\u7C7B\u578B, \u56E0\u4E3A\u5B83\u65E2\u4E0D\u662F\u5217\u8868\u7C7B\u578B, \u4E5F\u4E0D\u662F\u5305\u542B\u5217\u8868\u7684\u8054\u5408\u7C7B\u578B\u3002
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: ''{''item type definition''}'' \u7684 ''{''final''}'' \u7EC4\u4EF6 ''{0}'' \u5305\u542B ''list''\u3002\u8FD9\u8868\u793A ''{0}'' \u4E0D\u80FD\u7528\u4F5C\u5217\u8868\u7C7B\u578B ''{1}'' \u7684\u9879\u7C7B\u578B\u3002
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: ''{''member type definitions''}'' ''{0}'' \u7684 ''{''final''}'' \u7EC4\u4EF6\u5305\u542B ''union''\u3002\u8FD9\u8868\u793A ''{0}'' \u4E0D\u80FD\u7528\u4F5C\u8054\u5408\u7C7B\u578B ''{1}'' \u7684\u6210\u5458\u7C7B\u578B\u3002
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' \u7684 '{'final'}' \u7EC4\u4EF6 ''{0}'' \u5305\u542B ''list''\u3002\u8FD9\u8868\u793A ''{0}'' \u4E0D\u80FD\u7528\u4F5C\u5217\u8868\u7C7B\u578B ''{1}'' \u7684\u9879\u7C7B\u578B\u3002
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' ''{0}'' \u7684 '{'final'}' \u7EC4\u4EF6\u5305\u542B ''union''\u3002\u8FD9\u8868\u793A ''{0}'' \u4E0D\u80FD\u7528\u4F5C\u8054\u5408\u7C7B\u578B ''{1}'' \u7684\u6210\u5458\u7C7B\u578B\u3002
+ cos-valid-default.2.1 = cos-valid-default.2.1: \u5143\u7D20 ''{0}'' \u5177\u6709\u503C\u7EA6\u675F\u6761\u4EF6, \u5E76\u4E14\u5FC5\u987B\u5177\u6709\u201C\u6DF7\u5408\u201D\u6216\u201C\u7B80\u5355\u201D\u5185\u5BB9\u6A21\u578B\u3002
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u7531\u4E8E\u5143\u7D20 ''{0}'' \u5177\u6709 ''{''value constraint''}'', \u5E76\u4E14\u5176\u7C7B\u578B\u5B9A\u4E49\u5177\u6709\u6DF7\u5408\u7684 ''{''content type''}'', \u5219 ''{''content type''}'' \u7684\u7C92\u5B50\u5FC5\u987B\u53EF\u4E3A\u7A7A\u3002
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u7531\u4E8E\u5143\u7D20 ''{0}'' \u5177\u6709 '{'value constraint'}', \u5E76\u4E14\u5176\u7C7B\u578B\u5B9A\u4E49\u5177\u6709\u6DF7\u5408\u7684 '{'content type'}', \u5219 '{'content type'}' \u7684\u7C92\u5B50\u5FC5\u987B\u53EF\u4E3A\u7A7A\u3002
+ c-props-correct.2 = c-props-correct.2: \u952E\u5F15\u7528 ''{0}'' \u548C\u952E ''{1}'' \u4E2D\u5B57\u6BB5\u7684\u57FA\u6570\u5FC5\u987B\u76F8\u540C\u3002
+ ct-props-correct.3 = ct-props-correct.3: \u5728\u590D\u6742\u7C7B\u578B ''{0}'' \u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u5B9A\u4E49\u3002\u8FD9\u8868\u793A ''{0}'' \u5305\u542B\u5728\u5176\u81EA\u8EAB\u7684\u7C7B\u578B\u5206\u5C42\u7ED3\u6784\u4E2D, \u8FD9\u662F\u9519\u8BEF\u7684\u3002
+ ct-props-correct.4 = ct-props-correct.4: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u6307\u5B9A\u4E86\u5177\u6709\u76F8\u540C\u540D\u79F0\u548C\u76EE\u6807\u540D\u79F0\u7A7A\u95F4\u7684\u91CD\u590D\u5C5E\u6027\u7528\u6CD5\u3002\u91CD\u590D\u5C5E\u6027\u7528\u6CD5\u7684\u540D\u79F0\u4E3A ''{1}''\u3002
+ ct-props-correct.5 = ct-props-correct.5: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u4E24\u4E2A\u5C5E\u6027\u58F0\u660E ''{1}'' \u548C ''{2}'' \u5177\u6709\u4ECE ID \u6D3E\u751F\u7684\u7C7B\u578B\u3002
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: \u7C7B\u578B ''{0}'' \u7531\u9650\u5236\u4ECE\u7C7B\u578B ''{1}'' \u6D3E\u751F\u3002\u4F46\u662F, ''{1}'' \u5177\u6709\u7981\u6B62\u7531\u9650\u5236\u6D3E\u751F\u7684 ''{''final''}'' \u5C5E\u6027\u3002
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: \u7C7B\u578B ''{0}'' \u7531\u9650\u5236\u4ECE\u7C7B\u578B ''{1}'' \u6D3E\u751F\u3002\u4F46\u662F, ''{1}'' \u5177\u6709\u7981\u6B62\u7531\u9650\u5236\u6D3E\u751F\u7684 '{'final'}' \u5C5E\u6027\u3002
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u6B64\u7C7B\u578B\u4E2D\u7684\u5C5E\u6027\u7528\u6CD5 ''{1}'' \u5177\u6709 ''{2}'' \u7684 ''use'' \u503C, \u8FD9\u4E0E\u57FA\u7C7B\u578B\u4E2D\u7684\u5339\u914D\u5C5E\u6027\u7528\u6CD5\u7684 ''required'' \u503C\u4E0D\u4E00\u81F4\u3002
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u6B64\u7C7B\u578B\u4E2D\u7684\u5C5E\u6027\u7528\u6CD5 ''{1}'' \u5177\u6709\u7C7B\u578B ''{2}'', \u5B83\u4E0D\u662F\u4ECE\u57FA\u7C7B\u578B\u4E2D\u7684\u5339\u914D\u5C5E\u6027\u7528\u6CD5\u7684\u7C7B\u578B ''{3}'' \u6709\u6548\u6D3E\u751F\u7684\u3002
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002\u6B64\u7C7B\u578B\u4E2D\u7684\u5C5E\u6027\u7528\u6CD5 ''{1}'' \u5177\u6709\u4E0D\u56FA\u5B9A\u7684\u6709\u6548\u503C\u7EA6\u675F\u6761\u4EF6, \u800C\u57FA\u7C7B\u578B\u4E2D\u7684\u5339\u914D\u5C5E\u6027\u7528\u6CD5\u7684\u6709\u6548\u503C\u7EA6\u675F\u6761\u4EF6\u662F\u56FA\u5B9A\u7684\u3002
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: {2} ''{1}'' \u4F7F\u7528\u7684 NOTATION \u7C7B\u578B ''{0}'' \u5FC5\u987B\u5177\u6709\u679A\u4E3E\u9762\u503C, \u7528\u4E8E\u6307\u5B9A\u6B64\u7C7B\u578B\u4F7F\u7528\u7684\u6CE8\u91CA\u5143\u7D20\u3002
+ enumeration-valid-restriction = enumeration-valid-restriction: \u679A\u4E3E\u503C ''{0}'' \u4E0D\u5728\u57FA\u7C7B\u578B {1} \u7684\u503C\u7A7A\u95F4\u4E2D\u3002
+ e-props-correct.2 = e-props-correct.2: \u5143\u7D20 ''{0}'' \u4E2D\u7684\u503C\u7EA6\u675F\u6761\u4EF6\u7684\u503C ''{1}'' \u65E0\u6548\u3002
+- e-props-correct.4 = e-props-correct.4: \u5143\u7D20 ''{0}'' \u7684 ''{''type definition''}'' \u4E0D\u662F\u4ECE substitutionHead ''{1}'' \u7684 ''{''type definition''}'' \u6709\u6548\u6D3E\u751F\u7684, \u6216\u8005 ''{1}'' \u7684 ''{''substitution group exclusions''}'' \u5C5E\u6027\u4E0D\u5141\u8BB8\u8FDB\u884C\u6B64\u6D3E\u751F\u3002
+- e-props-correct.5 = e-props-correct.5: \u5143\u7D20 ''{0}'' \u4E2D\u4E0D\u80FD\u5305\u542B ''{''value constraint''}'', \u56E0\u4E3A\u5143\u7D20\u7684 ''{''type definition''}'' \u6216 ''{''type definition''}'' \u7684 ''{''content type''}'' \u4E3A ID, \u6216\u8005\u662F\u4ECE ID \u6D3E\u751F\u7684\u3002
++ e-props-correct.4 = e-props-correct.4: \u5143\u7D20 ''{0}'' \u7684 '{'type definition'}' \u4E0D\u662F\u4ECE substitutionHead ''{1}'' \u7684 '{'type definition'}' \u6709\u6548\u6D3E\u751F\u7684, \u6216\u8005 ''{1}'' \u7684 '{'substitution group exclusions'}' \u5C5E\u6027\u4E0D\u5141\u8BB8\u8FDB\u884C\u6B64\u6D3E\u751F\u3002
++ e-props-correct.5 = e-props-correct.5: \u5143\u7D20 ''{0}'' \u4E2D\u4E0D\u80FD\u5305\u542B '{'value constraint'}', \u56E0\u4E3A\u5143\u7D20\u7684 '{'type definition'}' \u6216 '{'type definition'}' \u7684 '{'content type'}' \u4E3A ID, \u6216\u8005\u662F\u4ECE ID \u6D3E\u751F\u7684\u3002
+ e-props-correct.6 = e-props-correct.6: \u5728\u5143\u7D20 ''{0}'' \u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u66FF\u4EE3\u7EC4\u3002
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''fractionDigits'' \u7684\u503C ''{0}'' \u65E0\u6548, \u56E0\u4E3A\u8BE5\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E ''fractionDigits'' \u7684\u503C, \u4F46\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u5DF2\u5C06\u5176\u8BBE\u7F6E\u4E3A ''{1}''\u3002
+ fractionDigits-totalDigits = fractionDigits-totalDigits: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''fractionDigits'' \u7684\u503C ''{0}'' \u65E0\u6548, \u56E0\u4E3A\u8BE5\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E ''totalDigits'' \u7684\u503C ''{1}''\u3002
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: \u7C7B\u578B ''{2}'' \u9519\u8BEF\u3002maxInclusive \u503C ''{0}'' \u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E\u57FA\u7C7B\u578B ''{1}'' \u7684 minInclusive\u3002
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: \u7C7B\u578B ''{2}'' \u9519\u8BEF\u3002maxInclusive \u503C ''{0}'' \u5FC5\u987B\u5927\u4E8E\u57FA\u7C7B\u578B ''{1}'' \u7684 minExclusive\u3002
+ maxLength-valid-restriction = maxLength-valid-restriction: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, maxLength \u503C ''{0}'' \u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E\u57FA\u7C7B\u578B ''{1}'' \u7684 maxLength\u3002
+- mg-props-correct.2 = mg-props-correct.2: \u5728\u7EC4 ''{0}'' \u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u5B9A\u4E49\u3002\u9012\u5F52\u8DDF\u968F\u7C92\u5B50\u7684 ''{''term''}'' \u4EE5\u4E0B\u503C\u4F1A\u5F15\u5BFC\u5230\u5176 ''{''term''}'' \u662F\u7EC4\u81EA\u8EAB\u7684\u7C92\u5B50\u3002
++ mg-props-correct.2 = mg-props-correct.2: \u5728\u7EC4 ''{0}'' \u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u5B9A\u4E49\u3002\u9012\u5F52\u8DDF\u968F\u7C92\u5B50\u7684 '{'term'}' \u4EE5\u4E0B\u503C\u4F1A\u5F15\u5BFC\u5230\u5176 '{'term'}' \u662F\u7EC4\u81EA\u8EAB\u7684\u7C92\u5B50\u3002
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, minExclusive \u503C ''{0}'' \u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E maxExclusive \u503C ''{1}''\u3002
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, minExclusive \u503C ''{0}'' \u5FC5\u987B\u5C0F\u4E8E maxInclusive \u503C ''{1}''\u3002
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: \u7C7B\u578B ''{2}'' \u9519\u8BEF\u3002minExclusive \u503C ''{0}'' \u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E\u57FA\u7C7B\u578B ''{1}'' \u7684 minExclusive\u3002
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, minLength \u7684\u503C ''{0}'' \u5FC5\u987B\u5C0F\u4E8E maxLength \u7684\u503C ''{1}''\u3002
+ minLength-valid-restriction = minLength-valid-restriction: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, minLength ''{0}'' \u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E\u57FA\u7C7B\u578B\u7684 minLength ''{1}''\u3002
+ no-xmlns = no-xmlns: \u5C5E\u6027\u58F0\u660E\u7684 {name} \u4E0D\u80FD\u4E0E 'xmlns' \u5339\u914D\u3002
+- no-xsi = no-xsi: \u5C5E\u6027\u58F0\u660E\u7684 ''{''target namespace''}'' \u4E0D\u80FD\u4E0E ''{0}'' \u5339\u914D\u3002
++ no-xsi = no-xsi: \u5C5E\u6027\u58F0\u660E\u7684 '{'target namespace'}' \u4E0D\u80FD\u4E0E ''{0}'' \u5339\u914D\u3002
+ p-props-correct.2.1 = p-props-correct.2.1: \u5728 ''{0}'' \u7684\u58F0\u660E\u4E2D, ''minOccurs'' \u7684\u503C\u4E3A ''{1}'', \u4F46\u8BE5\u503C\u4E0D\u80FD\u5927\u4E8E ''maxOccurs'' \u7684\u503C ''{2}''\u3002
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: \u7C92\u5B50\u4E4B\u95F4\u6CA1\u6709\u5B8C\u6574\u7684\u529F\u80FD\u6620\u5C04\u3002
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: \u7EC4\u7684\u53D1\u751F\u8303\u56F4 ({0},{1}) \u4E0D\u5728\u57FA\u7EC4\u7684\u53D1\u751F\u8303\u56F4 ({2},{3}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: \u5143\u7D20\u7684\u540D\u79F0\u548C\u76EE\u6807\u540D\u79F0\u7A7A\u95F4\u4E0D\u76F8\u540C: \u540D\u79F0\u7A7A\u95F4 ''{1}'' \u4E2D\u7684\u5143\u7D20\u4E3A ''{0}'', \u540D\u79F0\u7A7A\u95F4 ''{3}'' \u4E2D\u7684\u5143\u7D20\u4E3A ''{2}''\u3002
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: \u5176 ''{''term''}'' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u5143\u7D20\u58F0\u660E\u7684 ''{''nillable''}'' \u4E3A\u201C\u771F\u201D, \u4F46\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7684\u7C92\u5B50\u5177\u6709 ''{''nillable''}'' \u4E3A\u201C\u5047\u201D\u7684\u5143\u7D20\u58F0\u660E\u3002
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: \u5176 ''{''term''}'' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u8BE5\u7C92\u5B50\u7684\u53D1\u751F\u8303\u56F4 ({1},{2}) \u4E0D\u5728\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7C92\u5B50\u7684\u8303\u56F4 ({3},{4}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: \u5176 '{'term'}' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u5143\u7D20\u58F0\u660E\u7684 '{'nillable'}' \u4E3A\u201C\u771F\u201D, \u4F46\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7684\u7C92\u5B50\u5177\u6709 '{'nillable'}' \u4E3A\u201C\u5047\u201D\u7684\u5143\u7D20\u58F0\u660E\u3002
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: \u5176 '{'term'}' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u8BE5\u7C92\u5B50\u7684\u53D1\u751F\u8303\u56F4 ({1},{2}) \u4E0D\u5728\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7C92\u5B50\u7684\u8303\u56F4 ({3},{4}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: \u5143\u7D20 ''{0}'' \u4E0D\u662F\u56FA\u5B9A\u7684, \u4F46\u57FA\u7C7B\u578B\u4E2D\u7684\u5BF9\u5E94\u5143\u7D20\u662F\u56FA\u5B9A\u7684, \u4E14\u503C\u4E3A ''{1}''\u3002
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: \u5143\u7D20 ''{0}'' \u662F\u56FA\u5B9A\u7684, \u4E14\u503C\u4E3A ''{1}'', \u4F46\u57FA\u7C7B\u578B\u4E2D\u7684\u5BF9\u5E94\u5143\u7D20\u662F\u56FA\u5B9A\u7684, \u4E14\u503C\u4E3A ''{2}''\u3002
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: \u5143\u7D20 ''{0}'' \u7684\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u4E0D\u662F\u57FA\u7C7B\u578B\u4E2D\u90A3\u4E9B\u8EAB\u4EFD\u7EA6\u675F\u6761\u4EF6\u7684\u5B50\u96C6\u3002
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: \u5143\u7D20 ''{0}'' \u7684\u4E0D\u63A5\u53D7\u66FF\u4EE3\u4E0D\u662F\u57FA\u5143\u7D20\u4E2D\u4E0D\u63A5\u53D7\u66FF\u4EE3\u7684\u8D85\u96C6\u3002
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: \u5143\u7D20 ''{0}'' \u7684\u7C7B\u578B ''{1}'' \u4E0D\u662F\u4ECE\u57FA\u5143\u7D20\u7684\u7C7B\u578B ''{2}'' \u6D3E\u751F\u7684\u3002
+ rcase-NSCompat.1 = rcase-NSCompat.1: \u5143\u7D20 ''{0}'' \u5177\u6709\u540D\u79F0\u7A7A\u95F4 ''{1}'', \u5728\u57FA\u5143\u7D20\u4E2D, \u901A\u914D\u7B26\u4E0D\u5141\u8BB8\u5177\u6709\u6B64\u540D\u79F0\u7A7A\u95F4\u3002
+- rcase-NSCompat.2 = rcase-NSCompat.2: \u5176 ''{''term''}'' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u8BE5\u7C92\u5B50\u7684\u53D1\u751F\u8303\u56F4 ({1},{2}) \u4E0D\u5728\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7C92\u5B50\u7684\u8303\u56F4 ({3},{4}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
++ rcase-NSCompat.2 = rcase-NSCompat.2: \u5176 '{'term'}' \u4E3A\u5143\u7D20\u58F0\u660E ''{0}'' \u7684\u7C92\u5B50\u9519\u8BEF\u3002\u8BE5\u7C92\u5B50\u7684\u53D1\u751F\u8303\u56F4 ({1},{2}) \u4E0D\u5728\u57FA\u7C7B\u578B\u4E2D\u5BF9\u5E94\u7C92\u5B50\u7684\u8303\u56F4 ({3},{4}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: \u7C92\u5B50\u4E4B\u95F4\u6CA1\u6709\u5B8C\u6574\u7684\u529F\u80FD\u6620\u5C04\u3002
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: \u7EC4\u7684\u53D1\u751F\u8303\u56F4 ({0},{1}) \u4E0D\u5728\u57FA\u672C\u901A\u914D\u7B26\u8303\u56F4 ({2},{3}) \u7684\u6709\u6548\u9650\u5236\u4E4B\u5185\u3002
+ rcase-NSSubset.1 = rcase-NSSubset.1: \u901A\u914D\u7B26\u4E0D\u662F\u57FA\u672C\u901A\u914D\u7B26\u4E2D\u5BF9\u5E94\u901A\u914D\u7B26\u7684\u5B50\u96C6\u3002
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: \u65B9\u6848\u4E0D\u80FD\u5305\u542B\u5177\u6709\u76F8\u540C\u540D\u79F0\u7684\u4E24\u4E2A\u5168\u5C40\u7EC4\u4EF6; \u800C\u6B64\u65B9\u6848\u4E2D\u5305\u542B\u4E24\u4E2A ''{0}''\u3002
+ st-props-correct.2 = st-props-correct.2: \u5728\u7B80\u5355\u7C7B\u578B ''{0}'' \u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u5B9A\u4E49\u3002\u8FD9\u8868\u793A ''{0}'' \u5305\u542B\u5728\u5176\u81EA\u8EAB\u7684\u7C7B\u578B\u5206\u5C42\u7ED3\u6784\u4E2D, \u8FD9\u662F\u9519\u8BEF\u7684\u3002
+- st-props-correct.3 = st-props-correct.3: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002''{''base type definition''}'' \u7684 ''{''final''}'' \u7684\u503C ''{1}'' \u7981\u6B62\u7531\u9650\u5236\u6D3E\u751F\u3002
++ st-props-correct.3 = st-props-correct.3: \u7C7B\u578B ''{0}'' \u9519\u8BEF\u3002'{'base type definition'}' \u7684 '{'final'}' \u7684\u503C ''{1}'' \u7981\u6B62\u7531\u9650\u5236\u6D3E\u751F\u3002
+ totalDigits-valid-restriction = totalDigits-valid-restriction: \u5728 {2} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''totalDigits'' \u7684\u503C ''{0}'' \u65E0\u6548, \u56E0\u4E3A\u8BE5\u503C\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E ''totalDigits'' \u7684\u503C, \u800C\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u5DF2\u5C06\u5176\u8BBE\u7F6E\u4E3A ''{1}''\u3002
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: \u5728 {0} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''whitespace'' \u7684\u503C ''{1}'' \u65E0\u6548, \u56E0\u4E3A ''whitespace'' \u7684\u503C\u5DF2\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u8BBE\u7F6E\u4E3A ''collapse''\u3002
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: \u5728 {0} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''whitespace'' \u7684\u503C ''preserve'' \u65E0\u6548, \u56E0\u4E3A ''whitespace'' \u7684\u503C\u5DF2\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u8BBE\u7F6E\u4E3A ''replace''\u3002
+@@ -309,9 +281,9 @@
+ c-selector-xpath = c-selector-xpath: \u9009\u62E9\u5668\u503C ''{0}'' \u65E0\u6548; \u9009\u62E9\u5668 xpath \u4E0D\u80FD\u5305\u542B\u5C5E\u6027\u3002
+ EmptyTargetNamespace = EmptyTargetNamespace: \u5728\u65B9\u6848\u6587\u6863 ''{0}'' \u4E2D, ''targetNamespace'' \u5C5E\u6027\u7684\u503C\u4E0D\u80FD\u4E3A\u7A7A\u5B57\u7B26\u4E32\u3002
+ FacetValueFromBase = FacetValueFromBase: \u5728\u7C7B\u578B ''{0}'' \u7684\u58F0\u660E\u4E2D, \u9762 ''{2}'' \u7684\u503C ''{1}'' \u5FC5\u987B\u6765\u81EA\u57FA\u7C7B\u578B\u7684\u503C\u7A7A\u95F4 ''{3}''\u3002
+- FixedFacetValue = FixedFacetValue: \u5728 {3} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''{0}'' \u7684\u503C ''{1}'' \u65E0\u6548, \u56E0\u4E3A ''{0}'' \u7684\u503C\u5DF2\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u8BBE\u7F6E\u4E3A ''{2}'', \u5E76\u4E14 ''{''fixed''}'' = true\u3002
++ FixedFacetValue = FixedFacetValue: \u5728 {3} \u7684\u5B9A\u4E49\u4E2D, \u9762 ''{0}'' \u7684\u503C ''{1}'' \u65E0\u6548, \u56E0\u4E3A ''{0}'' \u7684\u503C\u5DF2\u5728\u539F\u7EA7\u7C7B\u578B\u4E4B\u4E00\u4E2D\u8BBE\u7F6E\u4E3A ''{2}'', \u5E76\u4E14 '{'fixed'}' = true\u3002
+ InvalidRegex = InvalidRegex: \u6A21\u5F0F\u503C ''{0}'' \u4E0D\u662F\u6709\u6548\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u3002\u5217 ''{2}'' \u4E0A\u62A5\u544A\u7684\u9519\u8BEF\u4E3A: ''{1}''\u3002
+- maxOccurLimit = \u8BED\u6CD5\u5206\u6790\u5668\u7684\u5F53\u524D\u914D\u7F6E\u4E0D\u5141\u8BB8\u5C06 maxOccurs \u5C5E\u6027\u503C\u8BBE\u7F6E\u4E3A\u5927\u4E8E\u503C {0}\u3002
++ maxOccurLimit = \u89E3\u6790\u5668\u7684\u5F53\u524D\u914D\u7F6E\u4E0D\u5141\u8BB8\u5C06 maxOccurs \u5C5E\u6027\u503C\u8BBE\u7F6E\u4E3A\u5927\u4E8E\u503C {0}\u3002
+ PublicSystemOnNotation = PublicSystemOnNotation: \u5143\u7D20 ''notation'' \u4E2D\u5FC5\u987B\u81F3\u5C11\u51FA\u73B0 ''public'' \u548C ''system'' \u4E2D\u7684\u4E00\u4E2A\u3002
+ SchemaLocation = SchemaLocation: schemaLocation \u503C ''{0}'' \u5FC5\u987B\u5177\u6709\u5076\u6570\u4E2A URI\u3002
+ TargetNamespace.1 = TargetNamespace.1: \u5E94\u4E3A\u540D\u79F0\u7A7A\u95F4 ''{0}'', \u4F46\u65B9\u6848\u6587\u6863\u7684\u76EE\u6807\u540D\u79F0\u7A7A\u95F4\u4E3A ''{1}''\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,35 +1,7 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file contains error and warning messages related to XML Schema
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XMLSchemaMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSchemaMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+ FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+@@ -42,20 +14,20 @@
+
+ # Identity constraints
+
+- AbsentKeyValue = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4 (cvc-identity-constraint.4.2.1): \u5143\u7D20 \"{0}\" \u5177\u6709\u7684\u91D1\u9470\u6C92\u6709\u503C\u3002
+- DuplicateField = \u7BC4\u570D\u4E2D\u7684\u6B04\u4F4D \"{0}\" \u91CD\u8907\u914D\u5C0D\u3002
+- DuplicateKey = \u70BA\u5143\u7D20 \"{1}\" \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u5BA3\u544A\u4E86\u91CD\u8907\u7684\u91D1\u9470\u503C [{0}]\u3002
+- DuplicateUnique = \u70BA\u5143\u7D20 \"{1}\" \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u5BA3\u544A\u4E86\u91CD\u8907\u7684\u552F\u4E00\u503C [{0}]\u3002
+- FieldMultipleMatch = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4: \u6B04\u4F4D \"{0}\" \u7B26\u5408\u5176\u9078\u53D6\u5668\u7BC4\u570D\u5167\u8D85\u904E\u4E00\u500B\u4EE5\u4E0A\u7684\u503C; \u6B04\u4F4D\u5FC5\u9808\u7B26\u5408\u552F\u4E00\u503C\u3002
+- FixedDiffersFromActual = \u6B64\u5143\u7D20\u7684\u5167\u5BB9\u4E0D\u7B49\u65BC\u7DB1\u8981\u5143\u7D20\u5BA3\u544A\u4E2D \"fixed\" \u5C6C\u6027\u7684\u503C\u3002
+- KeyMatchesNillable = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4 (cvc-identity-constraint.4.2.3): \u5143\u7D20 \"{0}\" \u5177\u6709\u7684\u91D1\u9470\uFF0C\u7B26\u5408 nillable \u8A2D\u70BA\u771F\u7684\u5143\u7D20\u3002
+- KeyNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <key name=\"{1}\"> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
++ AbsentKeyValue = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4 (cvc-identity-constraint.4.2.1): \u5143\u7D20 "{0}" \u5177\u6709\u7684\u91D1\u9470\u6C92\u6709\u503C\u3002
++ DuplicateField = \u7BC4\u570D\u4E2D\u7684\u6B04\u4F4D "{0}" \u91CD\u8907\u914D\u5C0D\u3002
++ DuplicateKey = \u70BA\u5143\u7D20 "{1}" \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u5BA3\u544A\u4E86\u91CD\u8907\u7684\u91D1\u9470\u503C [{0}]\u3002
++ DuplicateUnique = \u70BA\u5143\u7D20 "{1}" \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u5BA3\u544A\u4E86\u91CD\u8907\u7684\u552F\u4E00\u503C [{0}]\u3002
++ FieldMultipleMatch = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4: \u6B04\u4F4D "{0}" \u7B26\u5408\u5176\u9078\u53D6\u5668\u7BC4\u570D\u5167\u8D85\u904E\u4E00\u500B\u4EE5\u4E0A\u7684\u503C; \u6B04\u4F4D\u5FC5\u9808\u7B26\u5408\u552F\u4E00\u503C\u3002
++ FixedDiffersFromActual = \u6B64\u5143\u7D20\u7684\u5167\u5BB9\u4E0D\u7B49\u65BC\u7DB1\u8981\u5143\u7D20\u5BA3\u544A\u4E2D "fixed" \u5C6C\u6027\u7684\u503C\u3002
++ KeyMatchesNillable = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4 (cvc-identity-constraint.4.2.3): \u5143\u7D20 "{0}" \u5177\u6709\u7684\u91D1\u9470\uFF0C\u7B26\u5408 nillable \u8A2D\u70BA\u771F\u7684\u5143\u7D20\u3002
++ KeyNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <key name="{1}"> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
+ KeyNotFound = \u5143\u7D20 ''{2}'' \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u627E\u4E0D\u5230\u503C ''{1}'' \u7684\u91D1\u9470 ''{0}''\u3002
+- KeyRefNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <keyref name=\"{1}\"> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
+- KeyRefOutOfScope = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4: \u8B58\u5225\u9650\u5236\u689D\u4EF6 \"{0}\" \u5177\u6709\u4E00\u500B keyref\uFF0C\u5B83\u53C3\u7167\u4E86\u7BC4\u570D\u4E4B\u5916\u7684\u91D1\u9470\u6216\u552F\u4E00\u503C\u3002
+- KeyRefReferNotFound = \u91D1\u9470\u53C3\u7167\u5BA3\u544A \"{0}\" \u53C3\u7167\u4E86\u540D\u7A31\u70BA \"{1}\" \u7684\u4E0D\u660E\u91D1\u9470\u3002
+- UniqueNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 \"{0}\" \u6307\u5B9A\u7684 <unique> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
+- UnknownField = \u5167\u90E8\u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4; \u4E0D\u660E\u7684\u6B04\u4F4D \"{0}\"\u3002
++ KeyRefNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <keyref name="{1}"> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
++ KeyRefOutOfScope = \u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4: \u8B58\u5225\u9650\u5236\u689D\u4EF6 "{0}" \u5177\u6709\u4E00\u500B keyref\uFF0C\u5B83\u53C3\u7167\u4E86\u7BC4\u570D\u4E4B\u5916\u7684\u91D1\u9470\u6216\u552F\u4E00\u503C\u3002
++ KeyRefReferNotFound = \u91D1\u9470\u53C3\u7167\u5BA3\u544A "{0}" \u53C3\u7167\u4E86\u540D\u7A31\u70BA "{1}" \u7684\u4E0D\u660E\u91D1\u9470\u3002
++ UniqueNotEnoughValues = \u6C92\u6709\u8DB3\u5920\u7684\u503C\u6307\u5B9A\u5143\u7D20 "{0}" \u6307\u5B9A\u7684 <unique> \u8B58\u5225\u9650\u5236\u689D\u4EF6\u3002
++ UnknownField = \u5167\u90E8\u8B58\u5225\u9650\u5236\u689D\u4EF6\u932F\u8AA4; \u4E0D\u660E\u7684\u6B04\u4F4D "{0}"\u3002
+
+ # Ideally, we should only use the following error keys, not the ones under
+ # "Identity constraints". And we should cover all of the following errors.
+@@ -63,7 +35,7 @@
+ #validation (3.X.4)
+
+ cvc-attribute.3 = cvc-attribute.3: \u5143\u7D20 ''{0}'' \u4E0A\u5C6C\u6027 ''{1}'' \u7684\u503C ''{2}'' \u5C0D\u65BC\u5176\u985E\u578B ''{3}'' \u7121\u6548\u3002
+- cvc-attribute.4 = cvc-attribute.4: \u5143\u7D20 ''{0}'' \u4E0A\u5C6C\u6027 ''{1}'' \u7684\u503C ''{2}'' \u5C0D\u65BC\u5176\u56FA\u5B9A ''{''value constraint''}'' \u7121\u6548\u3002\u5C6C\u6027\u5FC5\u9808\u5177\u6709 ''{3}'' \u7684\u503C\u3002
++ cvc-attribute.4 = cvc-attribute.4: \u5143\u7D20 ''{0}'' \u4E0A\u5C6C\u6027 ''{1}'' \u7684\u503C ''{2}'' \u5C0D\u65BC\u5176\u56FA\u5B9A '{'value constraint'}' \u7121\u6548\u3002\u5C6C\u6027\u5FC5\u9808\u5177\u6709 ''{3}'' \u7684\u503C\u3002
+ cvc-complex-type.2.1 = cvc-complex-type.2.1: \u5143\u7D20 ''{0}'' \u4E0D\u80FD\u6709\u5B57\u5143\u6216\u5143\u7D20\u8CC7\u8A0A\u9805\u76EE [children]\uFF0C\u56E0\u70BA\u985E\u578B\u7684\u5167\u5BB9\u985E\u578B\u70BA\u7A7A\u767D\u3002
+ cvc-complex-type.2.2 = cvc-complex-type.2.2: \u5143\u7D20 ''{0}'' \u4E0D\u80FD\u6709\u5143\u7D20 [children]\uFF0C\u4E14\u503C\u5FC5\u9808\u6709\u6548\u3002
+ cvc-complex-type.2.3 = cvc-complex-type.2.3: \u5143\u7D20 ''{0}'' \u4E0D\u80FD\u6709\u5B57\u5143 [children]\uFF0C\u56E0\u70BA\u985E\u578B\u7684\u5167\u5BB9\u985E\u578B\u70BA element-only\u3002
+@@ -77,22 +49,22 @@
+ cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: \u4E0D\u5141\u8A31\u5C6C\u6027 ''{1}'' \u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E2D\u3002
+ cvc-complex-type.4 = cvc-complex-type.4: \u5C6C\u6027 ''{1}'' \u5FC5\u9808\u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E2D\u3002
+ cvc-complex-type.5.1 = cvc-complex-type.5.1: \u5728\u5143\u7D20 ''{0}'' \u4E2D\uFF0C\u5C6C\u6027 ''{1}'' \u70BA Wild ID\u3002\u4F46\u662F\u5DF2\u7D93\u6709\u4E00\u500B Wild ID ''{2}''\u3002\u53EA\u80FD\u6709\u4E00\u500B Wild ID\u3002
+- cvc-complex-type.5.2 = cvc-complex-type.5.2: \u5728\u5143\u7D20 ''{0}'' \u4E2D\uFF0C\u5C6C\u6027 ''{1}'' \u70BA Wild ID\u3002\u4F46\u662F\u5DF2\u7D93\u6709\u4E00\u500B\u5F9E ''{''attribute uses''}'' \u4E2D\u7684 ID \u884D\u751F\u800C\u4F86\u7684\u5C6C\u6027 ''{2}''\u3002
++ cvc-complex-type.5.2 = cvc-complex-type.5.2: \u5728\u5143\u7D20 ''{0}'' \u4E2D\uFF0C\u5C6C\u6027 ''{1}'' \u70BA Wild ID\u3002\u4F46\u662F\u5DF2\u7D93\u6709\u4E00\u500B\u5F9E '{'attribute uses'}' \u4E2D\u7684 ID \u884D\u751F\u800C\u4F86\u7684\u5C6C\u6027 ''{2}''\u3002
+ cvc-datatype-valid.1.2.1 = cvc-datatype-valid.1.2.1: ''{0}'' \u4E0D\u662F ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-datatype-valid.1.2.2 = cvc-datatype-valid.1.2.2: ''{0}'' \u4E0D\u662F\u6E05\u55AE\u985E\u578B ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-datatype-valid.1.2.3 = cvc-datatype-valid.1.2.3: ''{0}'' \u4E0D\u662F\u806F\u96C6\u985E\u578B ''{1}'' \u7684\u6709\u6548\u503C\u3002
+ cvc-elt.1 = cvc-elt.1: \u627E\u4E0D\u5230\u5143\u7D20 ''{0}'' \u7684\u5BA3\u544A\u3002
+- cvc-elt.2 = cvc-elt.2: ''{0}'' \u5143\u7D20\u5BA3\u544A\u4E2D ''{''abstract''}'' \u7684\u503C\u5FC5\u9808\u70BA\u507D\u3002
+- cvc-elt.3.1 = cvc-elt.3.1: \u5C6C\u6027 ''{1}'' \u4E0D\u53EF\u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E2D\uFF0C\u56E0\u70BA ''{0}'' \u7684 ''{''nillable''}'' \u5C6C\u6027\u70BA\u507D\u3002
++ cvc-elt.2 = cvc-elt.2: ''{0}'' \u5143\u7D20\u5BA3\u544A\u4E2D '{'abstract'}' \u7684\u503C\u5FC5\u9808\u70BA\u507D\u3002
++ cvc-elt.3.1 = cvc-elt.3.1: \u5C6C\u6027 ''{1}'' \u4E0D\u53EF\u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E2D\uFF0C\u56E0\u70BA ''{0}'' \u7684 '{'nillable'}' \u5C6C\u6027\u70BA\u507D\u3002
+ cvc-elt.3.2.1 = cvc-elt.3.2.1: \u5143\u7D20 ''{0}'' \u4E0D\u53EF\u6709\u5B57\u5143\u6216\u5143\u7D20\u8CC7\u8A0A [children]\uFF0C\u56E0\u70BA\u6307\u5B9A\u4E86 ''{1}''\u3002
+- cvc-elt.3.2.2 = cvc-elt.3.2.2: \u5143\u7D20 ''{0}'' \u4E0D\u53EF\u6709\u56FA\u5B9A\u7684 ''{''value constraint''}''\uFF0C\u56E0\u70BA\u6307\u5B9A\u4E86 ''{1}''\u3002
++ cvc-elt.3.2.2 = cvc-elt.3.2.2: \u5143\u7D20 ''{0}'' \u4E0D\u53EF\u6709\u56FA\u5B9A\u7684 '{'value constraint'}'\uFF0C\u56E0\u70BA\u6307\u5B9A\u4E86 ''{1}''\u3002
+ cvc-elt.4.1 = cvc-elt.4.1: \u5143\u7D20 ''{0}'' \u5C6C\u6027 ''{1}'' \u7684\u503C ''{2}'' \u4E0D\u662F\u6709\u6548\u7684 QName\u3002
+ cvc-elt.4.2 = cvc-elt.4.2: \u7121\u6CD5\u5C07 ''{1}'' \u89E3\u6790\u70BA\u5143\u7D20 ''{0}'' \u7684\u985E\u578B\u5B9A\u7FA9\u3002
+ cvc-elt.4.3 = cvc-elt.4.3: \u985E\u578B ''{1}'' \u4E0D\u662F\u6709\u6548\u884D\u751F\u81EA\u5143\u7D20 ''{0}'' \u7684\u985E\u578B\u5B9A\u7FA9 ''{2}''\u3002
+- cvc-elt.5.1.1 = cvc-elt.5.1.1: \u5143\u7D20 ''{0}'' \u7684 ''{''value constraint''}'' ''{2}'' \u4E0D\u662F\u985E\u578B ''{1}'' \u7684\u6709\u6548\u9810\u8A2D\u503C\u3002
++ cvc-elt.5.1.1 = cvc-elt.5.1.1: \u5143\u7D20 ''{0}'' \u7684 '{'value constraint'}' ''{2}'' \u4E0D\u662F\u985E\u578B ''{1}'' \u7684\u6709\u6548\u9810\u8A2D\u503C\u3002
+ cvc-elt.5.2.2.1 = cvc-elt.5.2.2.1: \u5143\u7D20 ''{0}'' \u4E0D\u53EF\u6709\u5143\u7D20\u8CC7\u8A0A\u9805\u76EE [children]\u3002
+- cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0D\u7B26\u5408\u56FA\u5B9A ''{''value constraint''}'' \u503C ''{2}''\u3002
+- cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0D\u7B26\u5408 ''{''value constraint''}'' \u503C ''{2}''\u3002
++ cvc-elt.5.2.2.2.1 = cvc-elt.5.2.2.2.1: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0D\u7B26\u5408\u56FA\u5B9A '{'value constraint'}' \u503C ''{2}''\u3002
++ cvc-elt.5.2.2.2.2 = cvc-elt.5.2.2.2.2: \u5143\u7D20 ''{0}'' \u7684\u503C ''{1}'' \u4E0D\u7B26\u5408 '{'value constraint'}' \u503C ''{2}''\u3002
+ cvc-enumeration-valid = cvc-enumeration-valid: \u503C ''{0}'' \u5C0D\u65BC\u5217\u8209 ''{1}'' \u800C\u8A00\u4E26\u975E facet-valid\u3002\u5B83\u5FC5\u9808\u662F\u4F86\u81EA\u5217\u8209\u7684\u503C\u3002
+ cvc-fractionDigits-valid = cvc-fractionDigits-valid: \u503C ''{0}'' \u5177\u6709 {1} \u5206\u6578\u4F4D\u6578\uFF0C\u4F46\u662F\u5206\u6578\u4F4D\u6578\u7684\u6578\u76EE\u9650\u5236\u70BA {2}\u3002
+ cvc-id.1 = cvc-id.1: IDREF ''{0}'' \u6C92\u6709 ID/IDREF \u9023\u7D50\u3002
+@@ -114,7 +86,7 @@
+
+ #schema valid (3.X.3)
+
+- schema_reference.access = schema_reference: Failed to read schema document ''{0}'', because ''{1}'' access is not allowed.
++ schema_reference.access = schema_reference: \u7121\u6CD5\u8B80\u53D6\u7DB1\u8981\u6587\u4EF6 ''{0}''\uFF0C\u56E0\u70BA accessExternalSchema \u5C6C\u6027\u8A2D\u5B9A\u7684\u9650\u5236\uFF0C\u6240\u4EE5\u4E0D\u5141\u8A31 ''{1}'' \u5B58\u53D6\u3002
+ schema_reference.4 = schema_reference.4: \u7121\u6CD5\u8B80\u53D6\u7DB1\u8981\u6587\u4EF6 ''{0}''\uFF0C\u56E0\u70BA 1) \u627E\u4E0D\u5230\u6587\u4EF6; 2) \u7121\u6CD5\u8B80\u53D6\u6587\u4EF6; 3) \u6587\u4EF6\u7684\u6839\u5143\u7D20\u4E0D\u662F <xsd:schema>\u3002
+ src-annotation = src-annotation: <annotation> \u5143\u7D20\u50C5\u80FD\u5305\u542B <appinfo> \u8207 <documentation> \u5143\u7D20\uFF0C\u4F46\u627E\u5230 ''{0}''\u3002
+ src-attribute.1 = src-attribute.1: \u5C6C\u6027 ''default'' \u8207 ''fixed'' \u4E0D\u53EF\u540C\u6642\u51FA\u73FE\u5728\u5C6C\u6027\u5BA3\u544A ''{0}'' \u4E2D\u3002\u8ACB\u53EA\u4F7F\u7528\u5176\u4E2D\u4E00\u500B\u3002
+@@ -171,10 +143,10 @@
+ ag-props-correct.2 = ag-props-correct.2: \u5C6C\u6027\u7FA4\u7D44 ''{0}'' \u7684\u932F\u8AA4\u3002\u91CD\u8907\u5C6C\u6027\u4F7F\u7528\u76F8\u540C\u540D\u7A31\u4E14\u6307\u5B9A\u4E86\u76EE\u6A19\u547D\u540D\u7A7A\u9593\u3002\u91CD\u8907\u5C6C\u6027\u4F7F\u7528\u7684\u540D\u7A31\u70BA ''{1}''\u3002
+ ag-props-correct.3 = ag-props-correct.3: \u5C6C\u6027\u7FA4\u7D44 ''{0}'' \u7684\u932F\u8AA4\u3002\u5169\u500B\u5C6C\u6027\u5BA3\u544A ''{1}'' \u8207 ''{2}'' \u5177\u6709\u884D\u751F\u81EA ID \u7684\u985E\u578B\u3002
+ a-props-correct.2 = a-props-correct.2: \u5C6C\u6027 ''{0}'' \u4E2D\u7684\u503C\u9650\u5236\u689D\u4EF6\u503C ''{1}'' \u7121\u6548\u3002
+- a-props-correct.3 = a-props-correct.3: \u5C6C\u6027 ''{0}'' \u7121\u6CD5\u4F7F\u7528 ''fixed'' \u6216 ''default''\uFF0C\u56E0\u70BA\u5C6C\u6027\u7684 ''{''type definition''}'' \u70BA ID\uFF0C\u6216\u884D\u751F\u81EA ID\u3002
+- au-props-correct.2 = au-props-correct.2: \u5728 ''{0}'' \u7684\u5C6C\u6027\u5BA3\u544A\u4E2D\uFF0C\u6307\u5B9A\u4E86 ''{1}'' \u7684\u56FA\u5B9A\u503C\u3002\u56E0\u6B64\uFF0C\u82E5\u53C3\u7167 ''{0}'' \u7684\u5C6C\u6027\u4F7F\u7528\u4E5F\u5177\u6709 ''{''value constraint''}''\uFF0C\u5B83\u5FC5\u9808\u662F\u56FA\u5B9A\u503C\u4E14\u503C\u5FC5\u9808\u70BA ''{1}''\u3002
++ a-props-correct.3 = a-props-correct.3: \u5C6C\u6027 ''{0}'' \u7121\u6CD5\u4F7F\u7528 ''fixed'' \u6216 ''default''\uFF0C\u56E0\u70BA\u5C6C\u6027\u7684 '{'type definition'}' \u70BA ID\uFF0C\u6216\u884D\u751F\u81EA ID\u3002
++ au-props-correct.2 = au-props-correct.2: \u5728 ''{0}'' \u7684\u5C6C\u6027\u5BA3\u544A\u4E2D\uFF0C\u6307\u5B9A\u4E86 ''{1}'' \u7684\u56FA\u5B9A\u503C\u3002\u56E0\u6B64\uFF0C\u82E5\u53C3\u7167 ''{0}'' \u7684\u5C6C\u6027\u4F7F\u7528\u4E5F\u5177\u6709 '{'value constraint'}'\uFF0C\u5B83\u5FC5\u9808\u662F\u56FA\u5B9A\u503C\u4E14\u503C\u5FC5\u9808\u70BA ''{1}''\u3002
+ cos-all-limited.1.2 = cos-all-limited.1.2: 'all' \u6A21\u578B\u7FA4\u7D44\u5FC5\u9808\u51FA\u73FE\u5728 '{'min occurs'}' = '{'max occurs'}' = 1 \u7684\u7269\u4EF6\u4E2D\uFF0C\u4E14\u8A72\u7269\u4EF6\u5FC5\u9808\u662F\u4E00\u5C0D\u7D44\u6210\u8907\u96DC\u985E\u578B\u5B9A\u7FA9\u4E4B '{'content type'}' \u7269\u4EF6\u4E2D\u7684\u4E00\u90E8\u5206\u3002
+- cos-all-limited.2 = cos-all-limited.2: ''all'' \u6A21\u578B\u7FA4\u7D44\u4E2D\u5143\u7D20\u7684 ''{''max occurs''}'' \u5FC5\u9808\u662F 0 \u6216 1\u3002\u5143\u7D20 ''{1}'' \u7684\u503C ''{0}'' \u7121\u6548\u3002
++ cos-all-limited.2 = cos-all-limited.2: ''all'' \u6A21\u578B\u7FA4\u7D44\u4E2D\u5143\u7D20\u7684 '{'max occurs'}' \u5FC5\u9808\u662F 0 \u6216 1\u3002\u5143\u7D20 ''{1}'' \u7684\u503C ''{0}'' \u7121\u6548\u3002
+ cos-applicable-facets = cos-applicable-facets: \u985E\u578B {1} \u4E0D\u5141\u8A31 Facet ''{0}''\u3002
+ cos-ct-extends.1.1 = cos-ct-extends.1.1: \u985E\u578B ''{0}'' \u662F\u7531\u64F4\u5145\u5957\u4EF6\u5F9E\u985E\u578B ''{1}'' \u884D\u751F\u3002\u4E0D\u904E\uFF0C''{1}'' \u7684 ''final'' \u5C6C\u6027\u7981\u6B62\u7531\u64F4\u5145\u5957\u4EF6\u884D\u751F\u3002
+ cos-ct-extends.1.4.3.2.2.1.a = cos-ct-extends.1.4.3.2.2.1.a: \u884D\u751F\u985E\u578B\u8207\u5176\u57FA\u790E\u7684\u5167\u5BB9\u985E\u578B\u7686\u5FC5\u9808\u662F\u6DF7\u5408\u985E\u578B\u6216\u5169\u8005\u7686\u662F element-only\u3002\u985E\u578B ''{0}'' \u662F element-only\uFF0C\u4F46\u5176\u57FA\u790E\u985E\u578B\u5247\u5426\u3002
+@@ -185,17 +157,17 @@
+ cos-particle-restrict.a = cos-particle-restrict.a: \u884D\u751F\u7269\u4EF6\u70BA\u7A7A\u767D\uFF0C\u5247\u57FA\u790E\u7269\u4EF6\u4E0D\u53EF\u70BA\u7A7A\u767D\u3002
+ cos-particle-restrict.b = cos-particle-restrict.b: \u57FA\u790E\u7269\u4EF6\u70BA\u7A7A\u767D\uFF0C\u4F46\u662F\u884D\u751F\u7269\u4EF6\u5247\u5426\u3002
+ cos-particle-restrict.2 = cos-particle-restrict.2: \u7981\u6B62\u7684\u7269\u4EF6\u9650\u5236: ''{0}''\u3002
+- cos-st-restricts.1.1 = cos-st-restricts.1.1: \u985E\u578B ''{1}'' \u70BA\u55AE\u5143\u985E\u578B\uFF0C\u56E0\u6B64\u5176 ''{''base type definition''}'' (''{0}'') \u5FC5\u9808\u662F\u55AE\u5143\u7C21\u55AE\u985E\u578B\u5B9A\u7FA9\u6216\u5167\u5EFA\u7684\u539F\u59CB\u8CC7\u6599\u985E\u578B\u3002
++ cos-st-restricts.1.1 = cos-st-restricts.1.1: \u985E\u578B ''{1}'' \u70BA\u55AE\u5143\u985E\u578B\uFF0C\u56E0\u6B64\u5176 '{'base type definition'}' (''{0}'') \u5FC5\u9808\u662F\u55AE\u5143\u7C21\u55AE\u985E\u578B\u5B9A\u7FA9\u6216\u5167\u5EFA\u7684\u539F\u59CB\u8CC7\u6599\u985E\u578B\u3002
+ cos-st-restricts.2.1 = cos-st-restricts.2.1: \u6E05\u55AE\u985E\u578B ''{0}'' \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u985E\u578B ''{1}'' \u662F\u7121\u6548\u7684\u9805\u76EE\u985E\u578B\uFF0C\u56E0\u70BA\u5B83\u662F\u6E05\u55AE\u985E\u578B\uFF0C\u6216\u5305\u542B\u6E05\u55AE\u7684\u806F\u96C6\u985E\u578B\u3002
+- cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: ''{''item type definition''}'' \u7684 ''{''final''}'' \u5143\u4EF6 ''{0}'' \u5305\u542B ''list''\u3002\u9019\u4EE3\u8868 ''{0}'' \u7121\u6CD5\u4F5C\u70BA\u6E05\u55AE\u985E\u578B ''{1}'' \u7684\u9805\u76EE\u985E\u578B\u3002
+- cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: ''{''member type definitions''}'' \u7684 ''{''final''}'' \u5143\u4EF6 ''{0}'' \u5305\u542B ''union''\u3002\u9019\u4EE3\u8868 ''{0}'' \u7121\u6CD5\u4F5C\u70BA\u806F\u96C6\u985E\u578B ''{1}'' \u7684\u6210\u54E1\u985E\u578B\u3002
++ cos-st-restricts.2.3.1.1 = cos-st-restricts.2.3.1.1: '{'item type definition'}' \u7684 '{'final'}' \u5143\u4EF6 ''{0}'' \u5305\u542B ''list''\u3002\u9019\u4EE3\u8868 ''{0}'' \u7121\u6CD5\u4F5C\u70BA\u6E05\u55AE\u985E\u578B ''{1}'' \u7684\u9805\u76EE\u985E\u578B\u3002
++ cos-st-restricts.3.3.1.1 = cos-st-restricts.3.3.1.1: '{'member type definitions'}' \u7684 '{'final'}' \u5143\u4EF6 ''{0}'' \u5305\u542B ''union''\u3002\u9019\u4EE3\u8868 ''{0}'' \u7121\u6CD5\u4F5C\u70BA\u806F\u96C6\u985E\u578B ''{1}'' \u7684\u6210\u54E1\u985E\u578B\u3002
+ cos-valid-default.2.1 = cos-valid-default.2.1: \u5143\u7D20 ''{0}'' \u5177\u6709\u503C\u9650\u5236\u689D\u4EF6\uFF0C\u4E14\u5FC5\u9808\u5177\u6709\u6DF7\u5408\u6216\u7C21\u55AE\u5167\u5BB9\u6A21\u578B\u3002
+- cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u7531\u65BC\u5143\u7D20 ''{0}'' \u5177\u6709 ''{''value constraint''}'' \u4E14\u5176\u985E\u578B\u5B9A\u7FA9\u5177\u6709\u6DF7\u5408\u7684 ''{''content type''}''\uFF0C\u56E0\u6B64 ''{''content type''}'' \u7684\u7269\u4EF6\u5FC5\u9808\u662F\u53EF\u7A7A\u767D\u3002
++ cos-valid-default.2.2.2 = cos-valid-default.2.2.2: \u7531\u65BC\u5143\u7D20 ''{0}'' \u5177\u6709 '{'value constraint'}' \u4E14\u5176\u985E\u578B\u5B9A\u7FA9\u5177\u6709\u6DF7\u5408\u7684 '{'content type'}'\uFF0C\u56E0\u6B64 '{'content type'}' \u7684\u7269\u4EF6\u5FC5\u9808\u662F\u53EF\u7A7A\u767D\u3002
+ c-props-correct.2 = c-props-correct.2: keyref ''{0}'' \u8207 key ''{1}'' \u7684 Fields \u57FA\u6578\u5F7C\u6B64\u5FC5\u9808\u76F8\u7B26\u3002
+ ct-props-correct.3 = ct-props-correct.3: \u5075\u6E2C\u5230\u8907\u96DC\u985E\u578B ''{0}'' \u7684\u5FAA\u74B0\u5B9A\u7FA9\u3002\u9019\u4EE3\u8868 ''{0}'' \u5305\u542B\u5728\u81EA\u8EAB\u985E\u578B\u968E\u5C64\u4E2D\uFF0C\u9019\u662F\u4E00\u9805\u932F\u8AA4\u3002
+ ct-props-correct.4 = ct-props-correct.4: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002\u91CD\u8907\u5C6C\u6027\u4F7F\u7528\u76F8\u540C\u540D\u7A31\u4E14\u6307\u5B9A\u4E86\u76EE\u6A19\u547D\u540D\u7A7A\u9593\u3002\u91CD\u8907\u5C6C\u6027\u4F7F\u7528\u7684\u540D\u7A31\u70BA ''{1}''\u3002
+ ct-props-correct.5 = ct-props-correct.5: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002\u5169\u500B\u5C6C\u6027\u5BA3\u544A ''{1}'' \u8207 ''{2}'' \u5177\u6709\u884D\u751F\u81EA ID \u7684\u985E\u578B\u3002
+- derivation-ok-restriction.1 = derivation-ok-restriction.1: \u985E\u578B ''{0}'' \u7531\u9650\u5236\u5F9E\u985E\u578B ''{1}'' \u884D\u751F\u3002\u4E0D\u904E\uFF0C''{1}'' \u5177\u6709 ''{''final''}'' \u5C6C\u6027\uFF0C\u7981\u6B62\u7531\u9650\u5236\u884D\u751F\u3002
++ derivation-ok-restriction.1 = derivation-ok-restriction.1: \u985E\u578B ''{0}'' \u7531\u9650\u5236\u5F9E\u985E\u578B ''{1}'' \u884D\u751F\u3002\u4E0D\u904E\uFF0C''{1}'' \u5177\u6709 '{'final'}' \u5C6C\u6027\uFF0C\u7981\u6B62\u7531\u9650\u5236\u884D\u751F\u3002
+ derivation-ok-restriction.2.1.1 = derivation-ok-restriction.2.1.1: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002\u6B64\u985E\u578B\u4E2D\u4F7F\u7528 ''{1}'' \u7684\u5C6C\u6027\u5177\u6709 ''use'' \u503C\u7684 ''{2}''\uFF0C\u9019\u8207\u57FA\u790E\u985E\u578B\u4E2D\u4F7F\u7528\u7B26\u5408\u5C6C\u6027\u7684 ''required'' \u503C\u4E0D\u4E00\u81F4\u3002
+ derivation-ok-restriction.2.1.2 = derivation-ok-restriction.2.1.2: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002\u6B64\u985E\u578B\u4E2D\u4F7F\u7528 ''{1}'' \u7684\u5C6C\u6027\u5177\u6709\u985E\u578B ''{2}''\uFF0C\u9019\u4E0D\u662F\u6709\u6548\u884D\u751F\u81EA ''{3}''\uFF0C\u4EA6\u5373\u57FA\u790E\u985E\u578B\u4E2D\u4F7F\u7528\u7B26\u5408\u5C6C\u6027\u7684\u985E\u578B\u3002
+ derivation-ok-restriction.2.1.3.a = derivation-ok-restriction.2.1.3.a: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002\u6B64\u985E\u578B\u4E2D\u4F7F\u7528 ''{1}'' \u7684\u5C6C\u6027\u5177\u6709\u672A\u56FA\u5B9A\u7684\u6709\u6548\u503C\u9650\u5236\u689D\u4EF6\uFF0C\u800C\u57FA\u790E\u985E\u578B\u4E2D\u4F7F\u7528\u7684\u7B26\u5408\u5C6C\u6027\u6709\u6548\u503C\u9650\u5236\u689D\u4EF6\u70BA\u56FA\u5B9A\u5F0F\u3002
+@@ -213,8 +185,8 @@
+ enumeration-required-notation = enumeration-required-notation: \u7531 {2} ''{1}'' \u4F7F\u7528\u7684 NOTATION \u985E\u578B ''{0}''\uFF0C\u5FC5\u9808\u5177\u6709\u5217\u8209 facet \u503C\uFF0C\u4EE5\u6307\u5B9A\u6B64\u985E\u578B\u4F7F\u7528\u7684\u8868\u793A\u6CD5\u5143\u7D20\u3002
+ enumeration-valid-restriction = enumeration-valid-restriction: \u5217\u8209\u503C ''{0}'' \u4E0D\u5728\u57FA\u790E\u985E\u578B {1} \u7684\u503C\u7A7A\u9593\u4E2D\u3002
+ e-props-correct.2 = e-props-correct.2: \u5143\u7D20 ''{0}'' \u4E2D\u7684\u503C\u9650\u5236\u689D\u4EF6\u503C ''{1}'' \u7121\u6548\u3002
+- e-props-correct.4 = e-props-correct.4: \u5143\u7D20 ''{0}'' \u7684 ''{''type definition''}'' \u4E0D\u662F\u6709\u6548\u884D\u751F\u81EA substitutionHead ''{1}'' \u7684 ''{''type definition''}''\uFF0C\u6216\u662F ''{1}'' \u7684 ''{''substitution group exclusions''}'' \u5C6C\u6027\u4E0D\u5141\u8A31\u6B64\u884D\u751F\u3002
+- e-props-correct.5 = e-props-correct.5: ''{''value constraint''}'' \u4E0D\u53EF\u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E0A\uFF0C\u56E0\u70BA\u5143\u7D20\u7684 ''{''type definition''}'' \u6216 ''{''type definition''}'' \u7684 ''{''content type''}'' \u70BA ID\uFF0C\u6216\u884D\u751F\u81EA ID\u3002
++ e-props-correct.4 = e-props-correct.4: \u5143\u7D20 ''{0}'' \u7684 '{'type definition'}' \u4E0D\u662F\u6709\u6548\u884D\u751F\u81EA substitutionHead ''{1}'' \u7684 '{'type definition'}'\uFF0C\u6216\u662F ''{1}'' \u7684 '{'substitution group exclusions'}' \u5C6C\u6027\u4E0D\u5141\u8A31\u6B64\u884D\u751F\u3002
++ e-props-correct.5 = e-props-correct.5: '{'value constraint'}' \u4E0D\u53EF\u51FA\u73FE\u5728\u5143\u7D20 ''{0}'' \u4E0A\uFF0C\u56E0\u70BA\u5143\u7D20\u7684 '{'type definition'}' \u6216 '{'type definition'}' \u7684 '{'content type'}' \u70BA ID\uFF0C\u6216\u884D\u751F\u81EA ID\u3002
+ e-props-correct.6 = e-props-correct.6: \u5075\u6E2C\u5230 ''{0}'' \u7684\u5FAA\u74B0\u66FF\u4EE3\u7FA4\u7D44\u3002
+ fractionDigits-valid-restriction = fractionDigits-valid-restriction: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''fractionDigits'' \u7684\u503C ''{0}'' \u7121\u6548\uFF0C\u56E0\u70BA\u5B83\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC ''fractionDigits'' \u7684\u503C\uFF0C\u6B64\u503C\u4EE5\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u8A2D\u70BA ''{1}''\u3002
+ fractionDigits-totalDigits = fractionDigits-totalDigits: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C facet ''fractionDigits'' \u7684\u503C ''{0}'' \u7121\u6548\uFF0C\u56E0\u70BA\u503C\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC ''totalDigits'' \u7684\u503C\uFF0C\u4EA6\u5373 ''{1}''\u3002
+@@ -235,7 +207,7 @@
+ maxInclusive-valid-restriction.3 = maxInclusive-valid-restriction.3: \u985E\u578B ''{2}'' \u7684\u932F\u8AA4\u3002\u7B49\u65BC ''{0}'' \u7684 maxInclusive \u503C\u5FC5\u9808\u5927\u65BC\u6216\u7B49\u65BC\u57FA\u790E\u985E\u578B ''{1}'' \u7684 minInclusive\u3002
+ maxInclusive-valid-restriction.4 = maxInclusive-valid-restriction.4: \u985E\u578B ''{2}'' \u7684\u932F\u8AA4\u3002\u7B49\u65BC ''{0}'' \u7684 maxInclusive \u503C\u5FC5\u9808\u5927\u65BC\u57FA\u790E\u985E\u578B ''{1}'' \u7684 minExclusive\u3002
+ maxLength-valid-restriction = maxLength-valid-restriction: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u7B49\u65BC ''{0}'' \u7684 maxLength \u503C\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC\u57FA\u790E\u985E\u578B ''{1}'' \u7684 maxLength \u503C\u3002
+- mg-props-correct.2 = mg-props-correct.2: \u5075\u6E2C\u5230\u7FA4\u7D44 ''{0}'' \u7684\u5FAA\u74B0\u5B9A\u7FA9\u3002\u905E\u8FF4\u4F7F\u7528\u7269\u4EF6\u7684 ''{''term''}'' \u503C\u5C07\u5C0E\u81F3\u5176 ''{''term''}'' \u70BA\u7FA4\u7D44\u672C\u8EAB\u7684\u7269\u4EF6\u3002
++ mg-props-correct.2 = mg-props-correct.2: \u5075\u6E2C\u5230\u7FA4\u7D44 ''{0}'' \u7684\u5FAA\u74B0\u5B9A\u7FA9\u3002\u905E\u8FF4\u4F7F\u7528\u7269\u4EF6\u7684 '{'term'}' \u503C\u5C07\u5C0E\u81F3\u5176 '{'term'}' \u70BA\u7FA4\u7D44\u672C\u8EAB\u7684\u7269\u4EF6\u3002
+ minExclusive-less-than-equal-to-maxExclusive = minExclusive-less-than-equal-to-maxExclusive: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u7B49\u65BC ''{0}'' \u7684 minExclusive \u503C\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC maxExclusive \u503C (\u7B49\u65BC ''{1}'')\u3002
+ minExclusive-less-than-maxInclusive = minExclusive-less-than-maxInclusive: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u7B49\u65BC ''{0}'' \u7684 minExclusive \u503C\u5FC5\u9808\u5C0F\u65BC maxInclusive \u503C (\u7B49\u65BC ''{1}'')\u3002
+ minExclusive-valid-restriction.1 = minExclusive-valid-restriction.1: \u985E\u578B ''{2}'' \u7684\u932F\u8AA4\u3002\u7B49\u65BC ''{0}'' \u7684 minExclusive \u503C\u5FC5\u9808\u5927\u65BC\u6216\u7B49\u65BC\u57FA\u790E\u985E\u578B ''{1}'' \u7684 minExclusive\u3002
+@@ -252,20 +224,20 @@
+ minLength-less-than-equal-to-maxLength = minLength-less-than-equal-to-maxLength: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u7B49\u65BC ''{0}'' \u7684 minLength \u503C\u5FC5\u9808\u5C0F\u65BC maxLength \u503C (\u7B49\u65BC ''{1}'')\u3002
+ minLength-valid-restriction = minLength-valid-restriction: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0C\u7B49\u65BC ''{0}'' \u7684 minLength \u5FC5\u9808\u5927\u65BC\u6216\u7B49\u65BC\u57FA\u790E\u985E\u578B ''{1}'' \u7684 minLength\u3002
+ no-xmlns = no-xmlns: \u5C6C\u6027\u5BA3\u544A\u7684 {name} \u4E0D\u80FD\u8207 'xmlns' \u76F8\u540C\u3002
+- no-xsi = no-xsi: \u5C6C\u6027\u5BA3\u544A\u7684 ''{''target namespace''}'' \u4E0D\u80FD\u8207 ''{0}'' \u76F8\u540C\u3002
++ no-xsi = no-xsi: \u5C6C\u6027\u5BA3\u544A\u7684 '{'target namespace'}' \u4E0D\u80FD\u8207 ''{0}'' \u76F8\u540C\u3002
+ p-props-correct.2.1 = p-props-correct.2.1: \u5728 ''{0}'' \u7684\u5BA3\u544A\u4E2D\uFF0C''minOccurs'' \u7684\u503C\u70BA ''{1}''\uFF0C\u4F46\u662F\u5B83\u4E0D\u53EF\u5927\u65BC ''maxOccurs'' \u7684\u503C ''{2}''\u3002
+ rcase-MapAndSum.1 = rcase-MapAndSum.1: \u7269\u4EF6\u4E4B\u9593\u6C92\u6709\u5B8C\u6574\u7684\u529F\u80FD\u5C0D\u61C9\u3002
+ rcase-MapAndSum.2 = rcase-MapAndSum.2: \u7FA4\u7D44\u7684\u767C\u751F\u7BC4\u570D ({0}\uFF0C{1}) \u4E0D\u662F\u57FA\u790E\u7FA4\u7D44\u767C\u751F\u7BC4\u570D ({2}\uFF0C{3}) \u7684\u6709\u6548\u9650\u5236\u3002
+ rcase-NameAndTypeOK.1 = rcase-NameAndTypeOK.1: \u5143\u7D20\u5177\u6709\u4E0D\u76F8\u540C\u7684\u540D\u7A31\u8207\u76EE\u6A19\u547D\u540D\u7A7A\u9593: \u547D\u540D\u7A7A\u9593 ''{1}'' \u4E2D\u7684\u5143\u7D20 ''{0}'' \u8207\u547D\u540D\u7A7A\u9593 ''{3}'' \u4E2D\u7684\u5143\u7D20 ''{2}''\u3002
+- rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: \u7269\u4EF6\u7684 ''{''term''}'' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5143\u7D20\u5BA3\u544A\u7684 ''{''nillable''}'' \u70BA\u771F\uFF0C\u4F46\u662F\u57FA\u790E\u985E\u578B\u4E2D\u7684\u5C0D\u61C9\u7269\u4EF6\u5177\u6709 ''{''nillable''}'' \u70BA\u507D\u7684\u5143\u7D20\u5BA3\u544A\u3002
+- rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: \u7269\u4EF6\u7684 ''{''term''}'' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5B83\u7684\u767C\u751F\u7BC4\u570D ({1}\uFF0C{2}) \u4E0D\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7269\u4EF6\u7BC4\u570D ({3}\uFF0C{4}) \u7684\u6709\u6548\u9650\u5236\u3002
++ rcase-NameAndTypeOK.2 = rcase-NameAndTypeOK.2: \u7269\u4EF6\u7684 '{'term'}' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5143\u7D20\u5BA3\u544A\u7684 '{'nillable'}' \u70BA\u771F\uFF0C\u4F46\u662F\u57FA\u790E\u985E\u578B\u4E2D\u7684\u5C0D\u61C9\u7269\u4EF6\u5177\u6709 '{'nillable'}' \u70BA\u507D\u7684\u5143\u7D20\u5BA3\u544A\u3002
++ rcase-NameAndTypeOK.3 = rcase-NameAndTypeOK.3: \u7269\u4EF6\u7684 '{'term'}' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5B83\u7684\u767C\u751F\u7BC4\u570D ({1}\uFF0C{2}) \u4E0D\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7269\u4EF6\u7BC4\u570D ({3}\uFF0C{4}) \u7684\u6709\u6548\u9650\u5236\u3002
+ rcase-NameAndTypeOK.4.a = rcase-NameAndTypeOK.4.a: \u5143\u7D20 ''{0}'' \u975E\u56FA\u5B9A\u5F0F\uFF0C\u4F46\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7684\u5143\u7D20\u5177\u6709\u56FA\u5B9A\u503C ''{1}''\u3002
+ rcase-NameAndTypeOK.4.b = rcase-NameAndTypeOK.4.b: \u5143\u7D20 ''{0}'' \u5177\u6709\u56FA\u5B9A\u503C ''{1}''\uFF0C\u4F46\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7684\u5143\u7D20\u5177\u6709\u56FA\u5B9A\u503C ''{2}''\u3002
+ rcase-NameAndTypeOK.5 = rcase-NameAndTypeOK.5: \u5143\u7D20 ''{0}'' \u7684\u8B58\u5225\u9650\u5236\u689D\u4EF6\u4E0D\u662F\u57FA\u790E\u4E2D\u7684\u5B50\u96C6\u3002
+ rcase-NameAndTypeOK.6 = rcase-NameAndTypeOK.6: \u5143\u7D20 ''{0}'' \u4E0D\u5141\u8A31\u7684\u66FF\u4EE3\u4E0D\u662F\u57FA\u790E\u4E2D\u7684\u8D85\u96C6\u3002
+ rcase-NameAndTypeOK.7 = rcase-NameAndTypeOK.7: \u5143\u7D20 ''{0}'' \u7684\u985E\u578B ''{1}'' \u4E0D\u662F\u884D\u751F\u81EA\u57FA\u790E\u5143\u7D20 ''{2}'' \u7684\u985E\u578B\u3002
+ rcase-NSCompat.1 = rcase-NSCompat.1: \u5143\u7D20 ''{0}'' \u5177\u6709\u57FA\u790E\u4E2D\u842C\u7528\u5B57\u5143\u4E0D\u5141\u8A31\u7684\u547D\u540D\u7A7A\u9593 ''{1}''\u3002
+- rcase-NSCompat.2 = rcase-NSCompat.2: \u7269\u4EF6\u7684 ''{''term''}'' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5B83\u7684\u767C\u751F\u7BC4\u570D ({1}\uFF0C{2}) \u4E0D\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7269\u4EF6\u7BC4\u570D ({3}\uFF0C{4}) \u7684\u6709\u6548\u9650\u5236\u3002
++ rcase-NSCompat.2 = rcase-NSCompat.2: \u7269\u4EF6\u7684 '{'term'}' \u70BA\u5143\u7D20\u5BA3\u544A ''{0}'' \u7684\u932F\u8AA4\u3002\u5B83\u7684\u767C\u751F\u7BC4\u570D ({1}\uFF0C{2}) \u4E0D\u662F\u57FA\u790E\u985E\u578B\u4E2D\u5C0D\u61C9\u7269\u4EF6\u7BC4\u570D ({3}\uFF0C{4}) \u7684\u6709\u6548\u9650\u5236\u3002
+ rcase-NSRecurseCheckCardinality.1 = rcase-NSRecurseCheckCardinality.1: \u7269\u4EF6\u4E4B\u9593\u6C92\u6709\u5B8C\u6574\u7684\u529F\u80FD\u5C0D\u61C9\u3002
+ rcase-NSRecurseCheckCardinality.2 = rcase-NSRecurseCheckCardinality.2: \u7FA4\u7D44\u7684\u767C\u751F\u7BC4\u570D ({0}\uFF0C{1}) \u4E0D\u662F\u57FA\u790E\u842C\u7528\u5B57\u5143\u7BC4\u570D ({2}\uFF0C{3}) \u7684\u6709\u6548\u9650\u5236\u3002
+ rcase-NSSubset.1 = rcase-NSSubset.1: \u842C\u7528\u5B57\u5143\u4E0D\u662F\u57FA\u790E\u4E2D\u5C0D\u61C9\u842C\u7528\u5B57\u5143\u7684\u5B50\u96C6\u3002
+@@ -281,7 +253,7 @@
+ # src-redefine.1 = src-redefine.1: The component ''{0}'' is begin redefined, but its corresponding component isn't in the schema document being redefined (with namespace ''{2}''), but in a different document, with namespace ''{1}''.
+ sch-props-correct.2 = sch-props-correct.2: \u7DB1\u8981\u7121\u6CD5\u5305\u542B\u76F8\u540C\u540D\u7A31\u7684\u5169\u500B\u5168\u57DF\u5143\u4EF6; \u6B64\u7DB1\u8981\u5305\u542B\u5169\u500B ''{0}''\u3002
+ st-props-correct.2 = st-props-correct.2: \u5075\u6E2C\u5230\u7C21\u55AE\u985E\u578B ''{0}'' \u7684\u5FAA\u74B0\u5B9A\u7FA9\u3002\u9019\u4EE3\u8868 ''{0}'' \u5305\u542B\u5728\u81EA\u8EAB\u985E\u578B\u968E\u5C64\u4E2D\uFF0C\u9019\u662F\u4E00\u9805\u932F\u8AA4\u3002
+- st-props-correct.3 = st-props-correct.3: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002''{''base type definition''}'' \u7684 ''{''final''}'' \u503C ''{1}'' \u9650\u5236\u7981\u6B62\u884D\u751F\u3002
++ st-props-correct.3 = st-props-correct.3: \u985E\u578B ''{0}'' \u7684\u932F\u8AA4\u3002'{'base type definition'}' \u7684 '{'final'}' \u503C ''{1}'' \u9650\u5236\u7981\u6B62\u884D\u751F\u3002
+ totalDigits-valid-restriction = totalDigits-valid-restriction: \u5728 {2} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''totalDigits'' \u7684\u503C ''{0}'' \u7121\u6548\uFF0C\u56E0\u70BA\u5B83\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC ''totalDigits'' \u7684\u503C\uFF0C\u6B64\u503C\u4EE5\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u8A2D\u70BA ''{1}''\u3002
+ whiteSpace-valid-restriction.1 = whiteSpace-valid-restriction.1: \u5728 {0} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''whitespace'' \u7684\u503C ''{1}'' \u7121\u6548\uFF0C\u56E0\u70BA ''whitespace'' \u7684\u503C\u4EE5\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u8A2D\u70BA ''collapse''\u3002
+ whiteSpace-valid-restriction.2 = whiteSpace-valid-restriction.2: \u5728 {0} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''whitespace'' \u7684\u503C ''preserve'' \u7121\u6548\uFF0C\u56E0\u70BA ''whitespace'' \u7684\u503C\u5728\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u4E2D\u8A2D\u70BA ''replace''\u3002
+@@ -297,7 +269,7 @@
+ # the "invalid-content" messages provide less information than the "must-match" counterparts above. They're used for complex types when providing a "match" would be an information dump
+ s4s-elt-invalid-content.1 = s4s-elt-invalid-content.1: ''{0}'' \u7684\u5167\u5BB9\u7121\u6548\u3002\u5143\u7D20 ''{1}'' \u7121\u6548\u3001\u4F4D\u7F6E\u932F\u8AA4\u6216\u592A\u5E38\u51FA\u73FE\u3002
+ s4s-elt-invalid-content.2 = s4s-elt-invalid-content.2: ''{0}'' \u7684\u5167\u5BB9\u7121\u6548\u3002\u5143\u7D20 ''{1}'' \u4E0D\u53EF\u7A7A\u767D\u3002
+- s4s-elt-invalid-content.3 = s4s-elt-invalid-content.3: \u985E\u578B ''{0}'' \u7684\u5143\u7D20\u4E0D\u53EF\u51FA\u73FE\u5728\u5BA3\u544A\u4E4B\u5F8C\uFF0C\u505A\u70BA <schema> \u5143\u7D20\u7684\u5B50\u9805\u3002
++ s4s-elt-invalid-content.3 = s4s-elt-invalid-content.3: \u985E\u578B ''{0}'' \u7684\u5143\u7D20\u4E0D\u53EF\u51FA\u73FE\u5728\u5BA3\u544A\u4E4B\u5F8C\uFF0C\u4F5C\u70BA <schema> \u5143\u7D20\u7684\u5B50\u9805\u3002
+ s4s-elt-schema-ns = s4s-elt-schema-ns: \u5143\u7D20 ''{0}'' \u7684\u547D\u540D\u7A7A\u9593\u5FC5\u9808\u4F86\u81EA\u7DB1\u8981\u547D\u540D\u7A7A\u9593 ''http://www.w3.org/2001/XMLSchema''\u3002
+ s4s-elt-character = s4s-elt-character: \u7DB1\u8981\u5143\u7D20\u4E2D\u4E0D\u5141\u8A31\u975E\u7A7A\u767D\u5B57\u5143\uFF0C\u4F46\u662F ''xs:appinfo'' \u8207 ''xs:documentation'' \u9664\u5916\u3002\u767C\u73FE ''{0}''\u3002
+
+@@ -309,12 +281,12 @@
+ c-selector-xpath = c-selector-xpath: \u7B49\u65BC ''{0}'' \u7684\u9078\u53D6\u5668\u503C\u7121\u6548; \u9078\u53D6\u5668 xpaths \u4E0D\u80FD\u5305\u542B\u5C6C\u6027\u3002
+ EmptyTargetNamespace = EmptyTargetNamespace: \u5728\u7DB1\u8981\u6587\u4EF6 ''{0}'' \u4E2D\uFF0C''targetNamespace'' \u5C6C\u6027\u7684\u503C\u4E0D\u53EF\u70BA\u7A7A\u767D\u5B57\u4E32\u3002
+ FacetValueFromBase = FacetValueFromBase: \u5728\u985E\u578B ''{0}'' \u7684\u5BA3\u544A\u4E2D\uFF0Cfacet ''{2}'' \u7684\u503C ''{1}'' \u5FC5\u9808\u4F86\u81EA\u57FA\u790E\u985E\u578B\u7684\u503C\u7A7A\u9593 ''{3}''\u3002
+- FixedFacetValue = FixedFacetValue: \u5728 {3} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''{0}'' \u7684\u503C ''{1}'' \u7121\u6548\uFF0C\u56E0\u70BA ''{0}'' \u7684\u503C\u4EE5\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u8A2D\u70BA ''{2}''\uFF0C\u4E14 ''{''fixed''}'' = true\u3002
+- InvalidRegex = InvalidRegex: \u6A23\u5F0F\u503C ''{0}'' \u4E0D\u662F\u6709\u6548\u7684\u4E00\u822C\u8868\u793A\u5F0F\u3002\u5831\u544A\u7684\u932F\u8AA4: \u4F4D\u65BC\u8CC7\u6599\u6B04 ''{2}'' \u7684 ''{1}''\u3002
++ FixedFacetValue = FixedFacetValue: \u5728 {3} \u7684\u5B9A\u7FA9\u4E2D\uFF0Cfacet ''{0}'' \u7684\u503C ''{1}'' \u7121\u6548\uFF0C\u56E0\u70BA ''{0}'' \u7684\u503C\u4EE5\u5176\u4E2D\u4E00\u500B\u7956\u7CFB\u985E\u578B\u8A2D\u70BA ''{2}''\uFF0C\u4E14 '{'fixed'}' = true\u3002
++ InvalidRegex = InvalidRegex: \u6A23\u5F0F\u503C ''{0}'' \u4E0D\u662F\u6709\u6548\u7684\u6B63\u898F\u8868\u793A\u5F0F\u3002\u5831\u544A\u7684\u932F\u8AA4: \u4F4D\u65BC\u8CC7\u6599\u6B04 ''{2}'' \u7684 ''{1}''\u3002
+ maxOccurLimit = \u5256\u6790\u5668\u76EE\u524D\u7684\u7D44\u614B\u4E0D\u5141\u8A31 maxOccurs \u5C6C\u6027\u503C\u8A2D\u70BA\u5927\u65BC\u503C {0}\u3002
+ PublicSystemOnNotation = PublicSystemOnNotation: ''public'' \u8207 ''system'' \u81F3\u5C11\u5176\u4E2D\u4E4B\u4E00\u5FC5\u9808\u51FA\u73FE\u5728\u5143\u7D20 ''notation'' \u4E2D\u3002
+ SchemaLocation = \u7B49\u65BC ''{0}'' \u7684 SchemaLocation: schemaLocation \u503C\u5FC5\u9808\u5177\u6709\u5076\u6578\u500B URI\u3002
+ TargetNamespace.1 = TargetNamespace.1: \u9810\u671F\u547D\u540D\u7A7A\u9593 ''{0}''\uFF0C\u4F46\u662F\u7DB1\u8981\u6587\u4EF6\u7684\u76EE\u6A19\u547D\u540D\u7A7A\u9593\u70BA ''{1}''\u3002
+ TargetNamespace.2 = TargetNamespace.2: \u672A\u9810\u671F\u547D\u540D\u7A7A\u9593\uFF0C\u4F46\u662F\u7DB1\u8981\u6587\u4EF6\u5177\u6709\u76EE\u6A19\u547D\u540D\u7A7A\u9593 ''{1}''\u3002
+- UndeclaredEntity = UndeclaredEntity: \u672A\u5BA3\u544A\u500B\u9AD4 ''{0}''\u3002
++ UndeclaredEntity = UndeclaredEntity: \u672A\u5BA3\u544A\u5BE6\u9AD4 ''{0}''\u3002
+ UndeclaredPrefix = UndeclaredPrefix: \u7121\u6CD5\u89E3\u6790 ''{0}'' \u70BA QName: \u672A\u5BA3\u544A\u524D\u7F6E\u78BC ''{1}''\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,31 +1,3 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+ # serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+@@ -33,7 +5,7 @@
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+ #
+-# @version $Id: XMLSerializerMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XMLSerializerMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+ FormatFailed = Beim Formatieren der folgenden Meldung ist ein interner Fehler aufgetreten:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = Attributname "{0}" ist kein QName.
+ AttributePrefix = Attribut "{0}" geh\u00F6rt zu keinem Namespace: Pr\u00E4fix ist m\u00F6glicherweise nicht deklariert oder an einen Namespace gebunden.
+ InvalidNSDecl = Namespace-Deklarationssyntax ist falsch: {0}.
+- EndingCDATA = Zeichenfolge"\"]]>\" darf nur im Content enthalten sein, wenn sie das Ende eines CDATA-Abschnitts markiert.
+- SplittingCDATA = Teilen eines CDATA-Abschnitts mit dem CDATA-Abschnittsabschlusszeichen \"]]>\".
++ EndingCDATA = Zeichenfolge""]]>" darf nur im Content enthalten sein, wenn sie das Ende eines CDATA-Abschnitts markiert.
++ SplittingCDATA = Teilen eines CDATA-Abschnitts mit dem CDATA-Abschnittsabschlusszeichen "]]>".
+ ResourceNotFound = Ressource "{0}" konnte nicht gefunden werden.
+ ResourceNotLoaded = Ressource "{0}" konnte nicht geladen werden. {1}
+ SerializationStopped = Serialisierung auf Benutzeranforderung gestoppt.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ BadMessageKey = No se ha encontrado el mensaje de error que corresponde a la clave de mensaje.
+ FormatFailed = Se ha producido un error interno al formatear el siguiente mensaje:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = El nombre del atributo ''{0}'' no es un QName.
+ AttributePrefix = El atributo ''{0}'' no pertenece a ning\u00FAn espacio de nombres: el prefijo puede ser no declarado o estar enlazado a alg\u00FAn espacio de nombres.
+ InvalidNSDecl = La sintaxis de la declaraci\u00F3n de espacio de nombres no es correcta: {0}.
+- EndingCDATA = La secuencia de caracteres \"]]>\" no debe aparecer en el contenido a menos que se utilice para marcar el final de una secci\u00F3n CDATA.
+- SplittingCDATA = Divisi\u00F3n de una secci\u00F3n CDATA que contiene el marcador de terminaci\u00F3n de secci\u00F3n CDATA \"]]>\".
++ EndingCDATA = La secuencia de caracteres "]]>" no debe aparecer en el contenido a menos que se utilice para marcar el final de una secci\u00F3n CDATA.
++ SplittingCDATA = Divisi\u00F3n de una secci\u00F3n CDATA que contiene el marcador de terminaci\u00F3n de secci\u00F3n CDATA "]]>".
+ ResourceNotFound = No se ha encontrado el recurso ''{0}''.
+ ResourceNotLoaded = No se ha podido cargar el recurso ''{0}''. {1}
+ SerializationStopped = La serializaci\u00F3n se ha parado a petici\u00F3n del usuario.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+ FormatFailed = Une erreur interne est survenue lors de la mise en forme du message suivant :\n
+@@ -49,8 +21,8 @@
+ AttributeQName = Le nom d''attribut ''{0}'' n''est pas un QName.
+ AttributePrefix = L''attribut ''{0}'' n''appartient \u00E0 aucun espace de noms : le pr\u00E9fixe est peut-\u00EAtre non d\u00E9clar\u00E9 ou li\u00E9 \u00E0 un espace de noms.
+ InvalidNSDecl = La syntaxe de la d\u00E9claration d''espace de noms est incorrecte : {0}.
+- EndingCDATA = La s\u00E9quence de caract\u00E8res \"]]>\" ne peut figurer dans le contenu que pour marquer la fin de la section CDATA.
+- SplittingCDATA = Fractionnement d'une section CDATA contenant le marqueur de fin de section CDATA \"]]>\".
++ EndingCDATA = La s\u00E9quence de caract\u00E8res "]]>" ne peut figurer dans le contenu que pour marquer la fin de la section CDATA.
++ SplittingCDATA = Fractionnement d'une section CDATA contenant le marqueur de fin de section CDATA "]]>".
+ ResourceNotFound = La ressource ''{0}'' est introuvable.
+ ResourceNotLoaded = La ressource ''{0}'' n''a pas pu \u00EAtre charg\u00E9e. {1}
+ SerializationStopped = La s\u00E9rialisation a \u00E9t\u00E9 arr\u00EAt\u00E9e \u00E0 la demande de l'utilisateur.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+ FormatFailed = Si \u00E8 verificato un errore interno durante la formattazione del seguente messaggio:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = Il nome attributo ''{0}'' non \u00E8 un QName.
+ AttributePrefix = L''attributo ''{0}'' non appartiene ad alcuno spazio di nomi: il prefisso deve essere non dichiarato o associato a uno spazio di nomi.
+ InvalidNSDecl = La sintassi della dichiarazione dello spazio di nomi \u00E8 errata: {0}.
+- EndingCDATA = La sequenza di caratteri \"]]>\" non deve essere presente nel contenuto a meno che non sia utilizzata per contrassegnare la fine di una sezione CDATA.
+- SplittingCDATA = Verr\u00E0 suddivisa una sezione CDATA che contiene l'indicatore di fine della sezione CDATA \"]]>\".
++ EndingCDATA = La sequenza di caratteri "]]>" non deve essere presente nel contenuto a meno che non sia utilizzata per contrassegnare la fine di una sezione CDATA.
++ SplittingCDATA = Verr\u00E0 suddivisa una sezione CDATA che contiene l'indicatore di fine della sezione CDATA "]]>".
+ ResourceNotFound = Impossibile trovare la risorsa ''{0}''.
+ ResourceNotLoaded = Impossibile caricare la risorsa ''{0}''. {1}
+ SerializationStopped = Serializzazione arrestata su richiesta dell'utente.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+ FormatFailed = \u6B21\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306E\u66F8\u5F0F\u8A2D\u5B9A\u4E2D\u306B\u5185\u90E8\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = \u5C5E\u6027\u540D''{0}''\u306FQName\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+ AttributePrefix = \u5C5E\u6027''{0}''\u304C\u3069\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306B\u3082\u5C5E\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u63A5\u982D\u8F9E\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u306A\u3044\u304B\u3001\u306A\u3093\u3089\u304B\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u306B\u30D0\u30A4\u30F3\u30C9\u3055\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002
+ InvalidNSDecl = \u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u5BA3\u8A00\u306E\u69CB\u6587\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093: {0}\u3002
+- EndingCDATA = \u6587\u5B57\u30B7\u30FC\u30B1\u30F3\u30B9\"]]>\"\u306F\u3001CDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u306E\u7D42\u308F\u308A\u3092\u793A\u3059\u76EE\u7684\u4EE5\u5916\u3067\u30B3\u30F3\u30C6\u30F3\u30C4\u306B\u4F7F\u7528\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
+- SplittingCDATA = CDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u7D42\u4E86\u30DE\u30FC\u30AB\u30FC\"]]>\"\u304C\u542B\u307E\u308C\u3066\u3044\u308BCDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u5206\u5272\u3057\u3066\u3044\u307E\u3059\u3002
++ EndingCDATA = \u6587\u5B57\u30B7\u30FC\u30B1\u30F3\u30B9"]]>"\u306F\u3001CDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u306E\u7D42\u308F\u308A\u3092\u793A\u3059\u76EE\u7684\u4EE5\u5916\u3067\u30B3\u30F3\u30C6\u30F3\u30C4\u306B\u4F7F\u7528\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
++ SplittingCDATA = CDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u7D42\u4E86\u30DE\u30FC\u30AB\u30FC"]]>"\u304C\u542B\u307E\u308C\u3066\u3044\u308BCDATA\u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u5206\u5272\u3057\u3066\u3044\u307E\u3059\u3002
+ ResourceNotFound = \u30EA\u30BD\u30FC\u30B9''{0}''\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002
+ ResourceNotLoaded = \u30EA\u30BD\u30FC\u30B9''{0}''\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002 {1}
+ SerializationStopped = \u30B7\u30EA\u30A2\u30E9\u30A4\u30BA\u304C\u30E6\u30FC\u30B6\u30FC\u30FB\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u505C\u6B62\u3055\u308C\u307E\u3057\u305F\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ FormatFailed = \uB2E4\uC74C \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC744 \uC9C0\uC815\uD558\uB294 \uC911 \uB0B4\uBD80 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.\n
+@@ -49,8 +21,8 @@
+ AttributeQName = \uC18D\uC131 \uC774\uB984 ''{0}''\uC740(\uB294) QName\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+ AttributePrefix = ''{0}'' \uC18D\uC131\uC774 \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uC18D\uD558\uC9C0 \uC54A\uC74C: \uC811\uB450\uC5B4\uC758 \uC120\uC5B8\uC744 \uD574\uC81C\uD558\uAC70\uB098 \uC811\uB450\uC5B4\uB97C \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uC5D0 \uBC14\uC778\uB4DC\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
+ InvalidNSDecl = \uB124\uC784\uC2A4\uD398\uC774\uC2A4 \uC120\uC5B8 \uAD6C\uBB38\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC74C: {0}.
+- EndingCDATA = \uBB38\uC790 \uC2DC\uD000\uC2A4 \"]]>\"\uB294 CDATA \uC139\uC158 \uB05D\uC744 \uD45C\uC2DC\uD558\uB294 \uB370 \uC0AC\uC6A9\uB418\uC9C0 \uC54A\uB294 \uACBD\uC6B0 \uCF58\uD150\uCE20\uC5D0 \uB098\uD0C0\uB098\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
+- SplittingCDATA = CDATA \uC139\uC158 \uC885\uB8CC \uD45C\uC2DC\uC790 \"]]>\"\uB97C \uD3EC\uD568\uD558\uB294 CDATA \uC139\uC158\uC744 \uBD84\uD560\uD558\uB294 \uC911\uC785\uB2C8\uB2E4.
++ EndingCDATA = \uBB38\uC790 \uC2DC\uD000\uC2A4 "]]>"\uB294 CDATA \uC139\uC158 \uB05D\uC744 \uD45C\uC2DC\uD558\uB294 \uB370 \uC0AC\uC6A9\uB418\uC9C0 \uC54A\uB294 \uACBD\uC6B0 \uCF58\uD150\uCE20\uC5D0 \uB098\uD0C0\uB098\uC9C0 \uC54A\uC544\uC57C \uD569\uB2C8\uB2E4.
++ SplittingCDATA = CDATA \uC139\uC158 \uC885\uB8CC \uD45C\uC2DC\uC790 "]]>"\uB97C \uD3EC\uD568\uD558\uB294 CDATA \uC139\uC158\uC744 \uBD84\uD560\uD558\uB294 \uC911\uC785\uB2C8\uB2E4.
+ ResourceNotFound = ''{0}'' \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+ ResourceNotLoaded = ''{0}'' \uB9AC\uC18C\uC2A4\uB97C \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. {1}
+ SerializationStopped = \uC0AC\uC6A9\uC790 \uC694\uCCAD\uC5D0 \uB530\uB77C \uC9C1\uB82C\uD654\uAC00 \uC815\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+ FormatFailed = Ocorreu um erro interno ao formatar a mensagem a seguir:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = O nome do atributo ''{0}'' n\u00E3o \u00E9 QName.
+ AttributePrefix = O atributo ''{0}'' n\u00E3o pertence a nenhum namespace: o prefixo n\u00E3o pode ser n\u00E3o declarado ou vinculado a algum namespace.
+ InvalidNSDecl = Sintaxe de declara\u00E7\u00E3o de namespace incorreta: {0}.
+- EndingCDATA = A sequ\u00EAncia de caracteres \"]]>\" n\u00E3o deve aparecer no conte\u00FAdo, a menos que seja usada para marcar o fim de uma se\u00E7\u00E3o CDATA.
+- SplittingCDATA = Dividir uma se\u00E7\u00E3o CDATA que cont\u00E9m o marcador \"]]>\" de termina\u00E7\u00E3o de se\u00E7\u00E3o CDATA.
++ EndingCDATA = A sequ\u00EAncia de caracteres "]]>" n\u00E3o deve aparecer no conte\u00FAdo, a menos que seja usada para marcar o fim de uma se\u00E7\u00E3o CDATA.
++ SplittingCDATA = Dividir uma se\u00E7\u00E3o CDATA que cont\u00E9m o marcador "]]>" de termina\u00E7\u00E3o de se\u00E7\u00E3o CDATA.
+ ResourceNotFound = N\u00E3o foi poss\u00EDvel encontrar o recurso ''{0}''.
+ ResourceNotLoaded = N\u00E3o foi poss\u00EDvel carregar o recurso ''{0}''. {1}
+ SerializationStopped = Serializa\u00E7\u00E3o interrompida na solicita\u00E7\u00E3o do usu\u00E1rio.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+ FormatFailed = Ett internt fel intr\u00E4ffade vid formatering av f\u00F6ljande meddelande:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = Attributnamnet ''{0}'' \u00E4r inte n\u00E5got QName.
+ AttributePrefix = Attributet ''{0}'' tillh\u00F6r inte n\u00E5gon namnrymd: prefixet kanske inte har deklarerats eller \u00E4r bundet till annan namnrymd.
+ InvalidNSDecl = Felaktig syntax i deklaration av namnrymd: {0}.
+- EndingCDATA = Teckensekvensen \"]]>\" f\u00E5r inte f\u00F6rekomma i inneh\u00E5llet, s\u00E5vida det inte anv\u00E4nds f\u00F6r att markera slut av CDATA-sektion.
+- SplittingCDATA = Delar en CDATA-sektion som inneh\u00E5ller CDATA-sektionens avslutningsmark\u00F6r \"]]>\".
++ EndingCDATA = Teckensekvensen "]]>" f\u00E5r inte f\u00F6rekomma i inneh\u00E5llet, s\u00E5vida det inte anv\u00E4nds f\u00F6r att markera slut av CDATA-sektion.
++ SplittingCDATA = Delar en CDATA-sektion som inneh\u00E5ller CDATA-sektionens avslutningsmark\u00F6r "]]>".
+ ResourceNotFound = Resursen ''{0}'' hittades inte.
+ ResourceNotLoaded = Resursen ''{0}'' kunde inte laddas. {1}
+ SerializationStopped = Serialiseringen stoppades vid anv\u00E4ndarbeg\u00E4ran.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+ FormatFailed = \u8BBE\u7F6E\u4EE5\u4E0B\u6D88\u606F\u7684\u683C\u5F0F\u65F6\u51FA\u73B0\u5185\u90E8\u9519\u8BEF:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = \u5C5E\u6027\u540D ''{0}'' \u4E0D\u662F\u9650\u5B9A\u540D\u3002
+ AttributePrefix = \u5C5E\u6027 ''{0}'' \u4E0D\u5C5E\u4E8E\u4EFB\u4F55\u540D\u79F0\u7A7A\u95F4: \u53EF\u80FD\u672A\u58F0\u660E\u524D\u7F00, \u6216\u8005\u5DF2\u7ECF\u5C06\u524D\u7F00\u7ED1\u5B9A\u5230\u67D0\u4E2A\u540D\u79F0\u7A7A\u95F4\u3002
+ InvalidNSDecl = \u540D\u79F0\u7A7A\u95F4\u58F0\u660E\u8BED\u6CD5\u4E0D\u6B63\u786E: {0}\u3002
+- EndingCDATA = \u9664\u975E\u4F7F\u7528\u5B57\u7B26\u5E8F\u5217 \"]]>\" \u6765\u6807\u8BB0 CDATA \u8282\u7684\u7ED3\u5C3E, \u5426\u5219\u8BE5\u5B57\u7B26\u5E8F\u5217\u4E0D\u80FD\u51FA\u73B0\u5728\u5185\u5BB9\u4E2D\u3002
+- SplittingCDATA = \u62C6\u5206\u5305\u542B CDATA \u6BB5\u7EC8\u6B62\u6807\u8BB0 \"]]>\" \u7684 CDATA \u6BB5\u3002
++ EndingCDATA = \u9664\u975E\u4F7F\u7528\u5B57\u7B26\u5E8F\u5217 "]]>" \u6765\u6807\u8BB0 CDATA \u8282\u7684\u7ED3\u5C3E, \u5426\u5219\u8BE5\u5B57\u7B26\u5E8F\u5217\u4E0D\u80FD\u51FA\u73B0\u5728\u5185\u5BB9\u4E2D\u3002
++ SplittingCDATA = \u62C6\u5206\u5305\u542B CDATA \u6BB5\u7EC8\u6B62\u6807\u8BB0 "]]>" \u7684 CDATA \u6BB5\u3002
+ ResourceNotFound = \u627E\u4E0D\u5230\u8D44\u6E90 ''{0}''\u3002
+ ResourceNotLoaded = \u65E0\u6CD5\u52A0\u8F7D\u8D44\u6E90 ''{0}''\u3002{1}
+ SerializationStopped = \u6839\u636E\u7528\u6237\u8BF7\u6C42\u505C\u6B62\u4E86\u5E8F\u5217\u5316\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,39 +1,11 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores error messages for the Xerces XML
+-# serializer. Many DOM Load/Save error messages also
++# serializer. Many DOM Load/Save error messages also
+ # live here, since the serializer largely implements that package.
+ #
+ # As usual with properties files, the messages are arranged in
+ # key/value tuples.
+-#
+-# @version $Id: XMLSerializerMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++#
++# @version $Id: XMLSerializerMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+ FormatFailed = \u683C\u5F0F\u5316\u4E0B\u5217\u8A0A\u606F\u6642\u767C\u751F\u5167\u90E8\u932F\u8AA4:\n
+@@ -49,8 +21,8 @@
+ AttributeQName = \u5C6C\u6027\u540D\u7A31 ''{0}'' \u4E0D\u662F QName\u3002
+ AttributePrefix = \u5C6C\u6027 ''{0}'' \u4E0D\u5C6C\u65BC\u4EFB\u4F55\u547D\u540D\u7A7A\u9593: \u53EF\u80FD\u672A\u5BA3\u544A\u524D\u7F6E\u78BC\u6216\u524D\u7F6E\u78BC\u9023\u7D50\u5176\u4ED6\u547D\u540D\u7A7A\u9593\u3002
+ InvalidNSDecl = \u547D\u540D\u7A7A\u9593\u5BA3\u544A\u8A9E\u6CD5\u4E0D\u6B63\u78BA: {0}\u3002
+- EndingCDATA = \u5B57\u5143\u9806\u5E8F \"]]>\" \u4E0D\u53EF\u51FA\u73FE\u5728\u5167\u5BB9\u4E2D\uFF0C\u9664\u975E\u7528\u65BC\u6A19\u793A CDATA \u6BB5\u843D\u7684\u7D50\u5C3E\u3002
+- SplittingCDATA = \u5206\u5272\u5305\u542B CDATA \u6BB5\u843D\u7D42\u6B62\u6A19\u8A18 \"]]>\" \u7684 CDATA \u6BB5\u843D\u3002
++ EndingCDATA = \u5B57\u5143\u9806\u5E8F "]]>" \u4E0D\u53EF\u51FA\u73FE\u5728\u5167\u5BB9\u4E2D\uFF0C\u9664\u975E\u7528\u65BC\u6A19\u793A CDATA \u6BB5\u843D\u7684\u7D50\u5C3E\u3002
++ SplittingCDATA = \u5206\u5272\u5305\u542B CDATA \u6BB5\u843D\u7D42\u6B62\u6A19\u8A18 "]]>" \u7684 CDATA \u6BB5\u843D\u3002
+ ResourceNotFound = \u627E\u4E0D\u5230\u8CC7\u6E90 ''{0}''\u3002
+ ResourceNotLoaded = \u7121\u6CD5\u8F09\u5165\u8CC7\u6E90 ''{0}''\u3002{1}
+ SerializationStopped = \u4F9D\u7167\u4F7F\u7528\u8005\u8981\u6C42\u505C\u6B62\u5E8F\u5217\u5316\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_de.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_de.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_de.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Die zum Meldungsschl\u00FCssel geh\u00F6rige Fehlermeldung kann nicht gefunden werden.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_es.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_es.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_es.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = No se ha encontrado el mensaje de error que corresponde a la clave de mensaje.
+@@ -38,7 +10,7 @@
+
+ # XPointer Framework Error Messages
+ XPointerProcessingError = XPointerProcessingError: Se ha producido un error al procesar la expresi\u00F3n XPointer.
+-InvalidXPointerToken = InvalidXPointerToken: La expresi\u00F3n XPointer contiene el elemento no v\u00E1lido ''{0}''
++InvalidXPointerToken = InvalidXPointerToken: La expresi\u00F3n XPointer contiene el token no v\u00E1lido ''{0}''
+ InvalidXPointerExpression = InvalidXPointerExpression: La expresi\u00F3n XPointer ''{0}'' no es v\u00E1lida.
+ MultipleShortHandPointers = MultipleShortHandPointers: La expresi\u00F3n XPointer ''{0}'' no es v\u00E1lida. Tiene m\u00E1s de un puntero abreviado.
+ SchemeDataNotFollowedByCloseParenthesis = SchemeDataNotFollowedByCloseParenthesis: La expresi\u00F3n XPointer ''{0}'' no es v\u00E1lida. SchemeData no viene seguido de un car\u00E1cter '')''.
+@@ -48,7 +20,7 @@
+ InvalidSchemeDataInXPointer = InvalidSchemeDataInXPointer: La expresi\u00F3n XPointer ''{0}'' contiene un valor de SchemeData no v\u00E1lido.
+
+ # XPointer Element Scheme Error Messages
+-InvalidElementSchemeToken = InvalidElementSchemeToken: La expresi\u00F3n XPointer del esquema de element() contiene el elemento no v\u00E1lido ''{0}''
++InvalidElementSchemeToken = InvalidElementSchemeToken: La expresi\u00F3n XPointer del esquema de element() contiene el token no v\u00E1lido ''{0}''
+ InvalidElementSchemeXPointer = InvalidElementSchemeXPointer: La expresi\u00F3n XPointer del esquema de elemento ''{0}'' no es v\u00E1lida.
+ XPointerElementSchemeProcessingError = XPointerElementSchemeProcessingError: Se ha producido un error al procesar la expresi\u00F3n de esquema XPointer element().
+ InvalidNCNameInElementSchemeData = InvalidNCNameInElementSchemeData: El esquema element() contiene un puntero abreviado ''{0}'' con un valor de NCName no v\u00E1lido.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_fr.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_fr.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Le message d'erreur correspondant \u00E0 la cl\u00E9 de message est introuvable.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_it.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_it.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Impossibile trovare il messaggio di errore corrispondente alla chiave di messaggio.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_ja.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_ja.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC\u306B\u5BFE\u5FDC\u3059\u308B\u30A8\u30E9\u30FC\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ko.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_ko.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_ko.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \uBA54\uC2DC\uC9C0 \uD0A4\uC5D0 \uD574\uB2F9\uD558\uB294 \uC624\uB958 \uBA54\uC2DC\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_pt_BR.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_pt_BR.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_pt_BR.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = N\u00E3o foi poss\u00EDvel encontrar a mensagem de erro correspondente \u00E0 chave da mensagem.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_sv.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_sv.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = Hittar inte felmeddelandet som motsvarar meddelandenyckeln.
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_CN.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_zh_CN.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_zh_CN.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u4E0E\u6D88\u606F\u5173\u952E\u5B57\u5BF9\u5E94\u7684\u9519\u8BEF\u6D88\u606F\u3002
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_TW.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,36 +1,8 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/*
+- * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+- */
+-
+ # This file stores localized messages for the Xerces XPointer implementation.
+ #
+ # The messages are arranged in key and value tuples in a ListResourceBundle.
+ #
+-# @version $Id: XPointerMessages_zh_TW.properties 3021 2011-03-01 00:12:28Z joehw $
++# @version $Id: XPointerMessages_zh_TW.properties /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+
+ # Messages for message reporting
+ BadMessageKey = \u627E\u4E0D\u5230\u5C0D\u61C9\u8A0A\u606F\u7D22\u5F15\u9375\u7684\u932F\u8AA4\u8A0A\u606F\u3002
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_de.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=Falsches Zeichen.
++parser.parse.2=Ung\u00FCltige Referenznummer.
++parser.next.1=Nach \\ ist ein Zeichen erforderlich.
++parser.next.2='?' wird nicht erwartet. '(?:' oder '(?=' oder '(?!' oder '(?<' oder '(?#' oder '(?>'?
++parser.next.3='(?<=' oder '(?<!' wird erwartet.
++parser.next.4=Ein Kommentar ist nicht abgeschlossen.
++parser.factor.1=')' wird erwartet.
++parser.factor.2=Unerwartetes Ende des Musters in einer Modifier-Gruppe.
++parser.factor.3=':' wird erwartet.
++parser.factor.4=Unerwartetes Ende des Musters in einer Bedingungsgruppe.
++parser.factor.5=Eine Back-Referenz, ein Anker, ein Lookahead oder ein Lookbehind wird in einem Bedingungsmuster erwartet
++parser.factor.6=Es gibt mehr als drei Auswahlm\u00F6glichkeiten in einer Bedingungsgruppe.
++parser.atom.1=Ein Zeichen in U+0040-U+005f muss auf \\c folgen.
++parser.atom.2=Ein '{' ist vor einer Zeichenkategorie erforderlich.
++parser.atom.3=Ein Eigenschaftsname nicht wird durch '}' abgeschlossen.
++parser.atom.4=Unerwartetes Metazeichen.
++parser.atom.5=Unbekannte Eigenschaft.
++parser.cc.1=Eine POSIX-Zeichenklasse muss durch ':]' abgeschlossen werden.
++parser.cc.2=Unerwartetes Ende des Musters in einer Zeichenklasse.
++parser.cc.3=Unbekannter Name f\u00FCr eine POSIX-Zeichenklasse.
++parser.cc.4='-' ist hier ung\u00FCltig.
++parser.cc.5=']' wird erwartet.
++parser.cc.6='[' ist in einer Zeichenklasse ung\u00FCltig. Schreiben Sie '\\['.
++parser.cc.7=']' ist in einer Zeichenklasse ung\u00FCltig. Schreiben Sie '\\]'.
++parser.cc.8='-' ist ein ung\u00FCltiger Zeichenbereich. Schreiben Sie '\\-'.
++parser.ope.1='[' wird erwartet.
++parser.ope.2=')' oder '-[' oder '+[' oder '&[' wird erwartet.
++parser.ope.3=Der Endcodepunkt des Bereichs ist kleiner als der Startcodepunkt.
++parser.descape.1=Ung\u00FCltige Unicode-Hex-Notation.
++parser.descape.2=\u00DCberlauf in einer Hex-Notation.
++parser.descape.3='\\x{' muss durch '}' abgeschlossen werden.
++parser.descape.4=Ung\u00FCltiger Unicode-Codepunkt.
++parser.descape.5=Ein Anker darf nicht hier sein.
++parser.process.1=Dieser Ausdruck wird in der aktuellen Optionseinstellung nicht unterst\u00FCtzt.
++parser.quantifier.1=Ung\u00FCltiger Quantifizierer. Eine Ziffer wird erwartet.
++parser.quantifier.2=Ung\u00FCltiger Quantifizierer. Ung\u00FCltige Menge, oder ein '}' fehlt.
++parser.quantifier.3=Ung\u00FCltiger Quantifizierer. Eine Stelle oder '}' wird erwartet.
++parser.quantifier.4=Ung\u00FCltiger Quantifizierer. Mindestmenge muss <= Maximalmenge sein.
++parser.quantifier.5=Ung\u00FCltiger Quantifizierer. Ein Mengenwert\u00FCberlauf.
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_es.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=Car\u00E1cter incorrecto.
++parser.parse.2=N\u00FAmero de referencia no v\u00E1lido.
++parser.next.1=Es necesario un car\u00E1cter despu\u00E9s de \\.
++parser.next.2=No se esperaba '?'. '(?:', '(?=', '(?!', '(?<', '(?#' o '(?>'?
++parser.next.3=Se esperaba '(?<=' o '(?<!'.
++parser.next.4=Un comentario no est\u00E1 terminado.
++parser.factor.1=Se esperaba ')'.
++parser.factor.2=Fin inesperado del patr\u00F3n en un grupo de modificadores.
++parser.factor.3=Se esperaba ':'.
++parser.factor.4=Fin inesperado del patr\u00F3n en un grupo condicional.
++parser.factor.5=Se esperaba una referencia hacia atr\u00E1s, anclaje, lookahead o lookbehind en un patr\u00F3n condicional.
++parser.factor.6=Hay m\u00E1s de tres opciones en un grupo condicional.
++parser.atom.1=Un car\u00E1cter en U+0040-U+005f debe seguir a \\c.
++parser.atom.2=Se necesita '{' antes de una categor\u00EDa de car\u00E1cter.
++parser.atom.3=Un nombre de propiedad no est\u00E1 cerrado por '}'.
++parser.atom.4=Metacar\u00E1cter inesperado.
++parser.atom.5=Propiedad desconocida.
++parser.cc.1=Una clase de car\u00E1cter POSIX debe estar cerrada por ':]'.
++parser.cc.2=Fin inesperado del patr\u00F3n en una clase de car\u00E1cter.
++parser.cc.3=Nombre desconocido para una clase de car\u00E1cter POSIX.
++parser.cc.4='-' no es v\u00E1lido aqu\u00ED.
++parser.cc.5=Se esperaba ']'.
++parser.cc.6='[' no es v\u00E1lido en una clase de car\u00E1cter. Escriba '\\['.
++parser.cc.7=']' no es v\u00E1lido en una clase de car\u00E1cter. Escriba '\\]'.
++parser.cc.8='-' no es un rango de caracteres v\u00E1lido. Escriba '\\-'.
++parser.ope.1=Se esperaba '['.
++parser.ope.2=Se esperaba ')', '-[', '+[' o '&['.
++parser.ope.3=El punto de c\u00F3digo de fin de rango es menor que el punto de c\u00F3digo de inicio.
++parser.descape.1=Notaci\u00F3n hexadecimal Unicode no v\u00E1lida.
++parser.descape.2=Desbordamiento en una notaci\u00F3n hexadecimal.
++parser.descape.3='\\x{' debe estar cerrado por '}'.
++parser.descape.4=Punto de c\u00F3digo Unicode no v\u00E1lido.
++parser.descape.5=No debe haber un anclaje aqu\u00ED.
++parser.process.1=Esta expresi\u00F3n no est\u00E1 soportada en la configuraci\u00F3n de la opci\u00F3n actual.
++parser.quantifier.1=Cuantificador no v\u00E1lido. Se esperaba un d\u00EDgito.
++parser.quantifier.2=Cuantificador no v\u00E1lido. La cantidad no es v\u00E1lida o falta '}'.
++parser.quantifier.3=Cuantificador no v\u00E1lido. Se esperaba un d\u00EDgito o '}'.
++parser.quantifier.4=Cuantificador no v\u00E1lido. Una cantidad m\u00EDnima debe ser <= una cantidad m\u00E1xima.
++parser.quantifier.5=Cuantificador no v\u00E1lido. Desbordamiento de un valor de cantidad.
++null
++null
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,32 +1,41 @@
+- parser.parse.1=Caract\u00e8re invalide.
+-parser.parse.2=Num\u00e9ro de r\u00e9f\u00e9rence invalide.
+-parser.next.1=Un \\ doit \u00eatre suivi d'un caract\u00e8re.
+-parser.next.2='?' n'est pas possible ici. '(?:' ou '(?=' ou '(?!' ou '(?<' ou '(?#' ou '(?>'?
+-parser.next.3='(?<=' ou '(?<!' sont attendus.
+-parser.next.4=Un commentaire n'est pas ferm\u00e9.
+-parser.factor.1=')' manquant.
+-parser.factor.2=Fin pr\u00e9matur\u00e9e de motif dans un groupe modifiant.
+-parser.factor.3=':' manquant.
+-parser.factor.4=Fin pr\u00e9matur\u00e9e de motif dans un groupe conditionel.
+-parser.factor.5=Une r\u00e9f\u00e9rence arri\u00e8re ou une ancre ou un lookahead ou un lookbehind est attendu dans un groupe conditionel.
+-parser.factor.6=Il y a plus de trois choix dans un groupe conditionel.
+-parser.atom.1=\\c doit \u00eatre suivi d'un caract\u00e8re dans l'intervalle U+0040-U+005f .
+-parser.atom.2=Un caract\u00e8re de cat\u00e9gorie ou '{' est requis.
+-parser.atom.3=Un nom de propri\u00e9t\u00e9 ne se termine pas par '}'.
+-parser.atom.4=M\u00e9tacaract\u00e8re interdit.
+-parser.atom.5=Propri\u00e9t\u00e9 inconnue.
+-parser.cc.1=Une classe de caract\u00e8re POSIX doit \u00eatre termin\u00e9e par ':]'.
+-parser.cc.2=Fin pr\u00e9matur\u00e9e de motif dans une classe de caract\u00e8re.
+-parser.cc.3=Nom inconnu pour une classe de caract\u00e8re POSIX.
+-parser.cc.4='-' est invalide, dans ce cas.
+-parser.cc.5=']' manquant.
+-parser.cc.6='[' est invalide dans une classe de caract\u00e8re. Ecrivez '\\['.
+-parser.cc.7=']' est invalide dans une classe de caract\u00e8re. Ecrivez '\\]'.
++parser.parse.1=Caract\u00E8re incorrect.
++parser.parse.2=Num\u00E9ro de r\u00E9f\u00E9rence non valide.
++parser.next.1=Un caract\u00E8re est obligatoire apr\u00E8s \\.
++parser.next.2='?' n'est pas attendu. '(?:' ou '(?=' ou '(?!' ou '(?<' ou '(?#' ou '(?>'?
++parser.next.3='(?<=' ou '(?<!' est attendu.
++parser.next.4=Un commentaire n'est pas termin\u00E9.
++parser.factor.1=')' est attendu.
++parser.factor.2=Fin de mod\u00E8le inattendue dans un groupe de modificateur.
++parser.factor.3=':' est attendu.
++parser.factor.4=Fin de mod\u00E8le inattendue dans un groupe conditionnel
++parser.factor.5=Une r\u00E9f\u00E9rence auxiliaire (back reference), un ancrage, une recherche vers l'avant ou une recherche vers l'arri\u00E8re est attendu dans un mod\u00E8le conditionnel.
++parser.factor.6=Il existe plus de trois choix dans un groupe conditionnel.
++parser.atom.1=Un caract\u00E8re compris entre U+0040-U+005f doit suivre \\c.
++parser.atom.2=Une accolade ('{') est obligatoire avant une cat\u00E9gorie de caract\u00E8res.
++parser.atom.3=Un nom de propri\u00E9t\u00E9 n'est pas ferm\u00E9 par une accolade ('}').
++parser.atom.4=M\u00E9tacaract\u00E8re inattendu
++parser.atom.5=Propri\u00E9t\u00E9 inconnue.
++parser.cc.1=Une classe de caract\u00E8res POSIX doit \u00EAtre ferm\u00E9e par ':]'.
++parser.cc.2=Fin de mod\u00E8le inattendue dans une classe de caract\u00E8res.
++parser.cc.3=Nom inconnu pour une classe de caract\u00E8res POSIX.
++parser.cc.4='-' n'est pas valide ici.
++parser.cc.5=']' est attendu.
++parser.cc.6='[' n'est pas valide dans une classe de caract\u00E8res. Ecrivez '\\['.
++parser.cc.7=']' n'est pas valide dans une classe de caract\u00E8res. Ecrivez '\\]'.
++parser.cc.8='-' est une plage de caract\u00E8res non valide. Ecrivez '\\-'.
+ parser.ope.1='[' est attendu.
+-parser.ope.2=')' ou '-[' ou '+[' ou '&[' sont attendus.
+-parser.descape.1=Notation hexad\u00e9cimale Unicode invalide.
+-parser.descape.2=D\u00e9passement de capacit\u00e9 dans une expression hexad\u00e9cimale.
+-parser.descape.3='\\x{' doit se terminer par un '}'.
+-parser.descape.4=Point de code Unicode invalide.
+-parser.descape.5=Ancre interdite ici.
+-parser.process.1=Cette expression n'est pas autoris\u00e9e compte tenu des options en cours.
++parser.ope.2=')' ou '-[' ou '+[' ou '&[' est attendu.
++parser.ope.3=Le point code de fin de la plage est inf\u00E9rieur au point code de d\u00E9but.
++parser.descape.1=Notation hexad\u00E9cimale Unicode non valide.
++parser.descape.2=D\u00E9bordement de capacit\u00E9 d'une notation hexad\u00E9cimale.
++parser.descape.3='\\x{' doit \u00EAtre ferm\u00E9 par '}'.
++parser.descape.4=Point code Unicode non valide.
++parser.descape.5=Aucun point d'ancrage ne doit se trouver ici.
++parser.process.1=Cette expression n'est pas prise en charge dans le param\u00E8tre d'option en cours.
++parser.quantifier.1=Quantificateur non valide. Un chiffre est attendu.
++parser.quantifier.2=Quantificateur non valide. Quantit\u00E9 non valide ou accolade ('}') manquante.
++parser.quantifier.3=Quantificateur non valide. Un chiffre ou une accolade ('}') est attendu.
++parser.quantifier.4=Quantificateur non valide. Une quantit\u00E9 minimale doit \u00EAtre <= une quantit\u00E9 maximale.
++parser.quantifier.5=Quantificateur non valide. D\u00E9bordement de la valeur de quantit\u00E9.
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_it.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=Carattere errato.
++parser.parse.2=Numero di riferimento non valido.
++parser.next.1=\u00C8 necessario un carattere dopo \\.
++parser.next.2='?' non previsto. '(?:' o '(?=' o '(?!' o '(?<' o '(?#' o '(?>'?
++parser.next.3='(?<=' o '(?<!' previsto.
++parser.next.4=Un commento non \u00E8 terminato.
++parser.factor.1=\u00E8 previsto ')'.
++parser.factor.2=Fine del pattern imprevista in un gruppo modificatore.
++parser.factor.3=\u00E8 previsto ':'.
++parser.factor.4=Fine del pattern imprevista in un gruppo condizionale.
++parser.factor.5=In un pattern condizionale \u00E8 previsto un riferimento all'indietro, un ancoraggio, un lookahead o un lookbehind.
++parser.factor.6=In un gruppo condizionale sono disponibili pi\u00F9 di tre scelte.
++parser.atom.1=Un carattere in U+0040-U+005f deve seguire \\c.
++parser.atom.2=Un '{' \u00E8 necessario prima di una categoria di carattere.
++parser.atom.3=Un nome di propriet\u00E0 non \u00E8 chiuso da '}'.
++parser.atom.4=Metacarattere imprevisto.
++parser.atom.5=Propriet\u00E0 sconosciuta.
++parser.cc.1=Una classe caratteri POSIX deve essere chiusa da ':]'.
++parser.cc.2=Fine imprevista del pattern in una classe caratteri.
++parser.cc.3=Nome sconosciuto per una classe caratteri POSIX.
++parser.cc.4='-' non \u00E8 valido qui.
++parser.cc.5=\u00E8 previsto ']'.
++parser.cc.6='[' non \u00E8 valido in una classe caratteri. Scrivere '\\['.
++parser.cc.7=']' non \u00E8 valido in una classe caratteri. Scrivere '\\]'.
++parser.cc.8='-' \u00E8 un intervallo di caratteri non valido. Scrivere '\\-'.
++parser.ope.1=\u00E8 previsto '['.
++parser.ope.2=\u00E8 previsto ')' o '-[' o '+[' o '&['.
++parser.ope.3=Il punto di codice finale dell'intervallo \u00E8 minore del punto di codice iniziale.
++parser.descape.1=Notazione esadecimale Unicode non valida.
++parser.descape.2=Overflow in una notazione esadecimale.
++parser.descape.3='\\x{' deve essere chiuso da '}'.
++parser.descape.4=Punto di codice Unicode non valido.
++parser.descape.5=Un ancoraggio non deve essere posizionato qui.
++parser.process.1=Questa espressione non \u00E8 supportata nell'impostazione dell'opzione corrente.
++parser.quantifier.1=Quantificatore non valido. \u00C8 prevista una cifra.
++parser.quantifier.2=Quantificatore non valido. Quantit\u00E0 non valida o '}' mancante.
++parser.quantifier.3=Quantificatore non valido. \u00C8 prevista una cifra o '}'.
++parser.quantifier.4=Quantificatore non valido.Una quantit\u00E0 minima deve essere <= di una quantit\u00E0 massima.
++parser.quantifier.5=Quantificatore non valido. Overflow del valore di quantit\u00E0.
++null
++null
+--- ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -1,32 +1,41 @@
+-parser.parse.1=\u3078\u3093\u306a\u6587\u5b57.
+-parser.parse.2=\u5b58\u5728\u3057\u306a\u3044\u30b0\u30eb\u30fc\u30d7\u756a\u53f7\u3067\u3059.
+-parser.next.1=\\ \u306e\u5f8c\u306b1\u6587\u5b57\u5fc5\u8981\u3067\u3059.
+-parser.next.2='?' \u3092\u3053\u3053\u306b\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. \u3082\u3057\u304b\u3057\u3066 '(?:' \u304b '(?=' \u304b '(?!' \u304b '(?<' \u304b '(?#' \u304b '(?>' \u3067\u3059\u304b?
+-parser.next.3='(?<=' \u304b '(?<!' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.next.4=\u8a3b\u91c8\u304c\u9589\u3058\u3066\u3044\u307e\u305b\u3093.
+-parser.factor.1=')' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.factor.2=\u30aa\u30d7\u30b7\u30e7\u30f3\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+-parser.factor.3=':' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.factor.4=\u6761\u4ef6\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+-parser.factor.5=\u6761\u4ef6\u30d1\u30bf\u30fc\u30f3\u306b\u306f\u3001\u5f8c\u65b9\u53c2\u7167\u30fb\u30a2\u30f3\u30ab\u30fc\u30fb\u5148\u8aad\u307f\u30fb\u5f8c\u8aad\u307f\u306e\u307f\u4f7f\u7528\u3067\u304d\u307e\u3059.
+-parser.factor.6=\u6761\u4ef6\u4ed8\u304d\u30b0\u30eb\u30fc\u30d7\u306e\u4e2d\u306b3\u500b\u4ee5\u4e0a\u306e\u9078\u629e\u3092\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+-parser.atom.1=\\c \u306e\u5f8c\u306b\u306f\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u304c U+0040\uff5eU+005f \u306e\u7bc4\u56f2\u306e\u6587\u5b57\u304c\u5fc5\u8981\u3067\u3059.
+-parser.atom.2=1\u6587\u5b57\u306e\u30ab\u30c6\u30b4\u30ea\u6587\u5b57\u304b '{' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.atom.3=\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u304c '}' \u3067\u9589\u3058\u3066\u3044\u307e\u305b\u3093.
+-parser.atom.4=\u30e1\u30bf\u6587\u5b57\u304c\u5909\u306a\u3068\u3053\u308d\u306b\u3042\u308a\u307e\u3059.
+-parser.atom.5=\u672a\u77e5\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3067\u3059.
+-parser.cc.1=POSIX \u6587\u5b57\u30af\u30e9\u30b9\u306f ':]' \u3067\u9589\u3058\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.
+-parser.cc.2=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u30d1\u30bf\u30fc\u30f3\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059.
+-parser.cc.3=\u672a\u77e5\u306e POSIX \u6587\u5b57\u30af\u30e9\u30b9\u540d\u3067\u3059.
+-parser.cc.4=\u3053\u3053\u306b '-' \u3092\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+-parser.cc.5=']' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.cc.6=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u306f '[' \u3092\u76f4\u63a5\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. '\\[' \u3068\u66f8\u3044\u3066\u304f\u3060\u3055\u3044.
+-parser.cc.7=\u6587\u5b57\u30af\u30e9\u30b9\u5185\u3067\u306f ']' \u3092\u76f4\u63a5\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093. '\\]' \u3068\u66f8\u3044\u3066\u304f\u3060\u3055\u3044.
+-parser.ope.1='[' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.ope.2=')' \u304b '-[' \u304b '+[' \u304b '&[' \u304c\u5fc5\u8981\u3067\u3059.
+-parser.descape.1=\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306e16\u9032\u6570\u8868\u8a18\u4e2d\u306b\u9593\u9055\u3063\u305f\u6587\u5b57\u304c\u3042\u308a\u307e\u3059.
+-parser.descape.2=\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u6570\u5024\u304c\u5927\u304d\u3059\u304e\u307e\u3059.
+-parser.descape.3='\\x{' \u306f '}' \u3067\u9589\u3058\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093.
+-parser.descape.4=Unicode \u306e\u30b3\u30fc\u30c9\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u4e0d\u6b63\u3067\u3059.
+-parser.descape.5=\u30a2\u30f3\u30ab\u30fc\u3092\u3053\u3053\u306b\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093.
+-parser.process.1=\u3053\u306e\u8868\u73fe\u306f\u73fe\u5728\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u8a2d\u5b9a\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093.
++parser.parse.1=\u6587\u5B57\u304C\u9055\u3063\u3066\u3044\u307E\u3059\u3002
++parser.parse.2=\u7121\u52B9\u306A\u53C2\u7167\u756A\u53F7\u3067\u3059\u3002
++parser.next.1=\\\u306E\u5F8C\u306B\u6587\u5B57\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.next.2='?'\u306F\u60F3\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002'(?:'\u3001'(?='\u3001'(?!'\u3001'(?<'\u3001'(?#'\u307E\u305F\u306F'(?>'\u3067\u3059\u304B\u3002
++parser.next.3='(?<='\u307E\u305F\u306F'(?<!'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.next.4=\u30B3\u30E1\u30F3\u30C8\u304C\u7D42\u4E86\u3057\u3066\u3044\u307E\u305B\u3093\u3002
++parser.factor.1=')'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.factor.2=\u4FEE\u98FE\u5B50\u30B0\u30EB\u30FC\u30D7\u306E\u30D1\u30BF\u30FC\u30F3\u304C\u4E88\u671F\u305B\u305A\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002
++parser.factor.3=':'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.factor.4=\u6761\u4EF6\u30B0\u30EB\u30FC\u30D7\u306E\u30D1\u30BF\u30FC\u30F3\u304C\u4E88\u671F\u305B\u305A\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002
++parser.factor.5=\u6761\u4EF6\u30D1\u30BF\u30FC\u30F3\u306B\u5F8C\u65B9\u53C2\u7167\u3001\u30A2\u30F3\u30AB\u30FC\u3001\u5148\u8AAD\u307F\u307E\u305F\u306F\u5F8C\u8AAD\u307F\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.factor.6=\u6761\u4EF6\u30B0\u30EB\u30FC\u30D7\u306B3\u500B\u8D85\u306E\u9078\u629E\u80A2\u304C\u3042\u308A\u307E\u3059\u3002
++parser.atom.1=\\c\u306E\u5F8C\u306BU+0040\u304B\u3089U+005f\u307E\u3067\u306E\u6587\u5B57\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.atom.2=\u6587\u5B57\u30AB\u30C6\u30B4\u30EA\u306E\u524D\u306B'{'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.atom.3=\u30D7\u30ED\u30D1\u30C6\u30A3\u540D\u304C'}'\u3067\u9589\u3058\u3089\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++parser.atom.4=\u4E88\u671F\u3057\u306A\u3044\u30E1\u30BF\u6587\u5B57\u3067\u3059\u3002
++parser.atom.5=\u4E0D\u660E\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u3059\u3002
++parser.cc.1=POSIX\u6587\u5B57\u30AF\u30E9\u30B9\u306F':]'\u3067\u9589\u3058\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++parser.cc.2=\u6587\u5B57\u30AF\u30E9\u30B9\u306E\u30D1\u30BF\u30FC\u30F3\u304C\u4E88\u671F\u305B\u305A\u7D42\u4E86\u3057\u307E\u3057\u305F\u3002
++parser.cc.3=POSIX\u6587\u5B57\u30AF\u30E9\u30B9\u306B\u5BFE\u3059\u308B\u540D\u524D\u304C\u4E0D\u660E\u3067\u3059\u3002
++parser.cc.4='-'\u306F\u3053\u3053\u3067\u306F\u7121\u52B9\u3067\u3059\u3002
++parser.cc.5=']'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.cc.6='['\u306F\u6587\u5B57\u30AF\u30E9\u30B9\u3067\u7121\u52B9\u3067\u3059\u3002'\\['\u3092\u8A18\u8FF0\u3057\u307E\u3059\u3002
++parser.cc.7=']'\u306F\u6587\u5B57\u30AF\u30E9\u30B9\u3067\u7121\u52B9\u3067\u3059\u3002'\\]'\u3092\u8A18\u8FF0\u3057\u307E\u3059\u3002
++parser.cc.8='-'\u306F\u7121\u52B9\u306A\u6587\u5B57\u7BC4\u56F2\u3067\u3059\u3002'\\-'\u3092\u8A18\u8FF0\u3057\u307E\u3059\u3002
++parser.ope.1='['\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.ope.2=')'\u3001'-['\u3001'+['\u307E\u305F\u306F'&['\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.ope.3=\u7BC4\u56F2\u306E\u7D42\u4E86\u30B3\u30FC\u30C9\u30FB\u30DD\u30A4\u30F3\u30C8\u304C\u958B\u59CB\u30B3\u30FC\u30C9\u30FB\u30DD\u30A4\u30F3\u30C8\u3088\u308A\u5C0F\u3055\u3044\u3067\u3059\u3002
++parser.descape.1=\u7121\u52B9\u306AUnicode16\u9032\u6CD5\u3067\u3059\u3002
++parser.descape.2=16\u9032\u6CD5\u3067\u30AA\u30FC\u30D0\u30FC\u30D5\u30ED\u30FC\u3057\u3066\u3044\u307E\u3059\u3002
++parser.descape.3='\\x{'\u306F'}'\u3067\u9589\u3058\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++parser.descape.4=\u7121\u52B9\u306AUnicode\u30B3\u30FC\u30C9\u30FB\u30DD\u30A4\u30F3\u30C8\u3067\u3059\u3002
++parser.descape.5=\u30A2\u30F3\u30AB\u30FC\u306F\u3053\u3053\u3067\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002
++parser.process.1=\u3053\u306E\u5F0F\u306F\u3001\u73FE\u5728\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
++parser.quantifier.1=\u7121\u52B9\u306A\u6570\u91CF\u8A5E\u3067\u3059\u3002\u6570\u5B57\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.quantifier.2=\u7121\u52B9\u306A\u6570\u91CF\u8A5E\u3067\u3059\u3002'}'\u304C\u3042\u308A\u307E\u305B\u3093\u3002
++parser.quantifier.3=\u7121\u52B9\u306A\u6570\u91CF\u8A5E\u3067\u3059\u3002\u6570\u5B57\u307E\u305F\u306F'}'\u304C\u5FC5\u8981\u3067\u3059\u3002
++parser.quantifier.4=\u7121\u52B9\u306A\u6570\u91CF\u8A5E\u3067\u3059\u3002\u6700\u5C0F\u6570\u91CF\u306F\u6700\u5927\u6570\u91CF\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
++parser.quantifier.5=\u7121\u52B9\u306A\u6570\u91CF\u8A5E\u3067\u3059\u3002\u6570\u91CF\u5024\u304C\u30AA\u30FC\u30D0\u30FC\u30D5\u30ED\u30FC\u3057\u3066\u3044\u307E\u3059\u3002
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ko.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=\uC798\uBABB\uB41C \uBB38\uC790\uC785\uB2C8\uB2E4.
++parser.parse.2=\uBD80\uC801\uD569\uD55C \uCC38\uC870 \uBC88\uD638\uC785\uB2C8\uB2E4.
++parser.next.1=\\ \uB4A4\uC5D0 \uBB38\uC790\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.next.2='?'\uB294 \uD544\uC694\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. '(?:' \uB610\uB294 '(?=' \uB610\uB294 '(?!' \uB610\uB294 '(?<' \uB610\uB294 '(?#' \uB610\uB294 '(?>'?
++parser.next.3='(?<=' \uB610\uB294 '(?<!'\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.next.4=\uC124\uBA85\uC774 \uC885\uB8CC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
++parser.factor.1=')'\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.factor.2=\uC218\uC815\uC790 \uADF8\uB8F9\uC5D0 \uC608\uC0C1\uCE58 \uC54A\uC740 \uD328\uD134 \uB05D\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++parser.factor.3=':'\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.factor.4=\uC870\uAC74 \uADF8\uB8F9\uC5D0 \uC608\uC0C1\uCE58 \uC54A\uC740 \uD328\uD134 \uB05D\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++parser.factor.5=\uC870\uAC74 \uD328\uD134\uC5D0 \uC5ED\uCC38\uC870 \uB610\uB294 \uC575\uCEE4 \uB610\uB294 lookahead \uB610\uB294 lookbehind\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.factor.6=\uC870\uAC74 \uADF8\uB8F9\uC5D0 4\uAC1C \uC774\uC0C1\uC758 \uC120\uD0DD \uD56D\uBAA9\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++parser.atom.1=U+0040-U+005f\uC758 \uBB38\uC790\uAC00 \\c \uB4A4\uC5D0 \uC640\uC57C \uD569\uB2C8\uB2E4.
++parser.atom.2=\uBB38\uC790 \uBC94\uC8FC \uC55E\uC5D0 '{'\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.atom.3=\uC18D\uC131 \uC774\uB984\uC774 '}'\uB85C \uB2EB\uD788\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
++parser.atom.4=\uC608\uC0C1\uCE58 \uC54A\uC740 \uBA54\uD0C0 \uBB38\uC790\uC785\uB2C8\uB2E4.
++parser.atom.5=\uC54C \uC218 \uC5C6\uB294 \uC18D\uC131\uC785\uB2C8\uB2E4.
++parser.cc.1=POSIX \uBB38\uC790 \uD074\uB798\uC2A4\uB97C ':]'\uB85C \uB2EB\uC544\uC57C \uD569\uB2C8\uB2E4.
++parser.cc.2=\uBB38\uC790 \uD074\uB798\uC2A4\uC5D0 \uC608\uC0C1\uCE58 \uC54A\uC740 \uD328\uD134 \uB05D\uC774 \uC788\uC2B5\uB2C8\uB2E4.
++parser.cc.3=POSIX \uBB38\uC790 \uD074\uB798\uC2A4\uC5D0 \uB300\uD574 \uC54C \uC218 \uC5C6\uB294 \uC774\uB984\uC785\uB2C8\uB2E4.
++parser.cc.4='-'\uB294 \uC5EC\uAE30\uC11C \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
++parser.cc.5=']'\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.cc.6=\uBB38\uC790 \uD074\uB798\uC2A4\uC5D0\uC11C '['\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. '\\['\uB97C \uC4F0\uC2ED\uC2DC\uC624.
++parser.cc.7=\uBB38\uC790 \uD074\uB798\uC2A4\uC5D0\uC11C ']'\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. '\\]'\uB97C \uC4F0\uC2ED\uC2DC\uC624.
++parser.cc.8='-'\uC740 \uBD80\uC801\uD569\uD55C \uBB38\uC790 \uBC94\uC704\uC785\uB2C8\uB2E4. '\\-'\uC744 \uC4F0\uC2ED\uC2DC\uC624.
++parser.ope.1='['\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.ope.2=')' \uB610\uB294 '-[' \uB610\uB294 '+[' \uB610\uB294 '&['\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.ope.3=\uBC94\uC704 \uB05D \uCF54\uB4DC \uD3EC\uC778\uD2B8\uAC00 \uC2DC\uC791 \uCF54\uB4DC \uD3EC\uC778\uD2B8\uBCF4\uB2E4 \uC791\uC2B5\uB2C8\uB2E4.
++parser.descape.1=\uBD80\uC801\uD569\uD55C \uC720\uB2C8\uCF54\uB4DC 16\uC9C4\uC218 \uD45C\uAE30\uBC95\uC785\uB2C8\uB2E4.
++parser.descape.2=16\uC9C4\uC218 \uD45C\uAE30\uBC95\uC758 \uC624\uBC84\uD50C\uB85C\uC6B0\uC785\uB2C8\uB2E4.
++parser.descape.3='\\x{'\uB294 '}'\uB85C \uB2EB\uC544\uC57C \uD569\uB2C8\uB2E4.
++parser.descape.4=\uBD80\uC801\uD569\uD55C \uC720\uB2C8\uCF54\uB4DC \uCF54\uB4DC \uD3EC\uC778\uD2B8\uC785\uB2C8\uB2E4.
++parser.descape.5=\uC575\uCEE4\uAC00 \uC5EC\uAE30\uC5D0 \uC788\uC73C\uBA74 \uC548\uB429\uB2C8\uB2E4.
++parser.process.1=\uC774 \uD45C\uD604\uC2DD\uC740 \uD604\uC7AC \uC635\uC158 \uC124\uC815\uC5D0\uC11C \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
++parser.quantifier.1=\uC218\uB7C9\uC0AC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC22B\uC790\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.quantifier.2=\uC218\uB7C9\uC0AC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC218\uB7C9\uC774 \uBD80\uC801\uD569\uD558\uAC70\uB098 '}'\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
++parser.quantifier.3=\uC218\uB7C9\uC0AC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC22B\uC790\uB098 '}'\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.
++parser.quantifier.4=\uC218\uB7C9\uC0AC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uCD5C\uC18C \uC218\uB7C9\uC740 \uCD5C\uB300 \uC218\uB7C9 \uC774\uD558\uC5EC\uC57C \uD569\uB2C8\uB2E4.
++parser.quantifier.5=\uC218\uB7C9\uC0AC\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. \uC218\uB7C9 \uAC12 \uC624\uBC84\uD50C\uB85C\uC6B0\uC785\uB2C8\uB2E4.
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_pt_BR.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=Caractere incorreto.
++parser.parse.2=N\u00FAmero de refer\u00EAncia inv\u00E1lido.
++parser.next.1=\u00C9 obrigat\u00F3rio um caractere ap\u00F3s \\.
++parser.next.2='?' n\u00E3o \u00E9 esperado. '(?:' ou '(?=' ou '(?!' ou '(?<' ou '(?#' ou '(?>'?
++parser.next.3='(?<=' ou '(?<!' \u00E9 esperado.
++parser.next.4=Um coment\u00E1rio n\u00E3o foi finalizado.
++parser.factor.1=')' \u00E9 esperado.
++parser.factor.2=Fim inesperado do padr\u00E3o em um grupo de modificadores.
++parser.factor.3=':' \u00E9 esperado.
++parser.factor.4=Fim inesperado do padr\u00E3o em um grupo condicional.
++parser.factor.5=Em um padr\u00E3o condicional, esperava-se uma refer\u00EAncia retroativa, \u00E2ncora, lookahead ou lookbehind.
++parser.factor.6=H\u00E1 mais de tr\u00EAs op\u00E7\u00F5es em um grupo condicional.
++parser.atom.1=Um caractere em U+0040-U+005f vir ap\u00F3s \\c.
++parser.atom.2=Um '{' \u00E9 obrigat\u00F3rio antes de uma categoria de caractere.
++parser.atom.3=Um nome de propriedade n\u00E3o foi fechado por '}'.
++parser.atom.4=Metacaractere inesperado.
++parser.atom.5=Propriedade desconhecida.
++parser.cc.1=Uma classe de caractere POSIX deve ser fechada por ':]'.
++parser.cc.2=Fim inesperado do padr\u00E3o em uma classe de caractere.
++parser.cc.3=Nome desconhecido para uma classe de caractere POSIX.
++parser.cc.4='-' \u00E9 inv\u00E1lido aqui.
++parser.cc.5=']' \u00E9 esperado.
++parser.cc.6='[' \u00E9 inv\u00E1lido em uma classe de caractere. Use '\\['.
++parser.cc.7=']' \u00E9 inv\u00E1lido em uma classe de caractere. Use '\\]'.
++parser.cc.8='-' \u00E9 uma faixa de caracteres inv\u00E1lida. Use '\\-'.
++parser.ope.1='[' \u00E9 esperado.
++parser.ope.2=')' ou '-[' ou '+[' ou '&[' \u00E9 esperado.
++parser.ope.3=O c\u00F3digo de fim da faixa \u00E9 inferior ao de in\u00EDcio.
++parser.descape.1=Nota\u00E7\u00E3o hexadecimal Unicode inv\u00E1lida.
++parser.descape.2=Overflow em uma nota\u00E7\u00E3o hexadecimal.
++parser.descape.3='\\x{' deve ser fechado por '}'.
++parser.descape.4=C\u00F3digo Unicode inv\u00E1lido.
++parser.descape.5=Uma \u00E2ncora n\u00E3o deve estar aqui.
++parser.process.1=Esta express\u00E3o n\u00E3o \u00E9 suportada na defini\u00E7\u00E3o da op\u00E7\u00E3o atual.
++parser.quantifier.1=Quantificador inv\u00E1lido. \u00C9 esperado um d\u00EDgito.
++parser.quantifier.2=Quantificador inv\u00E1lido. A quantidade \u00E9 inv\u00E1lida ou est\u00E1 faltando um '}'.
++parser.quantifier.3=Quantificador inv\u00E1lido. \u00C9 esperado um d\u00EDgito ou '}'.
++parser.quantifier.4=Quantificador inv\u00E1lido. Uma quantidade m\u00EDnima deve ser <= uma quantidade m\u00E1xima.
++parser.quantifier.5=Quantificador inv\u00E1lido. Um overflow do valor de quantidade.
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_sv.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=Fel tecken.
++parser.parse.2=Ogiltigt referensnummer.
++parser.next.1=Ett tecken kr\u00E4vs efter \\.
++parser.next.2='?' f\u00F6rv\u00E4ntas inte. '(?:' eller '(?=' eller '(?!' eller '(?<' eller '(?#' eller '(?>'?
++parser.next.3='(?<=' eller '(?<!' f\u00F6rv\u00E4ntas.
++parser.next.4=En kommentar har inte avslutats.
++parser.factor.1=')' f\u00F6rv\u00E4ntas.
++parser.factor.2=Ov\u00E4ntat avslut p\u00E5 m\u00F6nstret i en modifierargrupp.
++parser.factor.3=':' f\u00F6rv\u00E4ntas.
++parser.factor.4=Ov\u00E4ntat avslut p\u00E5 m\u00F6nstret i en villkorsgrupp.
++parser.factor.5=Bak\u00E5treferens eller ankare eller lookahead eller lookbehind f\u00F6rv\u00E4ntas i ett villkorsm\u00F6nster.
++parser.factor.6=Det finns mer \u00E4n tre val i en villkorsgrupp.
++parser.atom.1=Ett tecken i U+0040-U+005f m\u00E5ste komma efter \\c.
++parser.atom.2=Ett '{' kr\u00E4vs f\u00F6re en teckenkategori.
++parser.atom.3=Ett egenskapsnamn har inte st\u00E4ngts med '}'.
++parser.atom.4=Ov\u00E4ntat metatecken.
++parser.atom.5=Ok\u00E4nd egenskap.
++parser.cc.1=En POSIX-teckenklass m\u00E5ste st\u00E4ngas av ':]'.
++parser.cc.2=Ov\u00E4ntat avslut p\u00E5 m\u00F6nstret i en teckenklass.
++parser.cc.3=Ok\u00E4nt namn p\u00E5 en POSIX-teckenklass.
++parser.cc.4='-' \u00E4r ogiltigt h\u00E4r.
++parser.cc.5=']' f\u00F6rv\u00E4ntas.
++parser.cc.6='[' \u00E4r ogiltigt i en teckenklass. Skriv '\\['.
++parser.cc.7=']' \u00E4r ogiltigt i en teckenklass. Skriv '\\]'.
++parser.cc.8='-' \u00E4r ett ogiltigt teckenintervall. Skriv '\\-'.
++parser.ope.1='[' f\u00F6rv\u00E4ntas.
++parser.ope.2=')' eller '-[' eller '+[' eller '&[' f\u00F6rv\u00E4ntas.
++parser.ope.3=Slutkodspunkten f\u00F6r intervallet \u00E4r mindre \u00E4n startkodspunkten.
++parser.descape.1=Ogiltig Unicode hex-notation.
++parser.descape.2=Spill i en hex-notation.
++parser.descape.3='\\x{' m\u00E5ste st\u00E4ngas av '}'.
++parser.descape.4=Ogiltig Unicode-kodpunkt.
++parser.descape.5=Ett ankare f\u00E5r inte vara h\u00E4r.
++parser.process.1=Det h\u00E4r uttrycket st\u00F6ds inte i aktuell alternativinst\u00E4llning.
++parser.quantifier.1=Ogiltig kvantifierare. En siffra f\u00F6rv\u00E4ntas.
++parser.quantifier.2=Ogiltig kvantifierare. Ogiltig kvantitet eller '}' saknas.
++parser.quantifier.3=Ogiltig kvantifierare. En siffra eller '}' f\u00F6rv\u00E4ntas.
++parser.quantifier.4=Ogiltig kvantifierare. En minkvantitet m\u00E5ste vara <= en maxkvantitet.
++parser.quantifier.5=Ogiltig kvantifierare. Ett kvantitetsv\u00E4rdesspill.
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_CN.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=\u5B57\u7B26\u9519\u8BEF\u3002
++parser.parse.2=\u5F15\u7528\u53F7\u65E0\u6548\u3002
++parser.next.1=\\ \u540E\u9762\u5FC5\u987B\u6709\u5B57\u7B26\u3002
++parser.next.2=\u4E0D\u5E94\u51FA\u73B0 '?'\u3002'(?:' \u6216 '(?=' \u6216 '(?!' \u6216 '(?<' \u6216 '(?#' \u6216 '(?>'?
++parser.next.3=\u5E94\u4E3A '(?<=' \u6216 '(?<!'\u3002
++parser.next.4=\u6CE8\u91CA\u672A\u7EC8\u6B62\u3002
++parser.factor.1=\u5E94\u4E3A ')'\u3002
++parser.factor.2=\u4FEE\u9970\u7B26\u7EC4\u4E2D\u610F\u5916\u7684\u6A21\u5F0F\u7ED3\u5C3E\u3002
++parser.factor.3=\u5E94\u4E3A ':'\u3002
++parser.factor.4=\u6761\u4EF6\u7EC4\u4E2D\u610F\u5916\u7684\u6A21\u5F0F\u7ED3\u5C3E\u3002
++parser.factor.5=\u5728\u6761\u4EF6\u6A21\u5F0F\u4E2D\u5E94\u4E3A\u5411\u540E\u5F15\u7528\u6216\u951A\u5B9A\u70B9\u6216\u5411\u524D\u67E5\u627E\u6216\u5411\u540E\u67E5\u627E\u3002
++parser.factor.6=\u6761\u4EF6\u7EC4\u4E2D\u7684\u9009\u9879\u591A\u4E8E\u4E09\u4E2A\u3002
++parser.atom.1=\\c \u540E\u9762\u5FC5\u987B\u8DDF\u6709 U+0040-U+005f \u4E2D\u7684\u5B57\u7B26\u3002
++parser.atom.2=\u5B57\u7B26\u7C7B\u522B\u524D\u5FC5\u987B\u6709 '{'\u3002
++parser.atom.3=\u5C5E\u6027\u540D\u672A\u4EE5 '}' \u7ED3\u675F\u3002
++parser.atom.4=\u610F\u5916\u7684\u5143\u5B57\u7B26\u3002
++parser.atom.5=\u672A\u77E5\u5C5E\u6027\u3002
++parser.cc.1=POSIX \u5B57\u7B26\u7C7B\u5FC5\u987B\u4EE5 ':]' \u7ED3\u675F\u3002
++parser.cc.2=\u5B57\u7B26\u7C7B\u4E2D\u610F\u5916\u7684\u6A21\u5F0F\u7ED3\u5C3E\u3002
++parser.cc.3=POSIX \u5B57\u7B26\u7C7B\u7684\u540D\u79F0\u672A\u77E5\u3002
++parser.cc.4=\u6B64\u5904 '-' \u662F\u65E0\u6548\u7684\u3002
++parser.cc.5=\u5E94\u4E3A ']'\u3002
++parser.cc.6='[' \u5728\u5B57\u7B26\u7C7B\u4E2D\u662F\u65E0\u6548\u7684\u3002\u5199\u5165 '\\['\u3002
++parser.cc.7=']' \u5728\u5B57\u7B26\u7C7B\u4E2D\u662F\u65E0\u6548\u7684\u3002\u5199\u5165 '\\]'\u3002
++parser.cc.8='-' \u662F\u65E0\u6548\u7684\u5B57\u7B26\u8303\u56F4\u3002\u5199\u5165 '\\-'\u3002
++parser.ope.1=\u5E94\u4E3A '['\u3002
++parser.ope.2=\u5E94\u4E3A ')' \u6216 '-[' \u6216 '+[' \u6216 '&['\u3002
++parser.ope.3=\u8303\u56F4\u7ED3\u675F\u4EE3\u7801\u70B9\u5C0F\u4E8E\u5F00\u59CB\u4EE3\u7801\u70B9\u3002
++parser.descape.1=Unicode \u5341\u516D\u8FDB\u5236\u8BB0\u53F7\u65E0\u6548\u3002
++parser.descape.2=\u5341\u516D\u8FDB\u5236\u8BB0\u53F7\u6EA2\u51FA\u3002
++parser.descape.3='\\x{' \u5FC5\u987B\u4EE5 '}' \u7ED3\u675F\u3002
++parser.descape.4=Unicode \u4EE3\u7801\u70B9\u65E0\u6548\u3002
++parser.descape.5=\u6B64\u5904\u4E0D\u80FD\u6709\u951A\u5B9A\u70B9\u3002
++parser.process.1=\u5F53\u524D\u7684\u9009\u9879\u8BBE\u7F6E\u4E0D\u652F\u6301\u6B64\u8868\u8FBE\u5F0F\u3002
++parser.quantifier.1=\u9650\u5B9A\u7B26\u65E0\u6548\u3002\u5E94\u4E3A\u6570\u5B57\u3002
++parser.quantifier.2=\u9650\u5B9A\u7B26\u65E0\u6548\u3002\u7F3A\u5C11\u6709\u6548\u7684\u6570\u91CF\u6216 '}'\u3002
++parser.quantifier.3=\u9650\u5B9A\u7B26\u65E0\u6548\u3002\u5E94\u4E3A\u6570\u5B57\u6216 '}'\u3002
++parser.quantifier.4=\u9650\u5B9A\u7B26\u65E0\u6548\u3002\u6700\u5C0F\u6570\u91CF\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E\u6700\u5927\u6570\u91CF\u3002
++parser.quantifier.5=\u9650\u5B9A\u7B26\u65E0\u6548\u3002\u6570\u91CF\u503C\u6EA2\u51FA\u3002
++null
++null
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_TW.properties Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,41 @@
++parser.parse.1=\u4E0D\u6B63\u78BA\u7684\u5B57\u5143.
++parser.parse.2=\u7121\u6548\u7684\u53C3\u7167\u865F\u78BC.
++parser.next.1=\\ \u4E4B\u5F8C\u5FC5\u9808\u8981\u6709\u4E00\u500B\u5B57\u5143.
++parser.next.2=\u4E0D\u61C9\u70BA '?'. '(?:' \u6216 '(?=' \u6216 '(?!' \u6216 '(?<' \u6216 '(?#' \u6216 '(?>'?
++parser.next.3=\u9810\u671F\u61C9\u70BA '(?<=' \u6216 '(?<!'.
++parser.next.4=\u8A3B\u89E3\u672A\u7D42\u6B62.
++parser.factor.1=\u9810\u671F\u61C9\u6709 ')'.
++parser.factor.2=\u4FEE\u98FE\u689D\u4EF6\u7FA4\u7D44\u4E2D\u6709\u672A\u9810\u671F\u7684\u6A23\u5F0F\u7D50\u5C3E.
++parser.factor.3=\u9810\u671F\u61C9\u6709 ':'.
++parser.factor.4=\u689D\u4EF6\u6027\u7FA4\u7D44\u4E2D\u6709\u672A\u9810\u671F\u7684\u6A23\u5F0F\u7D50\u5C3E.
++parser.factor.5=\u689D\u4EF6\u6027\u6A23\u5F0F\u4E2D\u61C9\u8A72\u6709\u5F80\u56DE\u53C3\u7167\u3001\u5B9A\u9328\u9EDE\u3001\u5411\u524D\u67E5\u627E\u6216\u5411\u5F8C\u67E5\u627E.
++parser.factor.6=\u689D\u4EF6\u6027\u7FA4\u7D44\u4E2D\u6709\u4E09\u500B\u4EE5\u4E0A\u7684\u9078\u9805.
++parser.atom.1=U+0040-U+005f \u5B57\u5143\u5FC5\u9808\u63A5\u8457 \\c.
++parser.atom.2=\u5B57\u5143\u985E\u5225\u524D\u9762\u5FC5\u9808\u8981\u6709\u4E00\u500B '{'.
++parser.atom.3=\u7279\u6027\u540D\u7A31\u672A\u4EE5 '}' \u7D50\u675F.
++parser.atom.4=\u672A\u9810\u671F\u7684\u63CF\u8FF0\u5B57\u5143.
++parser.atom.5=\u4E0D\u660E\u7684\u7279\u6027.
++parser.cc.1=POSIX \u5B57\u5143\u985E\u5225\u5FC5\u9808\u4EE5 ':]' \u4F5C\u70BA\u7D50\u675F.
++parser.cc.2=\u5B57\u5143\u985E\u5225\u4E2D\u6709\u672A\u9810\u671F\u7684\u6A23\u5F0F\u7D50\u5C3E.
++parser.cc.3=\u4E0D\u660E\u7684 POSIX \u5B57\u5143\u985E\u5225\u540D\u7A31.
++parser.cc.4='-' \u5728\u6B64\u8655\u7121\u6548.
++parser.cc.5=\u9810\u671F\u61C9\u6709 ']'.
++parser.cc.6='[' \u5728\u5B57\u5143\u985E\u5225\u4E2D\u7121\u6548. \u5BEB\u5165 '\\['.
++parser.cc.7=']' \u5728\u5B57\u5143\u985E\u5225\u4E2D\u7121\u6548. \u5BEB\u5165 '\\]'.
++parser.cc.8='-' \u70BA\u7121\u6548\u7684\u5B57\u5143\u7BC4\u570D. \u5BEB\u5165 '\\-'.
++parser.ope.1=\u9810\u671F\u61C9\u6709 '['.
++parser.ope.2=\u9810\u671F\u61C9\u6709 ')'\u3001'-['\u3001'+[' \u6216 '&['.
++parser.ope.3=\u7BC4\u570D\u7D50\u675F\u5B57\u78BC\u6307\u6A19\u5C0F\u65BC\u958B\u59CB\u5B57\u78BC\u6307\u6A19.
++parser.descape.1=\u7121\u6548\u7684 Unicode \u5341\u516D\u9032\u4F4D\u8868\u793A\u6CD5.
++parser.descape.2=\u5341\u516D\u9032\u4F4D\u8868\u793A\u6CD5\u6EA2\u4F4D.
++parser.descape.3='\\x{' \u5FC5\u9808\u4EE5 '}' \u4F5C\u70BA\u7D50\u675F.
++parser.descape.4=\u7121\u6548\u7684 Unicode \u5B57\u78BC\u6307\u6A19.
++parser.descape.5=\u6B64\u8655\u4E0D\u53EF\u6709\u5B9A\u9328\u9EDE.
++parser.process.1=\u76EE\u524D\u7684\u9078\u9805\u8A2D\u5B9A\u4E0D\u652F\u63F4\u6B64\u8868\u793A\u5F0F
++parser.quantifier.1=\u7121\u6548\u7684\u6578\u91CF\u8A5E. \u9810\u671F\u61C9\u70BA\u6578\u5B57.
++parser.quantifier.2=\u7121\u6548\u7684\u6578\u91CF\u8A5E. \u7121\u6548\u7684\u6578\u91CF\u6216\u907A\u6F0F '}'.
++parser.quantifier.3=\u7121\u6548\u7684\u6578\u91CF\u8A5E. \u9810\u671F\u61C9\u70BA\u6578\u5B57\u6216 '}'.
++parser.quantifier.4=\u7121\u6548\u7684\u6578\u91CF\u8A5E. \u6700\u5C0F\u6578\u91CF\u5FC5\u9808\u5C0F\u65BC\u6216\u7B49\u65BC\u6700\u5927\u6578\u91CF.
++parser.quantifier.5=\u7121\u6548\u7684\u6578\u91CF\u8A5E. \u6578\u91CF\u503C\u6EA2\u4F4D.
++null
++null
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_de.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_de.java,v 1.2.4.1 2005/09/15 07:45:39 suresh_emailid Exp $
++ * $Id: XMLErrorResources_de.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_es.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_es.java,v 1.2.4.1 2005/09/15 07:45:41 suresh_emailid Exp $
++ * $Id: XMLErrorResources_es.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_fr.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_fr.java,v 1.2.4.1 2005/09/15 07:45:41 suresh_emailid Exp $
++ * $Id: XMLErrorResources_fr.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_it.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_it.java,v 1.2.4.1 2005/09/15 07:45:42 suresh_emailid Exp $
++ * $Id: XMLErrorResources_it.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ja.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_ja.java,v 1.2.4.1 2005/09/15 07:45:42 suresh_emailid Exp $
++ * $Id: XMLErrorResources_ja.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -230,7 +230,7 @@
+ "\u4E0D\u660E\u306A\u8EF8\u30C8\u30E9\u30D0\u30FC\u30B9\u30FB\u30BF\u30A4\u30D7\u3067\u3059: {0}"},
+
+ { ER_AXIS_NOT_SUPPORTED,
+- "\u8EF8traverser\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {0}"},
++ "\u8EF8\u30C8\u30E9\u30D0\u30FC\u30B5\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {0}"},
+
+ { ER_NO_DTMIDS_AVAIL,
+ "DTM ID\u306F\u3053\u308C\u4EE5\u4E0A\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},
+@@ -269,13 +269,13 @@
+ "\u30B9\u30AD\u30FC\u30E0\u304CURI\u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},
+
+ { ER_PATH_INVALID_CHAR,
+- "\u30D1\u30B9\u306B\u7121\u52B9\u6587\u5B57{0}\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059"},
++ "\u30D1\u30B9\u306B\u7121\u52B9\u306A\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: {0}"},
+
+ { ER_SCHEME_FROM_NULL_STRING,
+ "null\u6587\u5B57\u5217\u304B\u3089\u306F\u30B9\u30AD\u30FC\u30E0\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093"},
+
+ { ER_SCHEME_NOT_CONFORMANT,
+- "\u30B9\u30AD\u30FC\u30E0\u306F\u4E00\u81F4\u3057\u3066\u3044\u307E\u305B\u3093\u3002"},
++ "\u30B9\u30AD\u30FC\u30E0\u304C\u6574\u5408\u3057\u3066\u3044\u307E\u305B\u3093\u3002"},
+
+ { ER_HOST_ADDRESS_NOT_WELLFORMED,
+ "\u30DB\u30B9\u30C8\u306F\u6574\u5F62\u5F0F\u306E\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
+@@ -329,7 +329,7 @@
+ "XMLReader\u306FstartParse\u30EA\u30AF\u30A8\u30B9\u30C8\u3088\u308A\u524D\u306B\u3067\u304D\u307E\u305B\u3093"},
+
+ { ER_AXIS_TRAVERSER_NOT_SUPPORTED,
+- "\u8EF8traverser\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {0}"},
++ "\u8EF8\u30C8\u30E9\u30D0\u30FC\u30B5\u6A5F\u80FD\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093: {0}"},
+
+ { ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER,
+ "null PrintWriter\u306B\u3088\u3063\u3066ListingErrorHandler\u304C\u4F5C\u6210\u3055\u308C\u307E\u3057\u305F\u3002"},
+@@ -397,7 +397,7 @@
+ "\u7121\u52B9\u306AUTF-16\u30B5\u30ED\u30B2\u30FC\u30C8\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F: {0}\u3002" },
+
+ {ER_OIERROR,
+- "\u5165\u51FA\u529B\u30A8\u30E9\u30FC" },
++ "IO\u30A8\u30E9\u30FC" },
+
+ {ER_ILLEGAL_ATTRIBUTE_POSITION,
+ "\u5B50\u30CE\u30FC\u30C9\u306E\u5F8C\u307E\u305F\u306F\u8981\u7D20\u304C\u751F\u6210\u3055\u308C\u308B\u524D\u306B\u5C5E\u6027{0}\u3092\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002\u5C5E\u6027\u306F\u7121\u8996\u3055\u308C\u307E\u3059\u3002"},
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_ko.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_ko.java,v 1.2.4.1 2005/09/15 07:45:42 suresh_emailid Exp $
++ * $Id: XMLErrorResources_ko.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -9,7 +9,7 @@
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+- * http://www.apache.org/licenses/LICENSE-2.0
++ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+@@ -17,9 +17,8 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-
+ /*
+- * $Id: XMLErrorResources_pt_BR.java 3023 2011-03-01 00:53:34Z joehw $
++ * $Id: XMLErrorResources_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -180,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- public static final Object[][] contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -192,7 +191,7 @@
+ "N\u00E3o \u00E9 poss\u00EDvel substituir a causa"},
+
+ { ER_NO_DEFAULT_IMPL,
+- "Nenhuma implementa\u00E7\u00E3o default encontrada "},
++ "Nenhuma implementa\u00E7\u00E3o padr\u00E3o encontrada "},
+
+ { ER_CHUNKEDINTARRAY_NOT_SUPPORTED,
+ "ChunkedIntArray({0}) n\u00E3o suportado atualmente"},
+@@ -216,7 +215,7 @@
+ "\nINESPERADO: Parser doTerminate responde {0}"},
+
+ { ER_NO_PARSE_CALL_WHILE_PARSING,
+- "o parse n\u00E3o pode ser chamado durante o parse"},
++ "o parsing n\u00E3o pode ser chamado durante o parsing"},
+
+ { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED,
+ "Erro: iterador digitado para o eixo {0} n\u00E3o implementado"},
+@@ -246,7 +245,7 @@
+ "N\u00E3o foi poss\u00EDvel resolver o n\u00F3 para um handle"},
+
+ { ER_STARTPARSE_WHILE_PARSING,
+- "startParse n\u00E3o pode ser chamado durante o parse"},
++ "startParse n\u00E3o pode ser chamado durante o parsing"},
+
+ { ER_STARTPARSE_NEEDS_SAXPARSER,
+ "startParse requer um SAXParser n\u00E3o nulo"},
+@@ -261,7 +260,7 @@
+ "O caminho cont\u00E9m uma sequ\u00EAncia inv\u00E1lida de caracteres de escape"},
+
+ { ER_SCHEME_REQUIRED,
+- "\u00C9 necess\u00E1rio um esquema!"},
++ "O esquema \u00E9 obrigat\u00F3rio!"},
+
+ { ER_NO_SCHEME_IN_URI,
+ "Nenhum esquema encontrado no URI: {0}"},
+@@ -300,7 +299,7 @@
+ "O parser j\u00E1 est\u00E1 sendo usado"},
+
+ { ER_CANNOT_CHANGE_WHILE_PARSING,
+- "N\u00E3o \u00E9 poss\u00EDvel alterar {0} {1} durante o parse"},
++ "N\u00E3o \u00E9 poss\u00EDvel alterar {0} {1} durante o parsing"},
+
+ { ER_SELF_CAUSATION_NOT_PERMITTED,
+ "Autoaverigua\u00E7\u00E3o n\u00E3o permitida"},
+@@ -430,7 +429,7 @@
+ "Declara\u00E7\u00E3o de namespace ''{0}''=''{1}'' fora do elemento." },
+
+ {ER_COULD_NOT_LOAD_RESOURCE,
+- "N\u00E3o foi poss\u00EDvel carregar ''{0}'' (verificar CLASSPATH); usando agora apenas os defaults"},
++ "N\u00E3o foi poss\u00EDvel carregar ''{0}'' (verificar CLASSPATH); usando agora apenas os padr\u00F5es"},
+
+ { ER_ILLEGAL_CHARACTER,
+ "Tentativa de exibir um caractere de valor integral {0} que n\u00E3o est\u00E1 representado na codifica\u00E7\u00E3o de sa\u00EDda especificada de {1}."},
+@@ -440,16 +439,7 @@
+
+
+ };
+- private static final Object[][] msgCopy = new Object[contents.length][2];
+- // return a copy of contents; in theory we want a deep clone
+- // of contents, but since it only contains (immutable) Strings,
+- // this shallow copy is sufficient
+- static {
+- for (int i = 0; i < contents.length; i++) {
+- msgCopy[i][0] = contents[i][0];
+- msgCopy[i][1] = contents[i][1];
+- }
+- }
++
+ /**
+ * Get the association list.
+ *
+@@ -457,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return msgCopy;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_sv.java,v 1.2.4.1 2005/09/15 07:45:46 suresh_emailid Exp $
++ * $Id: XMLErrorResources_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,6 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
++
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_zh_CN.java,v 1.2.4.1 2005/09/15 07:45:47 suresh_emailid Exp $
++ * $Id: XMLErrorResources_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -212,10 +212,10 @@
+ "Coroutine \u53C2\u6570\u9519\u8BEF ({0})"},
+
+ { ER_PARSER_DOTERMINATE_ANSWERS,
+- "\n\u610F\u5916: \u8BED\u6CD5\u5206\u6790\u5668\u5BF9\u7B54\u590D{0}\u6267\u884C doTerminate"},
++ "\n\u610F\u5916: \u89E3\u6790\u5668\u5BF9\u7B54\u590D{0}\u6267\u884C doTerminate"},
+
+ { ER_NO_PARSE_CALL_WHILE_PARSING,
+- "\u65E0\u6CD5\u5728\u6267\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u8C03\u7528 parse"},
++ "\u65E0\u6CD5\u5728\u89E3\u6790\u65F6\u8C03\u7528 parse"},
+
+ { ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED,
+ "\u9519\u8BEF: \u672A\u5B9E\u73B0\u8F74{0}\u7684\u7C7B\u578B\u5316\u8FED\u4EE3\u5668"},
+@@ -245,13 +245,13 @@
+ "\u65E0\u6CD5\u5C06\u8282\u70B9\u89E3\u6790\u4E3A\u53E5\u67C4"},
+
+ { ER_STARTPARSE_WHILE_PARSING,
+- "\u65E0\u6CD5\u5728\u6267\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u8C03\u7528 startParse"},
++ "\u65E0\u6CD5\u5728\u89E3\u6790\u65F6\u8C03\u7528 startParse"},
+
+ { ER_STARTPARSE_NEEDS_SAXPARSER,
+ "startParse \u9700\u8981\u975E\u7A7A SAXParser"},
+
+ { ER_COULD_NOT_INIT_PARSER,
+- "\u65E0\u6CD5\u4F7F\u7528\u4EE5\u4E0B\u5BF9\u8C61\u521D\u59CB\u5316\u8BED\u6CD5\u5206\u6790\u5668"},
++ "\u65E0\u6CD5\u4F7F\u7528\u4EE5\u4E0B\u5BF9\u8C61\u521D\u59CB\u5316\u89E3\u6790\u5668"},
+
+ { ER_EXCEPTION_CREATING_POOL,
+ "\u4E3A\u6C60\u521B\u5EFA\u65B0\u5B9E\u4F8B\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF"},
+@@ -269,7 +269,7 @@
+ "\u5728 URI \u4E2D\u627E\u4E0D\u5230\u65B9\u6848"},
+
+ { ER_PATH_INVALID_CHAR,
+- "\u8DEF\u5F84\u5305\u542B\u65E0\u6548\u5B57\u7B26: {0}"},
++ "\u8DEF\u5F84\u5305\u542B\u65E0\u6548\u7684\u5B57\u7B26: {0}"},
+
+ { ER_SCHEME_FROM_NULL_STRING,
+ "\u65E0\u6CD5\u4ECE\u7A7A\u5B57\u7B26\u4E32\u8BBE\u7F6E\u65B9\u6848"},
+@@ -296,10 +296,10 @@
+ "\u7247\u6BB5\u5305\u542B\u65E0\u6548\u7684\u5B57\u7B26"},
+
+ { ER_PARSER_IN_USE,
+- "\u8BED\u6CD5\u5206\u6790\u5668\u5DF2\u5728\u4F7F\u7528"},
++ "\u89E3\u6790\u5668\u5DF2\u5728\u4F7F\u7528"},
+
+ { ER_CANNOT_CHANGE_WHILE_PARSING,
+- "\u65E0\u6CD5\u5728\u8FDB\u884C\u8BED\u6CD5\u5206\u6790\u65F6\u66F4\u6539{0} {1}"},
++ "\u65E0\u6CD5\u5728\u89E3\u6790\u65F6\u66F4\u6539{0} {1}"},
+
+ { ER_SELF_CAUSATION_NOT_PERMITTED,
+ "\u4E0D\u5141\u8BB8\u4F7F\u7528\u81EA\u56E0"},
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/res/XMLErrorResources_zh_TW.java Fri Apr 10 09:20:34 2015 -0700
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XMLErrorResources_zh_TW.java,v 1.2.4.1 2005/09/15 07:45:48 suresh_emailid Exp $
++ * $Id: XMLErrorResources_zh_TW.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+ */
+ package com.sun.org.apache.xml.internal.res;
+
+@@ -179,7 +179,7 @@
+ // Error messages...
+
+ /** The lookup table for error messages. */
+- private static final Object[][] _contents = {
++ private static final Object[][] contents = {
+
+ /** Error message ID that has a null message, but takes in a single object. */
+ {"ER0000" , "{0}" },
+@@ -447,7 +447,7 @@
+ */
+
+ protected Object[][] getContents() {
+- return _contents;
++ return contents;
+ }
+
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_de.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_de.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_de.java,v 1.1.4.1 2005/09/08 11:03:12 suresh_emailid Exp $
++ * $Id: SerializerMessages_de.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_de extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "Die Parallel-Seriell-Umsetzerklasse ''{0}'' implementiert org.xml.sax.ContentHandler nicht."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "Die Ressource [ {0} ] konnte nicht gefunden werden.\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "Die Ressource [ {0} ] konnte nicht geladen werden: {1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "Puffergr\u00f6\u00dfe <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "Ung\u00fcltige UTF-16-Ersetzung festgestellt: {0} ?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "Der Nachrichtenschl\u00FCssel \"{0}\" ist nicht in der Nachrichtenklasse \"{1}\" enthalten" },
+
+- { MsgKey.ER_OIERROR,
+- "E/A-Fehler"},
++ { MsgKey.BAD_MSGFORMAT,
++ "Das Format der Nachricht \"{0}\" in der Nachrichtenklasse \"{1}\" war nicht erfolgreich." },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "Attribut {0} kann nicht nach Kindknoten oder vor dem Erstellen eines Elements hinzugef\u00fcgt werden. Das Attribut wird ignoriert."},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "Serializer-Klasse \"{0}\" implementiert org.xml.sax.ContentHandler nicht." },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "Der Namensbereich f\u00fcr Pr\u00e4fix ''{0}'' wurde nicht deklariert."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "Ressource [ {0} ] konnte nicht gefunden werden.\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "Namensbereichsdeklaration ''{0}''=''{1}'' befindet sich nicht in einem Element."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "Ressource [ {0} ] konnte nicht geladen werden: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "''{0}'' konnte nicht geladen werden (CLASSPATH pr\u00fcfen); es werden die Standardwerte verwendet"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Puffergr\u00F6\u00DFe <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "Merkmaldatei ''{0}'' konnte f\u00fcr Ausgabemethode ''{1}'' nicht geladen werden (CLASSPATH pr\u00fcfen)"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "Ung\u00FCltige UTF-16-Ersetzung festgestellt: {0}?" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "Ung\u00fcltige Portnummer"},
++ { MsgKey.ER_OIERROR,
++ "I/O-Fehler" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "Der Port kann nicht festgelegt werden, wenn der Host gleich Null ist."},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "Attribut {0} kann nicht nach untergeordneten Knoten oder vor dem Erstellen eines Elements hinzugef\u00FCgt werden. Attribut wird ignoriert." },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "Der Host ist keine syntaktisch korrekte Adresse."},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "Namespace f\u00FCr Pr\u00E4fix \"{0}\" wurde nicht deklariert." },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "Das Schema ist nicht angepasst."},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "Attribut \"{0}\" au\u00DFerhalb des Elements." },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "Schema kann nicht von Nullzeichenfolge festgelegt werden."},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "Namespace-Deklaration {0}={1} au\u00DFerhalb des Elements." },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "Der Pfad enth\u00e4lt eine ung\u00fcltige Escapezeichenfolge."},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "\"{0}\" konnte nicht geladen werden (CLASSPATH pr\u00FCfen). Die Standardwerte werden verwendet" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "Pfad enth\u00e4lt ung\u00fcltiges Zeichen: {0}."},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "Versuch, Zeichen mit Integralwert {0} auszugeben, das nicht in der speziellen Ausgabecodierung von {1} dargestellt wird." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "Fragment enth\u00e4lt ein ung\u00fcltiges Zeichen."},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "Property-Datei \"{0}\" konnte f\u00FCr Ausgabemethode \"{1}\" nicht geladen werden (CLASSPATH pr\u00FCfen)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "Fragment kann nicht festgelegt werden, wenn der Pfad gleich Null ist."},
++ { MsgKey.ER_INVALID_PORT,
++ "Ung\u00FCltige Portnummer" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "Fragment kann nur f\u00fcr eine generische URI (Uniform Resource Identifier) festgelegt werden."},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "Port kann nicht festgelegt werden, wenn der Host null ist" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "Kein Schema gefunden in URI: {0}."},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "Host ist keine wohlgeformte Adresse" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "URI (Uniform Resource Identifier) kann nicht mit leeren Parametern initialisiert werden."},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "Schema ist nicht konform." },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "Fragment kann nicht im Pfad und im Fragment angegeben werden."},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "Schema kann nicht von Nullzeichenfolge festgelegt werden" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "Abfragezeichenfolge kann nicht im Pfad und in der Abfragezeichenfolge angegeben werden."},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "Pfad enth\u00E4lt eine ung\u00FCltige Escapesequenz" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "Der Port kann nicht angegeben werden, wenn der Host nicht angegeben wurde."},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "Pfad enth\u00E4lt ung\u00FCltiges Zeichen: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "Benutzerinformationen k\u00f6nnen nicht angegeben werden, wenn der Host nicht angegeben wurde."},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "Fragment enth\u00E4lt ein ung\u00FCltiges Zeichen" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "Schema ist erforderlich!"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "Fragment kann nicht festgelegt werden, wenn der Pfad null ist" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "Fragment kann nur f\u00FCr einen generischen URI festgelegt werden" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "Kein Schema gefunden in URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "URI kann nicht mit leeren Parametern initialisiert werden" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "Fragment kann nicht im Pfad und im Fragment angegeben werden" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "Abfragezeichenfolge kann nicht im Pfad und in der Abfragezeichenfolge angegeben werden" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "Port kann nicht angegeben werden, wenn der Host nicht angegeben wurde" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "Benutzerinformationen k\u00F6nnen nicht angegeben werden, wenn der Host nicht angegeben wurde" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Warnung: Die Version des Ausgabedokuments soll \"{0}\" sein. Diese Version von XML wird nicht unterst\u00FCtzt. Die Version des Ausgabedokuments wird \"1.0\" sein." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "Schema ist erforderlich." },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "Das an die SerializerFactory \u00FCbergebene Properties-Objekt verf\u00FCgt \u00FCber keine Eigenschaft \"{0}\"." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Warnung: Die Codierung \"{0}\" wird nicht von der Java-Laufzeit unterst\u00FCtzt." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_es.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_es.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_es.java,v 1.1.4.1 2005/09/08 11:03:13 suresh_emailid Exp $
++ * $Id: SerializerMessages_es.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_es extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "La clase serializer ''{0}'' no implementa org.xml.sax.ContentHandler."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "No se ha podido cargar el recurso [ {0} ].\n{1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "No se ha podido cargar el recurso [ {0} ]: {1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "Tama\u00f1o de almacenamiento intermedio <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "\u00bfSe ha detectado un sustituto UTF-16 no v\u00e1lido: {0}?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "La clave de mensaje ''{0}'' no est\u00E1 en la clase de mensaje ''{1}''" },
+
+- { MsgKey.ER_OIERROR,
+- "Error de ES"},
++ { MsgKey.BAD_MSGFORMAT,
++ "Fallo de formato del mensaje ''{0}'' en la clase de mensaje ''{1}''." },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "No se puede a\u00f1adir el atributo {0} despu\u00e9s de nodos hijo o antes de que se produzca un elemento. Se ignorar\u00e1 el atributo."},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "La clase de serializador ''{0}'' no implanta org.xml.sax.ContentHandler." },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "No se ha declarado el espacio de nombres para el prefijo ''{0}''."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "No se ha encontrado el recurso [ {0} ].\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "Declaraci\u00f3n del espacio de nombres ''{0}''=''{1}'' fuera del elemento."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "No se ha podido cargar el recurso [ {0} ]: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "No se ha podido cargar ''{0}'' (compruebe la CLASSPATH), ahora s\u00f3lo se est\u00e1n utilizando los valores por omisi\u00f3n"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Tama\u00F1o de buffer menor o igual que 0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "No se ha podido cargar el archivo de propiedades ''{0}'' para el m\u00e9todo de salida ''{1}'' (compruebe la CLASSPATH)"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "\u00BFSe ha detectado un sustituto UTF-16 no v\u00E1lido: {0}?" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "N\u00famero de puerto no v\u00e1lido"},
++ { MsgKey.ER_OIERROR,
++ "Error de E/S" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "No se puede establecer el puerto si el sistema principal es nulo"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "No se puede agregar el atributo {0} despu\u00E9s de nodos secundarios o antes de que se produzca un elemento. Se ignorar\u00E1 el atributo." },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "El sistema principal no es una direcci\u00f3n bien formada"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "No se ha declarado el espacio de nombres para el prefijo ''{0}''." },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "El esquema no es compatible."},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "El atributo ''{0}'' est\u00E1 fuera del elemento." },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "No se puede establecer un esquema de una serie nula"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "Declaraci\u00F3n del espacio de nombres ''{0}''=''{1}'' fuera del elemento." },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "La v\u00eda de acceso contiene una secuencia de escape no v\u00e1lida"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "No se ha podido cargar ''{0}'' (compruebe la CLASSPATH), ahora s\u00F3lo se est\u00E1n utilizando los valores por defecto" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "La v\u00eda de acceso contiene un car\u00e1cter no v\u00e1lido: {0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "Intento de realizar la salida del car\u00E1cter del valor integral {0}, que no est\u00E1 representado en la codificaci\u00F3n de salida de {1}." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "El fragmento contiene un car\u00e1cter no v\u00e1lido"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "No se ha podido cargar el archivo de propiedades ''{0}'' para el m\u00E9todo de salida ''{1}'' (compruebe la CLASSPATH)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "No se puede establecer el fragmento si la v\u00eda de acceso es nula"},
++ { MsgKey.ER_INVALID_PORT,
++ "N\u00FAmero de puerto no v\u00E1lido" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "S\u00f3lo se puede establecer el fragmento para un URI gen\u00e9rico"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "No se puede definir el puerto si el host es nulo" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "No se ha encontrado un esquema en el URI: {0}"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "El formato de la direcci\u00F3n de host no es correcto" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "No se puede inicializar el URI con par\u00e1metros vac\u00edos"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "El esquema no es v\u00E1lido." },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "No se puede especificar el fragmento en la v\u00eda de acceso y en el fragmento"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "No se puede definir un esquema a partir de una cadena nula" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "No se puede especificar la serie de consulta en la v\u00eda de acceso y en la serie de consulta"},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "La ruta de acceso contiene una secuencia de escape no v\u00E1lida" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "No se puede especificar el puerto si no se ha especificado el sistema principal"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "La ruta de acceso contiene un car\u00E1cter no v\u00E1lido: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "No se puede especificar la informaci\u00f3n de usuario si no se ha especificado el sistema principal"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "El fragmento contiene un car\u00E1cter no v\u00E1lido" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "\u00a1Se necesita un esquema!"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "No se puede definir el fragmento si la ruta de acceso es nula" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "S\u00F3lo se puede definir el fragmento para un URI gen\u00E9rico" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "No se ha encontrado un esquema en el URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "No se puede inicializar el URI con par\u00E1metros vac\u00EDos" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "No se puede especificar el fragmento en la ruta de acceso y en el fragmento" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "No se puede especificar la cadena de consulta en la ruta de acceso y en la cadena de consulta" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "No se puede especificar el puerto si no se ha especificado el host" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "No se puede especificar la informaci\u00F3n de usuario si no se ha especificado el host" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Advertencia: es necesario que la versi\u00F3n del documento de salida sea ''{0}''. Esta versi\u00F3n de XML no est\u00E1 soportada. La versi\u00F3n del documento de salida ser\u00E1 ''1.0''." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "Se necesita un esquema." },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "El objeto de propiedades transferido a SerializerFactory no tiene una propiedad ''{0}''." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Advertencia: el tiempo de ejecuci\u00F3n de Java no soporta la codificaci\u00F3n ''{0}''." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_fr.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_fr.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_fr.java,v 1.1.4.1 2005/09/08 11:03:13 suresh_emailid Exp $
++ * $Id: SerializerMessages_fr.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_fr extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "La classe de la m\u00e9thode de s\u00e9rialisation ''{0}'' n''impl\u00e9mente pas org.xml.sax.ContentHandler."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "La ressource [ {0} ] est introuvable.\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "La ressource [ {0} ] n''a pas pu charger : {1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "Taille du tampon <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "Substitut UTF-16 non valide d\u00e9tect\u00e9 : {0} ?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "La cl\u00E9 de message ''{0}'' ne figure pas dans la classe de messages ''{1}''" },
+
+- { MsgKey.ER_OIERROR,
+- "Erreur d''E-S"},
++ { MsgKey.BAD_MSGFORMAT,
++ "Echec du format de message ''{0}'' dans la classe de messages ''{1}''." },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "Ajout impossible de l''attribut {0} apr\u00e8s des noeuds enfants ou avant la production d''un \u00e9l\u00e9ment. L''attribut est ignor\u00e9."},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "La classe de serializer ''{0}'' n''impl\u00E9mente pas org.xml.sax.ContentHandler." },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "L''espace de noms du pr\u00e9fixe ''{0}'' n''a pas \u00e9t\u00e9 d\u00e9clar\u00e9."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "La ressource [ {0} ] est introuvable.\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "La d\u00e9claration d''espace de noms ''{0}''=''{1}'' est \u00e0 l''ext\u00e9rieur de l''\u00e9l\u00e9ment."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "La ressource [ {0} ] n''a pas pu charger : {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "Impossible de charger ''{0}'' (v\u00e9rifier CLASSPATH), les valeurs par d\u00e9faut sont donc employ\u00e9es "},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Taille du tampon <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "Impossible de charger le fichier de propri\u00e9t\u00e9s ''{0}'' pour la m\u00e9thode de sortie ''{1}'' (v\u00e9rifier CLASSPATH)"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "Substitut UTF-16 non valide d\u00E9tect\u00E9 : {0} ?" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "Num\u00e9ro de port non valide"},
++ { MsgKey.ER_OIERROR,
++ "Erreur d'E/S" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "Le port ne peut \u00eatre d\u00e9fini quand l'h\u00f4te est vide"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "Impossible d''ajouter l''attribut {0} apr\u00E8s des noeuds enfant ou avant la production d''un \u00E9l\u00E9ment. L''attribut est ignor\u00E9." },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "L'h\u00f4te n'est pas une adresse bien form\u00e9e"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "L''espace de noms du pr\u00E9fixe ''{0}'' n''a pas \u00E9t\u00E9 d\u00E9clar\u00E9." },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "Le processus n'est pas conforme."},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "Attribut ''{0}'' en dehors de l''\u00E9l\u00E9ment." },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "Impossible de d\u00e9finir le processus \u00e0 partir de la cha\u00eene vide"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "La d\u00E9claration d''espace de noms ''{0}''=''{1}'' est \u00E0 l''ext\u00E9rieur de l''\u00E9l\u00E9ment." },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "Le chemin d'acc\u00e8s contient une s\u00e9quence d'\u00e9chappement non valide"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "Impossible de charger ''{0}'' (v\u00E9rifier CLASSPATH), les valeurs par d\u00E9faut sont donc employ\u00E9es" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "Le chemin contient un caract\u00e8re non valide : {0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "Tentative de sortie d''un caract\u00E8re avec une valeur enti\u00E8re {0}, non repr\u00E9sent\u00E9 dans l''encodage de sortie sp\u00E9cifi\u00E9 pour {1}." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "Le fragment contient un caract\u00e8re non valide"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "Impossible de charger le fichier de propri\u00E9t\u00E9s ''{0}'' pour la m\u00E9thode de sortie ''{1}'' (v\u00E9rifier CLASSPATH)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "Le fragment ne peut \u00eatre d\u00e9fini quand le chemin d'acc\u00e8s est vide"},
++ { MsgKey.ER_INVALID_PORT,
++ "Num\u00E9ro de port non valide" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "Le fragment ne peut \u00eatre d\u00e9fini que pour un URI g\u00e9n\u00e9rique"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "Impossible de d\u00E9finir le port quand l'h\u00F4te est NULL" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "Processus introuvable dans l''URI : {0}"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "Le format de l'adresse de l'h\u00F4te n'est pas correct" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "Impossible d'initialiser l'URI avec des param\u00e8tres vides"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "Le mod\u00E8le n'est pas conforme." },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "Le fragment ne doit pas \u00eatre indiqu\u00e9 \u00e0 la fois dans le chemin et dans le fragment"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "Impossible de d\u00E9finir le mod\u00E8le \u00E0 partir de la cha\u00EEne NULL" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "La cha\u00eene de requ\u00eate ne doit pas figurer dans un chemin et une cha\u00eene de requ\u00eate"},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "Le chemin d'acc\u00E8s contient une s\u00E9quence d'\u00E9chappement non valide" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "Le port peut ne pas \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te n'est pas sp\u00e9cifi\u00e9"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "Le chemin contient un caract\u00E8re non valide : {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "Userinfo ne peut \u00eatre sp\u00e9cifi\u00e9 si l'h\u00f4te ne l'est pas"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "Le fragment contient un caract\u00E8re non valide" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "Processus requis !"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "Impossible de d\u00E9finir le fragment quand le chemin d'acc\u00E8s est NULL" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "Le fragment ne peut \u00EAtre d\u00E9fini que pour un URI g\u00E9n\u00E9rique" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "Mod\u00E8le introuvable dans l'URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "Impossible d'initialiser l'URI avec des param\u00E8tres vides" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "Le fragment ne doit pas \u00EAtre indiqu\u00E9 \u00E0 la fois dans le chemin et dans le fragment" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "La cha\u00EEne de requ\u00EAte ne doit pas figurer dans un chemin et une cha\u00EEne de requ\u00EAte" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "Le port peut ne pas \u00EAtre sp\u00E9cifi\u00E9 si l'h\u00F4te ne l'est pas" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "Userinfo peut ne pas \u00EAtre sp\u00E9cifi\u00E9 si l'h\u00F4te ne l'est pas" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Avertissement : la version du document de sortie doit \u00EAtre ''{0}''. Cette version XML n''est pas prise en charge. La version du document de sortie sera ''1.0''." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "Mod\u00E8le obligatoire." },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "L''objet de propri\u00E9t\u00E9s transmis \u00E0 SerializerFactory ne comporte aucune propri\u00E9t\u00E9 ''{0}''." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Avertissement : l''encodage ''{0}'' n''est pas pris en charge par l''ex\u00E9cution Java." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_it.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_it.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_it.java,v 1.1.4.1 2005/09/08 11:03:15 suresh_emailid Exp $
++ * $Id: SerializerMessages_it.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:41:53 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_it extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "La classe serializer ''{0}'' non implementa org.xml.sax.ContentHandler."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "Risorsa [ {0} ] non trovata.\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "Dimensione buffer <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "Rilevato surrogato UTF-16 non valido: {0} ?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "La chiave di messaggio ''{0}'' non si trova nella classe messaggio ''{1}''" },
+
+- { MsgKey.ER_OIERROR,
+- "Errore IO"},
++ { MsgKey.BAD_MSGFORMAT,
++ "Formato di messaggio ''{0}'' in classe messaggio ''{1}'' non riuscito." },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "Impossibile aggiungere l''attributo {0} dopo i nodi secondari o prima che sia prodotto un elemento. L''attributo verr\u00e0 ignorato. "},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "La classe serializzatore ''{0}'' non implementa org.xml.sax.ContentHandler." },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "Lo spazio nomi per il prefisso ''{0}'' non \u00e8 stato dichiarato. "},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "Risorsa [ {0} ] non trovata.\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "Dichiarazione dello spazio nome ''{0}''=''{1}'' al di fuori dell''elemento. "},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "Impossibile caricare ''{0}'' (verificare CLASSPATH); verranno utilizzati i valori predefiniti "},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Dimensione buffer <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "Impossibile caricare il file delle propriet\u00e0 ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "Rilevato surrogato UTF-16 non valido: {0}?" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "Numero di porta non valido"},
++ { MsgKey.ER_OIERROR,
++ "Errore di I/O" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "La porta non pu\u00f2 essere impostata se l'host \u00e8 nullo"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "Impossibile aggiungere l''attributo {0} dopo i nodi figlio o prima che sia prodotto un elemento. L''attributo verr\u00E0 ignorato." },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "Host non \u00e8 un'indirizzo corretto"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "Lo spazio di nomi per il prefisso ''{0}'' non \u00E8 stato dichiarato." },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "Lo schema non \u00e8 conforme."},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "Attributo ''{0}'' al di fuori dell''elemento." },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "Impossibile impostare lo schema da una stringa nulla"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "Dichiarazione dello spazio di nomi ''{0}''=''{1}'' al di fuori dell''elemento." },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "Il percorso contiene sequenza di escape non valida"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "Impossibile caricare ''{0}'' (verificare CLASSPATH); verranno utilizzati i valori predefiniti" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "Il percorso contiene un carattere non valido: {0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "Tentativo di eseguire l''output di un carattere di valore integrale {0} non rappresentato nella codifica di output {1} specificata." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "Il frammento contiene un carattere non valido"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "Impossibile caricare il file delle propriet\u00E0 ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "Il frammento non pu\u00f2 essere impostato se il percorso \u00e8 nullo"},
++ { MsgKey.ER_INVALID_PORT,
++ "Numero di porta non valido" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "Il frammento pu\u00f2 essere impostato solo per un URI generico"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "La porta non pu\u00F2 essere impostata se l'host \u00E8 nullo" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "Nessuno schema trovato nell''URI: {0}"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "Host non \u00E8 un indirizzo corretto" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "Impossibile inizializzare l'URI con i parametri vuoti"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "Lo schema non \u00E8 conforme." },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "Il frammento non pu\u00f2 essere specificato sia nel percorso che nel frammento"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "Impossibile impostare lo schema da una stringa nulla" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "La stringa di interrogazione non pu\u00f2 essere specificata nella stringa di interrogazione e percorso."},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "Il percorso contiene sequenza di escape non valida" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "La porta non pu\u00f2 essere specificata se l'host non \u00e8 specificato"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "Il percorso contiene un carattere non valido: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "Userinfo non pu\u00f2 essere specificato se l'host non \u00e8 specificato"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "Il frammento contiene un carattere non valido" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "Lo schema \u00e8 obbligatorio."}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "Il frammento non pu\u00F2 essere impostato se il percorso \u00E8 nullo" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "Il frammento pu\u00F2 essere impostato solo per un URI generico" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "Nessuno schema trovato nell'URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "Impossibile inizializzare l'URI con i parametri vuoti" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "Il frammento non pu\u00F2 essere specificato sia nel percorso che nel frammento" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "La stringa di query non pu\u00F2 essere specificata nella stringa di percorso e query." },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "La porta non pu\u00F2 essere specificata se l'host non \u00E8 specificato" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "Userinfo non pu\u00F2 essere specificato se l'host non \u00E8 specificato" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Avvertenza: la versione del documento di output deve essere ''{0}''. Questa versione di XML non \u00E8 supportata. La versione del documento di output sar\u00E0 ''1.0''." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "Lo schema \u00E8 obbligatorio." },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "L''oggetto Properties passato a SerializerFactory non dispone di una propriet\u00E0 ''{0}''." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Avvertenza: la codifica ''{0}'' non \u00E8 supportata da Java Runtime." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_ja.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_ja.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_ja.java,v 1.1.4.1 2005/09/08 11:03:16 suresh_emailid Exp $
++ * $Id: SerializerMessages_ja.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_ja extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "\u30b7\u30ea\u30a2\u30e9\u30a4\u30b6\u30fc\u30fb\u30af\u30e9\u30b9 ''{0}'' \u306f org.xml.sax.ContentHandler \u3092\u30a4\u30f3\u30d7\u30ea\u30e1\u30f3\u30c8\u3057\u307e\u305b\u3093\u3002"},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "\u30ea\u30bd\u30fc\u30b9 [ {0} ] \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: {1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "\u30d0\u30c3\u30d5\u30a1\u30fc\u30fb\u30b5\u30a4\u30ba <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "\u7121\u52b9\u306a UTF-16 \u30b5\u30ed\u30b2\u30fc\u30c8\u304c\u691c\u51fa\u3055\u308c\u307e\u3057\u305f: {0} ?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AD\u30FC''{0}''\u306F\u3001\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AF\u30E9\u30B9''{1}''\u3067\u306F\u3042\u308A\u307E\u305B\u3093" },
+
+- { MsgKey.ER_OIERROR,
+- "\u5165\u51fa\u529b\u30a8\u30e9\u30fc"},
++ { MsgKey.BAD_MSGFORMAT,
++ "\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30AF\u30E9\u30B9''{1}''\u306E\u30E1\u30C3\u30BB\u30FC\u30B8''{0}''\u306E\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u304C\u5931\u6557\u3057\u307E\u3057\u305F\u3002" },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "\u4e0b\u4f4d\u30ce\u30fc\u30c9\u306e\u5f8c\u307e\u305f\u306f\u30a8\u30ec\u30e1\u30f3\u30c8\u304c\u751f\u6210\u3055\u308c\u308b\u524d\u306b\u5c5e\u6027 {0} \u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002\u5c5e\u6027\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002"},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "\u30B7\u30EA\u30A2\u30E9\u30A4\u30B6\u30FB\u30AF\u30E9\u30B9''{0}''\u306Forg.xml.sax.ContentHandler\u3092\u5B9F\u88C5\u3057\u307E\u305B\u3093\u3002" },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "\u63a5\u982d\u90e8 ''{0}'' \u306e\u30cd\u30fc\u30e0\u30fb\u30b9\u30da\u30fc\u30b9\u304c\u5ba3\u8a00\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "\u30EA\u30BD\u30FC\u30B9[ {0} ]\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F\u3002\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "\u30cd\u30fc\u30e0\u30fb\u30b9\u30da\u30fc\u30b9\u5ba3\u8a00 ''{0}''=''{1}'' \u304c\u30a8\u30ec\u30e1\u30f3\u30c8\u306e\u5916\u5074\u3067\u3059\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "\u30EA\u30BD\u30FC\u30B9[ {0} ]\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "''{0}'' \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f (CLASSPATH \u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044)\u3002\u73fe\u5728\u306f\u5358\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "\u30D0\u30C3\u30D5\u30A1\u30FB\u30B5\u30A4\u30BA<=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "\u51fa\u529b\u30e1\u30bd\u30c3\u30c9 ''{1}'' \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u30fc\u30fb\u30d5\u30a1\u30a4\u30eb ''{0}'' \u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f (CLASSPATH \u3092\u78ba\u8a8d)"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "\u7121\u52B9\u306AUTF-16\u30B5\u30ED\u30B2\u30FC\u30C8\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F: {0}\u3002" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "\u7121\u52b9\u306a\u30dd\u30fc\u30c8\u756a\u53f7"},
++ { MsgKey.ER_OIERROR,
++ "IO\u30A8\u30E9\u30FC" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "\u30db\u30b9\u30c8\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30dd\u30fc\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "\u5B50\u30CE\u30FC\u30C9\u306E\u5F8C\u307E\u305F\u306F\u8981\u7D20\u304C\u751F\u6210\u3055\u308C\u308B\u524D\u306B\u5C5E\u6027{0}\u3092\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002\u5C5E\u6027\u306F\u7121\u8996\u3055\u308C\u307E\u3059\u3002" },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "\u30db\u30b9\u30c8\u306f\u3046\u307e\u304f\u69cb\u6210\u3055\u308c\u305f\u30a2\u30c9\u30ec\u30b9\u3067\u3042\u308a\u307e\u305b\u3093"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "\u63A5\u982D\u8F9E''{0}''\u306E\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u304C\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002" },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "\u30b9\u30ad\u30fc\u30e0\u306f\u4e00\u81f4\u3057\u3066\u3044\u307e\u305b\u3093\u3002"},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "\u5C5E\u6027''{0}''\u304C\u8981\u7D20\u306E\u5916\u5074\u306B\u3042\u308A\u307E\u3059\u3002" },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "\u30cc\u30eb\u30fb\u30b9\u30c8\u30ea\u30f3\u30b0\u304b\u3089\u306f\u30b9\u30ad\u30fc\u30e0\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9\u5BA3\u8A00''{0}''=''{1}''\u304C\u8981\u7D20\u306E\u5916\u5074\u306B\u3042\u308A\u307E\u3059\u3002" },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "\u30d1\u30b9\u306b\u7121\u52b9\u306a\u30a8\u30b9\u30b1\u30fc\u30d7\u30fb\u30b7\u30fc\u30b1\u30f3\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "''{0}''\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F(CLASSPATH\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044)\u3002\u73FE\u5728\u306F\u5358\u306B\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u4F7F\u7528\u3057\u3066\u3044\u307E\u3059" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "\u30d1\u30b9\u306b\u7121\u52b9\u6587\u5b57: {0} \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "{1}\u306E\u6307\u5B9A\u3055\u308C\u305F\u51FA\u529B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3067\u793A\u3055\u308C\u306A\u3044\u6574\u6570\u5024{0}\u306E\u6587\u5B57\u3092\u51FA\u529B\u3057\u3088\u3046\u3068\u3057\u307E\u3057\u305F\u3002" },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306b\u7121\u52b9\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "\u51FA\u529B\u30E1\u30BD\u30C3\u30C9''{1}''\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u30FB\u30D5\u30A1\u30A4\u30EB''{0}''\u3092\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F(CLASSPATH\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "\u30d1\u30b9\u304c\u30cc\u30eb\u3067\u3042\u308b\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_INVALID_PORT,
++ "\u7121\u52B9\u306A\u30DD\u30FC\u30C8\u756A\u53F7" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "\u7dcf\u79f0 URI \u306e\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3057\u304b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "\u30DB\u30B9\u30C8\u304Cnull\u306E\u5834\u5408\u306F\u30DD\u30FC\u30C8\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "\u30b9\u30ad\u30fc\u30e0\u306f URI {0} \u3067\u898b\u3064\u304b\u308a\u307e\u305b\u3093"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "\u30DB\u30B9\u30C8\u306F\u6574\u5F62\u5F0F\u306E\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "URI \u306f\u7a7a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u521d\u671f\u5316\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "\u30B9\u30AD\u30FC\u30E0\u304C\u6574\u5408\u3057\u3066\u3044\u307E\u305B\u3093\u3002" },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306f\u30d1\u30b9\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306e\u4e21\u65b9\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "null\u6587\u5B57\u5217\u304B\u3089\u306F\u30B9\u30AD\u30FC\u30E0\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u306f\u30d1\u30b9\u304a\u3088\u3073\u7167\u4f1a\u30b9\u30c8\u30ea\u30f3\u30b0\u5185\u306b\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093"},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "\u30D1\u30B9\u306B\u7121\u52B9\u306A\u30A8\u30B9\u30B1\u30FC\u30D7\u30FB\u30B7\u30FC\u30B1\u30F3\u30B9\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u30dd\u30fc\u30c8\u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "\u30D1\u30B9\u306B\u7121\u52B9\u306A\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "\u30db\u30b9\u30c8\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f Userinfo \u3092\u6307\u5b9a\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8\u306B\u7121\u52B9\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "\u30b9\u30ad\u30fc\u30e0\u304c\u5fc5\u8981\u3067\u3059!"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "\u30D1\u30B9\u304Cnull\u306E\u5834\u5408\u306F\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8\u3092\u8A2D\u5B9A\u3067\u304D\u307E\u305B\u3093" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "\u6C4E\u7528URI\u306E\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8\u306E\u307F\u8A2D\u5B9A\u3067\u304D\u307E\u3059" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "\u30B9\u30AD\u30FC\u30E0\u304CURI\u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "URI\u306F\u7A7A\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u4F7F\u7528\u3057\u3066\u521D\u671F\u5316\u3067\u304D\u307E\u305B\u3093" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8\u306F\u30D1\u30B9\u3068\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8\u306E\u4E21\u65B9\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "\u554F\u5408\u305B\u6587\u5B57\u5217\u306F\u30D1\u30B9\u304A\u3088\u3073\u554F\u5408\u305B\u6587\u5B57\u5217\u5185\u306B\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "\u30DB\u30B9\u30C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306F\u30DD\u30FC\u30C8\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "\u30DB\u30B9\u30C8\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u306A\u3044\u5834\u5408\u306FUserinfo\u3092\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "\u8B66\u544A: \u51FA\u529B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306F\u3001''{0}''\u3067\u3042\u308B\u3053\u3068\u304C\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002XML\u306E\u3053\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u51FA\u529B\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u30D0\u30FC\u30B8\u30E7\u30F3\u306F\u3001''1.0''\u306B\u306A\u308A\u307E\u3059\u3002" },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "\u30B9\u30AD\u30FC\u30E0\u304C\u5FC5\u8981\u3067\u3059\u3002" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "SerializerFactory\u306B\u6E21\u3055\u308C\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u30FB\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3001''{0}''\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u305B\u3093\u3002" },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "\u8B66\u544A: \u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0''{0}''\u306F\u3001Java\u30E9\u30F3\u30BF\u30A4\u30E0\u3067\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002" },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_ko.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_ko.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_ko.java,v 1.1.4.1 2005/09/08 11:03:16 suresh_emailid Exp $
++ * $Id: SerializerMessages_ko.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:34:59 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_ko extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "''{0}'' \uc9c1\ub82c\ud654 \ud504\ub85c\uadf8\ub7a8 \ud074\ub798\uc2a4\uac00 org.xml.sax.ContentHandler\ub97c \uad6c\ud604\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "[ {0} ] \uc790\uc6d0\uc744 \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "[ {0} ] \uc790\uc6d0\uc774 {1} \n {2} \n {3}\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. "},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "\ubc84\ud37c \ud06c\uae30 <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "\uc798\ubabb\ub41c UTF-16 \ub300\ub9ac\uc790(surrogate)\uac00 \ubc1c\uacac\ub418\uc5c8\uc2b5\ub2c8\ub2e4: {0} ?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "\uBA54\uC2DC\uC9C0 \uD0A4 ''{0}''\uC774(\uAC00) \uBA54\uC2DC\uC9C0 \uD074\uB798\uC2A4 ''{1}''\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_OIERROR,
+- "IO \uc624\ub958"},
++ { MsgKey.BAD_MSGFORMAT,
++ "\uBA54\uC2DC\uC9C0 \uD074\uB798\uC2A4 ''{1}''\uC5D0\uC11C ''{0}'' \uBA54\uC2DC\uC9C0\uC758 \uD615\uC2DD\uC774 \uC798\uBABB\uB418\uC5C8\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "\ud558\uc704 \ub178\ub4dc\uac00 \uc0dd\uc131\ub41c \uc774\ud6c4 \ub610\ub294 \uc694\uc18c\uac00 \uc791\uc131\ub418\uae30 \uc774\uc804\uc5d0 {0} \uc18d\uc131\uc744 \ucd94\uac00\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc18d\uc131\uc774 \ubb34\uc2dc\ub429\ub2c8\ub2e4."},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "Serializer \uD074\uB798\uC2A4 ''{0}''\uC774(\uAC00) org.xml.sax.ContentHandler\uB97C \uAD6C\uD604\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "''{0}'' \uc811\ub450\ubd80\uc5d0 \ub300\ud55c \uc774\ub984 \uacf5\uac04\uc774 \uc120\uc5b8\ub418\uc9c0 \uc54a\uc558\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "[{0}] \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "''{0}''=''{1}'' \uc774\ub984 \uacf5\uac04 \uc120\uc5b8\uc774 \uc694\uc18c\uc758 \uc678\ubd80\uc5d0 \uc788\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "[{0}] \uB9AC\uC18C\uC2A4\uAC00 \uB2E4\uC74C\uC744 \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC74C: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "''{0}''(CLASSPATH \ud655\uc778)\uc744(\ub97c) \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc73c\ubbc0\ub85c, \ud604\uc7ac \uae30\ubcf8\uac12\ub9cc\uc744 \uc0ac\uc6a9 \uc911\uc785\ub2c8\ub2e4."},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "\uBC84\uD37C \uD06C\uAE30 <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "''{1}''\ucd9c\ub825 \uba54\uc18c\ub4dc(CLASSPATH \ud655\uc778)\uc5d0 \ub300\ud55c ''{0}'' \ud2b9\uc131 \ud30c\uc77c\uc744 \ub85c\ub4dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "\uBD80\uC801\uD569\uD55C UTF-16 \uB300\uB9AC \uC694\uC18C\uAC00 \uAC10\uC9C0\uB428: {0}" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "\uc798\ubabb\ub41c \ud3ec\ud2b8 \ubc88\ud638"},
++ { MsgKey.ER_OIERROR,
++ "IO \uC624\uB958" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "\ud638\uc2a4\ud2b8\uac00 \ub110(null)\uc774\uba74 \ud3ec\ud2b8\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "\uD558\uC704 \uB178\uB4DC\uAC00 \uC0DD\uC131\uB41C \uD6C4 \uB610\uB294 \uC694\uC18C\uAC00 \uC0DD\uC131\uB418\uAE30 \uC804\uC5D0 {0} \uC18D\uC131\uC744 \uCD94\uAC00\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC18D\uC131\uC774 \uBB34\uC2DC\uB429\uB2C8\uB2E4." },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "\ud638\uc2a4\ud2b8\uac00 \uc644\uc804\ud55c \uc8fc\uc18c\uac00 \uc544\ub2d9\ub2c8\ub2e4."},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "''{0}'' \uC811\uB450\uC5B4\uC5D0 \uB300\uD55C \uB124\uC784\uC2A4\uD398\uC774\uC2A4\uAC00 \uC120\uC5B8\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "\uc124\uacc4\uac00 \uc77c\uce58\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4."},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "''{0}'' \uC18D\uC131\uC774 \uC694\uC18C\uC5D0 \uD3EC\uD568\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "\ub110(null) \ubb38\uc790\uc5f4\uc5d0\uc11c \uc124\uacc4\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "\uB124\uC784\uC2A4\uD398\uC774\uC2A4 \uC120\uC5B8 ''{0}''=''{1}''\uC774(\uAC00) \uC694\uC18C\uC5D0 \uD3EC\uD568\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \uc774\uc2a4\ucf00\uc774\ud504 \uc21c\uc11c\uac00 \uc788\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "{0}\uC744(\uB97C) \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. CLASSPATH\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624. \uD604\uC7AC \uAE30\uBCF8\uAC12\uB9CC \uC0AC\uC6A9\uD558\uB294 \uC911\uC785\uB2C8\uB2E4." },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "\uacbd\ub85c\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4: {0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "{1}\uC758 \uC9C0\uC815\uB41C \uCD9C\uB825 \uC778\uCF54\uB529\uC5D0\uC11C \uD45C\uC2DC\uB418\uC9C0 \uC54A\uB294 \uC815\uC218 \uAC12 {0}\uC758 \uBB38\uC790\uB97C \uCD9C\uB825\uD558\uB824\uACE0 \uC2DC\uB3C4\uD588\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "\ub2e8\ud3b8\uc5d0 \uc798\ubabb\ub41c \ubb38\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "\uCD9C\uB825 \uBA54\uC18C\uB4DC ''{1}''\uC5D0 \uB300\uD55C \uC18D\uC131 \uD30C\uC77C ''{0}''\uC744(\uB97C) \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. CLASSPATH\uB97C \uD655\uC778\uD558\uC2ED\uC2DC\uC624." },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "\uacbd\ub85c\uac00 \ub110(null)\uc774\uba74 \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_INVALID_PORT,
++ "\uD3EC\uD2B8 \uBC88\uD638\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4." },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "\uc77c\ubc18 URI\uc5d0 \ub300\ud574\uc11c\ub9cc \ub2e8\ud3b8\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "\uD638\uC2A4\uD2B8\uAC00 \uB110\uC77C \uACBD\uC6B0 \uD3EC\uD2B8\uB97C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "URI\uc5d0 \uc124\uacc4\uac00 \uc5c6\uc2b5\ub2c8\ub2e4: {0}"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "\uD638\uC2A4\uD2B8\uAC00 \uC644\uC804\uD55C \uC8FC\uC18C\uAC00 \uC544\uB2D9\uB2C8\uB2E4." },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "\ube48 \ub9e4\uac1c\ubcc0\uc218\ub85c URI\ub97c \ucd08\uae30\ud654\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "\uCCB4\uACC4\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "\uacbd\ub85c \ubc0f \ub2e8\ud3b8 \ub458 \ub2e4\uc5d0 \ub2e8\ud3b8\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "\uB110 \uBB38\uC790\uC5F4\uC5D0\uC11C \uCCB4\uACC4\uB97C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "\uacbd\ub85c \ubc0f \uc870\ud68c \ubb38\uc790\uc5f4\uc5d0 \uc870\ud68c \ubb38\uc790\uc5f4\uc744 \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "\uACBD\uB85C\uC5D0 \uBD80\uC801\uD569\uD55C \uC774\uC2A4\uCF00\uC774\uD504 \uC2DC\uD000\uC2A4\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 \ud3ec\ud2b8\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "\uACBD\uB85C\uC5D0 \uBD80\uC801\uD569\uD55C \uBB38\uC790\uAC00 \uD3EC\uD568\uB428: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "\ud638\uc2a4\ud2b8\ub97c \uc9c0\uc815\ud558\uc9c0 \uc54a\uc740 \uacbd\uc6b0\uc5d0\ub294 Userinfo\ub97c \uc9c0\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "\uBD80\uBD84\uC5D0 \uBD80\uC801\uD569\uD55C \uBB38\uC790\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4." },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "\uc124\uacc4\uac00 \ud544\uc694\ud569\ub2c8\ub2e4!"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "\uACBD\uB85C\uAC00 \uB110\uC77C \uACBD\uC6B0 \uBD80\uBD84\uC744 \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "\uC77C\uBC18 URI\uC5D0 \uB300\uD574\uC11C\uB9CC \uBD80\uBD84\uC744 \uC124\uC815\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "URI\uC5D0\uC11C \uCCB4\uACC4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "\uBE48 \uB9E4\uAC1C\uBCC0\uC218\uB85C URI\uB97C \uCD08\uAE30\uD654\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "\uACBD\uB85C\uC640 \uBD80\uBD84\uC5D0 \uBAA8\uB450 \uBD80\uBD84\uC744 \uC9C0\uC815\uD560 \uC218\uB294 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "\uACBD\uB85C \uBC0F \uC9C8\uC758 \uBB38\uC790\uC5F4\uC5D0 \uC9C8\uC758 \uBB38\uC790\uC5F4\uC744 \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "\uD638\uC2A4\uD2B8\uB97C \uC9C0\uC815\uD558\uC9C0 \uC54A\uC740 \uACBD\uC6B0\uC5D0\uB294 \uD3EC\uD2B8\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "\uD638\uC2A4\uD2B8\uB97C \uC9C0\uC815\uD558\uC9C0 \uC54A\uC740 \uACBD\uC6B0\uC5D0\uB294 Userinfo\uB97C \uC9C0\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "\uACBD\uACE0: \uCD9C\uB825 \uBB38\uC11C\uC758 \uBC84\uC804\uC774 ''{0}''\uC774(\uAC00) \uB418\uB3C4\uB85D \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4. \uC774 \uBC84\uC804\uC758 XML\uC740 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uCD9C\uB825 \uBB38\uC11C\uC758 \uBC84\uC804\uC740 ''1.0''\uC774 \uB429\uB2C8\uB2E4." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "\uCCB4\uACC4\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4!" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "SerializerFactory\uC5D0 \uC804\uB2EC\uB41C Properties \uAC1D\uCCB4\uC5D0 ''{0}'' \uC18D\uC131\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "\uACBD\uACE0: \uC778\uCF54\uB529 ''{0}''\uC740(\uB294) Java \uB7F0\uD0C0\uC784\uC5D0 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -0,0 +1,208 @@
++/*
++ * reserved comment block
++ * DO NOT REMOVE OR ALTER!
++ */
++/*
++ * Copyright 2004 The Apache Software Foundation.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++/*
++ * $Id: SerializerMessages_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
++ */
++package com.sun.org.apache.xml.internal.serializer.utils;
++
++import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
++
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
++public class SerializerMessages_pt_BR extends ListResourceBundle {
++
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
++
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
++
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
++
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "A chave de mensagem ''{0}'' n\u00E3o est\u00E1 na classe de mensagem ''{1}''" },
++
++ { MsgKey.BAD_MSGFORMAT,
++ "Houve falha no formato da mensagem ''{0}'' na classe de mensagem ''{1}''." },
++
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "A classe ''{0}'' do serializador n\u00E3o implementa org.xml.sax.ContentHandler." },
++
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "N\u00E3o foi poss\u00EDvel encontrar o recurso [ {0} ].\n {1}" },
++
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "O recurso [ {0} ] n\u00E3o foi carregado: {1} \n {2} \t {3}" },
++
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Tamanho do buffer <=0" },
++
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "Foi detectado um substituto de UTF-16 inv\u00E1lido: {0} ?" },
++
++ { MsgKey.ER_OIERROR,
++ "Erro de E/S" },
++
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "N\u00E3o \u00E9 poss\u00EDvel adicionar o atributo {0} depois dos n\u00F3s filhos ou antes que um elemento seja produzido. O atributo ser\u00E1 ignorado." },
++
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "O namespace do prefixo ''{0}'' n\u00E3o foi declarado." },
++
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "Atributo ''{0}'' fora do elemento." },
++
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "Declara\u00E7\u00E3o de namespace ''{0}''=''{1}'' fora do elemento." },
++
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "N\u00E3o foi poss\u00EDvel carregar ''{0}'' (verificar CLASSPATH); usando agora apenas os padr\u00F5es" },
++
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "Tentativa de exibir um caractere de valor integral {0} que n\u00E3o est\u00E1 representado na codifica\u00E7\u00E3o de sa\u00EDda especificada de {1}." },
++
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "N\u00E3o foi poss\u00EDvel carregar o arquivo de propriedade ''{0}'' para o m\u00E9todo de sa\u00EDda ''{1}'' (verificar CLASSPATH)" },
++
++ { MsgKey.ER_INVALID_PORT,
++ "N\u00FAmero de porta inv\u00E1lido" },
++
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "A porta n\u00E3o pode ser definida quando o host \u00E9 nulo" },
++
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "O host n\u00E3o \u00E9 um endere\u00E7o correto" },
++
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "O esquema n\u00E3o \u00E9 compat\u00EDvel." },
++
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "N\u00E3o \u00E9 poss\u00EDvel definir o esquema de uma string nula" },
++
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "O caminho cont\u00E9m uma sequ\u00EAncia inv\u00E1lida de caracteres de escape" },
++
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "O caminho cont\u00E9m um caractere inv\u00E1lido: {0}" },
++
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "O fragmento cont\u00E9m um caractere inv\u00E1lido" },
++
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "O fragmento n\u00E3o pode ser definido quando o caminho \u00E9 nulo" },
++
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "O fragmento s\u00F3 pode ser definido para um URI gen\u00E9rico" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "Nenhum esquema encontrado no URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "N\u00E3o \u00E9 poss\u00EDvel inicializar o URI com par\u00E2metros vazios" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "O fragmento n\u00E3o pode ser especificado no caminho nem no fragmento" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "A string de consulta n\u00E3o pode ser especificada no caminho nem na string de consulta" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "A porta n\u00E3o pode ser especificada se o host n\u00E3o tiver sido especificado" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "As informa\u00E7\u00F5es do usu\u00E1rio n\u00E3o podem ser especificadas se o host n\u00E3o tiver sido especificado" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Advert\u00EAncia: a vers\u00E3o do documento de sa\u00EDda deve ser obrigatoriamente ''{0}''. Esta vers\u00E3o do XML n\u00E3o \u00E9 suportada. A vers\u00E3o do documento de sa\u00EDda ser\u00E1 ''1.0''." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "O esquema \u00E9 obrigat\u00F3rio!" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "O objeto Properties especificado para a SerializerFactory n\u00E3o tem uma propriedade ''{0}''." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Advert\u00EAncia: a codifica\u00E7\u00E3o ''{0}'' n\u00E3o \u00E9 suportada pelo Java runtime." },
++
++
++ };
++
++ return contents;
++ }
++}
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,83 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_sv.java,v 1.1.4.1 2005/09/08 11:03:17 suresh_emailid Exp $
++ * $Id: SerializerMessages_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_sv extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- // ER_SERIALIZER_NOT_CONTENTHANDLER needs translation
+- // ER_RESOURCE_COULD_NOT_FIND needs translation
+- // ER_RESOURCE_COULD_NOT_LOAD needs translation
+- // ER_BUFFER_SIZE_LESSTHAN_ZERO needs translation
+- // ER_INVALID_UTF16_SURROGATE needs translation
+- // ER_OIERROR needs translation
+- // ER_ILLEGAL_ATTRIBUTE_POSITION needs translation
+- // ER_NAMESPACE_PREFIX needs translation
+- // ER_STRAY_ATTRIBUTE needs translation
+- // ER_STRAY_NAMESPACE needs translation
+- // ER_COULD_NOT_LOAD_RESOURCE needs translation
+- // ER_ILLEGAL_CHARACTER needs translation
+- // ER_COULD_NOT_LOAD_METHOD_PROPERTY needs translation
+- { MsgKey.ER_INVALID_PORT,
+- "Ogiltigt portnummer"},
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "Port kan inte s\u00e4ttas n\u00e4r v\u00e4rd \u00e4r null"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "V\u00e4rd \u00e4r inte en v\u00e4lformulerad adress"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "Schemat \u00e4r inte likformigt."},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "Kan inte s\u00e4tta schema fr\u00e5n null-str\u00e4ng"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "Meddelandenyckeln ''{0}'' \u00E4r inte i meddelandeklassen ''{1}''" },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "V\u00e4g inneh\u00e5ller ogiltig flyktsekvens"},
++ { MsgKey.BAD_MSGFORMAT,
++ "Formatet p\u00E5 meddelandet ''{0}'' i meddelandeklassen ''{1}'' underk\u00E4ndes." },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "V\u00e4g inneh\u00e5ller ogiltigt tecken: {0}"},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "Serializerklassen ''{0}'' implementerar inte org.xml.sax.ContentHandler." },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "Fragment inneh\u00e5ller ogiltigt tecken"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "Resursen [ {0} ] kunde inte h\u00E4mtas.\n {1}" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "Fragment kan inte s\u00e4ttas n\u00e4r v\u00e4g \u00e4r null"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "Resursen [ {0} ] kunde inte laddas: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "Fragment kan bara s\u00e4ttas f\u00f6r en allm\u00e4n URI"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "Buffertstorlek <=0" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "Schema saknas i URI: {0}"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "Ogiltigt UTF-16-surrogat uppt\u00E4ckt: {0} ?" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "Kan inte initialisera URI med tomma parametrar"},
++ { MsgKey.ER_OIERROR,
++ "IO-fel" },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "Fragment kan inte anges i b\u00e5de v\u00e4gen och fragmentet"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "Kan inte l\u00E4gga till attributet {0} efter underordnade noder eller innan ett element har skapats. Attributet ignoreras." },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "F\u00f6rfr\u00e5gan-str\u00e4ng kan inte anges i v\u00e4g och f\u00f6rfr\u00e5gan-str\u00e4ng"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "Namnrymd f\u00F6r prefix ''{0}'' har inte deklarerats." },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "Port f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "Attributet ''{0}'' finns utanf\u00F6r elementet." },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "Userinfo f\u00e5r inte anges om v\u00e4rden inte \u00e4r angiven"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "Namnrymdsdeklarationen ''{0}''=''{1}'' finns utanf\u00F6r element." },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "Schema kr\u00e4vs!"}
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "Kunde inte ladda ''{0}'' (kontrollera CLASSPATH), anv\u00E4nder nu enbart standardv\u00E4rden" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "F\u00F6rs\u00F6k att skriva utdatatecken med integralv\u00E4rdet {0} som inte \u00E4r representerat i angiven utdatakodning av {1}." },
++
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "Kunde inte ladda egenskapsfilen ''{0}'' f\u00F6r utdatametoden ''{1}'' (kontrollera CLASSPATH)" },
++
++ { MsgKey.ER_INVALID_PORT,
++ "Ogiltigt portnummer" },
++
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "Port kan inte st\u00E4llas in n\u00E4r v\u00E4rd \u00E4r null" },
++
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "V\u00E4rd \u00E4r inte en v\u00E4lformulerad adress" },
++
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "Schemat \u00E4r inte likformigt." },
++
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "Kan inte st\u00E4lla in schema fr\u00E5n null-str\u00E4ng" },
++
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "S\u00F6kv\u00E4gen inneh\u00E5ller en ogiltig escape-sekvens" },
++
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "S\u00F6kv\u00E4gen inneh\u00E5ller ett ogiltigt tecken: {0}" },
++
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "Fragment inneh\u00E5ller ett ogiltigt tecken" },
++
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "Fragment kan inte st\u00E4llas in n\u00E4r s\u00F6kv\u00E4g \u00E4r null" },
++
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "Fragment kan bara st\u00E4llas in f\u00F6r en allm\u00E4n URI" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "Schema saknas i URI" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "Kan inte initiera URI med tomma parametrar" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "Fragment kan inte anges i b\u00E5de s\u00F6kv\u00E4gen och fragmentet" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "Fr\u00E5gestr\u00E4ng kan inte anges i b\u00E5de s\u00F6kv\u00E4gen och fr\u00E5gestr\u00E4ngen" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "Port f\u00E5r inte anges om v\u00E4rden inte \u00E4r angiven" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "Anv\u00E4ndarinfo f\u00E5r inte anges om v\u00E4rden inte \u00E4r angiven" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "Varning: Versionen av utdatadokumentet som beg\u00E4rts \u00E4r ''{0}''. Den h\u00E4r versionen av XML st\u00F6ds inte. Versionen av utdatadokumentet kommer att vara ''1.0''." },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "Schema kr\u00E4vs!" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "Egenskapsobjektet som \u00F6verf\u00F6rts till SerializerFactory har ingen ''{0}''-egenskap." },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "Varning: Kodningen ''{0}'' st\u00F6ds inte av Java runtime." },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_zh_CN.java,v 1.1.4.1 2005/09/08 11:03:18 suresh_emailid Exp $
++ * $Id: SerializerMessages_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_zh_CN extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "\u4e32\u884c\u5668\u7c7b\u201c{0}\u201d\u4e0d\u5b9e\u73b0 org.xml.sax.ContentHandler."},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "\u627e\u4e0d\u5230\u8d44\u6e90 [ {0} ]\u3002\n {1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "\u8d44\u6e90 [ {0} ] \u65e0\u6cd5\u88c5\u5165\uff1a{1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "\u7f13\u51b2\u533a\u5927\u5c0f <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "\u68c0\u6d4b\u5230\u65e0\u6548\u7684 UTF-16 \u66ff\u4ee3\u8005\uff1a{0}\uff1f"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "\u6D88\u606F\u5173\u952E\u5B57 ''{0}'' \u4E0D\u5728\u6D88\u606F\u7C7B ''{1}'' \u4E2D" },
+
+- { MsgKey.ER_OIERROR,
+- "IO \u9519\u8bef"},
++ { MsgKey.BAD_MSGFORMAT,
++ "\u6D88\u606F\u7C7B ''{1}'' \u4E2D\u6D88\u606F ''{0}'' \u7684\u683C\u5F0F\u5316\u5931\u8D25\u3002" },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "\u5728\u751f\u6210\u5b50\u8282\u70b9\u4e4b\u540e\u6216\u5728\u751f\u6210\u5143\u7d20\u4e4b\u524d\u65e0\u6cd5\u6dfb\u52a0\u5c5e\u6027 {0}\u3002\u5c06\u5ffd\u7565\u5c5e\u6027\u3002"},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "\u4E32\u884C\u5668\u7C7B ''{0}'' \u4E0D\u5B9E\u73B0 org.xml.sax.ContentHandler\u3002" },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "\u6ca1\u6709\u8bf4\u660e\u540d\u79f0\u7a7a\u95f4\u524d\u7f00\u201c{0}\u201d\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "\u627E\u4E0D\u5230\u8D44\u6E90 [ {0} ]\u3002\n {1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "\u540d\u79f0\u7a7a\u95f4\u8bf4\u660e\u201c{0}\u201d=\u201c{1}\u201d\u5728\u5143\u7d20\u5916\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "\u8D44\u6E90 [ {0} ] \u65E0\u6CD5\u52A0\u8F7D: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "\u65e0\u6cd5\u88c5\u5165\u201c{0}\u201d\uff08\u68c0\u67e5 CLASSPATH\uff09\uff0c\u73b0\u5728\u53ea\u4f7f\u7528\u7f3a\u7701\u503c"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "\u7F13\u51B2\u533A\u5927\u5C0F <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "\u65e0\u6cd5\u4e3a\u8f93\u51fa\u65b9\u6cd5\u201c{1}\u201d\u88c5\u8f7d\u5c5e\u6027\u6587\u4ef6\u201c{0}\u201d\uff08\u68c0\u67e5 CLASSPATH\uff09"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "\u68C0\u6D4B\u5230\u65E0\u6548\u7684 UTF-16 \u4EE3\u7406: {0}?" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "\u65e0\u6548\u7684\u7aef\u53e3\u53f7"},
++ { MsgKey.ER_OIERROR,
++ "IO \u9519\u8BEF" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "\u4e3b\u673a\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7aef\u53e3"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "\u5728\u751F\u6210\u5B50\u8282\u70B9\u4E4B\u540E\u6216\u5728\u751F\u6210\u5143\u7D20\u4E4B\u524D\u65E0\u6CD5\u6DFB\u52A0\u5C5E\u6027 {0}\u3002\u5C06\u5FFD\u7565\u5C5E\u6027\u3002" },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "\u4e3b\u673a\u4e0d\u662f\u683c\u5f0f\u826f\u597d\u7684\u5730\u5740"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "\u6CA1\u6709\u8BF4\u660E\u540D\u79F0\u7A7A\u95F4\u524D\u7F00 ''{0}''\u3002" },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "\u6a21\u5f0f\u4e0d\u4e00\u81f4\u3002"},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "\u5C5E\u6027 ''{0}'' \u5728\u5143\u7D20\u5916\u90E8\u3002" },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "\u65e0\u6cd5\u4ece\u7a7a\u5b57\u7b26\u4e32\u8bbe\u7f6e\u6a21\u5f0f"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "\u540D\u79F0\u7A7A\u95F4\u58F0\u660E ''{0}''=''{1}'' \u5728\u5143\u7D20\u5916\u90E8\u3002" },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "\u8def\u5f84\u5305\u542b\u65e0\u6548\u7684\u8f6c\u4e49\u5e8f\u5217"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "\u65E0\u6CD5\u52A0\u8F7D ''{0}'' (\u68C0\u67E5 CLASSPATH), \u73B0\u5728\u53EA\u4F7F\u7528\u9ED8\u8BA4\u503C" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "\u8def\u5f84\u5305\u542b\u975e\u6cd5\u5b57\u7b26\uff1a{0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "\u5C1D\u8BD5\u8F93\u51FA\u672A\u4EE5{1}\u7684\u6307\u5B9A\u8F93\u51FA\u7F16\u7801\u8868\u793A\u7684\u6574\u6570\u503C {0} \u7684\u5B57\u7B26\u3002" },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "\u7247\u6bb5\u5305\u542b\u65e0\u6548\u7684\u5b57\u7b26"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "\u65E0\u6CD5\u4E3A\u8F93\u51FA\u65B9\u6CD5 ''{1}'' \u52A0\u8F7D\u5C5E\u6027\u6587\u4EF6 ''{0}'' (\u68C0\u67E5 CLASSPATH)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "\u8def\u5f84\u4e3a\u7a7a\u65f6\uff0c\u65e0\u6cd5\u8bbe\u7f6e\u7247\u6bb5"},
++ { MsgKey.ER_INVALID_PORT,
++ "\u65E0\u6548\u7684\u7AEF\u53E3\u53F7" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "\u53ea\u80fd\u4e3a\u4e00\u822c URI \u8bbe\u7f6e\u7247\u6bb5"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "\u4E3B\u673A\u4E3A\u7A7A\u65F6, \u65E0\u6CD5\u8BBE\u7F6E\u7AEF\u53E3" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "\u5728 URI \u4e2d\u627e\u4e0d\u5230\u6a21\u5f0f\uff1a{0}"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "\u4E3B\u673A\u4E0D\u662F\u683C\u5F0F\u826F\u597D\u7684\u5730\u5740" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "\u65e0\u6cd5\u4ee5\u7a7a\u53c2\u6570\u521d\u59cb\u5316 URI"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "\u65B9\u6848\u4E0D\u4E00\u81F4\u3002" },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "\u8def\u5f84\u548c\u7247\u6bb5\u4e2d\u90fd\u65e0\u6cd5\u6307\u5b9a\u7247\u6bb5"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "\u65E0\u6CD5\u4ECE\u7A7A\u5B57\u7B26\u4E32\u8BBE\u7F6E\u65B9\u6848" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "\u8def\u5f84\u548c\u67e5\u8be2\u5b57\u7b26\u4e32\u4e2d\u4e0d\u80fd\u6307\u5b9a\u67e5\u8be2\u5b57\u7b26\u4e32"},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "\u8DEF\u5F84\u5305\u542B\u65E0\u6548\u7684\u8F6C\u4E49\u5E8F\u5217" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a\u7aef\u53e3"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "\u8DEF\u5F84\u5305\u542B\u65E0\u6548\u7684\u5B57\u7B26: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u4e3b\u673a\uff0c\u5219\u4e0d\u53ef\u4ee5\u6307\u5b9a Userinfo"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "\u7247\u6BB5\u5305\u542B\u65E0\u6548\u7684\u5B57\u7B26" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "\u6a21\u5f0f\u662f\u5fc5\u9700\u7684\uff01"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "\u8DEF\u5F84\u4E3A\u7A7A\u65F6, \u65E0\u6CD5\u8BBE\u7F6E\u7247\u6BB5" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "\u53EA\u80FD\u4E3A\u4E00\u822C URI \u8BBE\u7F6E\u7247\u6BB5" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "\u5728 URI \u4E2D\u627E\u4E0D\u5230\u65B9\u6848" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "\u65E0\u6CD5\u4EE5\u7A7A\u53C2\u6570\u521D\u59CB\u5316 URI" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "\u8DEF\u5F84\u548C\u7247\u6BB5\u4E2D\u90FD\u65E0\u6CD5\u6307\u5B9A\u7247\u6BB5" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "\u8DEF\u5F84\u548C\u67E5\u8BE2\u5B57\u7B26\u4E32\u4E2D\u4E0D\u80FD\u6307\u5B9A\u67E5\u8BE2\u5B57\u7B26\u4E32" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u4E3B\u673A, \u5219\u4E0D\u53EF\u4EE5\u6307\u5B9A\u7AEF\u53E3" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "\u5982\u679C\u6CA1\u6709\u6307\u5B9A\u4E3B\u673A, \u5219\u4E0D\u53EF\u4EE5\u6307\u5B9A Userinfo" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "\u8B66\u544A: \u8F93\u51FA\u6587\u6863\u7684\u7248\u672C\u5E94\u4E3A ''{0}''\u3002\u4E0D\u652F\u6301\u6B64\u7248\u672C\u7684 XML\u3002\u8F93\u51FA\u6587\u6863\u7684\u7248\u672C\u5C06\u4E3A ''1.0''\u3002" },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "\u65B9\u6848\u662F\u5FC5\u9700\u7684!" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "\u4F20\u9012\u5230 SerializerFactory \u7684 Properties \u5BF9\u8C61\u6CA1\u6709 ''{0}'' \u5C5E\u6027\u3002" },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "\u8B66\u544A: Java \u8FD0\u884C\u65F6\u4E0D\u652F\u6301\u7F16\u7801 ''{0}''\u3002" },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_zh_TW.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/SerializerMessages_zh_TW.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,105 +18,191 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: SerializerMessages_zh_TW.java,v 1.1.4.1 2005/09/08 11:03:18 suresh_emailid Exp $
++ * $Id: SerializerMessages_zh_TW.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:45:37 gmolloy Exp $
+ */
+-
+ package com.sun.org.apache.xml.internal.serializer.utils;
+
+ import java.util.ListResourceBundle;
++import java.util.Locale;
++import java.util.MissingResourceException;
++import java.util.ResourceBundle;
+
++/**
++ * An instance of this class is a ListResourceBundle that
++ * has the required getContents() method that returns
++ * an array of message-key/message associations.
++ * <p>
++ * The message keys are defined in {@link MsgKey}. The
++ * messages that those keys map to are defined here.
++ * <p>
++ * The messages in the English version are intended to be
++ * translated.
++ *
++ * This class is not a public API, it is only public because it is
++ * used in com.sun.org.apache.xml.internal.serializer.
++ *
++ * @xsl.usage internal
++ */
+ public class SerializerMessages_zh_TW extends ListResourceBundle {
+- public Object[][] getContents() {
+- Object[][] contents = new Object[][] {
+- // BAD_MSGKEY needs translation
+- // BAD_MSGFORMAT needs translation
+- { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
+- "serializer \u985e\u5225 ''{0}'' \u4e0d\u5be6\u4f5c org.xml.sax.ContentHandler\u3002"},
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
+- "\u627e\u4e0d\u5230\u8cc7\u6e90 [ {0} ]\u3002\n{1}"},
++ /*
++ * This file contains error and warning messages related to
++ * Serializer Error Handling.
++ *
++ * General notes to translators:
+
+- { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
+- "\u7121\u6cd5\u8f09\u5165\u8cc7\u6e90 [ {0} ]\uff1a{1} \n {2} \n {3}"},
++ * 1) A stylesheet is a description of how to transform an input XML document
++ * into a resultant XML document (or HTML document or text). The
++ * stylesheet itself is described in the form of an XML document.
+
+- { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
+- "\u7de9\u885d\u5340\u5927\u5c0f <=0"},
++ *
++ * 2) An element is a mark-up tag in an XML document; an attribute is a
++ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
++ * "elem" is an element name, "attr" and "attr2" are attribute names with
++ * the values "val" and "val2", respectively.
++ *
++ * 3) A namespace declaration is a special attribute that is used to associate
++ * a prefix with a URI (the namespace). The meanings of element names and
++ * attribute names that use that prefix are defined with respect to that
++ * namespace.
++ *
++ *
++ */
+
+- { MsgKey.ER_INVALID_UTF16_SURROGATE,
+- "\u5075\u6e2c\u5230\u7121\u6548\u7684 UTF-16 \u4ee3\u7406\uff1a{0}?"},
++ /** The lookup table for error messages. */
++ public Object[][] getContents() {
++ Object[][] contents = new Object[][] {
++ { MsgKey.BAD_MSGKEY,
++ "\u8A0A\u606F\u7D22\u5F15\u9375 ''{0}'' \u7684\u8A0A\u606F\u985E\u5225\u4E0D\u662F ''{1}''" },
+
+- { MsgKey.ER_OIERROR,
+- "IO \u932f\u8aa4"},
++ { MsgKey.BAD_MSGFORMAT,
++ "\u8A0A\u606F\u985E\u5225 ''{1}'' \u4E2D\u7684\u8A0A\u606F ''{0}'' \u683C\u5F0F\u4E0D\u6B63\u78BA\u3002" },
+
+- { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
+- "\u5728\u7522\u751f\u5b50\u9805\u7bc0\u9ede\u4e4b\u5f8c\uff0c\u6216\u5728\u7522\u751f\u5143\u7d20\u4e4b\u524d\uff0c\u4e0d\u53ef\u65b0\u589e\u5c6c\u6027 {0}\u3002\u5c6c\u6027\u6703\u88ab\u5ffd\u7565\u3002"},
++ { MsgKey.ER_SERIALIZER_NOT_CONTENTHANDLER,
++ "serializer \u985E\u5225 ''{0}'' \u4E0D\u5BE6\u884C org.xml.sax.ContentHandler\u3002" },
+
+- { MsgKey.ER_NAMESPACE_PREFIX,
+- "\u5b57\u9996 ''{0}'' \u7684\u540d\u7a31\u7a7a\u9593\u5c1a\u672a\u5ba3\u544a\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_FIND,
++ "\u627E\u4E0D\u5230\u8CC7\u6E90 [ {0} ]\u3002\n{1}" },
+
+- // ER_STRAY_ATTRIBUTE needs translation
+- { MsgKey.ER_STRAY_NAMESPACE,
+- "\u540d\u7a31\u7a7a\u9593\u5ba3\u544a ''{0}''=''{1}'' \u8d85\u51fa\u5143\u7d20\u5916\u3002"},
++ { MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
++ "\u7121\u6CD5\u8F09\u5165\u8CC7\u6E90 [ {0} ]: {1} \n {2} \t {3}" },
+
+- { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
+- "\u7121\u6cd5\u8f09\u5165 ''{0}''\uff08\u6aa2\u67e5 CLASSPATH\uff09\uff0c\u76ee\u524d\u53ea\u4f7f\u7528\u9810\u8a2d\u503c"},
++ { MsgKey.ER_BUFFER_SIZE_LESSTHAN_ZERO,
++ "\u7DE9\u885D\u5340\u5927\u5C0F <=0" },
+
+- // ER_ILLEGAL_CHARACTER needs translation
+- { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
+- "\u7121\u6cd5\u8f09\u5165\u8f38\u51fa\u65b9\u6cd5 ''{1}'' \u7684\u5167\u5bb9\u6a94 ''{0}''\uff08\u6aa2\u67e5 CLASSPATH\uff09"},
++ { MsgKey.ER_INVALID_UTF16_SURROGATE,
++ "\u5075\u6E2C\u5230\u7121\u6548\u7684 UTF-16 \u4EE3\u7406: {0}\uFF1F" },
+
+- { MsgKey.ER_INVALID_PORT,
+- "\u7121\u6548\u7684\u57e0\u7de8\u865f"},
++ { MsgKey.ER_OIERROR,
++ "IO \u932F\u8AA4" },
+
+- { MsgKey.ER_PORT_WHEN_HOST_NULL,
+- "\u4e3b\u6a5f\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u57e0"},
++ { MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,
++ "\u5728\u7522\u751F\u5B50\u9805\u7BC0\u9EDE\u4E4B\u5F8C\uFF0C\u6216\u5728\u7522\u751F\u5143\u7D20\u4E4B\u524D\uFF0C\u4E0D\u53EF\u65B0\u589E\u5C6C\u6027 {0}\u3002\u5C6C\u6027\u6703\u88AB\u5FFD\u7565\u3002" },
+
+- { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
+- "\u4e3b\u6a5f\u6c92\u6709\u5b8c\u6574\u7684\u4f4d\u5740"},
++ /*
++ * Note to translators: The stylesheet contained a reference to a
++ * namespace prefix that was undefined. The value of the substitution
++ * text is the name of the prefix.
++ */
++ { MsgKey.ER_NAMESPACE_PREFIX,
++ "\u5B57\u9996 ''{0}'' \u7684\u547D\u540D\u7A7A\u9593\u5C1A\u672A\u5BA3\u544A\u3002" },
+
+- { MsgKey.ER_SCHEME_NOT_CONFORMANT,
+- "\u7db1\u8981\u4e0d\u662f conformant\u3002"},
++ /*
++ * Note to translators: This message is reported if the stylesheet
++ * being processed attempted to construct an XML document with an
++ * attribute in a place other than on an element. The substitution text
++ * specifies the name of the attribute.
++ */
++ { MsgKey.ER_STRAY_ATTRIBUTE,
++ "\u5C6C\u6027 ''{0}'' \u5728\u5143\u7D20\u4E4B\u5916\u3002" },
+
+- { MsgKey.ER_SCHEME_FROM_NULL_STRING,
+- "\u7121\u6cd5\u5f9e\u7a7a\u5b57\u4e32\u8a2d\u5b9a\u7db1\u8981"},
++ /*
++ * Note to translators: As with the preceding message, a namespace
++ * declaration has the form of an attribute and is only permitted to
++ * appear on an element. The substitution text {0} is the namespace
++ * prefix and {1} is the URI that was being used in the erroneous
++ * namespace declaration.
++ */
++ { MsgKey.ER_STRAY_NAMESPACE,
++ "\u547D\u540D\u7A7A\u9593\u5BA3\u544A ''{0}''=''{1}'' \u8D85\u51FA\u5143\u7D20\u5916\u3002" },
+
+- { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
+- "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u8df3\u812b\u5b57\u5143"},
++ { MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
++ "\u7121\u6CD5\u8F09\u5165 ''{0}'' (\u6AA2\u67E5 CLASSPATH)\uFF0C\u76EE\u524D\u53EA\u4F7F\u7528\u9810\u8A2D\u503C" },
+
+- { MsgKey.ER_PATH_INVALID_CHAR,
+- "\u8def\u5f91\u5305\u542b\u7121\u6548\u7684\u5b57\u5143\uff1a{0}"},
++ { MsgKey.ER_ILLEGAL_CHARACTER,
++ "\u5617\u8A66\u8F38\u51FA\u6574\u6578\u503C {0} \u7684\u5B57\u5143\uFF0C\u4F46\u662F\u5B83\u4E0D\u662F\u4EE5\u6307\u5B9A\u7684 {1} \u8F38\u51FA\u7DE8\u78BC\u5448\u73FE\u3002" },
+
+- { MsgKey.ER_FRAG_INVALID_CHAR,
+- "\u7247\u6bb5\u5305\u542b\u7121\u6548\u7684\u5b57\u5143"},
++ { MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
++ "\u7121\u6CD5\u8F09\u5165\u8F38\u51FA\u65B9\u6CD5 ''{1}'' \u7684\u5C6C\u6027\u6A94 ''{0}'' (\u6AA2\u67E5 CLASSPATH)" },
+
+- { MsgKey.ER_FRAG_WHEN_PATH_NULL,
+- "\u8def\u5f91\u70ba\u7a7a\u503c\u6642\uff0c\u7121\u6cd5\u8a2d\u5b9a\u7247\u6bb5"},
++ { MsgKey.ER_INVALID_PORT,
++ "\u7121\u6548\u7684\u9023\u63A5\u57E0\u865F\u78BC" },
+
+- { MsgKey.ER_FRAG_FOR_GENERIC_URI,
+- "\u53ea\u80fd\u5c0d\u901a\u7528\u7684 URI \u8a2d\u5b9a\u7247\u6bb5"},
++ { MsgKey.ER_PORT_WHEN_HOST_NULL,
++ "\u4E3B\u6A5F\u70BA\u7A7A\u503C\u6642\uFF0C\u7121\u6CD5\u8A2D\u5B9A\u9023\u63A5\u57E0" },
+
+- { MsgKey.ER_NO_SCHEME_IN_URI,
+- "\u5728 URI\uff1a{0} \u627e\u4e0d\u5230\u7db1\u8981"},
++ { MsgKey.ER_HOST_ADDRESS_NOT_WELLFORMED,
++ "\u4E3B\u6A5F\u6C92\u6709\u5B8C\u6574\u7684\u4F4D\u5740" },
+
+- { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
+- "\u7121\u6cd5\u4ee5\u7a7a\u767d\u53c3\u6578\u8d77\u59cb\u8a2d\u5b9a URI"},
++ { MsgKey.ER_SCHEME_NOT_CONFORMANT,
++ "\u914D\u7F6E\u4E0D\u4E00\u81F4\u3002" },
+
+- { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
+- "\u7247\u6bb5\u7121\u6cd5\u540c\u6642\u5728\u8def\u5f91\u548c\u7247\u6bb5\u4e2d\u6307\u5b9a"},
++ { MsgKey.ER_SCHEME_FROM_NULL_STRING,
++ "\u7121\u6CD5\u5F9E\u7A7A\u503C\u5B57\u4E32\u8A2D\u5B9A\u914D\u7F6E" },
+
+- { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
+- "\u5728\u8def\u5f91\u53ca\u67e5\u8a62\u5b57\u4e32\u4e2d\u4e0d\u53ef\u6307\u5b9a\u67e5\u8a62\u5b57\u4e32"},
++ { MsgKey.ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
++ "\u8DEF\u5F91\u5305\u542B\u7121\u6548\u7684\u9041\u96E2\u5E8F\u5217" },
+
+- { MsgKey.ER_NO_PORT_IF_NO_HOST,
+- "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a\u57e0"},
++ { MsgKey.ER_PATH_INVALID_CHAR,
++ "\u8DEF\u5F91\u5305\u542B\u7121\u6548\u7684\u5B57\u5143: {0}" },
+
+- { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
+- "\u5982\u679c\u6c92\u6709\u6307\u5b9a\u4e3b\u6a5f\uff0c\u4e0d\u53ef\u6307\u5b9a Userinfo"},
++ { MsgKey.ER_FRAG_INVALID_CHAR,
++ "\u7247\u6BB5\u5305\u542B\u7121\u6548\u7684\u5B57\u5143" },
+
+- { MsgKey.ER_SCHEME_REQUIRED,
+- "\u7db1\u8981\u662f\u5fc5\u9700\u7684\uff01"}
++ { MsgKey.ER_FRAG_WHEN_PATH_NULL,
++ "\u8DEF\u5F91\u70BA\u7A7A\u503C\u6642\uFF0C\u7121\u6CD5\u8A2D\u5B9A\u7247\u6BB5" },
+
+- };
+- return contents;
+- }
++ { MsgKey.ER_FRAG_FOR_GENERIC_URI,
++ "\u53EA\u80FD\u5C0D\u4E00\u822C URI \u8A2D\u5B9A\u7247\u6BB5" },
++
++ { MsgKey.ER_NO_SCHEME_IN_URI,
++ "\u5728 URI \u627E\u4E0D\u5230\u914D\u7F6E" },
++
++ { MsgKey.ER_CANNOT_INIT_URI_EMPTY_PARMS,
++ "\u7121\u6CD5\u4EE5\u7A7A\u767D\u53C3\u6578\u8D77\u59CB\u8A2D\u5B9A URI" },
++
++ { MsgKey.ER_NO_FRAGMENT_STRING_IN_PATH,
++ "\u8DEF\u5F91\u548C\u7247\u6BB5\u4E0D\u80FD\u540C\u6642\u6307\u5B9A\u7247\u6BB5" },
++
++ { MsgKey.ER_NO_QUERY_STRING_IN_PATH,
++ "\u5728\u8DEF\u5F91\u53CA\u67E5\u8A62\u5B57\u4E32\u4E2D\u4E0D\u53EF\u6307\u5B9A\u67E5\u8A62\u5B57\u4E32" },
++
++ { MsgKey.ER_NO_PORT_IF_NO_HOST,
++ "\u5982\u679C\u6C92\u6709\u6307\u5B9A\u4E3B\u6A5F\uFF0C\u4E0D\u53EF\u6307\u5B9A\u9023\u63A5\u57E0" },
++
++ { MsgKey.ER_NO_USERINFO_IF_NO_HOST,
++ "\u5982\u679C\u6C92\u6709\u6307\u5B9A\u4E3B\u6A5F\uFF0C\u4E0D\u53EF\u6307\u5B9A Userinfo" },
++
++ { MsgKey.ER_XML_VERSION_NOT_SUPPORTED,
++ "\u8B66\u544A: \u8981\u6C42\u7684\u8F38\u51FA\u6587\u4EF6\u7248\u672C\u70BA ''{0}''\u3002\u4E0D\u652F\u63F4\u6B64\u7248\u672C\u7684 XML\u3002\u8F38\u51FA\u6587\u4EF6\u7684\u7248\u672C\u5C07\u6703\u662F ''1.0''\u3002" },
++
++ { MsgKey.ER_SCHEME_REQUIRED,
++ "\u5FC5\u9808\u6709\u914D\u7F6E\uFF01" },
++
++ /*
++ * Note to translators: The words 'Properties' and
++ * 'SerializerFactory' in this message are Java class names
++ * and should not be translated.
++ */
++ { MsgKey.ER_FACTORY_PROPERTY_MISSING,
++ "\u50B3\u905E\u7D66 SerializerFactory \u7684 Properties \u7269\u4EF6\u6C92\u6709 ''{0}'' \u5C6C\u6027\u3002" },
++
++ { MsgKey.ER_ENCODING_NOT_SUPPORTED,
++ "\u8B66\u544A: Java Runtime \u4E0D\u652F\u63F4\u7DE8\u78BC ''{0}''\u3002" },
++
++
++ };
++
++ return contents;
++ }
+ }
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_de.java,v 1.2.4.1 2005/09/15 00:39:22 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_de.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:23:27 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -881,7 +881,7 @@
+ { "optionIN", " [-in inputXMLURL]"},
+ { "optionSelect", " [-select xpath expression]"},
+ { "optionMatch", " [-match match pattern (f\u00FCr Vergleichsdiagnose)]"},
+- { "optionAnyExpr", "Oder nur ein XPath-Ausdruck f\u00FChrt einen Diagnose-Dump aus"},
++ { "optionAnyExpr", "Oder nur ein XPath-Ausdruck f\u00FChrt einen Diagnosedump aus"},
+ { "noParsermsg1", "XSL-Prozess war nicht erfolgreich."},
+ { "noParsermsg2", "** Parser konnte nicht gefunden werden **"},
+ { "noParsermsg3", "Pr\u00FCfen Sie den Classpath."},
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_es.java,v 1.2.4.1 2005/09/15 00:39:22 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_es.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:38:53 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -432,7 +432,7 @@
+ "ERROR. C\u00F3digo de operaci\u00F3n desconocido: {0}"},
+
+ { ER_EXTRA_ILLEGAL_TOKENS,
+- "Elementos no permitidos adicionales: {0}"},
++ "Tokens no permitidos adicionales: {0}"},
+
+ { ER_EXPECTED_DOUBLE_QUOTE,
+ "literal con comillas incorrectas... se esperaban comillas dobles"},
+@@ -549,7 +549,7 @@
+ "En XPath.readObject: {0}"},
+
+ { ER_FUNCTION_TOKEN_NOT_FOUND,
+- "No se ha encontrado el elemento de funci\u00F3n."},
++ "No se ha encontrado el token de funci\u00F3n."},
+
+ { ER_CANNOT_DEAL_XPATH_TYPE,
+ "No se puede negociar con el tipo de XPath: {0}"},
+@@ -643,13 +643,13 @@
+ // The message indicates that such an expression was expected following the
+ // characters '/' or '//', but was not found.
+ { ER_EXPECTED_REL_LOC_PATH,
+- "Se esperaba una ruta de acceso de ubicaci\u00F3n relativa despu\u00E9s del elemento '/' o '//'."},
++ "Se esperaba una ruta de acceso de ubicaci\u00F3n relativa despu\u00E9s del token '/' o '//'."},
+
+ // Note to translators: A location path is a form of XPath expression.
+ // The message indicates that syntactically such an expression was expected,but
+ // the characters specified by the substitution text were encountered instead.
+ { ER_EXPECTED_LOC_PATH,
+- "Se esperaba una ruta de acceso de ubicaci\u00F3n, pero se ha encontrado el siguiente elemento: {0}"},
++ "Se esperaba una ruta de acceso de ubicaci\u00F3n, pero se ha encontrado el siguiente token: {0}"},
+
+ // Note to translators: A location path is a form of XPath expression.
+ // The message indicates that syntactically such a subexpression was expected,
+@@ -661,7 +661,7 @@
+ // The message indicates that syntactically such an expression was expected
+ // following the specified characters.
+ { ER_EXPECTED_LOC_STEP,
+- "Se esperaba un paso de ubicaci\u00F3n despu\u00E9s del elemento '/' o '//'."},
++ "Se esperaba un paso de ubicaci\u00F3n despu\u00E9s del token '/' o '//'."},
+
+ // Note to translators: A node test is part of an XPath expression that is
+ // used to test for particular kinds of nodes. In this case, a node test that
+@@ -846,7 +846,7 @@
+ "XPath necesita un objeto derivado para implantar una prueba de nodo."},
+
+ { WG_FUNCTION_TOKEN_NOT_FOUND,
+- "No se ha encontrado el elemento de funci\u00F3n."},
++ "No se ha encontrado el token de funci\u00F3n."},
+
+ { WG_COULDNOT_FIND_FUNCTION,
+ "No se ha encontrado la funci\u00F3n: {0}"},
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_fr.java,v 1.2.4.1 2005/09/15 00:39:21 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_fr.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 08:37:49 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -459,7 +459,7 @@
+ "Caract\u00E8re ',' trouv\u00E9 sans argument le suivant."},
+
+ { ER_PREDICATE_ILLEGAL_SYNTAX,
+- "Syntaxe '..[predicate]' ou '.[predicate]' non admise. Utilisez ''self::node()[predicate]'' \u00E0 la place."},
++ "Syntaxe '..[predicate]' ou '.[predicate]' non admise. Utilisez 'self::node()[predicate]' \u00E0 la place."},
+
+ { ER_ILLEGAL_AXIS_NAME,
+ "nom d''axe non admis : {0}"},
+@@ -643,7 +643,7 @@
+ // The message indicates that such an expression was expected following the
+ // characters '/' or '//', but was not found.
+ { ER_EXPECTED_REL_LOC_PATH,
+- "Un chemin d'acc\u00E8s relatif \u00E9tait attendu apr\u00E8s le jeton ''/'' ou ''//''."},
++ "Un chemin d'acc\u00E8s relatif \u00E9tait attendu apr\u00E8s le jeton '/' ou '//'."},
+
+ // Note to translators: A location path is a form of XPath expression.
+ // The message indicates that syntactically such an expression was expected,but
+@@ -661,7 +661,7 @@
+ // The message indicates that syntactically such an expression was expected
+ // following the specified characters.
+ { ER_EXPECTED_LOC_STEP,
+- "Une \u00E9tape d'emplacement \u00E9tait attendue apr\u00E8s le jeton ''/'' ou ''//''."},
++ "Une \u00E9tape d'emplacement \u00E9tait attendue apr\u00E8s le jeton '/' ou '//'."},
+
+ // Note to translators: A node test is part of an XPath expression that is
+ // used to test for particular kinds of nodes. In this case, a node test that
+@@ -674,7 +674,7 @@
+ // The message indicates that syntactically such an expression was expected,
+ // but the specified character was found in the expression instead.
+ { ER_EXPECTED_STEP_PATTERN,
+- "Un mod\u00E8le d'\u00E9tape \u00E9tait attendu, mais ''/'' a \u00E9t\u00E9 d\u00E9tect\u00E9."},
++ "Un mod\u00E8le d'\u00E9tape \u00E9tait attendu, mais '/' a \u00E9t\u00E9 d\u00E9tect\u00E9."},
+
+ // Note to translators: A relative path pattern is part of an XPath expression.
+ // The message indicates that syntactically such an expression was expected,
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_ja.java,v 1.2.4.1 2005/09/15 00:39:20 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_ja.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:16:51 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -540,7 +540,7 @@
+ "\u7121\u52B9\u306AUTF-16\u30B5\u30ED\u30B2\u30FC\u30C8\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F: {0}\u3002"},
+
+ { ER_OIERROR,
+- "\u5165\u51FA\u529B\u30A8\u30E9\u30FC"},
++ "IO\u30A8\u30E9\u30FC"},
+
+ { ER_CANNOT_CREATE_URL,
+ "{0}\u306EURL\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093"},
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_pt_BR.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,13 +3,13 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+- * http://www.apache.org/licenses/LICENSE-2.0
++ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+@@ -17,9 +17,8 @@
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-
+ /*
+- * $Id: XPATHErrorResources_pt_BR.java 3023 2011-03-01 00:53:34Z joehw $
++ * $Id: XPATHErrorResources_pt_BR.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:50:29 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -517,7 +516,7 @@
+ "O prefixo deve ser resolvido para um namespace: {0}"},
+
+ { ER_PARSE_NOT_SUPPORTED,
+- "parse (InputSource source) n\u00E3o suportado em XPathContext! N\u00E3o \u00E9 poss\u00EDvel abrir {0}"},
++ "parsing (InputSource source) n\u00E3o suportado em XPathContext! N\u00E3o \u00E9 poss\u00EDvel abrir {0}"},
+
+ { ER_SAX_API_NOT_HANDLED,
+ "Caracteres SAX API(char ch[]... n\u00E3o tratados por DTM!"},
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_sv.java,v 1.2.4.1 2005/09/15 00:39:20 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_sv.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 10:05:13 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -447,7 +447,7 @@
+ "F\u00F6rv\u00E4ntade {0}, men hittade: {1}"},
+
+ { ER_INCORRECT_PROGRAMMER_ASSERTION,
+- "Programmerarens verifiering \u00E4r inte korrekt! - {0}"},
++ "Programmerarens utsaga \u00E4r inte korrekt! - {0}"},
+
+ { ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL,
+ "Argumentet boolean(...) \u00E4r inte l\u00E4ngre valfritt med 19990709 XPath-utkast."},
+@@ -480,7 +480,7 @@
+ "Fel! Hittade inte xpath select-uttryck (-select)."},
+
+ { ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH,
+- "FEL! Kunde inte hitta ENDOP efter OP_LOCATIONPATH"},
++ "FEL! Hittade inte ENDOP efter OP_LOCATIONPATH"},
+
+ { ER_ERROR_OCCURED,
+ "Fel intr\u00E4ffade!"},
+@@ -498,7 +498,7 @@
+ "Funktionen count borde ta emot ett argument!"},
+
+ { ER_COULDNOT_FIND_FUNCTION,
+- "Kunde inte hitta funktionen: {0}"},
++ "Hittade inte funktionen: {0}"},
+
+ { ER_UNSUPPORTED_ENCODING,
+ "Kodning utan st\u00F6d: {0}"},
+@@ -567,7 +567,7 @@
+ "Felhanterare med v\u00E4rde null"},
+
+ { ER_PROG_ASSERT_UNKNOWN_OPCODE,
+- "Programmerarens verifiering: ok\u00E4nd op-kod: {0}"},
++ "Programmerarens utsaga: ok\u00E4nd op-kod: {0}"},
+
+ { ER_ZERO_OR_ONE,
+ "0 eller 1"},
+@@ -637,7 +637,7 @@
+ "{0} till\u00E5ter endast {1} argument"},
+
+ { ER_UNKNOWN_STEP,
+- "Programmerarens verifiering i getNextStepPos: ok\u00E4nt stepType: {0}"},
++ "Programmerarens utsaga i getNextStepPos: ok\u00E4nt stepType: {0}"},
+
+ //Note to translators: A relative location path is a form of XPath expression.
+ // The message indicates that such an expression was expected following the
+@@ -849,7 +849,7 @@
+ "funktionstecken hittades inte."},
+
+ { WG_COULDNOT_FIND_FUNCTION,
+- "Kunde inte hitta funktionen: {0}"},
++ "Hittade inte funktionen: {0}"},
+
+ { WG_CANNOT_MAKE_URL_FROM,
+ "Kan inte skapa URL fr\u00E5n: {0}"},
+--- ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java Mon Jan 05 11:56:34 2015 -0800
++++ ./jaxp/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java Fri Apr 10 09:20:34 2015 -0700
+@@ -3,7 +3,7 @@
+ * DO NOT REMOVE OR ALTER!
+ */
+ /*
+- * Copyright 1999-2004 The Apache Software Foundation.
++ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -18,7 +18,7 @@
+ * limitations under the License.
+ */
+ /*
+- * $Id: XPATHErrorResources_zh_CN.java,v 1.2.4.1 2005/09/15 00:39:21 jeffsuttor Exp $
++ * $Id: XPATHErrorResources_zh_CN.java /st_wptg_1.7.0.79.0jdk/1 2015/01/23 11:18:41 gmolloy Exp $
+ */
+ package com.sun.org.apache.xpath.internal.res;
+
+@@ -855,7 +855,7 @@
+ "\u65E0\u6CD5\u6839\u636E{0}\u751F\u6210 URL"},
+
+ { WG_EXPAND_ENTITIES_NOT_SUPPORTED,
+- "DTM \u8BED\u6CD5\u5206\u6790\u5668\u4E0D\u652F\u6301 -E \u9009\u9879"},
++ "DTM \u89E3\u6790\u5668\u4E0D\u652F\u6301 -E \u9009\u9879"},
+
+ { WG_ILLEGAL_VARIABLE_REFERENCE,
+ "\u4E3A\u53D8\u91CF\u7ED9\u5B9A\u7684 VariableReference \u8131\u79BB\u4E0A\u4E0B\u6587\u6216\u6CA1\u6709\u5B9A\u4E49! \u540D\u79F0 = {0}"},
+@@ -883,7 +883,7 @@
+ { "optionMatch", " [-match match pattern (for match diagnostics)]"},
+ { "optionAnyExpr", "\u6216\u8005\u4EC5 xpath \u8868\u8FBE\u5F0F\u6267\u884C\u8BCA\u65AD\u8F6C\u50A8"},
+ { "noParsermsg1", "XSL \u8FDB\u7A0B\u672A\u6210\u529F\u3002"},
+- { "noParsermsg2", "** \u627E\u4E0D\u5230\u8BED\u6CD5\u5206\u6790\u5668 **"},
++ { "noParsermsg2", "** \u627E\u4E0D\u5230\u89E3\u6790\u5668 **"},
+ { "noParsermsg3", "\u8BF7\u68C0\u67E5\u60A8\u7684\u7C7B\u8DEF\u5F84\u3002"},
+ { "noParsermsg4", "\u5982\u679C\u6CA1\u6709 IBM \u63D0\u4F9B\u7684 XML Parser for Java, \u5219\u53EF\u4EE5\u4ECE"},
+ { "noParsermsg5", "IBM AlphaWorks \u8FDB\u884C\u4E0B\u8F7D, \u7F51\u5740\u4E3A: http://www.alphaworks.ibm.com/formula/xml"},
+--- ./jaxws/.hgtags Mon Jan 05 11:56:55 2015 -0800
++++ ./jaxws/.hgtags Fri Apr 10 09:20:47 2015 -0700
+@@ -527,6 +527,10 @@
+ e33bca6f8dab3e82b2dec2c52074f19a88e1267e jdk7u72-b14
+ 587c4a3bfb76c03fa589f61e28ed739c537409bc jdk7u72-b30
+ 4257d52e30b4054c9ce43cfe830dff2b8f740037 jdk7u72-b31
++21fa73d6d8229f9b47e0e005d749f1a8f2e6773b jdk7u72-b32
++76bad2bdb262a711286dd3e564ff74a35a5e4057 jdk7u72-b33
++d696a336ab88e75a4754e33cc55d2077233274cf jdk7u72-b34
++f53c2202f0f3e71e5fce28a255c84f82c72e66af jdk7u72-b35
+ 664724762a245f1cd9d89ccd3d3833fcb16bed80 jdk7u75-b00
+ ce5b9e0d988cb52d9e6c36edeafe60bd16280534 jdk7u75-b01
+ 1b6ba791cbf7d995a81dfd1478906ebae3769ea2 jdk7u75-b02
+@@ -558,3 +562,37 @@
+ dc818936e1050f0058d35a7a27946e4e2bfb27ee jdk7u76-b12
+ a986e4b755f388532378d595831bebece7bf72c4 jdk7u76-b13
+ 260565d7fba1a2d176bd43d81b0714bd19cf4459 jdk7u76-b30
++c3d2e34987eae0eabef0f4297c6f45698251f27d jdk7u76-b31
++1861eefc3db3696d0b1871dd3bd9ab66bf9b70e7 jdk7u76-b32
++f1266833b5a07aa84d5da263f4a18503838286f4 jdk7u79-b00
++4f7ab6ef2080323109da52df2931eb661453cc74 jdk7u79-b01
++8a6d9421cc85ef5dd9549e748d2447a86ea91b46 jdk7u79-b02
++b73eefa2d0e12841f097547d1b3b15b03e8ca0df jdk7u79-b03
++931954df4985d83a044545f2606eeeacedc6d286 jdk7u79-b06
++c9c194a74632eb094b618a7d8622d6728ef48d01 jdk7u79-b07
++77da17c07509a090dfe19f742622b1bc3eaa3ed0 jdk7u79-b08
++1ddc3c2923f0c31c762a3261053969abbff0d116 jdk7u79-b09
++eed22a7e2498022e68fb19b5ac29ce72ad8032c1 jdk7u79-b10
++ed0b993ecbf0a353beae3fbfbe958da333ddc570 jdk7u79-b11
++c9c2272d9823e1ae10a2955811555a3bdb0bccb9 jdk7u79-b12
++b20bcfe401e916df6c850d7a944f18906b43f79b jdk7u79-b13
++d0bce57e5f05eead65366e2e4dbe635f1407b76d jdk7u79-b14
++5c8cec1a09708a2627930ff923e64f468c7d9000 jdk7u79-b30
++4ed47474a15acb48cd7f7fd3a4d9d3f8f457d914 jdk7u79-b15
++bef313c7ff7a7a829f8f6a305bf0c3738ad99795 jdk7u80-b00
++0eb2482c3d0663c39794ec4c268acc41c4cd387b jdk7u80-b01
++579128925dd9a0e9c529125c9e299dc0518037a5 jdk7u80-b02
++e24556d88882d7a683812d416e3409386dda4ceb jdk7u80-b03
++aaa0e97579b680842c80b0cf14c5dfd14deddbb7 jdk7u80-b04
++c104ccd5dec598e99b61ca9cb92fe4af26d450cc jdk7u80-b05
++4f6bcbad3545ab33c0aa587c80abf22b23e08162 jdk7u80-b06
++8cadb55300888be69636353d355bbcc85315f405 jdk7u80-b07
++2fb372549f5be49aba26992ea1d44121b7671fd5 jdk7u80-b08
++0fefcb506b46944f8ee42d36b2d9c22727c41ec9 jdk7u80-b09
++88edfb09289488ee4924977402f6d8949ecb8571 jdk7u80-b10
++dbb1d1057fe5005777e8796b616423ea99c0936c jdk7u80-b11
++4b6ad47f7eed058b894931e6e82117e9b1c00251 jdk7u80-b12
++f816779f033526a72e2d17ccbb1d8642639c4e50 jdk7u80-b13
++54dbf50da693ef8091e824b5d5bb1f271f753793 jdk7u80-b14
++c1bf2f665c46d0e0b514bdeb227003f98a54a561 jdk7u80-b30
++f6417ecaede6ee277f999f68e45959326dcd8f07 jdk7u80-b15
+--- ./jaxws/THIRD_PARTY_README Mon Jan 05 11:56:55 2015 -0800
++++ ./jaxws/THIRD_PARTY_README Fri Apr 10 09:20:47 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./jdk/.hgtags Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/.hgtags Fri Apr 10 09:21:28 2015 -0700
+@@ -511,6 +511,10 @@
+ f4cf053f2ed3df23b756dd182061876ac9774bc5 jdk7u72-b14
+ 6ef59d24666e8af5428706fc32295a5d088a48c9 jdk7u72-b30
+ 550c9196d41b566e01f2d164a1b5e0aba9871f5e jdk7u72-b31
++e2f6d0b84938d9ea91938f7105679b44f862ee3e jdk7u72-b32
++fb11e637716c656029b9cbcb57689d58386b4b9d jdk7u72-b33
++33ea00001116163c8a8a42f6048e285190e54a25 jdk7u72-b34
++b56e38e4693b659e5b80a396e39d66f1d17139c0 jdk7u72-b35
+ 87f9570ca734714f981d4a47477dcc6c80a7d324 jdk7u75-b00
+ 0fefa48e670a31015be985ba74e35841d0cc66c1 jdk7u75-b01
+ e885a036cc5dc0f8fa07dc0a5f55647f819f3fc5 jdk7u75-b02
+@@ -546,3 +550,35 @@
+ 9af83882ca9e628f9e35634b930081271a91d561 jdk7u76-b12
+ 1af0023da23e23482947b715fbf3bdfdee0d2813 jdk7u76-b13
+ c5567031a820910ded5f20f2d7fa21c433d744ca jdk7u76-b30
++09f3004e9b123b457da8f314aec027a5f4c3977f jdk7u76-b31
++efc8886310cbccb941f826acfad2ad51a2891be5 jdk7u80-b00
++bc7f9d966c1df3748ef9c148eab25976cd065963 jdk7u80-b01
++2590a9c18fdba19086712bb91a28352e9239a2be jdk7u80-b02
++3796111298d5b013e46d5ce49f17c16fc3197be8 jdk7u80-b03
++54acd5cd04856e80a3c7d5d38ef9c7a44d1e215a jdk7u80-b04
++45f30f5524d4eef7aa512e35d5399cc4d84af174 jdk7u79-b00
++2879572fbbb7be4d44e2bcd815711590cc6538e9 jdk7u79-b01
++643cb9ac8b38239c65404daff8cc8d501bafa610 jdk7u79-b02
++c2a53d62b3ad7eaae0087139f7764ff2054fe132 jdk7u79-b03
++10431974d072ad8a24b003373e891bc4514d0ae6 jdk7u79-b06
++e83b7d88c57654b0ebf78b5139bd74463a130525 jdk7u79-b07
++f94dd20a1efaa3b0b4345992330dfe7cddae343b jdk7u79-b08
++4fca88d471f4020266574064fa65787083ab1274 jdk7u79-b09
++a476addbc2a4c88b34e5aacfe00bfc635f895c14 jdk7u79-b10
++fd0139b86bc186ebfc2715266b70da08b0af6132 jdk7u79-b11
++ed6e798f44e1698dfe766ee9e0763e035968c3a6 jdk7u79-b12
++efc8369247fc9ace2ce2008192349e1e49949e7d jdk7u79-b13
++2471c1dfff367fd75654eaeff608f0c32caa8171 jdk7u79-b14
++da34e5f77e9e922844e7eb8d1e165d25245a8b40 jdk7u79-b30
++ea77b684d424c40f983d1aff2c9f4ef6a9c572b0 jdk7u79-b15
++f33e6ea5f4832468dd86a8d48ef50479ce91111e jdk7u80-b06
++feb04280659bf05b567dc725ff53e2a2077bdbb7 jdk7u80-b07
++f1334857fa99e6472870986b6071f9405c29ced4 jdk7u80-b08
++0f1f2eeee541517e36b0f58d5d11a7786c6c616b jdk7u80-b09
++a4e5054913cece41b8f42b7b0109779daf25b1ad jdk7u80-b10
++a2e056f646434ad434b967cd7b973d5d5404d463 jdk7u80-b11
++408f07c2baac78a1259c8168832493d5d828a4a8 jdk7u80-b12
++84c9465241bf7152f8277ad4f39c8fb0bf045977 jdk7u80-b13
++d5fb2dd3be5f3f65b8bbbf0965f3686a83c045b1 jdk7u80-b14
++75fb0553cc146fb238df4e93dbe90791435e84f9 jdk7u80-b30
++daa5092b07a75c17356bb438adba03f83f94ef17 jdk7u80-b15
+--- ./jdk/THIRD_PARTY_README Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/THIRD_PARTY_README Fri Apr 10 09:21:28 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+--- ./jdk/make/Makefile Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1995, 2014, 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
+@@ -232,7 +232,7 @@
+
+ all build:: sanity-all post-sanity-all
+
+-SUBDIRS = tools java javax sun com
++SUBDIRS = tools java javax jdk sun com
+ ifeq ($(PLATFORM), macosx)
+ SUBDIRS += apple
+ endif
+--- ./jdk/make/common/Defs.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/common/Defs.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1995, 2014, 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
+@@ -213,7 +213,7 @@
+ #
+ # zlib version
+ #
+-ZLIB_VERSION = 1.2.3
++ZLIB_VERSION = 1.2.8
+
+
+ #
+--- ./jdk/make/common/Program.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/common/Program.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1995, 2014, 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
+@@ -357,10 +357,10 @@
+ ifeq ($(PLATFORM), macosx)
+ OTHER_INCLUDES += -I$(LAUNCHER_SOLARIS_PLATFORM_SRC)/bin
+ ifneq ($(SYSTEM_ZLIB), true)
+- OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
++ OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.2.8
+ endif # SYSTEM_ZLIB
+ else # PLATFORM !MACOSX
+- OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
++ OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.2.8
+ endif
+
+ OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"'
+--- ./jdk/make/common/shared/Defs-javadoc.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/common/shared/Defs-javadoc.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -43,6 +43,7 @@
+ TREEAPI_FIRST_COPYRIGHT_YEAR = 2005
+ JNLP_FIRST_COPYRIGHT_YEAR = 1998
+ PLUGIN2_FIRST_COPYRIGHT_YEAR = 2007
++JDKNET_FIRST_COPYRIGHT_YEAR = 2014
+
+ # Oracle name
+ FULL_COMPANY_NAME = Oracle and/or its affiliates
+--- ./jdk/make/docs/Makefile Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/docs/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -1,4 +1,4 @@
+-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1997, 2014, 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
+@@ -836,6 +836,56 @@
+
+ #############################################################
+ #
++# jdk.net docs
++#
++
++ALL_OTHER_TARGETS += jdknetdocs
++
++JDKNET_DOCDIR := $(JRE_API_DOCSDIR)/net/socketoptions/spec
++JDKNET2COREAPI := ../../../$(JDKJRE2COREAPI)
++JDKNET_DOCTITLE := jdk.net API
++JDKNET_WINDOWTITLE := jdk.net API
++JDKNET_HEADER := <strong>jdk.net API</strong>
++JDKNET_BOTTOM := $(call CommonBottom,$(JDKNET_FIRST_COPYRIGHT_YEAR))
++# JDKNET_PKGS is located in NON_CORE_PKGS.gmk
++
++JDKNET_INDEX_HTML = $(JDKNET_DOCDIR)/index.html
++JDKNET_OPTIONS_FILE = $(DOCSTMPDIR)/jdknet.options
++JDKNET_PACKAGES_FILE = $(DOCSTMPDIR)/jdknet.packages
++
++jdknetdocs: $(JDKNET_INDEX_HTML)
++
++# Set relative location to core api document root
++$(JDKNET_INDEX_HTML): GET2DOCSDIR=$(JDKNET2COREAPI)/..
++
++# Run javadoc if the index file is out of date or missing
++$(JDKNET_INDEX_HTML): $(JDKNET_OPTIONS_FILE) $(JDKNET_PACKAGES_FILE)
++ $(prep-javadoc)
++ $(call JavadocSummary,$(JDKNET_OPTIONS_FILE),$(JDKNET_PACKAGES_FILE))
++ $(JAVADOC_CMD) $(JAVADOC_VM_MEMORY_FLAGS) -d $(@D) \
++ @$(JDKNET_OPTIONS_FILE) @$(JDKNET_PACKAGES_FILE)
++
++# Create file with javadoc options in it
++$(JDKNET_OPTIONS_FILE):
++ $(prep-target)
++ @($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
++ $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
++ $(call OptionPair,-encoding,ascii) ; \
++ $(call OptionOnly,-nodeprecatedlist) ; \
++ $(call OptionPair,-doctitle,$(JDKNET_DOCTITLE)) ; \
++ $(call OptionPair,-windowtitle,$(JDKNET_WINDOWTITLE) $(DRAFT_WINTITLE));\
++ $(call OptionPair,-header,$(JDKNET_HEADER)$(DRAFT_HEADER)); \
++ $(call OptionPair,-bottom,$(JDKNET_BOTTOM)$(DRAFT_BOTTOM)); \
++ $(call OptionTrip,-linkoffline,$(JDKNET2COREAPI),$(COREAPI_DOCSDIR)/); \
++ ) >> $@
++
++# Create a file with the package names in it
++$(JDKNET_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(JDKNET_PKGS))
++ $(prep-target)
++ $(call PackageFilter,$(JDKNET_PKGS))
++
++#############################################################
++#
+ # httpserverdocs
+ #
+
+--- ./jdk/make/docs/NON_CORE_PKGS.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/docs/NON_CORE_PKGS.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -62,6 +62,8 @@
+
+ OLD_JSSE_PKGS = com.sun.net.ssl
+
++JDKNET_PKGS = jdk.net
++
+ HTTPSERVER_PKGS = com.sun.net.httpserver \
+ com.sun.net.httpserver.spi
+
+@@ -99,6 +101,7 @@
+ NON_CORE_PKGS = $(DOMAPI_PKGS) \
+ $(MGMT_PKGS) \
+ $(JAAS_PKGS) \
++ $(JDKNET_PKGS) \
+ $(JGSS_PKGS) \
+ $(NIO_PKGS) \
+ $(OLD_JSSE_PKGS) \
+--- ./jdk/make/java/net/FILES_c.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/java/net/FILES_c.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -26,6 +26,7 @@
+ FILES_c = \
+ AbstractPlainDatagramSocketImpl.c \
+ DatagramPacket.c \
++ ExtendedOptionsImpl.c \
+ InetAddress.c \
+ Inet4Address.c \
+ Inet6Address.c \
+--- ./jdk/make/java/net/mapfile-vers Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/java/net/mapfile-vers Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1997, 2014, 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
+@@ -96,6 +96,10 @@
+ Java_sun_net_sdp_SdpSupport_create0;
+ Java_sun_net_spi_DefaultProxySelector_init;
+ Java_sun_net_spi_DefaultProxySelector_getSystemProxy;
++ Java_sun_net_ExtendedOptionsImpl_init;
++ Java_sun_net_ExtendedOptionsImpl_setFlowOption;
++ Java_sun_net_ExtendedOptionsImpl_getFlowOption;
++ Java_sun_net_ExtendedOptionsImpl_flowSupported;
+ NET_AllocSockaddr;
+ NET_SockaddrToInetAddress;
+ NET_SockaddrEqualsInetAddress;
+@@ -106,6 +110,8 @@
+ NET_Bind;
+ NET_MapSocketOption;
+ NET_Wait;
++ NET_EnableFastTcpLoopback;
++ NET_ThrowNew;
+ ipv6_available;
+
+ local:
+--- ./jdk/make/java/nio/Makefile Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/java/nio/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -380,6 +380,8 @@
+ -libpath:$(LIBDIR) java.lib \
+ $(OBJDIR)/../../../../sun/java.net/net/$(OBJDIRNAME)/net.lib \
+ $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/io_util.obj \
++ $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/io_util_md.obj \
++ $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/canonicalize_md.obj \
+ $(OBJDIR)/../../../java.lang/java/$(OBJDIRNAME)/FileDescriptor_md.obj
+ endif
+ ifeq ($(PLATFORM), linux)
+--- ./jdk/make/java/zip/FILES_c.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/java/zip/FILES_c.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1996, 2014, 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
+@@ -35,7 +35,6 @@
+ FILES_c += \
+ compress.c \
+ deflate.c \
+- gzio.c \
+ infback.c \
+ inffast.c \
+ inflate.c \
+--- ./jdk/make/java/zip/Makefile Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/java/zip/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -68,6 +68,16 @@
+ FILES_reorder += reorder-$(ARCH)
+ endif
+ endif
++
++#
++# Use mapfile unconditionally (even with fastdebug).
++# JDK's internal zlib is incompatible with stock zlib, because the
++# size of struct z_stream has been changed, so internal zlib
++# implementation must not be allowed to leak outside of libzip.so,
++# else you get hard to debug failures with fastdebug jdk when user
++# native code includes stock zlib.
++#
++FILES_m = mapfile-vers
+ include $(BUILDDIR)/common/Mapfile-vers.gmk
+ include $(BUILDDIR)/common/Library.gmk
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/make/jdk/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,40 @@
++#
++# Copyright (c) 2014, 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
++# particular file as subject to the "Classpath" exception as provided
++# by Oracle in the LICENSE file that accompanied this code.
++#
++# 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.
++#
++
++#
++# Makefile for building jdk sub dir
++#
++
++BUILDDIR = ..
++PRODUCT = jdk
++include $(BUILDDIR)/common/Defs.gmk
++
++SUBDIRS = net
++
++include $(BUILDDIR)/common/Subdirs.gmk
++
++all build clean clobber::
++ $(SUBDIRS-loop)
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/make/jdk/net/FILES_java.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,30 @@
++#
++# Copyright (c) 2014, 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
++# particular file as subject to the "Classpath" exception as provided
++# by Oracle in the LICENSE file that accompanied this code.
++#
++# 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.
++#
++
++FILES_java = \
++ jdk/net/ExtendedSocketOptions.java \
++ jdk/net/NetworkPermission.java \
++ jdk/net/SocketFlow.java \
++ jdk/net/Sockets.java
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/make/jdk/net/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,43 @@
++#
++# Copyright (c) 2014, 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
++# particular file as subject to the "Classpath" exception as provided
++# by Oracle in the LICENSE file that accompanied this code.
++#
++# 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.
++#
++
++#
++# Makefile for building jdk.net classes
++#
++
++BUILDDIR = ../..
++PACKAGE = jdk.net
++PRODUCT = sun
++include $(BUILDDIR)/common/Defs.gmk
++
++#
++# Files to compile.
++#
++AUTO_FILES_JAVA_DIRS = jdk/net
++
++#
++# Rules.
++#
++include $(BUILDDIR)/common/Classes.gmk
+--- ./jdk/make/jprt.properties Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/jprt.properties Fri Apr 10 09:21:28 2015 -0700
+@@ -81,6 +81,7 @@
+ ${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
++ ${jprt.my.test.target.set:TESTNAME=jdk_security4}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_management}, \
+ ${jprt.my.test.target.set:TESTNAME=jdk_jmx}, \
+--- ./jdk/make/sun/javazic/tzdata/VERSION Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/VERSION Fri Apr 10 09:21:28 2015 -0700
+@@ -21,4 +21,4 @@
+ # or visit www.oracle.com if you need additional information or have any
+ # questions.
+ #
+-tzdata2014j
++tzdata2015a
+--- ./jdk/make/sun/javazic/tzdata/antarctica Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/antarctica Fri Apr 10 09:21:28 2015 -0700
+@@ -70,8 +70,8 @@
+ Rule ChileAQ 2010 only - Apr Sun>=1 3:00u 0 -
+ Rule ChileAQ 2011 only - May Sun>=2 3:00u 0 -
+ Rule ChileAQ 2011 only - Aug Sun>=16 4:00u 1:00 S
+-Rule ChileAQ 2012 max - Apr Sun>=23 3:00u 0 -
+-Rule ChileAQ 2012 max - Sep Sun>=2 4:00u 1:00 S
++Rule ChileAQ 2012 2015 - Apr Sun>=23 3:00u 0 -
++Rule ChileAQ 2012 2014 - Sep Sun>=2 4:00u 1:00 S
+
+ # Argentina - year-round bases
+ # Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
+@@ -377,9 +377,10 @@
+ #
+ # Zone NAME GMTOFF RULES FORMAT [UNTIL]
+ Zone Antarctica/Palmer 0 - zzz 1965
+- -4:00 ArgAQ AR%sT 1969 Oct 5
++ -4:00 ArgAQ AR%sT 1969 Oct 5
+ -3:00 ArgAQ AR%sT 1982 May
+- -4:00 ChileAQ CL%sT
++ -4:00 ChileAQ CL%sT 2015 Apr 26 3:00u
++ -3:00 - CLT
+ #
+ #
+ # McMurdo Station, Ross Island, since 1955-12
+--- ./jdk/make/sun/javazic/tzdata/asia Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/asia Fri Apr 10 09:21:28 2015 -0700
+@@ -168,10 +168,7 @@
+ 4:00 Azer AZ%sT
+
+ # Bahrain
+-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+-Zone Asia/Bahrain 3:22:20 - LMT 1920 # Manamah
+- 4:00 - GST 1972 Jun
+- 3:00 - AST
++# See Asia/Qatar.
+
+ # Bangladesh
+ # From Alexander Krivenyshev (2009-05-13):
+@@ -1754,9 +1751,7 @@
+ ###############################################################################
+
+ # Kuwait
+-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+-Zone Asia/Kuwait 3:11:56 - LMT 1950
+- 3:00 - AST
++# See Asia/Riyadh.
+
+ # Laos
+ # See Asia/Bangkok.
+@@ -1977,12 +1972,7 @@
+ 5:45 - NPT # Nepal Time
+
+ # Oman
+-
+-# Milne says 3:54:24 was the meridian of the Muscat Tidal Observatory.
+-
+-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+-Zone Asia/Muscat 3:54:24 - LMT 1920
+- 4:00 - GST
++# See Asia/Dubai.
+
+ # Pakistan
+
+@@ -2476,6 +2466,7 @@
+ Zone Asia/Qatar 3:26:08 - LMT 1920 # Al Dawhah / Doha
+ 4:00 - GST 1972 Jun
+ 3:00 - AST
++Link Asia/Qatar Asia/Bahrain
+
+ # Saudi Arabia
+ #
+@@ -2502,6 +2493,8 @@
+ # Zone NAME GMTOFF RULES FORMAT [UNTIL]
+ Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14
+ 3:00 - AST
++Link Asia/Riyadh Asia/Aden # Yemen
++Link Asia/Riyadh Asia/Kuwait
+
+ # Singapore
+ # taken from Mok Ly Yng (2003-10-30)
+@@ -2790,6 +2783,7 @@
+ # Zone NAME GMTOFF RULES FORMAT [UNTIL]
+ Zone Asia/Dubai 3:41:12 - LMT 1920
+ 4:00 - GST
++Link Asia/Dubai Asia/Muscat # Oman
+
+ # Uzbekistan
+ # Byalokoz 1919 says Uzbekistan was 4:27:53.
+@@ -2874,10 +2868,4 @@
+ 7:00 - ICT
+
+ # Yemen
+-
+-# Milne says 2:59:54 was the meridian of the saluting battery at Aden,
+-# and that Yemen was at 1:55:56, the meridian of the Hagia Sophia.
+-
+-# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+-Zone Asia/Aden 2:59:54 - LMT 1950
+- 3:00 - AST
++# See Asia/Riyadh.
+--- ./jdk/make/sun/javazic/tzdata/backward Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/backward Fri Apr 10 09:21:28 2015 -0700
+@@ -28,7 +28,7 @@
+ # and their old names. Many names changed in late 1993.
+
+ # Link TARGET LINK-NAME
+-Link Africa/Asmara Africa/Asmera
++Link Africa/Nairobi Africa/Asmera
+ Link Africa/Abidjan Africa/Timbuktu
+ Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
+ Link America/Adak America/Atka
+--- ./jdk/make/sun/javazic/tzdata/europe Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/europe Fri Apr 10 09:21:28 2015 -0700
+@@ -1430,35 +1430,32 @@
+ # might be a reference to the Julian calendar as opposed to Gregorian, or it
+ # might mean something else (???).
+ #
+-# From Paul Eggert (2006-03-22):
+-# The Iceland Almanak, Shanks & Pottenger, and Whitman disagree on many points.
+-# We go with the Almanak, except for one claim from Shanks & Pottenger, namely
+-# that Reykavik was 21W57 from 1837 to 1908, local mean time before that.
++# From Paul Eggert (2014-11-22):
++# The information below is taken from the 1988 Almanak; see
++# http://www.almanak.hi.is/klukkan.html
+ #
+ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+-Rule Iceland 1917 1918 - Feb 19 23:00 1:00 S
++Rule Iceland 1917 1919 - Feb 19 23:00 1:00 S
+ Rule Iceland 1917 only - Oct 21 1:00 0 -
+-Rule Iceland 1918 only - Nov 16 1:00 0 -
++Rule Iceland 1918 1919 - Nov 16 1:00 0 -
++Rule Iceland 1921 only - Mar 19 23:00 1:00 S
++Rule Iceland 1921 only - Jun 23 1:00 0 -
+ Rule Iceland 1939 only - Apr 29 23:00 1:00 S
+-Rule Iceland 1939 only - Nov 29 2:00 0 -
++Rule Iceland 1939 only - Oct 29 2:00 0 -
+ Rule Iceland 1940 only - Feb 25 2:00 1:00 S
+-Rule Iceland 1940 only - Nov 3 2:00 0 -
+-Rule Iceland 1941 only - Mar 2 1:00s 1:00 S
+-Rule Iceland 1941 only - Nov 2 1:00s 0 -
+-Rule Iceland 1942 only - Mar 8 1:00s 1:00 S
+-Rule Iceland 1942 only - Oct 25 1:00s 0 -
++Rule Iceland 1940 1941 - Nov Sun>=2 1:00s 0 -
++Rule Iceland 1941 1942 - Mar Sun>=2 1:00s 1:00 S
+ # 1943-1946 - first Sunday in March until first Sunday in winter
+ Rule Iceland 1943 1946 - Mar Sun>=1 1:00s 1:00 S
+-Rule Iceland 1943 1948 - Oct Sun>=22 1:00s 0 -
++Rule Iceland 1942 1948 - Oct Sun>=22 1:00s 0 -
+ # 1947-1967 - first Sunday in April until first Sunday in winter
+ Rule Iceland 1947 1967 - Apr Sun>=1 1:00s 1:00 S
+-# 1949 Oct transition delayed by 1 week
++# 1949 and 1967 Oct transitions delayed by 1 week
+ Rule Iceland 1949 only - Oct 30 1:00s 0 -
+ Rule Iceland 1950 1966 - Oct Sun>=22 1:00s 0 -
+ Rule Iceland 1967 only - Oct 29 1:00s 0 -
+ # Zone NAME GMTOFF RULES FORMAT [UNTIL]
+-Zone Atlantic/Reykjavik -1:27:24 - LMT 1837
+- -1:27:48 - RMT 1908 # Reykjavik Mean Time?
++Zone Atlantic/Reykjavik -1:28 - LMT 1908
+ -1:00 Iceland IS%sT 1968 Apr 7 1:00s
+ 0:00 - GMT
+
+--- ./jdk/make/sun/javazic/tzdata/leapseconds Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/leapseconds Fri Apr 10 09:21:28 2015 -0700
+@@ -77,3 +77,7 @@
+ Leap 2005 Dec 31 23:59:60 + S
+ Leap 2008 Dec 31 23:59:60 + S
+ Leap 2012 Jun 30 23:59:60 + S
++Leap 2015 Jun 30 23:59:60 + S
++
++# Updated through IERS Bulletin C49
++# File expires on: 28 December 2015
+--- ./jdk/make/sun/javazic/tzdata/northamerica Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/northamerica Fri Apr 10 09:21:28 2015 -0700
+@@ -147,7 +147,7 @@
+ Rule US 1918 1919 - Oct lastSun 2:00 0 S
+ Rule US 1942 only - Feb 9 2:00 1:00 W # War
+ Rule US 1945 only - Aug 14 23:00u 1:00 P # Peace
+-Rule US 1945 only - Sep 30 2:00 0 S
++Rule US 1945 only - Sep lastSun 2:00 0 S
+ Rule US 1967 2006 - Oct lastSun 2:00 0 S
+ Rule US 1967 1973 - Apr lastSun 2:00 1:00 D
+ Rule US 1974 only - Jan 6 2:00 1:00 D
+@@ -2147,11 +2147,11 @@
+
+ # Mexico
+
+-# From Paul Eggert (2001-03-05):
++# From Paul Eggert (2014-12-07):
+ # The Investigation and Analysis Service of the
+ # Mexican Library of Congress (MLoC) has published a
+ # history of Mexican local time (in Spanish)
+-# http://www.cddhcu.gob.mx/bibliot/publica/inveyana/polisoc/horver/
++# http://www.diputados.gob.mx/bibliot/publica/inveyana/polisoc/horver/index.htm
+ #
+ # Here are the discrepancies between Shanks & Pottenger (S&P) and the MLoC.
+ # (In all cases we go with the MLoC.)
+@@ -2320,6 +2320,24 @@
+ # efecto desde las dos horas del segundo domingo de marzo y concluirá a
+ # las dos horas del primer domingo de noviembre.
+
++# From Steffen Thorsen (2014-12-08), translated by Gwillim Law:
++# The Mexican state of Quintana Roo will likely change to EST in 2015.
++#
++# http://www.unioncancun.mx/articulo/2014/12/04/medio-ambiente/congreso-aprueba-una-hora-mas-de-sol-en-qroo
++# "With this change, the time conflict that has existed between the municipios
++# of Quintana Roo and the municipio of Felipe Carrillo Puerto may come to an
++# end. The latter declared itself in rebellion 15 years ago when a time change
++# was initiated in Mexico, and since then it has refused to change its time
++# zone along with the rest of the country."
++#
++# From Steffen Thorsen (2015-01-14), translated by Gwillim Law:
++# http://sipse.com/novedades/confirman-aplicacion-de-nueva-zona-horaria-para-quintana-roo-132331.html
++# "...the new time zone will come into effect at two o'clock on the first Sunday
++# of February, when we will have to advance the clock one hour from its current
++# time..."
++#
++# Also, the new zone will not use DST.
++
+ # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+ Rule Mexico 1939 only - Feb 5 0:00 1:00 D
+ Rule Mexico 1939 only - Jun 25 0:00 0 S
+@@ -2340,7 +2358,8 @@
+ Zone America/Cancun -5:47:04 - LMT 1922 Jan 1 0:12:56
+ -6:00 - CST 1981 Dec 23
+ -5:00 Mexico E%sT 1998 Aug 2 2:00
+- -6:00 Mexico C%sT
++ -6:00 Mexico C%sT 2015 Feb 1 2:00
++ -5:00 - EST
+ # Campeche, Yucatán; represented by Mérida
+ Zone America/Merida -5:58:28 - LMT 1922 Jan 1 0:01:32
+ -6:00 - CST 1981 Dec 23
+--- ./jdk/make/sun/javazic/tzdata/southamerica Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/southamerica Fri Apr 10 09:21:28 2015 -0700
+@@ -1229,6 +1229,11 @@
+ # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
+ # http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
+
++# From Juan Correa (2015-01-28):
++# ... today the Ministry of Energy announced that Chile will drop DST, will keep
++# "summer time" (UTC -3 / UTC -5) all year round....
++# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
++
+ # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
+ # 'antarctica' file.
+
+@@ -1270,8 +1275,8 @@
+ Rule Chile 2010 only - Apr Sun>=1 3:00u 0 -
+ Rule Chile 2011 only - May Sun>=2 3:00u 0 -
+ Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 S
+-Rule Chile 2012 max - Apr Sun>=23 3:00u 0 -
+-Rule Chile 2012 max - Sep Sun>=2 4:00u 1:00 S
++Rule Chile 2012 2015 - Apr Sun>=23 3:00u 0 -
++Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 S
+ # IATA SSIM anomalies: (1992-02) says 1992-03-14;
+ # (1996-09) says 1998-03-08. Ignore these.
+ # Zone NAME GMTOFF RULES FORMAT [UNTIL]
+@@ -1282,11 +1287,13 @@
+ -4:00 - CLT 1919 Jul 1 # Chile Time
+ -4:42:46 - SMT 1927 Sep 1 # Santiago Mean Time
+ -5:00 Chile CL%sT 1947 May 22 # Chile Time
+- -4:00 Chile CL%sT
++ -4:00 Chile CL%sT 2015 Apr 26 3:00u
++ -3:00 - CLT
+ Zone Pacific/Easter -7:17:44 - LMT 1890
+ -7:17:28 - EMT 1932 Sep # Easter Mean Time
+- -7:00 Chile EAS%sT 1982 Mar 13 21:00 # Easter Time
+- -6:00 Chile EAS%sT
++ -7:00 Chile EAS%sT 1982 Mar 13 3:00u # Easter Time
++ -6:00 Chile EAS%sT 2015 Apr 26 3:00u
++ -5:00 - EAST
+ #
+ # Salas y Gómez Island is uninhabited.
+ # Other Chilean locations, including Juan Fernández Is, Desventuradas Is,
+--- ./jdk/make/sun/javazic/tzdata/zone.tab Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/javazic/tzdata/zone.tab Fri Apr 10 09:21:28 2015 -0700
+@@ -297,7 +297,7 @@
+ MV +0410+07330 Indian/Maldives
+ MW -1547+03500 Africa/Blantyre
+ MX +1924-09909 America/Mexico_City Central Time - most locations
+-MX +2105-08646 America/Cancun Central Time - Quintana Roo
++MX +2105-08646 America/Cancun Eastern Standard Time - Quintana Roo
+ MX +2058-08937 America/Merida Central Time - Campeche, Yucatan
+ MX +2540-10019 America/Monterrey Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
+ MX +2550-09730 America/Matamoros US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
+--- ./jdk/make/sun/net/FILES_java.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/net/FILES_java.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -24,6 +24,7 @@
+ #
+
+ FILES_java = \
++ sun/net/ExtendedOptionsImpl.java \
+ sun/net/InetAddressCachePolicy.java \
+ sun/net/URLCanonicalizer.java \
+ sun/net/NetworkClient.java \
+--- ./jdk/make/sun/splashscreen/FILES_c.gmk Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/sun/splashscreen/FILES_c.gmk Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 2005, 2014, 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
+@@ -98,7 +98,10 @@
+ FILES_c += \
+ compress.c \
+ deflate.c \
+- gzio.c \
++ gzclose.c \
++ gzlib.c \
++ gzread.c \
++ gzwrite.c \
+ infback.c \
+ inffast.c \
+ inflate.c \
+--- ./jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/tools/src/build/tools/generatecurrencydata/GenerateCurrencyData.java Fri Apr 10 09:21:28 2015 -0700
+@@ -281,8 +281,8 @@
+ checkCurrencyCode(newCurrency);
+ String timeString = currencyInfo.substring(4, length - 4);
+ long time = format.parse(timeString).getTime();
+- if (Math.abs(time - System.currentTimeMillis()) > ((long) 20) * 365 * 24 * 60 * 60 * 1000) {
+- throw new RuntimeException("time is more than 10 years from present: " + time + " " + timeString + " " + currencyInfo);
++ if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) * 365 * 24 * 60 * 60 * 1000) {
++ throw new RuntimeException("time is more than 10 years from present: " + time);
+ }
+ specialCaseCutOverTimes[specialCaseCount] = time;
+ specialCaseOldCurrencies[specialCaseCount] = oldCurrency;
+--- ./jdk/make/tools/src/build/tools/javazic/Zoneinfo.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/tools/src/build/tools/javazic/Zoneinfo.java Fri Apr 10 09:21:28 2015 -0700
+@@ -376,6 +376,7 @@
+ ZoneRec zrec = zone.get(zone.size()-1);
+ tz.getOffsetIndex(zrec.getGmtOffset());
+
++ int lastGmtOffsetValue = -1;
+ int currentSave = 0;
+ boolean usedZone;
+ for (int zindex = 0; zindex < zone.size(); zindex++) {
+@@ -384,9 +385,12 @@
+ gmtOffset = zrec.getGmtOffset();
+ int stdOffset = zrec.getDirectSave();
+
++ if (gmtOffset != lastGmtOffsetValue) {
++ tz.setRawOffset(gmtOffset, fromTime);
++ lastGmtOffsetValue = gmtOffset;
++ }
+ // If this is the last zone record, take the last rule info.
+ if (!zrec.hasUntil()) {
+- tz.setRawOffset(gmtOffset, fromTime);
+ if (zrec.hasRuleReference()) {
+ tz.setLastRules(zrec.getRuleRef().getLastRules());
+ } else if (stdOffset != 0) {
+--- ./jdk/make/tools/swing-beans/SwingBeanInfo.template Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/make/tools/swing-beans/SwingBeanInfo.template Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2015, 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
+@@ -28,6 +28,7 @@
+ import java.beans.BeanDescriptor;
+ import java.beans.PropertyDescriptor;
+ import java.awt.Image;
++import java.security.PrivilegedAction;
+
+ import sun.swing.BeanInfoUtils;
+
+@@ -92,25 +93,42 @@
+ /**
+ * @return an icon of the specified kind for @(BeanClassName)
+ */
+- public Image getIcon(int kind) {
++ public Image getIcon(final int kind) {
+ Image i;
+ switch (kind){
+ case ICON_COLOR_32x32:
+- i = loadImage("beaninfo/images/@(BeanClassName)Color32.gif");
+- return ((i == null) ? loadImage("beaninfo/images/JComponentColor32.gif") : i);
++ i = loadStandardImage("beaninfo/images/@(BeanClassName)Color32.gif");
++ return ((i == null) ? loadStandardImage("beaninfo/images/JComponentColor32.gif") : i);
+ case ICON_COLOR_16x16:
+- i = loadImage("beaninfo/images/@(BeanClassName)Color16.gif");
+- return ((i == null) ? loadImage("beaninfo/images/JComponentColor16.gif") : i);
++ i = loadStandardImage("beaninfo/images/@(BeanClassName)Color16.gif");
++ return ((i == null) ? loadStandardImage("beaninfo/images/JComponentColor16.gif") : i);
+ case ICON_MONO_32x32:
+- i = loadImage("beaninfo/images/@(BeanClassName)Mono32.gif");
+- return ((i == null) ? loadImage("beaninfo/images/JComponentMono32.gif") : i);
++ i = loadStandardImage("beaninfo/images/@(BeanClassName)Mono32.gif");
++ return ((i == null) ? loadStandardImage("beaninfo/images/JComponentMono32.gif") : i);
+ case ICON_MONO_16x16:
+- i = loadImage("beaninfo/images/@(BeanClassName)Mono16.gif");
+- return ((i == null) ? loadImage("beaninfo/images/JComponentMono16.gif") : i);
++ i = loadStandardImage("beaninfo/images/@(BeanClassName)Mono16.gif");
++ return ((i == null) ? loadStandardImage("beaninfo/images/JComponentMono16.gif") : i);
+ default:
+ return super.getIcon(kind);
+ }
+ }
++
++ /**
++ * This is a utility method to help in loading standard icon images.
++ *
++ * @param resourceName A pathname relative to the directory holding the
++ * class file of the current class
++ * @return an image object. May be null if the load failed.
++ * @see java.beans.SimpleBeanInfo#loadImage(String)
++ */
++ private Image loadStandardImage(final String resourceName) {
++ return (Image) java.security.AccessController.doPrivileged(
++ new PrivilegedAction() {
++ public Object run() {
++ return loadImage(resourceName);
++ }
++ });
++ }
+ }
+
+
+--- ./jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Apr 10 09:21:28 2015 -0700
+@@ -674,6 +674,13 @@
+ @Override // PlatformWindow
+ public void toFront() {
+ final long nsWindowPtr = getNSWindowPtr();
++ LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
++ Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
++ if( w != null && w.getPeer() != null
++ && ((LWWindowPeer)w.getPeer()).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
++ && !lwcToolkit.isApplicationActive()) {
++ lwcToolkit.activateApplicationIgnoringOtherApps();
++ }
+ updateFocusabilityForAutoRequestFocus(false);
+ nativePushNSWindowToFront(nsWindowPtr);
+ updateFocusabilityForAutoRequestFocus(true);
+--- ./jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Fri Apr 10 09:21:28 2015 -0700
+@@ -203,6 +203,10 @@
+
+
+ setAttributes(attributes);
++ // throw exception for invalid destination
++ if (destinationAttr != null) {
++ validateDestination(destinationAttr);
++ }
+
+ /* Get the range of pages we are to print. If the
+ * last page to print is unknown, then we print to
+--- ./jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Fri Apr 10 09:21:28 2015 -0700
+@@ -700,6 +700,11 @@
+ */
+ public native boolean isApplicationActive();
+
++ /*
++ * Activates application ignoring other apps.
++ */
++ public native void activateApplicationIgnoringOtherApps();
++
+ /************************
+ * Native methods section
+ ************************/
+--- ./jdk/src/macosx/native/sun/awt/LWCToolkit.m Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/macosx/native/sun/awt/LWCToolkit.m Fri Apr 10 09:21:28 2015 -0700
+@@ -392,6 +392,23 @@
+ return active;
+ }
+
++/*
++ * Class: sun_lwawt_macosx_LWCToolkit
++ * Method: activateApplicationIgnoringOtherApps
++ * Signature: ()V
++ */
++JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_activateApplicationIgnoringOtherApps
++(JNIEnv *env, jclass clazz)
++{
++ JNF_COCOA_ENTER(env);
++ [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
++ if(![NSApp isActive]){
++ [NSApp activateIgnoringOtherApps:YES];
++ }
++ }];
++ JNF_COCOA_EXIT(env);
++}
++
+
+ /*
+ * Class: sun_awt_SunToolkit
+--- ./jdk/src/macosx/native/sun/font/AWTStrike.m Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/macosx/native/sun/font/AWTStrike.m Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2011, 2014, 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
+@@ -25,14 +25,11 @@
+
+ #import <JavaNativeFoundation/JavaNativeFoundation.h>
+ #import "java_awt_geom_PathIterator.h"
+-#import "sun_awt_SunHints.h"
+ #import "sun_font_CStrike.h"
+ #import "sun_font_CStrikeDisposer.h"
+ #import "CGGlyphImages.h"
+ #import "CGGlyphOutlines.h"
+-#import "AWTStrike.h"
+ #import "CoreTextSupport.h"
+-//#import "jni_util.h"
+ #include "fontscalerdefs.h"
+
+ @implementation AWTStrike
+@@ -60,10 +57,10 @@
+ invDevTx.b *= -1;
+ invDevTx.c *= -1;
+ fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX);
+- fDevTx = CGAffineTransformInvert(invDevTx);
++ fDevTx = CGAffineTransformInvert(CGAffineTransformConcat(invDevTx, sInverseTX));
+
+ // the "font size" is the square root of the determinant of the matrix
+- fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
++ fSize = sqrt(fabs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
+ }
+ return self;
+ }
+--- ./jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/com/sun/crypto/provider/RSACipher.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2015, 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
+@@ -351,7 +351,7 @@
+ switch (mode) {
+ case MODE_SIGN:
+ data = padding.pad(buffer, 0, bufOfs);
+- return RSACore.rsa(data, privateKey);
++ return RSACore.rsa(data, privateKey, true);
+ case MODE_VERIFY:
+ byte[] verifyBuffer = RSACore.convert(buffer, 0, bufOfs);
+ data = RSACore.rsa(verifyBuffer, publicKey);
+@@ -361,7 +361,7 @@
+ return RSACore.rsa(data, publicKey);
+ case MODE_DECRYPT:
+ byte[] decryptBuffer = RSACore.convert(buffer, 0, bufOfs);
+- data = RSACore.rsa(decryptBuffer, privateKey);
++ data = RSACore.rsa(decryptBuffer, privateKey, false);
+ return padding.unpad(data);
+ default:
+ throw new AssertionError("Internal error");
+--- ./jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,6 +31,8 @@
+ import java.awt.KeyEventPostProcessor;
+ import java.awt.Window;
+ import java.awt.Toolkit;
++
++import sun.awt.AWTAccessor;
+ import sun.awt.SunToolkit;
+
+ import java.awt.event.ActionEvent;
+@@ -133,10 +135,15 @@
+ // window. If this time appears to be greater than the altRelease
+ // event time the event is skipped to avoid unexpected menu
+ // activation. See 7121442.
++ // Also we must ensure that original source of key event belongs
++ // to the same window object as winAncestor. See 8001633.
+ boolean skip = false;
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ if (tk instanceof SunToolkit) {
+- skip = ev.getWhen() <= ((SunToolkit)tk).getWindowDeactivationTime(winAncestor);
++ Component originalSource = AWTAccessor.getKeyEventAccessor()
++ .getOriginalSource(ev);
++ skip = SunToolkit.getContainingWindow(originalSource) != winAncestor ||
++ ev.getWhen() <= ((SunToolkit) tk).getWindowDeactivationTime(winAncestor);
+ }
+
+ if (menu != null && !skip) {
+--- ./jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri Apr 10 09:21:28 2015 -0700
+@@ -460,14 +460,16 @@
+ rber = ldr.getReplyBer();
+ if (rber == null) {
+ if (readTimeout > 0) { // Socket read timeout is specified
+-
+ // will be woken up before readTimeout only if reply is
+ // available
+ ldr.wait(readTimeout);
++ waited = true;
+ } else {
+- ldr.wait(15 * 1000); // 15 second timeout
++ // no timeout is set so we wait infinitely until
++ // a response is received
++ // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
++ ldr.wait();
+ }
+- waited = true;
+ } else {
+ break;
+ }
+--- ./jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1062,10 +1062,6 @@
+ if (ktab != null) {
+ if (!privCredSet.contains(ktab)) {
+ privCredSet.add(ktab);
+- // Compatibility; also add keys to privCredSet
+- for (KerberosKey key: ktab.getKeys(kerbClientPrinc)) {
+- privCredSet.add(new Krb5Util.KeysFromKeyTab(key));
+- }
+ }
+ } else {
+ succeeded = false;
+--- ./jdk/src/share/classes/java/awt/EventQueue.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/awt/EventQueue.java Fri Apr 10 09:21:28 2015 -0700
+@@ -181,7 +181,14 @@
+
+ private final String name = "AWT-EventQueue-" + threadInitNumber.getAndIncrement();
+
+- private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
++ private static volatile PlatformLogger eventLog;
++
++ private static final PlatformLogger getEventLog() {
++ if(eventLog == null) {
++ eventLog = PlatformLogger.getLogger("java.awt.event.EventQueue");
++ }
++ return eventLog;
++ }
+
+ static {
+ AWTAccessor.setEventQueueAccessor(
+@@ -748,8 +755,8 @@
+ dispatchThread.stopDispatching();
+ }
+ } else {
+- if (eventLog.isLoggable(PlatformLogger.FINE)) {
+- eventLog.fine("Unable to dispatch event: " + event);
++ if (getEventLog().isLoggable(PlatformLogger.FINE)) {
++ getEventLog().fine("Unable to dispatch event: " + event);
+ }
+ }
+ }
+@@ -846,8 +853,8 @@
+ * @since 1.2
+ */
+ public void push(EventQueue newEventQueue) {
+- if (eventLog.isLoggable(PlatformLogger.FINE)) {
+- eventLog.fine("EventQueue.push(" + newEventQueue + ")");
++ if (getEventLog().isLoggable(PlatformLogger.FINE)) {
++ getEventLog().fine("EventQueue.push(" + newEventQueue + ")");
+ }
+
+ pushPopLock.lock();
+@@ -870,8 +877,8 @@
+ // Use getNextEventPrivate() as it doesn't call flushPendingEvents()
+ newEventQueue.postEventPrivate(topQueue.getNextEventPrivate());
+ } catch (InterruptedException ie) {
+- if (eventLog.isLoggable(PlatformLogger.FINE)) {
+- eventLog.fine("Interrupted push", ie);
++ if (getEventLog().isLoggable(PlatformLogger.FINE)) {
++ getEventLog().fine("Interrupted push", ie);
+ }
+ }
+ }
+@@ -909,8 +916,8 @@
+ * @since 1.2
+ */
+ protected void pop() throws EmptyStackException {
+- if (eventLog.isLoggable(PlatformLogger.FINE)) {
+- eventLog.fine("EventQueue.pop(" + this + ")");
++ if (getEventLog().isLoggable(PlatformLogger.FINE)) {
++ getEventLog().fine("EventQueue.pop(" + this + ")");
+ }
+
+ pushPopLock.lock();
+@@ -932,8 +939,8 @@
+ try {
+ prevQueue.postEventPrivate(topQueue.getNextEventPrivate());
+ } catch (InterruptedException ie) {
+- if (eventLog.isLoggable(PlatformLogger.FINE)) {
+- eventLog.fine("Interrupted pop", ie);
++ if (getEventLog().isLoggable(PlatformLogger.FINE)) {
++ getEventLog().fine("Interrupted pop", ie);
+ }
+ }
+ }
+--- ./jdk/src/share/classes/java/awt/event/KeyEvent.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/awt/event/KeyEvent.java Fri Apr 10 09:21:28 2015 -0700
+@@ -930,6 +930,10 @@
+ long extendedKeyCode) {
+ ev.extendedKeyCode = extendedKeyCode;
+ }
++
++ public Component getOriginalSource( KeyEvent ev ) {
++ return ev.originalSource;
++ }
+ });
+ }
+
+@@ -939,6 +943,14 @@
+ */
+ private static native void initIDs();
+
++ /**
++ * The original event source.
++ *
++ * Event source can be changed during processing, but in some cases
++ * we need to be able to obtain original source.
++ */
++ private Component originalSource;
++
+ private KeyEvent(Component source, int id, long when, int modifiers,
+ int keyCode, char keyChar, int keyLocation, boolean isProxyActive) {
+ this(source, id, when, modifiers, keyCode, keyChar, keyLocation);
+@@ -1023,6 +1035,7 @@
+ } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) {
+ setOldModifiers();
+ }
++ originalSource = source;
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/beans/Beans.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/beans/Beans.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1996, 2015, 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
+@@ -46,9 +46,6 @@
+
+ import java.net.URL;
+
+-import java.security.AccessController;
+-import java.security.PrivilegedAction;
+-
+ import java.util.Enumeration;
+ import java.util.Hashtable;
+ import java.util.Iterator;
+@@ -177,16 +174,10 @@
+
+ // Try to find a serialized object with this name
+ final String serName = beanName.replace('.','/').concat(".ser");
+- final ClassLoader loader = cls;
+- ins = (InputStream)AccessController.doPrivileged
+- (new PrivilegedAction() {
+- public Object run() {
+- if (loader == null)
+- return ClassLoader.getSystemResourceAsStream(serName);
+- else
+- return loader.getResourceAsStream(serName);
+- }
+- });
++ if (cls == null)
++ ins = ClassLoader.getSystemResourceAsStream(serName);
++ else
++ ins = cls.getResourceAsStream(serName);
+ if (ins != null) {
+ try {
+ if (cls == null) {
+@@ -277,19 +268,10 @@
+ URL docBase = null;
+
+ // Now get the URL correponding to the resource name.
+-
+- final ClassLoader cloader = cls;
+- objectUrl = (URL)
+- AccessController.doPrivileged
+- (new PrivilegedAction() {
+- public Object run() {
+- if (cloader == null)
+- return ClassLoader.getSystemResource
+- (resourceName);
+- else
+- return cloader.getResource(resourceName);
+- }
+- });
++ if (cls == null) {
++ objectUrl = ClassLoader.getSystemResource(resourceName);
++ } else
++ objectUrl = cls.getResource(resourceName);
+
+ // If we found a URL, we try to locate the docbase by taking
+ // of the final path name component, and the code base by taking
+--- ./jdk/src/share/classes/java/beans/SimpleBeanInfo.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/beans/SimpleBeanInfo.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1996, 2015, 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
+@@ -25,6 +25,11 @@
+
+ package java.beans;
+
++import java.awt.Image;
++import java.awt.Toolkit;
++import java.awt.image.ImageProducer;
++import java.net.URL;
++
+ /**
+ * This is a support class to make it easier for people to provide
+ * BeanInfo classes.
+@@ -99,7 +104,7 @@
+ * Claim there are no icons available. You can override
+ * this if you want to provide icons for your bean.
+ */
+- public java.awt.Image getIcon(int iconKind) {
++ public Image getIcon(int iconKind) {
+ return null;
+ }
+
+@@ -114,33 +119,17 @@
+ * "wombat.gif".
+ * @return an image object. May be null if the load failed.
+ */
+- public java.awt.Image loadImage(final String resourceName) {
++ public Image loadImage(final String resourceName) {
+ try {
+- final Class c = getClass();
+- java.awt.image.ImageProducer ip = (java.awt.image.ImageProducer)
+- java.security.AccessController.doPrivileged(
+- new java.security.PrivilegedAction() {
+- public Object run() {
+- java.net.URL url;
+- if ((url = c.getResource(resourceName)) == null) {
+- return null;
+- } else {
+- try {
+- return url.getContent();
+- } catch (java.io.IOException ioe) {
+- return null;
+- }
+- }
+- }
+- });
+-
+- if (ip == null)
+- return null;
+- java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
+- return tk.createImage(ip);
+- } catch (Exception ex) {
+- return null;
++ final URL url = getClass().getResource(resourceName);
++ if (url != null) {
++ final ImageProducer ip = (ImageProducer) url.getContent();
++ if (ip != null) {
++ return Toolkit.getDefaultToolkit().createImage(ip);
++ }
++ }
++ } catch (final Exception ignored) {
+ }
++ return null;
+ }
+-
+ }
+--- ./jdk/src/share/classes/java/lang/Class.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/lang/Class.java Fri Apr 10 09:21:28 2015 -0700
+@@ -130,11 +130,15 @@
+ }
+
+ /*
+- * Constructor. Only the Java Virtual Machine creates Class
+- * objects.
++ * Private constructor. Only the Java Virtual Machine creates Class objects.
++ * This constructor is not used and prevents the default constructor being
++ * generated.
+ */
+- private Class() {}
+-
++ private Class(ClassLoader loader) {
++ // Initialize final field for classLoader. The initialization value of non-null
++ // prevents future JIT optimizations from assuming this final field is null.
++ classLoader = loader;
++ }
+
+ /**
+ * Converts the object to a string. The string representation is the
+@@ -622,8 +626,12 @@
+ }
+
+ // Package-private to allow ClassLoader access
+- native ClassLoader getClassLoader0();
++ ClassLoader getClassLoader0() { return classLoader; }
+
++ // Initialized in JVM not by private constructor
++ // This field is filtered from reflection access, i.e. getDeclaredField
++ // will throw NoSuchFieldException
++ private final ClassLoader classLoader;
+
+ /**
+ * Returns an array of {@code TypeVariable} objects that represent the
+@@ -2454,7 +2462,7 @@
+ private native String getGenericSignature();
+
+ // Generic info repository; lazily initialized
+- private transient ClassRepository genericInfo;
++ private volatile transient ClassRepository genericInfo;
+
+ // accessor for factory
+ private GenericsFactory getFactory() {
+@@ -2464,11 +2472,13 @@
+
+ // accessor for generic info repository
+ private ClassRepository getGenericInfo() {
++ ClassRepository genericInfo = this.genericInfo;
+ // lazily initialize repository if necessary
+ if (genericInfo == null) {
+ // create and cache generic info repository
+ genericInfo = ClassRepository.make(getGenericSignature(),
+ getFactory());
++ this.genericInfo = genericInfo;
+ }
+ return genericInfo; //return cached repository
+ }
+--- ./jdk/src/share/classes/java/lang/reflect/AccessibleObject.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/lang/reflect/AccessibleObject.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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
+@@ -129,14 +129,15 @@
+ setAccessible0(this, flag);
+ }
+
+- /* Check that you aren't exposing java.lang.Class.<init>. */
++ /* Check that you aren't exposing java.lang.Class.<init> or sensitive
++ fields in java.lang.Class. */
+ private static void setAccessible0(AccessibleObject obj, boolean flag)
+ throws SecurityException
+ {
+ if (obj instanceof Constructor && flag == true) {
+ Constructor<?> c = (Constructor<?>)obj;
+ if (c.getDeclaringClass() == Class.class) {
+- throw new SecurityException("Can not make a java.lang.Class" +
++ throw new SecurityException("Cannot make a java.lang.Class" +
+ " constructor accessible");
+ }
+ }
+--- ./jdk/src/share/classes/java/net/DatagramSocket.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/net/DatagramSocket.java Fri Apr 10 09:21:28 2015 -0700
+@@ -340,6 +340,7 @@
+ }
+ // creates a udp socket
+ impl.create();
++ impl.setDatagramSocket(this);
+ created = true;
+ }
+
+--- ./jdk/src/share/classes/java/net/DatagramSocketImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/net/DatagramSocketImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -54,6 +54,20 @@
+ }
+
+ /**
++ * The DatagramSocket or MulticastSocket
++ * that owns this impl
++ */
++ DatagramSocket socket;
++
++ void setDatagramSocket(DatagramSocket socket) {
++ this.socket = socket;
++ }
++
++ DatagramSocket getDatagramSocket() {
++ return socket;
++ }
++
++ /**
+ * Creates a datagram socket.
+ * @exception SocketException if there is an error in the
+ * underlying protocol, such as a TCP error.
+@@ -239,6 +253,56 @@
+ return localPort;
+ }
+
++ <T> void setOption(SocketOption<T> name, T value) throws IOException {
++ if (name == StandardSocketOptions.SO_SNDBUF) {
++ setOption(SocketOptions.SO_SNDBUF, value);
++ } else if (name == StandardSocketOptions.SO_RCVBUF) {
++ setOption(SocketOptions.SO_RCVBUF, value);
++ } else if (name == StandardSocketOptions.SO_REUSEADDR) {
++ setOption(SocketOptions.SO_REUSEADDR, value);
++ } else if (name == StandardSocketOptions.IP_TOS) {
++ setOption(SocketOptions.IP_TOS, value);
++ } else if (name == StandardSocketOptions.IP_MULTICAST_IF &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ setOption(SocketOptions.IP_MULTICAST_IF2, value);
++ } else if (name == StandardSocketOptions.IP_MULTICAST_TTL &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ if (! (value instanceof Integer)) {
++ throw new IllegalArgumentException("not an integer");
++ }
++ setTimeToLive((Integer)value);
++ } else if (name == StandardSocketOptions.IP_MULTICAST_LOOP &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ setOption(SocketOptions.IP_MULTICAST_LOOP, value);
++ } else {
++ throw new UnsupportedOperationException("unsupported option");
++ }
++ }
++
++ <T> T getOption(SocketOption<T> name) throws IOException {
++ if (name == StandardSocketOptions.SO_SNDBUF) {
++ return (T) getOption(SocketOptions.SO_SNDBUF);
++ } else if (name == StandardSocketOptions.SO_RCVBUF) {
++ return (T) getOption(SocketOptions.SO_RCVBUF);
++ } else if (name == StandardSocketOptions.SO_REUSEADDR) {
++ return (T) getOption(SocketOptions.SO_REUSEADDR);
++ } else if (name == StandardSocketOptions.IP_TOS) {
++ return (T) getOption(SocketOptions.IP_TOS);
++ } else if (name == StandardSocketOptions.IP_MULTICAST_IF &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ return (T) getOption(SocketOptions.IP_MULTICAST_IF2);
++ } else if (name == StandardSocketOptions.IP_MULTICAST_TTL &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ Integer ttl = getTimeToLive();
++ return (T)ttl;
++ } else if (name == StandardSocketOptions.IP_MULTICAST_LOOP &&
++ (getDatagramSocket() instanceof MulticastSocket)) {
++ return (T) getOption(SocketOptions.IP_MULTICAST_LOOP);
++ } else {
++ throw new UnsupportedOperationException("unsupported option");
++ }
++ }
++
+ /**
+ * Gets the datagram socket file descriptor.
+ * @return a <tt>FileDescriptor</tt> object representing the datagram socket
+--- ./jdk/src/share/classes/java/net/SocketImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/net/SocketImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -354,4 +354,44 @@
+ {
+ /* Not implemented yet */
+ }
++
++ <T> void setOption(SocketOption<T> name, T value) throws IOException {
++ if (name == StandardSocketOptions.SO_KEEPALIVE) {
++ setOption(SocketOptions.SO_KEEPALIVE, value);
++ } else if (name == StandardSocketOptions.SO_SNDBUF) {
++ setOption(SocketOptions.SO_SNDBUF, value);
++ } else if (name == StandardSocketOptions.SO_RCVBUF) {
++ setOption(SocketOptions.SO_RCVBUF, value);
++ } else if (name == StandardSocketOptions.SO_REUSEADDR) {
++ setOption(SocketOptions.SO_REUSEADDR, value);
++ } else if (name == StandardSocketOptions.SO_LINGER) {
++ setOption(SocketOptions.SO_LINGER, value);
++ } else if (name == StandardSocketOptions.IP_TOS) {
++ setOption(SocketOptions.IP_TOS, value);
++ } else if (name == StandardSocketOptions.TCP_NODELAY) {
++ setOption(SocketOptions.TCP_NODELAY, value);
++ } else {
++ throw new UnsupportedOperationException("unsupported option");
++ }
++ }
++
++ <T> T getOption(SocketOption<T> name) throws IOException {
++ if (name == StandardSocketOptions.SO_KEEPALIVE) {
++ return (T)getOption(SocketOptions.SO_KEEPALIVE);
++ } else if (name == StandardSocketOptions.SO_SNDBUF) {
++ return (T)getOption(SocketOptions.SO_SNDBUF);
++ } else if (name == StandardSocketOptions.SO_RCVBUF) {
++ return (T)getOption(SocketOptions.SO_RCVBUF);
++ } else if (name == StandardSocketOptions.SO_REUSEADDR) {
++ return (T)getOption(SocketOptions.SO_REUSEADDR);
++ } else if (name == StandardSocketOptions.SO_LINGER) {
++ return (T)getOption(SocketOptions.SO_LINGER);
++ } else if (name == StandardSocketOptions.IP_TOS) {
++ return (T)getOption(SocketOptions.IP_TOS);
++ } else if (name == StandardSocketOptions.TCP_NODELAY) {
++ return (T)getOption(SocketOptions.TCP_NODELAY);
++ } else {
++ throw new UnsupportedOperationException("unsupported option");
++ }
++ }
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/java/net/SocketSecrets.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,70 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package java.net;
++
++import java.io.IOException;
++
++class SocketSecrets {
++
++ /* accessed by reflection from jdk.net.Sockets */
++
++ /* obj must be a Socket or ServerSocket */
++
++ private static <T> void setOption(Object obj, SocketOption<T> name, T value) throws IOException {
++ SocketImpl impl;
++
++ if (obj instanceof Socket) {
++ impl = ((Socket)obj).getImpl();
++ } else if (obj instanceof ServerSocket) {
++ impl = ((ServerSocket)obj).getImpl();
++ } else {
++ throw new IllegalArgumentException();
++ }
++ impl.setOption(name, value);
++ }
++
++ private static <T> T getOption(Object obj, SocketOption<T> name) throws IOException {
++ SocketImpl impl;
++
++ if (obj instanceof Socket) {
++ impl = ((Socket)obj).getImpl();
++ } else if (obj instanceof ServerSocket) {
++ impl = ((ServerSocket)obj).getImpl();
++ } else {
++ throw new IllegalArgumentException();
++ }
++ return impl.getOption(name);
++ }
++
++ private static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException {
++ s.getImpl().setOption(name, value);
++ }
++
++ private static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException {
++ return s.getImpl().getOption(name);
++ }
++
++}
+--- ./jdk/src/share/classes/java/net/SocksSocketImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/net/SocksSocketImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -388,14 +388,13 @@
+ }
+ while (iProxy.hasNext()) {
+ p = iProxy.next();
+- if (p == null || p == Proxy.NO_PROXY) {
++ if (p == null || p.type() != Proxy.Type.SOCKS) {
+ super.connect(epoint, remainingMillis(deadlineMillis));
+ return;
+ }
+- if (p.type() != Proxy.Type.SOCKS)
+- throw new SocketException("Unknown proxy type : " + p.type());
++
+ if (!(p.address() instanceof InetSocketAddress))
+- throw new SocketException("Unknow address type for proxy: " + p);
++ throw new SocketException("Unknown address type for proxy: " + p);
+ // Use getHostString() to avoid reverse lookups
+ server = ((InetSocketAddress) p.address()).getHostString();
+ serverPort = ((InetSocketAddress) p.address()).getPort();
+@@ -703,13 +702,12 @@
+ }
+ while (iProxy.hasNext()) {
+ p = iProxy.next();
+- if (p == null || p == Proxy.NO_PROXY) {
++ if (p == null || p.type() != Proxy.Type.SOCKS) {
+ return;
+ }
+- if (p.type() != Proxy.Type.SOCKS)
+- throw new SocketException("Unknown proxy type : " + p.type());
++
+ if (!(p.address() instanceof InetSocketAddress))
+- throw new SocketException("Unknow address type for proxy: " + p);
++ throw new SocketException("Unknown address type for proxy: " + p);
+ // Use getHostString() to avoid reverse lookups
+ server = ((InetSocketAddress) p.address()).getHostString();
+ serverPort = ((InetSocketAddress) p.address()).getPort();
+--- ./jdk/src/share/classes/java/net/URL.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/net/URL.java Fri Apr 10 09:21:28 2015 -0700
+@@ -41,17 +41,21 @@
+ * directory, or it can be a reference to a more complicated object,
+ * such as a query to a database or to a search engine. More
+ * information on the types of URLs and their formats can be found at:
+- * <blockquote>
+- * <a href="http://www.socs.uts.edu.au/MosaicDocs-old/url-primer.html">
+- * <i>http://www.socs.uts.edu.au/MosaicDocs-old/url-primer.html</i></a>
+- * </blockquote>
++ * <a href=
++ * "http://web.archive.org/web/20051219043731/http://archive.ncsa.uiuc.edu/SDG/Software/Mosaic/Demo/url-primer.html">
++ * <i>Types of URL</i></a>
+ * <p>
+- * In general, a URL can be broken into several parts. The previous
+- * example of a URL indicates that the protocol to use is
++ * In general, a URL can be broken into several parts. Consider the
++ * following example:
++ * <blockquote><pre>
++ * http://www.example.com/docs/resource1.html
++ * </pre></blockquote>
++ * <p>
++ * The URL above indicates that the protocol to use is
+ * <code>http</code> (HyperText Transfer Protocol) and that the
+ * information resides on a host machine named
+- * <code>www.socs.uts.edu.au</code>. The information on that host
+- * machine is named <code>/MosaicDocs-old/url-primer.html</code>. The exact
++ * <code>www.example.com</code>. The information on that host
++ * machine is named <code>/docs/resource1.html</code>. The exact
+ * meaning of this name on the host machine is both protocol
+ * dependent and host dependent. The information normally resides in
+ * a file, but it could be generated on the fly. This component of
+@@ -64,7 +68,7 @@
+ * <code>http</code> is <code>80</code>. An alternative port could be
+ * specified as:
+ * <blockquote><pre>
+- * http://www.socs.uts.edu.au:80/MosaicDocs-old/url-primer.html
++ * http://www.example.com:1080/docs/resource1.html
+ * </pre></blockquote>
+ * <p>
+ * The syntax of <code>URL</code> is defined by <a
+--- ./jdk/src/share/classes/java/security/KeyPairGenerator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/security/KeyPairGenerator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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,7 @@
+
+ import sun.security.jca.*;
+ import sun.security.jca.GetInstance.Instance;
++import sun.security.util.Debug;
+
+ /**
+ * The KeyPairGenerator class is used to generate pairs of
+@@ -127,6 +128,11 @@
+
+ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("keypairgenerator");
++
+ private final String algorithm;
+
+ // The provider
+@@ -168,6 +174,12 @@
+ kpg = new Delegate(spi, algorithm);
+ }
+ kpg.provider = instance.provider;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyPairGenerator." + algorithm +
++ " algorithm from: " + kpg.provider.getName());
++ }
++
+ return kpg;
+ }
+
+@@ -558,6 +570,11 @@
+ provider = instance.provider;
+ this.serviceIterator = serviceIterator;
+ initType = I_NONE;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyPairGenerator." + algorithm +
++ " algorithm from: " + provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/security/KeyStore.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/security/KeyStore.java Fri Apr 10 09:21:28 2015 -0700
+@@ -34,6 +34,8 @@
+
+ import javax.security.auth.callback.*;
+
++import sun.security.util.Debug;
++
+ /**
+ * This class represents a storage facility for cryptographic
+ * keys and certificates.
+@@ -187,6 +189,11 @@
+
+ public class KeyStore {
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("keystore");
++
+ /*
+ * Constant to lookup in the Security properties file to determine
+ * the default keystore type.
+@@ -578,6 +585,11 @@
+ this.keyStoreSpi = keyStoreSpi;
+ this.provider = provider;
+ this.type = type;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyStore." + type.toUpperCase() + " type from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/security/MessageDigest.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/security/MessageDigest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -35,6 +35,8 @@
+
+ import java.nio.ByteBuffer;
+
++import sun.security.util.Debug;
++
+ /**
+ * This MessageDigest class provides applications the functionality of a
+ * message digest algorithm, such as SHA-1 or SHA-256.
+@@ -103,6 +105,11 @@
+
+ public abstract class MessageDigest extends MessageDigestSpi {
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("messagedigest");
++
+ private String algorithm;
+
+ // The state of this digest
+@@ -156,18 +163,23 @@
+ public static MessageDigest getInstance(String algorithm)
+ throws NoSuchAlgorithmException {
+ try {
++ MessageDigest md;
+ Object[] objs = Security.getImpl(algorithm, "MessageDigest",
+ (String)null);
+ if (objs[0] instanceof MessageDigest) {
+- MessageDigest md = (MessageDigest)objs[0];
+- md.provider = (Provider)objs[1];
+- return md;
++ md = (MessageDigest)objs[0];
+ } else {
+- MessageDigest delegate =
+- new Delegate((MessageDigestSpi)objs[0], algorithm);
+- delegate.provider = (Provider)objs[1];
+- return delegate;
++ md = new Delegate((MessageDigestSpi)objs[0], algorithm);
+ }
++ md.provider = (Provider)objs[1];
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("MessageDigest." + algorithm +
++ " algorithm from: " + md.provider.getName());
++ }
++
++ return md;
++
+ } catch(NoSuchProviderException e) {
+ throw new NoSuchAlgorithmException(algorithm + " not found");
+ }
+--- ./jdk/src/share/classes/java/security/SecureRandom.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/security/SecureRandom.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,6 +31,7 @@
+
+ import sun.security.jca.*;
+ import sun.security.jca.GetInstance.Instance;
++import sun.security.util.Debug;
+
+ /**
+ * This class provides a cryptographically strong random number
+@@ -91,6 +92,11 @@
+
+ public class SecureRandom extends java.util.Random {
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("securerandom");
++
+ /**
+ * The provider.
+ *
+@@ -233,6 +239,11 @@
+ this.secureRandomSpi = secureRandomSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("SecureRandom." + algorithm +
++ " algorithm from: " + this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/security/Signature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/security/Signature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -121,6 +121,11 @@
+ private static final Debug debug =
+ Debug.getInstance("jca", "Signature");
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("signature");
++
+ /*
+ * The algorithm for this signature object.
+ * This value is used to map an OID to the particular algorithm.
+@@ -450,6 +455,11 @@
+ throws InvalidKeyException {
+ engineInitVerify(publicKey);
+ state = VERIFY;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Signature." + algorithm +
++ " verification algorithm from: " + this.provider.getName());
++ }
+ }
+
+ /**
+@@ -494,6 +504,11 @@
+ PublicKey publicKey = certificate.getPublicKey();
+ engineInitVerify(publicKey);
+ state = VERIFY;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Signature." + algorithm +
++ " verification algorithm from: " + this.provider.getName());
++ }
+ }
+
+ /**
+@@ -510,6 +525,11 @@
+ throws InvalidKeyException {
+ engineInitSign(privateKey);
+ state = SIGN;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Signature." + algorithm +
++ " signing algorithm from: " + this.provider.getName());
++ }
+ }
+
+ /**
+@@ -528,6 +548,11 @@
+ throws InvalidKeyException {
+ engineInitSign(privateKey, random);
+ state = SIGN;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Signature." + algorithm +
++ " signing algorithm from: " + this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/util/Currency.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/util/Currency.java Fri Apr 10 09:21:28 2015 -0700
+@@ -34,6 +34,8 @@
+ import java.io.Serializable;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
++import java.util.concurrent.ConcurrentHashMap;
++import java.util.concurrent.ConcurrentMap;
+ import java.util.logging.Level;
+ import java.util.regex.Pattern;
+ import java.util.regex.Matcher;
+@@ -99,7 +101,7 @@
+
+ // class data: instance map
+
+- private static HashMap<String, Currency> instances = new HashMap<String, Currency>(7);
++ private static ConcurrentMap<String, Currency> instances = new ConcurrentHashMap<>(7);
+ private static HashSet<Currency> available;
+
+
+@@ -286,48 +288,47 @@
+
+ private static Currency getInstance(String currencyCode, int defaultFractionDigits,
+ int numericCode) {
+- synchronized (instances) {
+- // Try to look up the currency code in the instances table.
+- // This does the null pointer check as a side effect.
+- // Also, if there already is an entry, the currencyCode must be valid.
+- Currency instance = instances.get(currencyCode);
+- if (instance != null) {
+- return instance;
++ // Try to look up the currency code in the instances table.
++ // This does the null pointer check as a side effect.
++ // Also, if there already is an entry, the currencyCode must be valid.
++ Currency instance = instances.get(currencyCode);
++ if (instance != null) {
++ return instance;
++ }
++
++ if (defaultFractionDigits == Integer.MIN_VALUE) {
++ // Currency code not internally generated, need to verify first
++ // A currency code must have 3 characters and exist in the main table
++ // or in the list of other currencies.
++ if (currencyCode.length() != 3) {
++ throw new IllegalArgumentException();
+ }
+-
+- if (defaultFractionDigits == Integer.MIN_VALUE) {
+- // Currency code not internally generated, need to verify first
+- // A currency code must have 3 characters and exist in the main table
+- // or in the list of other currencies.
+- if (currencyCode.length() != 3) {
++ char char1 = currencyCode.charAt(0);
++ char char2 = currencyCode.charAt(1);
++ int tableEntry = getMainTableEntry(char1, char2);
++ if ((tableEntry & COUNTRY_TYPE_MASK) == SIMPLE_CASE_COUNTRY_MASK
++ && tableEntry != INVALID_COUNTRY_ENTRY
++ && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) {
++ defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT;
++ numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT;
++ } else {
++ // Check for '-' separately so we don't get false hits in the table.
++ if (currencyCode.charAt(2) == '-') {
+ throw new IllegalArgumentException();
+ }
+- char char1 = currencyCode.charAt(0);
+- char char2 = currencyCode.charAt(1);
+- int tableEntry = getMainTableEntry(char1, char2);
+- if ((tableEntry & COUNTRY_TYPE_MASK) == SIMPLE_CASE_COUNTRY_MASK
+- && tableEntry != INVALID_COUNTRY_ENTRY
+- && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) {
+- defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT;
+- numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT;
+- } else {
+- // Check for '-' separately so we don't get false hits in the table.
+- if (currencyCode.charAt(2) == '-') {
+- throw new IllegalArgumentException();
+- }
+- int index = otherCurrencies.indexOf(currencyCode);
+- if (index == -1) {
+- throw new IllegalArgumentException();
+- }
+- defaultFractionDigits = otherCurrenciesDFD[index / 4];
+- numericCode = otherCurrenciesNumericCode[index / 4];
++ int index = otherCurrencies.indexOf(currencyCode);
++ if (index == -1) {
++ throw new IllegalArgumentException();
+ }
++ defaultFractionDigits = otherCurrenciesDFD[index / 4];
++ numericCode = otherCurrenciesNumericCode[index / 4];
+ }
++ }
+
+- instance = new Currency(currencyCode, defaultFractionDigits, numericCode);
+- instances.put(currencyCode, instance);
+- return instance;
+- }
++ Currency currencyVal =
++ new Currency(currencyCode, defaultFractionDigits, numericCode);
++ instance = instances.putIfAbsent(currencyCode, currencyVal);
++ return (instance != null ? instance : currencyVal);
+ }
+
+ /**
+--- ./jdk/src/share/classes/java/util/logging/LogManager.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/java/util/logging/LogManager.java Fri Apr 10 09:21:28 2015 -0700
+@@ -383,11 +383,11 @@
+ JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
+ if (sm != null && javaAwtAccess != null) {
+ // for each applet, it has its own LoggerContext isolated from others
+- synchronized (javaAwtAccess) {
+- // find the AppContext of the applet code
+- // will be null if we are in the main app context.
+- final Object ecx = javaAwtAccess.getAppletContext();
+- if (ecx != null) {
++ final Object ecx = javaAwtAccess.getAppletContext();
++ if (ecx != null) {
++ synchronized (javaAwtAccess) {
++ // find the AppContext of the applet code
++ // will be null if we are in the main app context.
+ if (contextsMap == null) {
+ contextsMap = new WeakHashMap<>();
+ }
+--- ./jdk/src/share/classes/javax/crypto/Cipher.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/crypto/Cipher.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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
+@@ -156,6 +156,11 @@
+ private static final Debug debug =
+ Debug.getInstance("jca", "Cipher");
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("cipher");
++
+ /**
+ * Constant used to initialize cipher to encryption mode.
+ */
+@@ -1100,6 +1105,21 @@
+ }
+ }
+
++ private static String getOpmodeString(int opmode) {
++ switch (opmode) {
++ case ENCRYPT_MODE:
++ return "encryption";
++ case DECRYPT_MODE:
++ return "decryption";
++ case WRAP_MODE:
++ return "key wrapping";
++ case UNWRAP_MODE:
++ return "key unwrapping";
++ default:
++ return "";
++ }
++ }
++
+ /**
+ * Initializes this cipher with a key.
+ *
+@@ -1219,6 +1239,12 @@
+
+ initialized = true;
+ this.opmode = opmode;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Cipher." + transformation + " " +
++ getOpmodeString(opmode) + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+@@ -1350,6 +1376,12 @@
+
+ initialized = true;
+ this.opmode = opmode;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Cipher." + transformation + " " +
++ getOpmodeString(opmode) + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+@@ -1481,6 +1513,12 @@
+
+ initialized = true;
+ this.opmode = opmode;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Cipher." + transformation + " " +
++ getOpmodeString(opmode) + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+@@ -1659,6 +1697,12 @@
+
+ initialized = true;
+ this.opmode = opmode;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Cipher." + transformation + " " +
++ getOpmodeString(opmode) + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/javax/crypto/KeyAgreement.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/crypto/KeyAgreement.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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,11 @@
+ private static final Debug debug =
+ Debug.getInstance("jca", "KeyAgreement");
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("keyagreement");
++
+ // The provider
+ private Provider provider;
+
+@@ -467,6 +472,11 @@
+ throw new InvalidKeyException(e);
+ }
+ }
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+@@ -523,6 +533,11 @@
+ } else {
+ chooseProvider(I_PARAMS, key, params, random);
+ }
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/javax/crypto/KeyGenerator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/crypto/KeyGenerator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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,7 @@
+
+ import sun.security.jca.*;
+ import sun.security.jca.GetInstance.Instance;
++import sun.security.util.Debug;
+
+ /**
+ * This class provides the functionality of a secret (symmetric) key generator.
+@@ -109,6 +110,11 @@
+
+ public class KeyGenerator {
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("keygenerator");
++
+ // see java.security.KeyPairGenerator for failover notes
+
+ private final static int I_NONE = 1;
+@@ -146,6 +152,11 @@
+ this.spi = keyGenSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
+@@ -158,6 +169,11 @@
+ throw new NoSuchAlgorithmException
+ (algorithm + " KeyGenerator not available");
+ }
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/javax/crypto/Mac.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/crypto/Mac.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2014, 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
+@@ -77,6 +77,11 @@
+ private static final Debug debug =
+ Debug.getInstance("jca", "Mac");
+
++ private static final Debug pdebug =
++ Debug.getInstance("provider", "Provider");
++ private static final boolean skipDebug =
++ Debug.isOn("engine=") && !Debug.isOn("mac");
++
+ // The provider
+ private Provider provider;
+
+@@ -413,6 +418,11 @@
+ throw new InvalidKeyException("init() failed", e);
+ }
+ initialized = true;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Mac." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+@@ -435,6 +445,11 @@
+ chooseProvider(key, params);
+ }
+ initialized = true;
++
++ if (!skipDebug && pdebug != null) {
++ pdebug.println("Mac." + algorithm + " algorithm from: " +
++ this.provider.getName());
++ }
+ }
+
+ /**
+--- ./jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2014, 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,7 +33,8 @@
+ import javax.swing.text.View;
+ import sun.swing.SwingUtilities2;
+ import sun.awt.AppContext;
+-
++import java.util.Enumeration;
++import java.util.HashSet;
+
+ /**
+ * RadioButtonUI implementation for BasicRadioButtonUI
+@@ -44,15 +45,27 @@
+ {
+ private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object();
+
++ /**
++ * The icon.
++ */
+ protected Icon icon;
+
+ private boolean defaults_initialized = false;
+
+ private final static String propertyPrefix = "RadioButton" + ".";
+
++ private KeyListener keyListener = null;
++
+ // ********************************
+ // Create PLAF
+ // ********************************
++
++ /**
++ * Returns an instance of {@code BasicRadioButtonUI}.
++ *
++ * @param b a component
++ * @return an instance of {@code BasicRadioButtonUI}
++ */
+ public static ComponentUI createUI(JComponent b) {
+ AppContext appContext = AppContext.getAppContext();
+ BasicRadioButtonUI radioButtonUI =
+@@ -64,6 +77,7 @@
+ return radioButtonUI;
+ }
+
++ @Override
+ protected String getPropertyPrefix() {
+ return propertyPrefix;
+ }
+@@ -71,7 +85,8 @@
+ // ********************************
+ // Install PLAF
+ // ********************************
+- protected void installDefaults(AbstractButton b){
++ @Override
++ protected void installDefaults(AbstractButton b) {
+ super.installDefaults(b);
+ if(!defaults_initialized) {
+ icon = UIManager.getIcon(getPropertyPrefix() + "icon");
+@@ -82,15 +97,80 @@
+ // ********************************
+ // Uninstall PLAF
+ // ********************************
+- protected void uninstallDefaults(AbstractButton b){
++ @Override
++ protected void uninstallDefaults(AbstractButton b) {
+ super.uninstallDefaults(b);
+ defaults_initialized = false;
+ }
+
++ /**
++ * Returns the default icon.
++ *
++ * @return the default icon
++ */
+ public Icon getDefaultIcon() {
+ return icon;
+ }
+
++ // ********************************
++ // Install Listeners
++ // ********************************
++ @Override
++ protected void installListeners(AbstractButton button) {
++ super.installListeners(button);
++
++ // Only for JRadioButton
++ if (!(button instanceof JRadioButton))
++ return;
++
++ keyListener = createKeyListener();
++ button.addKeyListener(keyListener);
++
++ // Need to get traversal key event
++ button.setFocusTraversalKeysEnabled(false);
++
++ // Map actions to the arrow keys
++ button.getActionMap().put("Previous", new SelectPreviousBtn());
++ button.getActionMap().put("Next", new SelectNextBtn());
++
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
++ put(KeyStroke.getKeyStroke("UP"), "Previous");
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
++ put(KeyStroke.getKeyStroke("DOWN"), "Next");
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
++ put(KeyStroke.getKeyStroke("LEFT"), "Previous");
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).
++ put(KeyStroke.getKeyStroke("RIGHT"), "Next");
++ }
++
++ // ********************************
++ // UnInstall Listeners
++ // ********************************
++ @Override
++ protected void uninstallListeners(AbstractButton button) {
++ super.uninstallListeners(button);
++
++ // Only for JRadioButton
++ if (!(button instanceof JRadioButton))
++ return;
++
++ // Unmap actions from the arrow keys
++ button.getActionMap().remove("Previous");
++ button.getActionMap().remove("Next");
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
++ .remove(KeyStroke.getKeyStroke("UP"));
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
++ .remove(KeyStroke.getKeyStroke("DOWN"));
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
++ .remove(KeyStroke.getKeyStroke("LEFT"));
++ button.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
++ .remove(KeyStroke.getKeyStroke("RIGHT"));
++
++ if (keyListener != null) {
++ button.removeKeyListener(keyListener);
++ keyListener = null;
++ }
++ }
+
+ /* These Dimensions/Rectangles are allocated once for all
+ * RadioButtonUI.paint() calls. Re-using rectangles
+@@ -106,6 +186,7 @@
+ /**
+ * paint the radio button
+ */
++ @Override
+ public synchronized void paint(Graphics g, JComponent c) {
+ AbstractButton b = (AbstractButton) c;
+ ButtonModel model = b.getModel();
+@@ -195,7 +276,14 @@
+ }
+ }
+
+- protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){
++ /**
++ * Paints focused radio button.
++ *
++ * @param g an instance of {@code Graphics}
++ * @param textRect bounds
++ * @param size the size of radio button
++ */
++ protected void paintFocus(Graphics g, Rectangle textRect, Dimension size) {
+ }
+
+
+@@ -213,6 +301,7 @@
+ /**
+ * The preferred size of the radio button
+ */
++ @Override
+ public Dimension getPreferredSize(JComponent c) {
+ if(c.getComponentCount() > 0) {
+ return null;
+@@ -258,4 +347,262 @@
+ height += prefInsets.top + prefInsets.bottom;
+ return new Dimension(width, height);
+ }
++
++ /////////////////////////// Private functions ////////////////////////
++ /**
++ * Creates the key listener to handle tab navigation in JRadioButton Group.
++ */
++ private KeyListener createKeyListener() {
++ if (keyListener == null) {
++ keyListener = new KeyHandler();
++ }
++ return keyListener;
++ }
++
++
++ private boolean isValidRadioButtonObj(Object obj) {
++ return ((obj instanceof JRadioButton) &&
++ ((JRadioButton) obj).isVisible() &&
++ ((JRadioButton) obj).isEnabled());
++ }
++
++ /**
++ * Select radio button based on "Previous" or "Next" operation
++ *
++ * @param event, the event object.
++ * @param next, indicate if it's next one
++ */
++ private void selectRadioButton(ActionEvent event, boolean next) {
++ // Get the source of the event.
++ Object eventSrc = event.getSource();
++
++ // Check whether the source is JRadioButton, it so, whether it is visible
++ if (!isValidRadioButtonObj(eventSrc))
++ return;
++
++ ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
++ btnGroupInfo.selectNewButton(next);
++ }
++
++ /////////////////////////// Inner Classes ////////////////////////
++ @SuppressWarnings("serial")
++ private class SelectPreviousBtn extends AbstractAction {
++ public SelectPreviousBtn() {
++ super("Previous");
++ }
++
++ public void actionPerformed(ActionEvent e) {
++ BasicRadioButtonUI.this.selectRadioButton(e, false);
++ }
++ }
++
++ @SuppressWarnings("serial")
++ private class SelectNextBtn extends AbstractAction{
++ public SelectNextBtn() {
++ super("Next");
++ }
++
++ public void actionPerformed(ActionEvent e) {
++ BasicRadioButtonUI.this.selectRadioButton(e, true);
++ }
++ }
++
++ /**
++ * ButtonGroupInfo, used to get related info in button group
++ * for given radio button
++ */
++ private class ButtonGroupInfo {
++
++ JRadioButton activeBtn = null;
++
++ JRadioButton firstBtn = null;
++ JRadioButton lastBtn = null;
++
++ JRadioButton previousBtn = null;
++ JRadioButton nextBtn = null;
++
++ HashSet<JRadioButton> btnsInGroup = null;
++
++ boolean srcFound = false;
++ public ButtonGroupInfo(JRadioButton btn) {
++ activeBtn = btn;
++ btnsInGroup = new HashSet<JRadioButton>();
++ }
++
++ // Check if given object is in the button group
++ boolean containsInGroup(Object obj){
++ return btnsInGroup.contains(obj);
++ }
++
++ // Check if the next object to gain focus belongs
++ // to the button group or not
++ Component getFocusTransferBaseComponent(boolean next){
++ Component focusBaseComp = activeBtn;
++ Window container = SwingUtilities.getWindowAncestor(activeBtn);
++ if (container != null) {
++ FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
++ Component comp = next ? policy.getComponentAfter(container, activeBtn)
++ : policy.getComponentBefore(container, activeBtn);
++
++ // If next component in the button group, use last/first button as base focus
++ // otherwise, use the activeBtn as the base focus
++ if (containsInGroup(comp)) {
++ focusBaseComp = next ? lastBtn : firstBtn;
++ }
++ }
++
++ return focusBaseComp;
++ }
++
++ boolean getButtonGroupInfo() {
++ if (activeBtn == null)
++ return false;
++
++ btnsInGroup.clear();
++
++ // Get the button model from the source.
++ ButtonModel model = activeBtn.getModel();
++ if (!(model instanceof DefaultButtonModel))
++ return false;
++
++ // If the button model is DefaultButtonModel, and use it, otherwise return.
++ DefaultButtonModel bm = (DefaultButtonModel) model;
++
++ // get the ButtonGroup of the button from the button model
++ ButtonGroup group = bm.getGroup();
++ if (group == null)
++ return false;
++
++ // Get all the buttons in the group
++ Enumeration<AbstractButton> e = group.getElements();
++ if (e == null)
++ return false;
++
++ while (e.hasMoreElements()) {
++ AbstractButton curElement = e.nextElement();
++ if (!isValidRadioButtonObj(curElement))
++ continue;
++
++ btnsInGroup.add((JRadioButton) curElement);
++
++ // If firstBtn is not set yet, curElement is that first button
++ if (null == firstBtn)
++ firstBtn = (JRadioButton) curElement;
++
++ if (activeBtn == curElement)
++ srcFound = true;
++ else if (!srcFound) {
++ // The source has not been yet found and the current element
++ // is the last previousBtn
++ previousBtn = (JRadioButton) curElement;
++ } else if (nextBtn == null) {
++ // The source has been found and the current element
++ // is the next valid button of the list
++ nextBtn = (JRadioButton) curElement;
++ }
++
++ // Set new last "valid" JRadioButton of the list
++ lastBtn = (JRadioButton) curElement;
++ }
++
++ return true;
++ }
++
++ /**
++ * Find the new radio button that focus needs to be
++ * moved to in the group, select the button
++ *
++ * @param next, indicate if it's arrow up/left or down/right
++ */
++ void selectNewButton(boolean next) {
++ if (!getButtonGroupInfo())
++ return;
++
++ if (srcFound) {
++ JRadioButton newSelectedBtn = null;
++ if (next) {
++ // Select Next button. Cycle to the first button if the source
++ // button is the last of the group.
++ newSelectedBtn = (null == nextBtn) ? firstBtn : nextBtn;
++ } else {
++ // Select previous button. Cycle to the last button if the source
++ // button is the first button of the group.
++ newSelectedBtn = (null == previousBtn) ? lastBtn : previousBtn;
++ }
++ if (newSelectedBtn != null &&
++ (newSelectedBtn != activeBtn)) {
++ newSelectedBtn.requestFocusInWindow();
++ newSelectedBtn.setSelected(true);
++ }
++ }
++ }
++
++ /**
++ * Find the button group the passed in JRadioButton belongs to, and
++ * move focus to next component of the last button in the group
++ * or previous component of first button
++ *
++ * @param next, indicate if jump to next component or previous
++ */
++ void jumpToNextComponent(boolean next) {
++ if (!getButtonGroupInfo()){
++ // In case the button does not belong to any group, it needs
++ // to be treated as a component
++ if (activeBtn != null){
++ lastBtn = activeBtn;
++ firstBtn = activeBtn;
++ }
++ else
++ return;
++ }
++
++ // Update the component we will use as base to transfer
++ // focus from
++ JComponent compTransferFocusFrom = activeBtn;
++
++ // If next component in the parent window is not in
++ // the button group, current active button will be
++ // base, otherwise, the base will be first or last
++ // button in the button group
++ Component focusBase = getFocusTransferBaseComponent(next);
++ if (focusBase != null){
++ if (next) {
++ KeyboardFocusManager.
++ getCurrentKeyboardFocusManager().focusNextComponent(focusBase);
++ } else {
++ KeyboardFocusManager.
++ getCurrentKeyboardFocusManager().focusPreviousComponent(focusBase);
++ }
++ }
++ }
++ }
++
++ /**
++ * Radiobutton KeyListener
++ */
++ private class KeyHandler implements KeyListener {
++
++ // This listener checks if the key event is a KeyEvent.VK_TAB
++ // or shift + KeyEvent.VK_TAB event on a radio button, consume the event
++ // if so and move the focus to next/previous component
++ public void keyPressed(KeyEvent e) {
++ if (e.getKeyCode() == KeyEvent.VK_TAB) {
++ // Get the source of the event.
++ Object eventSrc = e.getSource();
++
++ // Check whether the source is a visible and enabled JRadioButton
++ if (isValidRadioButtonObj(eventSrc)) {
++ e.consume();
++ ButtonGroupInfo btnGroupInfo = new ButtonGroupInfo((JRadioButton)eventSrc);
++ btnGroupInfo.jumpToNextComponent(!e.isShiftDown());
++ }
++ }
++ }
++
++ public void keyReleased(KeyEvent e) {
++ }
++
++ public void keyTyped(KeyEvent e) {
++ }
++ }
+ }
+--- ./jdk/src/share/classes/javax/swing/text/FlowView.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/swing/text/FlowView.java Fri Apr 10 09:21:28 2015 -0700
+@@ -800,14 +800,22 @@
+ @Override
+ protected void forwardUpdate(DocumentEvent.ElementChange ec,
+ DocumentEvent e, Shape a, ViewFactory f) {
+- calculateUpdateIndexes(e);
+- // Send update event to all views followed by the changed place.
+- lastUpdateIndex = Math.max((getViewCount() - 1), 0);
+- for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
+- View v = getView(i);
+- if (v != null) {
+- Shape childAlloc = getChildAllocation(i, a);
+- forwardUpdateToView(v, e, childAlloc, f);
++ // Update the view responsible for the changed element by invocation of
++ // super method.
++ super.forwardUpdate(ec, e, a, f);
++ // Re-calculate the update indexes and update the views followed by
++ // the changed place. Note: we update the views only when insertion or
++ // removal takes place.
++ DocumentEvent.EventType type = e.getType();
++ if (type == DocumentEvent.EventType.INSERT ||
++ type == DocumentEvent.EventType.REMOVE) {
++ firstUpdateIndex = Math.min((lastUpdateIndex + 1), (getViewCount() - 1));
++ lastUpdateIndex = Math.max((getViewCount() - 1), 0);
++ for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
++ View v = getView(i);
++ if (v != null) {
++ v.updateAfterChange();
++ }
+ }
+ }
+ }
+--- ./jdk/src/share/classes/javax/swing/text/GlyphView.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/swing/text/GlyphView.java Fri Apr 10 09:21:28 2015 -0700
+@@ -963,6 +963,14 @@
+ }
+ }
+
++ /** {@inheritDoc} */
++ @Override
++ void updateAfterChange() {
++ // Drop the break spots. They will be re-calculated during
++ // layout. It is necessary for proper line break calculation.
++ breakSpots = null;
++ }
++
+ /**
+ * Class to hold data needed to justify this GlyphView in a PargraphView.Row
+ */
+--- ./jdk/src/share/classes/javax/swing/text/View.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/swing/text/View.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1195,6 +1195,13 @@
+ }
+
+ /**
++ * Updates the view to reflect the changes.
++ */
++ void updateAfterChange() {
++ // Do nothing by default. Should be overridden in subclasses, if any.
++ }
++
++ /**
+ * Forwards the <code>DocumentEvent</code> to the give child view. This
+ * simply messages the view with a call to <code>insertUpdate</code>,
+ * <code>removeUpdate</code>, or <code>changedUpdate</code> depending
+--- ./jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1371,8 +1371,13 @@
+ Element parent = elem.getParentElement();
+
+ if (parent != null) {
++ // If we are going to insert the string into the body
++ // section, it is necessary to set the corrsponding flag.
++ if (HTML.Tag.BODY.name.equals(parent.getName())) {
++ insertInBody = true;
++ }
+ int offset = elem.getEndOffset();
+- if (offset > getLength()) {
++ if (offset > (getLength() + 1)) {
+ offset--;
+ }
+ else if (elem.isLeaf() && getText(offset - 1, 1).
+@@ -1380,6 +1385,10 @@
+ offset--;
+ }
+ insertHTML(parent, offset, htmlText, false);
++ // Cleanup the flag, if any.
++ if (insertInBody) {
++ insertInBody = false;
++ }
+ }
+ }
+ }
+@@ -1818,6 +1827,11 @@
+ private static char[] NEWLINE;
+
+ /**
++ * Indicates that direct insertion to body section takes place.
++ */
++ private boolean insertInBody = false;
++
++ /**
+ * I18N property key.
+ *
+ * @see AbstractDocument#I18NProperty
+@@ -2566,7 +2580,9 @@
+ // Assume content should be added.
+ foundInsertTag(false);
+ foundInsertTag = true;
+- inParagraph = impliedP = true;
++ // If content is added directly to the body, it should
++ // be wrapped by p-implied.
++ inParagraph = impliedP = !insertInBody;
+ }
+ if (data.length >= 1) {
+ addContent(data, 0, data.length);
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/jdk/net/ExtendedSocketOptions.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,60 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package jdk.net;
++
++import java.net.SocketOption;
++
++/**
++ * Defines extended socket options, beyond those defined in
++ * {@link java.net.StandardSocketOptions}. These options may be platform
++ * specific.
++ *
++ */
++public final class ExtendedSocketOptions {
++
++ private static class ExtSocketOption<T> implements SocketOption<T> {
++ private final String name;
++ private final Class<T> type;
++ ExtSocketOption(String name, Class<T> type) {
++ this.name = name;
++ this.type = type;
++ }
++ @Override public String name() { return name; }
++ @Override public Class<T> type() { return type; }
++ @Override public String toString() { return name; }
++ }
++
++ private ExtendedSocketOptions() {}
++
++ /**
++ * Service level properties. When a security manager is installed,
++ * setting or getting this option requires a {@link NetworkPermission}
++ * {@code ("setOption.SO_FLOW_SLA")} or {@code "getOption.SO_FLOW_SLA"}
++ * respectively.
++ */
++ public static final SocketOption<SocketFlow> SO_FLOW_SLA = new
++ ExtSocketOption<SocketFlow>("SO_FLOW_SLA", SocketFlow.class);
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/jdk/net/NetworkPermission.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,89 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package jdk.net;
++
++import java.security.BasicPermission;
++
++/**
++ * Represents permission to access the extended networking capabilities
++ * defined in the jdk.net package. These permissions contain a target
++ * name, but no actions list. Callers either possess the permission or not.
++ * <p>
++ * The following targets are defined:
++ * <p>
++ * <table border=1 cellpadding=5 summary="permission target name,
++ * what the target allows,and associated risks">
++ * <tr>
++ * <th>Permission Target Name</th>
++ * <th>What the Permission Allows</th>
++ * <th>Risks of Allowing this Permission</th>
++ * </tr>
++ * <tr>
++ * <td>setOption.SO_FLOW_SLA</td>
++ * <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option
++ * on any socket that supports it</td>
++ * <td>allows caller to set a higher priority or bandwidth allocation
++ * to sockets it creates, than they might otherwise be allowed.</td>
++ * </tr>
++ * <tr>
++ * <td>getOption.SO_FLOW_SLA</td>
++ * <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA}
++ * setting from any socket that supports the option</td>
++ * <td>allows caller access to SLA information that it might not
++ * otherwise have</td>
++ * </tr></table>
++ *
++ * @see jdk.net.ExtendedSocketOptions
++ *
++ */
++
++public final class NetworkPermission extends BasicPermission {
++
++ private static final long serialVersionUID = -2012939586906722291L;
++
++ /**
++ * Creates a NetworkPermission with the given target name.
++ *
++ * @param name the permission target name
++ * @throws NullPointerException if {@code name} is {@code null}.
++ * @throws IllegalArgumentException if {@code name} is empty.
++ */
++ public NetworkPermission(String name) {
++ super(name);
++ }
++
++ /**
++ * Creates a NetworkPermission with the given target name.
++ *
++ * @param name the permission target name
++ * @param actions should be {@code null}. Is ignored if not.
++ * @throws NullPointerException if {@code name} is {@code null}.
++ * @throws IllegalArgumentException if {@code name} is empty.
++ */
++ public NetworkPermission(String name, String actions) {
++ super(name, actions);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/jdk/net/SocketFlow.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,165 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package jdk.net;
++
++
++/**
++ * Represents the service level properties for the platform specific socket
++ * option {@link ExtendedSocketOptions#SO_FLOW_SLA}.
++ * <p>
++ * The priority and bandwidth parameters must be set before
++ * setting the socket option.
++ * <p>
++ * When the {@code SO_FLOW_SLA} option is set then it may not take effect
++ * immediately. If the value of the socket option is obtained with
++ * {@code getOption()} then the status may be returned as {@code INPROGRESS}
++ * until it takes effect. The priority and bandwidth values are only valid when
++ * the status is returned as OK.
++ * <p>
++ * When a security manager is installed, a {@link NetworkPermission}
++ * is required to set or get this option.
++ *
++ */
++
++public class SocketFlow {
++
++ private static final int UNSET = -1;
++ public static final int NORMAL_PRIORITY = 1;
++ public static final int HIGH_PRIORITY = 2;
++
++ private int priority = NORMAL_PRIORITY;
++
++ private long bandwidth = UNSET;
++
++ private Status status = Status.NO_STATUS;
++
++ private SocketFlow() {}
++
++ /**
++ * Enumeration of the return values from the SO_FLOW_SLA
++ * socket option. Both setting and getting the option return
++ * one of these statuses, which reflect the state of socket's
++ * flow.
++ *
++ */
++ public enum Status {
++ /**
++ * Set or get socket option has not been called yet. Status
++ * values can only be retrieved after calling set or get.
++ */
++ NO_STATUS,
++ /**
++ * Flow successfully created.
++ */
++ OK,
++ /**
++ * Caller has no permission to create flow.
++ */
++ NO_PERMISSION,
++ /**
++ * Flow can not be created because socket is not connected.
++ */
++ NOT_CONNECTED,
++ /**
++ * Flow creation not supported for this socket.
++ */
++ NOT_SUPPORTED,
++ /**
++ * A flow already exists with identical attributes.
++ */
++ ALREADY_CREATED,
++ /**
++ * A flow is being created.
++ */
++ IN_PROGRESS,
++ /**
++ * Some other unspecified error.
++ */
++ OTHER
++ }
++
++ /**
++ * Creates a new SocketFlow that can be used to set the SO_FLOW_SLA
++ * socket option and create a socket flow.
++ */
++ public static SocketFlow create() {
++ return new SocketFlow();
++ }
++
++ /**
++ * Sets this SocketFlow's priority. Must be either NORMAL_PRIORITY
++ * HIGH_PRIORITY. If not set, a flow's priority is normal.
++ *
++ * @throws IllegalArgumentException if priority is not NORMAL_PRIORITY or
++ * HIGH_PRIORITY.
++ */
++ public SocketFlow priority(int priority) {
++ if (priority != NORMAL_PRIORITY && priority != HIGH_PRIORITY) {
++ throw new IllegalArgumentException("invalid priority");
++ }
++ this.priority = priority;
++ return this;
++ }
++
++ /**
++ * Sets this SocketFlow's bandwidth. Must be greater than or equal to zero.
++ * A value of zero drops all packets for the socket.
++ *
++ * @throws IllegalArgumentException if bandwidth is less than zero.
++ */
++ public SocketFlow bandwidth(long bandwidth) {
++ if (bandwidth < 0) {
++ throw new IllegalArgumentException("invalid bandwidth");
++ } else {
++ this.bandwidth = bandwidth;
++ }
++ return this;
++ }
++
++ /**
++ * Returns this SocketFlow's priority.
++ */
++ public int priority() {
++ return priority;
++ }
++
++ /**
++ * Returns this SocketFlow's bandwidth.
++ *
++ * @return this SocketFlow's bandwidth, or {@code -1} if status is not OK.
++ */
++ public long bandwidth() {
++ return bandwidth;
++ }
++
++ /**
++ * Returns the Status value of this SocketFlow. NO_STATUS is returned
++ * if the object was not used in a call to set or get the option.
++ */
++ public Status status() {
++ return status;
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/jdk/net/Sockets.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,406 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package jdk.net;
++
++import java.net.*;
++import java.io.IOException;
++import java.io.FileDescriptor;
++import java.security.PrivilegedAction;
++import java.security.AccessController;
++import java.lang.reflect.*;
++import java.util.Set;
++import java.util.HashSet;
++import java.util.HashMap;
++import java.util.Collections;
++import sun.net.ExtendedOptionsImpl;
++
++/**
++ * Defines static methods to set and get socket options defined by the
++ * {@link java.net.SocketOption} interface. All of the standard options defined
++ * by {@link java.net.Socket}, {@link java.net.ServerSocket}, and
++ * {@link java.net.DatagramSocket} can be set this way, as well as additional
++ * or platform specific options supported by each socket type.
++ * <p>
++ * The {@link #supportedOptions(Class)} method can be called to determine
++ * the complete set of options available (per socket type) on the
++ * current system.
++ * <p>
++ * When a security manager is installed, some non-standard socket options
++ * may require a security permission before being set or get.
++ * The details are specified in {@link ExtendedSocketOptions}. No permission
++ * is required for {@link java.net.StandardSocketOption}s.
++ *
++ * @see java.nio.channels.NetworkChannel
++ */
++public class Sockets {
++
++ private final static HashMap<Class<?>,Set<SocketOption<?>>>
++ options = new HashMap<>();
++
++ static {
++ initOptionSets();
++ AccessController.doPrivileged(
++ new java.security.PrivilegedAction<Void>() {
++ public Void run() {
++ initMethods();
++ return null;
++ }
++ }
++ );
++ }
++
++ private static Method siSetOption;
++ private static Method siGetOption;
++ private static Method dsiSetOption;
++ private static Method dsiGetOption;
++
++ private static void initMethods() {
++ try {
++ Class<?> clazz = Class.forName("java.net.SocketSecrets");
++
++ siSetOption = clazz.getDeclaredMethod(
++ "setOption", Object.class,
++ SocketOption.class, Object.class
++ );
++ siSetOption.setAccessible(true);
++
++ siGetOption = clazz.getDeclaredMethod(
++ "getOption", Object.class, SocketOption.class
++ );
++ siGetOption.setAccessible(true);
++
++ dsiSetOption = clazz.getDeclaredMethod(
++ "setOption", DatagramSocket.class,
++ SocketOption.class, Object.class
++ );
++ dsiSetOption.setAccessible(true);
++
++ dsiGetOption = clazz.getDeclaredMethod(
++ "getOption", DatagramSocket.class, SocketOption.class
++ );
++ dsiGetOption.setAccessible(true);
++ } catch (ReflectiveOperationException e) {
++ throw new Error(e);
++ }
++ }
++
++ private static <T> void invokeSet(
++ Method method, Object socket,
++ SocketOption<T> option, T value) throws IOException
++ {
++ try {
++ method.invoke(null, socket, option, value);
++ } catch (Exception e) {
++ if (e instanceof InvocationTargetException) {
++ Throwable t = ((InvocationTargetException)e).getTargetException();
++ if (t instanceof IOException) {
++ throw (IOException)t;
++ } else if (t instanceof RuntimeException) {
++ throw (RuntimeException)t;
++ }
++ }
++ throw new RuntimeException(e);
++ }
++ }
++
++ private static <T> T invokeGet(
++ Method method, Object socket, SocketOption<T> option) throws IOException
++ {
++ try {
++ return (T)method.invoke(null, socket, option);
++ } catch (Exception e) {
++ if (e instanceof InvocationTargetException) {
++ Throwable t = ((InvocationTargetException)e).getTargetException();
++ if (t instanceof IOException) {
++ throw (IOException)t;
++ } else if (t instanceof RuntimeException) {
++ throw (RuntimeException)t;
++ }
++ }
++ throw new RuntimeException(e);
++ }
++ }
++
++ private Sockets() {}
++
++ /**
++ * Sets the value of a socket option on a {@link java.net.Socket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ * @param value The value of the socket option. May be null for some
++ * options.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IllegalArgumentException if the value is not valid for
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs, or socket is closed.
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> void setOption(Socket s, SocketOption<T> name, T value) throws IOException
++ {
++ if (!isSupported(Socket.class, name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ invokeSet(siSetOption, s, name, value);
++ }
++
++ /**
++ * Returns the value of a socket option from a {@link java.net.Socket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ *
++ * @return The value of the socket option.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> T getOption(Socket s, SocketOption<T> name) throws IOException
++ {
++ if (!isSupported(Socket.class, name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ return invokeGet(siGetOption, s, name);
++ }
++
++ /**
++ * Sets the value of a socket option on a {@link java.net.ServerSocket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ * @param value The value of the socket option.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IllegalArgumentException if the value is not valid for
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> void setOption(ServerSocket s, SocketOption<T> name, T value) throws IOException
++ {
++ if (!isSupported(ServerSocket.class, name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ invokeSet(siSetOption, s, name, value);
++ }
++
++ /**
++ * Returns the value of a socket option from a {@link java.net.ServerSocket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ *
++ * @return The value of the socket option.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> T getOption(ServerSocket s, SocketOption<T> name) throws IOException
++ {
++ if (!isSupported(ServerSocket.class, name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ return invokeGet(siGetOption, s, name);
++ }
++
++ /**
++ * Sets the value of a socket option on a {@link java.net.DatagramSocket}
++ * or {@link java.net.MulticastSocket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ * @param value The value of the socket option.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IllegalArgumentException if the value is not valid for
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> void setOption(DatagramSocket s, SocketOption<T> name, T value) throws IOException
++ {
++ if (!isSupported(s.getClass(), name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ invokeSet(dsiSetOption, s, name, value);
++ }
++
++ /**
++ * Returns the value of a socket option from a
++ * {@link java.net.DatagramSocket} or {@link java.net.MulticastSocket}
++ *
++ * @param s the socket
++ * @param name The socket option
++ *
++ * @return The value of the socket option.
++ *
++ * @throws UnsupportedOperationException if the socket does not support
++ * the option.
++ *
++ * @throws IOException if an I/O error occurs
++ *
++ * @throws NullPointerException if name is null
++ *
++ * @throws SecurityException if a security manager is set and the
++ * caller does not have any required permission.
++ *
++ * @see java.net.StandardSocketOptions
++ */
++ public static <T> T getOption(DatagramSocket s, SocketOption<T> name) throws IOException
++ {
++ if (!isSupported(s.getClass(), name)) {
++ throw new UnsupportedOperationException(name.name());
++ }
++ return invokeGet(dsiGetOption, s, name);
++ }
++
++ /**
++ * Returns a set of {@link java.net.SocketOption}s supported by the
++ * given socket type. This set may include standard options and also
++ * non standard extended options.
++ *
++ * @param socketType the type of java.net socket
++ *
++ * @throws IllegalArgumentException if socketType is not a valid
++ * socket type from the java.net package.
++ */
++ public static Set<SocketOption<?>> supportedOptions(Class<?> socketType) {
++ Set<SocketOption<?>> set = options.get(socketType);
++ if (set == null) {
++ throw new IllegalArgumentException("unknown socket type");
++ }
++ return set;
++ }
++
++ private static boolean isSupported(Class<?> type, SocketOption<?> option) {
++ Set<SocketOption<?>> options = supportedOptions(type);
++ return options.contains(option);
++ }
++
++ private static void initOptionSets() {
++ boolean flowsupported = ExtendedOptionsImpl.flowSupported();
++
++ // Socket
++
++ Set<SocketOption<?>> set = new HashSet<>();
++ set.add(StandardSocketOptions.SO_KEEPALIVE);
++ set.add(StandardSocketOptions.SO_SNDBUF);
++ set.add(StandardSocketOptions.SO_RCVBUF);
++ set.add(StandardSocketOptions.SO_REUSEADDR);
++ set.add(StandardSocketOptions.SO_LINGER);
++ set.add(StandardSocketOptions.IP_TOS);
++ set.add(StandardSocketOptions.TCP_NODELAY);
++ if (flowsupported) {
++ set.add(ExtendedSocketOptions.SO_FLOW_SLA);
++ }
++ set = Collections.unmodifiableSet(set);
++ options.put(Socket.class, set);
++
++ // ServerSocket
++
++ set = new HashSet<>();
++ set.add(StandardSocketOptions.SO_RCVBUF);
++ set.add(StandardSocketOptions.SO_REUSEADDR);
++ set.add(StandardSocketOptions.IP_TOS);
++ set = Collections.unmodifiableSet(set);
++ options.put(ServerSocket.class, set);
++
++ // DatagramSocket
++
++ set = new HashSet<>();
++ set.add(StandardSocketOptions.SO_SNDBUF);
++ set.add(StandardSocketOptions.SO_RCVBUF);
++ set.add(StandardSocketOptions.SO_REUSEADDR);
++ set.add(StandardSocketOptions.IP_TOS);
++ if (flowsupported) {
++ set.add(ExtendedSocketOptions.SO_FLOW_SLA);
++ }
++ set = Collections.unmodifiableSet(set);
++ options.put(DatagramSocket.class, set);
++
++ // MulticastSocket
++
++ set = new HashSet<>();
++ set.add(StandardSocketOptions.SO_SNDBUF);
++ set.add(StandardSocketOptions.SO_RCVBUF);
++ set.add(StandardSocketOptions.SO_REUSEADDR);
++ set.add(StandardSocketOptions.IP_TOS);
++ set.add(StandardSocketOptions.IP_MULTICAST_IF);
++ set.add(StandardSocketOptions.IP_MULTICAST_TTL);
++ set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
++ if (flowsupported) {
++ set.add(ExtendedSocketOptions.SO_FLOW_SLA);
++ }
++ set = Collections.unmodifiableSet(set);
++ options.put(MulticastSocket.class, set);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/jdk/net/package-info.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,32 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/**
++ * Platform specific socket options for the {@code java.net} and {@code java.nio.channels}
++ * socket classes.
++ *
++ */
++
++package jdk.net;
+--- ./jdk/src/share/classes/sun/awt/AWTAccessor.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/awt/AWTAccessor.java Fri Apr 10 09:21:28 2015 -0700
+@@ -650,6 +650,11 @@
+ * Sets extendedKeyCode field for KeyEvent
+ */
+ void setExtendedKeyCode(KeyEvent ev, long extendedKeyCode);
++
++ /**
++ * Gets original source for KeyEvent
++ */
++ Component getOriginalSource(KeyEvent ev);
+ }
+
+ /**
+--- ./jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1365,6 +1365,15 @@
+ // bytes and dump them into a byte array. For text flavors, decode back
+ // to a String and recur to reencode according to the requested format.
+ } else if (flavor.isRepresentationClassInputStream()) {
++
++ // Workaround to JDK-8024061: Exception thrown when drag and drop
++ // between two components is executed quickly.
++ // and JDK-8065098: JColorChooser no longer supports drag and drop
++ // between two JVM instances
++ if (!(obj instanceof InputStream)) {
++ return new byte[0];
++ }
++
+ InputStream is = (InputStream)obj;
+ boolean eof = false;
+ int avail = is.available();
+@@ -2911,6 +2920,14 @@
+ return comp;
+ }
+
++ if (flavor1.isFlavorTextType()) {
++ return 1;
++ }
++
++ if (flavor2.isFlavorTextType()) {
++ return -1;
++ }
++
+ // Next, look for application/x-java-* types. Prefer unknown
+ // MIME types because if the user provides his own data flavor,
+ // it will likely be the most descriptive one.
+--- ./jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -239,13 +239,6 @@
+
+ if (localTransferable != null) {
+ return localTransferable.getTransferData(df);
+- } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
+- // Workaround to JDK-8024061: Exception thrown when drag and drop
+- // between two components is executed quickly.
+- // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
+- // is used. Executing further results in ClassCastException, so null is
+- // returned here as no transfer data is available in this case.
+- return null;
+ }
+
+ if (dropStatus != STATUS_ACCEPT || dropComplete) {
+--- ./jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1408,10 +1408,10 @@
+ }
+ }
+
+- int lastbit = (dataBitOffset
+- + (height-1) * scanlineStride * 8
+- + (width-1) * pixelBitStride
+- + pixelBitStride - 1);
++ long lastbit = (long) dataBitOffset
++ + (long) (height - 1) * (long) scanlineStride * 8
++ + (long) (width - 1) * (long) pixelBitStride
++ + (long) pixelBitStride - 1;
+ if (lastbit < 0 || lastbit / 8 >= data.length) {
+ throw new RasterFormatException("raster dimensions overflow " +
+ "array bounds");
+--- ./jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Fri Apr 10 09:21:28 2015 -0700
+@@ -777,7 +777,7 @@
+ JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
+ connServer.start();
+ } catch (IOException e) {
+- if (connServer == null) {
++ if (connServer == null || connServer.getAddress() == null) {
+ throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
+ e, url.toString());
+ } else {
+--- ./jdk/src/share/classes/sun/misc/ProxyGenerator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/misc/ProxyGenerator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -27,11 +27,15 @@
+
+ import java.io.ByteArrayOutputStream;
+ import java.io.DataOutputStream;
++import java.io.File;
+ import java.io.FileOutputStream;
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.lang.reflect.Array;
+ import java.lang.reflect.Method;
++import java.nio.file.Files;
++import java.nio.file.Path;
++import java.nio.file.Paths;
+ import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.LinkedList;
+@@ -327,10 +331,16 @@
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
+ try {
+- FileOutputStream file =
+- new FileOutputStream(dotToSlash(name) + ".class");
+- file.write(classFile);
+- file.close();
++ int i = name.lastIndexOf('.');
++ Path path;
++ if (i > 0) {
++ Path dir = Paths.get(name.substring(0, i).replace('.', File.separatorChar));
++ Files.createDirectories(dir);
++ path = dir.resolve(name.substring(i+1, name.length()) + ".class");
++ } else {
++ path = Paths.get(name + ".class");
++ }
++ Files.write(path, classFile);
+ return null;
+ } catch (IOException e) {
+ throw new InternalError(
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/classes/sun/net/ExtendedOptionsImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,94 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++package sun.net;
++
++import java.net.*;
++import jdk.net.*;
++import java.io.IOException;
++import java.io.FileDescriptor;
++import java.security.PrivilegedAction;
++import java.security.AccessController;
++import java.lang.reflect.Field;
++import java.util.Set;
++import java.util.HashSet;
++import java.util.HashMap;
++import java.util.Collections;
++
++/**
++ * Contains the native implementation for extended socket options
++ * together with some other static utilities
++ */
++public class ExtendedOptionsImpl {
++
++ static {
++ AccessController.doPrivileged(new PrivilegedAction<Void>() {
++ @Override
++ public Void run() {
++ System.loadLibrary("net");
++ return null;
++ }});
++ init();
++ }
++
++ private ExtendedOptionsImpl() {}
++
++ public static void checkSetOptionPermission(SocketOption<?> option) {
++ SecurityManager sm = System.getSecurityManager();
++ if (sm == null) {
++ return;
++ }
++ String check = "setOption." + option.name();
++ sm.checkPermission(new NetworkPermission(check));
++ }
++
++ public static void checkGetOptionPermission(SocketOption<?> option) {
++ SecurityManager sm = System.getSecurityManager();
++ if (sm == null) {
++ return;
++ }
++ String check = "getOption." + option.name();
++ sm.checkPermission(new NetworkPermission(check));
++ }
++
++ public static void checkValueType(Object value, Class<?> type) {
++ if (!type.isAssignableFrom(value.getClass())) {
++ String s = "Found: " + value.getClass().toString() + " Expected: "
++ + type.toString();
++ throw new IllegalArgumentException(s);
++ }
++ }
++
++ private static native void init();
++
++ /*
++ * Extension native implementations
++ *
++ * SO_FLOW_SLA
++ */
++ public static native void setFlowOption(FileDescriptor fd, SocketFlow f);
++ public static native void getFlowOption(FileDescriptor fd, SocketFlow f);
++ public static native boolean flowSupported();
++}
+--- ./jdk/src/share/classes/sun/net/httpserver/ServerImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/net/httpserver/ServerImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -330,15 +330,7 @@
+ public void run() {
+ while (!finished) {
+ try {
+- ListIterator<HttpConnection> li =
+- connsToRegister.listIterator();
+- for (HttpConnection c : connsToRegister) {
+- reRegister(c);
+- }
+- connsToRegister.clear();
+-
+ List<Event> list = null;
+- selector.select(1000);
+ synchronized (lolock) {
+ if (events.size() > 0) {
+ list = events;
+@@ -352,8 +344,14 @@
+ }
+ }
+
++ for (HttpConnection c : connsToRegister) {
++ reRegister(c);
++ }
++ connsToRegister.clear();
++
++ selector.select(1000);
++
+ /* process the selected list now */
+-
+ Set<SelectionKey> selected = selector.selectedKeys();
+ Iterator<SelectionKey> iter = selected.iterator();
+ while (iter.hasNext()) {
+--- ./jdk/src/share/classes/sun/net/www/http/HttpClient.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/net/www/http/HttpClient.java Fri Apr 10 09:21:28 2015 -0700
+@@ -643,9 +643,10 @@
+ cachedHttpClient = false;
+ if (!failedOnce && requests != null) {
+ failedOnce = true;
+- if (getRequestMethod().equals("CONNECT") ||
+- (httpuc.getRequestMethod().equals("POST") &&
+- (!retryPostProp || streaming))) {
++ if (getRequestMethod().equals("CONNECT")
++ || streaming
++ || (httpuc.getRequestMethod().equals("POST")
++ && !retryPostProp)) {
+ // do not retry the request
+ } else {
+ // try once more
+@@ -755,9 +756,10 @@
+ } else if (nread != 8) {
+ if (!failedOnce && requests != null) {
+ failedOnce = true;
+- if (getRequestMethod().equals("CONNECT") ||
+- (httpuc.getRequestMethod().equals("POST") &&
+- (!retryPostProp || streaming))) {
++ if (getRequestMethod().equals("CONNECT")
++ || streaming
++ || (httpuc.getRequestMethod().equals("POST")
++ && !retryPostProp)) {
+ // do not retry the request
+ } else {
+ closeServer();
+--- ./jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1093,7 +1093,7 @@
+
+ boolean expectContinue = false;
+ String expects = requests.findValue("Expect");
+- if ("100-Continue".equalsIgnoreCase(expects)) {
++ if ("100-Continue".equalsIgnoreCase(expects) && streaming()) {
+ http.setIgnoreContinue(false);
+ expectContinue = true;
+ }
+--- ./jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java Fri Apr 10 09:21:28 2015 -0700
+@@ -192,22 +192,6 @@
+ return userAgent;
+ }
+
+- // should remove once HttpClient.newHttpProxy is putback
+- private static Proxy newHttpProxy(String proxyHost, int proxyPort) {
+- InetSocketAddress saddr = null;
+- final String phost = proxyHost;
+- final int pport = proxyPort < 0 ? httpsPortNumber : proxyPort;
+- try {
+- saddr = java.security.AccessController.doPrivileged(new
+- java.security.PrivilegedExceptionAction<InetSocketAddress>() {
+- public InetSocketAddress run() {
+- return new InetSocketAddress(phost, pport);
+- }});
+- } catch (java.security.PrivilegedActionException pae) {
+- }
+- return new Proxy(Proxy.Type.HTTP, saddr);
+- }
+-
+ // CONSTRUCTOR, FACTORY
+
+
+@@ -251,7 +235,7 @@
+ throws IOException {
+ this(sf, url,
+ (proxyHost == null? null:
+- HttpsClient.newHttpProxy(proxyHost, proxyPort)),
++ HttpClient.newHttpProxy(proxyHost, proxyPort, "https")),
+ connectTimeout);
+ }
+
+@@ -261,6 +245,11 @@
+ HttpsClient(SSLSocketFactory sf, URL url, Proxy proxy,
+ int connectTimeout)
+ throws IOException {
++ PlatformLogger logger = HttpURLConnection.getHttpLogger();
++ if (logger.isLoggable(PlatformLogger.FINEST)) {
++ logger.finest("Creating new HttpsClient with url:" + url + " and proxy:" + proxy +
++ " with connect timeout:" + connectTimeout);
++ }
+ this.proxy = proxy;
+ setSSLSocketFactory(sf);
+ this.proxyDisabled = true;
+@@ -317,7 +306,7 @@
+
+ return HttpsClient.New(sf, url, hv,
+ (proxyHost == null? null :
+- HttpsClient.newHttpProxy(proxyHost, proxyPort)),
++ HttpClient.newHttpProxy(proxyHost, proxyPort, "https")),
+ useCache, connectTimeout, httpuc);
+ }
+
+@@ -329,6 +318,11 @@
+ if (p == null) {
+ p = Proxy.NO_PROXY;
+ }
++ PlatformLogger logger = HttpURLConnection.getHttpLogger();
++ if (logger.isLoggable(PlatformLogger.FINEST)) {
++ logger.finest("Looking for HttpClient for URL " + url +
++ " and proxy value of " + p);
++ }
+ HttpsClient ret = null;
+ if (useCache) {
+ /* see if one's already around */
+@@ -342,14 +336,13 @@
+
+ if (ret != null) {
+ if ((ret.proxy != null && ret.proxy.equals(p)) ||
+- (ret.proxy == null && p == null)) {
++ (ret.proxy == null && p == Proxy.NO_PROXY)) {
+ synchronized (ret) {
+ ret.cachedHttpClient = true;
+ assert ret.inCache;
+ ret.inCache = false;
+ if (httpuc != null && ret.needsTunneling())
+ httpuc.setTunnelState(TUNNELING);
+- PlatformLogger logger = HttpURLConnection.getHttpLogger();
+ if (logger.isLoggable(PlatformLogger.FINEST)) {
+ logger.finest("KeepAlive stream retrieved from the cache, " + ret);
+ }
+@@ -360,6 +353,9 @@
+ // This should be fine as it is very rare that a connection
+ // to the same host will not use the same proxy.
+ synchronized(ret) {
++ if (logger.isLoggable(PlatformLogger.FINEST)) {
++ logger.finest("Not returning this connection to cache: " + ret);
++ }
+ ret.inCache = false;
+ ret.closeServer();
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -39,6 +39,7 @@
+ import java.util.concurrent.*;
+ import java.util.concurrent.locks.*;
+ import sun.net.NetHooks;
++import sun.net.ExtendedOptionsImpl;
+
+ /**
+ * Base implementation of AsynchronousSocketChannel
+@@ -508,6 +509,9 @@
+ set.add(StandardSocketOptions.SO_KEEPALIVE);
+ set.add(StandardSocketOptions.SO_REUSEADDR);
+ set.add(StandardSocketOptions.TCP_NODELAY);
++ if (ExtendedOptionsImpl.flowSupported()) {
++ set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
++ }
+ return Collections.unmodifiableSet(set);
+ }
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -33,6 +33,7 @@
+ import java.nio.channels.spi.*;
+ import java.util.*;
+ import sun.net.ResourceManager;
++import sun.net.ExtendedOptionsImpl;
+
+
+ /**
+@@ -194,15 +195,8 @@
+ synchronized (stateLock) {
+ ensureOpen();
+
+- if (name == StandardSocketOptions.IP_TOS) {
+- // IPv4 only; no-op for IPv6
+- if (family == StandardProtocolFamily.INET) {
+- Net.setSocketOption(fd, family, name, value);
+- }
+- return this;
+- }
+-
+- if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
++ if (name == StandardSocketOptions.IP_TOS ||
++ name == StandardSocketOptions.IP_MULTICAST_TTL ||
+ name == StandardSocketOptions.IP_MULTICAST_LOOP)
+ {
+ // options are protocol dependent
+@@ -255,16 +249,8 @@
+ synchronized (stateLock) {
+ ensureOpen();
+
+- if (name == StandardSocketOptions.IP_TOS) {
+- // IPv4 only; always return 0 on IPv6
+- if (family == StandardProtocolFamily.INET) {
+- return (T) Net.getSocketOption(fd, family, name);
+- } else {
+- return (T) Integer.valueOf(0);
+- }
+- }
+-
+- if (name == StandardSocketOptions.IP_MULTICAST_TTL ||
++ if (name == StandardSocketOptions.IP_TOS ||
++ name == StandardSocketOptions.IP_MULTICAST_TTL ||
+ name == StandardSocketOptions.IP_MULTICAST_LOOP)
+ {
+ return (T) Net.getSocketOption(fd, family, name);
+@@ -317,6 +303,9 @@
+ set.add(StandardSocketOptions.IP_MULTICAST_IF);
+ set.add(StandardSocketOptions.IP_MULTICAST_TTL);
+ set.add(StandardSocketOptions.IP_MULTICAST_LOOP);
++ if (ExtendedOptionsImpl.flowSupported()) {
++ set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
++ }
+ return Collections.unmodifiableSet(set);
+ }
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -397,30 +397,13 @@
+ //
+ private static volatile boolean fileSupported = true;
+
+- private long transferToDirectly(long position, int icount,
+- WritableByteChannel target)
++ private long transferToDirectlyInternal(long position, int icount,
++ WritableByteChannel target,
++ FileDescriptor targetFD)
+ throws IOException
+ {
+- if (!transferSupported)
+- return IOStatus.UNSUPPORTED;
+-
+- FileDescriptor targetFD = null;
+- if (target instanceof FileChannelImpl) {
+- if (!fileSupported)
+- return IOStatus.UNSUPPORTED_CASE;
+- targetFD = ((FileChannelImpl)target).fd;
+- } else if (target instanceof SelChImpl) {
+- // Direct transfer to pipe causes EINVAL on some configurations
+- if ((target instanceof SinkChannelImpl) && !pipeSupported)
+- return IOStatus.UNSUPPORTED_CASE;
+- targetFD = ((SelChImpl)target).getFD();
+- }
+- if (targetFD == null)
+- return IOStatus.UNSUPPORTED;
+- int thisFDVal = IOUtil.fdVal(fd);
+- int targetFDVal = IOUtil.fdVal(targetFD);
+- if (thisFDVal == targetFDVal) // Not supported on some configurations
+- return IOStatus.UNSUPPORTED;
++ assert !nd.transferToDirectlyNeedsPositionLock() ||
++ Thread.holdsLock(positionLock);
+
+ long n = -1;
+ int ti = -1;
+@@ -430,7 +413,7 @@
+ if (!isOpen())
+ return -1;
+ do {
+- n = transferTo0(thisFDVal, position, icount, targetFDVal);
++ n = transferTo0(fd, position, icount, targetFD);
+ } while ((n == IOStatus.INTERRUPTED) && isOpen());
+ if (n == IOStatus.UNSUPPORTED_CASE) {
+ if (target instanceof SinkChannelImpl)
+@@ -451,6 +434,54 @@
+ }
+ }
+
++ private long transferToDirectly(long position, int icount,
++ WritableByteChannel target)
++ throws IOException
++ {
++ if (!transferSupported)
++ return IOStatus.UNSUPPORTED;
++
++ FileDescriptor targetFD = null;
++ if (target instanceof FileChannelImpl) {
++ if (!fileSupported)
++ return IOStatus.UNSUPPORTED_CASE;
++ targetFD = ((FileChannelImpl)target).fd;
++ } else if (target instanceof SelChImpl) {
++ // Direct transfer to pipe causes EINVAL on some configurations
++ if ((target instanceof SinkChannelImpl) && !pipeSupported)
++ return IOStatus.UNSUPPORTED_CASE;
++
++ // Platform-specific restrictions. Now there is only one:
++ // Direct transfer to non-blocking channel could be forbidden
++ SelectableChannel sc = (SelectableChannel)target;
++ if (!nd.canTransferToDirectly(sc))
++ return IOStatus.UNSUPPORTED_CASE;
++
++ targetFD = ((SelChImpl)target).getFD();
++ }
++
++ if (targetFD == null)
++ return IOStatus.UNSUPPORTED;
++ int thisFDVal = IOUtil.fdVal(fd);
++ int targetFDVal = IOUtil.fdVal(targetFD);
++ if (thisFDVal == targetFDVal) // Not supported on some configurations
++ return IOStatus.UNSUPPORTED;
++
++ if (nd.transferToDirectlyNeedsPositionLock()) {
++ synchronized (positionLock) {
++ long pos = position();
++ try {
++ return transferToDirectlyInternal(position, icount,
++ target, targetFD);
++ } finally {
++ position(pos);
++ }
++ }
++ } else {
++ return transferToDirectlyInternal(position, icount, target, targetFD);
++ }
++ }
++
+ // Maximum size to map when using a mapped buffer
+ private static final long MAPPED_TRANSFER_SIZE = 8L*1024L*1024L;
+
+@@ -1157,7 +1188,8 @@
+ private static native int unmap0(long address, long length);
+
+ // Transfers from src to dst, or returns -2 if kernel can't do that
+- private native long transferTo0(int src, long position, long count, int dst);
++ private native long transferTo0(FileDescriptor src, long position,
++ long count, FileDescriptor dst);
+
+ // Sets or reports this file's position
+ // If offset is -1, the current position is returned
+--- ./jdk/src/share/classes/sun/nio/ch/FileDispatcher.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/FileDispatcher.java Fri Apr 10 09:21:28 2015 -0700
+@@ -25,7 +25,9 @@
+
+ package sun.nio.ch;
+
+-import java.io.*;
++import java.io.FileDescriptor;
++import java.io.IOException;
++import java.nio.channels.SelectableChannel;
+
+ abstract class FileDispatcher extends NativeDispatcher {
+
+@@ -53,4 +55,8 @@
+ */
+ abstract FileDescriptor duplicateForMapping(FileDescriptor fd)
+ throws IOException;
++
++ abstract boolean canTransferToDirectly(SelectableChannel sc);
++
++ abstract boolean transferToDirectlyNeedsPositionLock();
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/Net.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/Net.java Fri Apr 10 09:21:28 2015 -0700
+@@ -27,11 +27,13 @@
+
+ import java.io.*;
+ import java.net.*;
++import jdk.net.*;
+ import java.nio.channels.*;
+ import java.util.*;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+ import java.security.PrivilegedExceptionAction;
++import sun.net.ExtendedOptionsImpl;
+
+
+ class Net { // package-private
+@@ -54,30 +56,8 @@
+ // set to true if exclusive binding is on for Windows
+ private static final boolean exclusiveBind;
+
+- static {
+- int availLevel = isExclusiveBindAvailable();
+- if (availLevel >= 0) {
+- String exclBindProp =
+- java.security.AccessController.doPrivileged(
+- new PrivilegedAction<String>() {
+- @Override
+- public String run() {
+- return System.getProperty(
+- "sun.net.useExclusiveBind");
+- }
+- });
+- if (exclBindProp != null) {
+- exclusiveBind = exclBindProp.length() == 0 ?
+- true : Boolean.parseBoolean(exclBindProp);
+- } else if (availLevel == 1) {
+- exclusiveBind = true;
+- } else {
+- exclusiveBind = false;
+- }
+- } else {
+- exclusiveBind = false;
+- }
+- }
++ // set to true if the fast tcp loopback should be enabled on Windows
++ private static final boolean fastLoopback;
+
+ // -- Miscellaneous utilities --
+
+@@ -327,6 +307,16 @@
+
+ // only simple values supported by this method
+ Class<?> type = name.type();
++
++ if (type == SocketFlow.class) {
++ SecurityManager sm = System.getSecurityManager();
++ if (sm != null) {
++ sm.checkPermission(new NetworkPermission("setOption.SO_FLOW_SLA"));
++ }
++ ExtendedOptionsImpl.setFlowOption(fd, (SocketFlow)value);
++ return;
++ }
++
+ if (type != Integer.class && type != Boolean.class)
+ throw new AssertionError("Should not reach here");
+
+@@ -370,7 +360,8 @@
+ }
+
+ boolean mayNeedConversion = (family == UNSPEC);
+- setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg);
++ boolean isIPv6 = (family == StandardProtocolFamily.INET6);
++ setIntOption0(fd, mayNeedConversion, key.level(), key.name(), arg, isIPv6);
+ }
+
+ static Object getSocketOption(FileDescriptor fd, ProtocolFamily family,
+@@ -379,6 +370,16 @@
+ {
+ Class<?> type = name.type();
+
++ if (type == SocketFlow.class) {
++ SecurityManager sm = System.getSecurityManager();
++ if (sm != null) {
++ sm.checkPermission(new NetworkPermission("getOption.SO_FLOW_SLA"));
++ }
++ SocketFlow flow = SocketFlow.create();
++ ExtendedOptionsImpl.getFlowOption(fd, flow);
++ return flow;
++ }
++
+ // only simple values supported by this method
+ if (type != Integer.class && type != Boolean.class)
+ throw new AssertionError("Should not reach here");
+@@ -398,6 +399,23 @@
+ }
+ }
+
++ public static boolean isFastTcpLoopbackRequested() {
++ String loopbackProp = java.security.AccessController.doPrivileged(
++ new PrivilegedAction<String>() {
++ @Override
++ public String run() {
++ return System.getProperty("jdk.net.useFastTcpLoopback");
++ }
++ });
++ boolean enable;
++ if ("".equals(loopbackProp)) {
++ enable = true;
++ } else {
++ enable = Boolean.parseBoolean(loopbackProp);
++ }
++ return enable;
++ }
++
+ // -- Socket operations --
+
+ private static native boolean isIPv6Available0();
+@@ -420,15 +438,16 @@
+ throws IOException {
+ boolean preferIPv6 = isIPv6Available() &&
+ (family != StandardProtocolFamily.INET);
+- return IOUtil.newFD(socket0(preferIPv6, stream, false));
++ return IOUtil.newFD(socket0(preferIPv6, stream, false, fastLoopback));
+ }
+
+ static FileDescriptor serverSocket(boolean stream) {
+- return IOUtil.newFD(socket0(isIPv6Available(), stream, true));
++ return IOUtil.newFD(socket0(isIPv6Available(), stream, true, fastLoopback));
+ }
+
+ // Due to oddities SO_REUSEADDR on windows reuse is ignored
+- private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
++ private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse,
++ boolean fastLoopback);
+
+ static void bind(FileDescriptor fd, InetAddress addr, int port)
+ throws IOException
+@@ -507,7 +526,7 @@
+ throws IOException;
+
+ private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
+- int level, int opt, int arg)
++ int level, int opt, int arg, boolean isIPv6)
+ throws IOException;
+
+ // -- Multicast support --
+@@ -613,4 +632,30 @@
+ initIDs();
+ }
+
++ static {
++ int availLevel = isExclusiveBindAvailable();
++ if (availLevel >= 0) {
++ String exclBindProp =
++ java.security.AccessController.doPrivileged(
++ new PrivilegedAction<String>() {
++ @Override
++ public String run() {
++ return System.getProperty(
++ "sun.net.useExclusiveBind");
++ }
++ });
++ if (exclBindProp != null) {
++ exclusiveBind = exclBindProp.length() == 0 ?
++ true : Boolean.parseBoolean(exclBindProp);
++ } else if (availLevel == 1) {
++ exclusiveBind = true;
++ } else {
++ exclusiveBind = false;
++ }
++ } else {
++ exclusiveBind = false;
++ }
++
++ fastLoopback = isFastTcpLoopbackRequested();
++ }
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -133,6 +133,14 @@
+ synchronized (stateLock) {
+ if (!isOpen())
+ throw new ClosedChannelException();
++
++ if (name == StandardSocketOptions.IP_TOS) {
++ ProtocolFamily family = Net.isIPv6Available() ?
++ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
++ Net.setSocketOption(fd, family, name, value);
++ return this;
++ }
++
+ if (name == StandardSocketOptions.SO_REUSEADDR &&
+ Net.useExclusiveBind())
+ {
+@@ -177,6 +185,7 @@
+ HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
+ set.add(StandardSocketOptions.SO_RCVBUF);
+ set.add(StandardSocketOptions.SO_REUSEADDR);
++ set.add(StandardSocketOptions.IP_TOS);
+ return Collections.unmodifiableSet(set);
+ }
+ }
+--- ./jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -33,6 +33,7 @@
+ import java.nio.channels.spi.*;
+ import java.util.*;
+ import sun.net.NetHooks;
++import sun.net.ExtendedOptionsImpl;
+ import sun.misc.IoTrace;
+
+ /**
+@@ -172,14 +173,14 @@
+ if (!isOpen())
+ throw new ClosedChannelException();
+
+- // special handling for IP_TOS: no-op when IPv6
+ if (name == StandardSocketOptions.IP_TOS) {
+- if (!Net.isIPv6Available())
+- Net.setSocketOption(fd, StandardProtocolFamily.INET, name, value);
++ ProtocolFamily family = Net.isIPv6Available() ?
++ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
++ Net.setSocketOption(fd, family, name, value);
+ return this;
+- } else if (name == StandardSocketOptions.SO_REUSEADDR &&
+- Net.useExclusiveBind())
+- {
++ }
++
++ if (name == StandardSocketOptions.SO_REUSEADDR && Net.useExclusiveBind()) {
+ // SO_REUSEADDR emulated when using exclusive bind
+ isReuseAddress = (Boolean)value;
+ return this;
+@@ -214,8 +215,9 @@
+
+ // special handling for IP_TOS: always return 0 when IPv6
+ if (name == StandardSocketOptions.IP_TOS) {
+- return (Net.isIPv6Available()) ? (T) Integer.valueOf(0) :
+- (T) Net.getSocketOption(fd, StandardProtocolFamily.INET, name);
++ ProtocolFamily family = Net.isIPv6Available() ?
++ StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
++ return (T) Net.getSocketOption(fd, family, name);
+ }
+
+ // no options that require special handling
+@@ -237,6 +239,9 @@
+ // additional options required by socket adaptor
+ set.add(StandardSocketOptions.IP_TOS);
+ set.add(ExtendedSocketOption.SO_OOBINLINE);
++ if (ExtendedOptionsImpl.flowSupported()) {
++ set.add(jdk.net.ExtendedSocketOptions.SO_FLOW_SLA);
++ }
+ return Collections.unmodifiableSet(set);
+ }
+ }
+--- ./jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/cs/ext/DoubleByte.java Fri Apr 10 09:21:28 2015 -0700
+@@ -109,7 +109,6 @@
+ public static class Decoder extends CharsetDecoder
+ implements DelegatableDecoder
+ {
+-
+ final char[][] b2c;
+ final char[] b2cSB;
+ final int b2Min;
+@@ -120,7 +119,12 @@
+ return CoderResult.UNDERFLOW;
+ }
+
+- protected CoderResult crMalformedOrUnmappable(int b) {
++ protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
++ if (b2c[b1] == B2C_UNMAPPABLE || // isNotLeadingByte(b1)
++ b2c[b2] != B2C_UNMAPPABLE || // isLeadingByte(b2)
++ decodeSingle(b2) != UNMAPPABLE_DECODING) { // isSingle(b2)
++ return CoderResult.malformedForLength(1);
++ }
+ return CoderResult.unmappableForLength(2);
+ }
+
+@@ -159,7 +163,7 @@
+ int b2 = sa[sp + 1] & 0xff;
+ if (b2 < b2Min || b2 > b2Max ||
+ (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
+- return crMalformedOrUnmappable(b1);
++ return crMalformedOrUnmappable(b1, b2);
+ }
+ inSize++;
+ }
+@@ -188,7 +192,7 @@
+ int b2 = src.get() & 0xff;
+ if (b2 < b2Min || b2 > b2Max ||
+ (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING)
+- return crMalformedOrUnmappable(b1);
++ return crMalformedOrUnmappable(b1, b2);
+ inSize++;
+ }
+ dst.put(c);
+@@ -400,8 +404,8 @@
+ return CoderResult.UNDERFLOW;
+ }
+
+- protected CoderResult crMalformedOrUnmappable(int b) {
+- if (b == SS2 || b == SS3 )
++ protected CoderResult crMalformedOrUnmappable(int b1, int b2) {
++ if (b1 == SS2 || b1 == SS3 )
+ return CoderResult.malformedForLength(1);
+ return CoderResult.unmappableForLength(2);
+ }
+--- ./jdk/src/share/classes/sun/nio/cs/ext/DoubleByteDecoder.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/cs/ext/DoubleByteDecoder.java Fri Apr 10 09:21:28 2015 -0700
+@@ -33,6 +33,8 @@
+ import java.nio.charset.Charset;
+ import java.nio.charset.CharsetDecoder;
+ import java.nio.charset.CoderResult;
++import java.security.AccessController;
++import sun.security.action.GetPropertyAction;
+
+ abstract class DoubleByteDecoder
+ extends CharsetDecoder
+@@ -52,6 +54,7 @@
+ protected static final char REPLACE_CHAR = '\uFFFD';
+ protected char highSurrogate;
+ protected char lowSurrogate;
++ private static volatile String bugLevel = null;
+
+ protected DoubleByteDecoder(Charset cs, short[] index1, String[] index2,
+ int start, int end ) {
+@@ -89,8 +92,16 @@
+ b2 = sa[sp + 1] & 0xff;
+ c = decodeDouble(b1, b2);
+ inputSize = 2;
+- if (c == REPLACE_CHAR)
+- return CoderResult.unmappableForLength(inputSize);
++ if (c == REPLACE_CHAR) {
++ if (!isLegalLeadingByte(b1) ||
++ isLegalLeadingByte(b2) ||
++ decodeSingle((byte)b2) != REPLACE_CHAR ||
++ atBugLevel("1.5")) {
++ return CoderResult.unmappableForLength(1);
++ } else {
++ return CoderResult.unmappableForLength(inputSize);
++ }
++ }
+ outputSize = (highSurrogate > 0) ? 2: 1;
+ }
+
+@@ -132,10 +143,16 @@
+ inputSize = 2;
+
+ c = decodeDouble(b1, b2);
+-
+- if (c == REPLACE_CHAR)
+- return CoderResult.unmappableForLength(2);
+-
++ if (c == REPLACE_CHAR) {
++ if (!isLegalLeadingByte(b1) ||
++ isLegalLeadingByte(b2) ||
++ decodeSingle((byte)b2) != REPLACE_CHAR ||
++ atBugLevel("1.5")) {
++ return CoderResult.unmappableForLength(1);
++ } else {
++ return CoderResult.unmappableForLength(inputSize);
++ }
++ }
+ outputSize = (highSurrogate > 0) ? 2: 1;
+ }
+ if (dst.remaining() < outputSize)
+@@ -179,4 +196,24 @@
+ int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
+ return index2[index1[byte1] >> 4].charAt(n);
+ }
++
++ /*
++ * Should be changed by sublasses needing to enforce this
++ */
++ protected boolean isLegalLeadingByte(int b) {
++ return b <= index1.length &&
++ ((index1[b] >> 4) != 0 || (index1[b] & 0xff) != 0);
+ }
++
++ static boolean atBugLevel(String bl) {
++ if (bugLevel == null) {
++ if (!sun.misc.VM.isBooted())
++ return false;
++ java.security.PrivilegedAction pa =
++ new GetPropertyAction("sun.nio.cs.bugLevel");
++ String value = (String)AccessController.doPrivileged(pa);
++ bugLevel = (value != null) ? value : "";
++ }
++ return bugLevel.equals(bl);
++ }
++}
+--- ./jdk/src/share/classes/sun/nio/cs/ext/SJIS.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/nio/cs/ext/SJIS.java Fri Apr 10 09:21:28 2015 -0700
+@@ -108,6 +108,10 @@
+ public CoderResult implFlush(CharBuffer out) {
+ return super.implFlush(out);
+ }
++ protected boolean isLegalLeadingByte(int b) {
++ return ((b >= 0x81 && b <= 0x9F) ||
++ (b >= 0xE0 && b <= 0XEF));
++ }
+ }
+
+ static class Encoder extends JIS_X_0208_Encoder {
+--- ./jdk/src/share/classes/sun/print/RasterPrinterJob.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/print/RasterPrinterJob.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1335,34 +1335,7 @@
+ setAttributes(attributes);
+ // throw exception for invalid destination
+ if (destinationAttr != null) {
+- // destinationAttr is null for Destination(new URI(""))
+- // because isAttributeValueSupported returns false in setAttributes
+-
+- // Destination(new URI(" ")) throws URISyntaxException
+- File f = new File(destinationAttr);
+- try {
+- // check if this is a new file and if filename chars are valid
+- if (f.createNewFile()) {
+- f.delete();
+- }
+- } catch (IOException ioe) {
+- throw new PrinterException("Cannot write to file:"+
+- destinationAttr);
+- } catch (SecurityException se) {
+- //There is already file read/write access so at this point
+- // only delete access is denied. Just ignore it because in
+- // most cases the file created in createNewFile gets overwritten
+- // anyway.
+- }
+-
+- File pFile = f.getParentFile();
+- if ((f.exists() &&
+- (!f.isFile() || !f.canWrite())) ||
+- ((pFile != null) &&
+- (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
+- throw new PrinterException("Cannot write to file:"+
+- destinationAttr);
+- }
++ validateDestination(destinationAttr);
+ }
+ } else {
+ spoolToService(psvc, attributes);
+@@ -1485,6 +1458,40 @@
+ }
+ }
+
++ protected void validateDestination(String dest) throws PrinterException {
++ if (dest == null) {
++ return;
++ }
++ // dest is null for Destination(new URI(""))
++ // because isAttributeValueSupported returns false in setAttributes
++
++ // Destination(new URI(" ")) throws URISyntaxException
++ File f = new File(dest);
++ try {
++ // check if this is a new file and if filename chars are valid
++ if (f.createNewFile()) {
++ f.delete();
++ }
++ } catch (IOException ioe) {
++ throw new PrinterException("Cannot write to file:"+
++ dest);
++ } catch (SecurityException se) {
++ //There is already file read/write access so at this point
++ // only delete access is denied. Just ignore it because in
++ // most cases the file created in createNewFile gets overwritten
++ // anyway.
++ }
++
++ File pFile = f.getParentFile();
++ if ((f.exists() &&
++ (!f.isFile() || !f.canWrite())) ||
++ ((pFile != null) &&
++ (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
++ throw new PrinterException("Cannot write to file:"+
++ dest);
++ }
++ }
++
+ /**
+ * updates a Paper object to reflect the current printer's selected
+ * paper size and imageable area for that paper size.
+--- ./jdk/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -32,7 +32,7 @@
+ bootstrapping. */
+
+ class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
+- private Constructor constructor;
++ private final Constructor constructor;
+
+ BootstrapConstructorAccessorImpl(Constructor c) {
+ this.constructor = c;
+--- ./jdk/src/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -33,7 +33,7 @@
+
+ class InstantiationExceptionConstructorAccessorImpl
+ extends ConstructorAccessorImpl {
+- private String message;
++ private final String message;
+
+ InstantiationExceptionConstructorAccessorImpl(String message) {
+ this.message = message;
+--- ./jdk/src/share/classes/sun/reflect/Label.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/Label.java Fri Apr 10 09:21:28 2015 -0700
+@@ -48,10 +48,10 @@
+ }
+ // This won't work for more than one assembler anyway, so this is
+ // unnecessary
+- ClassFileAssembler asm;
+- short instrBCI;
+- short patchBCI;
+- int stackDepth;
++ final ClassFileAssembler asm;
++ final short instrBCI;
++ final short patchBCI;
++ final int stackDepth;
+ }
+ private List/*<PatchInfo>*/ patches = new ArrayList();
+
+--- ./jdk/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/NativeConstructorAccessorImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,7 +31,7 @@
+ afterward, switches to bytecode-based implementation */
+
+ class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
+- private Constructor c;
++ private final Constructor c;
+ private DelegatingConstructorAccessorImpl parent;
+ private int numInvocations;
+
+--- ./jdk/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,7 +31,7 @@
+ switches to bytecode-based implementation */
+
+ class NativeMethodAccessorImpl extends MethodAccessorImpl {
+- private Method method;
++ private final Method method;
+ private DelegatingMethodAccessorImpl parent;
+ private int numInvocations;
+
+--- ./jdk/src/share/classes/sun/reflect/Reflection.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/Reflection.java Fri Apr 10 09:21:28 2015 -0700
+@@ -47,6 +47,7 @@
+ map.put(Reflection.class,
+ new String[] {"fieldFilterMap", "methodFilterMap"});
+ map.put(System.class, new String[] {"security"});
++ map.put(Class.class, new String[] {"classLoader"});
+ fieldFilterMap = map;
+
+ methodFilterMap = new HashMap<Class,String[]>();
+--- ./jdk/src/share/classes/sun/reflect/ReflectionFactory.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/ReflectionFactory.java Fri Apr 10 09:21:28 2015 -0700
+@@ -48,9 +48,9 @@
+ public class ReflectionFactory {
+
+ private static boolean initted = false;
+- private static Permission reflectionFactoryAccessPerm
++ private static final Permission reflectionFactoryAccessPerm
+ = new RuntimePermission("reflectionFactoryAccess");
+- private static ReflectionFactory soleInstance = new ReflectionFactory();
++ private static final ReflectionFactory soleInstance = new ReflectionFactory();
+ // Provides access to package-private mechanisms in java.lang.reflect
+ private static volatile LangReflectAccess langReflectAccess;
+
+--- ./jdk/src/share/classes/sun/reflect/SignatureIterator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/SignatureIterator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,7 +28,7 @@
+ /** Assists in iterating down a method's signature */
+
+ public class SignatureIterator {
+- private String sig;
++ private final String sig;
+ private int idx;
+
+ public SignatureIterator(String sig) {
+--- ./jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java Fri Apr 10 09:21:28 2015 -0700
+@@ -45,8 +45,8 @@
+ * core reflection (java.lang.reflect).
+ */
+ public class CoreReflectionFactory implements GenericsFactory {
+- private GenericDeclaration decl;
+- private Scope scope;
++ private final GenericDeclaration decl;
++ private final Scope scope;
+
+ private CoreReflectionFactory(GenericDeclaration d, Scope s) {
+ decl = d;
+--- ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/GenericArrayTypeImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -34,7 +34,7 @@
+ */
+ public class GenericArrayTypeImpl
+ implements GenericArrayType {
+- private Type genericComponentType;
++ private final Type genericComponentType;
+
+ // private constructor enforces use of static factory
+ private GenericArrayTypeImpl(Type ct) {
+--- ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/LazyReflectiveObjectGenerator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -40,7 +40,7 @@
+ *
+ */
+ public abstract class LazyReflectiveObjectGenerator {
+- private GenericsFactory factory; // cached factory
++ private final GenericsFactory factory; // cached factory
+
+ protected LazyReflectiveObjectGenerator(GenericsFactory f) {
+ factory = f;
+--- ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -38,9 +38,9 @@
+ /** Implementing class for ParameterizedType interface. */
+
+ public class ParameterizedTypeImpl implements ParameterizedType {
+- private Type[] actualTypeArguments;
+- private Class<?> rawType;
+- private Type ownerType;
++ private final Type[] actualTypeArguments;
++ private final Class<?> rawType;
++ private final Type ownerType;
+
+ private ParameterizedTypeImpl(Class<?> rawType,
+ Type[] actualTypeArguments,
+--- ./jdk/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/repository/AbstractRepository.java Fri Apr 10 09:21:28 2015 -0700
+@@ -40,9 +40,9 @@
+
+ // A factory used to produce reflective objects. Provided when the
+ //repository is created. Will vary across implementations.
+- private GenericsFactory factory;
++ private final GenericsFactory factory;
+
+- private T tree; // the AST for the generic type info
++ private final T tree; // the AST for the generic type info
+
+ //accessors
+ private GenericsFactory getFactory() { return factory;}
+--- ./jdk/src/share/classes/sun/reflect/generics/repository/ClassRepository.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/repository/ClassRepository.java Fri Apr 10 09:21:28 2015 -0700
+@@ -40,8 +40,11 @@
+ */
+ public class ClassRepository extends GenericDeclRepository<ClassSignature> {
+
+- private Type superclass; // caches the generic superclass info
+- private Type[] superInterfaces; // caches the generic superinterface info
++ /** The generic superclass info. Lazily initialized. */
++ private volatile Type superclass;
++
++ /** The generic superinterface info. Lazily initialized. */
++ private volatile Type[] superInterfaces;
+
+ // private, to enforce use of static factory
+ private ClassRepository(String rawSig, GenericsFactory f) {
+@@ -77,31 +80,34 @@
+ * with which the repository was created.
+ */
+
+- public Type getSuperclass(){
++ public Type getSuperclass() {
++ Type superclass = this.superclass;
+ if (superclass == null) { // lazily initialize superclass
+ Reifier r = getReifier(); // obtain visitor
+ // Extract superclass subtree from AST and reify
+ getTree().getSuperclass().accept(r);
+ // extract result from visitor and cache it
+ superclass = r.getResult();
+- }
++ this.superclass = superclass;
++ }
+ return superclass; // return cached result
+ }
+
+- public Type[] getSuperInterfaces(){
++ public Type[] getSuperInterfaces() {
++ Type[] superInterfaces = this.superInterfaces;
+ if (superInterfaces == null) { // lazily initialize super interfaces
+ // first, extract super interface subtree(s) from AST
+ TypeTree[] ts = getTree().getSuperInterfaces();
+ // create array to store reified subtree(s)
+- Type[] sis = new Type[ts.length];
++ superInterfaces = new Type[ts.length];
+ // reify all subtrees
+ for (int i = 0; i < ts.length; i++) {
+ Reifier r = getReifier(); // obtain visitor
+ ts[i].accept(r);// reify subtree
+ // extract result from visitor and store it
+- sis[i] = r.getResult();
++ superInterfaces[i] = r.getResult();
+ }
+- superInterfaces = sis; // cache overall result
++ this.superInterfaces = superInterfaces;
+ }
+ return superInterfaces.clone(); // return cached result
+ }
+--- ./jdk/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java Fri Apr 10 09:21:28 2015 -0700
+@@ -42,7 +42,8 @@
+ public abstract class GenericDeclRepository<S extends Signature>
+ extends AbstractRepository<S> {
+
+- private TypeVariable[] typeParams; // caches the formal type parameters
++ /** The formal type parameters. Lazily initialized. */
++ private volatile TypeVariable[] typeParams;
+
+ protected GenericDeclRepository(String rawSig, GenericsFactory f) {
+ super(rawSig, f);
+@@ -55,8 +56,7 @@
+ * If the corresponding field is non-null, it is returned.
+ * If not, it is created lazily. This is done by selecting the appropriate
+ * part of the tree and transforming it into a reflective object
+- * using a visitor.
+- * a visitor, which is created by feeding it the factory
++ * using a visitor, which is created by feeding it the factory
+ * with which the repository was created.
+ */
+
+@@ -64,20 +64,21 @@
+ * Return the formal type parameters of this generic declaration.
+ * @return the formal type parameters of this generic declaration
+ */
+- public TypeVariable/*<?>*/[] getTypeParameters(){
++ public TypeVariable/*<?>*/[] getTypeParameters() {
++ TypeVariable[] typeParams = this.typeParams;
+ if (typeParams == null) { // lazily initialize type parameters
+ // first, extract type parameter subtree(s) from AST
+ FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
+ // create array to store reified subtree(s)
+- TypeVariable[] tps = new TypeVariable[ftps.length];
++ typeParams = new TypeVariable[ftps.length];
+ // reify all subtrees
+ for (int i = 0; i < ftps.length; i++) {
+ Reifier r = getReifier(); // obtain visitor
+ ftps[i].accept(r); // reify subtree
+ // extract result from visitor and store it
+- tps[i] = (TypeVariable<?>) r.getResult();
++ typeParams[i] = (TypeVariable) r.getResult();
+ }
+- typeParams = tps; // cache overall result
++ this.typeParams = typeParams; // cache overall result
+ }
+ return typeParams.clone(); // return cached result
+ }
+--- ./jdk/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/scope/AbstractScope.java Fri Apr 10 09:21:28 2015 -0700
+@@ -41,8 +41,10 @@
+ public abstract class AbstractScope<D extends GenericDeclaration>
+ implements Scope {
+
+- private D recvr; // the declaration whose scope this instance represents
+- private Scope enclosingScope; // the enclosing scope of this scope
++ private final D recvr; // the declaration whose scope this instance represents
++
++ /** The enclosing scope of this scope. Lazily initialized. */
++ private volatile Scope enclosingScope;
+
+ /**
+ * Constructor. Takes a reflective object whose scope the newly
+@@ -71,7 +73,11 @@
+ * @return the enclosing scope
+ */
+ protected Scope getEnclosingScope(){
+- if (enclosingScope == null) {enclosingScope = computeEnclosingScope();}
++ Scope enclosingScope = this.enclosingScope;
++ if (enclosingScope == null) {
++ enclosingScope = computeEnclosingScope();
++ this.enclosingScope = enclosingScope;
++ }
+ return enclosingScope;
+ }
+
+--- ./jdk/src/share/classes/sun/reflect/generics/scope/DummyScope.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/scope/DummyScope.java Fri Apr 10 09:21:28 2015 -0700
+@@ -38,7 +38,7 @@
+ public class DummyScope implements Scope {
+ // Caches the unique instance of this class; instances contain no data
+ // so we can use the singleton pattern
+- private static DummyScope singleton = new DummyScope();
++ private static final DummyScope singleton = new DummyScope();
+
+ // constructor is private to enforce use of factory method
+ private DummyScope(){}
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/ArrayTypeSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/ArrayTypeSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,7 +28,7 @@
+ import sun.reflect.generics.visitor.TypeTreeVisitor;
+
+ public class ArrayTypeSignature implements FieldTypeSignature {
+- private TypeSignature componentType;
++ private final TypeSignature componentType;
+
+ private ArrayTypeSignature(TypeSignature ct) {componentType = ct;}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/BooleanSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/BooleanSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type boolean. */
+ public class BooleanSignature implements BaseType {
+- private static BooleanSignature singleton = new BooleanSignature();
++ private static final BooleanSignature singleton = new BooleanSignature();
+
+ private BooleanSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/BottomSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/BottomSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,7 +28,7 @@
+ import sun.reflect.generics.visitor.TypeTreeVisitor;
+
+ public class BottomSignature implements FieldTypeSignature {
+- private static BottomSignature singleton = new BottomSignature();
++ private static final BottomSignature singleton = new BottomSignature();
+
+ private BottomSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/ByteSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/ByteSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type byte. */
+ public class ByteSignature implements BaseType {
+- private static ByteSignature singleton = new ByteSignature();
++ private static final ByteSignature singleton = new ByteSignature();
+
+ private ByteSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/CharSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/CharSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type char. */
+ public class CharSignature implements BaseType {
+- private static CharSignature singleton = new CharSignature();
++ private static final CharSignature singleton = new CharSignature();
+
+ private CharSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/ClassSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,9 +28,9 @@
+ import sun.reflect.generics.visitor.Visitor;
+
+ public class ClassSignature implements Signature {
+- private FormalTypeParameter[] formalTypeParams;
+- private ClassTypeSignature superclass;
+- private ClassTypeSignature[] superInterfaces;
++ private final FormalTypeParameter[] formalTypeParams;
++ private final ClassTypeSignature superclass;
++ private final ClassTypeSignature[] superInterfaces;
+
+ private ClassSignature(FormalTypeParameter[] ftps,
+ ClassTypeSignature sc,
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/ClassTypeSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/ClassTypeSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -33,7 +33,7 @@
+ * AST representing class types.
+ */
+ public class ClassTypeSignature implements FieldTypeSignature {
+- private List<SimpleClassTypeSignature> path;
++ private final List<SimpleClassTypeSignature> path;
+
+
+ private ClassTypeSignature(List<SimpleClassTypeSignature> p) {
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/DoubleSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/DoubleSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type double. */
+ public class DoubleSignature implements BaseType {
+- private static DoubleSignature singleton = new DoubleSignature();
++ private static final DoubleSignature singleton = new DoubleSignature();
+
+ private DoubleSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/FloatSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/FloatSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type float. */
+ public class FloatSignature implements BaseType {
+- private static FloatSignature singleton = new FloatSignature();
++ private static final FloatSignature singleton = new FloatSignature();
+
+ private FloatSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/FormalTypeParameter.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/FormalTypeParameter.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+
+ /** AST that represents a formal type parameter. */
+ public class FormalTypeParameter implements TypeTree {
+- private String name;
+- private FieldTypeSignature[] bounds;
++ private final String name;
++ private final FieldTypeSignature[] bounds;
+
+ private FormalTypeParameter(String n, FieldTypeSignature[] bs) {
+ name = n;
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/IntSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/IntSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type int. */
+ public class IntSignature implements BaseType {
+- private static IntSignature singleton = new IntSignature();
++ private static final IntSignature singleton = new IntSignature();
+
+ private IntSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/LongSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/LongSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type long. */
+ public class LongSignature implements BaseType {
+- private static LongSignature singleton = new LongSignature();
++ private static final LongSignature singleton = new LongSignature();
+
+ private LongSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/MethodTypeSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,10 +28,10 @@
+ import sun.reflect.generics.visitor.Visitor;
+
+ public class MethodTypeSignature implements Signature {
+- private FormalTypeParameter[] formalTypeParams;
+- private TypeSignature[] parameterTypes;
+- private ReturnType returnType;
+- private FieldTypeSignature[] exceptionTypes;
++ private final FormalTypeParameter[] formalTypeParams;
++ private final TypeSignature[] parameterTypes;
++ private final ReturnType returnType;
++ private final FieldTypeSignature[] exceptionTypes;
+
+ private MethodTypeSignature(FormalTypeParameter[] ftps,
+ TypeSignature[] pts,
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/ShortSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/ShortSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -29,7 +29,7 @@
+
+ /** AST that represents the type short. */
+ public class ShortSignature implements BaseType {
+- private static ShortSignature singleton = new ShortSignature();
++ private static final ShortSignature singleton = new ShortSignature();
+
+ private ShortSignature(){}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/SimpleClassTypeSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/SimpleClassTypeSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,9 +28,9 @@
+ import sun.reflect.generics.visitor.TypeTreeVisitor;
+
+ public class SimpleClassTypeSignature implements FieldTypeSignature {
+- private boolean dollar;
+- private String name;
+- private TypeArgument[] typeArgs;
++ private final boolean dollar;
++ private final String name;
++ private final TypeArgument[] typeArgs;
+
+ private SimpleClassTypeSignature(String n, boolean dollar, TypeArgument[] tas) {
+ name = n;
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/TypeVariableSignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/TypeVariableSignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -28,7 +28,7 @@
+ import sun.reflect.generics.visitor.TypeTreeVisitor;
+
+ public class TypeVariableSignature implements FieldTypeSignature {
+- private String identifier;
++ private final String identifier;
+
+ private TypeVariableSignature(String id) {identifier = id;}
+
+--- ./jdk/src/share/classes/sun/reflect/generics/tree/VoidDescriptor.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/generics/tree/VoidDescriptor.java Fri Apr 10 09:21:28 2015 -0700
+@@ -30,7 +30,7 @@
+
+ /** AST that represents the pseudo-type void. */
+ public class VoidDescriptor implements ReturnType {
+- private static VoidDescriptor singleton = new VoidDescriptor();
++ private static final VoidDescriptor singleton = new VoidDescriptor();
+
+ private VoidDescriptor(){}
+
+--- ./jdk/src/share/classes/sun/reflect/misc/MethodUtil.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/reflect/misc/MethodUtil.java Fri Apr 10 09:21:28 2015 -0700
+@@ -80,9 +80,9 @@
+ * Create a trampoline class.
+ */
+ public final class MethodUtil extends SecureClassLoader {
+- private static String MISC_PKG = "sun.reflect.misc.";
+- private static String TRAMPOLINE = MISC_PKG + "Trampoline";
+- private static Method bounce = getTrampoline();
++ private static final String MISC_PKG = "sun.reflect.misc.";
++ private static final String TRAMPOLINE = MISC_PKG + "Trampoline";
++ private static final Method bounce = getTrampoline();
+
+ private MethodUtil() {
+ super();
+--- ./jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/jgss/krb5/Krb5Util.java Fri Apr 10 09:21:28 2015 -0700
+@@ -40,10 +40,7 @@
+ import sun.security.krb5.KrbException;
+ import java.io.IOException;
+ import java.util.ArrayList;
+-import java.util.Iterator;
+ import java.util.List;
+-import java.util.Objects;
+-import java.util.Set;
+ import sun.misc.SharedSecrets;
+ import sun.security.krb5.PrincipalName;
+ /**
+@@ -189,16 +186,6 @@
+ return subject;
+ }
+
+- // A special KerberosKey, used as keys read from a KeyTab object.
+- // Each time new keys are read from KeyTab objects in the private
+- // credentials set, old ones are removed and new ones added.
+- public static class KeysFromKeyTab extends KerberosKey {
+- public KeysFromKeyTab(KerberosKey key) {
+- super(key.getPrincipal(), key.getEncoded(),
+- key.getKeyType(), key.getVersionNumber());
+- }
+- }
+-
+ /**
+ * Credentials of a service, the private secret to authenticate its
+ * identity, which can be:
+@@ -237,7 +224,7 @@
+ // Compatibility with old behavior: even when there is no
+ // KerberosPrincipal, we can find one from KerberosKeys
+ List<KerberosKey> keys = SubjectComber.findMany(
+- subj, null, null, KerberosKey.class);
++ subj, serverPrincipal, null, KerberosKey.class);
+ if (!keys.isEmpty()) {
+ sc.kp = keys.get(0).getPrincipal();
+ serverPrincipal = sc.kp.getName();
+@@ -264,38 +251,17 @@
+ }
+
+ public KerberosKey[] getKKeys() {
+- if (ktabs.isEmpty()) {
+- return kk.toArray(new KerberosKey[kk.size()]);
+- } else {
+ List<KerberosKey> keys = new ArrayList<>();
++ for (KerberosKey k: kk) {
++ keys.add(k);
++ }
+ for (KeyTab ktab: ktabs) {
+ for (KerberosKey k: ktab.getKeys(kp)) {
+ keys.add(k);
+ }
+ }
+- // Compatibility: also add keys to privCredSet. Remove old
+- // ones first, only remove those from keytab.
+- if (!subj.isReadOnly()) {
+- Set<Object> pcs = subj.getPrivateCredentials();
+- synchronized (pcs) {
+- Iterator<Object> iterator = pcs.iterator();
+- while (iterator.hasNext()) {
+- Object obj = iterator.next();
+- if (obj instanceof KeysFromKeyTab) {
+- KerberosKey key = (KerberosKey)obj;
+- if (Objects.equals(key.getPrincipal(), kp)) {
+- iterator.remove();
+- }
+- }
+- }
+- }
+- for (KerberosKey key: keys) {
+- subj.getPrivateCredentials().add(new KeysFromKeyTab(key));
+- }
+- }
+ return keys.toArray(new KerberosKey[keys.size()]);
+ }
+- }
+
+ public EncryptionKey[] getEKeys() {
+ KerberosKey[] kkeys = getKKeys();
+--- ./jdk/src/share/classes/sun/security/krb5/Config.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/krb5/Config.java Fri Apr 10 09:21:28 2015 -0700
+@@ -799,8 +799,10 @@
+
+ private static String trimmed(String s) {
+ s = s.trim();
+- if (s.charAt(0) == '"' && s.charAt(s.length()-1) == '"' ||
+- s.charAt(0) == '\'' && s.charAt(s.length()-1) == '\'') {
++ if (s.length() >= 2 &&
++ ((s.charAt(0) == '"' && s.charAt(s.length()-1) == '"') ||
++ (s.charAt(0) == '\'' && s.charAt(s.length()-1) == '\'')))
++ {
+ s = s.substring(1, s.length()-1).trim();
+ }
+ return s;
+--- ./jdk/src/share/classes/sun/security/krb5/Credentials.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/krb5/Credentials.java Fri Apr 10 09:21:28 2015 -0700
+@@ -423,8 +423,10 @@
+ if (DEBUG) {
+ System.out.println(">> Acquire default native Credentials");
+ }
+- result = acquireDefaultNativeCreds(
+- EType.getDefaults("default_tkt_enctypes"));
++ int[] etypes = EType.getDefaults("default_tkt_enctypes");
++ if (etypes != null) {
++ result = acquireDefaultNativeCreds(etypes);
++ }
+ }
+ }
+ return result;
+--- ./jdk/src/share/classes/sun/security/krb5/EncryptionKey.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/krb5/EncryptionKey.java Fri Apr 10 09:21:28 2015 -0700
+@@ -555,6 +555,12 @@
+
+ int ktype;
+ boolean etypeFound = false;
++
++ // When no matched kvno is found, returns tke key of the same
++ // etype with the highest kvno
++ int kvno_found = 0;
++ EncryptionKey key_found = null;
++
+ for (int i = 0; i < keys.length; i++) {
+ ktype = keys[i].getEType();
+ if (EType.isSupported(ktype)) {
+@@ -563,6 +569,10 @@
+ etypeFound = true;
+ if (versionMatches(kvno, kv)) {
+ return keys[i];
++ } else if (kv > kvno_found) {
++ // kv is not null
++ key_found = keys[i];
++ kvno_found = kv;
+ }
+ }
+ }
+@@ -580,12 +590,17 @@
+ etypeFound = true;
+ if (versionMatches(kvno, kv)) {
+ return new EncryptionKey(etype, keys[i].getBytes());
++ } else if (kv > kvno_found) {
++ key_found = new EncryptionKey(etype, keys[i].getBytes());
++ kvno_found = kv;
+ }
+ }
+ }
+ }
+ if (etypeFound) {
+- throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER);
++ return key_found;
++ // For compatibility, will not fail here.
++ //throw new KrbException(Krb5.KRB_AP_ERR_BADKEYVER);
+ }
+ return null;
+ }
+--- ./jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Fri Apr 10 09:21:28 2015 -0700
+@@ -410,8 +410,7 @@
+ String uidStr = null;
+ long uid = 0;
+
+- if (osname.startsWith("SunOS") ||
+- (osname.startsWith("Linux"))) {
++ if (!osname.startsWith("Windows")) {
+ try {
+ Class<?> c = Class.forName
+ ("com.sun.security.auth.module.UnixSystem");
+--- ./jdk/src/share/classes/sun/security/pkcs11/Config.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/pkcs11/Config.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2014, 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
+@@ -583,16 +583,24 @@
+ }
+
+ private String parseLine() throws IOException {
+- String s = parseWord();
++ // allow quoted string as part of line
++ String s = null;
+ while (true) {
+ int token = nextToken();
+ if ((token == TT_EOL) || (token == TT_EOF)) {
+ break;
+ }
+- if (token != TT_WORD) {
++ if (token != TT_WORD && token != '\"') {
+ throw excToken("Unexpected value");
+ }
+- s = s + " " + st.sval;
++ if (s == null) {
++ s = st.sval;
++ } else {
++ s = s + " " + st.sval;
++ }
++ }
++ if (s == null) {
++ throw excToken("Unexpected empty line");
+ }
+ return s;
+ }
+--- ./jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 2015, 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
+@@ -54,6 +54,7 @@
+ import javax.crypto.Mac;
+ import javax.security.auth.x500.X500Principal;
+
++import sun.security.util.Debug;
+ import sun.security.util.DerInputStream;
+ import sun.security.util.DerOutputStream;
+ import sun.security.util.DerValue;
+@@ -122,6 +123,8 @@
+
+ public static final int VERSION_3 = 3;
+
++ private static final Debug debug = Debug.getInstance("pkcs12");
++
+ private static final int keyBag[] = {1, 2, 840, 113549, 1, 12, 10, 1, 2};
+ private static final int certBag[] = {1, 2, 840, 113549, 1, 12, 10, 1, 3};
+
+@@ -490,6 +493,11 @@
+
+ entry.protectedPrivKey = key.clone();
+ if (chain != null) {
++ // validate cert-chain
++ if ((chain.length > 1) && (!validateChain(chain))) {
++ throw new KeyStoreException("Certificate chain is "
++ + "not valid");
++ }
+ entry.chain = chain.clone();
+ }
+
+@@ -901,7 +909,12 @@
+ if (!(issuerDN.equals(subjectDN)))
+ return false;
+ }
+- return true;
++
++ // Check for loops in the chain. If there are repeated certs,
++ // the Set of certs in the chain will contain fewer certs than
++ // the chain
++ Set<Certificate> set = new HashSet<>(Arrays.asList(certChain));
++ return set.size() == certChain.length;
+ }
+
+
+@@ -1356,7 +1369,24 @@
+ ArrayList<X509Certificate> chain =
+ new ArrayList<X509Certificate>();
+ X509Certificate cert = findMatchedCertificate(entry);
++
++ mainloop:
+ while (cert != null) {
++ // Check for loops in the certificate chain
++ if (!chain.isEmpty()) {
++ for (X509Certificate chainCert : chain) {
++ if (cert.equals(chainCert)) {
++ if (debug != null) {
++ debug.println("Loop detected in " +
++ "certificate chain. Skip adding " +
++ "repeated cert to chain. Subject: " +
++ cert.getSubjectX500Principal()
++ .toString());
++ }
++ break mainloop;
++ }
++ }
++ }
+ chain.add(cert);
+ X500Principal issuerDN = cert.getIssuerX500Principal();
+ if (issuerDN.equals(cert.getSubjectX500Principal())) {
+--- ./jdk/src/share/classes/sun/security/provider/X509Factory.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/provider/X509Factory.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2014, 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,7 @@
+ *
+ * @exception CertificateException on parsing errors.
+ */
++ @Override
+ public Certificate engineGenerateCertificate(InputStream is)
+ throws CertificateException
+ {
+@@ -101,8 +102,8 @@
+ throw new IOException("Empty input");
+ }
+ } catch (IOException ioe) {
+- throw (CertificateException)new CertificateException
+- ("Could not parse certificate: " + ioe.toString()).initCause(ioe);
++ throw new CertificateException("Could not parse certificate: " +
++ ioe.toString(), ioe);
+ }
+ }
+
+@@ -138,6 +139,12 @@
+ * It is useful for certificates that cannot be created via
+ * generateCertificate() and for converting other X509Certificate
+ * implementations to an X509CertImpl.
++ *
++ * @param c The source X509Certificate
++ * @return An X509CertImpl object that is either a cached certificate or a
++ * newly built X509CertImpl from the provided X509Certificate
++ * @throws CertificateException if failures occur while obtaining the DER
++ * encoding for certificate data.
+ */
+ public static synchronized X509CertImpl intern(X509Certificate c)
+ throws CertificateException {
+@@ -168,6 +175,11 @@
+ /**
+ * Return an interned X509CRLImpl for the given certificate.
+ * For more information, see intern(X509Certificate).
++ * @param c The source X509CRL
++ * @return An X509CRLImpl object that is either a cached CRL or a
++ * newly built X509CRLImpl from the provided X509CRL
++ * @throws CRLException if failures occur while obtaining the DER
++ * encoding for CRL data.
+ */
+ public static synchronized X509CRLImpl intern(X509CRL c)
+ throws CRLException {
+@@ -228,6 +240,7 @@
+ * @exception CertificateException if an exception occurs while decoding
+ * @since 1.4
+ */
++ @Override
+ public CertPath engineGenerateCertPath(InputStream inStream)
+ throws CertificateException
+ {
+@@ -259,6 +272,7 @@
+ * the encoding requested is not supported
+ * @since 1.4
+ */
++ @Override
+ public CertPath engineGenerateCertPath(InputStream inStream,
+ String encoding) throws CertificateException
+ {
+@@ -291,6 +305,7 @@
+ * @exception CertificateException if an exception occurs
+ * @since 1.4
+ */
++ @Override
+ public CertPath
+ engineGenerateCertPath(List<? extends Certificate> certificates)
+ throws CertificateException
+@@ -310,6 +325,7 @@
+ * <code>CertPath</code> encodings (as <code>String</code>s)
+ * @since 1.4
+ */
++ @Override
+ public Iterator<String> engineGetCertPathEncodings() {
+ return(X509CertPath.getEncodingsStatic());
+ }
+@@ -325,6 +341,7 @@
+ *
+ * @exception CertificateException on parsing errors.
+ */
++ @Override
+ public Collection<? extends java.security.cert.Certificate>
+ engineGenerateCertificates(InputStream is)
+ throws CertificateException {
+@@ -350,6 +367,7 @@
+ *
+ * @exception CRLException on parsing errors.
+ */
++ @Override
+ public CRL engineGenerateCRL(InputStream is)
+ throws CRLException
+ {
+@@ -387,6 +405,7 @@
+ *
+ * @exception CRLException on parsing errors.
+ */
++ @Override
+ public Collection<? extends java.security.cert.CRL> engineGenerateCRLs(
+ InputStream is) throws CRLException
+ {
+@@ -409,10 +428,28 @@
+ parseX509orPKCS7Cert(InputStream is)
+ throws CertificateException, IOException
+ {
++ int peekByte;
++ byte[] data;
++ PushbackInputStream pbis = new PushbackInputStream(is);
+ Collection<X509CertImpl> coll = new ArrayList<>();
+- byte[] data = readOneBlock(is);
++
++ // Test the InputStream for end-of-stream. If the stream's
++ // initial state is already at end-of-stream then return
++ // an empty collection. Otherwise, push the byte back into the
++ // stream and let readOneBlock look for the first certificate.
++ peekByte = pbis.read();
++ if (peekByte == -1) {
++ return new ArrayList<>(0);
++ } else {
++ pbis.unread(peekByte);
++ data = readOneBlock(pbis);
++ }
++
++ // If we end up with a null value after reading the first block
++ // then we know the end-of-stream has been reached and no certificate
++ // data has been found.
+ if (data == null) {
+- return new ArrayList<>(0);
++ throw new CertificateException("No certificate data found");
+ }
+ try {
+ PKCS7 pkcs7 = new PKCS7(data);
+@@ -421,13 +458,13 @@
+ if (certs != null) {
+ return Arrays.asList(certs);
+ } else {
+- // no crls provided
++ // no certificates provided
+ return new ArrayList<>(0);
+ }
+ } catch (ParsingException e) {
+ while (data != null) {
+ coll.add(new X509CertImpl(data));
+- data = readOneBlock(is);
++ data = readOneBlock(pbis);
+ }
+ }
+ return coll;
+@@ -442,10 +479,28 @@
+ parseX509orPKCS7CRL(InputStream is)
+ throws CRLException, IOException
+ {
++ int peekByte;
++ byte[] data;
++ PushbackInputStream pbis = new PushbackInputStream(is);
+ Collection<X509CRLImpl> coll = new ArrayList<>();
+- byte[] data = readOneBlock(is);
++
++ // Test the InputStream for end-of-stream. If the stream's
++ // initial state is already at end-of-stream then return
++ // an empty collection. Otherwise, push the byte back into the
++ // stream and let readOneBlock look for the first CRL.
++ peekByte = pbis.read();
++ if (peekByte == -1) {
++ return new ArrayList<>(0);
++ } else {
++ pbis.unread(peekByte);
++ data = readOneBlock(pbis);
++ }
++
++ // If we end up with a null value after reading the first block
++ // then we know the end-of-stream has been reached and no CRL
++ // data has been found.
+ if (data == null) {
+- return new ArrayList<>(0);
++ throw new CRLException("No CRL data found");
+ }
+ try {
+ PKCS7 pkcs7 = new PKCS7(data);
+@@ -460,7 +515,7 @@
+ } catch (ParsingException e) {
+ while (data != null) {
+ coll.add(new X509CRLImpl(data));
+- data = readOneBlock(is);
++ data = readOneBlock(pbis);
+ }
+ }
+ return coll;
+@@ -623,7 +678,7 @@
+
+ int n = is.read();
+ if (n == -1) {
+- throw new IOException("BER/DER length info ansent");
++ throw new IOException("BER/DER length info absent");
+ }
+ bout.write(n);
+
+--- ./jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2002, 2015, 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
+@@ -508,10 +508,10 @@
+ // set interim reasons mask to the intersection of
+ // reasons in the DP and onlySomeReasons in the IDP
+ boolean[] idpReasonFlags = reasons.getFlags();
+- for (int i = 0; i < idpReasonFlags.length; i++) {
+- if (idpReasonFlags[i] && pointReasonFlags[i]) {
+- interimReasonsMask[i] = true;
+- }
++ for (int i = 0; i < interimReasonsMask.length; i++) {
++ interimReasonsMask[i] =
++ (i < idpReasonFlags.length && idpReasonFlags[i]) &&
++ (i < pointReasonFlags.length && pointReasonFlags[i]);
+ }
+ } else {
+ // set interim reasons mask to the value of
+@@ -525,7 +525,6 @@
+ interimReasonsMask = pointReasonFlags.clone();
+ } else {
+ // set interim reasons mask to the special value all-reasons
+- interimReasonsMask = new boolean[9];
+ Arrays.fill(interimReasonsMask, true);
+ }
+ }
+@@ -533,8 +532,10 @@
+ // verify that interim reasons mask includes one or more reasons
+ // not included in the reasons mask
+ boolean oneOrMore = false;
+- for (int i=0; i < interimReasonsMask.length && !oneOrMore; i++) {
+- if (!reasonsMask[i] && interimReasonsMask[i]) {
++ for (int i = 0; i < interimReasonsMask.length && !oneOrMore; i++) {
++ if (interimReasonsMask[i] &&
++ !(i < reasonsMask.length && reasonsMask[i]))
++ {
+ oneOrMore = true;
+ }
+ }
+@@ -652,11 +653,11 @@
+ }
+
+ // update reasonsMask
+- for (int i=0; i < interimReasonsMask.length; i++) {
+- if (!reasonsMask[i] && interimReasonsMask[i]) {
+- reasonsMask[i] = true;
+- }
++ for (int i = 0; i < interimReasonsMask.length; i++) {
++ reasonsMask[i] = reasonsMask[i] ||
++ (i < interimReasonsMask.length && interimReasonsMask[i]);
+ }
++
+ return true;
+ }
+
+--- ./jdk/src/share/classes/sun/security/rsa/RSACore.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/rsa/RSACore.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2015, 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
+@@ -102,12 +102,24 @@
+
+ /**
+ * Perform an RSA private key operation. Uses CRT if the key is a
+- * CRT key.
++ * CRT key with additional verification check after the signature
++ * is computed.
+ */
++ @Deprecated
+ public static byte[] rsa(byte[] msg, RSAPrivateKey key)
+ throws BadPaddingException {
++ return rsa(msg, key, true);
++ }
++
++ /**
++ * Perform an RSA private key operation. Uses CRT if the key is a
++ * CRT key. Set 'verify' to true if this function is used for
++ * generating a signature.
++ */
++ public static byte[] rsa(byte[] msg, RSAPrivateKey key, boolean verify)
++ throws BadPaddingException {
+ if (key instanceof RSAPrivateCrtKey) {
+- return crtCrypt(msg, (RSAPrivateCrtKey)key);
++ return crtCrypt(msg, (RSAPrivateCrtKey)key, verify);
+ } else {
+ return priCrypt(msg, key.getModulus(), key.getPrivateExponent());
+ }
+@@ -148,10 +160,11 @@
+ * RSA private key operations with CRT. Algorithm and variable naming
+ * are taken from PKCS#1 v2.1, section 5.1.2.
+ */
+- private static byte[] crtCrypt(byte[] msg, RSAPrivateCrtKey key)
+- throws BadPaddingException {
++ private static byte[] crtCrypt(byte[] msg, RSAPrivateCrtKey key,
++ boolean verify) throws BadPaddingException {
+ BigInteger n = key.getModulus();
+- BigInteger c = parseMsg(msg, n);
++ BigInteger c0 = parseMsg(msg, n);
++ BigInteger c = c0;
+ BigInteger p = key.getPrimeP();
+ BigInteger q = key.getPrimeQ();
+ BigInteger dP = key.getPrimeExponentP();
+@@ -184,6 +197,9 @@
+ if (ENABLE_BLINDING) {
+ m = m.multiply(brp.v).mod(n);
+ }
++ if (verify && !c0.equals(m.modPow(e, n))) {
++ throw new BadPaddingException("RSA private key operation failed");
++ }
+
+ return toByteArray(m, getByteLength(n));
+ }
+--- ./jdk/src/share/classes/sun/security/rsa/RSASignature.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/rsa/RSASignature.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2015, 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
+@@ -174,7 +174,7 @@
+ try {
+ byte[] encoded = encodeSignature(digestOID, digest);
+ byte[] padded = padding.pad(encoded);
+- byte[] encrypted = RSACore.rsa(padded, privateKey);
++ byte[] encrypted = RSACore.rsa(padded, privateKey, true);
+ return encrypted;
+ } catch (GeneralSecurityException e) {
+ throw new SignatureException("Could not sign data", e);
+--- ./jdk/src/share/classes/sun/security/ssl/Handshaker.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/ssl/Handshaker.java Fri Apr 10 09:21:28 2015 -0700
+@@ -637,6 +637,7 @@
+ */
+ ProtocolList getActiveProtocols() {
+ if (activeProtocols == null) {
++ boolean enabledSSL20Hello = false;
+ ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
+ EnumSet<CryptoPrimitive> cryptoPrimitives =
+ EnumSet.<CryptoPrimitive>of(CryptoPrimitive.KEY_AGREEMENT);
+@@ -650,6 +651,12 @@
+
+ continue;
+ }
++ // Need not to check the SSL20Hello protocol.
++ if (protocol.v == ProtocolVersion.SSL20Hello.v) {
++ enabledSSL20Hello = true;
++ continue;
++ }
++
+ boolean found = false;
+ for (CipherSuite suite : enabledCipherSuites.collection()) {
+ if (suite.isAvailable() && suite.obsoleted > protocol.v &&
+@@ -675,6 +682,11 @@
+ "No available cipher suite for " + protocol);
+ }
+ }
++
++ if (!protocols.isEmpty() && enabledSSL20Hello) {
++ protocols.add(ProtocolVersion.SSL20Hello);
++ }
++
+ activeProtocols = new ProtocolList(protocols);
+ }
+
+--- ./jdk/src/share/classes/sun/security/util/Debug.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/util/Debug.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2014, 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
+@@ -96,7 +96,15 @@
+ System.err.println("codebase=<URL>");
+ System.err.println(" only dump output if specified codebase");
+ System.err.println(" is being checked");
+-
++ System.err.println();
++ System.err.println("The following can be used with provider:");
++ System.err.println();
++ System.err.println("engine=<engines>");
++ System.err.println(" only dump output for the specified list");
++ System.err.println(" of JCA engines. Supported values:");
++ System.err.println(" Cipher, KeyAgreement, KeyGenerator,");
++ System.err.println(" KeyPairGenerator, KeyStore, Mac,");
++ System.err.println(" MessageDigest, SecureRandom, Signature.");
+ System.err.println();
+ System.err.println("Note: Separate multiple options with a comma");
+ System.exit(0);
+--- ./jdk/src/share/classes/sun/security/util/HostnameChecker.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/util/HostnameChecker.java Fri Apr 10 09:21:28 2015 -0700
+@@ -26,6 +26,8 @@
+ package sun.security.util;
+
+ import java.io.IOException;
++import java.net.InetAddress;
++import java.net.UnknownHostException;
+ import java.util.*;
+
+ import java.security.Principal;
+@@ -148,6 +150,17 @@
+ String ipAddress = (String)next.get(1);
+ if (expectedIP.equalsIgnoreCase(ipAddress)) {
+ return;
++ } else {
++ // compare InetAddress objects in order to ensure
++ // equality between a long IPv6 address and its
++ // abbreviated form.
++ try {
++ if (InetAddress.getByName(expectedIP).equals(
++ InetAddress.getByName(ipAddress))) {
++ return;
++ }
++ } catch (UnknownHostException e) {
++ } catch (SecurityException e) {}
+ }
+ }
+ }
+--- ./jdk/src/share/classes/sun/security/x509/KeyUsageExtension.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/x509/KeyUsageExtension.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -83,7 +83,8 @@
+ * @param position the position in the bit string to check.
+ */
+ private boolean isSet(int position) {
+- return bitString[position];
++ return (position < bitString.length) &&
++ bitString[position];
+ }
+
+ /**
+@@ -275,41 +276,40 @@
+ * Returns a printable representation of the KeyUsage.
+ */
+ public String toString() {
+- String s = super.toString() + "KeyUsage [\n";
++ StringBuilder sb = new StringBuilder();
++ sb.append(super.toString());
++ sb.append("KeyUsage [\n");
+
+- try {
+- if (isSet(0)) {
+- s += " DigitalSignature\n";
+- }
+- if (isSet(1)) {
+- s += " Non_repudiation\n";
+- }
+- if (isSet(2)) {
+- s += " Key_Encipherment\n";
+- }
+- if (isSet(3)) {
+- s += " Data_Encipherment\n";
+- }
+- if (isSet(4)) {
+- s += " Key_Agreement\n";
+- }
+- if (isSet(5)) {
+- s += " Key_CertSign\n";
+- }
+- if (isSet(6)) {
+- s += " Crl_Sign\n";
+- }
+- if (isSet(7)) {
+- s += " Encipher_Only\n";
+- }
+- if (isSet(8)) {
+- s += " Decipher_Only\n";
+- }
+- } catch (ArrayIndexOutOfBoundsException ex) {}
++ if (isSet(0)) {
++ sb.append(" DigitalSignature\n");
++ }
++ if (isSet(1)) {
++ sb.append(" Non_repudiation\n");
++ }
++ if (isSet(2)) {
++ sb.append(" Key_Encipherment\n");
++ }
++ if (isSet(3)) {
++ sb.append(" Data_Encipherment\n");
++ }
++ if (isSet(4)) {
++ sb.append(" Key_Agreement\n");
++ }
++ if (isSet(5)) {
++ sb.append(" Key_CertSign\n");
++ }
++ if (isSet(6)) {
++ sb.append(" Crl_Sign\n");
++ }
++ if (isSet(7)) {
++ sb.append(" Encipher_Only\n");
++ }
++ if (isSet(8)) {
++ sb.append(" Decipher_Only\n");
++ }
++ sb.append("]\n");
+
+- s += "]\n";
+-
+- return (s);
++ return sb.toString();
+ }
+
+ /**
+--- ./jdk/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2015, 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
+@@ -136,7 +136,8 @@
+ * @param position the position in the bit string to check.
+ */
+ private boolean isSet(int position) {
+- return bitString[position];
++ return (position < bitString.length) &&
++ bitString[position];
+ }
+
+ /**
+@@ -236,27 +237,34 @@
+ * Returns a printable representation of the NetscapeCertType.
+ */
+ public String toString() {
+- String s = super.toString() + "NetscapeCertType [\n";
++ StringBuilder sb = new StringBuilder();
++ sb.append(super.toString());
++ sb.append("NetscapeCertType [\n");
+
+- try {
+- if (isSet(getPosition(SSL_CLIENT)))
+- s += " SSL client\n";
+- if (isSet(getPosition(SSL_SERVER)))
+- s += " SSL server\n";
+- if (isSet(getPosition(S_MIME)))
+- s += " S/MIME\n";
+- if (isSet(getPosition(OBJECT_SIGNING)))
+- s += " Object Signing\n";
+- if (isSet(getPosition(SSL_CA)))
+- s += " SSL CA\n";
+- if (isSet(getPosition(S_MIME_CA)))
+- s += " S/MIME CA\n";
+- if (isSet(getPosition(OBJECT_SIGNING_CA)))
+- s += " Object Signing CA" ;
+- } catch (Exception e) { }
++ if (isSet(0)) {
++ sb.append(" SSL client\n");
++ }
++ if (isSet(1)) {
++ sb.append(" SSL server\n");
++ }
++ if (isSet(2)) {
++ sb.append(" S/MIME\n");
++ }
++ if (isSet(3)) {
++ sb.append(" Object Signing\n");
++ }
++ if (isSet(5)) {
++ sb.append(" SSL CA\n");
++ }
++ if (isSet(6)) {
++ sb.append(" S/MIME CA\n");
++ }
++ if (isSet(7)) {
++ sb.append(" Object Signing CA");
++ }
+
+- s += "]\n";
+- return (s);
++ sb.append("]\n");
++ return sb.toString();
+ }
+
+ /**
+--- ./jdk/src/share/classes/sun/security/x509/ReasonFlags.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/security/x509/ReasonFlags.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -99,7 +99,8 @@
+ * @param position the position in the bit string to check.
+ */
+ private boolean isSet(int position) {
+- return bitString[position];
++ return (position < bitString.length) &&
++ bitString[position];
+ }
+
+ /**
+@@ -199,23 +200,38 @@
+ * Returns a printable representation of the ReasonFlags.
+ */
+ public String toString() {
+- String s = "Reason Flags [\n";
++ StringBuilder sb = new StringBuilder("Reason Flags [\n");
+
+- try {
+- if (isSet(0)) s += " Unused\n";
+- if (isSet(1)) s += " Key Compromise\n";
+- if (isSet(2)) s += " CA Compromise\n";
+- if (isSet(3)) s += " Affiliation_Changed\n";
+- if (isSet(4)) s += " Superseded\n";
+- if (isSet(5)) s += " Cessation Of Operation\n";
+- if (isSet(6)) s += " Certificate Hold\n";
+- if (isSet(7)) s += " Privilege Withdrawn\n";
+- if (isSet(8)) s += " AA Compromise\n";
+- } catch (ArrayIndexOutOfBoundsException ex) {}
++ if (isSet(0)) {
++ sb.append(" Unused\n");
++ }
++ if (isSet(1)) {
++ sb.append(" Key Compromise\n");
++ }
++ if (isSet(2)) {
++ sb.append(" CA Compromise\n");
++ }
++ if (isSet(3)) {
++ sb.append(" Affiliation_Changed\n");
++ }
++ if (isSet(4)) {
++ sb.append(" Superseded\n");
++ }
++ if (isSet(5)) {
++ sb.append(" Cessation Of Operation\n");
++ }
++ if (isSet(6)) {
++ sb.append(" Certificate Hold\n");
++ }
++ if (isSet(7)) {
++ sb.append(" Privilege Withdrawn\n");
++ }
++ if (isSet(8)) {
++ sb.append(" AA Compromise\n");
++ }
++ sb.append("]\n");
+
+- s += "]\n";
+-
+- return (s);
++ return sb.toString();
+ }
+
+ /**
+--- ./jdk/src/share/classes/sun/text/resources/FormatData_sv_SE.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/text/resources/FormatData_sv_SE.java Fri Apr 10 09:21:28 2015 -0700
+@@ -52,7 +52,7 @@
+ new String[] {
+ "#,##0.###;-#,##0.###", // decimal pattern
+ "#,##0.00 \u00A4;-#,##0.00 \u00A4", // currency pattern
+- "#,##0%" // percent pattern
++ "#,##0 %" // percent pattern
+ }
+ },
+ };
+--- ./jdk/src/share/classes/sun/tools/jar/Main.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/tools/jar/Main.java Fri Apr 10 09:21:28 2015 -0700
+@@ -72,8 +72,9 @@
+ * flag0: no zip compression (store only)
+ * Mflag: DO NOT generate a manifest file (just ZIP)
+ * iflag: generate jar index
++ * pflag: preserve/don't strip leading slash and .. component from file name
+ */
+- boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag;
++ boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag;
+
+ static final String MANIFEST_DIR = "META-INF/";
+ static final String VERSION = "1.0";
+@@ -185,6 +186,7 @@
+ addMainClass(manifest, ename);
+ }
+ }
++ expand(null, files, false);
+ OutputStream out;
+ if (fname != null) {
+ out = new FileOutputStream(fname);
+@@ -197,7 +199,6 @@
+ vflag = false;
+ }
+ }
+- expand(null, files, false);
+ create(new BufferedOutputStream(out, 4096), manifest);
+ if (in != null) {
+ in.close();
+@@ -245,7 +246,7 @@
+ list(fname, files);
+ } else {
+ InputStream in = new FileInputStream(FileDescriptor.in);
+- try{
++ try {
+ list(new BufferedInputStream(in), files);
+ } finally {
+ in.close();
+@@ -361,6 +362,9 @@
+ case 'e':
+ ename = args[count++];
+ break;
++ case 'P':
++ pflag = true;
++ break;
+ default:
+ error(formatMsg("error.illegal.option",
+ String.valueOf(flags.charAt(i))));
+@@ -607,7 +611,6 @@
+ return updateOk;
+ }
+
+-
+ private void addIndex(JarIndex index, ZipOutputStream zos)
+ throws IOException
+ {
+@@ -643,6 +646,47 @@
+ }
+ }
+
++ private static final boolean isWinDriveLetter(char c) {
++ return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
++ }
++
++ private String safeName(String name) {
++ if (!pflag) {
++ int len = name.length();
++ int i = name.lastIndexOf("../");
++ if (i == -1) {
++ i = 0;
++ } else {
++ i += 3; // strip any dot-dot components
++ }
++ if (File.separatorChar == '\\') {
++ // the spec requests no drive letter. skip if
++ // the entry name has one.
++ while (i < len) {
++ int off = i;
++ if (i + 1 < len &&
++ name.charAt(i + 1) == ':' &&
++ isWinDriveLetter(name.charAt(i))) {
++ i += 2;
++ }
++ while (i < len && name.charAt(i) == '/') {
++ i++;
++ }
++ if (i == off) {
++ break;
++ }
++ }
++ } else {
++ while (i < len && name.charAt(i) == '/') {
++ i++;
++ }
++ }
++ if (i != 0) {
++ name = name.substring(i);
++ }
++ }
++ return name;
++ }
+
+ private String entryName(String name) {
+ name = name.replace(File.separatorChar, '/');
+@@ -654,10 +698,10 @@
+ }
+ }
+ name = name.substring(matchPath.length());
+-
+- if (name.startsWith("/")) {
+- name = name.substring(1);
+- } else if (name.startsWith("./")) {
++ name = safeName(name);
++ // the old implementaton doesn't remove
++ // "./" if it was led by "/" (?)
++ if (name.startsWith("./")) {
+ name = name.substring(2);
+ }
+ return name;
+@@ -857,8 +901,11 @@
+ for (ZipEntry ze : zes) {
+ long lastModified = ze.getTime();
+ if (lastModified != -1) {
+- File f = new File(ze.getName().replace('/', File.separatorChar));
+- f.setLastModified(lastModified);
++ String name = safeName(ze.getName().replace(File.separatorChar, '/'));
++ if (name.length() != 0) {
++ File f = new File(name.replace('/', File.separatorChar));
++ f.setLastModified(lastModified);
++ }
+ }
+ }
+ }
+@@ -902,7 +949,6 @@
+ Enumeration<? extends ZipEntry> zes = zf.entries();
+ while (zes.hasMoreElements()) {
+ ZipEntry e = zes.nextElement();
+- InputStream is;
+ if (files == null) {
+ dirs.add(extractFile(zf.getInputStream(e), e));
+ } else {
+@@ -926,8 +972,16 @@
+ */
+ ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
+ ZipEntry rc = null;
+- String name = e.getName();
+- File f = new File(e.getName().replace('/', File.separatorChar));
++ // The spec requres all slashes MUST be forward '/', it is possible
++ // an offending zip/jar entry may uses the backwards slash in its
++ // name. It might cause problem on Windows platform as it skips
++ // our "safe" check for leading slahs and dot-dot. So replace them
++ // with '/'.
++ String name = safeName(e.getName().replace(File.separatorChar, '/'));
++ if (name.length() == 0) {
++ return rc; // leading '/' or 'dot-dot' only path
++ }
++ File f = new File(name.replace('/', File.separatorChar));
+ if (e.isDirectory()) {
+ if (f.exists()) {
+ if (!f.isDirectory()) {
+--- ./jdk/src/share/classes/sun/tools/jar/resources/jar.properties Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/tools/jar/resources/jar.properties Fri Apr 10 09:21:28 2015 -0700
+@@ -66,7 +66,7 @@
+ (in = {0}) (out= {1})
+
+ usage=\
+-Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
++Usage: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files ...\n\
+ Options:\n\
+ \ \ -c create new archive\n\
+ \ \ -t list table of contents for archive\n\
+@@ -78,6 +78,7 @@
+ \ \ -e specify application entry point for stand-alone application \n\
+ \ \ bundled into an executable jar file\n\
+ \ \ -0 store only; use no ZIP compression\n\
++\ \ -P preserve leading '/' (absolute path) and ".." (parent directory) components from file names\n\
+ \ \ -M do not create a manifest file for the entries\n\
+ \ \ -i generate index information for the specified jar files\n\
+ \ \ -C change to the specified directory and include the following file\n\
+--- ./jdk/src/share/classes/sun/util/resources/LocaleNames_sv.properties Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/LocaleNames_sv.properties Fri Apr 10 09:21:28 2015 -0700
+@@ -1114,7 +1114,7 @@
+ WS=Samoa
+ YE=Jemen
+ YT=Mayotte
+-ZA=Sydafrika
++ZA=Sydafrika
+ ZM=Zambia
+ ZW=Zimbabwe
+
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1996, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Venezuela Time", "VET",
+ "Venezuela Summer Time", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Venezuelanische Zeit", "VET",
+ "Venezuelanische Sommerzeit", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Hora de Venezuela", "VET",
+ "Hora de verano de Venezuela", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Heure du Venezuela", "VET",
+ "Heure d'\u00e9t\u00e9 du Venezuela", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Ora del Venezuela", "VET",
+ "Ora estiva del Venezuela", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"\u30d9\u30cd\u30ba\u30a8\u30e9\u6642\u9593", "VET",
+ "\u30d9\u30cd\u30ba\u30a8\u30e9\u590f\u6642\u9593", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"\ubca0\ub124\uc218\uc5d8\ub77c \uc2dc\uac04", "VET",
+ "\ubca0\ub124\uc218\uc5d8\ub77c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_pt_BR.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Fuso hor\u00e1rio da Venezuela", "VET",
+ "Fuso hor\u00e1rio de ver\u00e3o da Venezuela", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"Venezuela, normaltid", "VET",
+ "Venezuela, sommartid", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"\u59d4\u5185\u745e\u62c9\u65f6\u95f4", "VET",
+ "\u59d4\u5185\u745e\u62c9\u590f\u4ee4\u65f6", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1997, 2015, 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
+@@ -331,7 +331,7 @@
+ {"America/Buenos_Aires", AGT},
+ {"America/Cambridge_Bay", MST},
+ {"America/Campo_Grande", AMT},
+- {"America/Cancun", CST},
++ {"America/Cancun", EST},
+ {"America/Caracas", new String[] {"\u59d4\u5167\u745e\u62c9\u6642\u9593", "VET",
+ "\u59d4\u5167\u745e\u62c9\u590f\u4ee4\u6642\u9593", "VEST"}},
+ {"America/Catamarca", AGT},
+--- ./jdk/src/share/demo/README Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/demo/README Fri Apr 10 09:21:28 2015 -0700
+@@ -4,3 +4,12 @@
+ production-quality application, such as security checks, input
+ validation, and proper error handling, might not be present in the
+ sample code.
++
++In some cases, the default security settings may block an execution
++of demo applets in a browser. To adjust the security settings, please
++refer to the following resource:
++
++http://java.com/en/download/help/java_blocked.xml
++
++Some demo applets need to be accessed through the HTTP or HTTPS
++protocols to enable access to the required resources.
+--- ./jdk/src/share/javavm/export/jvm.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/javavm/export/jvm.h Fri Apr 10 09:21:28 2015 -0700
+@@ -437,9 +437,6 @@
+ JNIEXPORT jobjectArray JNICALL
+ JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
+
+-JNIEXPORT jobject JNICALL
+-JVM_GetClassLoader(JNIEnv *env, jclass cls);
+-
+ JNIEXPORT jboolean JNICALL
+ JVM_IsInterface(JNIEnv *env, jclass cls);
+
+--- ./jdk/src/share/native/common/check_code.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/common/check_code.c Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1994, 2014, 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
+@@ -1296,16 +1296,9 @@
+ }
+ (*env)->DeleteLocalRef(env, super);
+
+- /* The optimizer make cause this to happen on local code */
++ /* The optimizer may cause this to happen on local code */
+ if (not_found) {
+-#ifdef BROKEN_JAVAC
+- jobject loader = JVM_GetClassLoader(env, context->class);
+- int has_loader = (loader != 0);
+- (*env)->DeleteLocalRef(env, loader);
+- if (has_loader)
+-#endif /* BROKEN_JAVAC */
+- CCerror(context,
+- "Illegal use of nonvirtual function call");
++ CCerror(context, "Illegal use of nonvirtual function call");
+ }
+ }
+ }
+--- ./jdk/src/share/native/java/io/io_util.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/io/io_util.c Fri Apr 10 09:21:28 2015 -0700
+@@ -214,13 +214,17 @@
+ throwFileNotFoundException(JNIEnv *env, jstring path)
+ {
+ char buf[256];
+- jint n;
++ size_t n;
+ jobject x;
+ jstring why = NULL;
+
+- n = JVM_GetLastErrorString(buf, sizeof(buf));
++ n = getLastErrorString(buf, sizeof(buf));
+ if (n > 0) {
++#ifdef WIN32
++ why = (*env)->NewStringUTF(env, buf);
++#else
+ why = JNU_NewStringPlatform(env, buf);
++#endif
+ }
+ x = JNU_NewObjectByName(env,
+ "java/io/FileNotFoundException",
+--- ./jdk/src/share/native/java/io/io_util.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/io/io_util.h Fri Apr 10 09:21:28 2015 -0700
+@@ -54,7 +54,7 @@
+ jint len, jboolean append, jfieldID fid);
+ void fileOpen(JNIEnv *env, jobject this, jstring path, jfieldID fid, int flags);
+ void throwFileNotFoundException(JNIEnv *env, jstring path);
+-
++size_t getLastErrorString(char *buf, size_t len);
+
+ /*
+ * Macros for managing platform strings. The typical usage pattern is:
+--- ./jdk/src/share/native/java/lang/Class.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/lang/Class.c Fri Apr 10 09:21:28 2015 -0700
+@@ -45,7 +45,6 @@
+ #define CLS "Ljava/lang/Class;"
+ #define CPL "Lsun/reflect/ConstantPool;"
+ #define STR "Ljava/lang/String;"
+-#define JCL "Ljava/lang/ClassLoader;"
+ #define FLD "Ljava/lang/reflect/Field;"
+ #define MHD "Ljava/lang/reflect/Method;"
+ #define CTR "Ljava/lang/reflect/Constructor;"
+@@ -56,7 +55,6 @@
+ {"getName0", "()" STR, (void *)&JVM_GetClassName},
+ {"getSuperclass", "()" CLS, NULL},
+ {"getInterfaces", "()[" CLS, (void *)&JVM_GetClassInterfaces},
+- {"getClassLoader0", "()" JCL, (void *)&JVM_GetClassLoader},
+ {"isInterface", "()Z", (void *)&JVM_IsInterface},
+ {"getSigners", "()[" OBJ, (void *)&JVM_GetClassSigners},
+ {"setSigners", "([" OBJ ")V", (void *)&JVM_SetClassSigners},
+@@ -81,7 +79,6 @@
+ #undef OBJ
+ #undef CLS
+ #undef STR
+-#undef JCL
+ #undef FLD
+ #undef MHD
+ #undef CTR
+--- ./jdk/src/share/native/java/net/Inet4Address.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/net/Inet4Address.c Fri Apr 10 09:21:28 2015 -0700
+@@ -46,5 +46,4 @@
+ ia4_class = (*env)->NewGlobalRef(env, c);
+ CHECK_NULL(ia4_class);
+ ia4_ctrID = (*env)->GetMethodID(env, ia4_class, "<init>", "()V");
+- CHECK_NULL(ia4_ctrID);
+ }
+--- ./jdk/src/share/native/java/net/Inet6Address.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/net/Inet6Address.c Fri Apr 10 09:21:28 2015 -0700
+@@ -66,11 +66,10 @@
+ ia6_cachedscopeidID = (*env)->GetFieldID(env, ia6_class, "cached_scope_id", "I");
+ CHECK_NULL(ia6_cachedscopeidID);
+ ia6_scopeidsetID = (*env)->GetFieldID(env, ia6h_class, "scope_id_set", "Z");
+- CHECK_NULL(ia6_scopeidID);
++ CHECK_NULL(ia6_scopeidsetID);
+ ia6_scopeifnameID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname", "Ljava/net/NetworkInterface;");
+ CHECK_NULL(ia6_scopeifnameID);
+ ia6_scopeifnamesetID = (*env)->GetFieldID(env, ia6h_class, "scope_ifname_set", "Z");
+ CHECK_NULL(ia6_scopeifnamesetID);
+ ia6_ctrID = (*env)->GetMethodID(env, ia6_class, "<init>", "()V");
+- CHECK_NULL(ia6_ctrID);
+ }
+--- ./jdk/src/share/native/java/net/InetAddress.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/net/InetAddress.c Fri Apr 10 09:21:28 2015 -0700
+@@ -64,5 +64,4 @@
+ iac_familyID = (*env)->GetFieldID(env, iac_class, "family", "I");
+ CHECK_NULL(iac_familyID);
+ iac_hostNameID = (*env)->GetFieldID(env, iac_class, "hostName", "Ljava/lang/String;");
+- CHECK_NULL(iac_hostNameID);
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/net/jdk_net_SocketFlow.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++#include <jni.h>
++/* Header for class jdk_net_SocketFlow */
++
++#ifndef _Included_jdk_net_SocketFlow
++#define _Included_jdk_net_SocketFlow
++#ifdef __cplusplus
++extern "C" {
++#endif
++#undef jdk_net_SocketFlow_UNSET
++#define jdk_net_SocketFlow_UNSET -1L
++#undef jdk_net_SocketFlow_NORMAL_PRIORITY
++#define jdk_net_SocketFlow_NORMAL_PRIORITY 1L
++#undef jdk_net_SocketFlow_HIGH_PRIORITY
++#define jdk_net_SocketFlow_HIGH_PRIORITY 2L
++#ifdef __cplusplus
++}
++#endif
++#endif
+--- ./jdk/src/share/native/java/net/net_util.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/net/net_util.h Fri Apr 10 09:21:28 2015 -0700
+@@ -40,7 +40,7 @@
+ #define IPv6 2
+
+ #define NET_ERROR(env, ex, msg) \
+-{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg) }
++{ if (!(*env)->ExceptionOccurred(env)) JNU_ThrowByName(env, ex, msg); }
+
+ #define CHECK_NULL(x) if ((x) == NULL) return;
+ #define CHECK_NULL_RETURN(x, y) if ((x) == NULL) return y;
+@@ -189,6 +189,9 @@
+ JNIEXPORT int JNICALL
+ NET_MapSocketOptionV6(jint cmd, int *level, int *optname);
+
++JNIEXPORT jint JNICALL
++NET_EnableFastTcpLoopback(int fd);
++
+ int getScopeID (struct sockaddr *);
+
+ int cmpScopeID (unsigned int, struct sockaddr *);
+--- ./jdk/src/share/native/java/util/zip/Deflater.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/util/zip/Deflater.c Fri Apr 10 09:21:28 2015 -0700
+@@ -68,10 +68,11 @@
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return jlong_zero;
+ } else {
+- char *msg;
+- switch (deflateInit2(strm, level, Z_DEFLATED,
+- nowrap ? -MAX_WBITS : MAX_WBITS,
+- DEF_MEM_LEVEL, strategy)) {
++ const char *msg;
++ int ret = deflateInit2(strm, level, Z_DEFLATED,
++ nowrap ? -MAX_WBITS : MAX_WBITS,
++ DEF_MEM_LEVEL, strategy);
++ switch (ret) {
+ case Z_OK:
+ return ptr_to_jlong(strm);
+ case Z_MEM_ERROR:
+@@ -83,7 +84,11 @@
+ JNU_ThrowIllegalArgumentException(env, 0);
+ return jlong_zero;
+ default:
+- msg = strm->msg;
++ msg = ((strm->msg != NULL) ? strm->msg :
++ (ret == Z_VERSION_ERROR) ?
++ "zlib returned Z_VERSION_ERROR: "
++ "compile time and runtime zlib implementations differ" :
++ "unknown error initializing zlib library");
+ free(strm);
+ JNU_ThrowInternalError(env, msg);
+ return jlong_zero;
+--- ./jdk/src/share/native/java/util/zip/Inflater.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/java/util/zip/Inflater.c Fri Apr 10 09:21:28 2015 -0700
+@@ -27,6 +27,7 @@
+ * Native method support for java.util.zip.Inflater
+ */
+
++#include <stddef.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <errno.h>
+@@ -60,12 +61,13 @@
+ {
+ z_stream *strm = calloc(1, sizeof(z_stream));
+
+- if (strm == 0) {
++ if (strm == NULL) {
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return jlong_zero;
+ } else {
+- char *msg;
+- switch (inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS)) {
++ const char *msg;
++ int ret = inflateInit2(strm, nowrap ? -MAX_WBITS : MAX_WBITS);
++ switch (ret) {
+ case Z_OK:
+ return ptr_to_jlong(strm);
+ case Z_MEM_ERROR:
+@@ -73,7 +75,13 @@
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return jlong_zero;
+ default:
+- msg = strm->msg;
++ msg = ((strm->msg != NULL) ? strm->msg :
++ (ret == Z_VERSION_ERROR) ?
++ "zlib returned Z_VERSION_ERROR: "
++ "compile time and runtime zlib implementations differ" :
++ (ret == Z_STREAM_ERROR) ?
++ "inflateInit2 returned Z_STREAM_ERROR" :
++ "unknown error initializing zlib library");
+ free(strm);
+ JNU_ThrowInternalError(env, msg);
+ return jlong_zero;
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,855 +0,0 @@
+-
+- ChangeLog file for zlib
+-
+-Changes in 1.2.3 (18 July 2005)
+-- Apply security vulnerability fixes to contrib/infback9 as well
+-- Clean up some text files (carriage returns, trailing space)
+-- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
+-
+-Changes in 1.2.2.4 (11 July 2005)
+-- Add inflatePrime() function for starting inflation at bit boundary
+-- Avoid some Visual C warnings in deflate.c
+-- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
+- compile
+-- Fix some spelling errors in comments [Betts]
+-- Correct inflateInit2() error return documentation in zlib.h
+-- Added zran.c example of compressed data random access to examples
+- directory, shows use of inflatePrime()
+-- Fix cast for assignments to strm->state in inflate.c and infback.c
+-- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
+-- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
+-- Add cast in trees.c t avoid a warning [Oberhumer]
+-- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
+-- Update make_vms.com [Zinser]
+-- Initialize state->write in inflateReset() since copied in inflate_fast()
+-- Be more strict on incomplete code sets in inflate_table() and increase
+- ENOUGH and MAXD -- this repairs a possible security vulnerability for
+- invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
+- discovering the vulnerability and providing test cases.
+-- Add ia64 support to configure for HP-UX [Smith]
+-- Add error return to gzread() for format or i/o error [Levin]
+-- Use malloc.h for OS/2 [Necasek]
+-
+-Changes in 1.2.2.3 (27 May 2005)
+-- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
+-- Typecast fread() return values in gzio.c [Vollant]
+-- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
+-- Fix crc check bug in gzread() after gzungetc() [Heiner]
+-- Add the deflateTune() function to adjust internal compression parameters
+-- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
+-- Remove an incorrect assertion in examples/zpipe.c
+-- Add C++ wrapper in infback9.h [Donais]
+-- Fix bug in inflateCopy() when decoding fixed codes
+-- Note in zlib.h how much deflateSetDictionary() actually uses
+-- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
+-- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
+-- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
+-- Add gzdirect() function to indicate transparent reads
+-- Update contrib/minizip [Vollant]
+-- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
+-- Add casts in crc32.c to avoid warnings [Oberhumer]
+-- Add contrib/masmx64 [Vollant]
+-- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
+-
+-Changes in 1.2.2.2 (30 December 2004)
+-- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
+- avoid implicit memcpy calls (portability for no-library compilation)
+-- Increase sprintf() buffer size in gzdopen() to allow for large numbers
+-- Add INFLATE_STRICT to check distances against zlib header
+-- Improve WinCE errno handling and comments [Chang]
+-- Remove comment about no gzip header processing in FAQ
+-- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
+-- Add updated make_vms.com [Coghlan], update README
+-- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
+- fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
+-- Add FAQ entry and comments in deflate.c on uninitialized memory access
+-- Add Solaris 9 make options in configure [Gilbert]
+-- Allow strerror() usage in gzio.c for STDC
+-- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
+-- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
+-- Use z_off_t for adler32_combine() and crc32_combine() lengths
+-- Make adler32() much faster for small len
+-- Use OS_CODE in deflate() default gzip header
+-
+-Changes in 1.2.2.1 (31 October 2004)
+-- Allow inflateSetDictionary() call for raw inflate
+-- Fix inflate header crc check bug for file names and comments
+-- Add deflateSetHeader() and gz_header structure for custom gzip headers
+-- Add inflateGetheader() to retrieve gzip headers
+-- Add crc32_combine() and adler32_combine() functions
+-- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
+-- Use zstreamp consistently in zlib.h (inflate_back functions)
+-- Remove GUNZIP condition from definition of inflate_mode in inflate.h
+- and in contrib/inflate86/inffast.S [Truta, Anderson]
+-- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
+-- Update projects/README.projects and projects/visualc6 [Truta]
+-- Update win32/DLL_FAQ.txt [Truta]
+-- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
+-- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
+-- Use a new algorithm for setting strm->data_type in trees.c [Truta]
+-- Do not define an exit() prototype in zutil.c unless DEBUG defined
+-- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
+-- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
+-- Fix Darwin build version identification [Peterson]
+-
+-Changes in 1.2.2 (3 October 2004)
+-- Update zlib.h comments on gzip in-memory processing
+-- Set adler to 1 in inflateReset() to support Java test suite [Walles]
+-- Add contrib/dotzlib [Ravn]
+-- Update win32/DLL_FAQ.txt [Truta]
+-- Update contrib/minizip [Vollant]
+-- Move contrib/visual-basic.txt to old/ [Truta]
+-- Fix assembler builds in projects/visualc6/ [Truta]
+-
+-Changes in 1.2.1.2 (9 September 2004)
+-- Update INDEX file
+-- Fix trees.c to update strm->data_type (no one ever noticed!)
+-- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
+-- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
+-- Add limited multitasking protection to DYNAMIC_CRC_TABLE
+-- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
+-- Don't declare strerror() under VMS [Mozilla]
+-- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
+-- Update contrib/ada [Anisimkov]
+-- Update contrib/minizip [Vollant]
+-- Fix configure to not hardcode directories for Darwin [Peterson]
+-- Fix gzio.c to not return error on empty files [Brown]
+-- Fix indentation; update version in contrib/delphi/ZLib.pas and
+- contrib/pascal/zlibpas.pas [Truta]
+-- Update mkasm.bat in contrib/masmx86 [Truta]
+-- Update contrib/untgz [Truta]
+-- Add projects/README.projects [Truta]
+-- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
+-- Update win32/DLL_FAQ.txt [Truta]
+-- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
+-- Remove an unnecessary assignment to curr in inftrees.c [Truta]
+-- Add OS/2 to exe builds in configure [Poltorak]
+-- Remove err dummy parameter in zlib.h [Kientzle]
+-
+-Changes in 1.2.1.1 (9 January 2004)
+-- Update email address in README
+-- Several FAQ updates
+-- Fix a big fat bug in inftrees.c that prevented decoding valid
+- dynamic blocks with only literals and no distance codes --
+- Thanks to "Hot Emu" for the bug report and sample file
+-- Add a note to puff.c on no distance codes case.
+-
+-Changes in 1.2.1 (17 November 2003)
+-- Remove a tab in contrib/gzappend/gzappend.c
+-- Update some interfaces in contrib for new zlib functions
+-- Update zlib version number in some contrib entries
+-- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
+-- Support shared libraries on Hurd and KFreeBSD [Brown]
+-- Fix error in NO_DIVIDE option of adler32.c
+-
+-Changes in 1.2.0.8 (4 November 2003)
+-- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
+-- Add experimental NO_DIVIDE #define in adler32.c
+- - Possibly faster on some processors (let me know if it is)
+-- Correct Z_BLOCK to not return on first inflate call if no wrap
+-- Fix strm->data_type on inflate() return to correctly indicate EOB
+-- Add deflatePrime() function for appending in the middle of a byte
+-- Add contrib/gzappend for an example of appending to a stream
+-- Update win32/DLL_FAQ.txt [Truta]
+-- Delete Turbo C comment in README [Truta]
+-- Improve some indentation in zconf.h [Truta]
+-- Fix infinite loop on bad input in configure script [Church]
+-- Fix gzeof() for concatenated gzip files [Johnson]
+-- Add example to contrib/visual-basic.txt [Michael B.]
+-- Add -p to mkdir's in Makefile.in [vda]
+-- Fix configure to properly detect presence or lack of printf functions
+-- Add AS400 support [Monnerat]
+-- Add a little Cygwin support [Wilson]
+-
+-Changes in 1.2.0.7 (21 September 2003)
+-- Correct some debug formats in contrib/infback9
+-- Cast a type in a debug statement in trees.c
+-- Change search and replace delimiter in configure from % to # [Beebe]
+-- Update contrib/untgz to 0.2 with various fixes [Truta]
+-- Add build support for Amiga [Nikl]
+-- Remove some directories in old that have been updated to 1.2
+-- Add dylib building for Mac OS X in configure and Makefile.in
+-- Remove old distribution stuff from Makefile
+-- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
+-- Update links in README
+-
+-Changes in 1.2.0.6 (13 September 2003)
+-- Minor FAQ updates
+-- Update contrib/minizip to 1.00 [Vollant]
+-- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
+-- Update POSTINC comment for 68060 [Nikl]
+-- Add contrib/infback9 with deflate64 decoding (unsupported)
+-- For MVS define NO_vsnprintf and undefine FAR [van Burik]
+-- Add pragma for fdopen on MVS [van Burik]
+-
+-Changes in 1.2.0.5 (8 September 2003)
+-- Add OF to inflateBackEnd() declaration in zlib.h
+-- Remember start when using gzdopen in the middle of a file
+-- Use internal off_t counters in gz* functions to properly handle seeks
+-- Perform more rigorous check for distance-too-far in inffast.c
+-- Add Z_BLOCK flush option to return from inflate at block boundary
+-- Set strm->data_type on return from inflate
+- - Indicate bits unused, if at block boundary, and if in last block
+-- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
+-- Add condition so old NO_DEFLATE define still works for compatibility
+-- FAQ update regarding the Windows DLL [Truta]
+-- INDEX update: add qnx entry, remove aix entry [Truta]
+-- Install zlib.3 into mandir [Wilson]
+-- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
+-- Adapt the zlib interface to the new DLL convention guidelines [Truta]
+-- Introduce ZLIB_WINAPI macro to allow the export of functions using
+- the WINAPI calling convention, for Visual Basic [Vollant, Truta]
+-- Update msdos and win32 scripts and makefiles [Truta]
+-- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
+-- Add contrib/ada [Anisimkov]
+-- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
+-- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
+-- Add contrib/masm686 [Truta]
+-- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
+- [Truta, Vollant]
+-- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
+-- Remove contrib/delphi2; add a new contrib/delphi [Truta]
+-- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
+- and fix some method prototypes [Truta]
+-- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
+- [Truta]
+-- Avoid the use of backslash (\) in contrib/minizip [Vollant]
+-- Fix file time handling in contrib/untgz; update makefiles [Truta]
+-- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
+- [Vollant]
+-- Remove contrib/vstudio/vc15_16 [Vollant]
+-- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
+-- Update README.contrib [Truta]
+-- Invert the assignment order of match_head and s->prev[...] in
+- INSERT_STRING [Truta]
+-- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
+- [Truta]
+-- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
+-- Fix prototype of syncsearch in inflate.c [Truta]
+-- Introduce ASMINF macro to be enabled when using an ASM implementation
+- of inflate_fast [Truta]
+-- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
+-- Modify test_gzio in example.c to take a single file name as a
+- parameter [Truta]
+-- Exit the example.c program if gzopen fails [Truta]
+-- Add type casts around strlen in example.c [Truta]
+-- Remove casting to sizeof in minigzip.c; give a proper type
+- to the variable compared with SUFFIX_LEN [Truta]
+-- Update definitions of STDC and STDC99 in zconf.h [Truta]
+-- Synchronize zconf.h with the new Windows DLL interface [Truta]
+-- Use SYS16BIT instead of __32BIT__ to distinguish between
+- 16- and 32-bit platforms [Truta]
+-- Use far memory allocators in small 16-bit memory models for
+- Turbo C [Truta]
+-- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
+- zlibCompileFlags [Truta]
+-- Cygwin has vsnprintf [Wilson]
+-- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
+-- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
+-
+-Changes in 1.2.0.4 (10 August 2003)
+-- Minor FAQ updates
+-- Be more strict when checking inflateInit2's windowBits parameter
+-- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
+-- Add gzip wrapper option to deflateInit2 using windowBits
+-- Add updated QNX rule in configure and qnx directory [Bonnefoy]
+-- Make inflate distance-too-far checks more rigorous
+-- Clean up FAR usage in inflate
+-- Add casting to sizeof() in gzio.c and minigzip.c
+-
+-Changes in 1.2.0.3 (19 July 2003)
+-- Fix silly error in gzungetc() implementation [Vollant]
+-- Update contrib/minizip and contrib/vstudio [Vollant]
+-- Fix printf format in example.c
+-- Correct cdecl support in zconf.in.h [Anisimkov]
+-- Minor FAQ updates
+-
+-Changes in 1.2.0.2 (13 July 2003)
+-- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
+-- Attempt to avoid warnings in crc32.c for pointer-int conversion
+-- Add AIX to configure, remove aix directory [Bakker]
+-- Add some casts to minigzip.c
+-- Improve checking after insecure sprintf() or vsprintf() calls
+-- Remove #elif's from crc32.c
+-- Change leave label to inf_leave in inflate.c and infback.c to avoid
+- library conflicts
+-- Remove inflate gzip decoding by default--only enable gzip decoding by
+- special request for stricter backward compatibility
+-- Add zlibCompileFlags() function to return compilation information
+-- More typecasting in deflate.c to avoid warnings
+-- Remove leading underscore from _Capital #defines [Truta]
+-- Fix configure to link shared library when testing
+-- Add some Windows CE target adjustments [Mai]
+-- Remove #define ZLIB_DLL in zconf.h [Vollant]
+-- Add zlib.3 [Rodgers]
+-- Update RFC URL in deflate.c and algorithm.txt [Mai]
+-- Add zlib_dll_FAQ.txt to contrib [Truta]
+-- Add UL to some constants [Truta]
+-- Update minizip and vstudio [Vollant]
+-- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
+-- Expand use of NO_DUMMY_DECL to avoid all dummy structures
+-- Added iostream3 to contrib [Schwardt]
+-- Replace rewind() with fseek() for WinCE [Truta]
+-- Improve setting of zlib format compression level flags
+- - Report 0 for huffman and rle strategies and for level == 0 or 1
+- - Report 2 only for level == 6
+-- Only deal with 64K limit when necessary at compile time [Truta]
+-- Allow TOO_FAR check to be turned off at compile time [Truta]
+-- Add gzclearerr() function [Souza]
+-- Add gzungetc() function
+-
+-Changes in 1.2.0.1 (17 March 2003)
+-- Add Z_RLE strategy for run-length encoding [Truta]
+- - When Z_RLE requested, restrict matches to distance one
+- - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
+-- Correct FASTEST compilation to allow level == 0
+-- Clean up what gets compiled for FASTEST
+-- Incorporate changes to zconf.in.h [Vollant]
+- - Refine detection of Turbo C need for dummy returns
+- - Refine ZLIB_DLL compilation
+- - Include additional header file on VMS for off_t typedef
+-- Try to use _vsnprintf where it supplants vsprintf [Vollant]
+-- Add some casts in inffast.c
+-- Enchance comments in zlib.h on what happens if gzprintf() tries to
+- write more than 4095 bytes before compression
+-- Remove unused state from inflateBackEnd()
+-- Remove exit(0) from minigzip.c, example.c
+-- Get rid of all those darn tabs
+-- Add "check" target to Makefile.in that does the same thing as "test"
+-- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
+-- Update contrib/inflate86 [Anderson]
+-- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
+-- Add msdos and win32 directories with makefiles [Truta]
+-- More additions and improvements to the FAQ
+-
+-Changes in 1.2.0 (9 March 2003)
+-- New and improved inflate code
+- - About 20% faster
+- - Does not allocate 32K window unless and until needed
+- - Automatically detects and decompresses gzip streams
+- - Raw inflate no longer needs an extra dummy byte at end
+- - Added inflateBack functions using a callback interface--even faster
+- than inflate, useful for file utilities (gzip, zip)
+- - Added inflateCopy() function to record state for random access on
+- externally generated deflate streams (e.g. in gzip files)
+- - More readable code (I hope)
+-- New and improved crc32()
+- - About 50% faster, thanks to suggestions from Rodney Brown
+-- Add deflateBound() and compressBound() functions
+-- Fix memory leak in deflateInit2()
+-- Permit setting dictionary for raw deflate (for parallel deflate)
+-- Fix const declaration for gzwrite()
+-- Check for some malloc() failures in gzio.c
+-- Fix bug in gzopen() on single-byte file 0x1f
+-- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
+- and next buffer doesn't start with 0x8b
+-- Fix uncompress() to return Z_DATA_ERROR on truncated input
+-- Free memory at end of example.c
+-- Remove MAX #define in trees.c (conflicted with some libraries)
+-- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
+-- Declare malloc() and free() in gzio.c if STDC not defined
+-- Use malloc() instead of calloc() in zutil.c if int big enough
+-- Define STDC for AIX
+-- Add aix/ with approach for compiling shared library on AIX
+-- Add HP-UX support for shared libraries in configure
+-- Add OpenUNIX support for shared libraries in configure
+-- Use $cc instead of gcc to build shared library
+-- Make prefix directory if needed when installing
+-- Correct Macintosh avoidance of typedef Byte in zconf.h
+-- Correct Turbo C memory allocation when under Linux
+-- Use libz.a instead of -lz in Makefile (assure use of compiled library)
+-- Update configure to check for snprintf or vsnprintf functions and their
+- return value, warn during make if using an insecure function
+-- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
+- is lost when library is used--resolution is to build new zconf.h
+-- Documentation improvements (in zlib.h):
+- - Document raw deflate and inflate
+- - Update RFCs URL
+- - Point out that zlib and gzip formats are different
+- - Note that Z_BUF_ERROR is not fatal
+- - Document string limit for gzprintf() and possible buffer overflow
+- - Note requirement on avail_out when flushing
+- - Note permitted values of flush parameter of inflate()
+-- Add some FAQs (and even answers) to the FAQ
+-- Add contrib/inflate86/ for x86 faster inflate
+-- Add contrib/blast/ for PKWare Data Compression Library decompression
+-- Add contrib/puff/ simple inflate for deflate format description
+-
+-Changes in 1.1.4 (11 March 2002)
+-- ZFREE was repeated on same allocation on some error conditions.
+- This creates a security problem described in
+- http://www.zlib.org/advisory-2002-03-11.txt
+-- Returned incorrect error (Z_MEM_ERROR) on some invalid data
+-- Avoid accesses before window for invalid distances with inflate window
+- less than 32K.
+-- force windowBits > 8 to avoid a bug in the encoder for a window size
+- of 256 bytes. (A complete fix will be available in 1.1.5).
+-
+-Changes in 1.1.3 (9 July 1998)
+-- fix "an inflate input buffer bug that shows up on rare but persistent
+- occasions" (Mark)
+-- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+-- fix gzseek(..., SEEK_SET) in write mode
+-- fix crc check after a gzeek (Frank Faubert)
+-- fix miniunzip when the last entry in a zip file is itself a zip file
+- (J Lillge)
+-- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+- See http://www.muppetlabs.com/~breadbox/software/assembly.html
+-- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+-- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+-- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+-- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+-- added a FAQ file
+-
+-- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+-- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+-- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+-- avoid some warnings with Borland C (Tom Tanner)
+-- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+-- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
+-- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+-- use libdir and includedir in Makefile.in (Tim Mooney)
+-- support shared libraries on OSF1 V4 (Tim Mooney)
+-- remove so_locations in "make clean" (Tim Mooney)
+-- fix maketree.c compilation error (Glenn, Mark)
+-- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+-- new Makefile.riscos (Rich Walker)
+-- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+-- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+-- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+-- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+-- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+-- fix parameter check in deflateCopy (Gunther Nikl)
+-- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+-- Many portability patches by Christian Spieler:
+- . zutil.c, zutil.h: added "const" for zmem*
+- . Make_vms.com: fixed some typos
+- . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+- . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+- . msdos/Makefile.*: use model-dependent name for the built zlib library
+- . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+- new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+-- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+-- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+-- fix test for errno.h in configure (Tim Newsham)
+-
+-Changes in 1.1.2 (19 March 98)
+-- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+- See http://www.winimage.com/zLibDll/unzip.html
+-- preinitialize the inflate tables for fixed codes, to make the code
+- completely thread safe (Mark)
+-- some simplifications and slight speed-up to the inflate code (Mark)
+-- fix gzeof on non-compressed files (Allan Schrum)
+-- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+-- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+-- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+-- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+-- do not wrap extern "C" around system includes (Tom Lane)
+-- mention zlib binding for TCL in README (Andreas Kupries)
+-- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+-- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+-- allow "configure --prefix $HOME" (Tim Mooney)
+-- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+-- move Makefile.sas to amiga/Makefile.sas
+-
+-Changes in 1.1.1 (27 Feb 98)
+-- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
+-- remove block truncation heuristic which had very marginal effect for zlib
+- (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+- compression ratio on some files. This also allows inlining _tr_tally for
+- matches in deflate_slow.
+-- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+-
+-Changes in 1.1.0 (24 Feb 98)
+-- do not return STREAM_END prematurely in inflate (John Bowler)
+-- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+-- compile with -DFASTEST to get compression code optimized for speed only
+-- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+-- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
+- on Sun but significant on HP)
+-
+-- add a pointer to experimental unzip library in README (Gilles Vollant)
+-- initialize variable gcc in configure (Chris Herborth)
+-
+-Changes in 1.0.9 (17 Feb 1998)
+-- added gzputs and gzgets functions
+-- do not clear eof flag in gzseek (Mark Diekhans)
+-- fix gzseek for files in transparent mode (Mark Diekhans)
+-- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
+-- replace EXPORT with ZEXPORT to avoid conflict with other programs
+-- added compress2 in zconf.h, zlib.def, zlib.dnt
+-- new asm code from Gilles Vollant in contrib/asm386
+-- simplify the inflate code (Mark):
+- . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
+- . ZALLOC the length list in inflate_trees_fixed() instead of using stack
+- . ZALLOC the value area for huft_build() instead of using stack
+- . Simplify Z_FINISH check in inflate()
+-
+-- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
+-- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
+-- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
+- the declaration of FAR (Gilles VOllant)
+-- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
+-- read_buf buf parameter of type Bytef* instead of charf*
+-- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
+-- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
+-- fix check for presence of directories in "make install" (Ian Willis)
+-
+-Changes in 1.0.8 (27 Jan 1998)
+-- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
+-- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
+-- added compress2() to allow setting the compression level
+-- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
+-- use constant arrays for the static trees in trees.c instead of computing
+- them at run time (thanks to Ken Raeburn for this suggestion). To create
+- trees.h, compile with GEN_TREES_H and run "make test".
+-- check return code of example in "make test" and display result
+-- pass minigzip command line options to file_compress
+-- simplifying code of inflateSync to avoid gcc 2.8 bug
+-
+-- support CC="gcc -Wall" in configure -s (QingLong)
+-- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
+-- fix test for shared library support to avoid compiler warnings
+-- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
+-- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
+-- do not use fdopen for Metrowerks on Mac (Brad Pettit))
+-- add checks for gzputc and gzputc in example.c
+-- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
+-- use const for the CRC table (Ken Raeburn)
+-- fixed "make uninstall" for shared libraries
+-- use Tracev instead of Trace in infblock.c
+-- in example.c use correct compressed length for test_sync
+-- suppress +vnocompatwarnings in configure for HPUX (not always supported)
+-
+-Changes in 1.0.7 (20 Jan 1998)
+-- fix gzseek which was broken in write mode
+-- return error for gzseek to negative absolute position
+-- fix configure for Linux (Chun-Chung Chen)
+-- increase stack space for MSC (Tim Wegner)
+-- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
+-- define EXPORTVA for gzprintf (Gilles Vollant)
+-- added man page zlib.3 (Rick Rodgers)
+-- for contrib/untgz, fix makedir() and improve Makefile
+-
+-- check gzseek in write mode in example.c
+-- allocate extra buffer for seeks only if gzseek is actually called
+-- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
+-- add inflateSyncPoint in zconf.h
+-- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
+-
+-Changes in 1.0.6 (19 Jan 1998)
+-- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
+- gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
+-- Fix a deflate bug occurring only with compression level 0 (thanks to
+- Andy Buckler for finding this one).
+-- In minigzip, pass transparently also the first byte for .Z files.
+-- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
+-- check Z_FINISH in inflate (thanks to Marc Schluper)
+-- Implement deflateCopy (thanks to Adam Costello)
+-- make static libraries by default in configure, add --shared option.
+-- move MSDOS or Windows specific files to directory msdos
+-- suppress the notion of partial flush to simplify the interface
+- (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
+-- suppress history buffer provided by application to simplify the interface
+- (this feature was not implemented anyway in 1.0.4)
+-- next_in and avail_in must be initialized before calling inflateInit or
+- inflateInit2
+-- add EXPORT in all exported functions (for Windows DLL)
+-- added Makefile.nt (thanks to Stephen Williams)
+-- added the unsupported "contrib" directory:
+- contrib/asm386/ by Gilles Vollant <info@winimage.com>
+- 386 asm code replacing longest_match().
+- contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
+- A C++ I/O streams interface to the zlib gz* functions
+- contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
+- Another C++ I/O streams interface
+- contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+- A very simple tar.gz file extractor using zlib
+- contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
+- How to use compress(), uncompress() and the gz* functions from VB.
+-- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
+- level) in minigzip (thanks to Tom Lane)
+-
+-- use const for rommable constants in deflate
+-- added test for gzseek and gztell in example.c
+-- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
+-- add undocumented function zError to convert error code to string
+- (for Tim Smithers)
+-- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
+-- Use default memcpy for Symantec MSDOS compiler.
+-- Add EXPORT keyword for check_func (needed for Windows DLL)
+-- add current directory to LD_LIBRARY_PATH for "make test"
+-- create also a link for libz.so.1
+-- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
+-- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
+-- added -soname for Linux in configure (Chun-Chung Chen,
+-- assign numbers to the exported functions in zlib.def (for Windows DLL)
+-- add advice in zlib.h for best usage of deflateSetDictionary
+-- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
+-- allow compilation with ANSI keywords only enabled for TurboC in large model
+-- avoid "versionString"[0] (Borland bug)
+-- add NEED_DUMMY_RETURN for Borland
+-- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
+-- allow compilation with CC
+-- defined STDC for OS/2 (David Charlap)
+-- limit external names to 8 chars for MVS (Thomas Lund)
+-- in minigzip.c, use static buffers only for 16-bit systems
+-- fix suffix check for "minigzip -d foo.gz"
+-- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
+-- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
+-- added makelcc.bat for lcc-win32 (Tom St Denis)
+-- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
+-- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
+-- check for unistd.h in configure (for off_t)
+-- remove useless check parameter in inflate_blocks_free
+-- avoid useless assignment of s->check to itself in inflate_blocks_new
+-- do not flush twice in gzclose (thanks to Ken Raeburn)
+-- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
+-- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
+-- work around buggy fclose on pipes for HP/UX
+-- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
+-- fix configure if CC is already equal to gcc
+-
+-Changes in 1.0.5 (3 Jan 98)
+-- Fix inflate to terminate gracefully when fed corrupted or invalid data
+-- Use const for rommable constants in inflate
+-- Eliminate memory leaks on error conditions in inflate
+-- Removed some vestigial code in inflate
+-- Update web address in README
+-
+-Changes in 1.0.4 (24 Jul 96)
+-- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+- bit, so the decompressor could decompress all the correct data but went
+- on to attempt decompressing extra garbage data. This affected minigzip too.
+-- zlibVersion and gzerror return const char* (needed for DLL)
+-- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+-- use z_error only for DEBUG (avoid problem with DLLs)
+-
+-Changes in 1.0.3 (2 Jul 96)
+-- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+- small and medium models; this makes the library incompatible with previous
+- versions for these models. (No effect in large model or on other systems.)
+-- return OK instead of BUF_ERROR if previous deflate call returned with
+- avail_out as zero but there is nothing to do
+-- added memcmp for non STDC compilers
+-- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+-- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+-- better check for 16-bit mode MSC (avoids problem with Symantec)
+-
+-Changes in 1.0.2 (23 May 96)
+-- added Windows DLL support
+-- added a function zlibVersion (for the DLL support)
+-- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
+-- Bytef is define's instead of typedef'd only for Borland C
+-- avoid reading uninitialized memory in example.c
+-- mention in README that the zlib format is now RFC1950
+-- updated Makefile.dj2
+-- added algorithm.doc
+-
+-Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
+-- fix array overlay in deflate.c which sometimes caused bad compressed data
+-- fix inflate bug with empty stored block
+-- fix MSDOS medium model which was broken in 0.99
+-- fix deflateParams() which could generated bad compressed data.
+-- Bytef is define'd instead of typedef'ed (work around Borland bug)
+-- added an INDEX file
+-- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
+- Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
+-- speed up adler32 for modern machines without auto-increment
+-- added -ansi for IRIX in configure
+-- static_init_done in trees.c is an int
+-- define unlink as delete for VMS
+-- fix configure for QNX
+-- add configure branch for SCO and HPUX
+-- avoid many warnings (unused variables, dead assignments, etc...)
+-- no fdopen for BeOS
+-- fix the Watcom fix for 32 bit mode (define FAR as empty)
+-- removed redefinition of Byte for MKWERKS
+-- work around an MWKERKS bug (incorrect merge of all .h files)
+-
+-Changes in 0.99 (27 Jan 96)
+-- allow preset dictionary shared between compressor and decompressor
+-- allow compression level 0 (no compression)
+-- add deflateParams in zlib.h: allow dynamic change of compression level
+- and compression strategy.
+-- test large buffers and deflateParams in example.c
+-- add optional "configure" to build zlib as a shared library
+-- suppress Makefile.qnx, use configure instead
+-- fixed deflate for 64-bit systems (detected on Cray)
+-- fixed inflate_blocks for 64-bit systems (detected on Alpha)
+-- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
+-- always return Z_BUF_ERROR when deflate() has nothing to do
+-- deflateInit and inflateInit are now macros to allow version checking
+-- prefix all global functions and types with z_ with -DZ_PREFIX
+-- make falloc completely reentrant (inftrees.c)
+-- fixed very unlikely race condition in ct_static_init
+-- free in reverse order of allocation to help memory manager
+-- use zlib-1.0/* instead of zlib/* inside the tar.gz
+-- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
+- -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
+-- allow gzread on concatenated .gz files
+-- deflateEnd now returns Z_DATA_ERROR if it was premature
+-- deflate is finally (?) fully deterministic (no matches beyond end of input)
+-- Document Z_SYNC_FLUSH
+-- add uninstall in Makefile
+-- Check for __cpluplus in zlib.h
+-- Better test in ct_align for partial flush
+-- avoid harmless warnings for Borland C++
+-- initialize hash_head in deflate.c
+-- avoid warning on fdopen (gzio.c) for HP cc -Aa
+-- include stdlib.h for STDC compilers
+-- include errno.h for Cray
+-- ignore error if ranlib doesn't exist
+-- call ranlib twice for NeXTSTEP
+-- use exec_prefix instead of prefix for libz.a
+-- renamed ct_* as _tr_* to avoid conflict with applications
+-- clear z->msg in inflateInit2 before any error return
+-- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
+-- fixed typo in zconf.h (_GNUC__ => __GNUC__)
+-- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
+-- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
+-- in fcalloc, normalize pointer if size > 65520 bytes
+-- don't use special fcalloc for 32 bit Borland C++
+-- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
+-- use Z_BINARY instead of BINARY
+-- document that gzclose after gzdopen will close the file
+-- allow "a" as mode in gzopen.
+-- fix error checking in gzread
+-- allow skipping .gz extra-field on pipes
+-- added reference to Perl interface in README
+-- put the crc table in FAR data (I dislike more and more the medium model :)
+-- added get_crc_table
+-- added a dimension to all arrays (Borland C can't count).
+-- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
+-- guard against multiple inclusion of *.h (for precompiled header on Mac)
+-- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
+-- don't use unsized arrays to avoid silly warnings by Visual C++:
+- warning C4746: 'inflate_mask' : unsized array treated as '__far'
+- (what's wrong with far data in far model?).
+-- define enum out of inflate_blocks_state to allow compilation with C++
+-
+-Changes in 0.95 (16 Aug 95)
+-- fix MSDOS small and medium model (now easier to adapt to any compiler)
+-- inlined send_bits
+-- fix the final (:-) bug for deflate with flush (output was correct but
+- not completely flushed in rare occasions).
+-- default window size is same for compression and decompression
+- (it's now sufficient to set MAX_WBITS in zconf.h).
+-- voidp -> voidpf and voidnp -> voidp (for consistency with other
+- typedefs and because voidnp was not near in large model).
+-
+-Changes in 0.94 (13 Aug 95)
+-- support MSDOS medium model
+-- fix deflate with flush (could sometimes generate bad output)
+-- fix deflateReset (zlib header was incorrectly suppressed)
+-- added support for VMS
+-- allow a compression level in gzopen()
+-- gzflush now calls fflush
+-- For deflate with flush, flush even if no more input is provided.
+-- rename libgz.a as libz.a
+-- avoid complex expression in infcodes.c triggering Turbo C bug
+-- work around a problem with gcc on Alpha (in INSERT_STRING)
+-- don't use inline functions (problem with some gcc versions)
+-- allow renaming of Byte, uInt, etc... with #define.
+-- avoid warning about (unused) pointer before start of array in deflate.c
+-- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
+-- avoid reserved word 'new' in trees.c
+-
+-Changes in 0.93 (25 June 95)
+-- temporarily disable inline functions
+-- make deflate deterministic
+-- give enough lookahead for PARTIAL_FLUSH
+-- Set binary mode for stdin/stdout in minigzip.c for OS/2
+-- don't even use signed char in inflate (not portable enough)
+-- fix inflate memory leak for segmented architectures
+-
+-Changes in 0.92 (3 May 95)
+-- don't assume that char is signed (problem on SGI)
+-- Clear bit buffer when starting a stored block
+-- no memcpy on Pyramid
+-- suppressed inftest.c
+-- optimized fill_window, put longest_match inline for gcc
+-- optimized inflate on stored blocks.
+-- untabify all sources to simplify patches
+-
+-Changes in 0.91 (2 May 95)
+-- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
+-- Document the memory requirements in zconf.h
+-- added "make install"
+-- fix sync search logic in inflateSync
+-- deflate(Z_FULL_FLUSH) now works even if output buffer too short
+-- after inflateSync, don't scare people with just "lo world"
+-- added support for DJGPP
+-
+-Changes in 0.9 (1 May 95)
+-- don't assume that zalloc clears the allocated memory (the TurboC bug
+- was Mark's bug after all :)
+-- let again gzread copy uncompressed data unchanged (was working in 0.71)
+-- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
+-- added a test of inflateSync in example.c
+-- moved MAX_WBITS to zconf.h because users might want to change that.
+-- document explicitly that zalloc(64K) on MSDOS must return a normalized
+- pointer (zero offset)
+-- added Makefiles for Microsoft C, Turbo C, Borland C++
+-- faster crc32()
+-
+-Changes in 0.8 (29 April 95)
+-- added fast inflate (inffast.c)
+-- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
+- is incompatible with previous versions of zlib which returned Z_OK.
+-- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
+- (actually that was not a compiler bug, see 0.81 above)
+-- gzread no longer reads one extra byte in certain cases
+-- In gzio destroy(), don't reference a freed structure
+-- avoid many warnings for MSDOS
+-- avoid the ERROR symbol which is used by MS Windows
+-
+-Changes in 0.71 (14 April 95)
+-- Fixed more MSDOS compilation problems :( There is still a bug with
+- TurboC large model.
+-
+-Changes in 0.7 (14 April 95)
+-- Added full inflate support.
+-- Simplified the crc32() interface. The pre- and post-conditioning
+- (one's complement) is now done inside crc32(). WARNING: this is
+- incompatible with previous versions; see zlib.h for the new usage.
+-
+-Changes in 0.61 (12 April 95)
+-- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
+-
+-Changes in 0.6 (11 April 95)
+-- added minigzip.c
+-- added gzdopen to reopen a file descriptor as gzFile
+-- added transparent reading of non-gziped files in gzread.
+-- fixed bug in gzread (don't read crc as data)
+-- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
+-- don't allocate big arrays in the stack (for MSDOS)
+-- fix some MSDOS compilation problems
+-
+-Changes in 0.5:
+-- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
+- not yet Z_FULL_FLUSH.
+-- support decompression but only in a single step (forced Z_FINISH)
+-- added opaque object for zalloc and zfree.
+-- added deflateReset and inflateReset
+-- added a variable zlib_version for consistency checking.
+-- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
+- Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
+-
+-Changes in 0.4:
+-- avoid "zip" everywhere, use zlib instead of ziplib.
+-- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
+- if compression method == 8.
+-- added adler32 and crc32
+-- renamed deflateOptions as deflateInit2, call one or the other but not both
+-- added the method parameter for deflateInit2.
+-- added inflateInit2
+-- simplied considerably deflateInit and inflateInit by not supporting
+- user-provided history buffer. This is supported only in deflateInit2
+- and inflateInit2.
+-
+-Changes in 0.3:
+-- prefix all macro names with Z_
+-- use Z_FINISH instead of deflateEnd to finish compression.
+-- added Z_HUFFMAN_ONLY
+-- added gzerror()
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/README Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,125 +0,0 @@
+-ZLIB DATA COMPRESSION LIBRARY
+-
+-zlib 1.2.3 is a general purpose data compression library. All the code is
+-thread safe. The data format used by the zlib library is described by RFCs
+-(Request for Comments) 1950 to 1952 in the files
+-http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
+-and rfc1952.txt (gzip format). These documents are also available in other
+-formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+-
+-All functions of the compression library are documented in the file zlib.h
+-(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
+-of the library is given in the file example.c which also tests that the library
+-is working correctly. Another example is given in the file minigzip.c. The
+-compression library itself is composed of all source files except example.c and
+-minigzip.c.
+-
+-To compile all files and run the test program, follow the instructions given at
+-the top of Makefile. In short "make test; make install" should work for most
+-machines. For Unix: "./configure; make test; make install". For MSDOS, use one
+-of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
+-
+-Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
+-<info@winimage.com> for the Windows DLL version. The zlib home page is
+-http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
+-please check this site to verify that you have the latest version of zlib;
+-otherwise get the latest version and check whether the problem still exists or
+-not.
+-
+-PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
+-for help.
+-
+-Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
+-issue of Dr. Dobb's Journal; a copy of the article is available in
+-http://dogma.net/markn/articles/zlibtool/zlibtool.htm
+-
+-The changes made in version 1.2.3 are documented in the file ChangeLog.
+-
+-Unsupported third party contributions are provided in directory "contrib".
+-
+-A Java implementation of zlib is available in the Java Development Kit
+-http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
+-See the zlib home page http://www.zlib.org for details.
+-
+-A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
+-CPAN (Comprehensive Perl Archive Network) sites
+-http://www.cpan.org/modules/by-module/Compress/
+-
+-A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
+-available in Python 1.5 and later versions, see
+-http://www.python.org/doc/lib/module-zlib.html
+-
+-A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
+-availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
+-
+-An experimental package to read and write files in .zip format, written on top
+-of zlib by Gilles Vollant <info@winimage.com>, is available in the
+-contrib/minizip directory of zlib.
+-
+-
+-Notes for some targets:
+-
+-- For Windows DLL versions, please see win32/DLL_FAQ.txt
+-
+-- For 64-bit Irix, deflate.c must be compiled without any optimization. With
+- -O, one libpng test fails. The test works in 32 bit mode (with the -n32
+- compiler flag). The compiler bug has been reported to SGI.
+-
+-- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
+- when compiled with cc.
+-
+-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
+- necessary to get gzprintf working correctly. This is done by configure.
+-
+-- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
+- other compilers. Use "make test" to check your compiler.
+-
+-- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+-
+-- For PalmOs, see http://palmzlib.sourceforge.net/
+-
+-- When building a shared, i.e. dynamic library on Mac OS X, the library must be
+- installed before testing (do "make install" before "make test"), since the
+- library location is specified in the library.
+-
+-
+-Acknowledgments:
+-
+- The deflate format used by zlib was defined by Phil Katz. The deflate
+- and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+- people who reported problems and suggested various improvements in zlib;
+- they are too numerous to cite here.
+-
+-Copyright notice:
+-
+- (C) 1995-2004 Jean-loup Gailly and Mark Adler
+-
+- This software is provided 'as-is', without any express or implied
+- warranty. In no event will the authors be held liable for any damages
+- arising from the use of this software.
+-
+- Permission is granted to anyone to use this software for any purpose,
+- including commercial applications, and to alter it and redistribute it
+- freely, subject to the following restrictions:
+-
+- 1. The origin of this software must not be misrepresented; you must not
+- claim that you wrote the original software. If you use this software
+- in a product, an acknowledgment in the product documentation would be
+- appreciated but is not required.
+- 2. Altered source versions must be plainly marked as such, and must not be
+- misrepresented as being the original software.
+- 3. This notice may not be removed or altered from any source distribution.
+-
+- Jean-loup Gailly Mark Adler
+- jloup@gzip.org madler@alumni.caltech.edu
+-
+-If you use the zlib library in a product, we would appreciate *not*
+-receiving lengthy legal documents to sign. The sources are provided
+-for free but without warranty of any kind. The library has been
+-entirely written by Jean-loup Gailly and Mark Adler; it does not
+-include third-party code.
+-
+-If you redistribute modified sources, we would appreciate that you include
+-in the file ChangeLog history information documenting your changes. Please
+-read the FAQ for more information on the distribution of modified source
+-versions.
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/compress.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,103 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* compress.c -- compress a memory buffer
+- * Copyright (C) 1995-2003 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* @(#) $Id$ */
+-
+-#define ZLIB_INTERNAL
+-#include "zlib.h"
+-
+-/* ===========================================================================
+- Compresses the source buffer into the destination buffer. The level
+- parameter has the same meaning as in deflateInit. sourceLen is the byte
+- length of the source buffer. Upon entry, destLen is the total size of the
+- destination buffer, which must be at least 0.1% larger than sourceLen plus
+- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+-
+- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+- Z_STREAM_ERROR if the level parameter is invalid.
+-*/
+-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
+- Bytef *dest;
+- uLongf *destLen;
+- const Bytef *source;
+- uLong sourceLen;
+- int level;
+-{
+- z_stream stream;
+- int err;
+-
+- stream.next_in = (Bytef*)source;
+- stream.avail_in = (uInt)sourceLen;
+-#ifdef MAXSEG_64K
+- /* Check for source > 64K on 16-bit machine: */
+- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+-#endif
+- stream.next_out = dest;
+- stream.avail_out = (uInt)*destLen;
+- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+-
+- stream.zalloc = (alloc_func)0;
+- stream.zfree = (free_func)0;
+- stream.opaque = (voidpf)0;
+-
+- err = deflateInit(&stream, level);
+- if (err != Z_OK) return err;
+-
+- err = deflate(&stream, Z_FINISH);
+- if (err != Z_STREAM_END) {
+- deflateEnd(&stream);
+- return err == Z_OK ? Z_BUF_ERROR : err;
+- }
+- *destLen = stream.total_out;
+-
+- err = deflateEnd(&stream);
+- return err;
+-}
+-
+-/* ===========================================================================
+- */
+-int ZEXPORT compress (dest, destLen, source, sourceLen)
+- Bytef *dest;
+- uLongf *destLen;
+- const Bytef *source;
+- uLong sourceLen;
+-{
+- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+-}
+-
+-/* ===========================================================================
+- If the default memLevel or windowBits for deflateInit() is changed, then
+- this function needs to be updated.
+- */
+-uLong ZEXPORT compressBound (sourceLen)
+- uLong sourceLen;
+-{
+- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/crc32.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,465 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* crc32.h -- tables for rapid CRC calculation
+- * Generated automatically by crc32.c
+- */
+-
+-local const unsigned long FAR crc_table[TBLS][256] =
+-{
+- {
+- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+- 0x2d02ef8dUL
+-#ifdef BYFOUR
+- },
+- {
+- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+- 0x9324fd72UL
+- },
+- {
+- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+- 0xbe9834edUL
+- },
+- {
+- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+- 0xde0506f1UL
+- },
+- {
+- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+- 0x8def022dUL
+- },
+- {
+- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+- 0x72fd2493UL
+- },
+- {
+- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+- 0xed3498beUL
+- },
+- {
+- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+- 0xf10605deUL
+-#endif
+- }
+-};
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1760 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* deflate.c -- compress data using the deflation algorithm
+- * Copyright (C) 1995-2005 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/*
+- * ALGORITHM
+- *
+- * The "deflation" process depends on being able to identify portions
+- * of the input text which are identical to earlier input (within a
+- * sliding window trailing behind the input currently being processed).
+- *
+- * The most straightforward technique turns out to be the fastest for
+- * most input files: try all possible matches and select the longest.
+- * The key feature of this algorithm is that insertions into the string
+- * dictionary are very simple and thus fast, and deletions are avoided
+- * completely. Insertions are performed at each input character, whereas
+- * string matches are performed only when the previous match ends. So it
+- * is preferable to spend more time in matches to allow very fast string
+- * insertions and avoid deletions. The matching algorithm for small
+- * strings is inspired from that of Rabin & Karp. A brute force approach
+- * is used to find longer strings when a small match has been found.
+- * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+- * (by Leonid Broukhis).
+- * A previous version of this file used a more sophisticated algorithm
+- * (by Fiala and Greene) which is guaranteed to run in linear amortized
+- * time, but has a larger average cost, uses more memory and is patented.
+- * However the F&G algorithm may be faster for some highly redundant
+- * files if the parameter max_chain_length (described below) is too large.
+- *
+- * ACKNOWLEDGEMENTS
+- *
+- * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+- * I found it in 'freeze' written by Leonid Broukhis.
+- * Thanks to many people for bug reports and testing.
+- *
+- * REFERENCES
+- *
+- * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+- * Available in http://www.ietf.org/rfc/rfc1951.txt
+- *
+- * A description of the Rabin and Karp algorithm is given in the book
+- * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+- *
+- * Fiala,E.R., and Greene,D.H.
+- * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+- *
+- */
+-
+-/* @(#) $Id$ */
+-
+-#include "deflate.h"
+-
+-const char deflate_copyright[] =
+- " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
+-/*
+- If you use the zlib library in a product, an acknowledgment is welcome
+- in the documentation of your product. If for some reason you cannot
+- include such an acknowledgment, I would appreciate that you keep this
+- copyright string in the executable of your product.
+- */
+-
+-/* ===========================================================================
+- * Function prototypes.
+- */
+-typedef enum {
+- need_more, /* block not completed, need more input or more output */
+- block_done, /* block flush performed */
+- finish_started, /* finish started, need only more output at next deflate */
+- finish_done /* finish done, accept no more input or output */
+-} block_state;
+-
+-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+-/* Compression function. Returns the block state after the call. */
+-
+-local void fill_window OF((deflate_state *s));
+-local block_state deflate_stored OF((deflate_state *s, int flush));
+-local block_state deflate_fast OF((deflate_state *s, int flush));
+-#ifndef FASTEST
+-local block_state deflate_slow OF((deflate_state *s, int flush));
+-#endif
+-local void lm_init OF((deflate_state *s));
+-local void putShortMSB OF((deflate_state *s, uInt b));
+-local void flush_pending OF((z_streamp strm));
+-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
+-#ifndef FASTEST
+-#ifdef ASMV
+- void match_init OF((void)); /* asm code initialization */
+- uInt longest_match OF((deflate_state *s, IPos cur_match));
+-#else
+-local uInt longest_match OF((deflate_state *s, IPos cur_match));
+-#endif
+-#endif
+-local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
+-
+-#ifdef DEBUG
+-local void check_match OF((deflate_state *s, IPos start, IPos match,
+- int length));
+-#endif
+-
+-/* ===========================================================================
+- * Local data
+- */
+-
+-#define NIL 0
+-/* Tail of hash chains */
+-
+-#ifndef TOO_FAR
+-# define TOO_FAR 4096
+-#endif
+-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+-
+-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+-/* Minimum amount of lookahead, except at the end of the input file.
+- * See deflate.c for comments about the MIN_MATCH+1.
+- */
+-
+-/* Values for max_lazy_match, good_match and max_chain_length, depending on
+- * the desired pack level (0..9). The values given below have been tuned to
+- * exclude worst case performance for pathological files. Better values may be
+- * found for specific files.
+- */
+-typedef struct config_s {
+- ush good_length; /* reduce lazy search above this match length */
+- ush max_lazy; /* do not perform lazy search above this match length */
+- ush nice_length; /* quit search above this match length */
+- ush max_chain;
+- compress_func func;
+-} config;
+-
+-#ifdef FASTEST
+-local const config configuration_table[2] = {
+-/* good lazy nice chain */
+-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
+-/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
+-#else
+-local const config configuration_table[10] = {
+-/* good lazy nice chain */
+-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
+-/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
+-/* 2 */ {4, 5, 16, 8, deflate_fast},
+-/* 3 */ {4, 6, 32, 32, deflate_fast},
+-
+-/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
+-/* 5 */ {8, 16, 32, 32, deflate_slow},
+-/* 6 */ {8, 16, 128, 128, deflate_slow},
+-/* 7 */ {8, 32, 128, 256, deflate_slow},
+-/* 8 */ {32, 128, 258, 1024, deflate_slow},
+-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
+-#endif
+-
+-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+- * meaning.
+- */
+-
+-#define EQUAL 0
+-/* result of memcmp for equal strings */
+-
+-#ifndef NO_DUMMY_DECL
+-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+-#endif
+-
+-/* ===========================================================================
+- * Update a hash value with the given input byte
+- * IN assertion: all calls to to UPDATE_HASH are made with consecutive
+- * input characters, so that a running hash key can be computed from the
+- * previous key instead of complete recalculation each time.
+- */
+-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+-
+-
+-/* ===========================================================================
+- * Insert string str in the dictionary and set match_head to the previous head
+- * of the hash chain (the most recent string with same hash key). Return
+- * the previous length of the hash chain.
+- * If this file is compiled with -DFASTEST, the compression level is forced
+- * to 1, and no hash chains are maintained.
+- * IN assertion: all calls to to INSERT_STRING are made with consecutive
+- * input characters and the first MIN_MATCH bytes of str are valid
+- * (except for the last MIN_MATCH-1 bytes of the input file).
+- */
+-#ifdef FASTEST
+-#define INSERT_STRING(s, str, match_head) \
+- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+- match_head = s->head[s->ins_h], \
+- s->head[s->ins_h] = (Pos)(str))
+-#else
+-#define INSERT_STRING(s, str, match_head) \
+- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
+- s->head[s->ins_h] = (Pos)(str))
+-#endif
+-
+-/* ===========================================================================
+- * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+- * prev[] will be initialized on the fly.
+- */
+-#define CLEAR_HASH(s) \
+- s->head[s->hash_size-1] = NIL; \
+- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateInit_(strm, level, version, stream_size)
+- z_streamp strm;
+- int level;
+- const char *version;
+- int stream_size;
+-{
+- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+- Z_DEFAULT_STRATEGY, version, stream_size);
+- /* To do: ignore strm->next_in if we use it as window */
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
+- version, stream_size)
+- z_streamp strm;
+- int level;
+- int method;
+- int windowBits;
+- int memLevel;
+- int strategy;
+- const char *version;
+- int stream_size;
+-{
+- deflate_state *s;
+- int wrap = 1;
+- static const char my_version[] = ZLIB_VERSION;
+-
+- ushf *overlay;
+- /* We overlay pending_buf and d_buf+l_buf. This works since the average
+- * output size for (length,distance) codes is <= 24 bits.
+- */
+-
+- if (version == Z_NULL || version[0] != my_version[0] ||
+- stream_size != sizeof(z_stream)) {
+- return Z_VERSION_ERROR;
+- }
+- if (strm == Z_NULL) return Z_STREAM_ERROR;
+-
+- strm->msg = Z_NULL;
+- if (strm->zalloc == (alloc_func)0) {
+- strm->zalloc = zcalloc;
+- strm->opaque = (voidpf)0;
+- }
+- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+-
+-#ifdef FASTEST
+- if (level != 0) level = 1;
+-#else
+- if (level == Z_DEFAULT_COMPRESSION) level = 6;
+-#endif
+-
+- if (windowBits < 0) { /* suppress zlib wrapper */
+- wrap = 0;
+- windowBits = -windowBits;
+- }
+-#ifdef GZIP
+- else if (windowBits > 15) {
+- wrap = 2; /* write gzip wrapper instead */
+- windowBits -= 16;
+- }
+-#endif
+- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+- strategy < 0 || strategy > Z_FIXED) {
+- return Z_STREAM_ERROR;
+- }
+- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
+- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+- if (s == Z_NULL) return Z_MEM_ERROR;
+- strm->state = (struct internal_state FAR *)s;
+- s->strm = strm;
+-
+- s->wrap = wrap;
+- s->gzhead = Z_NULL;
+- s->w_bits = windowBits;
+- s->w_size = 1 << s->w_bits;
+- s->w_mask = s->w_size - 1;
+-
+- s->hash_bits = memLevel + 7;
+- s->hash_size = 1 << s->hash_bits;
+- s->hash_mask = s->hash_size - 1;
+- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+-
+- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
+- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
+-
+- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+-
+- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+- s->pending_buf = (uchf *) overlay;
+- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+-
+- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+- s->pending_buf == Z_NULL) {
+- s->status = FINISH_STATE;
+- strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+- deflateEnd (strm);
+- return Z_MEM_ERROR;
+- }
+- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+-
+- s->level = level;
+- s->strategy = strategy;
+- s->method = (Byte)method;
+-
+- return deflateReset(strm);
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
+- z_streamp strm;
+- const Bytef *dictionary;
+- uInt dictLength;
+-{
+- deflate_state *s;
+- uInt length = dictLength;
+- uInt n;
+- IPos hash_head = 0;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+- strm->state->wrap == 2 ||
+- (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
+- return Z_STREAM_ERROR;
+-
+- s = strm->state;
+- if (s->wrap)
+- strm->adler = adler32(strm->adler, dictionary, dictLength);
+-
+- if (length < MIN_MATCH) return Z_OK;
+- if (length > MAX_DIST(s)) {
+- length = MAX_DIST(s);
+- dictionary += dictLength - length; /* use the tail of the dictionary */
+- }
+- zmemcpy(s->window, dictionary, length);
+- s->strstart = length;
+- s->block_start = (long)length;
+-
+- /* Insert all strings in the hash table (except for the last two bytes).
+- * s->lookahead stays null, so s->ins_h will be recomputed at the next
+- * call of fill_window.
+- */
+- s->ins_h = s->window[0];
+- UPDATE_HASH(s, s->ins_h, s->window[1]);
+- for (n = 0; n <= length - MIN_MATCH; n++) {
+- INSERT_STRING(s, n, hash_head);
+- }
+- if (hash_head) hash_head = 0; /* to make compiler happy */
+- return Z_OK;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateReset (strm)
+- z_streamp strm;
+-{
+- deflate_state *s;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL ||
+- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
+- return Z_STREAM_ERROR;
+- }
+-
+- strm->total_in = strm->total_out = 0;
+- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+- strm->data_type = Z_UNKNOWN;
+-
+- s = (deflate_state *)strm->state;
+- s->pending = 0;
+- s->pending_out = s->pending_buf;
+-
+- if (s->wrap < 0) {
+- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
+- }
+- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
+- strm->adler =
+-#ifdef GZIP
+- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
+-#endif
+- adler32(0L, Z_NULL, 0);
+- s->last_flush = Z_NO_FLUSH;
+-
+- _tr_init(s);
+- lm_init(s);
+-
+- return Z_OK;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateSetHeader (strm, head)
+- z_streamp strm;
+- gz_headerp head;
+-{
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
+- strm->state->gzhead = head;
+- return Z_OK;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflatePrime (strm, bits, value)
+- z_streamp strm;
+- int bits;
+- int value;
+-{
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- strm->state->bi_valid = bits;
+- strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
+- return Z_OK;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateParams(strm, level, strategy)
+- z_streamp strm;
+- int level;
+- int strategy;
+-{
+- deflate_state *s;
+- compress_func func;
+- int err = Z_OK;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- s = strm->state;
+-
+-#ifdef FASTEST
+- if (level != 0) level = 1;
+-#else
+- if (level == Z_DEFAULT_COMPRESSION) level = 6;
+-#endif
+- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
+- return Z_STREAM_ERROR;
+- }
+- func = configuration_table[s->level].func;
+-
+- if (func != configuration_table[level].func && strm->total_in != 0) {
+- /* Flush the last buffer: */
+- err = deflate(strm, Z_PARTIAL_FLUSH);
+- }
+- if (s->level != level) {
+- s->level = level;
+- s->max_lazy_match = configuration_table[level].max_lazy;
+- s->good_match = configuration_table[level].good_length;
+- s->nice_match = configuration_table[level].nice_length;
+- s->max_chain_length = configuration_table[level].max_chain;
+- }
+- s->strategy = strategy;
+- return err;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
+- z_streamp strm;
+- int good_length;
+- int max_lazy;
+- int nice_length;
+- int max_chain;
+-{
+- deflate_state *s;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- s = strm->state;
+- s->good_match = good_length;
+- s->max_lazy_match = max_lazy;
+- s->nice_match = nice_length;
+- s->max_chain_length = max_chain;
+- return Z_OK;
+-}
+-
+-/* =========================================================================
+- * For the default windowBits of 15 and memLevel of 8, this function returns
+- * a close to exact, as well as small, upper bound on the compressed size.
+- * They are coded as constants here for a reason--if the #define's are
+- * changed, then this function needs to be changed as well. The return
+- * value for 15 and 8 only works for those exact settings.
+- *
+- * For any setting other than those defaults for windowBits and memLevel,
+- * the value returned is a conservative worst case for the maximum expansion
+- * resulting from using fixed blocks instead of stored blocks, which deflate
+- * can emit on compressed data for some combinations of the parameters.
+- *
+- * This function could be more sophisticated to provide closer upper bounds
+- * for every combination of windowBits and memLevel, as well as wrap.
+- * But even the conservative upper bound of about 14% expansion does not
+- * seem onerous for output buffer allocation.
+- */
+-uLong ZEXPORT deflateBound(strm, sourceLen)
+- z_streamp strm;
+- uLong sourceLen;
+-{
+- deflate_state *s;
+- uLong destLen;
+-
+- /* conservative upper bound */
+- destLen = sourceLen +
+- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
+-
+- /* if can't get parameters, return conservative bound */
+- if (strm == Z_NULL || strm->state == Z_NULL)
+- return destLen;
+-
+- /* if not default parameters, return conservative bound */
+- s = strm->state;
+- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
+- return destLen;
+-
+- /* default settings: return tight bound for that case */
+- return compressBound(sourceLen);
+-}
+-
+-/* =========================================================================
+- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+- * IN assertion: the stream state is correct and there is enough room in
+- * pending_buf.
+- */
+-local void putShortMSB (s, b)
+- deflate_state *s;
+- uInt b;
+-{
+- put_byte(s, (Byte)(b >> 8));
+- put_byte(s, (Byte)(b & 0xff));
+-}
+-
+-/* =========================================================================
+- * Flush as much pending output as possible. All deflate() output goes
+- * through this function so some applications may wish to modify it
+- * to avoid allocating a large strm->next_out buffer and copying into it.
+- * (See also read_buf()).
+- */
+-local void flush_pending(strm)
+- z_streamp strm;
+-{
+- unsigned len = strm->state->pending;
+-
+- if (len > strm->avail_out) len = strm->avail_out;
+- if (len == 0) return;
+-
+- zmemcpy(strm->next_out, strm->state->pending_out, len);
+- strm->next_out += len;
+- strm->state->pending_out += len;
+- strm->total_out += len;
+- strm->avail_out -= len;
+- strm->state->pending -= len;
+- if (strm->state->pending == 0) {
+- strm->state->pending_out = strm->state->pending_buf;
+- }
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflate (strm, flush)
+- z_streamp strm;
+- int flush;
+-{
+- int old_flush; /* value of flush param for previous deflate call */
+- deflate_state *s;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL ||
+- flush > Z_FINISH || flush < 0) {
+- return Z_STREAM_ERROR;
+- }
+- s = strm->state;
+-
+- if (strm->next_out == Z_NULL ||
+- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+- (s->status == FINISH_STATE && flush != Z_FINISH)) {
+- ERR_RETURN(strm, Z_STREAM_ERROR);
+- }
+- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+-
+- s->strm = strm; /* just in case */
+- old_flush = s->last_flush;
+- s->last_flush = flush;
+-
+- /* Write the header */
+- if (s->status == INIT_STATE) {
+-#ifdef GZIP
+- if (s->wrap == 2) {
+- strm->adler = crc32(0L, Z_NULL, 0);
+- put_byte(s, 31);
+- put_byte(s, 139);
+- put_byte(s, 8);
+- if (s->gzhead == NULL) {
+- put_byte(s, 0);
+- put_byte(s, 0);
+- put_byte(s, 0);
+- put_byte(s, 0);
+- put_byte(s, 0);
+- put_byte(s, s->level == 9 ? 2 :
+- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+- 4 : 0));
+- put_byte(s, OS_CODE);
+- s->status = BUSY_STATE;
+- }
+- else {
+- put_byte(s, (s->gzhead->text ? 1 : 0) +
+- (s->gzhead->hcrc ? 2 : 0) +
+- (s->gzhead->extra == Z_NULL ? 0 : 4) +
+- (s->gzhead->name == Z_NULL ? 0 : 8) +
+- (s->gzhead->comment == Z_NULL ? 0 : 16)
+- );
+- put_byte(s, (Byte)(s->gzhead->time & 0xff));
+- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
+- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
+- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
+- put_byte(s, s->level == 9 ? 2 :
+- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
+- 4 : 0));
+- put_byte(s, s->gzhead->os & 0xff);
+- if (s->gzhead->extra != NULL) {
+- put_byte(s, s->gzhead->extra_len & 0xff);
+- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
+- }
+- if (s->gzhead->hcrc)
+- strm->adler = crc32(strm->adler, s->pending_buf,
+- s->pending);
+- s->gzindex = 0;
+- s->status = EXTRA_STATE;
+- }
+- }
+- else
+-#endif
+- {
+- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+- uInt level_flags;
+-
+- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
+- level_flags = 0;
+- else if (s->level < 6)
+- level_flags = 1;
+- else if (s->level == 6)
+- level_flags = 2;
+- else
+- level_flags = 3;
+- header |= (level_flags << 6);
+- if (s->strstart != 0) header |= PRESET_DICT;
+- header += 31 - (header % 31);
+-
+- s->status = BUSY_STATE;
+- putShortMSB(s, header);
+-
+- /* Save the adler32 of the preset dictionary: */
+- if (s->strstart != 0) {
+- putShortMSB(s, (uInt)(strm->adler >> 16));
+- putShortMSB(s, (uInt)(strm->adler & 0xffff));
+- }
+- strm->adler = adler32(0L, Z_NULL, 0);
+- }
+- }
+-#ifdef GZIP
+- if (s->status == EXTRA_STATE) {
+- if (s->gzhead->extra != NULL) {
+- uInt beg = s->pending; /* start of bytes to update crc */
+-
+- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
+- if (s->pending == s->pending_buf_size) {
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- flush_pending(strm);
+- beg = s->pending;
+- if (s->pending == s->pending_buf_size)
+- break;
+- }
+- put_byte(s, s->gzhead->extra[s->gzindex]);
+- s->gzindex++;
+- }
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- if (s->gzindex == s->gzhead->extra_len) {
+- s->gzindex = 0;
+- s->status = NAME_STATE;
+- }
+- }
+- else
+- s->status = NAME_STATE;
+- }
+- if (s->status == NAME_STATE) {
+- if (s->gzhead->name != NULL) {
+- uInt beg = s->pending; /* start of bytes to update crc */
+- int val;
+-
+- do {
+- if (s->pending == s->pending_buf_size) {
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- flush_pending(strm);
+- beg = s->pending;
+- if (s->pending == s->pending_buf_size) {
+- val = 1;
+- break;
+- }
+- }
+- val = s->gzhead->name[s->gzindex++];
+- put_byte(s, val);
+- } while (val != 0);
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- if (val == 0) {
+- s->gzindex = 0;
+- s->status = COMMENT_STATE;
+- }
+- }
+- else
+- s->status = COMMENT_STATE;
+- }
+- if (s->status == COMMENT_STATE) {
+- if (s->gzhead->comment != NULL) {
+- uInt beg = s->pending; /* start of bytes to update crc */
+- int val;
+-
+- do {
+- if (s->pending == s->pending_buf_size) {
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- flush_pending(strm);
+- beg = s->pending;
+- if (s->pending == s->pending_buf_size) {
+- val = 1;
+- break;
+- }
+- }
+- val = s->gzhead->comment[s->gzindex++];
+- put_byte(s, val);
+- } while (val != 0);
+- if (s->gzhead->hcrc && s->pending > beg)
+- strm->adler = crc32(strm->adler, s->pending_buf + beg,
+- s->pending - beg);
+- if (val == 0)
+- s->status = HCRC_STATE;
+- }
+- else
+- s->status = HCRC_STATE;
+- }
+- if (s->status == HCRC_STATE) {
+- if (s->gzhead->hcrc) {
+- if (s->pending + 2 > s->pending_buf_size)
+- flush_pending(strm);
+- if (s->pending + 2 <= s->pending_buf_size) {
+- put_byte(s, (Byte)(strm->adler & 0xff));
+- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+- strm->adler = crc32(0L, Z_NULL, 0);
+- s->status = BUSY_STATE;
+- }
+- }
+- else
+- s->status = BUSY_STATE;
+- }
+-#endif
+-
+- /* Flush as much pending output as possible */
+- if (s->pending != 0) {
+- flush_pending(strm);
+- if (strm->avail_out == 0) {
+- /* Since avail_out is 0, deflate will be called again with
+- * more output space, but possibly with both pending and
+- * avail_in equal to zero. There won't be anything to do,
+- * but this is not an error situation so make sure we
+- * return OK instead of BUF_ERROR at next call of deflate:
+- */
+- s->last_flush = -1;
+- return Z_OK;
+- }
+-
+- /* Make sure there is something to do and avoid duplicate consecutive
+- * flushes. For repeated and useless calls with Z_FINISH, we keep
+- * returning Z_STREAM_END instead of Z_BUF_ERROR.
+- */
+- } else if (strm->avail_in == 0 && flush <= old_flush &&
+- flush != Z_FINISH) {
+- ERR_RETURN(strm, Z_BUF_ERROR);
+- }
+-
+- /* User must not provide more input after the first FINISH: */
+- if (s->status == FINISH_STATE && strm->avail_in != 0) {
+- ERR_RETURN(strm, Z_BUF_ERROR);
+- }
+-
+- /* Start a new block or continue the current one.
+- */
+- if (strm->avail_in != 0 || s->lookahead != 0 ||
+- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+- block_state bstate;
+-
+- bstate = (*(configuration_table[s->level].func))(s, flush);
+-
+- if (bstate == finish_started || bstate == finish_done) {
+- s->status = FINISH_STATE;
+- }
+- if (bstate == need_more || bstate == finish_started) {
+- if (strm->avail_out == 0) {
+- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+- }
+- return Z_OK;
+- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+- * of deflate should use the same flush parameter to make sure
+- * that the flush is complete. So we don't have to output an
+- * empty block here, this will be done at next call. This also
+- * ensures that for a very small output buffer, we emit at most
+- * one empty block.
+- */
+- }
+- if (bstate == block_done) {
+- if (flush == Z_PARTIAL_FLUSH) {
+- _tr_align(s);
+- } else { /* FULL_FLUSH or SYNC_FLUSH */
+- _tr_stored_block(s, (char*)0, 0L, 0);
+- /* For a full flush, this empty block will be recognized
+- * as a special marker by inflate_sync().
+- */
+- if (flush == Z_FULL_FLUSH) {
+- CLEAR_HASH(s); /* forget history */
+- }
+- }
+- flush_pending(strm);
+- if (strm->avail_out == 0) {
+- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+- return Z_OK;
+- }
+- }
+- }
+- Assert(strm->avail_out > 0, "bug2");
+-
+- if (flush != Z_FINISH) return Z_OK;
+- if (s->wrap <= 0) return Z_STREAM_END;
+-
+- /* Write the trailer */
+-#ifdef GZIP
+- if (s->wrap == 2) {
+- put_byte(s, (Byte)(strm->adler & 0xff));
+- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
+- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
+- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
+- put_byte(s, (Byte)(strm->total_in & 0xff));
+- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
+- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
+- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
+- }
+- else
+-#endif
+- {
+- putShortMSB(s, (uInt)(strm->adler >> 16));
+- putShortMSB(s, (uInt)(strm->adler & 0xffff));
+- }
+- flush_pending(strm);
+- /* If avail_out is zero, the application will call deflate again
+- * to flush the rest.
+- */
+- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
+- return s->pending != 0 ? Z_OK : Z_STREAM_END;
+-}
+-
+-/* ========================================================================= */
+-int ZEXPORT deflateEnd (strm)
+- z_streamp strm;
+-{
+- int status;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+-
+- status = strm->state->status;
+- if (status != INIT_STATE &&
+- status != EXTRA_STATE &&
+- status != NAME_STATE &&
+- status != COMMENT_STATE &&
+- status != HCRC_STATE &&
+- status != BUSY_STATE &&
+- status != FINISH_STATE) {
+- return Z_STREAM_ERROR;
+- }
+-
+- /* Deallocate in reverse order of allocations: */
+- TRY_FREE(strm, strm->state->pending_buf);
+- TRY_FREE(strm, strm->state->head);
+- TRY_FREE(strm, strm->state->prev);
+- TRY_FREE(strm, strm->state->window);
+-
+- ZFREE(strm, strm->state);
+- strm->state = Z_NULL;
+-
+- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+-}
+-
+-/* =========================================================================
+- * Copy the source state to the destination state.
+- * To simplify the source, this is not supported for 16-bit MSDOS (which
+- * doesn't have enough memory anyway to duplicate compression states).
+- */
+-int ZEXPORT deflateCopy (dest, source)
+- z_streamp dest;
+- z_streamp source;
+-{
+-#ifdef MAXSEG_64K
+- return Z_STREAM_ERROR;
+-#else
+- deflate_state *ds;
+- deflate_state *ss;
+- ushf *overlay;
+-
+-
+- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+- return Z_STREAM_ERROR;
+- }
+-
+- ss = source->state;
+-
+- zmemcpy(dest, source, sizeof(z_stream));
+-
+- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+- if (ds == Z_NULL) return Z_MEM_ERROR;
+- dest->state = (struct internal_state FAR *) ds;
+- zmemcpy(ds, ss, sizeof(deflate_state));
+- ds->strm = dest;
+-
+- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
+- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
+- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+- ds->pending_buf = (uchf *) overlay;
+-
+- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+- ds->pending_buf == Z_NULL) {
+- deflateEnd (dest);
+- return Z_MEM_ERROR;
+- }
+- /* following zmemcpy do not work for 16-bit MSDOS */
+- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+- zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+- zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+-
+- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+-
+- ds->l_desc.dyn_tree = ds->dyn_ltree;
+- ds->d_desc.dyn_tree = ds->dyn_dtree;
+- ds->bl_desc.dyn_tree = ds->bl_tree;
+-
+- return Z_OK;
+-#endif /* MAXSEG_64K */
+-}
+-
+-/* ===========================================================================
+- * Read a new buffer from the current input stream, update the adler32
+- * and total number of bytes read. All deflate() input goes through
+- * this function so some applications may wish to modify it to avoid
+- * allocating a large strm->next_in buffer and copying from it.
+- * (See also flush_pending()).
+- */
+-local int read_buf(strm, buf, size)
+- z_streamp strm;
+- Bytef *buf;
+- unsigned size;
+-{
+- unsigned len = strm->avail_in;
+-
+- if (len > size) len = size;
+- if (len == 0) return 0;
+-
+- strm->avail_in -= len;
+-
+- if (strm->state->wrap == 1) {
+- strm->adler = adler32(strm->adler, strm->next_in, len);
+- }
+-#ifdef GZIP
+- else if (strm->state->wrap == 2) {
+- strm->adler = crc32(strm->adler, strm->next_in, len);
+- }
+-#endif
+- zmemcpy(buf, strm->next_in, len);
+- strm->next_in += len;
+- strm->total_in += len;
+-
+- return (int)len;
+-}
+-
+-/* ===========================================================================
+- * Initialize the "longest match" routines for a new zlib stream
+- */
+-local void lm_init (s)
+- deflate_state *s;
+-{
+- s->window_size = (ulg)2L*s->w_size;
+-
+- CLEAR_HASH(s);
+-
+- /* Set the default configuration parameters:
+- */
+- s->max_lazy_match = configuration_table[s->level].max_lazy;
+- s->good_match = configuration_table[s->level].good_length;
+- s->nice_match = configuration_table[s->level].nice_length;
+- s->max_chain_length = configuration_table[s->level].max_chain;
+-
+- s->strstart = 0;
+- s->block_start = 0L;
+- s->lookahead = 0;
+- s->match_length = s->prev_length = MIN_MATCH-1;
+- s->match_available = 0;
+- s->ins_h = 0;
+-#ifndef FASTEST
+-#ifdef ASMV
+- match_init(); /* initialize the asm code */
+-#endif
+-#endif
+-}
+-
+-#ifndef FASTEST
+-/* ===========================================================================
+- * Set match_start to the longest match starting at the given string and
+- * return its length. Matches shorter or equal to prev_length are discarded,
+- * in which case the result is equal to prev_length and match_start is
+- * garbage.
+- * IN assertions: cur_match is the head of the hash chain for the current
+- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+- * OUT assertion: the match length is not greater than s->lookahead.
+- */
+-#ifndef ASMV
+-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+- * match.S. The code will be functionally equivalent.
+- */
+-local uInt longest_match(s, cur_match)
+- deflate_state *s;
+- IPos cur_match; /* current match */
+-{
+- unsigned chain_length = s->max_chain_length;/* max hash chain length */
+- register Bytef *scan = s->window + s->strstart; /* current string */
+- register Bytef *match; /* matched string */
+- register int len; /* length of current match */
+- int best_len = s->prev_length; /* best match length so far */
+- int nice_match = s->nice_match; /* stop if match long enough */
+- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+- s->strstart - (IPos)MAX_DIST(s) : NIL;
+- /* Stop when cur_match becomes <= limit. To simplify the code,
+- * we prevent matches with the string of window index 0.
+- */
+- Posf *prev = s->prev;
+- uInt wmask = s->w_mask;
+-
+-#ifdef UNALIGNED_OK
+- /* Compare two bytes at a time. Note: this is not always beneficial.
+- * Try with and without -DUNALIGNED_OK to check.
+- */
+- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+- register ush scan_start = *(ushf*)scan;
+- register ush scan_end = *(ushf*)(scan+best_len-1);
+-#else
+- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+- register Byte scan_end1 = scan[best_len-1];
+- register Byte scan_end = scan[best_len];
+-#endif
+-
+- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+- * It is easy to get rid of this optimization if necessary.
+- */
+- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+-
+- /* Do not waste too much time if we already have a good match: */
+- if (s->prev_length >= s->good_match) {
+- chain_length >>= 2;
+- }
+- /* Do not look for matches beyond the end of the input. This is necessary
+- * to make deflate deterministic.
+- */
+- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+-
+- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+-
+- do {
+- Assert(cur_match < s->strstart, "no future");
+- match = s->window + cur_match;
+-
+- /* Skip to next match if the match length cannot increase
+- * or if the match length is less than 2. Note that the checks below
+- * for insufficient lookahead only occur occasionally for performance
+- * reasons. Therefore uninitialized memory will be accessed, and
+- * conditional jumps will be made that depend on those values.
+- * However the length of the match is limited to the lookahead, so
+- * the output of deflate is not affected by the uninitialized values.
+- */
+-#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+- /* This code assumes sizeof(unsigned short) == 2. Do not use
+- * UNALIGNED_OK if your compiler uses a different size.
+- */
+- if (*(ushf*)(match+best_len-1) != scan_end ||
+- *(ushf*)match != scan_start) continue;
+-
+- /* It is not necessary to compare scan[2] and match[2] since they are
+- * always equal when the other bytes match, given that the hash keys
+- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+- * strstart+3, +5, ... up to strstart+257. We check for insufficient
+- * lookahead only every 4th comparison; the 128th check will be made
+- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+- * necessary to put more guard bytes at the end of the window, or
+- * to check more often for insufficient lookahead.
+- */
+- Assert(scan[2] == match[2], "scan[2]?");
+- scan++, match++;
+- do {
+- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+- scan < strend);
+- /* The funny "do {}" generates better code on most compilers */
+-
+- /* Here, scan <= window+strstart+257 */
+- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+- if (*scan == *match) scan++;
+-
+- len = (MAX_MATCH - 1) - (int)(strend-scan);
+- scan = strend - (MAX_MATCH-1);
+-
+-#else /* UNALIGNED_OK */
+-
+- if (match[best_len] != scan_end ||
+- match[best_len-1] != scan_end1 ||
+- *match != *scan ||
+- *++match != scan[1]) continue;
+-
+- /* The check at best_len-1 can be removed because it will be made
+- * again later. (This heuristic is not always a win.)
+- * It is not necessary to compare scan[2] and match[2] since they
+- * are always equal when the other bytes match, given that
+- * the hash keys are equal and that HASH_BITS >= 8.
+- */
+- scan += 2, match++;
+- Assert(*scan == *match, "match[2]?");
+-
+- /* We check for insufficient lookahead only every 8th comparison;
+- * the 256th check will be made at strstart+258.
+- */
+- do {
+- } while (*++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- scan < strend);
+-
+- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+-
+- len = MAX_MATCH - (int)(strend - scan);
+- scan = strend - MAX_MATCH;
+-
+-#endif /* UNALIGNED_OK */
+-
+- if (len > best_len) {
+- s->match_start = cur_match;
+- best_len = len;
+- if (len >= nice_match) break;
+-#ifdef UNALIGNED_OK
+- scan_end = *(ushf*)(scan+best_len-1);
+-#else
+- scan_end1 = scan[best_len-1];
+- scan_end = scan[best_len];
+-#endif
+- }
+- } while ((cur_match = prev[cur_match & wmask]) > limit
+- && --chain_length != 0);
+-
+- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+- return s->lookahead;
+-}
+-#endif /* ASMV */
+-#endif /* FASTEST */
+-
+-/* ---------------------------------------------------------------------------
+- * Optimized version for level == 1 or strategy == Z_RLE only
+- */
+-local uInt longest_match_fast(s, cur_match)
+- deflate_state *s;
+- IPos cur_match; /* current match */
+-{
+- register Bytef *scan = s->window + s->strstart; /* current string */
+- register Bytef *match; /* matched string */
+- register int len; /* length of current match */
+- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+-
+- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+- * It is easy to get rid of this optimization if necessary.
+- */
+- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+-
+- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+-
+- Assert(cur_match < s->strstart, "no future");
+-
+- match = s->window + cur_match;
+-
+- /* Return failure if the match length is less than 2:
+- */
+- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+-
+- /* The check at best_len-1 can be removed because it will be made
+- * again later. (This heuristic is not always a win.)
+- * It is not necessary to compare scan[2] and match[2] since they
+- * are always equal when the other bytes match, given that
+- * the hash keys are equal and that HASH_BITS >= 8.
+- */
+- scan += 2, match += 2;
+- Assert(*scan == *match, "match[2]?");
+-
+- /* We check for insufficient lookahead only every 8th comparison;
+- * the 256th check will be made at strstart+258.
+- */
+- do {
+- } while (*++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- *++scan == *++match && *++scan == *++match &&
+- scan < strend);
+-
+- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+-
+- len = MAX_MATCH - (int)(strend - scan);
+-
+- if (len < MIN_MATCH) return MIN_MATCH - 1;
+-
+- s->match_start = cur_match;
+- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
+-}
+-
+-#ifdef DEBUG
+-/* ===========================================================================
+- * Check that the match at match_start is indeed a match.
+- */
+-local void check_match(s, start, match, length)
+- deflate_state *s;
+- IPos start, match;
+- int length;
+-{
+- /* check that the match is indeed a match */
+- if (zmemcmp(s->window + match,
+- s->window + start, length) != EQUAL) {
+- fprintf(stderr, " start %u, match %u, length %d\n",
+- start, match, length);
+- do {
+- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
+- } while (--length != 0);
+- z_error("invalid match");
+- }
+- if (z_verbose > 1) {
+- fprintf(stderr,"\\[%d,%d]", start-match, length);
+- do { putc(s->window[start++], stderr); } while (--length != 0);
+- }
+-}
+-#else
+-# define check_match(s, start, match, length)
+-#endif /* DEBUG */
+-
+-/* ===========================================================================
+- * Fill the window when the lookahead becomes insufficient.
+- * Updates strstart and lookahead.
+- *
+- * IN assertion: lookahead < MIN_LOOKAHEAD
+- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+- * At least one byte has been read, or avail_in == 0; reads are
+- * performed for at least two bytes (required for the zip translate_eol
+- * option -- not supported here).
+- */
+-local void fill_window(s)
+- deflate_state *s;
+-{
+- register unsigned n, m;
+- register Posf *p;
+- unsigned more; /* Amount of free space at the end of the window. */
+- uInt wsize = s->w_size;
+-
+- do {
+- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+-
+- /* Deal with !@#$% 64K limit: */
+- if (sizeof(int) <= 2) {
+- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+- more = wsize;
+-
+- } else if (more == (unsigned)(-1)) {
+- /* Very unlikely, but possible on 16 bit machine if
+- * strstart == 0 && lookahead == 1 (input done a byte at time)
+- */
+- more--;
+- }
+- }
+-
+- /* If the window is almost full and there is insufficient lookahead,
+- * move the upper half to the lower one to make room in the upper half.
+- */
+- if (s->strstart >= wsize+MAX_DIST(s)) {
+-
+- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+- s->match_start -= wsize;
+- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+- s->block_start -= (long) wsize;
+-
+- /* Slide the hash table (could be avoided with 32 bit values
+- at the expense of memory usage). We slide even when level == 0
+- to keep the hash table consistent if we switch back to level > 0
+- later. (Using level 0 permanently is not an optimal usage of
+- zlib, so we don't care about this pathological case.)
+- */
+- /* %%% avoid this when Z_RLE */
+- n = s->hash_size;
+- p = &s->head[n];
+- do {
+- m = *--p;
+- *p = (Pos)(m >= wsize ? m-wsize : NIL);
+- } while (--n);
+-
+- n = wsize;
+-#ifndef FASTEST
+- p = &s->prev[n];
+- do {
+- m = *--p;
+- *p = (Pos)(m >= wsize ? m-wsize : NIL);
+- /* If n is not on any hash chain, prev[n] is garbage but
+- * its value will never be used.
+- */
+- } while (--n);
+-#endif
+- more += wsize;
+- }
+- if (s->strm->avail_in == 0) return;
+-
+- /* If there was no sliding:
+- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+- * more == window_size - lookahead - strstart
+- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+- * => more >= window_size - 2*WSIZE + 2
+- * In the BIG_MEM or MMAP case (not yet supported),
+- * window_size == input_size + MIN_LOOKAHEAD &&
+- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+- * Otherwise, window_size == 2*WSIZE so more >= 2.
+- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+- */
+- Assert(more >= 2, "more < 2");
+-
+- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+- s->lookahead += n;
+-
+- /* Initialize the hash value now that we have some input: */
+- if (s->lookahead >= MIN_MATCH) {
+- s->ins_h = s->window[s->strstart];
+- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+-#if MIN_MATCH != 3
+- Call UPDATE_HASH() MIN_MATCH-3 more times
+-#endif
+- }
+- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+- * but this is not important since only literal bytes will be emitted.
+- */
+-
+- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+-}
+-
+-/* ===========================================================================
+- * Flush the current block, with given end-of-file flag.
+- * IN assertion: strstart is set to the end of the current match.
+- */
+-#define FLUSH_BLOCK_ONLY(s, eof) { \
+- _tr_flush_block(s, (s->block_start >= 0L ? \
+- (charf *)&s->window[(unsigned)s->block_start] : \
+- (charf *)Z_NULL), \
+- (ulg)((long)s->strstart - s->block_start), \
+- (eof)); \
+- s->block_start = s->strstart; \
+- flush_pending(s->strm); \
+- Tracev((stderr,"[FLUSH]")); \
+-}
+-
+-/* Same but force premature exit if necessary. */
+-#define FLUSH_BLOCK(s, eof) { \
+- FLUSH_BLOCK_ONLY(s, eof); \
+- if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+-}
+-
+-/* ===========================================================================
+- * Copy without compression as much as possible from the input stream, return
+- * the current block state.
+- * This function does not insert new strings in the dictionary since
+- * uncompressible data is probably not useful. This function is used
+- * only for the level=0 compression option.
+- * NOTE: this function should be optimized to avoid extra copying from
+- * window to pending_buf.
+- */
+-local block_state deflate_stored(s, flush)
+- deflate_state *s;
+- int flush;
+-{
+- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+- * to pending_buf_size, and each stored block has a 5 byte header:
+- */
+- ulg max_block_size = 0xffff;
+- ulg max_start;
+-
+- if (max_block_size > s->pending_buf_size - 5) {
+- max_block_size = s->pending_buf_size - 5;
+- }
+-
+- /* Copy as much as possible from input to output: */
+- for (;;) {
+- /* Fill the window as much as possible: */
+- if (s->lookahead <= 1) {
+-
+- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+- s->block_start >= (long)s->w_size, "slide too late");
+-
+- fill_window(s);
+- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+-
+- if (s->lookahead == 0) break; /* flush the current block */
+- }
+- Assert(s->block_start >= 0L, "block gone");
+-
+- s->strstart += s->lookahead;
+- s->lookahead = 0;
+-
+- /* Emit a stored block if pending_buf will be full: */
+- max_start = s->block_start + max_block_size;
+- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+- /* strstart == 0 is possible when wraparound on 16-bit machine */
+- s->lookahead = (uInt)(s->strstart - max_start);
+- s->strstart = (uInt)max_start;
+- FLUSH_BLOCK(s, 0);
+- }
+- /* Flush if we may have to slide, otherwise block_start may become
+- * negative and the data will be gone:
+- */
+- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+- FLUSH_BLOCK(s, 0);
+- }
+- }
+- FLUSH_BLOCK(s, flush == Z_FINISH);
+- return flush == Z_FINISH ? finish_done : block_done;
+-}
+-
+-/* ===========================================================================
+- * Compress as much as possible from the input stream, return the current
+- * block state.
+- * This function does not perform lazy evaluation of matches and inserts
+- * new strings in the dictionary only for unmatched strings or for short
+- * matches. It is used only for the fast compression options.
+- */
+-local block_state deflate_fast(s, flush)
+- deflate_state *s;
+- int flush;
+-{
+- IPos hash_head = NIL; /* head of the hash chain */
+- int bflush; /* set if current block must be flushed */
+-
+- for (;;) {
+- /* Make sure that we always have enough lookahead, except
+- * at the end of the input file. We need MAX_MATCH bytes
+- * for the next match, plus MIN_MATCH bytes to insert the
+- * string following the next match.
+- */
+- if (s->lookahead < MIN_LOOKAHEAD) {
+- fill_window(s);
+- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+- return need_more;
+- }
+- if (s->lookahead == 0) break; /* flush the current block */
+- }
+-
+- /* Insert the string window[strstart .. strstart+2] in the
+- * dictionary, and set hash_head to the head of the hash chain:
+- */
+- if (s->lookahead >= MIN_MATCH) {
+- INSERT_STRING(s, s->strstart, hash_head);
+- }
+-
+- /* Find the longest match, discarding those <= prev_length.
+- * At this point we have always match_length < MIN_MATCH
+- */
+- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+- /* To simplify the code, we prevent matches with the string
+- * of window index 0 (in particular we have to avoid a match
+- * of the string with itself at the start of the input file).
+- */
+-#ifdef FASTEST
+- if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
+- (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
+- s->match_length = longest_match_fast (s, hash_head);
+- }
+-#else
+- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
+- s->match_length = longest_match (s, hash_head);
+- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+- s->match_length = longest_match_fast (s, hash_head);
+- }
+-#endif
+- /* longest_match() or longest_match_fast() sets match_start */
+- }
+- if (s->match_length >= MIN_MATCH) {
+- check_match(s, s->strstart, s->match_start, s->match_length);
+-
+- _tr_tally_dist(s, s->strstart - s->match_start,
+- s->match_length - MIN_MATCH, bflush);
+-
+- s->lookahead -= s->match_length;
+-
+- /* Insert new strings in the hash table only if the match length
+- * is not too large. This saves time but degrades compression.
+- */
+-#ifndef FASTEST
+- if (s->match_length <= s->max_insert_length &&
+- s->lookahead >= MIN_MATCH) {
+- s->match_length--; /* string at strstart already in table */
+- do {
+- s->strstart++;
+- INSERT_STRING(s, s->strstart, hash_head);
+- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+- * always MIN_MATCH bytes ahead.
+- */
+- } while (--s->match_length != 0);
+- s->strstart++;
+- } else
+-#endif
+- {
+- s->strstart += s->match_length;
+- s->match_length = 0;
+- s->ins_h = s->window[s->strstart];
+- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+-#if MIN_MATCH != 3
+- Call UPDATE_HASH() MIN_MATCH-3 more times
+-#endif
+- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+- * matter since it will be recomputed at next deflate call.
+- */
+- }
+- } else {
+- /* No match, output a literal byte */
+- Tracevv((stderr,"%c", s->window[s->strstart]));
+- _tr_tally_lit (s, s->window[s->strstart], bflush);
+- s->lookahead--;
+- s->strstart++;
+- }
+- if (bflush) FLUSH_BLOCK(s, 0);
+- }
+- FLUSH_BLOCK(s, flush == Z_FINISH);
+- return flush == Z_FINISH ? finish_done : block_done;
+-}
+-
+-#ifndef FASTEST
+-/* ===========================================================================
+- * Same as above, but achieves better compression. We use a lazy
+- * evaluation for matches: a match is finally adopted only if there is
+- * no better match at the next window position.
+- */
+-local block_state deflate_slow(s, flush)
+- deflate_state *s;
+- int flush;
+-{
+- IPos hash_head = NIL; /* head of hash chain */
+- int bflush; /* set if current block must be flushed */
+-
+- /* Process the input block. */
+- for (;;) {
+- /* Make sure that we always have enough lookahead, except
+- * at the end of the input file. We need MAX_MATCH bytes
+- * for the next match, plus MIN_MATCH bytes to insert the
+- * string following the next match.
+- */
+- if (s->lookahead < MIN_LOOKAHEAD) {
+- fill_window(s);
+- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+- return need_more;
+- }
+- if (s->lookahead == 0) break; /* flush the current block */
+- }
+-
+- /* Insert the string window[strstart .. strstart+2] in the
+- * dictionary, and set hash_head to the head of the hash chain:
+- */
+- if (s->lookahead >= MIN_MATCH) {
+- INSERT_STRING(s, s->strstart, hash_head);
+- }
+-
+- /* Find the longest match, discarding those <= prev_length.
+- */
+- s->prev_length = s->match_length, s->prev_match = s->match_start;
+- s->match_length = MIN_MATCH-1;
+-
+- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+- s->strstart - hash_head <= MAX_DIST(s)) {
+- /* To simplify the code, we prevent matches with the string
+- * of window index 0 (in particular we have to avoid a match
+- * of the string with itself at the start of the input file).
+- */
+- if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
+- s->match_length = longest_match (s, hash_head);
+- } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
+- s->match_length = longest_match_fast (s, hash_head);
+- }
+- /* longest_match() or longest_match_fast() sets match_start */
+-
+- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
+-#if TOO_FAR <= 32767
+- || (s->match_length == MIN_MATCH &&
+- s->strstart - s->match_start > TOO_FAR)
+-#endif
+- )) {
+-
+- /* If prev_match is also MIN_MATCH, match_start is garbage
+- * but we will ignore the current match anyway.
+- */
+- s->match_length = MIN_MATCH-1;
+- }
+- }
+- /* If there was a match at the previous step and the current
+- * match is not better, output the previous match:
+- */
+- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+- /* Do not insert strings in hash table beyond this. */
+-
+- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+-
+- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+- s->prev_length - MIN_MATCH, bflush);
+-
+- /* Insert in hash table all strings up to the end of the match.
+- * strstart-1 and strstart are already inserted. If there is not
+- * enough lookahead, the last two strings are not inserted in
+- * the hash table.
+- */
+- s->lookahead -= s->prev_length-1;
+- s->prev_length -= 2;
+- do {
+- if (++s->strstart <= max_insert) {
+- INSERT_STRING(s, s->strstart, hash_head);
+- }
+- } while (--s->prev_length != 0);
+- s->match_available = 0;
+- s->match_length = MIN_MATCH-1;
+- s->strstart++;
+-
+- if (bflush) FLUSH_BLOCK(s, 0);
+-
+- } else if (s->match_available) {
+- /* If there was no match at the previous position, output a
+- * single literal. If there was a match but the current match
+- * is longer, truncate the previous match to a single literal.
+- */
+- Tracevv((stderr,"%c", s->window[s->strstart-1]));
+- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+- if (bflush) {
+- FLUSH_BLOCK_ONLY(s, 0);
+- }
+- s->strstart++;
+- s->lookahead--;
+- if (s->strm->avail_out == 0) return need_more;
+- } else {
+- /* There is no previous match to compare with, wait for
+- * the next step to decide.
+- */
+- s->match_available = 1;
+- s->strstart++;
+- s->lookahead--;
+- }
+- }
+- Assert (flush != Z_NO_FLUSH, "no flush?");
+- if (s->match_available) {
+- Tracevv((stderr,"%c", s->window[s->strstart-1]));
+- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+- s->match_available = 0;
+- }
+- FLUSH_BLOCK(s, flush == Z_FINISH);
+- return flush == Z_FINISH ? finish_done : block_done;
+-}
+-#endif /* FASTEST */
+-
+-#if 0
+-/* ===========================================================================
+- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
+- * one. Do not maintain a hash table. (It will be regenerated if this run of
+- * deflate switches away from Z_RLE.)
+- */
+-local block_state deflate_rle(s, flush)
+- deflate_state *s;
+- int flush;
+-{
+- int bflush; /* set if current block must be flushed */
+- uInt run; /* length of run */
+- uInt max; /* maximum length of run */
+- uInt prev; /* byte at distance one to match */
+- Bytef *scan; /* scan for end of run */
+-
+- for (;;) {
+- /* Make sure that we always have enough lookahead, except
+- * at the end of the input file. We need MAX_MATCH bytes
+- * for the longest encodable run.
+- */
+- if (s->lookahead < MAX_MATCH) {
+- fill_window(s);
+- if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
+- return need_more;
+- }
+- if (s->lookahead == 0) break; /* flush the current block */
+- }
+-
+- /* See how many times the previous byte repeats */
+- run = 0;
+- if (s->strstart > 0) { /* if there is a previous byte, that is */
+- max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
+- scan = s->window + s->strstart - 1;
+- prev = *scan++;
+- do {
+- if (*scan++ != prev)
+- break;
+- } while (++run < max);
+- }
+-
+- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
+- if (run >= MIN_MATCH) {
+- check_match(s, s->strstart, s->strstart - 1, run);
+- _tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
+- s->lookahead -= run;
+- s->strstart += run;
+- } else {
+- /* No match, output a literal byte */
+- Tracevv((stderr,"%c", s->window[s->strstart]));
+- _tr_tally_lit (s, s->window[s->strstart], bflush);
+- s->lookahead--;
+- s->strstart++;
+- }
+- if (bflush) FLUSH_BLOCK(s, 0);
+- }
+- FLUSH_BLOCK(s, flush == Z_FINISH);
+- return flush == Z_FINISH ? finish_done : block_done;
+-}
+-#endif
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/deflate.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,355 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* deflate.h -- internal compression state
+- * Copyright (C) 1995-2004 Jean-loup Gailly
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* WARNING: this file should *not* be used by applications. It is
+- part of the implementation of the compression library and is
+- subject to change. Applications should only use zlib.h.
+- */
+-
+-/* @(#) $Id$ */
+-
+-#ifndef DEFLATE_H
+-#define DEFLATE_H
+-
+-#include "zutil.h"
+-
+-/* define NO_GZIP when compiling if you want to disable gzip header and
+- trailer creation by deflate(). NO_GZIP would be used to avoid linking in
+- the crc code when it is not needed. For shared libraries, gzip encoding
+- should be left enabled. */
+-#ifndef NO_GZIP
+-# define GZIP
+-#endif
+-
+-/* ===========================================================================
+- * Internal compression state.
+- */
+-
+-#define LENGTH_CODES 29
+-/* number of length codes, not counting the special END_BLOCK code */
+-
+-#define LITERALS 256
+-/* number of literal bytes 0..255 */
+-
+-#define L_CODES (LITERALS+1+LENGTH_CODES)
+-/* number of Literal or Length codes, including the END_BLOCK code */
+-
+-#define D_CODES 30
+-/* number of distance codes */
+-
+-#define BL_CODES 19
+-/* number of codes used to transfer the bit lengths */
+-
+-#define HEAP_SIZE (2*L_CODES+1)
+-/* maximum heap size */
+-
+-#define MAX_BITS 15
+-/* All codes must not exceed MAX_BITS bits */
+-
+-#define INIT_STATE 42
+-#define EXTRA_STATE 69
+-#define NAME_STATE 73
+-#define COMMENT_STATE 91
+-#define HCRC_STATE 103
+-#define BUSY_STATE 113
+-#define FINISH_STATE 666
+-/* Stream status */
+-
+-
+-/* Data structure describing a single value and its code string. */
+-typedef struct ct_data_s {
+- union {
+- ush freq; /* frequency count */
+- ush code; /* bit string */
+- } fc;
+- union {
+- ush dad; /* father node in Huffman tree */
+- ush len; /* length of bit string */
+- } dl;
+-} FAR ct_data;
+-
+-#define Freq fc.freq
+-#define Code fc.code
+-#define Dad dl.dad
+-#define Len dl.len
+-
+-typedef struct static_tree_desc_s static_tree_desc;
+-
+-typedef struct tree_desc_s {
+- ct_data *dyn_tree; /* the dynamic tree */
+- int max_code; /* largest code with non zero frequency */
+- static_tree_desc *stat_desc; /* the corresponding static tree */
+-} FAR tree_desc;
+-
+-typedef ush Pos;
+-typedef Pos FAR Posf;
+-typedef unsigned IPos;
+-
+-/* A Pos is an index in the character window. We use short instead of int to
+- * save space in the various tables. IPos is used only for parameter passing.
+- */
+-
+-typedef struct internal_state {
+- z_streamp strm; /* pointer back to this zlib stream */
+- int status; /* as the name implies */
+- Bytef *pending_buf; /* output still pending */
+- ulg pending_buf_size; /* size of pending_buf */
+- Bytef *pending_out; /* next pending byte to output to the stream */
+- uInt pending; /* nb of bytes in the pending buffer */
+- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+- gz_headerp gzhead; /* gzip header information to write */
+- uInt gzindex; /* where in extra, name, or comment */
+- Byte method; /* STORED (for zip only) or DEFLATED */
+- int last_flush; /* value of flush param for previous deflate call */
+-
+- /* used by deflate.c: */
+-
+- uInt w_size; /* LZ77 window size (32K by default) */
+- uInt w_bits; /* log2(w_size) (8..16) */
+- uInt w_mask; /* w_size - 1 */
+-
+- Bytef *window;
+- /* Sliding window. Input bytes are read into the second half of the window,
+- * and move to the first half later to keep a dictionary of at least wSize
+- * bytes. With this organization, matches are limited to a distance of
+- * wSize-MAX_MATCH bytes, but this ensures that IO is always
+- * performed with a length multiple of the block size. Also, it limits
+- * the window size to 64K, which is quite useful on MSDOS.
+- * To do: use the user input buffer as sliding window.
+- */
+-
+- ulg window_size;
+- /* Actual size of window: 2*wSize, except when the user input buffer
+- * is directly used as sliding window.
+- */
+-
+- Posf *prev;
+- /* Link to older string with same hash index. To limit the size of this
+- * array to 64K, this link is maintained only for the last 32K strings.
+- * An index in this array is thus a window index modulo 32K.
+- */
+-
+- Posf *head; /* Heads of the hash chains or NIL. */
+-
+- uInt ins_h; /* hash index of string to be inserted */
+- uInt hash_size; /* number of elements in hash table */
+- uInt hash_bits; /* log2(hash_size) */
+- uInt hash_mask; /* hash_size-1 */
+-
+- uInt hash_shift;
+- /* Number of bits by which ins_h must be shifted at each input
+- * step. It must be such that after MIN_MATCH steps, the oldest
+- * byte no longer takes part in the hash key, that is:
+- * hash_shift * MIN_MATCH >= hash_bits
+- */
+-
+- long block_start;
+- /* Window position at the beginning of the current output block. Gets
+- * negative when the window is moved backwards.
+- */
+-
+- uInt match_length; /* length of best match */
+- IPos prev_match; /* previous match */
+- int match_available; /* set if previous match exists */
+- uInt strstart; /* start of string to insert */
+- uInt match_start; /* start of matching string */
+- uInt lookahead; /* number of valid bytes ahead in window */
+-
+- uInt prev_length;
+- /* Length of the best match at previous step. Matches not greater than this
+- * are discarded. This is used in the lazy match evaluation.
+- */
+-
+- uInt max_chain_length;
+- /* To speed up deflation, hash chains are never searched beyond this
+- * length. A higher limit improves compression ratio but degrades the
+- * speed.
+- */
+-
+- uInt max_lazy_match;
+- /* Attempt to find a better match only when the current match is strictly
+- * smaller than this value. This mechanism is used only for compression
+- * levels >= 4.
+- */
+-# define max_insert_length max_lazy_match
+- /* Insert new strings in the hash table only if the match length is not
+- * greater than this length. This saves time but degrades compression.
+- * max_insert_length is used only for compression levels <= 3.
+- */
+-
+- int level; /* compression level (1..9) */
+- int strategy; /* favor or force Huffman coding*/
+-
+- uInt good_match;
+- /* Use a faster search when the previous match is longer than this */
+-
+- int nice_match; /* Stop searching when current match exceeds this */
+-
+- /* used by trees.c: */
+- /* Didn't use ct_data typedef below to supress compiler warning */
+- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
+- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
+-
+- struct tree_desc_s l_desc; /* desc. for literal tree */
+- struct tree_desc_s d_desc; /* desc. for distance tree */
+- struct tree_desc_s bl_desc; /* desc. for bit length tree */
+-
+- ush bl_count[MAX_BITS+1];
+- /* number of codes at each bit length for an optimal tree */
+-
+- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
+- int heap_len; /* number of elements in the heap */
+- int heap_max; /* element of largest frequency */
+- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+- * The same heap array is used to build all trees.
+- */
+-
+- uch depth[2*L_CODES+1];
+- /* Depth of each subtree used as tie breaker for trees of equal frequency
+- */
+-
+- uchf *l_buf; /* buffer for literals or lengths */
+-
+- uInt lit_bufsize;
+- /* Size of match buffer for literals/lengths. There are 4 reasons for
+- * limiting lit_bufsize to 64K:
+- * - frequencies can be kept in 16 bit counters
+- * - if compression is not successful for the first block, all input
+- * data is still in the window so we can still emit a stored block even
+- * when input comes from standard input. (This can also be done for
+- * all blocks if lit_bufsize is not greater than 32K.)
+- * - if compression is not successful for a file smaller than 64K, we can
+- * even emit a stored file instead of a stored block (saving 5 bytes).
+- * This is applicable only for zip (not gzip or zlib).
+- * - creating new Huffman trees less frequently may not provide fast
+- * adaptation to changes in the input data statistics. (Take for
+- * example a binary file with poorly compressible code followed by
+- * a highly compressible string table.) Smaller buffer sizes give
+- * fast adaptation but have of course the overhead of transmitting
+- * trees more frequently.
+- * - I can't count above 4
+- */
+-
+- uInt last_lit; /* running index in l_buf */
+-
+- ushf *d_buf;
+- /* Buffer for distances. To simplify the code, d_buf and l_buf have
+- * the same number of elements. To use different lengths, an extra flag
+- * array would be necessary.
+- */
+-
+- ulg opt_len; /* bit length of current block with optimal trees */
+- ulg static_len; /* bit length of current block with static trees */
+- uInt matches; /* number of string matches in current block */
+- int last_eob_len; /* bit length of EOB code for last block */
+-
+-#ifdef DEBUG
+- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
+-#endif
+-
+- ush bi_buf;
+- /* Output buffer. bits are inserted starting at the bottom (least
+- * significant bits).
+- */
+- int bi_valid;
+- /* Number of valid bits in bi_buf. All bits above the last valid bit
+- * are always zero.
+- */
+-
+-} FAR deflate_state;
+-
+-/* Output a byte on the stream.
+- * IN assertion: there is enough room in pending_buf.
+- */
+-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+-
+-
+-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+-/* Minimum amount of lookahead, except at the end of the input file.
+- * See deflate.c for comments about the MIN_MATCH+1.
+- */
+-
+-#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
+-/* In order to simplify the code, particularly on 16 bit machines, match
+- * distances are limited to MAX_DIST instead of WSIZE.
+- */
+-
+- /* in trees.c */
+-void _tr_init OF((deflate_state *s));
+-int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
+-void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
+- int eof));
+-void _tr_align OF((deflate_state *s));
+-void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+- int eof));
+-
+-#define d_code(dist) \
+- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+-/* Mapping from a distance to a distance code. dist is the distance - 1 and
+- * must not have side effects. _dist_code[256] and _dist_code[257] are never
+- * used.
+- */
+-
+-#ifndef DEBUG
+-/* Inline versions of _tr_tally for speed: */
+-
+-#if defined(GEN_TREES_H) || !defined(STDC)
+- extern uch _length_code[];
+- extern uch _dist_code[];
+-#else
+- extern const uch _length_code[];
+- extern const uch _dist_code[];
+-#endif
+-
+-# define _tr_tally_lit(s, c, flush) \
+- { uch cc = (c); \
+- s->d_buf[s->last_lit] = 0; \
+- s->l_buf[s->last_lit++] = cc; \
+- s->dyn_ltree[cc].Freq++; \
+- flush = (s->last_lit == s->lit_bufsize-1); \
+- }
+-# define _tr_tally_dist(s, distance, length, flush) \
+- { uch len = (length); \
+- ush dist = (distance); \
+- s->d_buf[s->last_lit] = dist; \
+- s->l_buf[s->last_lit++] = len; \
+- dist--; \
+- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+- s->dyn_dtree[d_code(dist)].Freq++; \
+- flush = (s->last_lit == s->lit_bufsize-1); \
+- }
+-#else
+-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+-# define _tr_tally_dist(s, distance, length, flush) \
+- flush = _tr_tally(s, distance, length)
+-#endif
+-
+-#endif /* DEFLATE_H */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/gzio.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1050 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* gzio.c -- IO on .gz files
+- * Copyright (C) 1995-2005 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- *
+- * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
+- */
+-
+-/* @(#) $Id$ */
+-
+-#include <stdio.h>
+-
+-#include "zutil.h"
+-
+-#ifdef NO_DEFLATE /* for compatibility with old definition */
+-# define NO_GZCOMPRESS
+-#endif
+-
+-#ifndef NO_DUMMY_DECL
+-struct internal_state {int dummy;}; /* for buggy compilers */
+-#endif
+-
+-#ifndef Z_BUFSIZE
+-# ifdef MAXSEG_64K
+-# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+-# else
+-# define Z_BUFSIZE 16384
+-# endif
+-#endif
+-#ifndef Z_PRINTF_BUFSIZE
+-# define Z_PRINTF_BUFSIZE 4096
+-#endif
+-
+-#ifdef __MVS__
+-# pragma map (fdopen , "\174\174FDOPEN")
+- FILE *fdopen(int, const char *);
+-#endif
+-
+-#ifndef STDC
+-extern voidp malloc OF((uInt size));
+-extern void free OF((voidpf ptr));
+-#endif
+-
+-#define ALLOC(size) malloc(size)
+-#define TRYFREE(p) {if (p) free(p);}
+-
+-static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+-
+-/* gzip flag byte */
+-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+-#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
+-#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+-#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+-#define COMMENT 0x10 /* bit 4 set: file comment present */
+-#define RESERVED 0xE0 /* bits 5..7: reserved */
+-
+-typedef struct gz_stream {
+- z_stream stream;
+- int z_err; /* error code for last stream operation */
+- int z_eof; /* set if end of input file */
+- FILE *file; /* .gz file */
+- Byte *inbuf; /* input buffer */
+- Byte *outbuf; /* output buffer */
+- uLong crc; /* crc32 of uncompressed data */
+- char *msg; /* error message */
+- char *path; /* path name for debugging only */
+- int transparent; /* 1 if input file is not a .gz file */
+- char mode; /* 'w' or 'r' */
+- z_off_t start; /* start of compressed data in file (header skipped) */
+- z_off_t in; /* bytes into deflate or inflate */
+- z_off_t out; /* bytes out of deflate or inflate */
+- int back; /* one character push-back */
+- int last; /* true if push-back is last character */
+-} gz_stream;
+-
+-
+-local gzFile gz_open OF((const char *path, const char *mode, int fd));
+-local int do_flush OF((gzFile file, int flush));
+-local int get_byte OF((gz_stream *s));
+-local void check_header OF((gz_stream *s));
+-local int destroy OF((gz_stream *s));
+-local void putLong OF((FILE *file, uLong x));
+-local uLong getLong OF((gz_stream *s));
+-
+-/* ===========================================================================
+- Opens a gzip (.gz) file for reading or writing. The mode parameter
+- is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+- or path name (if fd == -1).
+- gz_open returns NULL if the file could not be opened or if there was
+- insufficient memory to allocate the (de)compression state; errno
+- can be checked to distinguish the two cases (if errno is zero, the
+- zlib error is Z_MEM_ERROR).
+-*/
+-local gzFile gz_open (path, mode, fd)
+- const char *path;
+- const char *mode;
+- int fd;
+-{
+- int err;
+- int level = Z_DEFAULT_COMPRESSION; /* compression level */
+- int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
+- char *p = (char*)mode;
+- gz_stream *s;
+- char fmode[80]; /* copy of mode, without the compression level */
+- char *m = fmode;
+-
+- if (!path || !mode) return Z_NULL;
+-
+- s = (gz_stream *)ALLOC(sizeof(gz_stream));
+- if (!s) return Z_NULL;
+-
+- s->stream.zalloc = (alloc_func)0;
+- s->stream.zfree = (free_func)0;
+- s->stream.opaque = (voidpf)0;
+- s->stream.next_in = s->inbuf = Z_NULL;
+- s->stream.next_out = s->outbuf = Z_NULL;
+- s->stream.avail_in = s->stream.avail_out = 0;
+- s->file = NULL;
+- s->z_err = Z_OK;
+- s->z_eof = 0;
+- s->in = 0;
+- s->out = 0;
+- s->back = EOF;
+- s->crc = crc32(0L, Z_NULL, 0);
+- s->msg = NULL;
+- s->transparent = 0;
+-
+- s->path = (char*)ALLOC(strlen(path)+1);
+- if (s->path == NULL) {
+- return destroy(s), (gzFile)Z_NULL;
+- }
+- strcpy(s->path, path); /* do this early for debugging */
+-
+- s->mode = '\0';
+- do {
+- if (*p == 'r') s->mode = 'r';
+- if (*p == 'w' || *p == 'a') s->mode = 'w';
+- if (*p >= '0' && *p <= '9') {
+- level = *p - '0';
+- } else if (*p == 'f') {
+- strategy = Z_FILTERED;
+- } else if (*p == 'h') {
+- strategy = Z_HUFFMAN_ONLY;
+- } else if (*p == 'R') {
+- strategy = Z_RLE;
+- } else {
+- *m++ = *p; /* copy the mode */
+- }
+- } while (*p++ && m != fmode + sizeof(fmode));
+- if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
+-
+- if (s->mode == 'w') {
+-#ifdef NO_GZCOMPRESS
+- err = Z_STREAM_ERROR;
+-#else
+- err = deflateInit2(&(s->stream), level,
+- Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
+- /* windowBits is passed < 0 to suppress zlib header */
+-
+- s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+-#endif
+- if (err != Z_OK || s->outbuf == Z_NULL) {
+- return destroy(s), (gzFile)Z_NULL;
+- }
+- } else {
+- s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+-
+- err = inflateInit2(&(s->stream), -MAX_WBITS);
+- /* windowBits is passed < 0 to tell that there is no zlib header.
+- * Note that in this case inflate *requires* an extra "dummy" byte
+- * after the compressed stream in order to complete decompression and
+- * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+- * present after the compressed stream.
+- */
+- if (err != Z_OK || s->inbuf == Z_NULL) {
+- return destroy(s), (gzFile)Z_NULL;
+- }
+- }
+- s->stream.avail_out = Z_BUFSIZE;
+-
+- errno = 0;
+- s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
+-
+- if (s->file == NULL) {
+- return destroy(s), (gzFile)Z_NULL;
+- }
+- if (s->mode == 'w') {
+- /* Write a very simple .gz header:
+- */
+- fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+- Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
+- s->start = 10L;
+- /* We use 10L instead of ftell(s->file) to because ftell causes an
+- * fflush on some systems. This version of the library doesn't use
+- * start anyway in write mode, so this initialization is not
+- * necessary.
+- */
+- } else {
+- check_header(s); /* skip the .gz header */
+- s->start = ftell(s->file) - s->stream.avail_in;
+- }
+-
+- return (gzFile)s;
+-}
+-
+-/* ===========================================================================
+- Opens a gzip (.gz) file for reading or writing.
+-*/
+-gzFile ZEXPORT gzopen (path, mode)
+- const char *path;
+- const char *mode;
+-{
+- return gz_open (path, mode, -1);
+-}
+-
+-/* ===========================================================================
+- Associate a gzFile with the file descriptor fd. fd is not dup'ed here
+- to mimic the behavio(u)r of fdopen.
+-*/
+-gzFile ZEXPORT gzdopen (fd, mode)
+- int fd;
+- const char *mode;
+-{
+- char name[46]; /* allow for up to 128-bit integers */
+-
+- if (fd < 0) return (gzFile)Z_NULL;
+- sprintf(name, "<fd:%d>", fd); /* for debugging */
+-
+- return gz_open (name, mode, fd);
+-}
+-
+-/* ===========================================================================
+- * Update the compression level and strategy
+- */
+-int ZEXPORT gzsetparams (file, level, strategy)
+- gzFile file;
+- int level;
+- int strategy;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+-
+- /* Make room to allow flushing */
+- if (s->stream.avail_out == 0) {
+-
+- s->stream.next_out = s->outbuf;
+- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+- s->z_err = Z_ERRNO;
+- }
+- s->stream.avail_out = Z_BUFSIZE;
+- }
+-
+- return deflateParams (&(s->stream), level, strategy);
+-}
+-
+-/* ===========================================================================
+- Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+- for end of file.
+- IN assertion: the stream s has been sucessfully opened for reading.
+-*/
+-local int get_byte(s)
+- gz_stream *s;
+-{
+- if (s->z_eof) return EOF;
+- if (s->stream.avail_in == 0) {
+- errno = 0;
+- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+- if (s->stream.avail_in == 0) {
+- s->z_eof = 1;
+- if (ferror(s->file)) s->z_err = Z_ERRNO;
+- return EOF;
+- }
+- s->stream.next_in = s->inbuf;
+- }
+- s->stream.avail_in--;
+- return *(s->stream.next_in)++;
+-}
+-
+-/* ===========================================================================
+- Check the gzip header of a gz_stream opened for reading. Set the stream
+- mode to transparent if the gzip magic header is not present; set s->err
+- to Z_DATA_ERROR if the magic header is present but the rest of the header
+- is incorrect.
+- IN assertion: the stream s has already been created sucessfully;
+- s->stream.avail_in is zero for the first time, but may be non-zero
+- for concatenated .gz files.
+-*/
+-local void check_header(s)
+- gz_stream *s;
+-{
+- int method; /* method byte */
+- int flags; /* flags byte */
+- uInt len;
+- int c;
+-
+- /* Assure two bytes in the buffer so we can peek ahead -- handle case
+- where first byte of header is at the end of the buffer after the last
+- gzip segment */
+- len = s->stream.avail_in;
+- if (len < 2) {
+- if (len) s->inbuf[0] = s->stream.next_in[0];
+- errno = 0;
+- len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
+- if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
+- s->stream.avail_in += len;
+- s->stream.next_in = s->inbuf;
+- if (s->stream.avail_in < 2) {
+- s->transparent = s->stream.avail_in;
+- return;
+- }
+- }
+-
+- /* Peek ahead to check the gzip magic header */
+- if (s->stream.next_in[0] != gz_magic[0] ||
+- s->stream.next_in[1] != gz_magic[1]) {
+- s->transparent = 1;
+- return;
+- }
+- s->stream.avail_in -= 2;
+- s->stream.next_in += 2;
+-
+- /* Check the rest of the gzip header */
+- method = get_byte(s);
+- flags = get_byte(s);
+- if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+- s->z_err = Z_DATA_ERROR;
+- return;
+- }
+-
+- /* Discard time, xflags and OS code: */
+- for (len = 0; len < 6; len++) (void)get_byte(s);
+-
+- if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+- len = (uInt)get_byte(s);
+- len += ((uInt)get_byte(s))<<8;
+- /* len is garbage if EOF but the loop below will quit anyway */
+- while (len-- != 0 && get_byte(s) != EOF) ;
+- }
+- if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+- while ((c = get_byte(s)) != 0 && c != EOF) ;
+- }
+- if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
+- while ((c = get_byte(s)) != 0 && c != EOF) ;
+- }
+- if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
+- for (len = 0; len < 2; len++) (void)get_byte(s);
+- }
+- s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+-}
+-
+- /* ===========================================================================
+- * Cleanup then free the given gz_stream. Return a zlib error code.
+- Try freeing in the reverse order of allocations.
+- */
+-local int destroy (s)
+- gz_stream *s;
+-{
+- int err = Z_OK;
+-
+- if (!s) return Z_STREAM_ERROR;
+-
+- TRYFREE(s->msg);
+-
+- if (s->stream.state != NULL) {
+- if (s->mode == 'w') {
+-#ifdef NO_GZCOMPRESS
+- err = Z_STREAM_ERROR;
+-#else
+- err = deflateEnd(&(s->stream));
+-#endif
+- } else if (s->mode == 'r') {
+- err = inflateEnd(&(s->stream));
+- }
+- }
+- if (s->file != NULL && fclose(s->file)) {
+-#ifdef ESPIPE
+- if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
+-#endif
+- err = Z_ERRNO;
+- }
+- if (s->z_err < 0) err = s->z_err;
+-
+- TRYFREE(s->inbuf);
+- TRYFREE(s->outbuf);
+- TRYFREE(s->path);
+- TRYFREE(s);
+- return err;
+-}
+-
+-/* ===========================================================================
+- Reads the given number of uncompressed bytes from the compressed file.
+- gzread returns the number of bytes actually read (0 for end of file).
+-*/
+-int ZEXPORT gzread (file, buf, len)
+- gzFile file;
+- voidp buf;
+- unsigned len;
+-{
+- gz_stream *s = (gz_stream*)file;
+- Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+- Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+-
+- if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
+-
+- if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
+- if (s->z_err == Z_STREAM_END) return 0; /* EOF */
+-
+- next_out = (Byte*)buf;
+- s->stream.next_out = (Bytef*)buf;
+- s->stream.avail_out = len;
+-
+- if (s->stream.avail_out && s->back != EOF) {
+- *next_out++ = s->back;
+- s->stream.next_out++;
+- s->stream.avail_out--;
+- s->back = EOF;
+- s->out++;
+- start++;
+- if (s->last) {
+- s->z_err = Z_STREAM_END;
+- return 1;
+- }
+- }
+-
+- while (s->stream.avail_out != 0) {
+-
+- if (s->transparent) {
+- /* Copy first the lookahead bytes: */
+- uInt n = s->stream.avail_in;
+- if (n > s->stream.avail_out) n = s->stream.avail_out;
+- if (n > 0) {
+- zmemcpy(s->stream.next_out, s->stream.next_in, n);
+- next_out += n;
+- s->stream.next_out = next_out;
+- s->stream.next_in += n;
+- s->stream.avail_out -= n;
+- s->stream.avail_in -= n;
+- }
+- if (s->stream.avail_out > 0) {
+- s->stream.avail_out -=
+- (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
+- }
+- len -= s->stream.avail_out;
+- s->in += len;
+- s->out += len;
+- if (len == 0) s->z_eof = 1;
+- return (int)len;
+- }
+- if (s->stream.avail_in == 0 && !s->z_eof) {
+-
+- errno = 0;
+- s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+- if (s->stream.avail_in == 0) {
+- s->z_eof = 1;
+- if (ferror(s->file)) {
+- s->z_err = Z_ERRNO;
+- break;
+- }
+- }
+- s->stream.next_in = s->inbuf;
+- }
+- s->in += s->stream.avail_in;
+- s->out += s->stream.avail_out;
+- s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+- s->in -= s->stream.avail_in;
+- s->out -= s->stream.avail_out;
+-
+- if (s->z_err == Z_STREAM_END) {
+- /* Check CRC and original size */
+- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+- start = s->stream.next_out;
+-
+- if (getLong(s) != s->crc) {
+- s->z_err = Z_DATA_ERROR;
+- } else {
+- (void)getLong(s);
+- /* The uncompressed length returned by above getlong() may be
+- * different from s->out in case of concatenated .gz files.
+- * Check for such files:
+- */
+- check_header(s);
+- if (s->z_err == Z_OK) {
+- inflateReset(&(s->stream));
+- s->crc = crc32(0L, Z_NULL, 0);
+- }
+- }
+- }
+- if (s->z_err != Z_OK || s->z_eof) break;
+- }
+- s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+-
+- if (len == s->stream.avail_out &&
+- (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
+- return -1;
+- return (int)(len - s->stream.avail_out);
+-}
+-
+-
+-/* ===========================================================================
+- Reads one byte from the compressed file. gzgetc returns this byte
+- or -1 in case of end of file or error.
+-*/
+-int ZEXPORT gzgetc(file)
+- gzFile file;
+-{
+- unsigned char c;
+-
+- return gzread(file, &c, 1) == 1 ? c : -1;
+-}
+-
+-
+-/* ===========================================================================
+- Push one byte back onto the stream.
+-*/
+-int ZEXPORT gzungetc(c, file)
+- int c;
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
+- s->back = c;
+- s->out--;
+- s->last = (s->z_err == Z_STREAM_END);
+- if (s->last) s->z_err = Z_OK;
+- s->z_eof = 0;
+- return c;
+-}
+-
+-
+-/* ===========================================================================
+- Reads bytes from the compressed file until len-1 characters are
+- read, or a newline character is read and transferred to buf, or an
+- end-of-file condition is encountered. The string is then terminated
+- with a null character.
+- gzgets returns buf, or Z_NULL in case of error.
+-
+- The current implementation is not optimized at all.
+-*/
+-char * ZEXPORT gzgets(file, buf, len)
+- gzFile file;
+- char *buf;
+- int len;
+-{
+- char *b = buf;
+- if (buf == Z_NULL || len <= 0) return Z_NULL;
+-
+- while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
+- *buf = '\0';
+- return b == buf && len > 0 ? Z_NULL : b;
+-}
+-
+-
+-#ifndef NO_GZCOMPRESS
+-/* ===========================================================================
+- Writes the given number of uncompressed bytes into the compressed file.
+- gzwrite returns the number of bytes actually written (0 in case of error).
+-*/
+-int ZEXPORT gzwrite (file, buf, len)
+- gzFile file;
+- voidpc buf;
+- unsigned len;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+-
+- s->stream.next_in = (Bytef*)buf;
+- s->stream.avail_in = len;
+-
+- while (s->stream.avail_in != 0) {
+-
+- if (s->stream.avail_out == 0) {
+-
+- s->stream.next_out = s->outbuf;
+- if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+- s->z_err = Z_ERRNO;
+- break;
+- }
+- s->stream.avail_out = Z_BUFSIZE;
+- }
+- s->in += s->stream.avail_in;
+- s->out += s->stream.avail_out;
+- s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
+- s->in -= s->stream.avail_in;
+- s->out -= s->stream.avail_out;
+- if (s->z_err != Z_OK) break;
+- }
+- s->crc = crc32(s->crc, (const Bytef *)buf, len);
+-
+- return (int)(len - s->stream.avail_in);
+-}
+-
+-
+-/* ===========================================================================
+- Converts, formats, and writes the args to the compressed file under
+- control of the format string, as in fprintf. gzprintf returns the number of
+- uncompressed bytes actually written (0 in case of error).
+-*/
+-#ifdef STDC
+-#include <stdarg.h>
+-
+-int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
+-{
+- char buf[Z_PRINTF_BUFSIZE];
+- va_list va;
+- int len;
+-
+- buf[sizeof(buf) - 1] = 0;
+- va_start(va, format);
+-#ifdef NO_vsnprintf
+-# ifdef HAS_vsprintf_void
+- (void)vsprintf(buf, format, va);
+- va_end(va);
+- for (len = 0; len < sizeof(buf); len++)
+- if (buf[len] == 0) break;
+-# else
+- len = vsprintf(buf, format, va);
+- va_end(va);
+-# endif
+-#else
+-# ifdef HAS_vsnprintf_void
+- (void)vsnprintf(buf, sizeof(buf), format, va);
+- va_end(va);
+- len = strlen(buf);
+-# else
+- len = vsnprintf(buf, sizeof(buf), format, va);
+- va_end(va);
+-# endif
+-#endif
+- if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
+- return 0;
+- return gzwrite(file, buf, (unsigned)len);
+-}
+-#else /* not ANSI C */
+-
+-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+- gzFile file;
+- const char *format;
+- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+-{
+- char buf[Z_PRINTF_BUFSIZE];
+- int len;
+-
+- buf[sizeof(buf) - 1] = 0;
+-#ifdef NO_snprintf
+-# ifdef HAS_sprintf_void
+- sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+- for (len = 0; len < sizeof(buf); len++)
+- if (buf[len] == 0) break;
+-# else
+- len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+-# endif
+-#else
+-# ifdef HAS_snprintf_void
+- snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+- len = strlen(buf);
+-# else
+- len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+-# endif
+-#endif
+- if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
+- return 0;
+- return gzwrite(file, buf, len);
+-}
+-#endif
+-
+-/* ===========================================================================
+- Writes c, converted to an unsigned char, into the compressed file.
+- gzputc returns the value that was written, or -1 in case of error.
+-*/
+-int ZEXPORT gzputc(file, c)
+- gzFile file;
+- int c;
+-{
+- unsigned char cc = (unsigned char) c; /* required for big endian systems */
+-
+- return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
+-}
+-
+-
+-/* ===========================================================================
+- Writes the given null-terminated string to the compressed file, excluding
+- the terminating null character.
+- gzputs returns the number of characters written, or -1 in case of error.
+-*/
+-int ZEXPORT gzputs(file, s)
+- gzFile file;
+- const char *s;
+-{
+- return gzwrite(file, (char*)s, (unsigned)strlen(s));
+-}
+-
+-
+-/* ===========================================================================
+- Flushes all pending output into the compressed file. The parameter
+- flush is as in the deflate() function.
+-*/
+-local int do_flush (file, flush)
+- gzFile file;
+- int flush;
+-{
+- uInt len;
+- int done = 0;
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+-
+- s->stream.avail_in = 0; /* should be zero already anyway */
+-
+- for (;;) {
+- len = Z_BUFSIZE - s->stream.avail_out;
+-
+- if (len != 0) {
+- if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
+- s->z_err = Z_ERRNO;
+- return Z_ERRNO;
+- }
+- s->stream.next_out = s->outbuf;
+- s->stream.avail_out = Z_BUFSIZE;
+- }
+- if (done) break;
+- s->out += s->stream.avail_out;
+- s->z_err = deflate(&(s->stream), flush);
+- s->out -= s->stream.avail_out;
+-
+- /* Ignore the second of two consecutive flushes: */
+- if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
+-
+- /* deflate has finished flushing only when it hasn't used up
+- * all the available space in the output buffer:
+- */
+- done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
+-
+- if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
+- }
+- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+-}
+-
+-int ZEXPORT gzflush (file, flush)
+- gzFile file;
+- int flush;
+-{
+- gz_stream *s = (gz_stream*)file;
+- int err = do_flush (file, flush);
+-
+- if (err) return err;
+- fflush(s->file);
+- return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+-}
+-#endif /* NO_GZCOMPRESS */
+-
+-/* ===========================================================================
+- Sets the starting position for the next gzread or gzwrite on the given
+- compressed file. The offset represents a number of bytes in the
+- gzseek returns the resulting offset location as measured in bytes from
+- the beginning of the uncompressed stream, or -1 in case of error.
+- SEEK_END is not implemented, returns error.
+- In this version of the library, gzseek can be extremely slow.
+-*/
+-z_off_t ZEXPORT gzseek (file, offset, whence)
+- gzFile file;
+- z_off_t offset;
+- int whence;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || whence == SEEK_END ||
+- s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+- return -1L;
+- }
+-
+- if (s->mode == 'w') {
+-#ifdef NO_GZCOMPRESS
+- return -1L;
+-#else
+- if (whence == SEEK_SET) {
+- offset -= s->in;
+- }
+- if (offset < 0) return -1L;
+-
+- /* At this point, offset is the number of zero bytes to write. */
+- if (s->inbuf == Z_NULL) {
+- s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
+- if (s->inbuf == Z_NULL) return -1L;
+- zmemzero(s->inbuf, Z_BUFSIZE);
+- }
+- while (offset > 0) {
+- uInt size = Z_BUFSIZE;
+- if (offset < Z_BUFSIZE) size = (uInt)offset;
+-
+- size = gzwrite(file, s->inbuf, size);
+- if (size == 0) return -1L;
+-
+- offset -= size;
+- }
+- return s->in;
+-#endif
+- }
+- /* Rest of function is for reading only */
+-
+- /* compute absolute position */
+- if (whence == SEEK_CUR) {
+- offset += s->out;
+- }
+- if (offset < 0) return -1L;
+-
+- if (s->transparent) {
+- /* map to fseek */
+- s->back = EOF;
+- s->stream.avail_in = 0;
+- s->stream.next_in = s->inbuf;
+- if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+-
+- s->in = s->out = offset;
+- return offset;
+- }
+-
+- /* For a negative seek, rewind and use positive seek */
+- if (offset >= s->out) {
+- offset -= s->out;
+- } else if (gzrewind(file) < 0) {
+- return -1L;
+- }
+- /* offset is now the number of bytes to skip. */
+-
+- if (offset != 0 && s->outbuf == Z_NULL) {
+- s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+- if (s->outbuf == Z_NULL) return -1L;
+- }
+- if (offset && s->back != EOF) {
+- s->back = EOF;
+- s->out++;
+- offset--;
+- if (s->last) s->z_err = Z_STREAM_END;
+- }
+- while (offset > 0) {
+- int size = Z_BUFSIZE;
+- if (offset < Z_BUFSIZE) size = (int)offset;
+-
+- size = gzread(file, s->outbuf, (uInt)size);
+- if (size <= 0) return -1L;
+- offset -= size;
+- }
+- return s->out;
+-}
+-
+-/* ===========================================================================
+- Rewinds input file.
+-*/
+-int ZEXPORT gzrewind (file)
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'r') return -1;
+-
+- s->z_err = Z_OK;
+- s->z_eof = 0;
+- s->back = EOF;
+- s->stream.avail_in = 0;
+- s->stream.next_in = s->inbuf;
+- s->crc = crc32(0L, Z_NULL, 0);
+- if (!s->transparent) (void)inflateReset(&s->stream);
+- s->in = 0;
+- s->out = 0;
+- return fseek(s->file, s->start, SEEK_SET);
+-}
+-
+-/* ===========================================================================
+- Returns the starting position for the next gzread or gzwrite on the
+- given compressed file. This position represents a number of bytes in the
+- uncompressed data stream.
+-*/
+-z_off_t ZEXPORT gztell (file)
+- gzFile file;
+-{
+- return gzseek(file, 0L, SEEK_CUR);
+-}
+-
+-/* ===========================================================================
+- Returns 1 when EOF has previously been detected reading the given
+- input stream, otherwise zero.
+-*/
+-int ZEXPORT gzeof (file)
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- /* With concatenated compressed files that can have embedded
+- * crc trailers, z_eof is no longer the only/best indicator of EOF
+- * on a gz_stream. Handle end-of-stream error explicitly here.
+- */
+- if (s == NULL || s->mode != 'r') return 0;
+- if (s->z_eof) return 1;
+- return s->z_err == Z_STREAM_END;
+-}
+-
+-/* ===========================================================================
+- Returns 1 if reading and doing so transparently, otherwise zero.
+-*/
+-int ZEXPORT gzdirect (file)
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL || s->mode != 'r') return 0;
+- return s->transparent;
+-}
+-
+-/* ===========================================================================
+- Outputs a long in LSB order to the given file
+-*/
+-local void putLong (file, x)
+- FILE *file;
+- uLong x;
+-{
+- int n;
+- for (n = 0; n < 4; n++) {
+- fputc((int)(x & 0xff), file);
+- x >>= 8;
+- }
+-}
+-
+-/* ===========================================================================
+- Reads a long in LSB order from the given gz_stream. Sets z_err in case
+- of error.
+-*/
+-local uLong getLong (s)
+- gz_stream *s;
+-{
+- uLong x = (uLong)get_byte(s);
+- int c;
+-
+- x += ((uLong)get_byte(s))<<8;
+- x += ((uLong)get_byte(s))<<16;
+- c = get_byte(s);
+- if (c == EOF) s->z_err = Z_DATA_ERROR;
+- x += ((uLong)c)<<24;
+- return x;
+-}
+-
+-/* ===========================================================================
+- Flushes all pending output if necessary, closes the compressed file
+- and deallocates all the (de)compression state.
+-*/
+-int ZEXPORT gzclose (file)
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL) return Z_STREAM_ERROR;
+-
+- if (s->mode == 'w') {
+-#ifdef NO_GZCOMPRESS
+- return Z_STREAM_ERROR;
+-#else
+- if (do_flush (file, Z_FINISH) != Z_OK)
+- return destroy((gz_stream*)file);
+-
+- putLong (s->file, s->crc);
+- putLong (s->file, (uLong)(s->in & 0xffffffff));
+-#endif
+- }
+- return destroy((gz_stream*)file);
+-}
+-
+-#ifdef STDC
+-# define zstrerror(errnum) strerror(errnum)
+-#else
+-# define zstrerror(errnum) ""
+-#endif
+-
+-/* ===========================================================================
+- Returns the error message for the last error which occurred on the
+- given compressed file. errnum is set to zlib error number. If an
+- error occurred in the file system and not in the compression library,
+- errnum is set to Z_ERRNO and the application may consult errno
+- to get the exact error code.
+-*/
+-const char * ZEXPORT gzerror (file, errnum)
+- gzFile file;
+- int *errnum;
+-{
+- char *m;
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL) {
+- *errnum = Z_STREAM_ERROR;
+- return (const char*)ERR_MSG(Z_STREAM_ERROR);
+- }
+- *errnum = s->z_err;
+- if (*errnum == Z_OK) return (const char*)"";
+-
+- m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+-
+- if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+-
+- TRYFREE(s->msg);
+- s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+- if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
+- strcpy(s->msg, s->path);
+- strcat(s->msg, ": ");
+- strcat(s->msg, m);
+- return (const char*)s->msg;
+-}
+-
+-/* ===========================================================================
+- Clear the error and end-of-file flags, and do the same for the real file.
+-*/
+-void ZEXPORT gzclearerr (file)
+- gzFile file;
+-{
+- gz_stream *s = (gz_stream*)file;
+-
+- if (s == NULL) return;
+- if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
+- s->z_eof = 0;
+- clearerr(s->file);
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/infback.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,647 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* infback.c -- inflate using a call-back interface
+- * Copyright (C) 1995-2005 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/*
+- This code is largely copied from inflate.c. Normally either infback.o or
+- inflate.o would be linked into an application--not both. The interface
+- with inffast.c is retained so that optimized assembler-coded versions of
+- inflate_fast() can be used with either inflate.c or infback.c.
+- */
+-
+-#include "zutil.h"
+-#include "inftrees.h"
+-#include "inflate.h"
+-#include "inffast.h"
+-
+-/* function prototypes */
+-local void fixedtables OF((struct inflate_state FAR *state));
+-
+-/*
+- strm provides memory allocation functions in zalloc and zfree, or
+- Z_NULL to use the library memory allocation functions.
+-
+- windowBits is in the range 8..15, and window is a user-supplied
+- window and output buffer that is 2**windowBits bytes.
+- */
+-int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
+-z_streamp strm;
+-int windowBits;
+-unsigned char FAR *window;
+-const char *version;
+-int stream_size;
+-{
+- struct inflate_state FAR *state;
+-
+- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+- stream_size != (int)(sizeof(z_stream)))
+- return Z_VERSION_ERROR;
+- if (strm == Z_NULL || window == Z_NULL ||
+- windowBits < 8 || windowBits > 15)
+- return Z_STREAM_ERROR;
+- strm->msg = Z_NULL; /* in case we return an error */
+- if (strm->zalloc == (alloc_func)0) {
+- strm->zalloc = zcalloc;
+- strm->opaque = (voidpf)0;
+- }
+- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
+- sizeof(struct inflate_state));
+- if (state == Z_NULL) return Z_MEM_ERROR;
+- Tracev((stderr, "inflate: allocated\n"));
+- strm->state = (struct internal_state FAR *)state;
+- state->dmax = 32768U;
+- state->wbits = windowBits;
+- state->wsize = 1U << windowBits;
+- state->window = window;
+- state->write = 0;
+- state->whave = 0;
+- return Z_OK;
+-}
+-
+-/*
+- Return state with length and distance decoding tables and index sizes set to
+- fixed code decoding. Normally this returns fixed tables from inffixed.h.
+- If BUILDFIXED is defined, then instead this routine builds the tables the
+- first time it's called, and returns those tables the first time and
+- thereafter. This reduces the size of the code by about 2K bytes, in
+- exchange for a little execution time. However, BUILDFIXED should not be
+- used for threaded applications, since the rewriting of the tables and virgin
+- may not be thread-safe.
+- */
+-local void fixedtables(state)
+-struct inflate_state FAR *state;
+-{
+-#ifdef BUILDFIXED
+- static int virgin = 1;
+- static code *lenfix, *distfix;
+- static code fixed[544];
+-
+- /* build fixed huffman tables if first call (may not be thread safe) */
+- if (virgin) {
+- unsigned sym, bits;
+- static code *next;
+-
+- /* literal/length table */
+- sym = 0;
+- while (sym < 144) state->lens[sym++] = 8;
+- while (sym < 256) state->lens[sym++] = 9;
+- while (sym < 280) state->lens[sym++] = 7;
+- while (sym < 288) state->lens[sym++] = 8;
+- next = fixed;
+- lenfix = next;
+- bits = 9;
+- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+-
+- /* distance table */
+- sym = 0;
+- while (sym < 32) state->lens[sym++] = 5;
+- distfix = next;
+- bits = 5;
+- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+-
+- /* do this just once */
+- virgin = 0;
+- }
+-#else /* !BUILDFIXED */
+-# include "inffixed.h"
+-#endif /* BUILDFIXED */
+- state->lencode = lenfix;
+- state->lenbits = 9;
+- state->distcode = distfix;
+- state->distbits = 5;
+-}
+-
+-/* Macros for inflateBack(): */
+-
+-/* Load returned state from inflate_fast() */
+-#define LOAD() \
+- do { \
+- put = strm->next_out; \
+- left = strm->avail_out; \
+- next = strm->next_in; \
+- have = strm->avail_in; \
+- hold = state->hold; \
+- bits = state->bits; \
+- } while (0)
+-
+-/* Set state from registers for inflate_fast() */
+-#define RESTORE() \
+- do { \
+- strm->next_out = put; \
+- strm->avail_out = left; \
+- strm->next_in = next; \
+- strm->avail_in = have; \
+- state->hold = hold; \
+- state->bits = bits; \
+- } while (0)
+-
+-/* Clear the input bit accumulator */
+-#define INITBITS() \
+- do { \
+- hold = 0; \
+- bits = 0; \
+- } while (0)
+-
+-/* Assure that some input is available. If input is requested, but denied,
+- then return a Z_BUF_ERROR from inflateBack(). */
+-#define PULL() \
+- do { \
+- if (have == 0) { \
+- have = in(in_desc, &next); \
+- if (have == 0) { \
+- next = Z_NULL; \
+- ret = Z_BUF_ERROR; \
+- goto inf_leave; \
+- } \
+- } \
+- } while (0)
+-
+-/* Get a byte of input into the bit accumulator, or return from inflateBack()
+- with an error if there is no input available. */
+-#define PULLBYTE() \
+- do { \
+- PULL(); \
+- have--; \
+- hold += (unsigned long)(*next++) << bits; \
+- bits += 8; \
+- } while (0)
+-
+-/* Assure that there are at least n bits in the bit accumulator. If there is
+- not enough available input to do that, then return from inflateBack() with
+- an error. */
+-#define NEEDBITS(n) \
+- do { \
+- while (bits < (unsigned)(n)) \
+- PULLBYTE(); \
+- } while (0)
+-
+-/* Return the low n bits of the bit accumulator (n < 16) */
+-#define BITS(n) \
+- ((unsigned)hold & ((1U << (n)) - 1))
+-
+-/* Remove n bits from the bit accumulator */
+-#define DROPBITS(n) \
+- do { \
+- hold >>= (n); \
+- bits -= (unsigned)(n); \
+- } while (0)
+-
+-/* Remove zero to seven bits as needed to go to a byte boundary */
+-#define BYTEBITS() \
+- do { \
+- hold >>= bits & 7; \
+- bits -= bits & 7; \
+- } while (0)
+-
+-/* Assure that some output space is available, by writing out the window
+- if it's full. If the write fails, return from inflateBack() with a
+- Z_BUF_ERROR. */
+-#define ROOM() \
+- do { \
+- if (left == 0) { \
+- put = state->window; \
+- left = state->wsize; \
+- state->whave = left; \
+- if (out(out_desc, put, left)) { \
+- ret = Z_BUF_ERROR; \
+- goto inf_leave; \
+- } \
+- } \
+- } while (0)
+-
+-/*
+- strm provides the memory allocation functions and window buffer on input,
+- and provides information on the unused input on return. For Z_DATA_ERROR
+- returns, strm will also provide an error message.
+-
+- in() and out() are the call-back input and output functions. When
+- inflateBack() needs more input, it calls in(). When inflateBack() has
+- filled the window with output, or when it completes with data in the
+- window, it calls out() to write out the data. The application must not
+- change the provided input until in() is called again or inflateBack()
+- returns. The application must not change the window/output buffer until
+- inflateBack() returns.
+-
+- in() and out() are called with a descriptor parameter provided in the
+- inflateBack() call. This parameter can be a structure that provides the
+- information required to do the read or write, as well as accumulated
+- information on the input and output such as totals and check values.
+-
+- in() should return zero on failure. out() should return non-zero on
+- failure. If either in() or out() fails, than inflateBack() returns a
+- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
+- was in() or out() that caused in the error. Otherwise, inflateBack()
+- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
+- error, or Z_MEM_ERROR if it could not allocate memory for the state.
+- inflateBack() can also return Z_STREAM_ERROR if the input parameters
+- are not correct, i.e. strm is Z_NULL or the state was not initialized.
+- */
+-int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
+-z_streamp strm;
+-in_func in;
+-void FAR *in_desc;
+-out_func out;
+-void FAR *out_desc;
+-{
+- struct inflate_state FAR *state;
+- unsigned char FAR *next; /* next input */
+- unsigned char FAR *put; /* next output */
+- unsigned have, left; /* available input and output */
+- unsigned long hold; /* bit buffer */
+- unsigned bits; /* bits in bit buffer */
+- unsigned copy; /* number of stored or match bytes to copy */
+- unsigned char FAR *from; /* where to copy match bytes from */
+- code this; /* current decoding table entry */
+- code last; /* parent table entry */
+- unsigned len; /* length to copy for repeats, bits to drop */
+- int ret; /* return code */
+- static const unsigned short order[19] = /* permutation of code lengths */
+- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+-
+- /* Check that the strm exists and that the state was initialized */
+- if (strm == Z_NULL || strm->state == Z_NULL)
+- return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+-
+- /* Reset the state */
+- strm->msg = Z_NULL;
+- state->mode = TYPE;
+- state->last = 0;
+- state->whave = 0;
+- next = strm->next_in;
+- have = next != Z_NULL ? strm->avail_in : 0;
+- hold = 0;
+- bits = 0;
+- put = state->window;
+- left = state->wsize;
+-
+- /* Inflate until end of block marked as last */
+- for (;;)
+- switch (state->mode) {
+- case TYPE:
+- /* determine and dispatch block type */
+- if (state->last) {
+- BYTEBITS();
+- state->mode = DONE;
+- break;
+- }
+- NEEDBITS(3);
+- state->last = BITS(1);
+- DROPBITS(1);
+- switch (BITS(2)) {
+- case 0: /* stored block */
+- Tracev((stderr, "inflate: stored block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = STORED;
+- break;
+- case 1: /* fixed block */
+- fixedtables(state);
+- Tracev((stderr, "inflate: fixed codes block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = LEN; /* decode codes */
+- break;
+- case 2: /* dynamic block */
+- Tracev((stderr, "inflate: dynamic codes block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = TABLE;
+- break;
+- case 3:
+- strm->msg = (char *)"invalid block type";
+- state->mode = BAD;
+- }
+- DROPBITS(2);
+- break;
+-
+- case STORED:
+- /* get and verify stored block length */
+- BYTEBITS(); /* go to byte boundary */
+- NEEDBITS(32);
+- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+- strm->msg = (char *)"invalid stored block lengths";
+- state->mode = BAD;
+- break;
+- }
+- state->length = (unsigned)hold & 0xffff;
+- Tracev((stderr, "inflate: stored length %u\n",
+- state->length));
+- INITBITS();
+-
+- /* copy stored block from input to output */
+- while (state->length != 0) {
+- copy = state->length;
+- PULL();
+- ROOM();
+- if (copy > have) copy = have;
+- if (copy > left) copy = left;
+- zmemcpy(put, next, copy);
+- have -= copy;
+- next += copy;
+- left -= copy;
+- put += copy;
+- state->length -= copy;
+- }
+- Tracev((stderr, "inflate: stored end\n"));
+- state->mode = TYPE;
+- break;
+-
+- case TABLE:
+- /* get dynamic table entries descriptor */
+- NEEDBITS(14);
+- state->nlen = BITS(5) + 257;
+- DROPBITS(5);
+- state->ndist = BITS(5) + 1;
+- DROPBITS(5);
+- state->ncode = BITS(4) + 4;
+- DROPBITS(4);
+-#ifndef PKZIP_BUG_WORKAROUND
+- if (state->nlen > 286 || state->ndist > 30) {
+- strm->msg = (char *)"too many length or distance symbols";
+- state->mode = BAD;
+- break;
+- }
+-#endif
+- Tracev((stderr, "inflate: table sizes ok\n"));
+-
+- /* get code length code lengths (not a typo) */
+- state->have = 0;
+- while (state->have < state->ncode) {
+- NEEDBITS(3);
+- state->lens[order[state->have++]] = (unsigned short)BITS(3);
+- DROPBITS(3);
+- }
+- while (state->have < 19)
+- state->lens[order[state->have++]] = 0;
+- state->next = state->codes;
+- state->lencode = (code const FAR *)(state->next);
+- state->lenbits = 7;
+- ret = inflate_table(CODES, state->lens, 19, &(state->next),
+- &(state->lenbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid code lengths set";
+- state->mode = BAD;
+- break;
+- }
+- Tracev((stderr, "inflate: code lengths ok\n"));
+-
+- /* get length and distance code code lengths */
+- state->have = 0;
+- while (state->have < state->nlen + state->ndist) {
+- for (;;) {
+- this = state->lencode[BITS(state->lenbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if (this.val < 16) {
+- NEEDBITS(this.bits);
+- DROPBITS(this.bits);
+- state->lens[state->have++] = this.val;
+- }
+- else {
+- if (this.val == 16) {
+- NEEDBITS(this.bits + 2);
+- DROPBITS(this.bits);
+- if (state->have == 0) {
+- strm->msg = (char *)"invalid bit length repeat";
+- state->mode = BAD;
+- break;
+- }
+- len = (unsigned)(state->lens[state->have - 1]);
+- copy = 3 + BITS(2);
+- DROPBITS(2);
+- }
+- else if (this.val == 17) {
+- NEEDBITS(this.bits + 3);
+- DROPBITS(this.bits);
+- len = 0;
+- copy = 3 + BITS(3);
+- DROPBITS(3);
+- }
+- else {
+- NEEDBITS(this.bits + 7);
+- DROPBITS(this.bits);
+- len = 0;
+- copy = 11 + BITS(7);
+- DROPBITS(7);
+- }
+- if (state->have + copy > state->nlen + state->ndist) {
+- strm->msg = (char *)"invalid bit length repeat";
+- state->mode = BAD;
+- break;
+- }
+- while (copy--)
+- state->lens[state->have++] = (unsigned short)len;
+- }
+- }
+-
+- /* handle error breaks in while */
+- if (state->mode == BAD) break;
+-
+- /* build code tables */
+- state->next = state->codes;
+- state->lencode = (code const FAR *)(state->next);
+- state->lenbits = 9;
+- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+- &(state->lenbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid literal/lengths set";
+- state->mode = BAD;
+- break;
+- }
+- state->distcode = (code const FAR *)(state->next);
+- state->distbits = 6;
+- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+- &(state->next), &(state->distbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid distances set";
+- state->mode = BAD;
+- break;
+- }
+- Tracev((stderr, "inflate: codes ok\n"));
+- state->mode = LEN;
+-
+- case LEN:
+- /* use inflate_fast() if we have enough input and output */
+- if (have >= 6 && left >= 258) {
+- RESTORE();
+- if (state->whave < state->wsize)
+- state->whave = state->wsize - left;
+- inflate_fast(strm, state->wsize);
+- LOAD();
+- break;
+- }
+-
+- /* get a literal, length, or end-of-block code */
+- for (;;) {
+- this = state->lencode[BITS(state->lenbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if (this.op && (this.op & 0xf0) == 0) {
+- last = this;
+- for (;;) {
+- this = state->lencode[last.val +
+- (BITS(last.bits + last.op) >> last.bits)];
+- if ((unsigned)(last.bits + this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- DROPBITS(last.bits);
+- }
+- DROPBITS(this.bits);
+- state->length = (unsigned)this.val;
+-
+- /* process literal */
+- if (this.op == 0) {
+- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+- "inflate: literal '%c'\n" :
+- "inflate: literal 0x%02x\n", this.val));
+- ROOM();
+- *put++ = (unsigned char)(state->length);
+- left--;
+- state->mode = LEN;
+- break;
+- }
+-
+- /* process end of block */
+- if (this.op & 32) {
+- Tracevv((stderr, "inflate: end of block\n"));
+- state->mode = TYPE;
+- break;
+- }
+-
+- /* invalid code */
+- if (this.op & 64) {
+- strm->msg = (char *)"invalid literal/length code";
+- state->mode = BAD;
+- break;
+- }
+-
+- /* length code -- get extra bits, if any */
+- state->extra = (unsigned)(this.op) & 15;
+- if (state->extra != 0) {
+- NEEDBITS(state->extra);
+- state->length += BITS(state->extra);
+- DROPBITS(state->extra);
+- }
+- Tracevv((stderr, "inflate: length %u\n", state->length));
+-
+- /* get distance code */
+- for (;;) {
+- this = state->distcode[BITS(state->distbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if ((this.op & 0xf0) == 0) {
+- last = this;
+- for (;;) {
+- this = state->distcode[last.val +
+- (BITS(last.bits + last.op) >> last.bits)];
+- if ((unsigned)(last.bits + this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- DROPBITS(last.bits);
+- }
+- DROPBITS(this.bits);
+- if (this.op & 64) {
+- strm->msg = (char *)"invalid distance code";
+- state->mode = BAD;
+- break;
+- }
+- state->offset = (unsigned)this.val;
+-
+- /* get distance extra bits, if any */
+- state->extra = (unsigned)(this.op) & 15;
+- if (state->extra != 0) {
+- NEEDBITS(state->extra);
+- state->offset += BITS(state->extra);
+- DROPBITS(state->extra);
+- }
+- if (state->offset > state->wsize - (state->whave < state->wsize ?
+- left : 0)) {
+- strm->msg = (char *)"invalid distance too far back";
+- state->mode = BAD;
+- break;
+- }
+- Tracevv((stderr, "inflate: distance %u\n", state->offset));
+-
+- /* copy match from window to output */
+- do {
+- ROOM();
+- copy = state->wsize - state->offset;
+- if (copy < left) {
+- from = put + copy;
+- copy = left - copy;
+- }
+- else {
+- from = put - state->offset;
+- copy = left;
+- }
+- if (copy > state->length) copy = state->length;
+- state->length -= copy;
+- left -= copy;
+- do {
+- *put++ = *from++;
+- } while (--copy);
+- } while (state->length != 0);
+- break;
+-
+- case DONE:
+- /* inflate stream terminated properly -- write leftover output */
+- ret = Z_STREAM_END;
+- if (left < state->wsize) {
+- if (out(out_desc, state->window, state->wsize - left))
+- ret = Z_BUF_ERROR;
+- }
+- goto inf_leave;
+-
+- case BAD:
+- ret = Z_DATA_ERROR;
+- goto inf_leave;
+-
+- default: /* can't happen, but makes compilers happy */
+- ret = Z_STREAM_ERROR;
+- goto inf_leave;
+- }
+-
+- /* Return unused input */
+- inf_leave:
+- strm->next_in = next;
+- strm->avail_in = have;
+- return ret;
+-}
+-
+-int ZEXPORT inflateBackEnd(strm)
+-z_streamp strm;
+-{
+- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+- return Z_STREAM_ERROR;
+- ZFREE(strm, strm->state);
+- strm->state = Z_NULL;
+- Tracev((stderr, "inflate: end\n"));
+- return Z_OK;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,342 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inffast.c -- fast decoding
+- * Copyright (C) 1995-2004 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-#include "zutil.h"
+-#include "inftrees.h"
+-#include "inflate.h"
+-#include "inffast.h"
+-
+-#ifndef ASMINF
+-
+-/* Allow machine dependent optimization for post-increment or pre-increment.
+- Based on testing to date,
+- Pre-increment preferred for:
+- - PowerPC G3 (Adler)
+- - MIPS R5000 (Randers-Pehrson)
+- Post-increment preferred for:
+- - none
+- No measurable difference:
+- - Pentium III (Anderson)
+- - M68060 (Nikl)
+- */
+-#ifdef POSTINC
+-# define OFF 0
+-# define PUP(a) *(a)++
+-#else
+-# define OFF 1
+-# define PUP(a) *++(a)
+-#endif
+-
+-/*
+- Decode literal, length, and distance codes and write out the resulting
+- literal and match bytes until either not enough input or output is
+- available, an end-of-block is encountered, or a data error is encountered.
+- When large enough input and output buffers are supplied to inflate(), for
+- example, a 16K input buffer and a 64K output buffer, more than 95% of the
+- inflate execution time is spent in this routine.
+-
+- Entry assumptions:
+-
+- state->mode == LEN
+- strm->avail_in >= 6
+- strm->avail_out >= 258
+- start >= strm->avail_out
+- state->bits < 8
+-
+- On return, state->mode is one of:
+-
+- LEN -- ran out of enough output space or enough available input
+- TYPE -- reached end of block code, inflate() to interpret next block
+- BAD -- error in block data
+-
+- Notes:
+-
+- - The maximum input bits used by a length/distance pair is 15 bits for the
+- length code, 5 bits for the length extra, 15 bits for the distance code,
+- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
+- Therefore if strm->avail_in >= 6, then there is enough input to avoid
+- checking for available input while decoding.
+-
+- - The maximum bytes that a single length/distance pair can output is 258
+- bytes, which is the maximum length that can be coded. inflate_fast()
+- requires strm->avail_out >= 258 for each loop to avoid checking for
+- output space.
+- */
+-void inflate_fast(strm, start)
+-z_streamp strm;
+-unsigned start; /* inflate()'s starting value for strm->avail_out */
+-{
+- struct inflate_state FAR *state;
+- unsigned char FAR *in; /* local strm->next_in */
+- unsigned char FAR *last; /* while in < last, enough input available */
+- unsigned char FAR *out; /* local strm->next_out */
+- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
+- unsigned char FAR *end; /* while out < end, enough space available */
+-#ifdef INFLATE_STRICT
+- unsigned dmax; /* maximum distance from zlib header */
+-#endif
+- unsigned wsize; /* window size or zero if not using window */
+- unsigned whave; /* valid bytes in the window */
+- unsigned write; /* window write index */
+- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
+- unsigned long hold; /* local strm->hold */
+- unsigned bits; /* local strm->bits */
+- code const FAR *lcode; /* local strm->lencode */
+- code const FAR *dcode; /* local strm->distcode */
+- unsigned lmask; /* mask for first level of length codes */
+- unsigned dmask; /* mask for first level of distance codes */
+- code this; /* retrieved table entry */
+- unsigned op; /* code bits, operation, extra bits, or */
+- /* window position, window bytes to copy */
+- unsigned len; /* match length, unused bytes */
+- unsigned dist; /* match distance */
+- unsigned char FAR *from; /* where to copy match from */
+-
+- /* copy state to local variables */
+- state = (struct inflate_state FAR *)strm->state;
+- in = strm->next_in - OFF;
+- last = in + (strm->avail_in - 5);
+- out = strm->next_out - OFF;
+- beg = out - (start - strm->avail_out);
+- end = out + (strm->avail_out - 257);
+-#ifdef INFLATE_STRICT
+- dmax = state->dmax;
+-#endif
+- wsize = state->wsize;
+- whave = state->whave;
+- write = state->write;
+- window = state->window;
+- hold = state->hold;
+- bits = state->bits;
+- lcode = state->lencode;
+- dcode = state->distcode;
+- lmask = (1U << state->lenbits) - 1;
+- dmask = (1U << state->distbits) - 1;
+-
+- /* decode literals and length/distances until end-of-block or not enough
+- input data or output space */
+- do {
+- if (bits < 15) {
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- }
+- this = lcode[hold & lmask];
+- dolen:
+- op = (unsigned)(this.bits);
+- hold >>= op;
+- bits -= op;
+- op = (unsigned)(this.op);
+- if (op == 0) { /* literal */
+- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+- "inflate: literal '%c'\n" :
+- "inflate: literal 0x%02x\n", this.val));
+- PUP(out) = (unsigned char)(this.val);
+- }
+- else if (op & 16) { /* length base */
+- len = (unsigned)(this.val);
+- op &= 15; /* number of extra bits */
+- if (op) {
+- if (bits < op) {
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- }
+- len += (unsigned)hold & ((1U << op) - 1);
+- hold >>= op;
+- bits -= op;
+- }
+- Tracevv((stderr, "inflate: length %u\n", len));
+- if (bits < 15) {
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- }
+- this = dcode[hold & dmask];
+- dodist:
+- op = (unsigned)(this.bits);
+- hold >>= op;
+- bits -= op;
+- op = (unsigned)(this.op);
+- if (op & 16) { /* distance base */
+- dist = (unsigned)(this.val);
+- op &= 15; /* number of extra bits */
+- if (bits < op) {
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- if (bits < op) {
+- hold += (unsigned long)(PUP(in)) << bits;
+- bits += 8;
+- }
+- }
+- dist += (unsigned)hold & ((1U << op) - 1);
+-#ifdef INFLATE_STRICT
+- if (dist > dmax) {
+- strm->msg = (char *)"invalid distance too far back";
+- state->mode = BAD;
+- break;
+- }
+-#endif
+- hold >>= op;
+- bits -= op;
+- Tracevv((stderr, "inflate: distance %u\n", dist));
+- op = (unsigned)(out - beg); /* max distance in output */
+- if (dist > op) { /* see if copy from window */
+- op = dist - op; /* distance back in window */
+- if (op > whave) {
+- strm->msg = (char *)"invalid distance too far back";
+- state->mode = BAD;
+- break;
+- }
+- from = window - OFF;
+- if (write == 0) { /* very common case */
+- from += wsize - op;
+- if (op < len) { /* some from window */
+- len -= op;
+- do {
+- PUP(out) = PUP(from);
+- } while (--op);
+- from = out - dist; /* rest from output */
+- }
+- }
+- else if (write < op) { /* wrap around window */
+- from += wsize + write - op;
+- op -= write;
+- if (op < len) { /* some from end of window */
+- len -= op;
+- do {
+- PUP(out) = PUP(from);
+- } while (--op);
+- from = window - OFF;
+- if (write < len) { /* some from start of window */
+- op = write;
+- len -= op;
+- do {
+- PUP(out) = PUP(from);
+- } while (--op);
+- from = out - dist; /* rest from output */
+- }
+- }
+- }
+- else { /* contiguous in window */
+- from += write - op;
+- if (op < len) { /* some from window */
+- len -= op;
+- do {
+- PUP(out) = PUP(from);
+- } while (--op);
+- from = out - dist; /* rest from output */
+- }
+- }
+- while (len > 2) {
+- PUP(out) = PUP(from);
+- PUP(out) = PUP(from);
+- PUP(out) = PUP(from);
+- len -= 3;
+- }
+- if (len) {
+- PUP(out) = PUP(from);
+- if (len > 1)
+- PUP(out) = PUP(from);
+- }
+- }
+- else {
+- from = out - dist; /* copy direct from output */
+- do { /* minimum length is three */
+- PUP(out) = PUP(from);
+- PUP(out) = PUP(from);
+- PUP(out) = PUP(from);
+- len -= 3;
+- } while (len > 2);
+- if (len) {
+- PUP(out) = PUP(from);
+- if (len > 1)
+- PUP(out) = PUP(from);
+- }
+- }
+- }
+- else if ((op & 64) == 0) { /* 2nd level distance code */
+- this = dcode[this.val + (hold & ((1U << op) - 1))];
+- goto dodist;
+- }
+- else {
+- strm->msg = (char *)"invalid distance code";
+- state->mode = BAD;
+- break;
+- }
+- }
+- else if ((op & 64) == 0) { /* 2nd level length code */
+- this = lcode[this.val + (hold & ((1U << op) - 1))];
+- goto dolen;
+- }
+- else if (op & 32) { /* end-of-block */
+- Tracevv((stderr, "inflate: end of block\n"));
+- state->mode = TYPE;
+- break;
+- }
+- else {
+- strm->msg = (char *)"invalid literal/length code";
+- state->mode = BAD;
+- break;
+- }
+- } while (in < last && out < end);
+-
+- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
+- len = bits >> 3;
+- in -= len;
+- bits -= len << 3;
+- hold &= (1U << bits) - 1;
+-
+- /* update state and return */
+- strm->next_in = in + OFF;
+- strm->next_out = out + OFF;
+- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
+- strm->avail_out = (unsigned)(out < end ?
+- 257 + (end - out) : 257 - (out - end));
+- state->hold = hold;
+- state->bits = bits;
+- return;
+-}
+-
+-/*
+- inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
+- - Using bit fields for code structure
+- - Different op definition to avoid & for extra bits (do & for table bits)
+- - Three separate decoding do-loops for direct, window, and write == 0
+- - Special case for distance > 1 copies to do overlapped load and store copy
+- - Explicit branch predictions (based on measured branch probabilities)
+- - Deferring match copy and interspersed it with decoding subsequent codes
+- - Swapping literal/length else
+- - Swapping window/direct else
+- - Larger unrolled copy loops (three is about right)
+- - Moving len -= 3 statement into middle of loop
+- */
+-
+-#endif /* !ASMINF */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inffast.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,35 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inffast.h -- header to use inffast.c
+- * Copyright (C) 1995-2003 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* WARNING: this file should *not* be used by applications. It is
+- part of the implementation of the compression library and is
+- subject to change. Applications should only use zlib.h.
+- */
+-
+-void inflate_fast OF((z_streamp strm, unsigned start));
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,118 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+- /* inffixed.h -- table for decoding fixed codes
+- * Generated automatically by makefixed().
+- */
+-
+- /* WARNING: this file should *not* be used by applications. It
+- is part of the implementation of the compression library and
+- is subject to change. Applications should only use zlib.h.
+- */
+-
+- static const code lenfix[512] = {
+- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
+- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
+- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
+- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
+- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
+- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
+- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
+- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
+- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
+- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
+- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
+- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
+- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
+- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
+- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
+- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
+- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
+- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
+- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
+- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
+- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
+- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
+- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
+- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
+- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
+- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
+- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
+- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
+- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
+- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
+- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
+- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
+- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
+- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
+- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
+- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
+- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
+- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
+- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
+- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
+- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
+- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
+- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
+- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
+- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
+- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
+- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
+- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
+- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
+- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
+- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
+- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
+- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
+- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
+- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
+- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
+- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
+- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
+- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
+- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
+- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
+- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
+- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
+- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
+- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
+- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
+- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
+- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
+- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
+- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
+- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
+- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
+- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
+- {0,9,255}
+- };
+-
+- static const code distfix[32] = {
+- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
+- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
+- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
+- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
+- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
+- {22,5,193},{64,5,0}
+- };
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1392 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inflate.c -- zlib decompression
+- * Copyright (C) 1995-2005 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/*
+- * Change history:
+- *
+- * 1.2.beta0 24 Nov 2002
+- * - First version -- complete rewrite of inflate to simplify code, avoid
+- * creation of window when not needed, minimize use of window when it is
+- * needed, make inffast.c even faster, implement gzip decoding, and to
+- * improve code readability and style over the previous zlib inflate code
+- *
+- * 1.2.beta1 25 Nov 2002
+- * - Use pointers for available input and output checking in inffast.c
+- * - Remove input and output counters in inffast.c
+- * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
+- * - Remove unnecessary second byte pull from length extra in inffast.c
+- * - Unroll direct copy to three copies per loop in inffast.c
+- *
+- * 1.2.beta2 4 Dec 2002
+- * - Change external routine names to reduce potential conflicts
+- * - Correct filename to inffixed.h for fixed tables in inflate.c
+- * - Make hbuf[] unsigned char to match parameter type in inflate.c
+- * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
+- * to avoid negation problem on Alphas (64 bit) in inflate.c
+- *
+- * 1.2.beta3 22 Dec 2002
+- * - Add comments on state->bits assertion in inffast.c
+- * - Add comments on op field in inftrees.h
+- * - Fix bug in reuse of allocated window after inflateReset()
+- * - Remove bit fields--back to byte structure for speed
+- * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
+- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
+- * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
+- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
+- * - Use local copies of stream next and avail values, as well as local bit
+- * buffer and bit count in inflate()--for speed when inflate_fast() not used
+- *
+- * 1.2.beta4 1 Jan 2003
+- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
+- * - Move a comment on output buffer sizes from inffast.c to inflate.c
+- * - Add comments in inffast.c to introduce the inflate_fast() routine
+- * - Rearrange window copies in inflate_fast() for speed and simplification
+- * - Unroll last copy for window match in inflate_fast()
+- * - Use local copies of window variables in inflate_fast() for speed
+- * - Pull out common write == 0 case for speed in inflate_fast()
+- * - Make op and len in inflate_fast() unsigned for consistency
+- * - Add FAR to lcode and dcode declarations in inflate_fast()
+- * - Simplified bad distance check in inflate_fast()
+- * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
+- * source file infback.c to provide a call-back interface to inflate for
+- * programs like gzip and unzip -- uses window as output buffer to avoid
+- * window copying
+- *
+- * 1.2.beta5 1 Jan 2003
+- * - Improved inflateBack() interface to allow the caller to provide initial
+- * input in strm.
+- * - Fixed stored blocks bug in inflateBack()
+- *
+- * 1.2.beta6 4 Jan 2003
+- * - Added comments in inffast.c on effectiveness of POSTINC
+- * - Typecasting all around to reduce compiler warnings
+- * - Changed loops from while (1) or do {} while (1) to for (;;), again to
+- * make compilers happy
+- * - Changed type of window in inflateBackInit() to unsigned char *
+- *
+- * 1.2.beta7 27 Jan 2003
+- * - Changed many types to unsigned or unsigned short to avoid warnings
+- * - Added inflateCopy() function
+- *
+- * 1.2.0 9 Mar 2003
+- * - Changed inflateBack() interface to provide separate opaque descriptors
+- * for the in() and out() functions
+- * - Changed inflateBack() argument and in_func typedef to swap the length
+- * and buffer address return values for the input function
+- * - Check next_in and next_out for Z_NULL on entry to inflate()
+- *
+- * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
+- */
+-
+-#include "zutil.h"
+-#include "inftrees.h"
+-#include "inflate.h"
+-#include "inffast.h"
+-
+-#ifdef MAKEFIXED
+-# ifndef BUILDFIXED
+-# define BUILDFIXED
+-# endif
+-#endif
+-
+-/* function prototypes */
+-local void fixedtables OF((struct inflate_state FAR *state));
+-local int updatewindow OF((z_streamp strm, unsigned out));
+-#ifdef BUILDFIXED
+- void makefixed OF((void));
+-#endif
+-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
+- unsigned len));
+-
+-int ZEXPORT inflateReset(strm)
+-z_streamp strm;
+-{
+- struct inflate_state FAR *state;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- strm->total_in = strm->total_out = state->total = 0;
+- strm->msg = Z_NULL;
+- strm->adler = 1; /* to support ill-conceived Java test suite */
+- state->mode = HEAD;
+- state->last = 0;
+- state->havedict = 0;
+- state->dmax = 32768U;
+- state->head = Z_NULL;
+- state->wsize = 0;
+- state->whave = 0;
+- state->write = 0;
+- state->hold = 0;
+- state->bits = 0;
+- state->lencode = state->distcode = state->next = state->codes;
+- Tracev((stderr, "inflate: reset\n"));
+- return Z_OK;
+-}
+-
+-int ZEXPORT inflatePrime(strm, bits, value)
+-z_streamp strm;
+-int bits;
+-int value;
+-{
+- struct inflate_state FAR *state;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
+- value &= (1L << bits) - 1;
+- state->hold += value << state->bits;
+- state->bits += bits;
+- return Z_OK;
+-}
+-
+-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
+-z_streamp strm;
+-int windowBits;
+-const char *version;
+-int stream_size;
+-{
+- struct inflate_state FAR *state;
+-
+- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+- stream_size != (int)(sizeof(z_stream)))
+- return Z_VERSION_ERROR;
+- if (strm == Z_NULL) return Z_STREAM_ERROR;
+- strm->msg = Z_NULL; /* in case we return an error */
+- if (strm->zalloc == (alloc_func)0) {
+- strm->zalloc = zcalloc;
+- strm->opaque = (voidpf)0;
+- }
+- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+- state = (struct inflate_state FAR *)
+- ZALLOC(strm, 1, sizeof(struct inflate_state));
+- if (state == Z_NULL) return Z_MEM_ERROR;
+- Tracev((stderr, "inflate: allocated\n"));
+- strm->state = (struct internal_state FAR *)state;
+- if (windowBits < 0) {
+- state->wrap = 0;
+- windowBits = -windowBits;
+- }
+- else {
+- state->wrap = (windowBits >> 4) + 1;
+-#ifdef GUNZIP
+- if (windowBits < 48) windowBits &= 15;
+-#endif
+- }
+- if (windowBits < 8 || windowBits > 15) {
+- ZFREE(strm, state);
+- strm->state = Z_NULL;
+- return Z_STREAM_ERROR;
+- }
+- state->wbits = (unsigned)windowBits;
+- state->window = Z_NULL;
+- return inflateReset(strm);
+-}
+-
+-int ZEXPORT inflateInit_(strm, version, stream_size)
+-z_streamp strm;
+-const char *version;
+-int stream_size;
+-{
+- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+-}
+-
+-/*
+- Return state with length and distance decoding tables and index sizes set to
+- fixed code decoding. Normally this returns fixed tables from inffixed.h.
+- If BUILDFIXED is defined, then instead this routine builds the tables the
+- first time it's called, and returns those tables the first time and
+- thereafter. This reduces the size of the code by about 2K bytes, in
+- exchange for a little execution time. However, BUILDFIXED should not be
+- used for threaded applications, since the rewriting of the tables and virgin
+- may not be thread-safe.
+- */
+-local void fixedtables(state)
+-struct inflate_state FAR *state;
+-{
+-#ifdef BUILDFIXED
+- static int virgin = 1;
+- static code *lenfix, *distfix;
+- static code fixed[544];
+-
+- /* build fixed huffman tables if first call (may not be thread safe) */
+- if (virgin) {
+- unsigned sym, bits;
+- static code *next;
+-
+- /* literal/length table */
+- sym = 0;
+- while (sym < 144) state->lens[sym++] = 8;
+- while (sym < 256) state->lens[sym++] = 9;
+- while (sym < 280) state->lens[sym++] = 7;
+- while (sym < 288) state->lens[sym++] = 8;
+- next = fixed;
+- lenfix = next;
+- bits = 9;
+- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+-
+- /* distance table */
+- sym = 0;
+- while (sym < 32) state->lens[sym++] = 5;
+- distfix = next;
+- bits = 5;
+- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+-
+- /* do this just once */
+- virgin = 0;
+- }
+-#else /* !BUILDFIXED */
+-# include "inffixed.h"
+-#endif /* BUILDFIXED */
+- state->lencode = lenfix;
+- state->lenbits = 9;
+- state->distcode = distfix;
+- state->distbits = 5;
+-}
+-
+-#ifdef MAKEFIXED
+-#include <stdio.h>
+-
+-/*
+- Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
+- defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
+- those tables to stdout, which would be piped to inffixed.h. A small program
+- can simply call makefixed to do this:
+-
+- void makefixed(void);
+-
+- int main(void)
+- {
+- makefixed();
+- return 0;
+- }
+-
+- Then that can be linked with zlib built with MAKEFIXED defined and run:
+-
+- a.out > inffixed.h
+- */
+-void makefixed()
+-{
+- unsigned low, size;
+- struct inflate_state state;
+-
+- fixedtables(&state);
+- puts(" /* inffixed.h -- table for decoding fixed codes");
+- puts(" * Generated automatically by makefixed().");
+- puts(" */");
+- puts("");
+- puts(" /* WARNING: this file should *not* be used by applications.");
+- puts(" It is part of the implementation of this library and is");
+- puts(" subject to change. Applications should only use zlib.h.");
+- puts(" */");
+- puts("");
+- size = 1U << 9;
+- printf(" static const code lenfix[%u] = {", size);
+- low = 0;
+- for (;;) {
+- if ((low % 7) == 0) printf("\n ");
+- printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
+- state.lencode[low].val);
+- if (++low == size) break;
+- putchar(',');
+- }
+- puts("\n };");
+- size = 1U << 5;
+- printf("\n static const code distfix[%u] = {", size);
+- low = 0;
+- for (;;) {
+- if ((low % 6) == 0) printf("\n ");
+- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
+- state.distcode[low].val);
+- if (++low == size) break;
+- putchar(',');
+- }
+- puts("\n };");
+-}
+-#endif /* MAKEFIXED */
+-
+-/*
+- Update the window with the last wsize (normally 32K) bytes written before
+- returning. If window does not exist yet, create it. This is only called
+- when a window is already in use, or when output has been written during this
+- inflate call, but the end of the deflate stream has not been reached yet.
+- It is also called to create a window for dictionary data when a dictionary
+- is loaded.
+-
+- Providing output buffers larger than 32K to inflate() should provide a speed
+- advantage, since only the last 32K of output is copied to the sliding window
+- upon return from inflate(), and since all distances after the first 32K of
+- output will fall in the output data, making match copies simpler and faster.
+- The advantage may be dependent on the size of the processor's data caches.
+- */
+-local int updatewindow(strm, out)
+-z_streamp strm;
+-unsigned out;
+-{
+- struct inflate_state FAR *state;
+- unsigned copy, dist;
+-
+- state = (struct inflate_state FAR *)strm->state;
+-
+- /* if it hasn't been done already, allocate space for the window */
+- if (state->window == Z_NULL) {
+- state->window = (unsigned char FAR *)
+- ZALLOC(strm, 1U << state->wbits,
+- sizeof(unsigned char));
+- if (state->window == Z_NULL) return 1;
+- }
+-
+- /* if window not in use yet, initialize */
+- if (state->wsize == 0) {
+- state->wsize = 1U << state->wbits;
+- state->write = 0;
+- state->whave = 0;
+- }
+-
+- /* copy state->wsize or less output bytes into the circular window */
+- copy = out - strm->avail_out;
+- if (copy >= state->wsize) {
+- zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
+- state->write = 0;
+- state->whave = state->wsize;
+- }
+- else {
+- dist = state->wsize - state->write;
+- if (dist > copy) dist = copy;
+- zmemcpy(state->window + state->write, strm->next_out - copy, dist);
+- copy -= dist;
+- if (copy) {
+- zmemcpy(state->window, strm->next_out - copy, copy);
+- state->write = copy;
+- state->whave = state->wsize;
+- }
+- else {
+- state->write += dist;
+- if (state->write == state->wsize) state->write = 0;
+- if (state->whave < state->wsize) state->whave += dist;
+- }
+- }
+- return 0;
+-}
+-
+-/* Macros for inflate(): */
+-
+-/* check function to use adler32() for zlib or crc32() for gzip */
+-#ifdef GUNZIP
+-# define UPDATE(check, buf, len) \
+- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
+-#else
+-# define UPDATE(check, buf, len) adler32(check, buf, len)
+-#endif
+-
+-/* check macros for header crc */
+-#ifdef GUNZIP
+-# define CRC2(check, word) \
+- do { \
+- hbuf[0] = (unsigned char)(word); \
+- hbuf[1] = (unsigned char)((word) >> 8); \
+- check = crc32(check, hbuf, 2); \
+- } while (0)
+-
+-# define CRC4(check, word) \
+- do { \
+- hbuf[0] = (unsigned char)(word); \
+- hbuf[1] = (unsigned char)((word) >> 8); \
+- hbuf[2] = (unsigned char)((word) >> 16); \
+- hbuf[3] = (unsigned char)((word) >> 24); \
+- check = crc32(check, hbuf, 4); \
+- } while (0)
+-#endif
+-
+-/* Load registers with state in inflate() for speed */
+-#define LOAD() \
+- do { \
+- put = strm->next_out; \
+- left = strm->avail_out; \
+- next = strm->next_in; \
+- have = strm->avail_in; \
+- hold = state->hold; \
+- bits = state->bits; \
+- } while (0)
+-
+-/* Restore state from registers in inflate() */
+-#define RESTORE() \
+- do { \
+- strm->next_out = put; \
+- strm->avail_out = left; \
+- strm->next_in = next; \
+- strm->avail_in = have; \
+- state->hold = hold; \
+- state->bits = bits; \
+- } while (0)
+-
+-/* Clear the input bit accumulator */
+-#define INITBITS() \
+- do { \
+- hold = 0; \
+- bits = 0; \
+- } while (0)
+-
+-/* Get a byte of input into the bit accumulator, or return from inflate()
+- if there is no input available. */
+-#define PULLBYTE() \
+- do { \
+- if (have == 0) goto inf_leave; \
+- have--; \
+- hold += (unsigned long)(*next++) << bits; \
+- bits += 8; \
+- } while (0)
+-
+-/* Assure that there are at least n bits in the bit accumulator. If there is
+- not enough available input to do that, then return from inflate(). */
+-#define NEEDBITS(n) \
+- do { \
+- while (bits < (unsigned)(n)) \
+- PULLBYTE(); \
+- } while (0)
+-
+-/* Return the low n bits of the bit accumulator (n < 16) */
+-#define BITS(n) \
+- ((unsigned)hold & ((1U << (n)) - 1))
+-
+-/* Remove n bits from the bit accumulator */
+-#define DROPBITS(n) \
+- do { \
+- hold >>= (n); \
+- bits -= (unsigned)(n); \
+- } while (0)
+-
+-/* Remove zero to seven bits as needed to go to a byte boundary */
+-#define BYTEBITS() \
+- do { \
+- hold >>= bits & 7; \
+- bits -= bits & 7; \
+- } while (0)
+-
+-/* Reverse the bytes in a 32-bit value */
+-#define REVERSE(q) \
+- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+-
+-/*
+- inflate() uses a state machine to process as much input data and generate as
+- much output data as possible before returning. The state machine is
+- structured roughly as follows:
+-
+- for (;;) switch (state) {
+- ...
+- case STATEn:
+- if (not enough input data or output space to make progress)
+- return;
+- ... make progress ...
+- state = STATEm;
+- break;
+- ...
+- }
+-
+- so when inflate() is called again, the same case is attempted again, and
+- if the appropriate resources are provided, the machine proceeds to the
+- next state. The NEEDBITS() macro is usually the way the state evaluates
+- whether it can proceed or should return. NEEDBITS() does the return if
+- the requested bits are not available. The typical use of the BITS macros
+- is:
+-
+- NEEDBITS(n);
+- ... do something with BITS(n) ...
+- DROPBITS(n);
+-
+- where NEEDBITS(n) either returns from inflate() if there isn't enough
+- input left to load n bits into the accumulator, or it continues. BITS(n)
+- gives the low n bits in the accumulator. When done, DROPBITS(n) drops
+- the low n bits off the accumulator. INITBITS() clears the accumulator
+- and sets the number of available bits to zero. BYTEBITS() discards just
+- enough bits to put the accumulator on a byte boundary. After BYTEBITS()
+- and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
+-
+- NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
+- if there is no input available. The decoding of variable length codes uses
+- PULLBYTE() directly in order to pull just enough bytes to decode the next
+- code, and no more.
+-
+- Some states loop until they get enough input, making sure that enough
+- state information is maintained to continue the loop where it left off
+- if NEEDBITS() returns in the loop. For example, want, need, and keep
+- would all have to actually be part of the saved state in case NEEDBITS()
+- returns:
+-
+- case STATEw:
+- while (want < need) {
+- NEEDBITS(n);
+- keep[want++] = BITS(n);
+- DROPBITS(n);
+- }
+- state = STATEx;
+- case STATEx:
+-
+- As shown above, if the next state is also the next case, then the break
+- is omitted.
+-
+- A state may also return if there is not enough output space available to
+- complete that state. Those states are copying stored data, writing a
+- literal byte, and copying a matching string.
+-
+- When returning, a "goto inf_leave" is used to update the total counters,
+- update the check value, and determine whether any progress has been made
+- during that inflate() call in order to return the proper return code.
+- Progress is defined as a change in either strm->avail_in or strm->avail_out.
+- When there is a window, goto inf_leave will update the window with the last
+- output written. If a goto inf_leave occurs in the middle of decompression
+- and there is no window currently, goto inf_leave will create one and copy
+- output to the window for the next call of inflate().
+-
+- In this implementation, the flush parameter of inflate() only affects the
+- return code (per zlib.h). inflate() always writes as much as possible to
+- strm->next_out, given the space available and the provided input--the effect
+- documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
+- the allocation of and copying into a sliding window until necessary, which
+- provides the effect documented in zlib.h for Z_FINISH when the entire input
+- stream available. So the only thing the flush parameter actually does is:
+- when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
+- will return Z_BUF_ERROR if it has not reached the end of the stream.
+- */
+-
+-int ZEXPORT inflate(strm, flush)
+-z_streamp strm;
+-int flush;
+-{
+- struct inflate_state FAR *state;
+- unsigned char FAR *next; /* next input */
+- unsigned char FAR *put; /* next output */
+- unsigned have, left; /* available input and output */
+- unsigned long hold; /* bit buffer */
+- unsigned bits; /* bits in bit buffer */
+- unsigned in, out; /* save starting available input and output */
+- unsigned copy; /* number of stored or match bytes to copy */
+- unsigned char FAR *from; /* where to copy match bytes from */
+- code this; /* current decoding table entry */
+- code last; /* parent table entry */
+- unsigned len; /* length to copy for repeats, bits to drop */
+- int ret; /* return code */
+-#ifdef GUNZIP
+- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
+-#endif
+- static const unsigned short order[19] = /* permutation of code lengths */
+- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+-
+- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
+- (strm->next_in == Z_NULL && strm->avail_in != 0))
+- return Z_STREAM_ERROR;
+-
+- state = (struct inflate_state FAR *)strm->state;
+- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
+- LOAD();
+- in = have;
+- out = left;
+- ret = Z_OK;
+- for (;;)
+- switch (state->mode) {
+- case HEAD:
+- if (state->wrap == 0) {
+- state->mode = TYPEDO;
+- break;
+- }
+- NEEDBITS(16);
+-#ifdef GUNZIP
+- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
+- state->check = crc32(0L, Z_NULL, 0);
+- CRC2(state->check, hold);
+- INITBITS();
+- state->mode = FLAGS;
+- break;
+- }
+- state->flags = 0; /* expect zlib header */
+- if (state->head != Z_NULL)
+- state->head->done = -1;
+- if (!(state->wrap & 1) || /* check if zlib header allowed */
+-#else
+- if (
+-#endif
+- ((BITS(8) << 8) + (hold >> 8)) % 31) {
+- strm->msg = (char *)"incorrect header check";
+- state->mode = BAD;
+- break;
+- }
+- if (BITS(4) != Z_DEFLATED) {
+- strm->msg = (char *)"unknown compression method";
+- state->mode = BAD;
+- break;
+- }
+- DROPBITS(4);
+- len = BITS(4) + 8;
+- if (len > state->wbits) {
+- strm->msg = (char *)"invalid window size";
+- state->mode = BAD;
+- break;
+- }
+- state->dmax = 1U << len;
+- Tracev((stderr, "inflate: zlib header ok\n"));
+- strm->adler = state->check = adler32(0L, Z_NULL, 0);
+- state->mode = hold & 0x200 ? DICTID : TYPE;
+- INITBITS();
+- break;
+-#ifdef GUNZIP
+- case FLAGS:
+- NEEDBITS(16);
+- state->flags = (int)(hold);
+- if ((state->flags & 0xff) != Z_DEFLATED) {
+- strm->msg = (char *)"unknown compression method";
+- state->mode = BAD;
+- break;
+- }
+- if (state->flags & 0xe000) {
+- strm->msg = (char *)"unknown header flags set";
+- state->mode = BAD;
+- break;
+- }
+- if (state->head != Z_NULL)
+- state->head->text = (int)((hold >> 8) & 1);
+- if (state->flags & 0x0200) CRC2(state->check, hold);
+- INITBITS();
+- state->mode = TIME;
+- case TIME:
+- NEEDBITS(32);
+- if (state->head != Z_NULL)
+- state->head->time = hold;
+- if (state->flags & 0x0200) CRC4(state->check, hold);
+- INITBITS();
+- state->mode = OS;
+- case OS:
+- NEEDBITS(16);
+- if (state->head != Z_NULL) {
+- state->head->xflags = (int)(hold & 0xff);
+- state->head->os = (int)(hold >> 8);
+- }
+- if (state->flags & 0x0200) CRC2(state->check, hold);
+- INITBITS();
+- state->mode = EXLEN;
+- case EXLEN:
+- if (state->flags & 0x0400) {
+- NEEDBITS(16);
+- state->length = (unsigned)(hold);
+- if (state->head != Z_NULL)
+- state->head->extra_len = (unsigned)hold;
+- if (state->flags & 0x0200) CRC2(state->check, hold);
+- INITBITS();
+- }
+- else if (state->head != Z_NULL)
+- state->head->extra = Z_NULL;
+- state->mode = EXTRA;
+- case EXTRA:
+- if (state->flags & 0x0400) {
+- copy = state->length;
+- if (copy > have) copy = have;
+- if (copy) {
+- if (state->head != Z_NULL &&
+- state->head->extra != Z_NULL) {
+- len = state->head->extra_len - state->length;
+- zmemcpy(state->head->extra + len, next,
+- len + copy > state->head->extra_max ?
+- state->head->extra_max - len : copy);
+- }
+- if (state->flags & 0x0200)
+- state->check = crc32(state->check, next, copy);
+- have -= copy;
+- next += copy;
+- state->length -= copy;
+- }
+- if (state->length) goto inf_leave;
+- }
+- state->length = 0;
+- state->mode = NAME;
+- case NAME:
+- if (state->flags & 0x0800) {
+- if (have == 0) goto inf_leave;
+- copy = 0;
+- do {
+- len = (unsigned)(next[copy++]);
+- if (state->head != Z_NULL &&
+- state->head->name != Z_NULL &&
+- state->length < state->head->name_max)
+- state->head->name[state->length++] = len;
+- } while (len && copy < have);
+- if (state->flags & 0x0200)
+- state->check = crc32(state->check, next, copy);
+- have -= copy;
+- next += copy;
+- if (len) goto inf_leave;
+- }
+- else if (state->head != Z_NULL)
+- state->head->name = Z_NULL;
+- state->length = 0;
+- state->mode = COMMENT;
+- case COMMENT:
+- if (state->flags & 0x1000) {
+- if (have == 0) goto inf_leave;
+- copy = 0;
+- do {
+- len = (unsigned)(next[copy++]);
+- if (state->head != Z_NULL &&
+- state->head->comment != Z_NULL &&
+- state->length < state->head->comm_max)
+- state->head->comment[state->length++] = len;
+- } while (len && copy < have);
+- if (state->flags & 0x0200)
+- state->check = crc32(state->check, next, copy);
+- have -= copy;
+- next += copy;
+- if (len) goto inf_leave;
+- }
+- else if (state->head != Z_NULL)
+- state->head->comment = Z_NULL;
+- state->mode = HCRC;
+- case HCRC:
+- if (state->flags & 0x0200) {
+- NEEDBITS(16);
+- if (hold != (state->check & 0xffff)) {
+- strm->msg = (char *)"header crc mismatch";
+- state->mode = BAD;
+- break;
+- }
+- INITBITS();
+- }
+- if (state->head != Z_NULL) {
+- state->head->hcrc = (int)((state->flags >> 9) & 1);
+- state->head->done = 1;
+- }
+- strm->adler = state->check = crc32(0L, Z_NULL, 0);
+- state->mode = TYPE;
+- break;
+-#endif
+- case DICTID:
+- NEEDBITS(32);
+- strm->adler = state->check = REVERSE(hold);
+- INITBITS();
+- state->mode = DICT;
+- case DICT:
+- if (state->havedict == 0) {
+- RESTORE();
+- return Z_NEED_DICT;
+- }
+- strm->adler = state->check = adler32(0L, Z_NULL, 0);
+- state->mode = TYPE;
+- case TYPE:
+- if (flush == Z_BLOCK) goto inf_leave;
+- case TYPEDO:
+- if (state->last) {
+- BYTEBITS();
+- state->mode = CHECK;
+- break;
+- }
+- NEEDBITS(3);
+- state->last = BITS(1);
+- DROPBITS(1);
+- switch (BITS(2)) {
+- case 0: /* stored block */
+- Tracev((stderr, "inflate: stored block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = STORED;
+- break;
+- case 1: /* fixed block */
+- fixedtables(state);
+- Tracev((stderr, "inflate: fixed codes block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = LEN; /* decode codes */
+- break;
+- case 2: /* dynamic block */
+- Tracev((stderr, "inflate: dynamic codes block%s\n",
+- state->last ? " (last)" : ""));
+- state->mode = TABLE;
+- break;
+- case 3:
+- strm->msg = (char *)"invalid block type";
+- state->mode = BAD;
+- }
+- DROPBITS(2);
+- break;
+- case STORED:
+- BYTEBITS(); /* go to byte boundary */
+- NEEDBITS(32);
+- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+- strm->msg = (char *)"invalid stored block lengths";
+- state->mode = BAD;
+- break;
+- }
+- state->length = (unsigned)hold & 0xffff;
+- Tracev((stderr, "inflate: stored length %u\n",
+- state->length));
+- INITBITS();
+- state->mode = COPY;
+- case COPY:
+- copy = state->length;
+- if (copy) {
+- if (copy > have) copy = have;
+- if (copy > left) copy = left;
+- if (copy == 0) goto inf_leave;
+- zmemcpy(put, next, copy);
+- have -= copy;
+- next += copy;
+- left -= copy;
+- put += copy;
+- state->length -= copy;
+- break;
+- }
+- Tracev((stderr, "inflate: stored end\n"));
+- state->mode = TYPE;
+- break;
+- case TABLE:
+- NEEDBITS(14);
+- state->nlen = BITS(5) + 257;
+- DROPBITS(5);
+- state->ndist = BITS(5) + 1;
+- DROPBITS(5);
+- state->ncode = BITS(4) + 4;
+- DROPBITS(4);
+-#ifndef PKZIP_BUG_WORKAROUND
+- if (state->nlen > 286 || state->ndist > 30) {
+- strm->msg = (char *)"too many length or distance symbols";
+- state->mode = BAD;
+- break;
+- }
+-#endif
+- Tracev((stderr, "inflate: table sizes ok\n"));
+- state->have = 0;
+- state->mode = LENLENS;
+- case LENLENS:
+- while (state->have < state->ncode) {
+- NEEDBITS(3);
+- state->lens[order[state->have++]] = (unsigned short)BITS(3);
+- DROPBITS(3);
+- }
+- while (state->have < 19)
+- state->lens[order[state->have++]] = 0;
+- state->next = state->codes;
+- state->lencode = (code const FAR *)(state->next);
+- state->lenbits = 7;
+- ret = inflate_table(CODES, state->lens, 19, &(state->next),
+- &(state->lenbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid code lengths set";
+- state->mode = BAD;
+- break;
+- }
+- Tracev((stderr, "inflate: code lengths ok\n"));
+- state->have = 0;
+- state->mode = CODELENS;
+- case CODELENS:
+- while (state->have < state->nlen + state->ndist) {
+- for (;;) {
+- this = state->lencode[BITS(state->lenbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if (this.val < 16) {
+- NEEDBITS(this.bits);
+- DROPBITS(this.bits);
+- state->lens[state->have++] = this.val;
+- }
+- else {
+- if (this.val == 16) {
+- NEEDBITS(this.bits + 2);
+- DROPBITS(this.bits);
+- if (state->have == 0) {
+- strm->msg = (char *)"invalid bit length repeat";
+- state->mode = BAD;
+- break;
+- }
+- len = state->lens[state->have - 1];
+- copy = 3 + BITS(2);
+- DROPBITS(2);
+- }
+- else if (this.val == 17) {
+- NEEDBITS(this.bits + 3);
+- DROPBITS(this.bits);
+- len = 0;
+- copy = 3 + BITS(3);
+- DROPBITS(3);
+- }
+- else {
+- NEEDBITS(this.bits + 7);
+- DROPBITS(this.bits);
+- len = 0;
+- copy = 11 + BITS(7);
+- DROPBITS(7);
+- }
+- if (state->have + copy > state->nlen + state->ndist) {
+- strm->msg = (char *)"invalid bit length repeat";
+- state->mode = BAD;
+- break;
+- }
+- while (copy--)
+- state->lens[state->have++] = (unsigned short)len;
+- }
+- }
+-
+- /* handle error breaks in while */
+- if (state->mode == BAD) break;
+-
+- /* build code tables */
+- state->next = state->codes;
+- state->lencode = (code const FAR *)(state->next);
+- state->lenbits = 9;
+- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+- &(state->lenbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid literal/lengths set";
+- state->mode = BAD;
+- break;
+- }
+- state->distcode = (code const FAR *)(state->next);
+- state->distbits = 6;
+- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+- &(state->next), &(state->distbits), state->work);
+- if (ret) {
+- strm->msg = (char *)"invalid distances set";
+- state->mode = BAD;
+- break;
+- }
+- Tracev((stderr, "inflate: codes ok\n"));
+- state->mode = LEN;
+- case LEN:
+- if (have >= 6 && left >= 258) {
+- RESTORE();
+- inflate_fast(strm, out);
+- LOAD();
+- break;
+- }
+- for (;;) {
+- this = state->lencode[BITS(state->lenbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if (this.op && (this.op & 0xf0) == 0) {
+- last = this;
+- for (;;) {
+- this = state->lencode[last.val +
+- (BITS(last.bits + last.op) >> last.bits)];
+- if ((unsigned)(last.bits + this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- DROPBITS(last.bits);
+- }
+- DROPBITS(this.bits);
+- state->length = (unsigned)this.val;
+- if ((int)(this.op) == 0) {
+- Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+- "inflate: literal '%c'\n" :
+- "inflate: literal 0x%02x\n", this.val));
+- state->mode = LIT;
+- break;
+- }
+- if (this.op & 32) {
+- Tracevv((stderr, "inflate: end of block\n"));
+- state->mode = TYPE;
+- break;
+- }
+- if (this.op & 64) {
+- strm->msg = (char *)"invalid literal/length code";
+- state->mode = BAD;
+- break;
+- }
+- state->extra = (unsigned)(this.op) & 15;
+- state->mode = LENEXT;
+- case LENEXT:
+- if (state->extra) {
+- NEEDBITS(state->extra);
+- state->length += BITS(state->extra);
+- DROPBITS(state->extra);
+- }
+- Tracevv((stderr, "inflate: length %u\n", state->length));
+- state->mode = DIST;
+- case DIST:
+- for (;;) {
+- this = state->distcode[BITS(state->distbits)];
+- if ((unsigned)(this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- if ((this.op & 0xf0) == 0) {
+- last = this;
+- for (;;) {
+- this = state->distcode[last.val +
+- (BITS(last.bits + last.op) >> last.bits)];
+- if ((unsigned)(last.bits + this.bits) <= bits) break;
+- PULLBYTE();
+- }
+- DROPBITS(last.bits);
+- }
+- DROPBITS(this.bits);
+- if (this.op & 64) {
+- strm->msg = (char *)"invalid distance code";
+- state->mode = BAD;
+- break;
+- }
+- state->offset = (unsigned)this.val;
+- state->extra = (unsigned)(this.op) & 15;
+- state->mode = DISTEXT;
+- case DISTEXT:
+- if (state->extra) {
+- NEEDBITS(state->extra);
+- state->offset += BITS(state->extra);
+- DROPBITS(state->extra);
+- }
+-#ifdef INFLATE_STRICT
+- if (state->offset > state->dmax) {
+- strm->msg = (char *)"invalid distance too far back";
+- state->mode = BAD;
+- break;
+- }
+-#endif
+- if (state->offset > state->whave + out - left) {
+- strm->msg = (char *)"invalid distance too far back";
+- state->mode = BAD;
+- break;
+- }
+- Tracevv((stderr, "inflate: distance %u\n", state->offset));
+- state->mode = MATCH;
+- case MATCH:
+- if (left == 0) goto inf_leave;
+- copy = out - left;
+- if (state->offset > copy) { /* copy from window */
+- copy = state->offset - copy;
+- if (copy > state->write) {
+- copy -= state->write;
+- from = state->window + (state->wsize - copy);
+- }
+- else
+- from = state->window + (state->write - copy);
+- if (copy > state->length) copy = state->length;
+- }
+- else { /* copy from output */
+- from = put - state->offset;
+- copy = state->length;
+- }
+- if (copy > left) copy = left;
+- left -= copy;
+- state->length -= copy;
+- do {
+- *put++ = *from++;
+- } while (--copy);
+- if (state->length == 0) state->mode = LEN;
+- break;
+- case LIT:
+- if (left == 0) goto inf_leave;
+- *put++ = (unsigned char)(state->length);
+- left--;
+- state->mode = LEN;
+- break;
+- case CHECK:
+- if (state->wrap) {
+- NEEDBITS(32);
+- out -= left;
+- strm->total_out += out;
+- state->total += out;
+- if (out)
+- strm->adler = state->check =
+- UPDATE(state->check, put - out, out);
+- out = left;
+- if ((
+-#ifdef GUNZIP
+- state->flags ? hold :
+-#endif
+- REVERSE(hold)) != state->check) {
+- strm->msg = (char *)"incorrect data check";
+- state->mode = BAD;
+- break;
+- }
+- INITBITS();
+- Tracev((stderr, "inflate: check matches trailer\n"));
+- }
+-#ifdef GUNZIP
+- state->mode = LENGTH;
+- case LENGTH:
+- if (state->wrap && state->flags) {
+- NEEDBITS(32);
+- if (hold != (state->total & 0xffffffffUL)) {
+- strm->msg = (char *)"incorrect length check";
+- state->mode = BAD;
+- break;
+- }
+- INITBITS();
+- Tracev((stderr, "inflate: length matches trailer\n"));
+- }
+-#endif
+- state->mode = DONE;
+- case DONE:
+- ret = Z_STREAM_END;
+- goto inf_leave;
+- case BAD:
+- ret = Z_DATA_ERROR;
+- goto inf_leave;
+- case MEM:
+- return Z_MEM_ERROR;
+- case SYNC:
+- default:
+- return Z_STREAM_ERROR;
+- }
+-
+- /*
+- Return from inflate(), updating the total counts and the check value.
+- If there was no progress during the inflate() call, return a buffer
+- error. Call updatewindow() to create and/or update the window state.
+- Note: a memory error from inflate() is non-recoverable.
+- */
+- inf_leave:
+- RESTORE();
+- if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
+- if (updatewindow(strm, out)) {
+- state->mode = MEM;
+- return Z_MEM_ERROR;
+- }
+- in -= strm->avail_in;
+- out -= strm->avail_out;
+- strm->total_in += in;
+- strm->total_out += out;
+- state->total += out;
+- if (state->wrap && out)
+- strm->adler = state->check =
+- UPDATE(state->check, strm->next_out - out, out);
+- strm->data_type = state->bits + (state->last ? 64 : 0) +
+- (state->mode == TYPE ? 128 : 0);
+- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
+- ret = Z_BUF_ERROR;
+- return ret;
+-}
+-
+-int ZEXPORT inflateEnd(strm)
+-z_streamp strm;
+-{
+- struct inflate_state FAR *state;
+- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+- return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- if (state->window != Z_NULL) ZFREE(strm, state->window);
+- ZFREE(strm, strm->state);
+- strm->state = Z_NULL;
+- Tracev((stderr, "inflate: end\n"));
+- return Z_OK;
+-}
+-
+-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
+-z_streamp strm;
+-const Bytef *dictionary;
+-uInt dictLength;
+-{
+- struct inflate_state FAR *state;
+- unsigned long id;
+-
+- /* check state */
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- if (state->wrap != 0 && state->mode != DICT)
+- return Z_STREAM_ERROR;
+-
+- /* check for correct dictionary id */
+- if (state->mode == DICT) {
+- id = adler32(0L, Z_NULL, 0);
+- id = adler32(id, dictionary, dictLength);
+- if (id != state->check)
+- return Z_DATA_ERROR;
+- }
+-
+- /* copy dictionary to window */
+- if (updatewindow(strm, strm->avail_out)) {
+- state->mode = MEM;
+- return Z_MEM_ERROR;
+- }
+- if (dictLength > state->wsize) {
+- zmemcpy(state->window, dictionary + dictLength - state->wsize,
+- state->wsize);
+- state->whave = state->wsize;
+- }
+- else {
+- zmemcpy(state->window + state->wsize - dictLength, dictionary,
+- dictLength);
+- state->whave = dictLength;
+- }
+- state->havedict = 1;
+- Tracev((stderr, "inflate: dictionary set\n"));
+- return Z_OK;
+-}
+-
+-int ZEXPORT inflateGetHeader(strm, head)
+-z_streamp strm;
+-gz_headerp head;
+-{
+- struct inflate_state FAR *state;
+-
+- /* check state */
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
+-
+- /* save header structure */
+- state->head = head;
+- head->done = 0;
+- return Z_OK;
+-}
+-
+-/*
+- Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
+- or when out of input. When called, *have is the number of pattern bytes
+- found in order so far, in 0..3. On return *have is updated to the new
+- state. If on return *have equals four, then the pattern was found and the
+- return value is how many bytes were read including the last byte of the
+- pattern. If *have is less than four, then the pattern has not been found
+- yet and the return value is len. In the latter case, syncsearch() can be
+- called again with more data and the *have state. *have is initialized to
+- zero for the first call.
+- */
+-local unsigned syncsearch(have, buf, len)
+-unsigned FAR *have;
+-unsigned char FAR *buf;
+-unsigned len;
+-{
+- unsigned got;
+- unsigned next;
+-
+- got = *have;
+- next = 0;
+- while (next < len && got < 4) {
+- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
+- got++;
+- else if (buf[next])
+- got = 0;
+- else
+- got = 4 - got;
+- next++;
+- }
+- *have = got;
+- return next;
+-}
+-
+-int ZEXPORT inflateSync(strm)
+-z_streamp strm;
+-{
+- unsigned len; /* number of bytes to look at or looked at */
+- unsigned long in, out; /* temporary to save total_in and total_out */
+- unsigned char buf[4]; /* to restore bit buffer to byte string */
+- struct inflate_state FAR *state;
+-
+- /* check parameters */
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
+-
+- /* if first time, start search in bit buffer */
+- if (state->mode != SYNC) {
+- state->mode = SYNC;
+- state->hold <<= state->bits & 7;
+- state->bits -= state->bits & 7;
+- len = 0;
+- while (state->bits >= 8) {
+- buf[len++] = (unsigned char)(state->hold);
+- state->hold >>= 8;
+- state->bits -= 8;
+- }
+- state->have = 0;
+- syncsearch(&(state->have), buf, len);
+- }
+-
+- /* search available input */
+- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
+- strm->avail_in -= len;
+- strm->next_in += len;
+- strm->total_in += len;
+-
+- /* return no joy or set up to restart inflate() on a new block */
+- if (state->have != 4) return Z_DATA_ERROR;
+- in = strm->total_in; out = strm->total_out;
+- inflateReset(strm);
+- strm->total_in = in; strm->total_out = out;
+- state->mode = TYPE;
+- return Z_OK;
+-}
+-
+-/*
+- Returns true if inflate is currently at the end of a block generated by
+- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+- implementation to provide an additional safety check. PPP uses
+- Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
+- block. When decompressing, PPP checks that at the end of input packet,
+- inflate is waiting for these length bytes.
+- */
+-int ZEXPORT inflateSyncPoint(strm)
+-z_streamp strm;
+-{
+- struct inflate_state FAR *state;
+-
+- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)strm->state;
+- return state->mode == STORED && state->bits == 0;
+-}
+-
+-int ZEXPORT inflateCopy(dest, source)
+-z_streamp dest;
+-z_streamp source;
+-{
+- struct inflate_state FAR *state;
+- struct inflate_state FAR *copy;
+- unsigned char FAR *window;
+- unsigned wsize;
+-
+- /* check input */
+- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
+- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
+- return Z_STREAM_ERROR;
+- state = (struct inflate_state FAR *)source->state;
+-
+- /* allocate space */
+- copy = (struct inflate_state FAR *)
+- ZALLOC(source, 1, sizeof(struct inflate_state));
+- if (copy == Z_NULL) return Z_MEM_ERROR;
+- window = Z_NULL;
+- if (state->window != Z_NULL) {
+- window = (unsigned char FAR *)
+- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
+- if (window == Z_NULL) {
+- ZFREE(source, copy);
+- return Z_MEM_ERROR;
+- }
+- }
+-
+- /* copy state */
+- zmemcpy(dest, source, sizeof(z_stream));
+- zmemcpy(copy, state, sizeof(struct inflate_state));
+- if (state->lencode >= state->codes &&
+- state->lencode <= state->codes + ENOUGH - 1) {
+- copy->lencode = copy->codes + (state->lencode - state->codes);
+- copy->distcode = copy->codes + (state->distcode - state->codes);
+- }
+- copy->next = copy->codes + (state->next - state->codes);
+- if (window != Z_NULL) {
+- wsize = 1U << state->wbits;
+- zmemcpy(window, state->window, wsize);
+- }
+- copy->window = window;
+- dest->state = (struct internal_state FAR *)copy;
+- return Z_OK;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inflate.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,139 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inflate.h -- internal inflate state definition
+- * Copyright (C) 1995-2004 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* WARNING: this file should *not* be used by applications. It is
+- part of the implementation of the compression library and is
+- subject to change. Applications should only use zlib.h.
+- */
+-
+-/* define NO_GZIP when compiling if you want to disable gzip header and
+- trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
+- the crc code when it is not needed. For shared libraries, gzip decoding
+- should be left enabled. */
+-#ifndef NO_GZIP
+-# define GUNZIP
+-#endif
+-
+-/* Possible inflate modes between inflate() calls */
+-typedef enum {
+- HEAD, /* i: waiting for magic header */
+- FLAGS, /* i: waiting for method and flags (gzip) */
+- TIME, /* i: waiting for modification time (gzip) */
+- OS, /* i: waiting for extra flags and operating system (gzip) */
+- EXLEN, /* i: waiting for extra length (gzip) */
+- EXTRA, /* i: waiting for extra bytes (gzip) */
+- NAME, /* i: waiting for end of file name (gzip) */
+- COMMENT, /* i: waiting for end of comment (gzip) */
+- HCRC, /* i: waiting for header crc (gzip) */
+- DICTID, /* i: waiting for dictionary check value */
+- DICT, /* waiting for inflateSetDictionary() call */
+- TYPE, /* i: waiting for type bits, including last-flag bit */
+- TYPEDO, /* i: same, but skip check to exit inflate on new block */
+- STORED, /* i: waiting for stored size (length and complement) */
+- COPY, /* i/o: waiting for input or output to copy stored block */
+- TABLE, /* i: waiting for dynamic block table lengths */
+- LENLENS, /* i: waiting for code length code lengths */
+- CODELENS, /* i: waiting for length/lit and distance code lengths */
+- LEN, /* i: waiting for length/lit code */
+- LENEXT, /* i: waiting for length extra bits */
+- DIST, /* i: waiting for distance code */
+- DISTEXT, /* i: waiting for distance extra bits */
+- MATCH, /* o: waiting for output space to copy string */
+- LIT, /* o: waiting for output space to write literal */
+- CHECK, /* i: waiting for 32-bit check value */
+- LENGTH, /* i: waiting for 32-bit length (gzip) */
+- DONE, /* finished check, done -- remain here until reset */
+- BAD, /* got a data error -- remain here until reset */
+- MEM, /* got an inflate() memory error -- remain here until reset */
+- SYNC /* looking for synchronization bytes to restart inflate() */
+-} inflate_mode;
+-
+-/*
+- State transitions between above modes -
+-
+- (most modes can go to the BAD or MEM mode -- not shown for clarity)
+-
+- Process header:
+- HEAD -> (gzip) or (zlib)
+- (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
+- NAME -> COMMENT -> HCRC -> TYPE
+- (zlib) -> DICTID or TYPE
+- DICTID -> DICT -> TYPE
+- Read deflate blocks:
+- TYPE -> STORED or TABLE or LEN or CHECK
+- STORED -> COPY -> TYPE
+- TABLE -> LENLENS -> CODELENS -> LEN
+- Read deflate codes:
+- LEN -> LENEXT or LIT or TYPE
+- LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
+- LIT -> LEN
+- Process trailer:
+- CHECK -> LENGTH -> DONE
+- */
+-
+-/* state maintained between inflate() calls. Approximately 7K bytes. */
+-struct inflate_state {
+- inflate_mode mode; /* current inflate mode */
+- int last; /* true if processing last block */
+- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+- int havedict; /* true if dictionary provided */
+- int flags; /* gzip header method and flags (0 if zlib) */
+- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
+- unsigned long check; /* protected copy of check value */
+- unsigned long total; /* protected copy of output count */
+- gz_headerp head; /* where to save gzip header information */
+- /* sliding window */
+- unsigned wbits; /* log base 2 of requested window size */
+- unsigned wsize; /* window size or zero if not using window */
+- unsigned whave; /* valid bytes in the window */
+- unsigned write; /* window write index */
+- unsigned char FAR *window; /* allocated sliding window, if needed */
+- /* bit accumulator */
+- unsigned long hold; /* input bit accumulator */
+- unsigned bits; /* number of bits in "in" */
+- /* for string and stored block copying */
+- unsigned length; /* literal or length of data to copy */
+- unsigned offset; /* distance back to copy string from */
+- /* for table and code decoding */
+- unsigned extra; /* extra bits needed */
+- /* fixed and dynamic code tables */
+- code const FAR *lencode; /* starting table for length/literal codes */
+- code const FAR *distcode; /* starting table for distance codes */
+- unsigned lenbits; /* index bits for lencode */
+- unsigned distbits; /* index bits for distcode */
+- /* dynamic table building */
+- unsigned ncode; /* number of code length code lengths */
+- unsigned nlen; /* number of length code lengths */
+- unsigned ndist; /* number of distance code lengths */
+- unsigned have; /* number of code lengths in lens[] */
+- code FAR *next; /* next available space in codes[] */
+- unsigned short lens[320]; /* temporary storage for code lengths */
+- unsigned short work[288]; /* work area for code table building */
+- code codes[ENOUGH]; /* space for code tables */
+-};
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,353 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inftrees.c -- generate Huffman trees for efficient decoding
+- * Copyright (C) 1995-2005 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-#include "zutil.h"
+-#include "inftrees.h"
+-
+-#define MAXBITS 15
+-
+-const char inflate_copyright[] =
+- " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
+-/*
+- If you use the zlib library in a product, an acknowledgment is welcome
+- in the documentation of your product. If for some reason you cannot
+- include such an acknowledgment, I would appreciate that you keep this
+- copyright string in the executable of your product.
+- */
+-
+-/*
+- Build a set of tables to decode the provided canonical Huffman code.
+- The code lengths are lens[0..codes-1]. The result starts at *table,
+- whose indices are 0..2^bits-1. work is a writable array of at least
+- lens shorts, which is used as a work area. type is the type of code
+- to be generated, CODES, LENS, or DISTS. On return, zero is success,
+- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
+- on return points to the next available entry's address. bits is the
+- requested root table index bits, and on return it is the actual root
+- table index bits. It will differ if the request is greater than the
+- longest code or if it is less than the shortest code.
+- */
+-int inflate_table(type, lens, codes, table, bits, work)
+-codetype type;
+-unsigned short FAR *lens;
+-unsigned codes;
+-code FAR * FAR *table;
+-unsigned FAR *bits;
+-unsigned short FAR *work;
+-{
+- unsigned len; /* a code's length in bits */
+- unsigned sym; /* index of code symbols */
+- unsigned min, max; /* minimum and maximum code lengths */
+- unsigned root; /* number of index bits for root table */
+- unsigned curr; /* number of index bits for current table */
+- unsigned drop; /* code bits to drop for sub-table */
+- int left; /* number of prefix codes available */
+- unsigned used; /* code entries in table used */
+- unsigned huff; /* Huffman code */
+- unsigned incr; /* for incrementing code, index */
+- unsigned fill; /* index for replicating entries */
+- unsigned low; /* low bits for current root entry */
+- unsigned mask; /* mask for low root bits */
+- code this; /* table entry for duplication */
+- code FAR *next; /* next available space in table */
+- const unsigned short FAR *base; /* base value table to use */
+- const unsigned short FAR *extra; /* extra bits table to use */
+- int end; /* use base and extra for symbol > end */
+- unsigned short count[MAXBITS+1]; /* number of codes of each length */
+- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
+- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
+- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
+- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
+- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
+- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
+- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+- 8193, 12289, 16385, 24577, 0, 0};
+- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
+- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
+- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
+- 28, 28, 29, 29, 64, 64};
+-
+- /*
+- Process a set of code lengths to create a canonical Huffman code. The
+- code lengths are lens[0..codes-1]. Each length corresponds to the
+- symbols 0..codes-1. The Huffman code is generated by first sorting the
+- symbols by length from short to long, and retaining the symbol order
+- for codes with equal lengths. Then the code starts with all zero bits
+- for the first code of the shortest length, and the codes are integer
+- increments for the same length, and zeros are appended as the length
+- increases. For the deflate format, these bits are stored backwards
+- from their more natural integer increment ordering, and so when the
+- decoding tables are built in the large loop below, the integer codes
+- are incremented backwards.
+-
+- This routine assumes, but does not check, that all of the entries in
+- lens[] are in the range 0..MAXBITS. The caller must assure this.
+- 1..MAXBITS is interpreted as that code length. zero means that that
+- symbol does not occur in this code.
+-
+- The codes are sorted by computing a count of codes for each length,
+- creating from that a table of starting indices for each length in the
+- sorted table, and then entering the symbols in order in the sorted
+- table. The sorted table is work[], with that space being provided by
+- the caller.
+-
+- The length counts are used for other purposes as well, i.e. finding
+- the minimum and maximum length codes, determining if there are any
+- codes at all, checking for a valid set of lengths, and looking ahead
+- at length counts to determine sub-table sizes when building the
+- decoding tables.
+- */
+-
+- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
+- for (len = 0; len <= MAXBITS; len++)
+- count[len] = 0;
+- for (sym = 0; sym < codes; sym++)
+- count[lens[sym]]++;
+-
+- /* bound code lengths, force root to be within code lengths */
+- root = *bits;
+- for (max = MAXBITS; max >= 1; max--)
+- if (count[max] != 0) break;
+- if (root > max) root = max;
+- if (max == 0) { /* no symbols to code at all */
+- this.op = (unsigned char)64; /* invalid code marker */
+- this.bits = (unsigned char)1;
+- this.val = (unsigned short)0;
+- *(*table)++ = this; /* make a table to force an error */
+- *(*table)++ = this;
+- *bits = 1;
+- return 0; /* no symbols, but wait for decoding to report error */
+- }
+- for (min = 1; min <= MAXBITS; min++)
+- if (count[min] != 0) break;
+- if (root < min) root = min;
+-
+- /* check for an over-subscribed or incomplete set of lengths */
+- left = 1;
+- for (len = 1; len <= MAXBITS; len++) {
+- left <<= 1;
+- left -= count[len];
+- if (left < 0) return -1; /* over-subscribed */
+- }
+- if (left > 0 && (type == CODES || max != 1))
+- return -1; /* incomplete set */
+-
+- /* generate offsets into symbol table for each length for sorting */
+- offs[1] = 0;
+- for (len = 1; len < MAXBITS; len++)
+- offs[len + 1] = offs[len] + count[len];
+-
+- /* sort symbols by length, by symbol order within each length */
+- for (sym = 0; sym < codes; sym++)
+- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
+-
+- /*
+- Create and fill in decoding tables. In this loop, the table being
+- filled is at next and has curr index bits. The code being used is huff
+- with length len. That code is converted to an index by dropping drop
+- bits off of the bottom. For codes where len is less than drop + curr,
+- those top drop + curr - len bits are incremented through all values to
+- fill the table with replicated entries.
+-
+- root is the number of index bits for the root table. When len exceeds
+- root, sub-tables are created pointed to by the root entry with an index
+- of the low root bits of huff. This is saved in low to check for when a
+- new sub-table should be started. drop is zero when the root table is
+- being filled, and drop is root when sub-tables are being filled.
+-
+- When a new sub-table is needed, it is necessary to look ahead in the
+- code lengths to determine what size sub-table is needed. The length
+- counts are used for this, and so count[] is decremented as codes are
+- entered in the tables.
+-
+- used keeps track of how many table entries have been allocated from the
+- provided *table space. It is checked when a LENS table is being made
+- against the space in *table, ENOUGH, minus the maximum space needed by
+- the worst case distance code, MAXD. This should never happen, but the
+- sufficiency of ENOUGH has not been proven exhaustively, hence the check.
+- This assumes that when type == LENS, bits == 9.
+-
+- sym increments through all symbols, and the loop terminates when
+- all codes of length max, i.e. all codes, have been processed. This
+- routine permits incomplete codes, so another loop after this one fills
+- in the rest of the decoding tables with invalid code markers.
+- */
+-
+- /* set up for code type */
+- switch (type) {
+- case CODES:
+- base = extra = work; /* dummy value--not used */
+- end = 19;
+- break;
+- case LENS:
+- base = lbase;
+- base -= 257;
+- extra = lext;
+- extra -= 257;
+- end = 256;
+- break;
+- default: /* DISTS */
+- base = dbase;
+- extra = dext;
+- end = -1;
+- }
+-
+- /* initialize state for loop */
+- huff = 0; /* starting code */
+- sym = 0; /* starting code symbol */
+- len = min; /* starting code length */
+- next = *table; /* current table to fill in */
+- curr = root; /* current table index bits */
+- drop = 0; /* current bits to drop from code for index */
+- low = (unsigned)(-1); /* trigger new sub-table when len > root */
+- used = 1U << root; /* use root table entries */
+- mask = used - 1; /* mask for comparing low */
+-
+- /* check available table space */
+- if (type == LENS && used >= ENOUGH - MAXD)
+- return 1;
+-
+- /* process all codes and make table entries */
+- for (;;) {
+- /* create table entry */
+- this.bits = (unsigned char)(len - drop);
+- if ((int)(work[sym]) < end) {
+- this.op = (unsigned char)0;
+- this.val = work[sym];
+- }
+- else if ((int)(work[sym]) > end) {
+- this.op = (unsigned char)(extra[work[sym]]);
+- this.val = base[work[sym]];
+- }
+- else {
+- this.op = (unsigned char)(32 + 64); /* end of block */
+- this.val = 0;
+- }
+-
+- /* replicate for those indices with low len bits equal to huff */
+- incr = 1U << (len - drop);
+- fill = 1U << curr;
+- min = fill; /* save offset to next table */
+- do {
+- fill -= incr;
+- next[(huff >> drop) + fill] = this;
+- } while (fill != 0);
+-
+- /* backwards increment the len-bit code huff */
+- incr = 1U << (len - 1);
+- while (huff & incr)
+- incr >>= 1;
+- if (incr != 0) {
+- huff &= incr - 1;
+- huff += incr;
+- }
+- else
+- huff = 0;
+-
+- /* go to next symbol, update count, len */
+- sym++;
+- if (--(count[len]) == 0) {
+- if (len == max) break;
+- len = lens[work[sym]];
+- }
+-
+- /* create new sub-table if needed */
+- if (len > root && (huff & mask) != low) {
+- /* if first time, transition to sub-tables */
+- if (drop == 0)
+- drop = root;
+-
+- /* increment past last table */
+- next += min; /* here min is 1 << curr */
+-
+- /* determine length of next table */
+- curr = len - drop;
+- left = (int)(1 << curr);
+- while (curr + drop < max) {
+- left -= count[curr + drop];
+- if (left <= 0) break;
+- curr++;
+- left <<= 1;
+- }
+-
+- /* check for enough space */
+- used += 1U << curr;
+- if (type == LENS && used >= ENOUGH - MAXD)
+- return 1;
+-
+- /* point entry in root table to sub-table */
+- low = huff & mask;
+- (*table)[low].op = (unsigned char)curr;
+- (*table)[low].bits = (unsigned char)root;
+- (*table)[low].val = (unsigned short)(next - *table);
+- }
+- }
+-
+- /*
+- Fill in rest of table for incomplete codes. This loop is similar to the
+- loop above in incrementing huff for table indices. It is assumed that
+- len is equal to curr + drop, so there is no loop needed to increment
+- through high index bits. When the current sub-table is filled, the loop
+- drops back to the root table to fill in any remaining entries there.
+- */
+- this.op = (unsigned char)64; /* invalid code marker */
+- this.bits = (unsigned char)(len - drop);
+- this.val = (unsigned short)0;
+- while (huff != 0) {
+- /* when done with sub-table, drop back to root table */
+- if (drop != 0 && (huff & mask) != low) {
+- drop = 0;
+- len = root;
+- next = *table;
+- this.bits = (unsigned char)len;
+- }
+-
+- /* put invalid code marker in table */
+- next[huff >> drop] = this;
+-
+- /* backwards increment the len-bit code huff */
+- incr = 1U << (len - 1);
+- while (huff & incr)
+- incr >>= 1;
+- if (incr != 0) {
+- huff &= incr - 1;
+- huff += incr;
+- }
+- else
+- huff = 0;
+- }
+-
+- /* set return parameters */
+- *table += used;
+- *bits = root;
+- return 0;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,79 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* inftrees.h -- header to use inftrees.c
+- * Copyright (C) 1995-2005 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* WARNING: this file should *not* be used by applications. It is
+- part of the implementation of the compression library and is
+- subject to change. Applications should only use zlib.h.
+- */
+-
+-/* Structure for decoding tables. Each entry provides either the
+- information needed to do the operation requested by the code that
+- indexed that table entry, or it provides a pointer to another
+- table that indexes more bits of the code. op indicates whether
+- the entry is a pointer to another table, a literal, a length or
+- distance, an end-of-block, or an invalid code. For a table
+- pointer, the low four bits of op is the number of index bits of
+- that table. For a length or distance, the low four bits of op
+- is the number of extra bits to get after the code. bits is
+- the number of bits in this code or part of the code to drop off
+- of the bit buffer. val is the actual byte to output in the case
+- of a literal, the base length or distance, or the offset from
+- the current table to the next table. Each entry is four bytes. */
+-typedef struct {
+- unsigned char op; /* operation, extra bits, table bits */
+- unsigned char bits; /* bits in this part of the code */
+- unsigned short val; /* offset in table or code value */
+-} code;
+-
+-/* op values as set by inflate_table():
+- 00000000 - literal
+- 0000tttt - table link, tttt != 0 is the number of table index bits
+- 0001eeee - length or distance, eeee is the number of extra bits
+- 01100000 - end of block
+- 01000000 - invalid code
+- */
+-
+-/* Maximum size of dynamic tree. The maximum found in a long but non-
+- exhaustive search was 1444 code structures (852 for length/literals
+- and 592 for distances, the latter actually the result of an
+- exhaustive search). The true maximum is not known, but the value
+- below is more than safe. */
+-#define ENOUGH 2048
+-#define MAXD 592
+-
+-/* Type of code to build for inftable() */
+-typedef enum {
+- CODES,
+- LENS,
+- DISTS
+-} codetype;
+-
+-extern int inflate_table OF((codetype type, unsigned short FAR *lens,
+- unsigned codes, code FAR * FAR *table,
+- unsigned FAR *bits, unsigned short FAR *work));
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,10 +0,0 @@
+-(1)renamed
+- adler32.c -> zadler32.c
+- zcrc32c -> zcrc32.c
+-
+-(2)added _LP64 to make uLong a 32-bit int on 64-bit platform
+- zconf.h:
+- uLong -> 32-bit int
+-
+-(3)updated crc32.c/crc32()
+- unsigned long -> uLong
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,25 +0,0 @@
+---- /home/sherman/TL/zlib-1.2.3_ORG/crc32.c Sun Jun 12 16:56:07 2005
+-+++ zcrc32.c Tue Aug 25 14:22:41 2009
+-@@ -216,8 +216,8 @@
+- #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+-
+- /* ========================================================================= */
+--unsigned long ZEXPORT crc32(crc, buf, len)
+-- unsigned long crc;
+-+uLong ZEXPORT crc32(crc, buf, len)
+-+ uLong crc;
+- const unsigned char FAR *buf;
+- unsigned len;
+- {
+-@@ -234,9 +234,9 @@
+-
+- endian = 1;
+- if (*((unsigned char *)(&endian)))
+-- return crc32_little(crc, buf, len);
+-+ return (uLong)crc32_little(crc, buf, len);
+- else
+-- return crc32_big(crc, buf, len);
+-+ return (uLong)crc32_big(crc, buf, len);
+- }
+- #endif /* BYFOUR */
+- crc = crc ^ 0xffffffffUL;
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,11 +0,0 @@
+---- /home/sherman/TL/zlib-1.2.3_ORG/inflate.c Tue Jun 14 14:50:12 2005
+-+++ inflate.c Tue Aug 25 14:22:09 2009
+-@@ -1263,7 +1263,7 @@
+- z_streamp strm;
+- {
+- unsigned len; /* number of bytes to look at or looked at */
+-- unsigned long in, out; /* temporary to save total_in and total_out */
+-+ long long in, out; /* temporary to save total_in and total_out */
+- unsigned char buf[4]; /* to restore bit buffer to byte string */
+- struct inflate_state FAR *state;
+-
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,24 +0,0 @@
+---- /home/sherman/TL/zlib-1.2.3_ORG/zconf.h Fri May 27 23:40:35 2005
+-+++ zconf.h Tue Aug 25 14:22:28 2009
+-@@ -8,6 +8,9 @@
+- #ifndef ZCONF_H
+- #define ZCONF_H
+-
+-+/* for _LP64 */
+-+#include <sys/types.h>
+-+
+- /*
+- * If you *really* need a unique prefix for all types and library functions,
+- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+-@@ -261,7 +264,11 @@
+- typedef unsigned char Byte; /* 8 bits */
+- #endif
+- typedef unsigned int uInt; /* 16 bits or more */
+-+#ifdef _LP64
+-+typedef unsigned int uLong; /* 32 bits or more */
+-+#else
+- typedef unsigned long uLong; /* 32 bits or more */
+-+#endif
+-
+- #ifdef SMALL_MEDIUM
+- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,25 +0,0 @@
+---- /home/sherman/TL/zlib-1.2.3_ORG/zlib.h Sun Jul 17 19:26:49 2005
+-+++ zlib.h Tue Aug 25 14:22:50 2009
+-@@ -82,11 +82,11 @@
+- typedef struct z_stream_s {
+- Bytef *next_in; /* next input byte */
+- uInt avail_in; /* number of bytes available at next_in */
+-- uLong total_in; /* total nb of input bytes read so far */
+-+ long long total_in; /* total nb of input bytes read so far */
+-
+- Bytef *next_out; /* next output byte should be put there */
+- uInt avail_out; /* remaining free space at next_out */
+-- uLong total_out; /* total nb of bytes output so far */
+-+ long long total_out;/* total nb of bytes output so far */
+-
+- char *msg; /* last error message, NULL if no error */
+- struct internal_state FAR *state; /* not visible by applications */
+-@@ -1348,7 +1348,7 @@
+-
+- ZEXTERN const char * ZEXPORT zError OF((int));
+- ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+--ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+-+ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void));
+-
+- #ifdef __cplusplus
+- }
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1243 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* trees.c -- output deflated data using Huffman coding
+- * Copyright (C) 1995-2005 Jean-loup Gailly
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/*
+- * ALGORITHM
+- *
+- * The "deflation" process uses several Huffman trees. The more
+- * common source values are represented by shorter bit sequences.
+- *
+- * Each code tree is stored in a compressed form which is itself
+- * a Huffman encoding of the lengths of all the code strings (in
+- * ascending order by source values). The actual code strings are
+- * reconstructed from the lengths in the inflate process, as described
+- * in the deflate specification.
+- *
+- * REFERENCES
+- *
+- * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+- * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+- *
+- * Storer, James A.
+- * Data Compression: Methods and Theory, pp. 49-50.
+- * Computer Science Press, 1988. ISBN 0-7167-8156-5.
+- *
+- * Sedgewick, R.
+- * Algorithms, p290.
+- * Addison-Wesley, 1983. ISBN 0-201-06672-6.
+- */
+-
+-/* @(#) $Id$ */
+-
+-/* #define GEN_TREES_H */
+-
+-#include "deflate.h"
+-
+-#ifdef DEBUG
+-# include <ctype.h>
+-#endif
+-
+-/* ===========================================================================
+- * Constants
+- */
+-
+-#define MAX_BL_BITS 7
+-/* Bit length codes must not exceed MAX_BL_BITS bits */
+-
+-#define END_BLOCK 256
+-/* end of block literal code */
+-
+-#define REP_3_6 16
+-/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+-
+-#define REPZ_3_10 17
+-/* repeat a zero length 3-10 times (3 bits of repeat count) */
+-
+-#define REPZ_11_138 18
+-/* repeat a zero length 11-138 times (7 bits of repeat count) */
+-
+-local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+-
+-local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+-
+-local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+-
+-local const uch bl_order[BL_CODES]
+- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+-/* The lengths of the bit length codes are sent in order of decreasing
+- * probability, to avoid transmitting the lengths for unused bit length codes.
+- */
+-
+-#define Buf_size (8 * 2*sizeof(char))
+-/* Number of bits used within bi_buf. (bi_buf might be implemented on
+- * more than 16 bits on some systems.)
+- */
+-
+-/* ===========================================================================
+- * Local data. These are initialized only once.
+- */
+-
+-#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
+-
+-#if defined(GEN_TREES_H) || !defined(STDC)
+-/* non ANSI compilers may not accept trees.h */
+-
+-local ct_data static_ltree[L_CODES+2];
+-/* The static literal tree. Since the bit lengths are imposed, there is no
+- * need for the L_CODES extra codes used during heap construction. However
+- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+- * below).
+- */
+-
+-local ct_data static_dtree[D_CODES];
+-/* The static distance tree. (Actually a trivial tree since all codes use
+- * 5 bits.)
+- */
+-
+-uch _dist_code[DIST_CODE_LEN];
+-/* Distance codes. The first 256 values correspond to the distances
+- * 3 .. 258, the last 256 values correspond to the top 8 bits of
+- * the 15 bit distances.
+- */
+-
+-uch _length_code[MAX_MATCH-MIN_MATCH+1];
+-/* length code for each normalized match length (0 == MIN_MATCH) */
+-
+-local int base_length[LENGTH_CODES];
+-/* First normalized length for each code (0 = MIN_MATCH) */
+-
+-local int base_dist[D_CODES];
+-/* First normalized distance for each code (0 = distance of 1) */
+-
+-#else
+-# include "trees.h"
+-#endif /* GEN_TREES_H */
+-
+-struct static_tree_desc_s {
+- const ct_data *static_tree; /* static tree or NULL */
+- const intf *extra_bits; /* extra bits for each code or NULL */
+- int extra_base; /* base index for extra_bits */
+- int elems; /* max number of elements in the tree */
+- int max_length; /* max bit length for the codes */
+-};
+-
+-local static_tree_desc static_l_desc =
+-{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+-
+-local static_tree_desc static_d_desc =
+-{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
+-
+-local static_tree_desc static_bl_desc =
+-{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
+-
+-/* ===========================================================================
+- * Local (static) routines in this file.
+- */
+-
+-local void tr_static_init OF((void));
+-local void init_block OF((deflate_state *s));
+-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
+-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
+-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
+-local void build_tree OF((deflate_state *s, tree_desc *desc));
+-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
+-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
+-local int build_bl_tree OF((deflate_state *s));
+-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+- int blcodes));
+-local void compress_block OF((deflate_state *s, ct_data *ltree,
+- ct_data *dtree));
+-local void set_data_type OF((deflate_state *s));
+-local unsigned bi_reverse OF((unsigned value, int length));
+-local void bi_windup OF((deflate_state *s));
+-local void bi_flush OF((deflate_state *s));
+-local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
+- int header));
+-
+-#ifdef GEN_TREES_H
+-local void gen_trees_header OF((void));
+-#endif
+-
+-#ifndef DEBUG
+-# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+- /* Send a code of the given tree. c and tree must not have side effects */
+-
+-#else /* DEBUG */
+-# define send_code(s, c, tree) \
+- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
+- send_bits(s, tree[c].Code, tree[c].Len); }
+-#endif
+-
+-/* ===========================================================================
+- * Output a short LSB first on the stream.
+- * IN assertion: there is enough room in pendingBuf.
+- */
+-#define put_short(s, w) { \
+- put_byte(s, (uch)((w) & 0xff)); \
+- put_byte(s, (uch)((ush)(w) >> 8)); \
+-}
+-
+-/* ===========================================================================
+- * Send a value on a given number of bits.
+- * IN assertion: length <= 16 and value fits in length bits.
+- */
+-#ifdef DEBUG
+-local void send_bits OF((deflate_state *s, int value, int length));
+-
+-local void send_bits(s, value, length)
+- deflate_state *s;
+- int value; /* value to send */
+- int length; /* number of bits */
+-{
+- Tracevv((stderr," l %2d v %4x ", length, value));
+- Assert(length > 0 && length <= 15, "invalid length");
+- s->bits_sent += (ulg)length;
+-
+- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+- * unused bits in value.
+- */
+- if (s->bi_valid > (int)Buf_size - length) {
+- s->bi_buf |= (value << s->bi_valid);
+- put_short(s, s->bi_buf);
+- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+- s->bi_valid += length - Buf_size;
+- } else {
+- s->bi_buf |= value << s->bi_valid;
+- s->bi_valid += length;
+- }
+-}
+-#else /* !DEBUG */
+-
+-#define send_bits(s, value, length) \
+-{ int len = length;\
+- if (s->bi_valid > (int)Buf_size - len) {\
+- int val = value;\
+- s->bi_buf |= (val << s->bi_valid);\
+- put_short(s, s->bi_buf);\
+- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+- s->bi_valid += len - Buf_size;\
+- } else {\
+- s->bi_buf |= (value) << s->bi_valid;\
+- s->bi_valid += len;\
+- }\
+-}
+-#endif /* DEBUG */
+-
+-
+-/* the arguments must not have side effects */
+-
+-/* ===========================================================================
+- * Initialize the various 'constant' tables.
+- */
+-local void tr_static_init()
+-{
+-#if defined(GEN_TREES_H) || !defined(STDC)
+- static int static_init_done = 0;
+- int n; /* iterates over tree elements */
+- int bits; /* bit counter */
+- int length; /* length value */
+- int code; /* code value */
+- int dist; /* distance index */
+- ush bl_count[MAX_BITS+1];
+- /* number of codes at each bit length for an optimal tree */
+-
+- if (static_init_done) return;
+-
+- /* For some embedded targets, global variables are not initialized: */
+- static_l_desc.static_tree = static_ltree;
+- static_l_desc.extra_bits = extra_lbits;
+- static_d_desc.static_tree = static_dtree;
+- static_d_desc.extra_bits = extra_dbits;
+- static_bl_desc.extra_bits = extra_blbits;
+-
+- /* Initialize the mapping length (0..255) -> length code (0..28) */
+- length = 0;
+- for (code = 0; code < LENGTH_CODES-1; code++) {
+- base_length[code] = length;
+- for (n = 0; n < (1<<extra_lbits[code]); n++) {
+- _length_code[length++] = (uch)code;
+- }
+- }
+- Assert (length == 256, "tr_static_init: length != 256");
+- /* Note that the length 255 (match length 258) can be represented
+- * in two different ways: code 284 + 5 bits or code 285, so we
+- * overwrite length_code[255] to use the best encoding:
+- */
+- _length_code[length-1] = (uch)code;
+-
+- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+- dist = 0;
+- for (code = 0 ; code < 16; code++) {
+- base_dist[code] = dist;
+- for (n = 0; n < (1<<extra_dbits[code]); n++) {
+- _dist_code[dist++] = (uch)code;
+- }
+- }
+- Assert (dist == 256, "tr_static_init: dist != 256");
+- dist >>= 7; /* from now on, all distances are divided by 128 */
+- for ( ; code < D_CODES; code++) {
+- base_dist[code] = dist << 7;
+- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+- _dist_code[256 + dist++] = (uch)code;
+- }
+- }
+- Assert (dist == 256, "tr_static_init: 256+dist != 512");
+-
+- /* Construct the codes of the static literal tree */
+- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+- n = 0;
+- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+- /* Codes 286 and 287 do not exist, but we must include them in the
+- * tree construction to get a canonical Huffman tree (longest code
+- * all ones)
+- */
+- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+-
+- /* The static distance tree is trivial: */
+- for (n = 0; n < D_CODES; n++) {
+- static_dtree[n].Len = 5;
+- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+- }
+- static_init_done = 1;
+-
+-# ifdef GEN_TREES_H
+- gen_trees_header();
+-# endif
+-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+-}
+-
+-/* ===========================================================================
+- * Genererate the file trees.h describing the static trees.
+- */
+-#ifdef GEN_TREES_H
+-# ifndef DEBUG
+-# include <stdio.h>
+-# endif
+-
+-# define SEPARATOR(i, last, width) \
+- ((i) == (last)? "\n};\n\n" : \
+- ((i) % (width) == (width)-1 ? ",\n" : ", "))
+-
+-void gen_trees_header()
+-{
+- FILE *header = fopen("trees.h", "w");
+- int i;
+-
+- Assert (header != NULL, "Can't open trees.h");
+- fprintf(header,
+- "/* header created automatically with -DGEN_TREES_H */\n\n");
+-
+- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
+- for (i = 0; i < L_CODES+2; i++) {
+- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
+- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+- }
+-
+- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
+- for (i = 0; i < D_CODES; i++) {
+- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
+- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+- }
+-
+- fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
+- for (i = 0; i < DIST_CODE_LEN; i++) {
+- fprintf(header, "%2u%s", _dist_code[i],
+- SEPARATOR(i, DIST_CODE_LEN-1, 20));
+- }
+-
+- fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+- fprintf(header, "%2u%s", _length_code[i],
+- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+- }
+-
+- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
+- for (i = 0; i < LENGTH_CODES; i++) {
+- fprintf(header, "%1u%s", base_length[i],
+- SEPARATOR(i, LENGTH_CODES-1, 20));
+- }
+-
+- fprintf(header, "local const int base_dist[D_CODES] = {\n");
+- for (i = 0; i < D_CODES; i++) {
+- fprintf(header, "%5u%s", base_dist[i],
+- SEPARATOR(i, D_CODES-1, 10));
+- }
+-
+- fclose(header);
+-}
+-#endif /* GEN_TREES_H */
+-
+-/* ===========================================================================
+- * Initialize the tree data structures for a new zlib stream.
+- */
+-void _tr_init(s)
+- deflate_state *s;
+-{
+- tr_static_init();
+-
+- s->l_desc.dyn_tree = s->dyn_ltree;
+- s->l_desc.stat_desc = &static_l_desc;
+-
+- s->d_desc.dyn_tree = s->dyn_dtree;
+- s->d_desc.stat_desc = &static_d_desc;
+-
+- s->bl_desc.dyn_tree = s->bl_tree;
+- s->bl_desc.stat_desc = &static_bl_desc;
+-
+- s->bi_buf = 0;
+- s->bi_valid = 0;
+- s->last_eob_len = 8; /* enough lookahead for inflate */
+-#ifdef DEBUG
+- s->compressed_len = 0L;
+- s->bits_sent = 0L;
+-#endif
+-
+- /* Initialize the first block of the first file: */
+- init_block(s);
+-}
+-
+-/* ===========================================================================
+- * Initialize a new block.
+- */
+-local void init_block(s)
+- deflate_state *s;
+-{
+- int n; /* iterates over tree elements */
+-
+- /* Initialize the trees. */
+- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+-
+- s->dyn_ltree[END_BLOCK].Freq = 1;
+- s->opt_len = s->static_len = 0L;
+- s->last_lit = s->matches = 0;
+-}
+-
+-#define SMALLEST 1
+-/* Index within the heap array of least frequent node in the Huffman tree */
+-
+-
+-/* ===========================================================================
+- * Remove the smallest element from the heap and recreate the heap with
+- * one less element. Updates heap and heap_len.
+- */
+-#define pqremove(s, tree, top) \
+-{\
+- top = s->heap[SMALLEST]; \
+- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+- pqdownheap(s, tree, SMALLEST); \
+-}
+-
+-/* ===========================================================================
+- * Compares to subtrees, using the tree depth as tie breaker when
+- * the subtrees have equal frequency. This minimizes the worst case length.
+- */
+-#define smaller(tree, n, m, depth) \
+- (tree[n].Freq < tree[m].Freq || \
+- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+-
+-/* ===========================================================================
+- * Restore the heap property by moving down the tree starting at node k,
+- * exchanging a node with the smallest of its two sons if necessary, stopping
+- * when the heap property is re-established (each father smaller than its
+- * two sons).
+- */
+-local void pqdownheap(s, tree, k)
+- deflate_state *s;
+- ct_data *tree; /* the tree to restore */
+- int k; /* node to move down */
+-{
+- int v = s->heap[k];
+- int j = k << 1; /* left son of k */
+- while (j <= s->heap_len) {
+- /* Set j to the smallest of the two sons: */
+- if (j < s->heap_len &&
+- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+- j++;
+- }
+- /* Exit if v is smaller than both sons */
+- if (smaller(tree, v, s->heap[j], s->depth)) break;
+-
+- /* Exchange v with the smallest son */
+- s->heap[k] = s->heap[j]; k = j;
+-
+- /* And continue down the tree, setting j to the left son of k */
+- j <<= 1;
+- }
+- s->heap[k] = v;
+-}
+-
+-/* ===========================================================================
+- * Compute the optimal bit lengths for a tree and update the total bit length
+- * for the current block.
+- * IN assertion: the fields freq and dad are set, heap[heap_max] and
+- * above are the tree nodes sorted by increasing frequency.
+- * OUT assertions: the field len is set to the optimal bit length, the
+- * array bl_count contains the frequencies for each bit length.
+- * The length opt_len is updated; static_len is also updated if stree is
+- * not null.
+- */
+-local void gen_bitlen(s, desc)
+- deflate_state *s;
+- tree_desc *desc; /* the tree descriptor */
+-{
+- ct_data *tree = desc->dyn_tree;
+- int max_code = desc->max_code;
+- const ct_data *stree = desc->stat_desc->static_tree;
+- const intf *extra = desc->stat_desc->extra_bits;
+- int base = desc->stat_desc->extra_base;
+- int max_length = desc->stat_desc->max_length;
+- int h; /* heap index */
+- int n, m; /* iterate over the tree elements */
+- int bits; /* bit length */
+- int xbits; /* extra bits */
+- ush f; /* frequency */
+- int overflow = 0; /* number of elements with bit length too large */
+-
+- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+-
+- /* In a first pass, compute the optimal bit lengths (which may
+- * overflow in the case of the bit length tree).
+- */
+- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+-
+- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+- n = s->heap[h];
+- bits = tree[tree[n].Dad].Len + 1;
+- if (bits > max_length) bits = max_length, overflow++;
+- tree[n].Len = (ush)bits;
+- /* We overwrite tree[n].Dad which is no longer needed */
+-
+- if (n > max_code) continue; /* not a leaf node */
+-
+- s->bl_count[bits]++;
+- xbits = 0;
+- if (n >= base) xbits = extra[n-base];
+- f = tree[n].Freq;
+- s->opt_len += (ulg)f * (bits + xbits);
+- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+- }
+- if (overflow == 0) return;
+-
+- Trace((stderr,"\nbit length overflow\n"));
+- /* This happens for example on obj2 and pic of the Calgary corpus */
+-
+- /* Find the first bit length which could increase: */
+- do {
+- bits = max_length-1;
+- while (s->bl_count[bits] == 0) bits--;
+- s->bl_count[bits]--; /* move one leaf down the tree */
+- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+- s->bl_count[max_length]--;
+- /* The brother of the overflow item also moves one step up,
+- * but this does not affect bl_count[max_length]
+- */
+- overflow -= 2;
+- } while (overflow > 0);
+-
+- /* Now recompute all bit lengths, scanning in increasing frequency.
+- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+- * lengths instead of fixing only the wrong ones. This idea is taken
+- * from 'ar' written by Haruhiko Okumura.)
+- */
+- for (bits = max_length; bits != 0; bits--) {
+- n = s->bl_count[bits];
+- while (n != 0) {
+- m = s->heap[--h];
+- if (m > max_code) continue;
+- if ((unsigned) tree[m].Len != (unsigned) bits) {
+- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
+- s->opt_len += ((long)bits - (long)tree[m].Len)
+- *(long)tree[m].Freq;
+- tree[m].Len = (ush)bits;
+- }
+- n--;
+- }
+- }
+-}
+-
+-/* ===========================================================================
+- * Generate the codes for a given tree and bit counts (which need not be
+- * optimal).
+- * IN assertion: the array bl_count contains the bit length statistics for
+- * the given tree and the field len is set for all tree elements.
+- * OUT assertion: the field code is set for all tree elements of non
+- * zero code length.
+- */
+-local void gen_codes (tree, max_code, bl_count)
+- ct_data *tree; /* the tree to decorate */
+- int max_code; /* largest code with non zero frequency */
+- ushf *bl_count; /* number of codes at each bit length */
+-{
+- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+- ush code = 0; /* running code value */
+- int bits; /* bit index */
+- int n; /* code index */
+-
+- /* The distribution counts are first used to generate the code values
+- * without bit reversal.
+- */
+- for (bits = 1; bits <= MAX_BITS; bits++) {
+- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+- }
+- /* Check that the bit counts in bl_count are consistent. The last code
+- * must be all ones.
+- */
+- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+- "inconsistent bit counts");
+- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+-
+- for (n = 0; n <= max_code; n++) {
+- int len = tree[n].Len;
+- if (len == 0) continue;
+- /* Now reverse the bits */
+- tree[n].Code = bi_reverse(next_code[len]++, len);
+-
+- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+- }
+-}
+-
+-/* ===========================================================================
+- * Construct one Huffman tree and assigns the code bit strings and lengths.
+- * Update the total bit length for the current block.
+- * IN assertion: the field freq is set for all tree elements.
+- * OUT assertions: the fields len and code are set to the optimal bit length
+- * and corresponding code. The length opt_len is updated; static_len is
+- * also updated if stree is not null. The field max_code is set.
+- */
+-local void build_tree(s, desc)
+- deflate_state *s;
+- tree_desc *desc; /* the tree descriptor */
+-{
+- ct_data *tree = desc->dyn_tree;
+- const ct_data *stree = desc->stat_desc->static_tree;
+- int elems = desc->stat_desc->elems;
+- int n, m; /* iterate over heap elements */
+- int max_code = -1; /* largest code with non zero frequency */
+- int node; /* new node being created */
+-
+- /* Construct the initial heap, with least frequent element in
+- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+- * heap[0] is not used.
+- */
+- s->heap_len = 0, s->heap_max = HEAP_SIZE;
+-
+- for (n = 0; n < elems; n++) {
+- if (tree[n].Freq != 0) {
+- s->heap[++(s->heap_len)] = max_code = n;
+- s->depth[n] = 0;
+- } else {
+- tree[n].Len = 0;
+- }
+- }
+-
+- /* The pkzip format requires that at least one distance code exists,
+- * and that at least one bit should be sent even if there is only one
+- * possible code. So to avoid special checks later on we force at least
+- * two codes of non zero frequency.
+- */
+- while (s->heap_len < 2) {
+- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+- tree[node].Freq = 1;
+- s->depth[node] = 0;
+- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+- /* node is 0 or 1 so it does not have extra bits */
+- }
+- desc->max_code = max_code;
+-
+- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+- * establish sub-heaps of increasing lengths:
+- */
+- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+-
+- /* Construct the Huffman tree by repeatedly combining the least two
+- * frequent nodes.
+- */
+- node = elems; /* next internal node of the tree */
+- do {
+- pqremove(s, tree, n); /* n = node of least frequency */
+- m = s->heap[SMALLEST]; /* m = node of next least frequency */
+-
+- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+- s->heap[--(s->heap_max)] = m;
+-
+- /* Create a new node father of n and m */
+- tree[node].Freq = tree[n].Freq + tree[m].Freq;
+- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
+- s->depth[n] : s->depth[m]) + 1);
+- tree[n].Dad = tree[m].Dad = (ush)node;
+-#ifdef DUMP_BL_TREE
+- if (tree == s->bl_tree) {
+- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
+- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+- }
+-#endif
+- /* and insert the new node in the heap */
+- s->heap[SMALLEST] = node++;
+- pqdownheap(s, tree, SMALLEST);
+-
+- } while (s->heap_len >= 2);
+-
+- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+-
+- /* At this point, the fields freq and dad are set. We can now
+- * generate the bit lengths.
+- */
+- gen_bitlen(s, (tree_desc *)desc);
+-
+- /* The field len is now set, we can generate the bit codes */
+- gen_codes ((ct_data *)tree, max_code, s->bl_count);
+-}
+-
+-/* ===========================================================================
+- * Scan a literal or distance tree to determine the frequencies of the codes
+- * in the bit length tree.
+- */
+-local void scan_tree (s, tree, max_code)
+- deflate_state *s;
+- ct_data *tree; /* the tree to be scanned */
+- int max_code; /* and its largest code of non zero frequency */
+-{
+- int n; /* iterates over all tree elements */
+- int prevlen = -1; /* last emitted length */
+- int curlen; /* length of current code */
+- int nextlen = tree[0].Len; /* length of next code */
+- int count = 0; /* repeat count of the current code */
+- int max_count = 7; /* max repeat count */
+- int min_count = 4; /* min repeat count */
+-
+- if (nextlen == 0) max_count = 138, min_count = 3;
+- tree[max_code+1].Len = (ush)0xffff; /* guard */
+-
+- for (n = 0; n <= max_code; n++) {
+- curlen = nextlen; nextlen = tree[n+1].Len;
+- if (++count < max_count && curlen == nextlen) {
+- continue;
+- } else if (count < min_count) {
+- s->bl_tree[curlen].Freq += count;
+- } else if (curlen != 0) {
+- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+- s->bl_tree[REP_3_6].Freq++;
+- } else if (count <= 10) {
+- s->bl_tree[REPZ_3_10].Freq++;
+- } else {
+- s->bl_tree[REPZ_11_138].Freq++;
+- }
+- count = 0; prevlen = curlen;
+- if (nextlen == 0) {
+- max_count = 138, min_count = 3;
+- } else if (curlen == nextlen) {
+- max_count = 6, min_count = 3;
+- } else {
+- max_count = 7, min_count = 4;
+- }
+- }
+-}
+-
+-/* ===========================================================================
+- * Send a literal or distance tree in compressed form, using the codes in
+- * bl_tree.
+- */
+-local void send_tree (s, tree, max_code)
+- deflate_state *s;
+- ct_data *tree; /* the tree to be scanned */
+- int max_code; /* and its largest code of non zero frequency */
+-{
+- int n; /* iterates over all tree elements */
+- int prevlen = -1; /* last emitted length */
+- int curlen; /* length of current code */
+- int nextlen = tree[0].Len; /* length of next code */
+- int count = 0; /* repeat count of the current code */
+- int max_count = 7; /* max repeat count */
+- int min_count = 4; /* min repeat count */
+-
+- /* tree[max_code+1].Len = -1; */ /* guard already set */
+- if (nextlen == 0) max_count = 138, min_count = 3;
+-
+- for (n = 0; n <= max_code; n++) {
+- curlen = nextlen; nextlen = tree[n+1].Len;
+- if (++count < max_count && curlen == nextlen) {
+- continue;
+- } else if (count < min_count) {
+- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+-
+- } else if (curlen != 0) {
+- if (curlen != prevlen) {
+- send_code(s, curlen, s->bl_tree); count--;
+- }
+- Assert(count >= 3 && count <= 6, " 3_6?");
+- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+-
+- } else if (count <= 10) {
+- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+-
+- } else {
+- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+- }
+- count = 0; prevlen = curlen;
+- if (nextlen == 0) {
+- max_count = 138, min_count = 3;
+- } else if (curlen == nextlen) {
+- max_count = 6, min_count = 3;
+- } else {
+- max_count = 7, min_count = 4;
+- }
+- }
+-}
+-
+-/* ===========================================================================
+- * Construct the Huffman tree for the bit lengths and return the index in
+- * bl_order of the last bit length code to send.
+- */
+-local int build_bl_tree(s)
+- deflate_state *s;
+-{
+- int max_blindex; /* index of last bit length code of non zero freq */
+-
+- /* Determine the bit length frequencies for literal and distance trees */
+- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+-
+- /* Build the bit length tree: */
+- build_tree(s, (tree_desc *)(&(s->bl_desc)));
+- /* opt_len now includes the length of the tree representations, except
+- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+- */
+-
+- /* Determine the number of bit length codes to send. The pkzip format
+- * requires that at least 4 bit length codes be sent. (appnote.txt says
+- * 3 but the actual value used is 4.)
+- */
+- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+- }
+- /* Update opt_len to include the bit length tree and counts */
+- s->opt_len += 3*(max_blindex+1) + 5+5+4;
+- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
+- s->opt_len, s->static_len));
+-
+- return max_blindex;
+-}
+-
+-/* ===========================================================================
+- * Send the header for a block using dynamic Huffman trees: the counts, the
+- * lengths of the bit length codes, the literal tree and the distance tree.
+- * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+- */
+-local void send_all_trees(s, lcodes, dcodes, blcodes)
+- deflate_state *s;
+- int lcodes, dcodes, blcodes; /* number of codes for each tree */
+-{
+- int rank; /* index in bl_order */
+-
+- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+- "too many codes");
+- Tracev((stderr, "\nbl counts: "));
+- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+- send_bits(s, dcodes-1, 5);
+- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+- for (rank = 0; rank < blcodes; rank++) {
+- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+- }
+- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
+-
+- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
+-
+- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
+-}
+-
+-/* ===========================================================================
+- * Send a stored block
+- */
+-void _tr_stored_block(s, buf, stored_len, eof)
+- deflate_state *s;
+- charf *buf; /* input block */
+- ulg stored_len; /* length of input block */
+- int eof; /* true if this is the last block for a file */
+-{
+- send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
+-#ifdef DEBUG
+- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+- s->compressed_len += (stored_len + 4) << 3;
+-#endif
+- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+-}
+-
+-/* ===========================================================================
+- * Send one empty static block to give enough lookahead for inflate.
+- * This takes 10 bits, of which 7 may remain in the bit buffer.
+- * The current inflate code requires 9 bits of lookahead. If the
+- * last two codes for the previous block (real code plus EOB) were coded
+- * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+- * the last real code. In this case we send two empty static blocks instead
+- * of one. (There are no problems if the previous block is stored or fixed.)
+- * To simplify the code, we assume the worst case of last real code encoded
+- * on one bit only.
+- */
+-void _tr_align(s)
+- deflate_state *s;
+-{
+- send_bits(s, STATIC_TREES<<1, 3);
+- send_code(s, END_BLOCK, static_ltree);
+-#ifdef DEBUG
+- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+-#endif
+- bi_flush(s);
+- /* Of the 10 bits for the empty block, we have already sent
+- * (10 - bi_valid) bits. The lookahead for the last real code (before
+- * the EOB of the previous block) was thus at least one plus the length
+- * of the EOB plus what we have just sent of the empty static block.
+- */
+- if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+- send_bits(s, STATIC_TREES<<1, 3);
+- send_code(s, END_BLOCK, static_ltree);
+-#ifdef DEBUG
+- s->compressed_len += 10L;
+-#endif
+- bi_flush(s);
+- }
+- s->last_eob_len = 7;
+-}
+-
+-/* ===========================================================================
+- * Determine the best encoding for the current block: dynamic trees, static
+- * trees or store, and output the encoded block to the zip file.
+- */
+-void _tr_flush_block(s, buf, stored_len, eof)
+- deflate_state *s;
+- charf *buf; /* input block, or NULL if too old */
+- ulg stored_len; /* length of input block */
+- int eof; /* true if this is the last block for a file */
+-{
+- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+- int max_blindex = 0; /* index of last bit length code of non zero freq */
+-
+- /* Build the Huffman trees unless a stored block is forced */
+- if (s->level > 0) {
+-
+- /* Check if the file is binary or text */
+- if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
+- set_data_type(s);
+-
+- /* Construct the literal and distance trees */
+- build_tree(s, (tree_desc *)(&(s->l_desc)));
+- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
+- s->static_len));
+-
+- build_tree(s, (tree_desc *)(&(s->d_desc)));
+- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
+- s->static_len));
+- /* At this point, opt_len and static_len are the total bit lengths of
+- * the compressed block data, excluding the tree representations.
+- */
+-
+- /* Build the bit length tree for the above two trees, and get the index
+- * in bl_order of the last bit length code to send.
+- */
+- max_blindex = build_bl_tree(s);
+-
+- /* Determine the best encoding. Compute the block lengths in bytes. */
+- opt_lenb = (s->opt_len+3+7)>>3;
+- static_lenb = (s->static_len+3+7)>>3;
+-
+- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+- s->last_lit));
+-
+- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+-
+- } else {
+- Assert(buf != (char*)0, "lost buf");
+- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+- }
+-
+-#ifdef FORCE_STORED
+- if (buf != (char*)0) { /* force stored block */
+-#else
+- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+- /* 4: two words for the lengths */
+-#endif
+- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+- * Otherwise we can't have processed more than WSIZE input bytes since
+- * the last block flush, because compression would have been
+- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+- * transform a block into a stored block.
+- */
+- _tr_stored_block(s, buf, stored_len, eof);
+-
+-#ifdef FORCE_STATIC
+- } else if (static_lenb >= 0) { /* force static trees */
+-#else
+- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
+-#endif
+- send_bits(s, (STATIC_TREES<<1)+eof, 3);
+- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+-#ifdef DEBUG
+- s->compressed_len += 3 + s->static_len;
+-#endif
+- } else {
+- send_bits(s, (DYN_TREES<<1)+eof, 3);
+- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+- max_blindex+1);
+- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+-#ifdef DEBUG
+- s->compressed_len += 3 + s->opt_len;
+-#endif
+- }
+- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
+- /* The above check is made mod 2^32, for files larger than 512 MB
+- * and uLong implemented on 32 bits.
+- */
+- init_block(s);
+-
+- if (eof) {
+- bi_windup(s);
+-#ifdef DEBUG
+- s->compressed_len += 7; /* align on byte boundary */
+-#endif
+- }
+- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+- s->compressed_len-7*eof));
+-}
+-
+-/* ===========================================================================
+- * Save the match info and tally the frequency counts. Return true if
+- * the current block must be flushed.
+- */
+-int _tr_tally (s, dist, lc)
+- deflate_state *s;
+- unsigned dist; /* distance of matched string */
+- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+-{
+- s->d_buf[s->last_lit] = (ush)dist;
+- s->l_buf[s->last_lit++] = (uch)lc;
+- if (dist == 0) {
+- /* lc is the unmatched char */
+- s->dyn_ltree[lc].Freq++;
+- } else {
+- s->matches++;
+- /* Here, lc is the match length - MIN_MATCH */
+- dist--; /* dist = match distance - 1 */
+- Assert((ush)dist < (ush)MAX_DIST(s) &&
+- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
+-
+- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+- s->dyn_dtree[d_code(dist)].Freq++;
+- }
+-
+-#ifdef TRUNCATE_BLOCK
+- /* Try to guess if it is profitable to stop the current block here */
+- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+- /* Compute an upper bound for the compressed length */
+- ulg out_length = (ulg)s->last_lit*8L;
+- ulg in_length = (ulg)((long)s->strstart - s->block_start);
+- int dcode;
+- for (dcode = 0; dcode < D_CODES; dcode++) {
+- out_length += (ulg)s->dyn_dtree[dcode].Freq *
+- (5L+extra_dbits[dcode]);
+- }
+- out_length >>= 3;
+- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+- s->last_lit, in_length, out_length,
+- 100L - out_length*100L/in_length));
+- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+- }
+-#endif
+- return (s->last_lit == s->lit_bufsize-1);
+- /* We avoid equality with lit_bufsize because of wraparound at 64K
+- * on 16 bit machines and because stored blocks are restricted to
+- * 64K-1 bytes.
+- */
+-}
+-
+-/* ===========================================================================
+- * Send the block data compressed using the given Huffman trees
+- */
+-local void compress_block(s, ltree, dtree)
+- deflate_state *s;
+- ct_data *ltree; /* literal tree */
+- ct_data *dtree; /* distance tree */
+-{
+- unsigned dist; /* distance of matched string */
+- int lc; /* match length or unmatched char (if dist == 0) */
+- unsigned lx = 0; /* running index in l_buf */
+- unsigned code; /* the code to send */
+- int extra; /* number of extra bits to send */
+-
+- if (s->last_lit != 0) do {
+- dist = s->d_buf[lx];
+- lc = s->l_buf[lx++];
+- if (dist == 0) {
+- send_code(s, lc, ltree); /* send a literal byte */
+- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+- } else {
+- /* Here, lc is the match length - MIN_MATCH */
+- code = _length_code[lc];
+- send_code(s, code+LITERALS+1, ltree); /* send the length code */
+- extra = extra_lbits[code];
+- if (extra != 0) {
+- lc -= base_length[code];
+- send_bits(s, lc, extra); /* send the extra length bits */
+- }
+- dist--; /* dist is now the match distance - 1 */
+- code = d_code(dist);
+- Assert (code < D_CODES, "bad d_code");
+-
+- send_code(s, code, dtree); /* send the distance code */
+- extra = extra_dbits[code];
+- if (extra != 0) {
+- dist -= base_dist[code];
+- send_bits(s, dist, extra); /* send the extra distance bits */
+- }
+- } /* literal or match pair ? */
+-
+- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
+- "pendingBuf overflow");
+-
+- } while (lx < s->last_lit);
+-
+- send_code(s, END_BLOCK, ltree);
+- s->last_eob_len = ltree[END_BLOCK].Len;
+-}
+-
+-/* ===========================================================================
+- * Set the data type to BINARY or TEXT, using a crude approximation:
+- * set it to Z_TEXT if all symbols are either printable characters (33 to 255)
+- * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
+- * IN assertion: the fields Freq of dyn_ltree are set.
+- */
+-local void set_data_type(s)
+- deflate_state *s;
+-{
+- int n;
+-
+- for (n = 0; n < 9; n++)
+- if (s->dyn_ltree[n].Freq != 0)
+- break;
+- if (n == 9)
+- for (n = 14; n < 32; n++)
+- if (s->dyn_ltree[n].Freq != 0)
+- break;
+- s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
+-}
+-
+-/* ===========================================================================
+- * Reverse the first len bits of a code, using straightforward code (a faster
+- * method would use a table)
+- * IN assertion: 1 <= len <= 15
+- */
+-local unsigned bi_reverse(code, len)
+- unsigned code; /* the value to invert */
+- int len; /* its bit length */
+-{
+- register unsigned res = 0;
+- do {
+- res |= code & 1;
+- code >>= 1, res <<= 1;
+- } while (--len > 0);
+- return res >> 1;
+-}
+-
+-/* ===========================================================================
+- * Flush the bit buffer, keeping at most 7 bits in it.
+- */
+-local void bi_flush(s)
+- deflate_state *s;
+-{
+- if (s->bi_valid == 16) {
+- put_short(s, s->bi_buf);
+- s->bi_buf = 0;
+- s->bi_valid = 0;
+- } else if (s->bi_valid >= 8) {
+- put_byte(s, (Byte)s->bi_buf);
+- s->bi_buf >>= 8;
+- s->bi_valid -= 8;
+- }
+-}
+-
+-/* ===========================================================================
+- * Flush the bit buffer and align the output on a byte boundary
+- */
+-local void bi_windup(s)
+- deflate_state *s;
+-{
+- if (s->bi_valid > 8) {
+- put_short(s, s->bi_buf);
+- } else if (s->bi_valid > 0) {
+- put_byte(s, (Byte)s->bi_buf);
+- }
+- s->bi_buf = 0;
+- s->bi_valid = 0;
+-#ifdef DEBUG
+- s->bits_sent = (s->bits_sent+7) & ~7;
+-#endif
+-}
+-
+-/* ===========================================================================
+- * Copy a stored block, storing first the length and its
+- * one's complement if requested.
+- */
+-local void copy_block(s, buf, len, header)
+- deflate_state *s;
+- charf *buf; /* the input data */
+- unsigned len; /* its length */
+- int header; /* true if block header must be written */
+-{
+- bi_windup(s); /* align on byte boundary */
+- s->last_eob_len = 8; /* enough lookahead for inflate */
+-
+- if (header) {
+- put_short(s, (ush)len);
+- put_short(s, (ush)~len);
+-#ifdef DEBUG
+- s->bits_sent += 2*16;
+-#endif
+- }
+-#ifdef DEBUG
+- s->bits_sent += (ulg)len<<3;
+-#endif
+- while (len--) {
+- put_byte(s, *buf++);
+- }
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/trees.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,152 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* header created automatically with -DGEN_TREES_H */
+-
+-local const ct_data static_ltree[L_CODES+2] = {
+-{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
+-{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
+-{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
+-{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
+-{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
+-{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
+-{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
+-{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
+-{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
+-{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
+-{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
+-{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
+-{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
+-{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
+-{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
+-{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
+-{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
+-{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
+-{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
+-{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
+-{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
+-{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
+-{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
+-{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
+-{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
+-{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
+-{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
+-{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
+-{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
+-{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
+-{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
+-{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
+-{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
+-{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
+-{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
+-{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
+-{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
+-{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
+-{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
+-{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
+-{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
+-{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
+-{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
+-{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
+-{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
+-{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
+-{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
+-{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
+-{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
+-{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
+-{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
+-{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
+-{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
+-{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
+-{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
+-{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
+-{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
+-{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
+-};
+-
+-local const ct_data static_dtree[D_CODES] = {
+-{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+-{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+-{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+-{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+-{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+-{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+-};
+-
+-const uch _dist_code[DIST_CODE_LEN] = {
+- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
+-10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+-11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+-12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+-13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+-13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
+-18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+-24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+-27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+-28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+-};
+-
+-const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
+-13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+-17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+-19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+-21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+-22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+-24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+-26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+-};
+-
+-local const int base_length[LENGTH_CODES] = {
+-0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+-64, 80, 96, 112, 128, 160, 192, 224, 0
+-};
+-
+-local const int base_dist[D_CODES] = {
+- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
+- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
+- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
+-};
+-
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,85 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* uncompr.c -- decompress a memory buffer
+- * Copyright (C) 1995-2003 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* @(#) $Id$ */
+-
+-#define ZLIB_INTERNAL
+-#include "zlib.h"
+-
+-/* ===========================================================================
+- Decompresses the source buffer into the destination buffer. sourceLen is
+- the byte length of the source buffer. Upon entry, destLen is the total
+- size of the destination buffer, which must be large enough to hold the
+- entire uncompressed data. (The size of the uncompressed data must have
+- been saved previously by the compressor and transmitted to the decompressor
+- by some mechanism outside the scope of this compression library.)
+- Upon exit, destLen is the actual size of the compressed buffer.
+- This function can be used to decompress a whole file at once if the
+- input file is mmap'ed.
+-
+- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_BUF_ERROR if there was not enough room in the output
+- buffer, or Z_DATA_ERROR if the input data was corrupted.
+-*/
+-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
+- Bytef *dest;
+- uLongf *destLen;
+- const Bytef *source;
+- uLong sourceLen;
+-{
+- z_stream stream;
+- int err;
+-
+- stream.next_in = (Bytef*)source;
+- stream.avail_in = (uInt)sourceLen;
+- /* Check for source > 64K on 16-bit machine: */
+- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+-
+- stream.next_out = dest;
+- stream.avail_out = (uInt)*destLen;
+- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+-
+- stream.zalloc = (alloc_func)0;
+- stream.zfree = (free_func)0;
+-
+- err = inflateInit(&stream);
+- if (err != Z_OK) return err;
+-
+- err = inflate(&stream, Z_FINISH);
+- if (err != Z_STREAM_END) {
+- inflateEnd(&stream);
+- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
+- return Z_DATA_ERROR;
+- return err;
+- }
+- *destLen = (uLong)stream.total_out;
+-
+- err = inflateEnd(&stream);
+- return err;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,173 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* adler32.c -- compute the Adler-32 checksum of a data stream
+- * Copyright (C) 1995-2004 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* @(#) $Id$ */
+-
+-#define ZLIB_INTERNAL
+-#include "zlib.h"
+-
+-#define BASE 65521UL /* largest prime smaller than 65536 */
+-#define NMAX 5552
+-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+-
+-#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
+-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
+-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
+-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
+-#define DO16(buf) DO8(buf,0); DO8(buf,8);
+-
+-/* use NO_DIVIDE if your processor does not do division in hardware */
+-#ifdef NO_DIVIDE
+-# define MOD(a) \
+- do { \
+- if (a >= (BASE << 16)) a -= (BASE << 16); \
+- if (a >= (BASE << 15)) a -= (BASE << 15); \
+- if (a >= (BASE << 14)) a -= (BASE << 14); \
+- if (a >= (BASE << 13)) a -= (BASE << 13); \
+- if (a >= (BASE << 12)) a -= (BASE << 12); \
+- if (a >= (BASE << 11)) a -= (BASE << 11); \
+- if (a >= (BASE << 10)) a -= (BASE << 10); \
+- if (a >= (BASE << 9)) a -= (BASE << 9); \
+- if (a >= (BASE << 8)) a -= (BASE << 8); \
+- if (a >= (BASE << 7)) a -= (BASE << 7); \
+- if (a >= (BASE << 6)) a -= (BASE << 6); \
+- if (a >= (BASE << 5)) a -= (BASE << 5); \
+- if (a >= (BASE << 4)) a -= (BASE << 4); \
+- if (a >= (BASE << 3)) a -= (BASE << 3); \
+- if (a >= (BASE << 2)) a -= (BASE << 2); \
+- if (a >= (BASE << 1)) a -= (BASE << 1); \
+- if (a >= BASE) a -= BASE; \
+- } while (0)
+-# define MOD4(a) \
+- do { \
+- if (a >= (BASE << 4)) a -= (BASE << 4); \
+- if (a >= (BASE << 3)) a -= (BASE << 3); \
+- if (a >= (BASE << 2)) a -= (BASE << 2); \
+- if (a >= (BASE << 1)) a -= (BASE << 1); \
+- if (a >= BASE) a -= BASE; \
+- } while (0)
+-#else
+-# define MOD(a) a %= BASE
+-# define MOD4(a) a %= BASE
+-#endif
+-
+-/* ========================================================================= */
+-uLong ZEXPORT adler32(adler, buf, len)
+- uLong adler;
+- const Bytef *buf;
+- uInt len;
+-{
+- unsigned long sum2;
+- unsigned n;
+-
+- /* split Adler-32 into component sums */
+- sum2 = (adler >> 16) & 0xffff;
+- adler &= 0xffff;
+-
+- /* in case user likes doing a byte at a time, keep it fast */
+- if (len == 1) {
+- adler += buf[0];
+- if (adler >= BASE)
+- adler -= BASE;
+- sum2 += adler;
+- if (sum2 >= BASE)
+- sum2 -= BASE;
+- return adler | (sum2 << 16);
+- }
+-
+- /* initial Adler-32 value (deferred check for len == 1 speed) */
+- if (buf == Z_NULL)
+- return 1L;
+-
+- /* in case short lengths are provided, keep it somewhat fast */
+- if (len < 16) {
+- while (len--) {
+- adler += *buf++;
+- sum2 += adler;
+- }
+- if (adler >= BASE)
+- adler -= BASE;
+- MOD4(sum2); /* only added so many BASE's */
+- return adler | (sum2 << 16);
+- }
+-
+- /* do length NMAX blocks -- requires just one modulo operation */
+- while (len >= NMAX) {
+- len -= NMAX;
+- n = NMAX / 16; /* NMAX is divisible by 16 */
+- do {
+- DO16(buf); /* 16 sums unrolled */
+- buf += 16;
+- } while (--n);
+- MOD(adler);
+- MOD(sum2);
+- }
+-
+- /* do remaining bytes (less than NMAX, still just one modulo) */
+- if (len) { /* avoid modulos if none remaining */
+- while (len >= 16) {
+- len -= 16;
+- DO16(buf);
+- buf += 16;
+- }
+- while (len--) {
+- adler += *buf++;
+- sum2 += adler;
+- }
+- MOD(adler);
+- MOD(sum2);
+- }
+-
+- /* return recombined sums */
+- return adler | (sum2 << 16);
+-}
+-
+-/* ========================================================================= */
+-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
+- uLong adler1;
+- uLong adler2;
+- z_off_t len2;
+-{
+- unsigned long sum1;
+- unsigned long sum2;
+- unsigned rem;
+-
+- /* the derivation of this formula is left as an exercise for the reader */
+- rem = (unsigned)(len2 % BASE);
+- sum1 = adler1 & 0xffff;
+- sum2 = rem * sum1;
+- MOD(sum2);
+- sum1 += (adler2 & 0xffff) + BASE - 1;
+- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
+- if (sum1 > BASE) sum1 -= BASE;
+- if (sum1 > BASE) sum1 -= BASE;
+- if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
+- if (sum2 > BASE) sum2 -= BASE;
+- return sum1 | (sum2 << 16);
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zconf.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,363 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* zconf.h -- configuration of the zlib compression library
+- * Copyright (C) 1995-2005 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* @(#) $Id$ */
+-
+-#ifndef ZCONF_H
+-#define ZCONF_H
+-
+-/* for _LP64 */
+-#include <sys/types.h>
+-
+-/*
+- * If you *really* need a unique prefix for all types and library functions,
+- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+- */
+-#ifdef Z_PREFIX
+-# define deflateInit_ z_deflateInit_
+-# define deflate z_deflate
+-# define deflateEnd z_deflateEnd
+-# define inflateInit_ z_inflateInit_
+-# define inflate z_inflate
+-# define inflateEnd z_inflateEnd
+-# define deflateInit2_ z_deflateInit2_
+-# define deflateSetDictionary z_deflateSetDictionary
+-# define deflateCopy z_deflateCopy
+-# define deflateReset z_deflateReset
+-# define deflateParams z_deflateParams
+-# define deflateBound z_deflateBound
+-# define deflatePrime z_deflatePrime
+-# define inflateInit2_ z_inflateInit2_
+-# define inflateSetDictionary z_inflateSetDictionary
+-# define inflateSync z_inflateSync
+-# define inflateSyncPoint z_inflateSyncPoint
+-# define inflateCopy z_inflateCopy
+-# define inflateReset z_inflateReset
+-# define inflateBack z_inflateBack
+-# define inflateBackEnd z_inflateBackEnd
+-# define compress z_compress
+-# define compress2 z_compress2
+-# define compressBound z_compressBound
+-# define uncompress z_uncompress
+-# define adler32 z_adler32
+-# define crc32 z_crc32
+-# define get_crc_table z_get_crc_table
+-# define zError z_zError
+-
+-# define alloc_func z_alloc_func
+-# define free_func z_free_func
+-# define in_func z_in_func
+-# define out_func z_out_func
+-# define Byte z_Byte
+-# define uInt z_uInt
+-# define uLong z_uLong
+-# define Bytef z_Bytef
+-# define charf z_charf
+-# define intf z_intf
+-# define uIntf z_uIntf
+-# define uLongf z_uLongf
+-# define voidpf z_voidpf
+-# define voidp z_voidp
+-#endif
+-
+-#if defined(__MSDOS__) && !defined(MSDOS)
+-# define MSDOS
+-#endif
+-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+-# define OS2
+-#endif
+-#if defined(_WINDOWS) && !defined(WINDOWS)
+-# define WINDOWS
+-#endif
+-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+-# ifndef WIN32
+-# define WIN32
+-# endif
+-#endif
+-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+-# ifndef SYS16BIT
+-# define SYS16BIT
+-# endif
+-# endif
+-#endif
+-
+-/*
+- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+- * than 64k bytes at a time (needed on systems with 16-bit int).
+- */
+-#ifdef SYS16BIT
+-# define MAXSEG_64K
+-#endif
+-#ifdef MSDOS
+-# define UNALIGNED_OK
+-#endif
+-
+-#ifdef __STDC_VERSION__
+-# ifndef STDC
+-# define STDC
+-# endif
+-# if __STDC_VERSION__ >= 199901L
+-# ifndef STDC99
+-# define STDC99
+-# endif
+-# endif
+-#endif
+-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+-# define STDC
+-#endif
+-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+-# define STDC
+-#endif
+-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+-# define STDC
+-#endif
+-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+-# define STDC
+-#endif
+-
+-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
+-# define STDC
+-#endif
+-
+-#ifndef STDC
+-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+-# define const /* note: need a more gentle solution here */
+-# endif
+-#endif
+-
+-/* Some Mac compilers merge all .h files incorrectly: */
+-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+-# define NO_DUMMY_DECL
+-#endif
+-
+-/* Maximum value for memLevel in deflateInit2 */
+-#ifndef MAX_MEM_LEVEL
+-# ifdef MAXSEG_64K
+-# define MAX_MEM_LEVEL 8
+-# else
+-# define MAX_MEM_LEVEL 9
+-# endif
+-#endif
+-
+-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+- * created by gzip. (Files created by minigzip can still be extracted by
+- * gzip.)
+- */
+-#ifndef MAX_WBITS
+-# define MAX_WBITS 15 /* 32K LZ77 window */
+-#endif
+-
+-/* The memory requirements for deflate are (in bytes):
+- (1 << (windowBits+2)) + (1 << (memLevel+9))
+- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+- plus a few kilobytes for small objects. For example, if you want to reduce
+- the default memory requirements from 256K to 128K, compile with
+- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+- Of course this will generally degrade compression (there's no free lunch).
+-
+- The memory requirements for inflate are (in bytes) 1 << windowBits
+- that is, 32K for windowBits=15 (default value) plus a few kilobytes
+- for small objects.
+-*/
+-
+- /* Type declarations */
+-
+-#ifndef OF /* function prototypes */
+-# ifdef STDC
+-# define OF(args) args
+-# else
+-# define OF(args) ()
+-# endif
+-#endif
+-
+-/* The following definitions for FAR are needed only for MSDOS mixed
+- * model programming (small or medium model with some far allocations).
+- * This was tested only with MSC; for other MSDOS compilers you may have
+- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+- * just define FAR to be empty.
+- */
+-#ifdef SYS16BIT
+-# if defined(M_I86SM) || defined(M_I86MM)
+- /* MSC small or medium model */
+-# define SMALL_MEDIUM
+-# ifdef _MSC_VER
+-# define FAR _far
+-# else
+-# define FAR far
+-# endif
+-# endif
+-# if (defined(__SMALL__) || defined(__MEDIUM__))
+- /* Turbo C small or medium model */
+-# define SMALL_MEDIUM
+-# ifdef __BORLANDC__
+-# define FAR _far
+-# else
+-# define FAR far
+-# endif
+-# endif
+-#endif
+-
+-#if defined(WINDOWS) || defined(WIN32)
+- /* If building or using zlib as a DLL, define ZLIB_DLL.
+- * This is not mandatory, but it offers a little performance increase.
+- */
+-# ifdef ZLIB_DLL
+-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+-# ifdef ZLIB_INTERNAL
+-# define ZEXTERN extern __declspec(dllexport)
+-# else
+-# define ZEXTERN extern __declspec(dllimport)
+-# endif
+-# endif
+-# endif /* ZLIB_DLL */
+- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+- * define ZLIB_WINAPI.
+- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+- */
+-# ifdef ZLIB_WINAPI
+-# ifdef FAR
+-# undef FAR
+-# endif
+-# include <windows.h>
+- /* No need for _export, use ZLIB.DEF instead. */
+- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+-# define ZEXPORT WINAPI
+-# ifdef WIN32
+-# define ZEXPORTVA WINAPIV
+-# else
+-# define ZEXPORTVA FAR CDECL
+-# endif
+-# endif
+-#endif
+-
+-#if defined (__BEOS__)
+-# ifdef ZLIB_DLL
+-# ifdef ZLIB_INTERNAL
+-# define ZEXPORT __declspec(dllexport)
+-# define ZEXPORTVA __declspec(dllexport)
+-# else
+-# define ZEXPORT __declspec(dllimport)
+-# define ZEXPORTVA __declspec(dllimport)
+-# endif
+-# endif
+-#endif
+-
+-#ifndef ZEXTERN
+-# define ZEXTERN extern
+-#endif
+-#ifndef ZEXPORT
+-# define ZEXPORT
+-#endif
+-#ifndef ZEXPORTVA
+-# define ZEXPORTVA
+-#endif
+-
+-#ifndef FAR
+-# define FAR
+-#endif
+-
+-#if !defined(__MACTYPES__)
+-typedef unsigned char Byte; /* 8 bits */
+-#endif
+-typedef unsigned int uInt; /* 16 bits or more */
+-#ifdef _LP64
+-typedef unsigned int uLong; /* 32 bits or more */
+-#else
+-typedef unsigned long uLong; /* 32 bits or more */
+-#endif
+-
+-#ifdef SMALL_MEDIUM
+- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+-# define Bytef Byte FAR
+-#else
+- typedef Byte FAR Bytef;
+-#endif
+-typedef char FAR charf;
+-typedef int FAR intf;
+-typedef uInt FAR uIntf;
+-typedef uLong FAR uLongf;
+-
+-#ifdef STDC
+- typedef void const *voidpc;
+- typedef void FAR *voidpf;
+- typedef void *voidp;
+-#else
+- typedef Byte const *voidpc;
+- typedef Byte FAR *voidpf;
+- typedef Byte *voidp;
+-#endif
+-
+-#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
+-# include <sys/types.h> /* for off_t */
+-# include <unistd.h> /* for SEEK_* and off_t */
+-# ifdef VMS
+-# include <unixio.h> /* for off_t */
+-# endif
+-# define z_off_t off_t
+-#endif
+-#ifndef SEEK_SET
+-# define SEEK_SET 0 /* Seek from beginning of file. */
+-# define SEEK_CUR 1 /* Seek from current position. */
+-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+-#endif
+-#ifndef z_off_t
+-# define z_off_t long
+-#endif
+-
+-#if defined(__OS400__)
+-# define NO_vsnprintf
+-#endif
+-
+-#if defined(__MVS__)
+-# define NO_vsnprintf
+-# ifdef FAR
+-# undef FAR
+-# endif
+-#endif
+-
+-/* MVS linker does not support external names larger than 8 bytes */
+-#if defined(__MVS__)
+-# pragma map(deflateInit_,"DEIN")
+-# pragma map(deflateInit2_,"DEIN2")
+-# pragma map(deflateEnd,"DEEND")
+-# pragma map(deflateBound,"DEBND")
+-# pragma map(inflateInit_,"ININ")
+-# pragma map(inflateInit2_,"ININ2")
+-# pragma map(inflateEnd,"INEND")
+-# pragma map(inflateSync,"INSY")
+-# pragma map(inflateSetDictionary,"INSEDI")
+-# pragma map(compressBound,"CMBND")
+-# pragma map(inflate_table,"INTABL")
+-# pragma map(inflate_fast,"INFA")
+-# pragma map(inflate_copyright,"INCOPY")
+-#endif
+-
+-#endif /* ZCONF_H */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,447 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* crc32.c -- compute the CRC-32 of a data stream
+- * Copyright (C) 1995-2005 Mark Adler
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- *
+- * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
+- * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
+- * tables for updating the shift register in one step with three exclusive-ors
+- * instead of four steps with four exclusive-ors. This results in about a
+- * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
+- */
+-
+-/* @(#) $Id$ */
+-
+-/*
+- Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+- protection on the static variables used to control the first-use generation
+- of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+- first call get_crc_table() to initialize the tables before allowing more than
+- one thread to use crc32().
+- */
+-
+-#ifdef MAKECRCH
+-# include <stdio.h>
+-# ifndef DYNAMIC_CRC_TABLE
+-# define DYNAMIC_CRC_TABLE
+-# endif /* !DYNAMIC_CRC_TABLE */
+-#endif /* MAKECRCH */
+-
+-#include "zutil.h" /* for STDC and FAR definitions */
+-
+-#define local static
+-
+-/* Find a four-byte integer type for crc32_little() and crc32_big(). */
+-#ifndef NOBYFOUR
+-# ifdef STDC /* need ANSI C limits.h to determine sizes */
+-# include <limits.h>
+-# define BYFOUR
+-# if (UINT_MAX == 0xffffffffUL)
+- typedef unsigned int u4;
+-# else
+-# if (ULONG_MAX == 0xffffffffUL)
+- typedef unsigned long u4;
+-# else
+-# if (USHRT_MAX == 0xffffffffUL)
+- typedef unsigned short u4;
+-# else
+-# undef BYFOUR /* can't find a four-byte integer type! */
+-# endif
+-# endif
+-# endif
+-# endif /* STDC */
+-#endif /* !NOBYFOUR */
+-
+-/* Definitions for doing the crc four data bytes at a time. */
+-#ifdef BYFOUR
+-# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
+- (((w)&0xff00)<<8)+(((w)&0xff)<<24))
+- local unsigned long crc32_little OF((unsigned long,
+- const unsigned char FAR *, unsigned));
+- local unsigned long crc32_big OF((unsigned long,
+- const unsigned char FAR *, unsigned));
+-# define TBLS 8
+-#else
+-# define TBLS 1
+-#endif /* BYFOUR */
+-
+-/* Local functions for crc concatenation */
+-local unsigned long gf2_matrix_times OF((unsigned long *mat,
+- unsigned long vec));
+-local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
+-
+-#ifdef DYNAMIC_CRC_TABLE
+-
+-local volatile int crc_table_empty = 1;
+-local unsigned long FAR crc_table[TBLS][256];
+-local void make_crc_table OF((void));
+-#ifdef MAKECRCH
+- local void write_table OF((FILE *, const unsigned long FAR *));
+-#endif /* MAKECRCH */
+-/*
+- Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
+- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+-
+- Polynomials over GF(2) are represented in binary, one bit per coefficient,
+- with the lowest powers in the most significant bit. Then adding polynomials
+- is just exclusive-or, and multiplying a polynomial by x is a right shift by
+- one. If we call the above polynomial p, and represent a byte as the
+- polynomial q, also with the lowest power in the most significant bit (so the
+- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+- where a mod b means the remainder after dividing a by b.
+-
+- This calculation is done using the shift-register method of multiplying and
+- taking the remainder. The register is initialized to zero, and for each
+- incoming bit, x^32 is added mod p to the register if the bit is a one (where
+- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+- x (which is shifting right by one and adding x^32 mod p if the bit shifted
+- out is a one). We start with the highest power (least significant bit) of
+- q and repeat for all eight bits of q.
+-
+- The first table is simply the CRC of all possible eight bit values. This is
+- all the information needed to generate CRCs on data a byte at a time for all
+- combinations of CRC register values and incoming bytes. The remaining tables
+- allow for word-at-a-time CRC calculation for both big-endian and little-
+- endian machines, where a word is four bytes.
+-*/
+-local void make_crc_table()
+-{
+- unsigned long c;
+- int n, k;
+- unsigned long poly; /* polynomial exclusive-or pattern */
+- /* terms of polynomial defining this crc (except x^32): */
+- static volatile int first = 1; /* flag to limit concurrent making */
+- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+-
+- /* See if another task is already doing this (not thread-safe, but better
+- than nothing -- significantly reduces duration of vulnerability in
+- case the advice about DYNAMIC_CRC_TABLE is ignored) */
+- if (first) {
+- first = 0;
+-
+- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+- poly = 0UL;
+- for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+- poly |= 1UL << (31 - p[n]);
+-
+- /* generate a crc for every 8-bit value */
+- for (n = 0; n < 256; n++) {
+- c = (unsigned long)n;
+- for (k = 0; k < 8; k++)
+- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+- crc_table[0][n] = c;
+- }
+-
+-#ifdef BYFOUR
+- /* generate crc for each value followed by one, two, and three zeros,
+- and then the byte reversal of those as well as the first table */
+- for (n = 0; n < 256; n++) {
+- c = crc_table[0][n];
+- crc_table[4][n] = REV(c);
+- for (k = 1; k < 4; k++) {
+- c = crc_table[0][c & 0xff] ^ (c >> 8);
+- crc_table[k][n] = c;
+- crc_table[k + 4][n] = REV(c);
+- }
+- }
+-#endif /* BYFOUR */
+-
+- crc_table_empty = 0;
+- }
+- else { /* not first */
+- /* wait for the other guy to finish (not efficient, but rare) */
+- while (crc_table_empty)
+- ;
+- }
+-
+-#ifdef MAKECRCH
+- /* write out CRC tables to crc32.h */
+- {
+- FILE *out;
+-
+- out = fopen("crc32.h", "w");
+- if (out == NULL) return;
+- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+- fprintf(out, "local const unsigned long FAR ");
+- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
+- write_table(out, crc_table[0]);
+-# ifdef BYFOUR
+- fprintf(out, "#ifdef BYFOUR\n");
+- for (k = 1; k < 8; k++) {
+- fprintf(out, " },\n {\n");
+- write_table(out, crc_table[k]);
+- }
+- fprintf(out, "#endif\n");
+-# endif /* BYFOUR */
+- fprintf(out, " }\n};\n");
+- fclose(out);
+- }
+-#endif /* MAKECRCH */
+-}
+-
+-#ifdef MAKECRCH
+-local void write_table(out, table)
+- FILE *out;
+- const unsigned long FAR *table;
+-{
+- int n;
+-
+- for (n = 0; n < 256; n++)
+- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
+- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+-}
+-#endif /* MAKECRCH */
+-
+-#else /* !DYNAMIC_CRC_TABLE */
+-/* ========================================================================
+- * Tables of CRC-32s of all single-byte values, made by make_crc_table().
+- */
+-#include "crc32.h"
+-#endif /* DYNAMIC_CRC_TABLE */
+-
+-/* =========================================================================
+- * This function can be used by asm versions of crc32()
+- */
+-const unsigned long FAR * ZEXPORT get_crc_table()
+-{
+-#ifdef DYNAMIC_CRC_TABLE
+- if (crc_table_empty)
+- make_crc_table();
+-#endif /* DYNAMIC_CRC_TABLE */
+- return (const unsigned long FAR *)crc_table;
+-}
+-
+-/* ========================================================================= */
+-#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+-#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+-
+-/* ========================================================================= */
+-uLong ZEXPORT crc32(crc, buf, len)
+- uLong crc;
+- const unsigned char FAR *buf;
+- unsigned len;
+-{
+- if (buf == Z_NULL) return 0UL;
+-
+-#ifdef DYNAMIC_CRC_TABLE
+- if (crc_table_empty)
+- make_crc_table();
+-#endif /* DYNAMIC_CRC_TABLE */
+-
+-#ifdef BYFOUR
+- if (sizeof(void *) == sizeof(ptrdiff_t)) {
+- u4 endian;
+-
+- endian = 1;
+- if (*((unsigned char *)(&endian)))
+- return (uLong)crc32_little(crc, buf, len);
+- else
+- return (uLong)crc32_big(crc, buf, len);
+- }
+-#endif /* BYFOUR */
+- crc = crc ^ 0xffffffffUL;
+- while (len >= 8) {
+- DO8;
+- len -= 8;
+- }
+- if (len) do {
+- DO1;
+- } while (--len);
+- return crc ^ 0xffffffffUL;
+-}
+-
+-#ifdef BYFOUR
+-
+-/* ========================================================================= */
+-#define DOLIT4 c ^= *buf4++; \
+- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+-#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
+-
+-/* ========================================================================= */
+-local unsigned long crc32_little(crc, buf, len)
+- unsigned long crc;
+- const unsigned char FAR *buf;
+- unsigned len;
+-{
+- register u4 c;
+- register const u4 FAR *buf4;
+-
+- c = (u4)crc;
+- c = ~c;
+- while (len && ((ptrdiff_t)buf & 3)) {
+- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+- len--;
+- }
+-
+- buf4 = (const u4 FAR *)(const void FAR *)buf;
+- while (len >= 32) {
+- DOLIT32;
+- len -= 32;
+- }
+- while (len >= 4) {
+- DOLIT4;
+- len -= 4;
+- }
+- buf = (const unsigned char FAR *)buf4;
+-
+- if (len) do {
+- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+- } while (--len);
+- c = ~c;
+- return (unsigned long)c;
+-}
+-
+-/* ========================================================================= */
+-#define DOBIG4 c ^= *++buf4; \
+- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+-#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
+-
+-/* ========================================================================= */
+-local unsigned long crc32_big(crc, buf, len)
+- unsigned long crc;
+- const unsigned char FAR *buf;
+- unsigned len;
+-{
+- register u4 c;
+- register const u4 FAR *buf4;
+-
+- c = REV((u4)crc);
+- c = ~c;
+- while (len && ((ptrdiff_t)buf & 3)) {
+- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+- len--;
+- }
+-
+- buf4 = (const u4 FAR *)(const void FAR *)buf;
+- buf4--;
+- while (len >= 32) {
+- DOBIG32;
+- len -= 32;
+- }
+- while (len >= 4) {
+- DOBIG4;
+- len -= 4;
+- }
+- buf4++;
+- buf = (const unsigned char FAR *)buf4;
+-
+- if (len) do {
+- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+- } while (--len);
+- c = ~c;
+- return (unsigned long)(REV(c));
+-}
+-
+-#endif /* BYFOUR */
+-
+-#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
+-
+-/* ========================================================================= */
+-local unsigned long gf2_matrix_times(mat, vec)
+- unsigned long *mat;
+- unsigned long vec;
+-{
+- unsigned long sum;
+-
+- sum = 0;
+- while (vec) {
+- if (vec & 1)
+- sum ^= *mat;
+- vec >>= 1;
+- mat++;
+- }
+- return sum;
+-}
+-
+-/* ========================================================================= */
+-local void gf2_matrix_square(square, mat)
+- unsigned long *square;
+- unsigned long *mat;
+-{
+- int n;
+-
+- for (n = 0; n < GF2_DIM; n++)
+- square[n] = gf2_matrix_times(mat, mat[n]);
+-}
+-
+-/* ========================================================================= */
+-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
+- uLong crc1;
+- uLong crc2;
+- z_off_t len2;
+-{
+- int n;
+- unsigned long row;
+- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
+- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
+-
+- /* degenerate case */
+- if (len2 == 0)
+- return crc1;
+-
+- /* put operator for one zero bit in odd */
+- odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
+- row = 1;
+- for (n = 1; n < GF2_DIM; n++) {
+- odd[n] = row;
+- row <<= 1;
+- }
+-
+- /* put operator for two zero bits in even */
+- gf2_matrix_square(even, odd);
+-
+- /* put operator for four zero bits in odd */
+- gf2_matrix_square(odd, even);
+-
+- /* apply len2 zeros to crc1 (first square will put the operator for one
+- zero byte, eight zero bits, in even) */
+- do {
+- /* apply zeros operator for this bit of len2 */
+- gf2_matrix_square(even, odd);
+- if (len2 & 1)
+- crc1 = gf2_matrix_times(even, crc1);
+- len2 >>= 1;
+-
+- /* if no more bits set, then done */
+- if (len2 == 0)
+- break;
+-
+- /* another iteration of the loop with odd and even swapped */
+- gf2_matrix_square(odd, even);
+- if (len2 & 1)
+- crc1 = gf2_matrix_times(odd, crc1);
+- len2 >>= 1;
+-
+- /* if no more bits set, then done */
+- } while (len2 != 0);
+-
+- /* return combined crc */
+- crc1 ^= crc2;
+- return crc1;
+-}
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zlib.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1381 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* zlib.h -- interface of the 'zlib' general purpose compression library
+- version 1.2.3, July 18th, 2005
+-
+- Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+-
+- This software is provided 'as-is', without any express or implied
+- warranty. In no event will the authors be held liable for any damages
+- arising from the use of this software.
+-
+- Permission is granted to anyone to use this software for any purpose,
+- including commercial applications, and to alter it and redistribute it
+- freely, subject to the following restrictions:
+-
+- 1. The origin of this software must not be misrepresented; you must not
+- claim that you wrote the original software. If you use this software
+- in a product, an acknowledgment in the product documentation would be
+- appreciated but is not required.
+- 2. Altered source versions must be plainly marked as such, and must not be
+- misrepresented as being the original software.
+- 3. This notice may not be removed or altered from any source distribution.
+-
+- Jean-loup Gailly Mark Adler
+- jloup@gzip.org madler@alumni.caltech.edu
+-
+-
+- The data format used by the zlib library is described by RFCs (Request for
+- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+-*/
+-
+-#ifndef ZLIB_H
+-#define ZLIB_H
+-
+-#include "zconf.h"
+-
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-
+-#define ZLIB_VERSION "1.2.3"
+-#define ZLIB_VERNUM 0x1230
+-
+-/*
+- The 'zlib' compression library provides in-memory compression and
+- decompression functions, including integrity checks of the uncompressed
+- data. This version of the library supports only one compression method
+- (deflation) but other algorithms will be added later and will have the same
+- stream interface.
+-
+- Compression can be done in a single step if the buffers are large
+- enough (for example if an input file is mmap'ed), or can be done by
+- repeated calls of the compression function. In the latter case, the
+- application must provide more input and/or consume the output
+- (providing more output space) before each call.
+-
+- The compressed data format used by default by the in-memory functions is
+- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+- around a deflate stream, which is itself documented in RFC 1951.
+-
+- The library also supports reading and writing files in gzip (.gz) format
+- with an interface similar to that of stdio using the functions that start
+- with "gz". The gzip format is different from the zlib format. gzip is a
+- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+-
+- This library can optionally read and write gzip streams in memory as well.
+-
+- The zlib format was designed to be compact and fast for use in memory
+- and on communications channels. The gzip format was designed for single-
+- file compression on file systems, has a larger header than zlib to maintain
+- directory information, and uses a different, slower check method than zlib.
+-
+- The library does not install any signal handler. The decoder checks
+- the consistency of the compressed data, so the library should never
+- crash even in case of corrupted input.
+-*/
+-
+-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+-typedef void (*free_func) OF((voidpf opaque, voidpf address));
+-
+-struct internal_state;
+-
+-typedef struct z_stream_s {
+- Bytef *next_in; /* next input byte */
+- uInt avail_in; /* number of bytes available at next_in */
+- uLong total_in; /* total nb of input bytes read so far */
+-
+- Bytef *next_out; /* next output byte should be put there */
+- uInt avail_out; /* remaining free space at next_out */
+- uLong total_out; /* total nb of bytes output so far */
+-
+- char *msg; /* last error message, NULL if no error */
+- struct internal_state FAR *state; /* not visible by applications */
+-
+- alloc_func zalloc; /* used to allocate the internal state */
+- free_func zfree; /* used to free the internal state */
+- voidpf opaque; /* private data object passed to zalloc and zfree */
+-
+- int data_type; /* best guess about the data type: binary or text */
+- uLong adler; /* adler32 value of the uncompressed data */
+- uLong reserved; /* reserved for future use */
+-} z_stream;
+-
+-typedef z_stream FAR *z_streamp;
+-
+-/*
+- gzip header information passed to and from zlib routines. See RFC 1952
+- for more details on the meanings of these fields.
+-*/
+-typedef struct gz_header_s {
+- int text; /* true if compressed data believed to be text */
+- uLong time; /* modification time */
+- int xflags; /* extra flags (not used when writing a gzip file) */
+- int os; /* operating system */
+- Bytef *extra; /* pointer to extra field or Z_NULL if none */
+- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
+- uInt extra_max; /* space at extra (only when reading header) */
+- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
+- uInt name_max; /* space at name (only when reading header) */
+- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
+- uInt comm_max; /* space at comment (only when reading header) */
+- int hcrc; /* true if there was or will be a header crc */
+- int done; /* true when done reading gzip header (not used
+- when writing a gzip file) */
+-} gz_header;
+-
+-typedef gz_header FAR *gz_headerp;
+-
+-/*
+- The application must update next_in and avail_in when avail_in has
+- dropped to zero. It must update next_out and avail_out when avail_out
+- has dropped to zero. The application must initialize zalloc, zfree and
+- opaque before calling the init function. All other fields are set by the
+- compression library and must not be updated by the application.
+-
+- The opaque value provided by the application will be passed as the first
+- parameter for calls of zalloc and zfree. This can be useful for custom
+- memory management. The compression library attaches no meaning to the
+- opaque value.
+-
+- zalloc must return Z_NULL if there is not enough memory for the object.
+- If zlib is used in a multi-threaded application, zalloc and zfree must be
+- thread safe.
+-
+- On 16-bit systems, the functions zalloc and zfree must be able to allocate
+- exactly 65536 bytes, but will not be required to allocate more than this
+- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+- pointers returned by zalloc for objects of exactly 65536 bytes *must*
+- have their offset normalized to zero. The default allocation function
+- provided by this library ensures this (see zutil.c). To reduce memory
+- requirements and avoid any allocation of 64K objects, at the expense of
+- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+-
+- The fields total_in and total_out can be used for statistics or
+- progress reports. After compression, total_in holds the total size of
+- the uncompressed data and may be saved for use in the decompressor
+- (particularly if the decompressor wants to decompress everything in
+- a single step).
+-*/
+-
+- /* constants */
+-
+-#define Z_NO_FLUSH 0
+-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+-#define Z_SYNC_FLUSH 2
+-#define Z_FULL_FLUSH 3
+-#define Z_FINISH 4
+-#define Z_BLOCK 5
+-/* Allowed flush values; see deflate() and inflate() below for details */
+-
+-#define Z_OK 0
+-#define Z_STREAM_END 1
+-#define Z_NEED_DICT 2
+-#define Z_ERRNO (-1)
+-#define Z_STREAM_ERROR (-2)
+-#define Z_DATA_ERROR (-3)
+-#define Z_MEM_ERROR (-4)
+-#define Z_BUF_ERROR (-5)
+-#define Z_VERSION_ERROR (-6)
+-/* Return codes for the compression/decompression functions. Negative
+- * values are errors, positive values are used for special but normal events.
+- */
+-
+-#define Z_NO_COMPRESSION 0
+-#define Z_BEST_SPEED 1
+-#define Z_BEST_COMPRESSION 9
+-#define Z_DEFAULT_COMPRESSION (-1)
+-/* compression levels */
+-
+-#define Z_FILTERED 1
+-#define Z_HUFFMAN_ONLY 2
+-#define Z_RLE 3
+-#define Z_FIXED 4
+-#define Z_DEFAULT_STRATEGY 0
+-/* compression strategy; see deflateInit2() below for details */
+-
+-#define Z_BINARY 0
+-#define Z_TEXT 1
+-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
+-#define Z_UNKNOWN 2
+-/* Possible values of the data_type field (though see inflate()) */
+-
+-#define Z_DEFLATED 8
+-/* The deflate compression method (the only one supported in this version) */
+-
+-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+-
+-#define zlib_version zlibVersion()
+-/* for compatibility with versions < 1.0.2 */
+-
+- /* basic functions */
+-
+-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+- If the first character differs, the library code actually used is
+- not compatible with the zlib.h header file used by the application.
+- This check is automatically made by deflateInit and inflateInit.
+- */
+-
+-/*
+-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+-
+- Initializes the internal stream state for compression. The fields
+- zalloc, zfree and opaque must be initialized before by the caller.
+- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+- use default allocation functions.
+-
+- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+- 1 gives best speed, 9 gives best compression, 0 gives no compression at
+- all (the input data is simply copied a block at a time).
+- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+- compression (currently equivalent to level 6).
+-
+- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+- with the version assumed by the caller (ZLIB_VERSION).
+- msg is set to null if there is no error message. deflateInit does not
+- perform any compression: this will be done by deflate().
+-*/
+-
+-
+-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+-/*
+- deflate compresses as much data as possible, and stops when the input
+- buffer becomes empty or the output buffer becomes full. It may introduce some
+- output latency (reading input without producing any output) except when
+- forced to flush.
+-
+- The detailed semantics are as follows. deflate performs one or both of the
+- following actions:
+-
+- - Compress more input starting at next_in and update next_in and avail_in
+- accordingly. If not all input can be processed (because there is not
+- enough room in the output buffer), next_in and avail_in are updated and
+- processing will resume at this point for the next call of deflate().
+-
+- - Provide more output starting at next_out and update next_out and avail_out
+- accordingly. This action is forced if the parameter flush is non zero.
+- Forcing flush frequently degrades the compression ratio, so this parameter
+- should be set only when necessary (in interactive applications).
+- Some output may be provided even if flush is not set.
+-
+- Before the call of deflate(), the application should ensure that at least
+- one of the actions is possible, by providing more input and/or consuming
+- more output, and updating avail_in or avail_out accordingly; avail_out
+- should never be zero before the call. The application can consume the
+- compressed output when it wants, for example when the output buffer is full
+- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+- and with zero avail_out, it must be called again after making room in the
+- output buffer because there might be more output pending.
+-
+- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+- decide how much data to accumualte before producing output, in order to
+- maximize compression.
+-
+- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+- flushed to the output buffer and the output is aligned on a byte boundary, so
+- that the decompressor can get all input data available so far. (In particular
+- avail_in is zero after the call if enough output space has been provided
+- before the call.) Flushing may degrade compression for some compression
+- algorithms and so it should be used only when necessary.
+-
+- If flush is set to Z_FULL_FLUSH, all output is flushed as with
+- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+- restart from this point if previous compressed data has been damaged or if
+- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+- compression.
+-
+- If deflate returns with avail_out == 0, this function must be called again
+- with the same value of the flush parameter and more output space (updated
+- avail_out), until the flush is complete (deflate returns with non-zero
+- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+- avail_out is greater than six to avoid repeated flush markers due to
+- avail_out == 0 on return.
+-
+- If the parameter flush is set to Z_FINISH, pending input is processed,
+- pending output is flushed and deflate returns with Z_STREAM_END if there
+- was enough output space; if deflate returns with Z_OK, this function must be
+- called again with Z_FINISH and more output space (updated avail_out) but no
+- more input data, until it returns with Z_STREAM_END or an error. After
+- deflate has returned Z_STREAM_END, the only possible operations on the
+- stream are deflateReset or deflateEnd.
+-
+- Z_FINISH can be used immediately after deflateInit if all the compression
+- is to be done in a single step. In this case, avail_out must be at least
+- the value returned by deflateBound (see below). If deflate does not return
+- Z_STREAM_END, then it must be called again as described above.
+-
+- deflate() sets strm->adler to the adler32 checksum of all input read
+- so far (that is, total_in bytes).
+-
+- deflate() may update strm->data_type if it can make a good guess about
+- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
+- binary. This field is only for information purposes and does not affect
+- the compression algorithm in any manner.
+-
+- deflate() returns Z_OK if some progress has been made (more input
+- processed or more output produced), Z_STREAM_END if all input has been
+- consumed and all output has been produced (only when flush is set to
+- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+- fatal, and deflate() can be called again with more input and more output
+- space to continue compressing.
+-*/
+-
+-
+-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+-/*
+- All dynamically allocated data structures for this stream are freed.
+- This function discards any unprocessed input and does not flush any
+- pending output.
+-
+- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+- prematurely (some input or output was discarded). In the error case,
+- msg may be set but then points to a static string (which must not be
+- deallocated).
+-*/
+-
+-
+-/*
+-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+-
+- Initializes the internal stream state for decompression. The fields
+- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+- value depends on the compression method), inflateInit determines the
+- compression method from the zlib header and allocates all data structures
+- accordingly; otherwise the allocation will be deferred to the first call of
+- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+- use default allocation functions.
+-
+- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+- version assumed by the caller. msg is set to null if there is no error
+- message. inflateInit does not perform any decompression apart from reading
+- the zlib header if present: this will be done by inflate(). (So next_in and
+- avail_in may be modified, but next_out and avail_out are unchanged.)
+-*/
+-
+-
+-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+-/*
+- inflate decompresses as much data as possible, and stops when the input
+- buffer becomes empty or the output buffer becomes full. It may introduce
+- some output latency (reading input without producing any output) except when
+- forced to flush.
+-
+- The detailed semantics are as follows. inflate performs one or both of the
+- following actions:
+-
+- - Decompress more input starting at next_in and update next_in and avail_in
+- accordingly. If not all input can be processed (because there is not
+- enough room in the output buffer), next_in is updated and processing
+- will resume at this point for the next call of inflate().
+-
+- - Provide more output starting at next_out and update next_out and avail_out
+- accordingly. inflate() provides as much output as possible, until there
+- is no more input data or no more space in the output buffer (see below
+- about the flush parameter).
+-
+- Before the call of inflate(), the application should ensure that at least
+- one of the actions is possible, by providing more input and/or consuming
+- more output, and updating the next_* and avail_* values accordingly.
+- The application can consume the uncompressed output when it wants, for
+- example when the output buffer is full (avail_out == 0), or after each
+- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+- must be called again after making room in the output buffer because there
+- might be more output pending.
+-
+- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+- Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+- output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+- if and when it gets to the next deflate block boundary. When decoding the
+- zlib or gzip format, this will cause inflate() to return immediately after
+- the header and before the first block. When doing a raw inflate, inflate()
+- will go ahead and process the first block, and will return when it gets to
+- the end of that block, or when it runs out of data.
+-
+- The Z_BLOCK option assists in appending to or combining deflate streams.
+- Also to assist in this, on return inflate() will set strm->data_type to the
+- number of unused bits in the last byte taken from strm->next_in, plus 64
+- if inflate() is currently decoding the last block in the deflate stream,
+- plus 128 if inflate() returned immediately after decoding an end-of-block
+- code or decoding the complete header up to just before the first byte of the
+- deflate stream. The end-of-block will not be indicated until all of the
+- uncompressed data from that block has been written to strm->next_out. The
+- number of unused bits may in general be greater than seven, except when
+- bit 7 of data_type is set, in which case the number of unused bits will be
+- less than eight.
+-
+- inflate() should normally be called until it returns Z_STREAM_END or an
+- error. However if all decompression is to be performed in a single step
+- (a single call of inflate), the parameter flush should be set to
+- Z_FINISH. In this case all pending input is processed and all pending
+- output is flushed; avail_out must be large enough to hold all the
+- uncompressed data. (The size of the uncompressed data may have been saved
+- by the compressor for this purpose.) The next operation on this stream must
+- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+- is never required, but can be used to inform inflate that a faster approach
+- may be used for the single inflate() call.
+-
+- In this implementation, inflate() always flushes as much output as
+- possible to the output buffer, and always uses the faster approach on the
+- first call. So the only effect of the flush parameter in this implementation
+- is on the return value of inflate(), as noted below, or when it returns early
+- because Z_BLOCK is used.
+-
+- If a preset dictionary is needed after this call (see inflateSetDictionary
+- below), inflate sets strm->adler to the adler32 checksum of the dictionary
+- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+- strm->adler to the adler32 checksum of all output produced so far (that is,
+- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+- below. At the end of the stream, inflate() checks that its computed adler32
+- checksum is equal to that saved by the compressor and returns Z_STREAM_END
+- only if the checksum is correct.
+-
+- inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+- deflate data. The header type is detected automatically. Any information
+- contained in the gzip header is not retained, so applications that need that
+- information should instead use raw inflate, see inflateInit2() below, or
+- inflateBack() and perform their own processing of the gzip header and
+- trailer.
+-
+- inflate() returns Z_OK if some progress has been made (more input processed
+- or more output produced), Z_STREAM_END if the end of the compressed data has
+- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+- corrupted (input stream not conforming to the zlib format or incorrect check
+- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+- if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+- inflate() can be called again with more input and more output space to
+- continue decompressing. If Z_DATA_ERROR is returned, the application may then
+- call inflateSync() to look for a good compression block if a partial recovery
+- of the data is desired.
+-*/
+-
+-
+-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+-/*
+- All dynamically allocated data structures for this stream are freed.
+- This function discards any unprocessed input and does not flush any
+- pending output.
+-
+- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+- was inconsistent. In the error case, msg may be set but then points to a
+- static string (which must not be deallocated).
+-*/
+-
+- /* Advanced functions */
+-
+-/*
+- The following functions are needed only in some special applications.
+-*/
+-
+-/*
+-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+- int level,
+- int method,
+- int windowBits,
+- int memLevel,
+- int strategy));
+-
+- This is another version of deflateInit with more compression options. The
+- fields next_in, zalloc, zfree and opaque must be initialized before by
+- the caller.
+-
+- The method parameter is the compression method. It must be Z_DEFLATED in
+- this version of the library.
+-
+- The windowBits parameter is the base two logarithm of the window size
+- (the size of the history buffer). It should be in the range 8..15 for this
+- version of the library. Larger values of this parameter result in better
+- compression at the expense of memory usage. The default value is 15 if
+- deflateInit is used instead.
+-
+- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+- determines the window size. deflate() will then generate raw deflate data
+- with no zlib header or trailer, and will not compute an adler32 check value.
+-
+- windowBits can also be greater than 15 for optional gzip encoding. Add
+- 16 to windowBits to write a simple gzip header and trailer around the
+- compressed data instead of a zlib wrapper. The gzip header will have no
+- file name, no extra data, no comment, no modification time (set to zero),
+- no header crc, and the operating system will be set to 255 (unknown). If a
+- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+-
+- The memLevel parameter specifies how much memory should be allocated
+- for the internal compression state. memLevel=1 uses minimum memory but
+- is slow and reduces compression ratio; memLevel=9 uses maximum memory
+- for optimal speed. The default value is 8. See zconf.h for total memory
+- usage as a function of windowBits and memLevel.
+-
+- The strategy parameter is used to tune the compression algorithm. Use the
+- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+- string match), or Z_RLE to limit match distances to one (run-length
+- encoding). Filtered data consists mostly of small values with a somewhat
+- random distribution. In this case, the compression algorithm is tuned to
+- compress them better. The effect of Z_FILTERED is to force more Huffman
+- coding and less string matching; it is somewhat intermediate between
+- Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+- Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+- parameter only affects the compression ratio but not the correctness of the
+- compressed output even if it is not set appropriately. Z_FIXED prevents the
+- use of dynamic Huffman codes, allowing for a simpler decoder for special
+- applications.
+-
+- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+- method). msg is set to null if there is no error message. deflateInit2 does
+- not perform any compression: this will be done by deflate().
+-*/
+-
+-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+- const Bytef *dictionary,
+- uInt dictLength));
+-/*
+- Initializes the compression dictionary from the given byte sequence
+- without producing any compressed output. This function must be called
+- immediately after deflateInit, deflateInit2 or deflateReset, before any
+- call of deflate. The compressor and decompressor must use exactly the same
+- dictionary (see inflateSetDictionary).
+-
+- The dictionary should consist of strings (byte sequences) that are likely
+- to be encountered later in the data to be compressed, with the most commonly
+- used strings preferably put towards the end of the dictionary. Using a
+- dictionary is most useful when the data to be compressed is short and can be
+- predicted with good accuracy; the data can then be compressed better than
+- with the default empty dictionary.
+-
+- Depending on the size of the compression data structures selected by
+- deflateInit or deflateInit2, a part of the dictionary may in effect be
+- discarded, for example if the dictionary is larger than the window size in
+- deflate or deflate2. Thus the strings most likely to be useful should be
+- put at the end of the dictionary, not at the front. In addition, the
+- current implementation of deflate will use at most the window size minus
+- 262 bytes of the provided dictionary.
+-
+- Upon return of this function, strm->adler is set to the adler32 value
+- of the dictionary; the decompressor may later use this value to determine
+- which dictionary has been used by the compressor. (The adler32 value
+- applies to the whole dictionary even if only a subset of the dictionary is
+- actually used by the compressor.) If a raw deflate was requested, then the
+- adler32 value is not computed and strm->adler is not set.
+-
+- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+- parameter is invalid (such as NULL dictionary) or the stream state is
+- inconsistent (for example if deflate has already been called for this stream
+- or if the compression method is bsort). deflateSetDictionary does not
+- perform any compression: this will be done by deflate().
+-*/
+-
+-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+- z_streamp source));
+-/*
+- Sets the destination stream as a complete copy of the source stream.
+-
+- This function can be useful when several compression strategies will be
+- tried, for example when there are several ways of pre-processing the input
+- data with a filter. The streams that will be discarded should then be freed
+- by calling deflateEnd. Note that deflateCopy duplicates the internal
+- compression state which can be quite large, so this strategy is slow and
+- can consume lots of memory.
+-
+- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+- (such as zalloc being NULL). msg is left unchanged in both source and
+- destination.
+-*/
+-
+-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+-/*
+- This function is equivalent to deflateEnd followed by deflateInit,
+- but does not free and reallocate all the internal compression state.
+- The stream will keep the same compression level and any other attributes
+- that may have been set by deflateInit2.
+-
+- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent (such as zalloc or state being NULL).
+-*/
+-
+-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+- int level,
+- int strategy));
+-/*
+- Dynamically update the compression level and compression strategy. The
+- interpretation of level and strategy is as in deflateInit2. This can be
+- used to switch between compression and straight copy of the input data, or
+- to switch to a different kind of input data requiring a different
+- strategy. If the compression level is changed, the input available so far
+- is compressed with the old level (and may be flushed); the new level will
+- take effect only at the next call of deflate().
+-
+- Before the call of deflateParams, the stream state must be set as for
+- a call of deflate(), since the currently available input may have to
+- be compressed and flushed. In particular, strm->avail_out must be non-zero.
+-
+- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+- if strm->avail_out was zero.
+-*/
+-
+-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+- int good_length,
+- int max_lazy,
+- int nice_length,
+- int max_chain));
+-/*
+- Fine tune deflate's internal compression parameters. This should only be
+- used by someone who understands the algorithm used by zlib's deflate for
+- searching for the best matching string, and even then only by the most
+- fanatic optimizer trying to squeeze out the last compressed bit for their
+- specific input data. Read the deflate.c source code for the meaning of the
+- max_lazy, good_length, nice_length, and max_chain parameters.
+-
+- deflateTune() can be called after deflateInit() or deflateInit2(), and
+- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+- */
+-
+-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+- uLong sourceLen));
+-/*
+- deflateBound() returns an upper bound on the compressed size after
+- deflation of sourceLen bytes. It must be called after deflateInit()
+- or deflateInit2(). This would be used to allocate an output buffer
+- for deflation in a single pass, and so would be called before deflate().
+-*/
+-
+-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+- int bits,
+- int value));
+-/*
+- deflatePrime() inserts bits in the deflate output stream. The intent
+- is that this function is used to start off the deflate output with the
+- bits leftover from a previous deflate stream when appending to it. As such,
+- this function can only be used for raw deflate, and must be used before the
+- first deflate() call after a deflateInit2() or deflateReset(). bits must be
+- less than or equal to 16, and that many of the least significant bits of
+- value will be inserted in the output.
+-
+- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent.
+-*/
+-
+-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+- gz_headerp head));
+-/*
+- deflateSetHeader() provides gzip header information for when a gzip
+- stream is requested by deflateInit2(). deflateSetHeader() may be called
+- after deflateInit2() or deflateReset() and before the first call of
+- deflate(). The text, time, os, extra field, name, and comment information
+- in the provided gz_header structure are written to the gzip header (xflag is
+- ignored -- the extra flags are set according to the compression level). The
+- caller must assure that, if not Z_NULL, name and comment are terminated with
+- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+- available there. If hcrc is true, a gzip header crc is included. Note that
+- the current versions of the command-line version of gzip (up through version
+- 1.3.x) do not support header crc's, and will report that it is a "multi-part
+- gzip file" and give up.
+-
+- If deflateSetHeader is not used, the default gzip header has text false,
+- the time set to zero, and os set to 255, with no extra, name, or comment
+- fields. The gzip header is returned to the default state by deflateReset().
+-
+- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent.
+-*/
+-
+-/*
+-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+- int windowBits));
+-
+- This is another version of inflateInit with an extra parameter. The
+- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+- before by the caller.
+-
+- The windowBits parameter is the base two logarithm of the maximum window
+- size (the size of the history buffer). It should be in the range 8..15 for
+- this version of the library. The default value is 15 if inflateInit is used
+- instead. windowBits must be greater than or equal to the windowBits value
+- provided to deflateInit2() while compressing, or it must be equal to 15 if
+- deflateInit2() was not used. If a compressed stream with a larger window
+- size is given as input, inflate() will return with the error code
+- Z_DATA_ERROR instead of trying to allocate a larger window.
+-
+- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+- determines the window size. inflate() will then process raw deflate data,
+- not looking for a zlib or gzip header, not generating a check value, and not
+- looking for any check values for comparison at the end of the stream. This
+- is for use with other formats that use the deflate compressed data format
+- such as zip. Those formats provide their own check values. If a custom
+- format is developed using the raw deflate format for compressed data, it is
+- recommended that a check value such as an adler32 or a crc32 be applied to
+- the uncompressed data as is done in the zlib, gzip, and zip formats. For
+- most applications, the zlib format should be used as is. Note that comments
+- above on the use in deflateInit2() applies to the magnitude of windowBits.
+-
+- windowBits can also be greater than 15 for optional gzip decoding. Add
+- 32 to windowBits to enable zlib and gzip decoding with automatic header
+- detection, or add 16 to decode only the gzip format (the zlib format will
+- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
+- a crc32 instead of an adler32.
+-
+- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+- memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
+- is set to null if there is no error message. inflateInit2 does not perform
+- any decompression apart from reading the zlib header if present: this will
+- be done by inflate(). (So next_in and avail_in may be modified, but next_out
+- and avail_out are unchanged.)
+-*/
+-
+-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+- const Bytef *dictionary,
+- uInt dictLength));
+-/*
+- Initializes the decompression dictionary from the given uncompressed byte
+- sequence. This function must be called immediately after a call of inflate,
+- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
+- can be determined from the adler32 value returned by that call of inflate.
+- The compressor and decompressor must use exactly the same dictionary (see
+- deflateSetDictionary). For raw inflate, this function can be called
+- immediately after inflateInit2() or inflateReset() and before any call of
+- inflate() to set the dictionary. The application must insure that the
+- dictionary that was used for compression is provided.
+-
+- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+- parameter is invalid (such as NULL dictionary) or the stream state is
+- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+- expected one (incorrect adler32 value). inflateSetDictionary does not
+- perform any decompression: this will be done by subsequent calls of
+- inflate().
+-*/
+-
+-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+-/*
+- Skips invalid compressed data until a full flush point (see above the
+- description of deflate with Z_FULL_FLUSH) can be found, or until all
+- available input is skipped. No output is provided.
+-
+- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+- case, the application may save the current current value of total_in which
+- indicates where valid compressed data was found. In the error case, the
+- application may repeatedly call inflateSync, providing more input each time,
+- until success or end of the input data.
+-*/
+-
+-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+- z_streamp source));
+-/*
+- Sets the destination stream as a complete copy of the source stream.
+-
+- This function can be useful when randomly accessing a large stream. The
+- first pass through the stream can periodically record the inflate state,
+- allowing restarting inflate at those points when randomly accessing the
+- stream.
+-
+- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+- (such as zalloc being NULL). msg is left unchanged in both source and
+- destination.
+-*/
+-
+-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+-/*
+- This function is equivalent to inflateEnd followed by inflateInit,
+- but does not free and reallocate all the internal decompression state.
+- The stream will keep attributes that may have been set by inflateInit2.
+-
+- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent (such as zalloc or state being NULL).
+-*/
+-
+-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+- int bits,
+- int value));
+-/*
+- This function inserts bits in the inflate input stream. The intent is
+- that this function is used to start inflating at a bit position in the
+- middle of a byte. The provided bits will be used before any bytes are used
+- from next_in. This function should only be used with raw inflate, and
+- should be used before the first inflate() call after inflateInit2() or
+- inflateReset(). bits must be less than or equal to 16, and that many of the
+- least significant bits of value will be inserted in the input.
+-
+- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent.
+-*/
+-
+-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+- gz_headerp head));
+-/*
+- inflateGetHeader() requests that gzip header information be stored in the
+- provided gz_header structure. inflateGetHeader() may be called after
+- inflateInit2() or inflateReset(), and before the first call of inflate().
+- As inflate() processes the gzip stream, head->done is zero until the header
+- is completed, at which time head->done is set to one. If a zlib stream is
+- being decoded, then head->done is set to -1 to indicate that there will be
+- no gzip header information forthcoming. Note that Z_BLOCK can be used to
+- force inflate() to return immediately after header processing is complete
+- and before any actual data is decompressed.
+-
+- The text, time, xflags, and os fields are filled in with the gzip header
+- contents. hcrc is set to true if there is a header CRC. (The header CRC
+- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+- contains the maximum number of bytes to write to extra. Once done is true,
+- extra_len contains the actual extra field length, and extra contains the
+- extra field, or that field truncated if extra_max is less than extra_len.
+- If name is not Z_NULL, then up to name_max characters are written there,
+- terminated with a zero unless the length is greater than name_max. If
+- comment is not Z_NULL, then up to comm_max characters are written there,
+- terminated with a zero unless the length is greater than comm_max. When
+- any of extra, name, or comment are not Z_NULL and the respective field is
+- not present in the header, then that field is set to Z_NULL to signal its
+- absence. This allows the use of deflateSetHeader() with the returned
+- structure to duplicate the header. However if those fields are set to
+- allocated memory, then the application will need to save those pointers
+- elsewhere so that they can be eventually freed.
+-
+- If inflateGetHeader is not used, then the header information is simply
+- discarded. The header is always checked for validity, including the header
+- CRC if present. inflateReset() will reset the process to discard the header
+- information. The application would need to call inflateGetHeader() again to
+- retrieve the header from the next gzip stream.
+-
+- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+- stream state was inconsistent.
+-*/
+-
+-/*
+-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+- unsigned char FAR *window));
+-
+- Initialize the internal stream state for decompression using inflateBack()
+- calls. The fields zalloc, zfree and opaque in strm must be initialized
+- before the call. If zalloc and zfree are Z_NULL, then the default library-
+- derived memory allocation routines are used. windowBits is the base two
+- logarithm of the window size, in the range 8..15. window is a caller
+- supplied buffer of that size. Except for special applications where it is
+- assured that deflate was used with small window sizes, windowBits must be 15
+- and a 32K byte window must be supplied to be able to decompress general
+- deflate streams.
+-
+- See inflateBack() for the usage of these routines.
+-
+- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+- the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+- be allocated, or Z_VERSION_ERROR if the version of the library does not
+- match the version of the header file.
+-*/
+-
+-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+-
+-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+- in_func in, void FAR *in_desc,
+- out_func out, void FAR *out_desc));
+-/*
+- inflateBack() does a raw inflate with a single call using a call-back
+- interface for input and output. This is more efficient than inflate() for
+- file i/o applications in that it avoids copying between the output and the
+- sliding window by simply making the window itself the output buffer. This
+- function trusts the application to not change the output buffer passed by
+- the output function, at least until inflateBack() returns.
+-
+- inflateBackInit() must be called first to allocate the internal state
+- and to initialize the state with the user-provided window buffer.
+- inflateBack() may then be used multiple times to inflate a complete, raw
+- deflate stream with each call. inflateBackEnd() is then called to free
+- the allocated state.
+-
+- A raw deflate stream is one with no zlib or gzip header or trailer.
+- This routine would normally be used in a utility that reads zip or gzip
+- files and writes out uncompressed files. The utility would decode the
+- header and process the trailer on its own, hence this routine expects
+- only the raw deflate stream to decompress. This is different from the
+- normal behavior of inflate(), which expects either a zlib or gzip header and
+- trailer around the deflate stream.
+-
+- inflateBack() uses two subroutines supplied by the caller that are then
+- called by inflateBack() for input and output. inflateBack() calls those
+- routines until it reads a complete deflate stream and writes out all of the
+- uncompressed data, or until it encounters an error. The function's
+- parameters and return types are defined above in the in_func and out_func
+- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
+- number of bytes of provided input, and a pointer to that input in buf. If
+- there is no input available, in() must return zero--buf is ignored in that
+- case--and inflateBack() will return a buffer error. inflateBack() will call
+- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
+- should return zero on success, or non-zero on failure. If out() returns
+- non-zero, inflateBack() will return with an error. Neither in() nor out()
+- are permitted to change the contents of the window provided to
+- inflateBackInit(), which is also the buffer that out() uses to write from.
+- The length written by out() will be at most the window size. Any non-zero
+- amount of input may be provided by in().
+-
+- For convenience, inflateBack() can be provided input on the first call by
+- setting strm->next_in and strm->avail_in. If that input is exhausted, then
+- in() will be called. Therefore strm->next_in must be initialized before
+- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
+- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
+- must also be initialized, and then if strm->avail_in is not zero, input will
+- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+-
+- The in_desc and out_desc parameters of inflateBack() is passed as the
+- first parameter of in() and out() respectively when they are called. These
+- descriptors can be optionally used to pass any information that the caller-
+- supplied in() and out() functions need to do their job.
+-
+- On return, inflateBack() will set strm->next_in and strm->avail_in to
+- pass back any unused input that was provided by the last in() call. The
+- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+- if in() or out() returned an error, Z_DATA_ERROR if there was a format
+- error in the deflate stream (in which case strm->msg is set to indicate the
+- nature of the error), or Z_STREAM_ERROR if the stream was not properly
+- initialized. In the case of Z_BUF_ERROR, an input or output error can be
+- distinguished using strm->next_in which will be Z_NULL only if in() returned
+- an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+- out() returning non-zero. (in() will always be called before out(), so
+- strm->next_in is assured to be defined if out() returns non-zero.) Note
+- that inflateBack() cannot return Z_OK.
+-*/
+-
+-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+-/*
+- All memory allocated by inflateBackInit() is freed.
+-
+- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+- state was inconsistent.
+-*/
+-
+-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+-/* Return flags indicating compile-time options.
+-
+- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+- 1.0: size of uInt
+- 3.2: size of uLong
+- 5.4: size of voidpf (pointer)
+- 7.6: size of z_off_t
+-
+- Compiler, assembler, and debug options:
+- 8: DEBUG
+- 9: ASMV or ASMINF -- use ASM code
+- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+- 11: 0 (reserved)
+-
+- One-time table building (smaller code, but not thread-safe if true):
+- 12: BUILDFIXED -- build static block decoding tables when needed
+- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+- 14,15: 0 (reserved)
+-
+- Library content (indicates missing functionality):
+- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+- deflate code when not needed)
+- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+- and decode gzip streams (to avoid linking crc code)
+- 18-19: 0 (reserved)
+-
+- Operation variations (changes in library functionality):
+- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+- 21: FASTEST -- deflate algorithm with only one, lowest compression level
+- 22,23: 0 (reserved)
+-
+- The sprintf variant used by gzprintf (zero is best):
+- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+-
+- Remainder:
+- 27-31: 0 (reserved)
+- */
+-
+-
+- /* utility functions */
+-
+-/*
+- The following utility functions are implemented on top of the
+- basic stream-oriented functions. To simplify the interface, some
+- default options are assumed (compression level and memory usage,
+- standard memory allocation functions). The source code of these
+- utility functions can easily be modified if you need special options.
+-*/
+-
+-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+- const Bytef *source, uLong sourceLen));
+-/*
+- Compresses the source buffer into the destination buffer. sourceLen is
+- the byte length of the source buffer. Upon entry, destLen is the total
+- size of the destination buffer, which must be at least the value returned
+- by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+- compressed buffer.
+- This function can be used to compress a whole file at once if the
+- input file is mmap'ed.
+- compress returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_BUF_ERROR if there was not enough room in the output
+- buffer.
+-*/
+-
+-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+- const Bytef *source, uLong sourceLen,
+- int level));
+-/*
+- Compresses the source buffer into the destination buffer. The level
+- parameter has the same meaning as in deflateInit. sourceLen is the byte
+- length of the source buffer. Upon entry, destLen is the total size of the
+- destination buffer, which must be at least the value returned by
+- compressBound(sourceLen). Upon exit, destLen is the actual size of the
+- compressed buffer.
+-
+- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+- Z_STREAM_ERROR if the level parameter is invalid.
+-*/
+-
+-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+-/*
+- compressBound() returns an upper bound on the compressed size after
+- compress() or compress2() on sourceLen bytes. It would be used before
+- a compress() or compress2() call to allocate the destination buffer.
+-*/
+-
+-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+- const Bytef *source, uLong sourceLen));
+-/*
+- Decompresses the source buffer into the destination buffer. sourceLen is
+- the byte length of the source buffer. Upon entry, destLen is the total
+- size of the destination buffer, which must be large enough to hold the
+- entire uncompressed data. (The size of the uncompressed data must have
+- been saved previously by the compressor and transmitted to the decompressor
+- by some mechanism outside the scope of this compression library.)
+- Upon exit, destLen is the actual size of the compressed buffer.
+- This function can be used to decompress a whole file at once if the
+- input file is mmap'ed.
+-
+- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+- enough memory, Z_BUF_ERROR if there was not enough room in the output
+- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+-*/
+-
+-
+-typedef voidp gzFile;
+-
+-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+-/*
+- Opens a gzip (.gz) file for reading or writing. The mode parameter
+- is as in fopen ("rb" or "wb") but can also include a compression level
+- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+- Huffman only compression as in "wb1h", or 'R' for run-length encoding
+- as in "wb1R". (See the description of deflateInit2 for more information
+- about the strategy parameter.)
+-
+- gzopen can be used to read a file which is not in gzip format; in this
+- case gzread will directly read from the file without decompression.
+-
+- gzopen returns NULL if the file could not be opened or if there was
+- insufficient memory to allocate the (de)compression state; errno
+- can be checked to distinguish the two cases (if errno is zero, the
+- zlib error is Z_MEM_ERROR). */
+-
+-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+-/*
+- gzdopen() associates a gzFile with the file descriptor fd. File
+- descriptors are obtained from calls like open, dup, creat, pipe or
+- fileno (in the file has been previously opened with fopen).
+- The mode parameter is as in gzopen.
+- The next call of gzclose on the returned gzFile will also close the
+- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+- gzdopen returns NULL if there was insufficient memory to allocate
+- the (de)compression state.
+-*/
+-
+-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+-/*
+- Dynamically update the compression level or strategy. See the description
+- of deflateInit2 for the meaning of these parameters.
+- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+- opened for writing.
+-*/
+-
+-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+-/*
+- Reads the given number of uncompressed bytes from the compressed file.
+- If the input file was not in gzip format, gzread copies the given number
+- of bytes into the buffer.
+- gzread returns the number of uncompressed bytes actually read (0 for
+- end of file, -1 for error). */
+-
+-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+- voidpc buf, unsigned len));
+-/*
+- Writes the given number of uncompressed bytes into the compressed file.
+- gzwrite returns the number of uncompressed bytes actually written
+- (0 in case of error).
+-*/
+-
+-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+-/*
+- Converts, formats, and writes the args to the compressed file under
+- control of the format string, as in fprintf. gzprintf returns the number of
+- uncompressed bytes actually written (0 in case of error). The number of
+- uncompressed bytes written is limited to 4095. The caller should assure that
+- this limit is not exceeded. If it is exceeded, then gzprintf() will return
+- return an error (0) with nothing written. In this case, there may also be a
+- buffer overflow with unpredictable consequences, which is possible only if
+- zlib was compiled with the insecure functions sprintf() or vsprintf()
+- because the secure snprintf() or vsnprintf() functions were not available.
+-*/
+-
+-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+-/*
+- Writes the given null-terminated string to the compressed file, excluding
+- the terminating null character.
+- gzputs returns the number of characters written, or -1 in case of error.
+-*/
+-
+-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+-/*
+- Reads bytes from the compressed file until len-1 characters are read, or
+- a newline character is read and transferred to buf, or an end-of-file
+- condition is encountered. The string is then terminated with a null
+- character.
+- gzgets returns buf, or Z_NULL in case of error.
+-*/
+-
+-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+-/*
+- Writes c, converted to an unsigned char, into the compressed file.
+- gzputc returns the value that was written, or -1 in case of error.
+-*/
+-
+-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+-/*
+- Reads one byte from the compressed file. gzgetc returns this byte
+- or -1 in case of end of file or error.
+-*/
+-
+-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+-/*
+- Push one character back onto the stream to be read again later.
+- Only one character of push-back is allowed. gzungetc() returns the
+- character pushed, or -1 on failure. gzungetc() will fail if a
+- character has been pushed but not read yet, or if c is -1. The pushed
+- character will be discarded if the stream is repositioned with gzseek()
+- or gzrewind().
+-*/
+-
+-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+-/*
+- Flushes all pending output into the compressed file. The parameter
+- flush is as in the deflate() function. The return value is the zlib
+- error number (see function gzerror below). gzflush returns Z_OK if
+- the flush parameter is Z_FINISH and all output could be flushed.
+- gzflush should be called only when strictly necessary because it can
+- degrade compression.
+-*/
+-
+-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+- z_off_t offset, int whence));
+-/*
+- Sets the starting position for the next gzread or gzwrite on the
+- given compressed file. The offset represents a number of bytes in the
+- uncompressed data stream. The whence parameter is defined as in lseek(2);
+- the value SEEK_END is not supported.
+- If the file is opened for reading, this function is emulated but can be
+- extremely slow. If the file is opened for writing, only forward seeks are
+- supported; gzseek then compresses a sequence of zeroes up to the new
+- starting position.
+-
+- gzseek returns the resulting offset location as measured in bytes from
+- the beginning of the uncompressed stream, or -1 in case of error, in
+- particular if the file is opened for writing and the new starting position
+- would be before the current position.
+-*/
+-
+-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+-/*
+- Rewinds the given file. This function is supported only for reading.
+-
+- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+-*/
+-
+-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+-/*
+- Returns the starting position for the next gzread or gzwrite on the
+- given compressed file. This position represents a number of bytes in the
+- uncompressed data stream.
+-
+- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+-*/
+-
+-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+-/*
+- Returns 1 when EOF has previously been detected reading the given
+- input stream, otherwise zero.
+-*/
+-
+-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+-/*
+- Returns 1 if file is being read directly without decompression, otherwise
+- zero.
+-*/
+-
+-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+-/*
+- Flushes all pending output if necessary, closes the compressed file
+- and deallocates all the (de)compression state. The return value is the zlib
+- error number (see function gzerror below).
+-*/
+-
+-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+-/*
+- Returns the error message for the last error which occurred on the
+- given compressed file. errnum is set to zlib error number. If an
+- error occurred in the file system and not in the compression library,
+- errnum is set to Z_ERRNO and the application may consult errno
+- to get the exact error code.
+-*/
+-
+-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+-/*
+- Clears the error and end-of-file flags for file. This is analogous to the
+- clearerr() function in stdio. This is useful for continuing to read a gzip
+- file that is being written concurrently.
+-*/
+-
+- /* checksum functions */
+-
+-/*
+- These functions are not related to compression but are exported
+- anyway because they might be useful in applications using the
+- compression library.
+-*/
+-
+-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+-/*
+- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+- return the updated checksum. If buf is NULL, this function returns
+- the required initial value for the checksum.
+- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+- much faster. Usage example:
+-
+- uLong adler = adler32(0L, Z_NULL, 0);
+-
+- while (read_buffer(buffer, length) != EOF) {
+- adler = adler32(adler, buffer, length);
+- }
+- if (adler != original_adler) error();
+-*/
+-
+-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+- z_off_t len2));
+-/*
+- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
+- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
+- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+-*/
+-
+-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+-/*
+- Update a running CRC-32 with the bytes buf[0..len-1] and return the
+- updated CRC-32. If buf is NULL, this function returns the required initial
+- value for the for the crc. Pre- and post-conditioning (one's complement) is
+- performed within this function so it shouldn't be done by the application.
+- Usage example:
+-
+- uLong crc = crc32(0L, Z_NULL, 0);
+-
+- while (read_buffer(buffer, length) != EOF) {
+- crc = crc32(crc, buffer, length);
+- }
+- if (crc != original_crc) error();
+-*/
+-
+-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+-
+-/*
+- Combine two CRC-32 check values into one. For two sequences of bytes,
+- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
+- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+- len2.
+-*/
+-
+-
+- /* various hacks, don't look :) */
+-
+-/* deflateInit and inflateInit are macros to allow checking the zlib version
+- * and the compiler's view of z_stream:
+- */
+-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+- const char *version, int stream_size));
+-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+- const char *version, int stream_size));
+-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+- int windowBits, int memLevel,
+- int strategy, const char *version,
+- int stream_size));
+-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+- const char *version, int stream_size));
+-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+- unsigned char FAR *window,
+- const char *version,
+- int stream_size));
+-#define deflateInit(strm, level) \
+- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+-#define inflateInit(strm) \
+- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+- (strategy), ZLIB_VERSION, sizeof(z_stream))
+-#define inflateInit2(strm, windowBits) \
+- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+-#define inflateBackInit(strm, windowBits, window) \
+- inflateBackInit_((strm), (windowBits), (window), \
+- ZLIB_VERSION, sizeof(z_stream))
+-
+-
+-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+- struct internal_state {int dummy;}; /* hack for buggy compilers */
+-#endif
+-
+-ZEXTERN const char * ZEXPORT zError OF((int));
+-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+-ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table OF((void));
+-
+-#ifdef __cplusplus
+-}
+-#endif
+-
+-#endif /* ZLIB_H */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.c Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,342 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* zutil.c -- target dependent utility functions for the compression library
+- * Copyright (C) 1995-2005 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* @(#) $Id$ */
+-
+-#include "zutil.h"
+-
+-#ifndef NO_DUMMY_DECL
+-struct internal_state {int dummy;}; /* for buggy compilers */
+-#endif
+-
+-const char * const z_errmsg[10] = {
+-"need dictionary", /* Z_NEED_DICT 2 */
+-"stream end", /* Z_STREAM_END 1 */
+-"", /* Z_OK 0 */
+-"file error", /* Z_ERRNO (-1) */
+-"stream error", /* Z_STREAM_ERROR (-2) */
+-"data error", /* Z_DATA_ERROR (-3) */
+-"insufficient memory", /* Z_MEM_ERROR (-4) */
+-"buffer error", /* Z_BUF_ERROR (-5) */
+-"incompatible version",/* Z_VERSION_ERROR (-6) */
+-""};
+-
+-
+-const char * ZEXPORT zlibVersion()
+-{
+- return ZLIB_VERSION;
+-}
+-
+-uLong ZEXPORT zlibCompileFlags()
+-{
+- uLong flags;
+-
+- flags = 0;
+- switch (sizeof(uInt)) {
+- case 2: break;
+- case 4: flags += 1; break;
+- case 8: flags += 2; break;
+- default: flags += 3;
+- }
+- switch (sizeof(uLong)) {
+- case 2: break;
+- case 4: flags += 1 << 2; break;
+- case 8: flags += 2 << 2; break;
+- default: flags += 3 << 2;
+- }
+- switch (sizeof(voidpf)) {
+- case 2: break;
+- case 4: flags += 1 << 4; break;
+- case 8: flags += 2 << 4; break;
+- default: flags += 3 << 4;
+- }
+- switch (sizeof(z_off_t)) {
+- case 2: break;
+- case 4: flags += 1 << 6; break;
+- case 8: flags += 2 << 6; break;
+- default: flags += 3 << 6;
+- }
+-#ifdef DEBUG
+- flags += 1 << 8;
+-#endif
+-#if defined(ASMV) || defined(ASMINF)
+- flags += 1 << 9;
+-#endif
+-#ifdef ZLIB_WINAPI
+- flags += 1 << 10;
+-#endif
+-#ifdef BUILDFIXED
+- flags += 1 << 12;
+-#endif
+-#ifdef DYNAMIC_CRC_TABLE
+- flags += 1 << 13;
+-#endif
+-#ifdef NO_GZCOMPRESS
+- flags += 1L << 16;
+-#endif
+-#ifdef NO_GZIP
+- flags += 1L << 17;
+-#endif
+-#ifdef PKZIP_BUG_WORKAROUND
+- flags += 1L << 20;
+-#endif
+-#ifdef FASTEST
+- flags += 1L << 21;
+-#endif
+-#ifdef STDC
+-# ifdef NO_vsnprintf
+- flags += 1L << 25;
+-# ifdef HAS_vsprintf_void
+- flags += 1L << 26;
+-# endif
+-# else
+-# ifdef HAS_vsnprintf_void
+- flags += 1L << 26;
+-# endif
+-# endif
+-#else
+- flags += 1L << 24;
+-# ifdef NO_snprintf
+- flags += 1L << 25;
+-# ifdef HAS_sprintf_void
+- flags += 1L << 26;
+-# endif
+-# else
+-# ifdef HAS_snprintf_void
+- flags += 1L << 26;
+-# endif
+-# endif
+-#endif
+- return flags;
+-}
+-
+-#ifdef DEBUG
+-
+-# ifndef verbose
+-# define verbose 0
+-# endif
+-int z_verbose = verbose;
+-
+-void z_error (m)
+- char *m;
+-{
+- fprintf(stderr, "%s\n", m);
+- exit(1);
+-}
+-#endif
+-
+-/* exported to allow conversion of error code to string for compress() and
+- * uncompress()
+- */
+-const char * ZEXPORT zError(err)
+- int err;
+-{
+- return ERR_MSG(err);
+-}
+-
+-#if defined(_WIN32_WCE)
+- /* The Microsoft C Run-Time Library for Windows CE doesn't have
+- * errno. We define it as a global variable to simplify porting.
+- * Its value is always 0 and should not be used.
+- */
+- int errno = 0;
+-#endif
+-
+-#ifndef HAVE_MEMCPY
+-
+-void zmemcpy(dest, source, len)
+- Bytef* dest;
+- const Bytef* source;
+- uInt len;
+-{
+- if (len == 0) return;
+- do {
+- *dest++ = *source++; /* ??? to be unrolled */
+- } while (--len != 0);
+-}
+-
+-int zmemcmp(s1, s2, len)
+- const Bytef* s1;
+- const Bytef* s2;
+- uInt len;
+-{
+- uInt j;
+-
+- for (j = 0; j < len; j++) {
+- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+- }
+- return 0;
+-}
+-
+-void zmemzero(dest, len)
+- Bytef* dest;
+- uInt len;
+-{
+- if (len == 0) return;
+- do {
+- *dest++ = 0; /* ??? to be unrolled */
+- } while (--len != 0);
+-}
+-#endif
+-
+-
+-#ifdef SYS16BIT
+-
+-#ifdef __TURBOC__
+-/* Turbo C in 16-bit mode */
+-
+-# define MY_ZCALLOC
+-
+-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+- * and farmalloc(64K) returns a pointer with an offset of 8, so we
+- * must fix the pointer. Warning: the pointer must be put back to its
+- * original form in order to free it, use zcfree().
+- */
+-
+-#define MAX_PTR 10
+-/* 10*64K = 640K */
+-
+-local int next_ptr = 0;
+-
+-typedef struct ptr_table_s {
+- voidpf org_ptr;
+- voidpf new_ptr;
+-} ptr_table;
+-
+-local ptr_table table[MAX_PTR];
+-/* This table is used to remember the original form of pointers
+- * to large buffers (64K). Such pointers are normalized with a zero offset.
+- * Since MSDOS is not a preemptive multitasking OS, this table is not
+- * protected from concurrent access. This hack doesn't work anyway on
+- * a protected system like OS/2. Use Microsoft C instead.
+- */
+-
+-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+-{
+- voidpf buf = opaque; /* just to make some compilers happy */
+- ulg bsize = (ulg)items*size;
+-
+- /* If we allocate less than 65520 bytes, we assume that farmalloc
+- * will return a usable pointer which doesn't have to be normalized.
+- */
+- if (bsize < 65520L) {
+- buf = farmalloc(bsize);
+- if (*(ush*)&buf != 0) return buf;
+- } else {
+- buf = farmalloc(bsize + 16L);
+- }
+- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+- table[next_ptr].org_ptr = buf;
+-
+- /* Normalize the pointer to seg:0 */
+- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+- *(ush*)&buf = 0;
+- table[next_ptr++].new_ptr = buf;
+- return buf;
+-}
+-
+-void zcfree (voidpf opaque, voidpf ptr)
+-{
+- int n;
+- if (*(ush*)&ptr != 0) { /* object < 64K */
+- farfree(ptr);
+- return;
+- }
+- /* Find the original pointer */
+- for (n = 0; n < next_ptr; n++) {
+- if (ptr != table[n].new_ptr) continue;
+-
+- farfree(table[n].org_ptr);
+- while (++n < next_ptr) {
+- table[n-1] = table[n];
+- }
+- next_ptr--;
+- return;
+- }
+- ptr = opaque; /* just to make some compilers happy */
+- Assert(0, "zcfree: ptr not found");
+-}
+-
+-#endif /* __TURBOC__ */
+-
+-
+-#ifdef M_I86
+-/* Microsoft C in 16-bit mode */
+-
+-# define MY_ZCALLOC
+-
+-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+-# define _halloc halloc
+-# define _hfree hfree
+-#endif
+-
+-voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+-{
+- if (opaque) opaque = 0; /* to make compiler happy */
+- return _halloc((long)items, size);
+-}
+-
+-void zcfree (voidpf opaque, voidpf ptr)
+-{
+- if (opaque) opaque = 0; /* to make compiler happy */
+- _hfree(ptr);
+-}
+-
+-#endif /* M_I86 */
+-
+-#endif /* SYS16BIT */
+-
+-
+-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+-
+-#ifndef STDC
+-extern voidp malloc OF((uInt size));
+-extern voidp calloc OF((uInt items, uInt size));
+-extern void free OF((voidpf ptr));
+-#endif
+-
+-voidpf zcalloc (opaque, items, size)
+- voidpf opaque;
+- unsigned items;
+- unsigned size;
+-{
+- if (opaque) items += size - size; /* make compiler happy */
+- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+- (voidpf)calloc(items, size);
+-}
+-
+-void zcfree (opaque, ptr)
+- voidpf opaque;
+- voidpf ptr;
+-{
+- free(ptr);
+- if (opaque) return; /* make compiler happy */
+-}
+-
+-#endif /* MY_ZCALLOC */
+--- ./jdk/src/share/native/java/util/zip/zlib-1.2.3/zutil.h Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,294 +0,0 @@
+-/*
+- * 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
+- * particular file as subject to the "Classpath" exception as provided
+- * by Oracle in the LICENSE file that accompanied this code.
+- *
+- * 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.
+- */
+-
+-/* zutil.h -- internal interface and configuration of the compression library
+- * Copyright (C) 1995-2005 Jean-loup Gailly.
+- * For conditions of distribution and use, see copyright notice in zlib.h
+- */
+-
+-/* WARNING: this file should *not* be used by applications. It is
+- part of the implementation of the compression library and is
+- subject to change. Applications should only use zlib.h.
+- */
+-
+-/* @(#) $Id$ */
+-
+-#ifndef ZUTIL_H
+-#define ZUTIL_H
+-
+-#define ZLIB_INTERNAL
+-#include "zlib.h"
+-
+-#ifdef STDC
+-# ifndef _WIN32_WCE
+-# include <stddef.h>
+-# endif
+-# include <string.h>
+-# include <stdlib.h>
+-#endif
+-#ifdef NO_ERRNO_H
+-# ifdef _WIN32_WCE
+- /* The Microsoft C Run-Time Library for Windows CE doesn't have
+- * errno. We define it as a global variable to simplify porting.
+- * Its value is always 0 and should not be used. We rename it to
+- * avoid conflict with other libraries that use the same workaround.
+- */
+-# define errno z_errno
+-# endif
+- extern int errno;
+-#else
+-# ifndef _WIN32_WCE
+-# include <errno.h>
+-# endif
+-#endif
+-
+-#ifndef local
+-# define local static
+-#endif
+-/* compile with -Dlocal if your debugger can't find static symbols */
+-
+-typedef unsigned char uch;
+-typedef uch FAR uchf;
+-typedef unsigned short ush;
+-typedef ush FAR ushf;
+-typedef unsigned long ulg;
+-
+-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+-/* (size given to avoid silly warnings with Visual C++) */
+-
+-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+-
+-#define ERR_RETURN(strm,err) \
+- return (strm->msg = (char*)ERR_MSG(err), (err))
+-/* To be used only when the state is known to be valid */
+-
+- /* common constants */
+-
+-#ifndef DEF_WBITS
+-# define DEF_WBITS MAX_WBITS
+-#endif
+-/* default windowBits for decompression. MAX_WBITS is for compression only */
+-
+-#if MAX_MEM_LEVEL >= 8
+-# define DEF_MEM_LEVEL 8
+-#else
+-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+-#endif
+-/* default memLevel */
+-
+-#define STORED_BLOCK 0
+-#define STATIC_TREES 1
+-#define DYN_TREES 2
+-/* The three kinds of block type */
+-
+-#define MIN_MATCH 3
+-#define MAX_MATCH 258
+-/* The minimum and maximum match lengths */
+-
+-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+-
+- /* target dependencies */
+-
+-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+-# define OS_CODE 0x00
+-# if defined(__TURBOC__) || defined(__BORLANDC__)
+-# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+- /* Allow compilation with ANSI keywords only enabled */
+- void _Cdecl farfree( void *block );
+- void *_Cdecl farmalloc( unsigned long nbytes );
+-# else
+-# include <alloc.h>
+-# endif
+-# else /* MSC or DJGPP */
+-# include <malloc.h>
+-# endif
+-#endif
+-
+-#ifdef AMIGA
+-# define OS_CODE 0x01
+-#endif
+-
+-#if defined(VAXC) || defined(VMS)
+-# define OS_CODE 0x02
+-# define F_OPEN(name, mode) \
+- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+-#endif
+-
+-#if defined(ATARI) || defined(atarist)
+-# define OS_CODE 0x05
+-#endif
+-
+-#ifdef OS2
+-# define OS_CODE 0x06
+-# ifdef M_I86
+- #include <malloc.h>
+-# endif
+-#endif
+-
+-#if defined(MACOS) || defined(TARGET_OS_MAC)
+-# define OS_CODE 0x07
+-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+-# include <unix.h> /* for fdopen */
+-# else
+-# ifndef fdopen
+-# define fdopen(fd,mode) NULL /* No fdopen() */
+-# endif
+-# endif
+-#endif
+-
+-#ifdef TOPS20
+-# define OS_CODE 0x0a
+-#endif
+-
+-#ifdef WIN32
+-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
+-# define OS_CODE 0x0b
+-# endif
+-#endif
+-
+-#ifdef __50SERIES /* Prime/PRIMOS */
+-# define OS_CODE 0x0f
+-#endif
+-
+-#if defined(_BEOS_) || defined(RISCOS)
+-# define fdopen(fd,mode) NULL /* No fdopen() */
+-#endif
+-
+-#if (defined(_MSC_VER) && (_MSC_VER > 600))
+-# if defined(_WIN32_WCE)
+-# define fdopen(fd,mode) NULL /* No fdopen() */
+-# ifndef _PTRDIFF_T_DEFINED
+- typedef int ptrdiff_t;
+-# define _PTRDIFF_T_DEFINED
+-# endif
+-# else
+-# define fdopen(fd,type) _fdopen(fd,type)
+-# endif
+-#endif
+-
+- /* common defaults */
+-
+-#ifndef OS_CODE
+-# define OS_CODE 0x03 /* assume Unix */
+-#endif
+-
+-#ifndef F_OPEN
+-# define F_OPEN(name, mode) fopen((name), (mode))
+-#endif
+-
+- /* functions */
+-
+-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+-# ifndef HAVE_VSNPRINTF
+-# define HAVE_VSNPRINTF
+-# endif
+-#endif
+-#if defined(__CYGWIN__)
+-# ifndef HAVE_VSNPRINTF
+-# define HAVE_VSNPRINTF
+-# endif
+-#endif
+-#ifndef HAVE_VSNPRINTF
+-# ifdef MSDOS
+- /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+- but for now we just assume it doesn't. */
+-# define NO_vsnprintf
+-# endif
+-# ifdef __TURBOC__
+-# define NO_vsnprintf
+-# endif
+-# ifdef WIN32
+- /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+-# if !defined(vsnprintf) && !defined(NO_vsnprintf) && (!defined(_MSC_VER) || (_MSC_VER < 1500))
+- /* Only needed before Visual Studio 2008 */
+-# define vsnprintf _vsnprintf
+-# endif
+-# endif
+-# ifdef __SASC
+-# define NO_vsnprintf
+-# endif
+-#endif
+-#ifdef VMS
+-# define NO_vsnprintf
+-#endif
+-
+-#if defined(pyr)
+-# define NO_MEMCPY
+-#endif
+-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+- /* Use our own functions for small and medium model with MSC <= 5.0.
+- * You may have to use the same strategy for Borland C (untested).
+- * The __SC__ check is for Symantec.
+- */
+-# define NO_MEMCPY
+-#endif
+-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+-# define HAVE_MEMCPY
+-#endif
+-#ifdef HAVE_MEMCPY
+-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+-# define zmemcpy _fmemcpy
+-# define zmemcmp _fmemcmp
+-# define zmemzero(dest, len) _fmemset(dest, 0, len)
+-# else
+-# define zmemcpy memcpy
+-# define zmemcmp memcmp
+-# define zmemzero(dest, len) memset(dest, 0, len)
+-# endif
+-#else
+- extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+- extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+- extern void zmemzero OF((Bytef* dest, uInt len));
+-#endif
+-
+-/* Diagnostic functions */
+-#ifdef DEBUG
+-# include <stdio.h>
+- extern int z_verbose;
+- extern void z_error OF((char *m));
+-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+-# define Trace(x) {if (z_verbose>=0) fprintf x ;}
+-# define Tracev(x) {if (z_verbose>0) fprintf x ;}
+-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+-#else
+-# define Assert(cond,msg)
+-# define Trace(x)
+-# define Tracev(x)
+-# define Tracevv(x)
+-# define Tracec(c,x)
+-# define Tracecv(c,x)
+-#endif
+-
+-
+-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+-void zcfree OF((voidpf opaque, voidpf ptr));
+-
+-#define ZALLOC(strm, items, size) \
+- (*((strm)->zalloc))((strm)->opaque, (items), (size))
+-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+-
+-#endif /* ZUTIL_H */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/ChangeLog Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,1472 @@
++
++ ChangeLog file for zlib
++
++Changes in 1.2.8 (28 Apr 2013)
++- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
++- Do not force Z_CONST for C++
++- Clean up contrib/vstudio [Ro§]
++- Correct spelling error in zlib.h
++- Fix mixed line endings in contrib/vstudio
++
++Changes in 1.2.7.3 (13 Apr 2013)
++- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc
++
++Changes in 1.2.7.2 (13 Apr 2013)
++- Change check for a four-byte type back to hexadecimal
++- Fix typo in win32/Makefile.msc
++- Add casts in gzwrite.c for pointer differences
++
++Changes in 1.2.7.1 (24 Mar 2013)
++- Replace use of unsafe string functions with snprintf if available
++- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink]
++- Fix gzgetc undefine when Z_PREFIX set [Turk]
++- Eliminate use of mktemp in Makefile (not always available)
++- Fix bug in 'F' mode for gzopen()
++- Add inflateGetDictionary() function
++- Correct comment in deflate.h
++- Use _snprintf for snprintf in Microsoft C
++- On Darwin, only use /usr/bin/libtool if libtool is not Apple
++- Delete "--version" file if created by "ar --version" [Richard G.]
++- Fix configure check for veracity of compiler error return codes
++- Fix CMake compilation of static lib for MSVC2010 x64
++- Remove unused variable in infback9.c
++- Fix argument checks in gzlog_compress() and gzlog_write()
++- Clean up the usage of z_const and respect const usage within zlib
++- Clean up examples/gzlog.[ch] comparisons of different types
++- Avoid shift equal to bits in type (caused endless loop)
++- Fix unintialized value bug in gzputc() introduced by const patches
++- Fix memory allocation error in examples/zran.c [Nor]
++- Fix bug where gzopen(), gzclose() would write an empty file
++- Fix bug in gzclose() when gzwrite() runs out of memory
++- Check for input buffer malloc failure in examples/gzappend.c
++- Add note to contrib/blast to use binary mode in stdio
++- Fix comparisons of differently signed integers in contrib/blast
++- Check for invalid code length codes in contrib/puff
++- Fix serious but very rare decompression bug in inftrees.c
++- Update inflateBack() comments, since inflate() can be faster
++- Use underscored I/O function names for WINAPI_FAMILY
++- Add _tr_flush_bits to the external symbols prefixed by --zprefix
++- Add contrib/vstudio/vc10 pre-build step for static only
++- Quote --version-script argument in CMakeLists.txt
++- Don't specify --version-script on Apple platforms in CMakeLists.txt
++- Fix casting error in contrib/testzlib/testzlib.c
++- Fix types in contrib/minizip to match result of get_crc_table()
++- Simplify contrib/vstudio/vc10 with 'd' suffix
++- Add TOP support to win32/Makefile.msc
++- Suport i686 and amd64 assembler builds in CMakeLists.txt
++- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
++- Add vc11 and vc12 build files to contrib/vstudio
++- Add gzvprintf() as an undocumented function in zlib
++- Fix configure for Sun shell
++- Remove runtime check in configure for four-byte integer type
++- Add casts and consts to ease user conversion to C++
++- Add man pages for minizip and miniunzip
++- In Makefile uninstall, don't rm if preceding cd fails
++- Do not return Z_BUF_ERROR if deflateParam() has nothing to write
++
++Changes in 1.2.7 (2 May 2012)
++- Replace use of memmove() with a simple copy for portability
++- Test for existence of strerror
++- Restore gzgetc_ for backward compatibility with 1.2.6
++- Fix build with non-GNU make on Solaris
++- Require gcc 4.0 or later on Mac OS X to use the hidden attribute
++- Include unistd.h for Watcom C
++- Use __WATCOMC__ instead of __WATCOM__
++- Do not use the visibility attribute if NO_VIZ defined
++- Improve the detection of no hidden visibility attribute
++- Avoid using __int64 for gcc or solo compilation
++- Cast to char * in gzprintf to avoid warnings [Zinser]
++- Fix make_vms.com for VAX [Zinser]
++- Don't use library or built-in byte swaps
++- Simplify test and use of gcc hidden attribute
++- Fix bug in gzclose_w() when gzwrite() fails to allocate memory
++- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen()
++- Fix bug in test/minigzip.c for configure --solo
++- Fix contrib/vstudio project link errors [Mohanathas]
++- Add ability to choose the builder in make_vms.com [Schweda]
++- Add DESTDIR support to mingw32 win32/Makefile.gcc
++- Fix comments in win32/Makefile.gcc for proper usage
++- Allow overriding the default install locations for cmake
++- Generate and install the pkg-config file with cmake
++- Build both a static and a shared version of zlib with cmake
++- Include version symbols for cmake builds
++- If using cmake with MSVC, add the source directory to the includes
++- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta]
++- Move obsolete emx makefile to old [Truta]
++- Allow the use of -Wundef when compiling or using zlib
++- Avoid the use of the -u option with mktemp
++- Improve inflate() documentation on the use of Z_FINISH
++- Recognize clang as gcc
++- Add gzopen_w() in Windows for wide character path names
++- Rename zconf.h in CMakeLists.txt to move it out of the way
++- Add source directory in CMakeLists.txt for building examples
++- Look in build directory for zlib.pc in CMakeLists.txt
++- Remove gzflags from zlibvc.def in vc9 and vc10
++- Fix contrib/minizip compilation in the MinGW environment
++- Update ./configure for Solaris, support --64 [Mooney]
++- Remove -R. from Solaris shared build (possible security issue)
++- Avoid race condition for parallel make (-j) running example
++- Fix type mismatch between get_crc_table() and crc_table
++- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler]
++- Fix the path to zlib.map in CMakeLists.txt
++- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe]
++- Add instructions to win32/Makefile.gcc for shared install [Torri]
++
++Changes in 1.2.6.1 (12 Feb 2012)
++- Avoid the use of the Objective-C reserved name "id"
++- Include io.h in gzguts.h for Microsoft compilers
++- Fix problem with ./configure --prefix and gzgetc macro
++- Include gz_header definition when compiling zlib solo
++- Put gzflags() functionality back in zutil.c
++- Avoid library header include in crc32.c for Z_SOLO
++- Use name in GCC_CLASSIC as C compiler for coverage testing, if set
++- Minor cleanup in contrib/minizip/zip.c [Vollant]
++- Update make_vms.com [Zinser]
++- Remove unnecessary gzgetc_ function
++- Use optimized byte swap operations for Microsoft and GNU [Snyder]
++- Fix minor typo in zlib.h comments [Rzesniowiecki]
++
++Changes in 1.2.6 (29 Jan 2012)
++- Update the Pascal interface in contrib/pascal
++- Fix function numbers for gzgetc_ in zlibvc.def files
++- Fix configure.ac for contrib/minizip [Schiffer]
++- Fix large-entry detection in minizip on 64-bit systems [Schiffer]
++- Have ./configure use the compiler return code for error indication
++- Fix CMakeLists.txt for cross compilation [McClure]
++- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes]
++- Fix compilation of contrib/minizip on FreeBSD [Marquez]
++- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath]
++- Include io.h for Turbo C / Borland C on all platforms [Truta]
++- Make version explicit in contrib/minizip/configure.ac [Bosmans]
++- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant]
++- Minor cleanup up contrib/minizip/unzip.c [Vollant]
++- Fix bug when compiling minizip with C++ [Vollant]
++- Protect for long name and extra fields in contrib/minizip [Vollant]
++- Avoid some warnings in contrib/minizip [Vollant]
++- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip
++- Add missing libs to minizip linker command
++- Add support for VPATH builds in contrib/minizip
++- Add an --enable-demos option to contrib/minizip/configure
++- Add the generation of configure.log by ./configure
++- Exit when required parameters not provided to win32/Makefile.gcc
++- Have gzputc return the character written instead of the argument
++- Use the -m option on ldconfig for BSD systems [Tobias]
++- Correct in zlib.map when deflateResetKeep was added
++
++Changes in 1.2.5.3 (15 Jan 2012)
++- Restore gzgetc function for binary compatibility
++- Do not use _lseeki64 under Borland C++ [Truta]
++- Update win32/Makefile.msc to build test/*.c [Truta]
++- Remove old/visualc6 given CMakefile and other alternatives
++- Update AS400 build files and documentation [Monnerat]
++- Update win32/Makefile.gcc to build test/*.c [Truta]
++- Permit stronger flushes after Z_BLOCK flushes
++- Avoid extraneous empty blocks when doing empty flushes
++- Permit Z_NULL arguments to deflatePending
++- Allow deflatePrime() to insert bits in the middle of a stream
++- Remove second empty static block for Z_PARTIAL_FLUSH
++- Write out all of the available bits when using Z_BLOCK
++- Insert the first two strings in the hash table after a flush
++
++Changes in 1.2.5.2 (17 Dec 2011)
++- fix ld error: unable to find version dependency 'ZLIB_1.2.5'
++- use relative symlinks for shared libs
++- Avoid searching past window for Z_RLE strategy
++- Assure that high-water mark initialization is always applied in deflate
++- Add assertions to fill_window() in deflate.c to match comments
++- Update python link in README
++- Correct spelling error in gzread.c
++- Fix bug in gzgets() for a concatenated empty gzip stream
++- Correct error in comment for gz_make()
++- Change gzread() and related to ignore junk after gzip streams
++- Allow gzread() and related to continue after gzclearerr()
++- Allow gzrewind() and gzseek() after a premature end-of-file
++- Simplify gzseek() now that raw after gzip is ignored
++- Change gzgetc() to a macro for speed (~40% speedup in testing)
++- Fix gzclose() to return the actual error last encountered
++- Always add large file support for windows
++- Include zconf.h for windows large file support
++- Include zconf.h.cmakein for windows large file support
++- Update zconf.h.cmakein on make distclean
++- Merge vestigial vsnprintf determination from zutil.h to gzguts.h
++- Clarify how gzopen() appends in zlib.h comments
++- Correct documentation of gzdirect() since junk at end now ignored
++- Add a transparent write mode to gzopen() when 'T' is in the mode
++- Update python link in zlib man page
++- Get inffixed.h and MAKEFIXED result to match
++- Add a ./config --solo option to make zlib subset with no libary use
++- Add undocumented inflateResetKeep() function for CAB file decoding
++- Add --cover option to ./configure for gcc coverage testing
++- Add #define ZLIB_CONST option to use const in the z_stream interface
++- Add comment to gzdopen() in zlib.h to use dup() when using fileno()
++- Note behavior of uncompress() to provide as much data as it can
++- Add files in contrib/minizip to aid in building libminizip
++- Split off AR options in Makefile.in and configure
++- Change ON macro to Z_ARG to avoid application conflicts
++- Facilitate compilation with Borland C++ for pragmas and vsnprintf
++- Include io.h for Turbo C / Borland C++
++- Move example.c and minigzip.c to test/
++- Simplify incomplete code table filling in inflate_table()
++- Remove code from inflate.c and infback.c that is impossible to execute
++- Test the inflate code with full coverage
++- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw)
++- Add deflateResetKeep and fix inflateResetKeep to retain dictionary
++- Fix gzwrite.c to accommodate reduced memory zlib compilation
++- Have inflate() with Z_FINISH avoid the allocation of a window
++- Do not set strm->adler when doing raw inflate
++- Fix gzeof() to behave just like feof() when read is not past end of file
++- Fix bug in gzread.c when end-of-file is reached
++- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF
++- Document gzread() capability to read concurrently written files
++- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo]
++
++Changes in 1.2.5.1 (10 Sep 2011)
++- Update FAQ entry on shared builds (#13)
++- Avoid symbolic argument to chmod in Makefile.in
++- Fix bug and add consts in contrib/puff [Oberhumer]
++- Update contrib/puff/zeros.raw test file to have all block types
++- Add full coverage test for puff in contrib/puff/Makefile
++- Fix static-only-build install in Makefile.in
++- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno]
++- Add libz.a dependency to shared in Makefile.in for parallel builds
++- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out
++- Replace $(...) with `...` in configure for non-bash sh [Bowler]
++- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen]
++- Add solaris* to Linux* in configure to allow gcc use [Groffen]
++- Add *bsd* to Linux* case in configure [Bar-Lev]
++- Add inffast.obj to dependencies in win32/Makefile.msc
++- Correct spelling error in deflate.h [Kohler]
++- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc
++- Add test to configure for GNU C looking for gcc in output of $cc -v
++- Add zlib.pc generation to win32/Makefile.gcc [Weigelt]
++- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not
++- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense
++- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser)
++- Make stronger test in zconf.h to include unistd.h for LFS
++- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack]
++- Fix zlib.h LFS support when Z_PREFIX used
++- Add updated as400 support (removed from old) [Monnerat]
++- Avoid deflate sensitivity to volatile input data
++- Avoid division in adler32_combine for NO_DIVIDE
++- Clarify the use of Z_FINISH with deflateBound() amount of space
++- Set binary for output file in puff.c
++- Use u4 type for crc_table to avoid conversion warnings
++- Apply casts in zlib.h to avoid conversion warnings
++- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
++- Improve inflateSync() documentation to note indeterminancy
++- Add deflatePending() function to return the amount of pending output
++- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
++- Add a check in configure for stdarg.h, use for gzprintf()
++- Check that pointers fit in ints when gzprint() compiled old style
++- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
++- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
++- Add debug records in assmebler code [Londer]
++- Update RFC references to use http://tools.ietf.org/html/... [Li]
++- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
++
++Changes in 1.2.5 (19 Apr 2010)
++- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
++- Default to libdir as sharedlibdir in configure [Nieder]
++- Update copyright dates on modified source files
++- Update trees.c to be able to generate modified trees.h
++- Exit configure for MinGW, suggesting win32/Makefile.gcc
++- Check for NULL path in gz_open [Homurlu]
++
++Changes in 1.2.4.5 (18 Apr 2010)
++- Set sharedlibdir in configure [Torok]
++- Set LDFLAGS in Makefile.in [Bar-Lev]
++- Avoid mkdir objs race condition in Makefile.in [Bowler]
++- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
++- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
++- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
++
++Changes in 1.2.4.4 (18 Apr 2010)
++- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
++- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
++- Try to use bash or ksh regardless of functionality of /bin/sh
++- Fix configure incompatibility with NetBSD sh
++- Remove attempt to run under bash or ksh since have better NetBSD fix
++- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
++- Add diagnostic messages when using CROSS_PREFIX in configure
++- Added --sharedlibdir option to configure [Weigelt]
++- Use hidden visibility attribute when available [Frysinger]
++
++Changes in 1.2.4.3 (10 Apr 2010)
++- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
++- Use CROSS_PREFIX for nm [Bar-Lev]
++- Assume _LARGEFILE64_SOURCE defined is equivalent to true
++- Avoid use of undefined symbols in #if with && and ||
++- Make *64 prototypes in gzguts.h consistent with functions
++- Add -shared load option for MinGW in configure [Bowler]
++- Move z_off64_t to public interface, use instead of off64_t
++- Remove ! from shell test in configure (not portable to Solaris)
++- Change +0 macro tests to -0 for possibly increased portability
++
++Changes in 1.2.4.2 (9 Apr 2010)
++- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
++- Really provide prototypes for *64 functions when building without LFS
++- Only define unlink() in minigzip.c if unistd.h not included
++- Update README to point to contrib/vstudio project files
++- Move projects/vc6 to old/ and remove projects/
++- Include stdlib.h in minigzip.c for setmode() definition under WinCE
++- Clean up assembler builds in win32/Makefile.msc [Rowe]
++- Include sys/types.h for Microsoft for off_t definition
++- Fix memory leak on error in gz_open()
++- Symbolize nm as $NM in configure [Weigelt]
++- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
++- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
++- Fix bug in gzeof() to take into account unused input data
++- Avoid initialization of structures with variables in puff.c
++- Updated win32/README-WIN32.txt [Rowe]
++
++Changes in 1.2.4.1 (28 Mar 2010)
++- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
++- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
++- Restore "for debugging" comment on sprintf() in gzlib.c
++- Remove fdopen for MVS from gzguts.h
++- Put new README-WIN32.txt in win32 [Rowe]
++- Add check for shell to configure and invoke another shell if needed
++- Fix big fat stinking bug in gzseek() on uncompressed files
++- Remove vestigial F_OPEN64 define in zutil.h
++- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
++- Avoid errors on non-LFS systems when applications define LFS macros
++- Set EXE to ".exe" in configure for MINGW [Kahle]
++- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
++- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
++- Add DLL install in win32/makefile.gcc [Bar-Lev]
++- Allow Linux* or linux* from uname in configure [Bar-Lev]
++- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
++- Add cross-compilation prefixes to configure [Bar-Lev]
++- Match type exactly in gz_load() invocation in gzread.c
++- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
++- Provide prototypes for *64 functions when building zlib without LFS
++- Don't use -lc when linking shared library on MinGW
++- Remove errno.h check in configure and vestigial errno code in zutil.h
++
++Changes in 1.2.4 (14 Mar 2010)
++- Fix VER3 extraction in configure for no fourth subversion
++- Update zlib.3, add docs to Makefile.in to make .pdf out of it
++- Add zlib.3.pdf to distribution
++- Don't set error code in gzerror() if passed pointer is NULL
++- Apply destination directory fixes to CMakeLists.txt [Lowman]
++- Move #cmakedefine's to a new zconf.in.cmakein
++- Restore zconf.h for builds that don't use configure or cmake
++- Add distclean to dummy Makefile for convenience
++- Update and improve INDEX, README, and FAQ
++- Update CMakeLists.txt for the return of zconf.h [Lowman]
++- Update contrib/vstudio/vc9 and vc10 [Vollant]
++- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
++- Apply license and readme changes to contrib/asm686 [Raiter]
++- Check file name lengths and add -c option in minigzip.c [Li]
++- Update contrib/amd64 and contrib/masmx86/ [Vollant]
++- Avoid use of "eof" parameter in trees.c to not shadow library variable
++- Update make_vms.com for removal of zlibdefs.h [Zinser]
++- Update assembler code and vstudio projects in contrib [Vollant]
++- Remove outdated assembler code contrib/masm686 and contrib/asm586
++- Remove old vc7 and vc8 from contrib/vstudio
++- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
++- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
++- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
++- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
++- Fix bug in void-returning vsprintf() case in gzwrite.c
++- Fix name change from inflate.h in contrib/inflate86/inffas86.c
++- Check if temporary file exists before removing in make_vms.com [Zinser]
++- Fix make install and uninstall for --static option
++- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
++- Update readme.txt in contrib/masmx64 and masmx86 to assemble
++
++Changes in 1.2.3.9 (21 Feb 2010)
++- Expunge gzio.c
++- Move as400 build information to old
++- Fix updates in contrib/minizip and contrib/vstudio
++- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
++- Delete zconf.h (made by configure) [Weigelt]
++- Change zconf.in.h to zconf.h.in per convention [Weigelt]
++- Check for NULL buf in gzgets()
++- Return empty string for gzgets() with len == 1 (like fgets())
++- Fix description of gzgets() in zlib.h for end-of-file, NULL return
++- Update minizip to 1.1 [Vollant]
++- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
++- Note in zlib.h that gzerror() should be used to distinguish from EOF
++- Remove use of snprintf() from gzlib.c
++- Fix bug in gzseek()
++- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
++- Fix zconf.h generation in CMakeLists.txt [Lowman]
++- Improve comments in zconf.h where modified by configure
++
++Changes in 1.2.3.8 (13 Feb 2010)
++- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
++- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
++- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
++- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
++- Fix missing error return in gzflush(), add zlib.h note
++- Add *64 functions to zlib.map [Levin]
++- Fix signed/unsigned comparison in gz_comp()
++- Use SFLAGS when testing shared linking in configure
++- Add --64 option to ./configure to use -m64 with gcc
++- Fix ./configure --help to correctly name options
++- Have make fail if a test fails [Levin]
++- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
++- Remove assembler object files from contrib
++
++Changes in 1.2.3.7 (24 Jan 2010)
++- Always gzopen() with O_LARGEFILE if available
++- Fix gzdirect() to work immediately after gzopen() or gzdopen()
++- Make gzdirect() more precise when the state changes while reading
++- Improve zlib.h documentation in many places
++- Catch memory allocation failure in gz_open()
++- Complete close operation if seek forward in gzclose_w() fails
++- Return Z_ERRNO from gzclose_r() if close() fails
++- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
++- Return zero for gzwrite() errors to match zlib.h description
++- Return -1 on gzputs() error to match zlib.h description
++- Add zconf.in.h to allow recovery from configure modification [Weigelt]
++- Fix static library permissions in Makefile.in [Weigelt]
++- Avoid warnings in configure tests that hide functionality [Weigelt]
++- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
++- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
++- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
++- Keep object files in subdirectories to reduce the clutter somewhat
++- Remove default Makefile and zlibdefs.h, add dummy Makefile
++- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
++- Remove zlibdefs.h completely -- modify zconf.h instead
++
++Changes in 1.2.3.6 (17 Jan 2010)
++- Avoid void * arithmetic in gzread.c and gzwrite.c
++- Make compilers happier with const char * for gz_error message
++- Avoid unused parameter warning in inflate.c
++- Avoid signed-unsigned comparison warning in inflate.c
++- Indent #pragma's for traditional C
++- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
++- Correct email address in configure for system options
++- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
++- Update zlib.map [Brown]
++- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
++- Apply various fixes to CMakeLists.txt [Lowman]
++- Add checks on len in gzread() and gzwrite()
++- Add error message for no more room for gzungetc()
++- Remove zlib version check in gzwrite()
++- Defer compression of gzprintf() result until need to
++- Use snprintf() in gzdopen() if available
++- Remove USE_MMAP configuration determination (only used by minigzip)
++- Remove examples/pigz.c (available separately)
++- Update examples/gun.c to 1.6
++
++Changes in 1.2.3.5 (8 Jan 2010)
++- Add space after #if in zutil.h for some compilers
++- Fix relatively harmless bug in deflate_fast() [Exarevsky]
++- Fix same problem in deflate_slow()
++- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
++- Add deflate_rle() for faster Z_RLE strategy run-length encoding
++- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
++- Change name of "write" variable in inffast.c to avoid library collisions
++- Fix premature EOF from gzread() in gzio.c [Brown]
++- Use zlib header window size if windowBits is 0 in inflateInit2()
++- Remove compressBound() call in deflate.c to avoid linking compress.o
++- Replace use of errno in gz* with functions, support WinCE [Alves]
++- Provide alternative to perror() in minigzip.c for WinCE [Alves]
++- Don't use _vsnprintf on later versions of MSVC [Lowman]
++- Add CMake build script and input file [Lowman]
++- Update contrib/minizip to 1.1 [Svensson, Vollant]
++- Moved nintendods directory from contrib to .
++- Replace gzio.c with a new set of routines with the same functionality
++- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
++- Update contrib/minizip to 1.1b
++- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
++
++Changes in 1.2.3.4 (21 Dec 2009)
++- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
++- Update comments in configure and Makefile.in for default --shared
++- Fix test -z's in configure [Marquess]
++- Build examplesh and minigzipsh when not testing
++- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
++- Import LDFLAGS from the environment in configure
++- Fix configure to populate SFLAGS with discovered CFLAGS options
++- Adapt make_vms.com to the new Makefile.in [Zinser]
++- Add zlib2ansi script for C++ compilation [Marquess]
++- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
++- Add AMD64 assembler code for longest match to contrib [Teterin]
++- Include options from $SFLAGS when doing $LDSHARED
++- Simplify 64-bit file support by introducing z_off64_t type
++- Make shared object files in objs directory to work around old Sun cc
++- Use only three-part version number for Darwin shared compiles
++- Add rc option to ar in Makefile.in for when ./configure not run
++- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
++- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
++- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
++- Rename Makefile.in targets allstatic to static and allshared to shared
++- Fix static and shared Makefile.in targets to be independent
++- Correct error return bug in gz_open() by setting state [Brown]
++- Put spaces before ;;'s in configure for better sh compatibility
++- Add pigz.c (parallel implementation of gzip) to examples/
++- Correct constant in crc32.c to UL [Leventhal]
++- Reject negative lengths in crc32_combine()
++- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
++- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
++- Correct typo in doc/algorithm.txt [Janik]
++- Fix bug in adler32_combine() [Zhu]
++- Catch missing-end-of-block-code error in all inflates and in puff
++ Assures that random input to inflate eventually results in an error
++- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
++- Update ENOUGH and its usage to reflect discovered bounds
++- Fix gzerror() error report on empty input file [Brown]
++- Add ush casts in trees.c to avoid pedantic runtime errors
++- Fix typo in zlib.h uncompress() description [Reiss]
++- Correct inflate() comments with regard to automatic header detection
++- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
++- Put new version of gzlog (2.0) in examples with interruption recovery
++- Add puff compile option to permit invalid distance-too-far streams
++- Add puff TEST command options, ability to read piped input
++- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
++ _LARGEFILE64_SOURCE not defined
++- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
++- Fix deflateSetDictionary() to use all 32K for output consistency
++- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
++- Clear bytes after deflate lookahead to avoid use of uninitialized data
++- Change a limit in inftrees.c to be more transparent to Coverity Prevent
++- Update win32/zlib.def with exported symbols from zlib.h
++- Correct spelling errors in zlib.h [Willem, Sobrado]
++- Allow Z_BLOCK for deflate() to force a new block
++- Allow negative bits in inflatePrime() to delete existing bit buffer
++- Add Z_TREES flush option to inflate() to return at end of trees
++- Add inflateMark() to return current state information for random access
++- Add Makefile for NintendoDS to contrib [Costa]
++- Add -w in configure compile tests to avoid spurious warnings [Beucler]
++- Fix typos in zlib.h comments for deflateSetDictionary()
++- Fix EOF detection in transparent gzread() [Maier]
++
++Changes in 1.2.3.3 (2 October 2006)
++- Make --shared the default for configure, add a --static option
++- Add compile option to permit invalid distance-too-far streams
++- Add inflateUndermine() function which is required to enable above
++- Remove use of "this" variable name for C++ compatibility [Marquess]
++- Add testing of shared library in make test, if shared library built
++- Use ftello() and fseeko() if available instead of ftell() and fseek()
++- Provide two versions of all functions that use the z_off_t type for
++ binary compatibility -- a normal version and a 64-bit offset version,
++ per the Large File Support Extension when _LARGEFILE64_SOURCE is
++ defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
++ is defined to be 64
++- Add a --uname= option to configure to perhaps help with cross-compiling
++
++Changes in 1.2.3.2 (3 September 2006)
++- Turn off silly Borland warnings [Hay]
++- Use off64_t and define _LARGEFILE64_SOURCE when present
++- Fix missing dependency on inffixed.h in Makefile.in
++- Rig configure --shared to build both shared and static [Teredesai, Truta]
++- Remove zconf.in.h and instead create a new zlibdefs.h file
++- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
++- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
++
++Changes in 1.2.3.1 (16 August 2006)
++- Add watcom directory with OpenWatcom make files [Daniel]
++- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
++- Update make_vms.com [Zinser]
++- Use -fPIC for shared build in configure [Teredesai, Nicholson]
++- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
++- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck]
++- Add some FAQ entries about the contrib directory
++- Update the MVS question in the FAQ
++- Avoid extraneous reads after EOF in gzio.c [Brown]
++- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
++- Add comments to zlib.h about gzerror() usage [Brown]
++- Set extra flags in gzip header in gzopen() like deflate() does
++- Make configure options more compatible with double-dash conventions
++ [Weigelt]
++- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
++- Fix uninstall target in Makefile.in [Truta]
++- Add pkgconfig support [Weigelt]
++- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
++- Replace set_data_type() with a more accurate detect_data_type() in
++ trees.c, according to the txtvsbin.txt document [Truta]
++- Swap the order of #include <stdio.h> and #include "zlib.h" in
++ gzio.c, example.c and minigzip.c [Truta]
++- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
++ Truta] (where?)
++- Fix target "clean" from win32/Makefile.bor [Truta]
++- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
++- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
++- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
++- Enable browse info in the "Debug" and "ASM Debug" configurations in
++ the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
++- Add pkgconfig support [Weigelt]
++- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
++ for use in win32/zlib1.rc [Polushin, Rowe, Truta]
++- Add a document that explains the new text detection scheme to
++ doc/txtvsbin.txt [Truta]
++- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
++- Move algorithm.txt into doc/ [Truta]
++- Synchronize FAQ with website
++- Fix compressBound(), was low for some pathological cases [Fearnley]
++- Take into account wrapper variations in deflateBound()
++- Set examples/zpipe.c input and output to binary mode for Windows
++- Update examples/zlib_how.html with new zpipe.c (also web site)
++- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
++ that gcc became pickier in 4.0)
++- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
++ un-versioned, the patch adds versioning only for symbols introduced in
++ zlib-1.2.0 or later. It also declares as local those symbols which are
++ not designed to be exported." [Levin]
++- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
++- Do not initialize global static by default in trees.c, add a response
++ NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
++- Don't use strerror() in gzio.c under WinCE [Yakimov]
++- Don't use errno.h in zutil.h under WinCE [Yakimov]
++- Move arguments for AR to its usage to allow replacing ar [Marot]
++- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
++- Improve inflateInit() and inflateInit2() documentation
++- Fix structure size comment in inflate.h
++- Change configure help option from --h* to --help [Santos]
++
++Changes in 1.2.3 (18 July 2005)
++- Apply security vulnerability fixes to contrib/infback9 as well
++- Clean up some text files (carriage returns, trailing space)
++- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
++
++Changes in 1.2.2.4 (11 July 2005)
++- Add inflatePrime() function for starting inflation at bit boundary
++- Avoid some Visual C warnings in deflate.c
++- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
++ compile
++- Fix some spelling errors in comments [Betts]
++- Correct inflateInit2() error return documentation in zlib.h
++- Add zran.c example of compressed data random access to examples
++ directory, shows use of inflatePrime()
++- Fix cast for assignments to strm->state in inflate.c and infback.c
++- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
++- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
++- Add cast in trees.c t avoid a warning [Oberhumer]
++- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
++- Update make_vms.com [Zinser]
++- Initialize state->write in inflateReset() since copied in inflate_fast()
++- Be more strict on incomplete code sets in inflate_table() and increase
++ ENOUGH and MAXD -- this repairs a possible security vulnerability for
++ invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
++ discovering the vulnerability and providing test cases.
++- Add ia64 support to configure for HP-UX [Smith]
++- Add error return to gzread() for format or i/o error [Levin]
++- Use malloc.h for OS/2 [Necasek]
++
++Changes in 1.2.2.3 (27 May 2005)
++- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
++- Typecast fread() return values in gzio.c [Vollant]
++- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
++- Fix crc check bug in gzread() after gzungetc() [Heiner]
++- Add the deflateTune() function to adjust internal compression parameters
++- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
++- Remove an incorrect assertion in examples/zpipe.c
++- Add C++ wrapper in infback9.h [Donais]
++- Fix bug in inflateCopy() when decoding fixed codes
++- Note in zlib.h how much deflateSetDictionary() actually uses
++- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
++- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
++- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
++- Add gzdirect() function to indicate transparent reads
++- Update contrib/minizip [Vollant]
++- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
++- Add casts in crc32.c to avoid warnings [Oberhumer]
++- Add contrib/masmx64 [Vollant]
++- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
++
++Changes in 1.2.2.2 (30 December 2004)
++- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
++ avoid implicit memcpy calls (portability for no-library compilation)
++- Increase sprintf() buffer size in gzdopen() to allow for large numbers
++- Add INFLATE_STRICT to check distances against zlib header
++- Improve WinCE errno handling and comments [Chang]
++- Remove comment about no gzip header processing in FAQ
++- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
++- Add updated make_vms.com [Coghlan], update README
++- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
++ fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
++- Add FAQ entry and comments in deflate.c on uninitialized memory access
++- Add Solaris 9 make options in configure [Gilbert]
++- Allow strerror() usage in gzio.c for STDC
++- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
++- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
++- Use z_off_t for adler32_combine() and crc32_combine() lengths
++- Make adler32() much faster for small len
++- Use OS_CODE in deflate() default gzip header
++
++Changes in 1.2.2.1 (31 October 2004)
++- Allow inflateSetDictionary() call for raw inflate
++- Fix inflate header crc check bug for file names and comments
++- Add deflateSetHeader() and gz_header structure for custom gzip headers
++- Add inflateGetheader() to retrieve gzip headers
++- Add crc32_combine() and adler32_combine() functions
++- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
++- Use zstreamp consistently in zlib.h (inflate_back functions)
++- Remove GUNZIP condition from definition of inflate_mode in inflate.h
++ and in contrib/inflate86/inffast.S [Truta, Anderson]
++- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
++- Update projects/README.projects and projects/visualc6 [Truta]
++- Update win32/DLL_FAQ.txt [Truta]
++- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
++- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
++- Use a new algorithm for setting strm->data_type in trees.c [Truta]
++- Do not define an exit() prototype in zutil.c unless DEBUG defined
++- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
++- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
++- Fix Darwin build version identification [Peterson]
++
++Changes in 1.2.2 (3 October 2004)
++- Update zlib.h comments on gzip in-memory processing
++- Set adler to 1 in inflateReset() to support Java test suite [Walles]
++- Add contrib/dotzlib [Ravn]
++- Update win32/DLL_FAQ.txt [Truta]
++- Update contrib/minizip [Vollant]
++- Move contrib/visual-basic.txt to old/ [Truta]
++- Fix assembler builds in projects/visualc6/ [Truta]
++
++Changes in 1.2.1.2 (9 September 2004)
++- Update INDEX file
++- Fix trees.c to update strm->data_type (no one ever noticed!)
++- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
++- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
++- Add limited multitasking protection to DYNAMIC_CRC_TABLE
++- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
++- Don't declare strerror() under VMS [Mozilla]
++- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
++- Update contrib/ada [Anisimkov]
++- Update contrib/minizip [Vollant]
++- Fix configure to not hardcode directories for Darwin [Peterson]
++- Fix gzio.c to not return error on empty files [Brown]
++- Fix indentation; update version in contrib/delphi/ZLib.pas and
++ contrib/pascal/zlibpas.pas [Truta]
++- Update mkasm.bat in contrib/masmx86 [Truta]
++- Update contrib/untgz [Truta]
++- Add projects/README.projects [Truta]
++- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
++- Update win32/DLL_FAQ.txt [Truta]
++- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
++- Remove an unnecessary assignment to curr in inftrees.c [Truta]
++- Add OS/2 to exe builds in configure [Poltorak]
++- Remove err dummy parameter in zlib.h [Kientzle]
++
++Changes in 1.2.1.1 (9 January 2004)
++- Update email address in README
++- Several FAQ updates
++- Fix a big fat bug in inftrees.c that prevented decoding valid
++ dynamic blocks with only literals and no distance codes --
++ Thanks to "Hot Emu" for the bug report and sample file
++- Add a note to puff.c on no distance codes case.
++
++Changes in 1.2.1 (17 November 2003)
++- Remove a tab in contrib/gzappend/gzappend.c
++- Update some interfaces in contrib for new zlib functions
++- Update zlib version number in some contrib entries
++- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
++- Support shared libraries on Hurd and KFreeBSD [Brown]
++- Fix error in NO_DIVIDE option of adler32.c
++
++Changes in 1.2.0.8 (4 November 2003)
++- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
++- Add experimental NO_DIVIDE #define in adler32.c
++ - Possibly faster on some processors (let me know if it is)
++- Correct Z_BLOCK to not return on first inflate call if no wrap
++- Fix strm->data_type on inflate() return to correctly indicate EOB
++- Add deflatePrime() function for appending in the middle of a byte
++- Add contrib/gzappend for an example of appending to a stream
++- Update win32/DLL_FAQ.txt [Truta]
++- Delete Turbo C comment in README [Truta]
++- Improve some indentation in zconf.h [Truta]
++- Fix infinite loop on bad input in configure script [Church]
++- Fix gzeof() for concatenated gzip files [Johnson]
++- Add example to contrib/visual-basic.txt [Michael B.]
++- Add -p to mkdir's in Makefile.in [vda]
++- Fix configure to properly detect presence or lack of printf functions
++- Add AS400 support [Monnerat]
++- Add a little Cygwin support [Wilson]
++
++Changes in 1.2.0.7 (21 September 2003)
++- Correct some debug formats in contrib/infback9
++- Cast a type in a debug statement in trees.c
++- Change search and replace delimiter in configure from % to # [Beebe]
++- Update contrib/untgz to 0.2 with various fixes [Truta]
++- Add build support for Amiga [Nikl]
++- Remove some directories in old that have been updated to 1.2
++- Add dylib building for Mac OS X in configure and Makefile.in
++- Remove old distribution stuff from Makefile
++- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
++- Update links in README
++
++Changes in 1.2.0.6 (13 September 2003)
++- Minor FAQ updates
++- Update contrib/minizip to 1.00 [Vollant]
++- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
++- Update POSTINC comment for 68060 [Nikl]
++- Add contrib/infback9 with deflate64 decoding (unsupported)
++- For MVS define NO_vsnprintf and undefine FAR [van Burik]
++- Add pragma for fdopen on MVS [van Burik]
++
++Changes in 1.2.0.5 (8 September 2003)
++- Add OF to inflateBackEnd() declaration in zlib.h
++- Remember start when using gzdopen in the middle of a file
++- Use internal off_t counters in gz* functions to properly handle seeks
++- Perform more rigorous check for distance-too-far in inffast.c
++- Add Z_BLOCK flush option to return from inflate at block boundary
++- Set strm->data_type on return from inflate
++ - Indicate bits unused, if at block boundary, and if in last block
++- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
++- Add condition so old NO_DEFLATE define still works for compatibility
++- FAQ update regarding the Windows DLL [Truta]
++- INDEX update: add qnx entry, remove aix entry [Truta]
++- Install zlib.3 into mandir [Wilson]
++- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
++- Adapt the zlib interface to the new DLL convention guidelines [Truta]
++- Introduce ZLIB_WINAPI macro to allow the export of functions using
++ the WINAPI calling convention, for Visual Basic [Vollant, Truta]
++- Update msdos and win32 scripts and makefiles [Truta]
++- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
++- Add contrib/ada [Anisimkov]
++- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
++- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
++- Add contrib/masm686 [Truta]
++- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
++ [Truta, Vollant]
++- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
++- Remove contrib/delphi2; add a new contrib/delphi [Truta]
++- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
++ and fix some method prototypes [Truta]
++- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
++ [Truta]
++- Avoid the use of backslash (\) in contrib/minizip [Vollant]
++- Fix file time handling in contrib/untgz; update makefiles [Truta]
++- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
++ [Vollant]
++- Remove contrib/vstudio/vc15_16 [Vollant]
++- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
++- Update README.contrib [Truta]
++- Invert the assignment order of match_head and s->prev[...] in
++ INSERT_STRING [Truta]
++- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
++ [Truta]
++- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
++- Fix prototype of syncsearch in inflate.c [Truta]
++- Introduce ASMINF macro to be enabled when using an ASM implementation
++ of inflate_fast [Truta]
++- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
++- Modify test_gzio in example.c to take a single file name as a
++ parameter [Truta]
++- Exit the example.c program if gzopen fails [Truta]
++- Add type casts around strlen in example.c [Truta]
++- Remove casting to sizeof in minigzip.c; give a proper type
++ to the variable compared with SUFFIX_LEN [Truta]
++- Update definitions of STDC and STDC99 in zconf.h [Truta]
++- Synchronize zconf.h with the new Windows DLL interface [Truta]
++- Use SYS16BIT instead of __32BIT__ to distinguish between
++ 16- and 32-bit platforms [Truta]
++- Use far memory allocators in small 16-bit memory models for
++ Turbo C [Truta]
++- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
++ zlibCompileFlags [Truta]
++- Cygwin has vsnprintf [Wilson]
++- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
++- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
++
++Changes in 1.2.0.4 (10 August 2003)
++- Minor FAQ updates
++- Be more strict when checking inflateInit2's windowBits parameter
++- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
++- Add gzip wrapper option to deflateInit2 using windowBits
++- Add updated QNX rule in configure and qnx directory [Bonnefoy]
++- Make inflate distance-too-far checks more rigorous
++- Clean up FAR usage in inflate
++- Add casting to sizeof() in gzio.c and minigzip.c
++
++Changes in 1.2.0.3 (19 July 2003)
++- Fix silly error in gzungetc() implementation [Vollant]
++- Update contrib/minizip and contrib/vstudio [Vollant]
++- Fix printf format in example.c
++- Correct cdecl support in zconf.in.h [Anisimkov]
++- Minor FAQ updates
++
++Changes in 1.2.0.2 (13 July 2003)
++- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
++- Attempt to avoid warnings in crc32.c for pointer-int conversion
++- Add AIX to configure, remove aix directory [Bakker]
++- Add some casts to minigzip.c
++- Improve checking after insecure sprintf() or vsprintf() calls
++- Remove #elif's from crc32.c
++- Change leave label to inf_leave in inflate.c and infback.c to avoid
++ library conflicts
++- Remove inflate gzip decoding by default--only enable gzip decoding by
++ special request for stricter backward compatibility
++- Add zlibCompileFlags() function to return compilation information
++- More typecasting in deflate.c to avoid warnings
++- Remove leading underscore from _Capital #defines [Truta]
++- Fix configure to link shared library when testing
++- Add some Windows CE target adjustments [Mai]
++- Remove #define ZLIB_DLL in zconf.h [Vollant]
++- Add zlib.3 [Rodgers]
++- Update RFC URL in deflate.c and algorithm.txt [Mai]
++- Add zlib_dll_FAQ.txt to contrib [Truta]
++- Add UL to some constants [Truta]
++- Update minizip and vstudio [Vollant]
++- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
++- Expand use of NO_DUMMY_DECL to avoid all dummy structures
++- Added iostream3 to contrib [Schwardt]
++- Replace rewind() with fseek() for WinCE [Truta]
++- Improve setting of zlib format compression level flags
++ - Report 0 for huffman and rle strategies and for level == 0 or 1
++ - Report 2 only for level == 6
++- Only deal with 64K limit when necessary at compile time [Truta]
++- Allow TOO_FAR check to be turned off at compile time [Truta]
++- Add gzclearerr() function [Souza]
++- Add gzungetc() function
++
++Changes in 1.2.0.1 (17 March 2003)
++- Add Z_RLE strategy for run-length encoding [Truta]
++ - When Z_RLE requested, restrict matches to distance one
++ - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
++- Correct FASTEST compilation to allow level == 0
++- Clean up what gets compiled for FASTEST
++- Incorporate changes to zconf.in.h [Vollant]
++ - Refine detection of Turbo C need for dummy returns
++ - Refine ZLIB_DLL compilation
++ - Include additional header file on VMS for off_t typedef
++- Try to use _vsnprintf where it supplants vsprintf [Vollant]
++- Add some casts in inffast.c
++- Enchance comments in zlib.h on what happens if gzprintf() tries to
++ write more than 4095 bytes before compression
++- Remove unused state from inflateBackEnd()
++- Remove exit(0) from minigzip.c, example.c
++- Get rid of all those darn tabs
++- Add "check" target to Makefile.in that does the same thing as "test"
++- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
++- Update contrib/inflate86 [Anderson]
++- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
++- Add msdos and win32 directories with makefiles [Truta]
++- More additions and improvements to the FAQ
++
++Changes in 1.2.0 (9 March 2003)
++- New and improved inflate code
++ - About 20% faster
++ - Does not allocate 32K window unless and until needed
++ - Automatically detects and decompresses gzip streams
++ - Raw inflate no longer needs an extra dummy byte at end
++ - Added inflateBack functions using a callback interface--even faster
++ than inflate, useful for file utilities (gzip, zip)
++ - Added inflateCopy() function to record state for random access on
++ externally generated deflate streams (e.g. in gzip files)
++ - More readable code (I hope)
++- New and improved crc32()
++ - About 50% faster, thanks to suggestions from Rodney Brown
++- Add deflateBound() and compressBound() functions
++- Fix memory leak in deflateInit2()
++- Permit setting dictionary for raw deflate (for parallel deflate)
++- Fix const declaration for gzwrite()
++- Check for some malloc() failures in gzio.c
++- Fix bug in gzopen() on single-byte file 0x1f
++- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
++ and next buffer doesn't start with 0x8b
++- Fix uncompress() to return Z_DATA_ERROR on truncated input
++- Free memory at end of example.c
++- Remove MAX #define in trees.c (conflicted with some libraries)
++- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
++- Declare malloc() and free() in gzio.c if STDC not defined
++- Use malloc() instead of calloc() in zutil.c if int big enough
++- Define STDC for AIX
++- Add aix/ with approach for compiling shared library on AIX
++- Add HP-UX support for shared libraries in configure
++- Add OpenUNIX support for shared libraries in configure
++- Use $cc instead of gcc to build shared library
++- Make prefix directory if needed when installing
++- Correct Macintosh avoidance of typedef Byte in zconf.h
++- Correct Turbo C memory allocation when under Linux
++- Use libz.a instead of -lz in Makefile (assure use of compiled library)
++- Update configure to check for snprintf or vsnprintf functions and their
++ return value, warn during make if using an insecure function
++- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
++ is lost when library is used--resolution is to build new zconf.h
++- Documentation improvements (in zlib.h):
++ - Document raw deflate and inflate
++ - Update RFCs URL
++ - Point out that zlib and gzip formats are different
++ - Note that Z_BUF_ERROR is not fatal
++ - Document string limit for gzprintf() and possible buffer overflow
++ - Note requirement on avail_out when flushing
++ - Note permitted values of flush parameter of inflate()
++- Add some FAQs (and even answers) to the FAQ
++- Add contrib/inflate86/ for x86 faster inflate
++- Add contrib/blast/ for PKWare Data Compression Library decompression
++- Add contrib/puff/ simple inflate for deflate format description
++
++Changes in 1.1.4 (11 March 2002)
++- ZFREE was repeated on same allocation on some error conditions.
++ This creates a security problem described in
++ http://www.zlib.org/advisory-2002-03-11.txt
++- Returned incorrect error (Z_MEM_ERROR) on some invalid data
++- Avoid accesses before window for invalid distances with inflate window
++ less than 32K.
++- force windowBits > 8 to avoid a bug in the encoder for a window size
++ of 256 bytes. (A complete fix will be available in 1.1.5).
++
++Changes in 1.1.3 (9 July 1998)
++- fix "an inflate input buffer bug that shows up on rare but persistent
++ occasions" (Mark)
++- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
++- fix gzseek(..., SEEK_SET) in write mode
++- fix crc check after a gzeek (Frank Faubert)
++- fix miniunzip when the last entry in a zip file is itself a zip file
++ (J Lillge)
++- add contrib/asm586 and contrib/asm686 (Brian Raiter)
++ See http://www.muppetlabs.com/~breadbox/software/assembly.html
++- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
++- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
++- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
++- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
++- added a FAQ file
++
++- Support gzdopen on Mac with Metrowerks (Jason Linhart)
++- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
++- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
++- avoid some warnings with Borland C (Tom Tanner)
++- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
++- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
++- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
++- use libdir and includedir in Makefile.in (Tim Mooney)
++- support shared libraries on OSF1 V4 (Tim Mooney)
++- remove so_locations in "make clean" (Tim Mooney)
++- fix maketree.c compilation error (Glenn, Mark)
++- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
++- new Makefile.riscos (Rich Walker)
++- initialize static descriptors in trees.c for embedded targets (Nick Smith)
++- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
++- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
++- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
++- fix maketree.c to allow clean compilation of inffixed.h (Mark)
++- fix parameter check in deflateCopy (Gunther Nikl)
++- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
++- Many portability patches by Christian Spieler:
++ . zutil.c, zutil.h: added "const" for zmem*
++ . Make_vms.com: fixed some typos
++ . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
++ . msdos/Makefile.msc: remove "default rtl link library" info from obj files
++ . msdos/Makefile.*: use model-dependent name for the built zlib library
++ . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
++ new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
++- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
++- replace __far with _far for better portability (Christian Spieler, Tom Lane)
++- fix test for errno.h in configure (Tim Newsham)
++
++Changes in 1.1.2 (19 March 98)
++- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
++ See http://www.winimage.com/zLibDll/unzip.html
++- preinitialize the inflate tables for fixed codes, to make the code
++ completely thread safe (Mark)
++- some simplifications and slight speed-up to the inflate code (Mark)
++- fix gzeof on non-compressed files (Allan Schrum)
++- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
++- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
++- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
++- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
++- do not wrap extern "C" around system includes (Tom Lane)
++- mention zlib binding for TCL in README (Andreas Kupries)
++- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
++- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
++- allow "configure --prefix $HOME" (Tim Mooney)
++- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
++- move Makefile.sas to amiga/Makefile.sas
++
++Changes in 1.1.1 (27 Feb 98)
++- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
++- remove block truncation heuristic which had very marginal effect for zlib
++ (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
++ compression ratio on some files. This also allows inlining _tr_tally for
++ matches in deflate_slow.
++- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
++
++Changes in 1.1.0 (24 Feb 98)
++- do not return STREAM_END prematurely in inflate (John Bowler)
++- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
++- compile with -DFASTEST to get compression code optimized for speed only
++- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
++- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
++ on Sun but significant on HP)
++
++- add a pointer to experimental unzip library in README (Gilles Vollant)
++- initialize variable gcc in configure (Chris Herborth)
++
++Changes in 1.0.9 (17 Feb 1998)
++- added gzputs and gzgets functions
++- do not clear eof flag in gzseek (Mark Diekhans)
++- fix gzseek for files in transparent mode (Mark Diekhans)
++- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
++- replace EXPORT with ZEXPORT to avoid conflict with other programs
++- added compress2 in zconf.h, zlib.def, zlib.dnt
++- new asm code from Gilles Vollant in contrib/asm386
++- simplify the inflate code (Mark):
++ . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
++ . ZALLOC the length list in inflate_trees_fixed() instead of using stack
++ . ZALLOC the value area for huft_build() instead of using stack
++ . Simplify Z_FINISH check in inflate()
++
++- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
++- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
++- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
++ the declaration of FAR (Gilles VOllant)
++- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
++- read_buf buf parameter of type Bytef* instead of charf*
++- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
++- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
++- fix check for presence of directories in "make install" (Ian Willis)
++
++Changes in 1.0.8 (27 Jan 1998)
++- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
++- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
++- added compress2() to allow setting the compression level
++- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
++- use constant arrays for the static trees in trees.c instead of computing
++ them at run time (thanks to Ken Raeburn for this suggestion). To create
++ trees.h, compile with GEN_TREES_H and run "make test".
++- check return code of example in "make test" and display result
++- pass minigzip command line options to file_compress
++- simplifying code of inflateSync to avoid gcc 2.8 bug
++
++- support CC="gcc -Wall" in configure -s (QingLong)
++- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
++- fix test for shared library support to avoid compiler warnings
++- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
++- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
++- do not use fdopen for Metrowerks on Mac (Brad Pettit))
++- add checks for gzputc and gzputc in example.c
++- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
++- use const for the CRC table (Ken Raeburn)
++- fixed "make uninstall" for shared libraries
++- use Tracev instead of Trace in infblock.c
++- in example.c use correct compressed length for test_sync
++- suppress +vnocompatwarnings in configure for HPUX (not always supported)
++
++Changes in 1.0.7 (20 Jan 1998)
++- fix gzseek which was broken in write mode
++- return error for gzseek to negative absolute position
++- fix configure for Linux (Chun-Chung Chen)
++- increase stack space for MSC (Tim Wegner)
++- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
++- define EXPORTVA for gzprintf (Gilles Vollant)
++- added man page zlib.3 (Rick Rodgers)
++- for contrib/untgz, fix makedir() and improve Makefile
++
++- check gzseek in write mode in example.c
++- allocate extra buffer for seeks only if gzseek is actually called
++- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
++- add inflateSyncPoint in zconf.h
++- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
++
++Changes in 1.0.6 (19 Jan 1998)
++- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
++ gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
++- Fix a deflate bug occurring only with compression level 0 (thanks to
++ Andy Buckler for finding this one).
++- In minigzip, pass transparently also the first byte for .Z files.
++- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
++- check Z_FINISH in inflate (thanks to Marc Schluper)
++- Implement deflateCopy (thanks to Adam Costello)
++- make static libraries by default in configure, add --shared option.
++- move MSDOS or Windows specific files to directory msdos
++- suppress the notion of partial flush to simplify the interface
++ (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
++- suppress history buffer provided by application to simplify the interface
++ (this feature was not implemented anyway in 1.0.4)
++- next_in and avail_in must be initialized before calling inflateInit or
++ inflateInit2
++- add EXPORT in all exported functions (for Windows DLL)
++- added Makefile.nt (thanks to Stephen Williams)
++- added the unsupported "contrib" directory:
++ contrib/asm386/ by Gilles Vollant <info@winimage.com>
++ 386 asm code replacing longest_match().
++ contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
++ A C++ I/O streams interface to the zlib gz* functions
++ contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
++ Another C++ I/O streams interface
++ contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
++ A very simple tar.gz file extractor using zlib
++ contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
++ How to use compress(), uncompress() and the gz* functions from VB.
++- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
++ level) in minigzip (thanks to Tom Lane)
++
++- use const for rommable constants in deflate
++- added test for gzseek and gztell in example.c
++- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
++- add undocumented function zError to convert error code to string
++ (for Tim Smithers)
++- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
++- Use default memcpy for Symantec MSDOS compiler.
++- Add EXPORT keyword for check_func (needed for Windows DLL)
++- add current directory to LD_LIBRARY_PATH for "make test"
++- create also a link for libz.so.1
++- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
++- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
++- added -soname for Linux in configure (Chun-Chung Chen,
++- assign numbers to the exported functions in zlib.def (for Windows DLL)
++- add advice in zlib.h for best usage of deflateSetDictionary
++- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
++- allow compilation with ANSI keywords only enabled for TurboC in large model
++- avoid "versionString"[0] (Borland bug)
++- add NEED_DUMMY_RETURN for Borland
++- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
++- allow compilation with CC
++- defined STDC for OS/2 (David Charlap)
++- limit external names to 8 chars for MVS (Thomas Lund)
++- in minigzip.c, use static buffers only for 16-bit systems
++- fix suffix check for "minigzip -d foo.gz"
++- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
++- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
++- added makelcc.bat for lcc-win32 (Tom St Denis)
++- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
++- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
++- check for unistd.h in configure (for off_t)
++- remove useless check parameter in inflate_blocks_free
++- avoid useless assignment of s->check to itself in inflate_blocks_new
++- do not flush twice in gzclose (thanks to Ken Raeburn)
++- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
++- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
++- work around buggy fclose on pipes for HP/UX
++- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
++- fix configure if CC is already equal to gcc
++
++Changes in 1.0.5 (3 Jan 98)
++- Fix inflate to terminate gracefully when fed corrupted or invalid data
++- Use const for rommable constants in inflate
++- Eliminate memory leaks on error conditions in inflate
++- Removed some vestigial code in inflate
++- Update web address in README
++
++Changes in 1.0.4 (24 Jul 96)
++- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
++ bit, so the decompressor could decompress all the correct data but went
++ on to attempt decompressing extra garbage data. This affected minigzip too.
++- zlibVersion and gzerror return const char* (needed for DLL)
++- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
++- use z_error only for DEBUG (avoid problem with DLLs)
++
++Changes in 1.0.3 (2 Jul 96)
++- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
++ small and medium models; this makes the library incompatible with previous
++ versions for these models. (No effect in large model or on other systems.)
++- return OK instead of BUF_ERROR if previous deflate call returned with
++ avail_out as zero but there is nothing to do
++- added memcmp for non STDC compilers
++- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
++- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
++- better check for 16-bit mode MSC (avoids problem with Symantec)
++
++Changes in 1.0.2 (23 May 96)
++- added Windows DLL support
++- added a function zlibVersion (for the DLL support)
++- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
++- Bytef is define's instead of typedef'd only for Borland C
++- avoid reading uninitialized memory in example.c
++- mention in README that the zlib format is now RFC1950
++- updated Makefile.dj2
++- added algorithm.doc
++
++Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
++- fix array overlay in deflate.c which sometimes caused bad compressed data
++- fix inflate bug with empty stored block
++- fix MSDOS medium model which was broken in 0.99
++- fix deflateParams() which could generated bad compressed data.
++- Bytef is define'd instead of typedef'ed (work around Borland bug)
++- added an INDEX file
++- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
++ Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
++- speed up adler32 for modern machines without auto-increment
++- added -ansi for IRIX in configure
++- static_init_done in trees.c is an int
++- define unlink as delete for VMS
++- fix configure for QNX
++- add configure branch for SCO and HPUX
++- avoid many warnings (unused variables, dead assignments, etc...)
++- no fdopen for BeOS
++- fix the Watcom fix for 32 bit mode (define FAR as empty)
++- removed redefinition of Byte for MKWERKS
++- work around an MWKERKS bug (incorrect merge of all .h files)
++
++Changes in 0.99 (27 Jan 96)
++- allow preset dictionary shared between compressor and decompressor
++- allow compression level 0 (no compression)
++- add deflateParams in zlib.h: allow dynamic change of compression level
++ and compression strategy.
++- test large buffers and deflateParams in example.c
++- add optional "configure" to build zlib as a shared library
++- suppress Makefile.qnx, use configure instead
++- fixed deflate for 64-bit systems (detected on Cray)
++- fixed inflate_blocks for 64-bit systems (detected on Alpha)
++- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
++- always return Z_BUF_ERROR when deflate() has nothing to do
++- deflateInit and inflateInit are now macros to allow version checking
++- prefix all global functions and types with z_ with -DZ_PREFIX
++- make falloc completely reentrant (inftrees.c)
++- fixed very unlikely race condition in ct_static_init
++- free in reverse order of allocation to help memory manager
++- use zlib-1.0/* instead of zlib/* inside the tar.gz
++- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
++ -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
++- allow gzread on concatenated .gz files
++- deflateEnd now returns Z_DATA_ERROR if it was premature
++- deflate is finally (?) fully deterministic (no matches beyond end of input)
++- Document Z_SYNC_FLUSH
++- add uninstall in Makefile
++- Check for __cpluplus in zlib.h
++- Better test in ct_align for partial flush
++- avoid harmless warnings for Borland C++
++- initialize hash_head in deflate.c
++- avoid warning on fdopen (gzio.c) for HP cc -Aa
++- include stdlib.h for STDC compilers
++- include errno.h for Cray
++- ignore error if ranlib doesn't exist
++- call ranlib twice for NeXTSTEP
++- use exec_prefix instead of prefix for libz.a
++- renamed ct_* as _tr_* to avoid conflict with applications
++- clear z->msg in inflateInit2 before any error return
++- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
++- fixed typo in zconf.h (_GNUC__ => __GNUC__)
++- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
++- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
++- in fcalloc, normalize pointer if size > 65520 bytes
++- don't use special fcalloc for 32 bit Borland C++
++- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
++- use Z_BINARY instead of BINARY
++- document that gzclose after gzdopen will close the file
++- allow "a" as mode in gzopen.
++- fix error checking in gzread
++- allow skipping .gz extra-field on pipes
++- added reference to Perl interface in README
++- put the crc table in FAR data (I dislike more and more the medium model :)
++- added get_crc_table
++- added a dimension to all arrays (Borland C can't count).
++- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
++- guard against multiple inclusion of *.h (for precompiled header on Mac)
++- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
++- don't use unsized arrays to avoid silly warnings by Visual C++:
++ warning C4746: 'inflate_mask' : unsized array treated as '__far'
++ (what's wrong with far data in far model?).
++- define enum out of inflate_blocks_state to allow compilation with C++
++
++Changes in 0.95 (16 Aug 95)
++- fix MSDOS small and medium model (now easier to adapt to any compiler)
++- inlined send_bits
++- fix the final (:-) bug for deflate with flush (output was correct but
++ not completely flushed in rare occasions).
++- default window size is same for compression and decompression
++ (it's now sufficient to set MAX_WBITS in zconf.h).
++- voidp -> voidpf and voidnp -> voidp (for consistency with other
++ typedefs and because voidnp was not near in large model).
++
++Changes in 0.94 (13 Aug 95)
++- support MSDOS medium model
++- fix deflate with flush (could sometimes generate bad output)
++- fix deflateReset (zlib header was incorrectly suppressed)
++- added support for VMS
++- allow a compression level in gzopen()
++- gzflush now calls fflush
++- For deflate with flush, flush even if no more input is provided.
++- rename libgz.a as libz.a
++- avoid complex expression in infcodes.c triggering Turbo C bug
++- work around a problem with gcc on Alpha (in INSERT_STRING)
++- don't use inline functions (problem with some gcc versions)
++- allow renaming of Byte, uInt, etc... with #define.
++- avoid warning about (unused) pointer before start of array in deflate.c
++- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
++- avoid reserved word 'new' in trees.c
++
++Changes in 0.93 (25 June 95)
++- temporarily disable inline functions
++- make deflate deterministic
++- give enough lookahead for PARTIAL_FLUSH
++- Set binary mode for stdin/stdout in minigzip.c for OS/2
++- don't even use signed char in inflate (not portable enough)
++- fix inflate memory leak for segmented architectures
++
++Changes in 0.92 (3 May 95)
++- don't assume that char is signed (problem on SGI)
++- Clear bit buffer when starting a stored block
++- no memcpy on Pyramid
++- suppressed inftest.c
++- optimized fill_window, put longest_match inline for gcc
++- optimized inflate on stored blocks.
++- untabify all sources to simplify patches
++
++Changes in 0.91 (2 May 95)
++- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
++- Document the memory requirements in zconf.h
++- added "make install"
++- fix sync search logic in inflateSync
++- deflate(Z_FULL_FLUSH) now works even if output buffer too short
++- after inflateSync, don't scare people with just "lo world"
++- added support for DJGPP
++
++Changes in 0.9 (1 May 95)
++- don't assume that zalloc clears the allocated memory (the TurboC bug
++ was Mark's bug after all :)
++- let again gzread copy uncompressed data unchanged (was working in 0.71)
++- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
++- added a test of inflateSync in example.c
++- moved MAX_WBITS to zconf.h because users might want to change that.
++- document explicitly that zalloc(64K) on MSDOS must return a normalized
++ pointer (zero offset)
++- added Makefiles for Microsoft C, Turbo C, Borland C++
++- faster crc32()
++
++Changes in 0.8 (29 April 95)
++- added fast inflate (inffast.c)
++- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
++ is incompatible with previous versions of zlib which returned Z_OK.
++- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
++ (actually that was not a compiler bug, see 0.81 above)
++- gzread no longer reads one extra byte in certain cases
++- In gzio destroy(), don't reference a freed structure
++- avoid many warnings for MSDOS
++- avoid the ERROR symbol which is used by MS Windows
++
++Changes in 0.71 (14 April 95)
++- Fixed more MSDOS compilation problems :( There is still a bug with
++ TurboC large model.
++
++Changes in 0.7 (14 April 95)
++- Added full inflate support.
++- Simplified the crc32() interface. The pre- and post-conditioning
++ (one's complement) is now done inside crc32(). WARNING: this is
++ incompatible with previous versions; see zlib.h for the new usage.
++
++Changes in 0.61 (12 April 95)
++- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
++
++Changes in 0.6 (11 April 95)
++- added minigzip.c
++- added gzdopen to reopen a file descriptor as gzFile
++- added transparent reading of non-gziped files in gzread.
++- fixed bug in gzread (don't read crc as data)
++- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
++- don't allocate big arrays in the stack (for MSDOS)
++- fix some MSDOS compilation problems
++
++Changes in 0.5:
++- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
++ not yet Z_FULL_FLUSH.
++- support decompression but only in a single step (forced Z_FINISH)
++- added opaque object for zalloc and zfree.
++- added deflateReset and inflateReset
++- added a variable zlib_version for consistency checking.
++- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
++ Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
++
++Changes in 0.4:
++- avoid "zip" everywhere, use zlib instead of ziplib.
++- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
++ if compression method == 8.
++- added adler32 and crc32
++- renamed deflateOptions as deflateInit2, call one or the other but not both
++- added the method parameter for deflateInit2.
++- added inflateInit2
++- simplied considerably deflateInit and inflateInit by not supporting
++ user-provided history buffer. This is supported only in deflateInit2
++ and inflateInit2.
++
++Changes in 0.3:
++- prefix all macro names with Z_
++- use Z_FINISH instead of deflateEnd to finish compression.
++- added Z_HUFFMAN_ONLY
++- added gzerror()
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/README Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,115 @@
++ZLIB DATA COMPRESSION LIBRARY
++
++zlib 1.2.8 is a general purpose data compression library. All the code is
++thread safe. The data format used by the zlib library is described by RFCs
++(Request for Comments) 1950 to 1952 in the files
++http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
++rfc1952 (gzip format).
++
++All functions of the compression library are documented in the file zlib.h
++(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
++of the library is given in the file test/example.c which also tests that
++the library is working correctly. Another example is given in the file
++test/minigzip.c. The compression library itself is composed of all source
++files in the root directory.
++
++To compile all files and run the test program, follow the instructions given at
++the top of Makefile.in. In short "./configure; make test", and if that goes
++well, "make install" should work for most flavors of Unix. For Windows, use
++one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
++make_vms.com.
++
++Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
++<info@winimage.com> for the Windows DLL version. The zlib home page is
++http://zlib.net/ . Before reporting a problem, please check this site to
++verify that you have the latest version of zlib; otherwise get the latest
++version and check whether the problem still exists or not.
++
++PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
++
++Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
++issue of Dr. Dobb's Journal; a copy of the article is available at
++http://marknelson.us/1997/01/01/zlib-engine/ .
++
++The changes made in version 1.2.8 are documented in the file ChangeLog.
++
++Unsupported third party contributions are provided in directory contrib/ .
++
++zlib is available in Java using the java.util.zip package, documented at
++http://java.sun.com/developer/technicalArticles/Programming/compression/ .
++
++A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
++at CPAN (Comprehensive Perl Archive Network) sites, including
++http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
++
++A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
++available in Python 1.5 and later versions, see
++http://docs.python.org/library/zlib.html .
++
++zlib is built into tcl: http://wiki.tcl.tk/4610 .
++
++An experimental package to read and write files in .zip format, written on top
++of zlib by Gilles Vollant <info@winimage.com>, is available in the
++contrib/minizip directory of zlib.
++
++
++Notes for some targets:
++
++- For Windows DLL versions, please see win32/DLL_FAQ.txt
++
++- For 64-bit Irix, deflate.c must be compiled without any optimization. With
++ -O, one libpng test fails. The test works in 32 bit mode (with the -n32
++ compiler flag). The compiler bug has been reported to SGI.
++
++- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
++ when compiled with cc.
++
++- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
++ necessary to get gzprintf working correctly. This is done by configure.
++
++- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
++ other compilers. Use "make test" to check your compiler.
++
++- gzdopen is not supported on RISCOS or BEOS.
++
++- For PalmOs, see http://palmzlib.sourceforge.net/
++
++
++Acknowledgments:
++
++ The deflate format used by zlib was defined by Phil Katz. The deflate and
++ zlib specifications were written by L. Peter Deutsch. Thanks to all the
++ people who reported problems and suggested various improvements in zlib; they
++ are too numerous to cite here.
++
++Copyright notice:
++
++ (C) 1995-2013 Jean-loup Gailly and Mark Adler
++
++ This software is provided 'as-is', without any express or implied
++ warranty. In no event will the authors be held liable for any damages
++ arising from the use of this software.
++
++ Permission is granted to anyone to use this software for any purpose,
++ including commercial applications, and to alter it and redistribute it
++ freely, subject to the following restrictions:
++
++ 1. The origin of this software must not be misrepresented; you must not
++ claim that you wrote the original software. If you use this software
++ in a product, an acknowledgment in the product documentation would be
++ appreciated but is not required.
++ 2. Altered source versions must be plainly marked as such, and must not be
++ misrepresented as being the original software.
++ 3. This notice may not be removed or altered from any source distribution.
++
++ Jean-loup Gailly Mark Adler
++ jloup@gzip.org madler@alumni.caltech.edu
++
++If you use the zlib library in a product, we would appreciate *not* receiving
++lengthy legal documents to sign. The sources are provided for free but without
++warranty of any kind. The library has been entirely written by Jean-loup
++Gailly and Mark Adler; it does not include third-party code.
++
++If you redistribute modified sources, we would appreciate that you include in
++the file ChangeLog history information documenting your changes. Please read
++the FAQ for more information on the distribution of modified source versions.
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/compress.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,104 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* compress.c -- compress a memory buffer
++ * Copyright (C) 1995-2005 Jean-loup Gailly.
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* @(#) $Id$ */
++
++#define ZLIB_INTERNAL
++#include "zlib.h"
++
++/* ===========================================================================
++ Compresses the source buffer into the destination buffer. The level
++ parameter has the same meaning as in deflateInit. sourceLen is the byte
++ length of the source buffer. Upon entry, destLen is the total size of the
++ destination buffer, which must be at least 0.1% larger than sourceLen plus
++ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
++
++ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
++ Z_STREAM_ERROR if the level parameter is invalid.
++*/
++int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
++ Bytef *dest;
++ uLongf *destLen;
++ const Bytef *source;
++ uLong sourceLen;
++ int level;
++{
++ z_stream stream;
++ int err;
++
++ stream.next_in = (z_const Bytef *)source;
++ stream.avail_in = (uInt)sourceLen;
++#ifdef MAXSEG_64K
++ /* Check for source > 64K on 16-bit machine: */
++ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
++#endif
++ stream.next_out = dest;
++ stream.avail_out = (uInt)*destLen;
++ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
++
++ stream.zalloc = (alloc_func)0;
++ stream.zfree = (free_func)0;
++ stream.opaque = (voidpf)0;
++
++ err = deflateInit(&stream, level);
++ if (err != Z_OK) return err;
++
++ err = deflate(&stream, Z_FINISH);
++ if (err != Z_STREAM_END) {
++ deflateEnd(&stream);
++ return err == Z_OK ? Z_BUF_ERROR : err;
++ }
++ *destLen = stream.total_out;
++
++ err = deflateEnd(&stream);
++ return err;
++}
++
++/* ===========================================================================
++ */
++int ZEXPORT compress (dest, destLen, source, sourceLen)
++ Bytef *dest;
++ uLongf *destLen;
++ const Bytef *source;
++ uLong sourceLen;
++{
++ return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
++}
++
++/* ===========================================================================
++ If the default memLevel or windowBits for deflateInit() is changed, then
++ this function needs to be updated.
++ */
++uLong ZEXPORT compressBound (sourceLen)
++ uLong sourceLen;
++{
++ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
++ (sourceLen >> 25) + 13;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/crc32.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,465 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* crc32.h -- tables for rapid CRC calculation
++ * Generated automatically by crc32.c
++ */
++
++local const z_crc_t FAR crc_table[TBLS][256] =
++{
++ {
++ 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
++ 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
++ 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
++ 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
++ 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
++ 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
++ 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
++ 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
++ 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
++ 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
++ 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
++ 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
++ 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
++ 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
++ 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
++ 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
++ 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
++ 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
++ 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
++ 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
++ 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
++ 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
++ 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
++ 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
++ 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
++ 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
++ 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
++ 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
++ 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
++ 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
++ 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
++ 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
++ 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
++ 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
++ 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
++ 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
++ 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
++ 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
++ 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
++ 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
++ 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
++ 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
++ 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
++ 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
++ 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
++ 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
++ 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
++ 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
++ 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
++ 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
++ 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
++ 0x2d02ef8dUL
++#ifdef BYFOUR
++ },
++ {
++ 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
++ 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
++ 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
++ 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
++ 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
++ 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
++ 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
++ 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
++ 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
++ 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
++ 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
++ 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
++ 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
++ 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
++ 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
++ 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
++ 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
++ 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
++ 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
++ 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
++ 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
++ 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
++ 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
++ 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
++ 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
++ 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
++ 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
++ 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
++ 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
++ 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
++ 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
++ 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
++ 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
++ 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
++ 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
++ 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
++ 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
++ 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
++ 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
++ 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
++ 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
++ 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
++ 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
++ 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
++ 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
++ 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
++ 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
++ 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
++ 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
++ 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
++ 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
++ 0x9324fd72UL
++ },
++ {
++ 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
++ 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
++ 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
++ 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
++ 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
++ 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
++ 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
++ 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
++ 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
++ 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
++ 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
++ 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
++ 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
++ 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
++ 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
++ 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
++ 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
++ 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
++ 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
++ 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
++ 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
++ 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
++ 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
++ 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
++ 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
++ 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
++ 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
++ 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
++ 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
++ 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
++ 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
++ 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
++ 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
++ 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
++ 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
++ 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
++ 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
++ 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
++ 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
++ 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
++ 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
++ 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
++ 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
++ 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
++ 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
++ 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
++ 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
++ 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
++ 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
++ 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
++ 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
++ 0xbe9834edUL
++ },
++ {
++ 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
++ 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
++ 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
++ 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
++ 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
++ 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
++ 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
++ 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
++ 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
++ 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
++ 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
++ 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
++ 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
++ 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
++ 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
++ 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
++ 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
++ 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
++ 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
++ 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
++ 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
++ 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
++ 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
++ 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
++ 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
++ 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
++ 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
++ 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
++ 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
++ 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
++ 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
++ 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
++ 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
++ 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
++ 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
++ 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
++ 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
++ 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
++ 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
++ 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
++ 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
++ 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
++ 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
++ 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
++ 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
++ 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
++ 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
++ 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
++ 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
++ 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
++ 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
++ 0xde0506f1UL
++ },
++ {
++ 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
++ 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
++ 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
++ 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
++ 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
++ 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
++ 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
++ 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
++ 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
++ 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
++ 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
++ 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
++ 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
++ 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
++ 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
++ 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
++ 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
++ 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
++ 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
++ 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
++ 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
++ 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
++ 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
++ 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
++ 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
++ 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
++ 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
++ 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
++ 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
++ 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
++ 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
++ 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
++ 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
++ 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
++ 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
++ 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
++ 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
++ 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
++ 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
++ 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
++ 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
++ 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
++ 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
++ 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
++ 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
++ 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
++ 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
++ 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
++ 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
++ 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
++ 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
++ 0x8def022dUL
++ },
++ {
++ 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
++ 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
++ 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
++ 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
++ 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
++ 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
++ 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
++ 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
++ 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
++ 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
++ 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
++ 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
++ 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
++ 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
++ 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
++ 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
++ 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
++ 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
++ 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
++ 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
++ 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
++ 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
++ 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
++ 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
++ 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
++ 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
++ 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
++ 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
++ 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
++ 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
++ 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
++ 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
++ 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
++ 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
++ 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
++ 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
++ 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
++ 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
++ 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
++ 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
++ 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
++ 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
++ 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
++ 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
++ 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
++ 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
++ 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
++ 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
++ 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
++ 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
++ 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
++ 0x72fd2493UL
++ },
++ {
++ 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
++ 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
++ 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
++ 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
++ 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
++ 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
++ 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
++ 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
++ 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
++ 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
++ 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
++ 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
++ 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
++ 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
++ 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
++ 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
++ 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
++ 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
++ 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
++ 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
++ 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
++ 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
++ 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
++ 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
++ 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
++ 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
++ 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
++ 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
++ 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
++ 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
++ 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
++ 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
++ 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
++ 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
++ 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
++ 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
++ 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
++ 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
++ 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
++ 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
++ 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
++ 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
++ 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
++ 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
++ 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
++ 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
++ 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
++ 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
++ 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
++ 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
++ 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
++ 0xed3498beUL
++ },
++ {
++ 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
++ 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
++ 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
++ 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
++ 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
++ 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
++ 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
++ 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
++ 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
++ 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
++ 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
++ 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
++ 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
++ 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
++ 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
++ 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
++ 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
++ 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
++ 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
++ 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
++ 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
++ 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
++ 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
++ 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
++ 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
++ 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
++ 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
++ 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
++ 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
++ 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
++ 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
++ 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
++ 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
++ 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
++ 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
++ 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
++ 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
++ 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
++ 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
++ 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
++ 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
++ 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
++ 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
++ 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
++ 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
++ 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
++ 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
++ 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
++ 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
++ 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
++ 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
++ 0xf10605deUL
++#endif
++ }
++};
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/deflate.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,1991 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* deflate.c -- compress data using the deflation algorithm
++ * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/*
++ * ALGORITHM
++ *
++ * The "deflation" process depends on being able to identify portions
++ * of the input text which are identical to earlier input (within a
++ * sliding window trailing behind the input currently being processed).
++ *
++ * The most straightforward technique turns out to be the fastest for
++ * most input files: try all possible matches and select the longest.
++ * The key feature of this algorithm is that insertions into the string
++ * dictionary are very simple and thus fast, and deletions are avoided
++ * completely. Insertions are performed at each input character, whereas
++ * string matches are performed only when the previous match ends. So it
++ * is preferable to spend more time in matches to allow very fast string
++ * insertions and avoid deletions. The matching algorithm for small
++ * strings is inspired from that of Rabin & Karp. A brute force approach
++ * is used to find longer strings when a small match has been found.
++ * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
++ * (by Leonid Broukhis).
++ * A previous version of this file used a more sophisticated algorithm
++ * (by Fiala and Greene) which is guaranteed to run in linear amortized
++ * time, but has a larger average cost, uses more memory and is patented.
++ * However the F&G algorithm may be faster for some highly redundant
++ * files if the parameter max_chain_length (described below) is too large.
++ *
++ * ACKNOWLEDGEMENTS
++ *
++ * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
++ * I found it in 'freeze' written by Leonid Broukhis.
++ * Thanks to many people for bug reports and testing.
++ *
++ * REFERENCES
++ *
++ * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
++ * Available in http://tools.ietf.org/html/rfc1951
++ *
++ * A description of the Rabin and Karp algorithm is given in the book
++ * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
++ *
++ * Fiala,E.R., and Greene,D.H.
++ * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
++ *
++ */
++
++/* @(#) $Id$ */
++
++#include "deflate.h"
++
++const char deflate_copyright[] =
++ " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
++/*
++ If you use the zlib library in a product, an acknowledgment is welcome
++ in the documentation of your product. If for some reason you cannot
++ include such an acknowledgment, I would appreciate that you keep this
++ copyright string in the executable of your product.
++ */
++
++/* ===========================================================================
++ * Function prototypes.
++ */
++typedef enum {
++ need_more, /* block not completed, need more input or more output */
++ block_done, /* block flush performed */
++ finish_started, /* finish started, need only more output at next deflate */
++ finish_done /* finish done, accept no more input or output */
++} block_state;
++
++typedef block_state (*compress_func) OF((deflate_state *s, int flush));
++/* Compression function. Returns the block state after the call. */
++
++local void fill_window OF((deflate_state *s));
++local block_state deflate_stored OF((deflate_state *s, int flush));
++local block_state deflate_fast OF((deflate_state *s, int flush));
++#ifndef FASTEST
++local block_state deflate_slow OF((deflate_state *s, int flush));
++#endif
++local block_state deflate_rle OF((deflate_state *s, int flush));
++local block_state deflate_huff OF((deflate_state *s, int flush));
++local void lm_init OF((deflate_state *s));
++local void putShortMSB OF((deflate_state *s, uInt b));
++local void flush_pending OF((z_streamp strm));
++local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
++#ifdef ASMV
++ void match_init OF((void)); /* asm code initialization */
++ uInt longest_match OF((deflate_state *s, IPos cur_match));
++#else
++local uInt longest_match OF((deflate_state *s, IPos cur_match));
++#endif
++
++#ifdef DEBUG
++local void check_match OF((deflate_state *s, IPos start, IPos match,
++ int length));
++#endif
++
++/* ===========================================================================
++ * Local data
++ */
++
++#define NIL 0
++/* Tail of hash chains */
++
++#ifndef TOO_FAR
++# define TOO_FAR 4096
++#endif
++/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
++
++/* Values for max_lazy_match, good_match and max_chain_length, depending on
++ * the desired pack level (0..9). The values given below have been tuned to
++ * exclude worst case performance for pathological files. Better values may be
++ * found for specific files.
++ */
++typedef struct config_s {
++ ush good_length; /* reduce lazy search above this match length */
++ ush max_lazy; /* do not perform lazy search above this match length */
++ ush nice_length; /* quit search above this match length */
++ ush max_chain;
++ compress_func func;
++} config;
++
++#ifdef FASTEST
++local const config configuration_table[2] = {
++/* good lazy nice chain */
++/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
++/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
++#else
++local const config configuration_table[10] = {
++/* good lazy nice chain */
++/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
++/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
++/* 2 */ {4, 5, 16, 8, deflate_fast},
++/* 3 */ {4, 6, 32, 32, deflate_fast},
++
++/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
++/* 5 */ {8, 16, 32, 32, deflate_slow},
++/* 6 */ {8, 16, 128, 128, deflate_slow},
++/* 7 */ {8, 32, 128, 256, deflate_slow},
++/* 8 */ {32, 128, 258, 1024, deflate_slow},
++/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
++#endif
++
++/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
++ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
++ * meaning.
++ */
++
++#define EQUAL 0
++/* result of memcmp for equal strings */
++
++#ifndef NO_DUMMY_DECL
++struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
++#endif
++
++/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
++#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
++
++/* ===========================================================================
++ * Update a hash value with the given input byte
++ * IN assertion: all calls to to UPDATE_HASH are made with consecutive
++ * input characters, so that a running hash key can be computed from the
++ * previous key instead of complete recalculation each time.
++ */
++#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
++
++
++/* ===========================================================================
++ * Insert string str in the dictionary and set match_head to the previous head
++ * of the hash chain (the most recent string with same hash key). Return
++ * the previous length of the hash chain.
++ * If this file is compiled with -DFASTEST, the compression level is forced
++ * to 1, and no hash chains are maintained.
++ * IN assertion: all calls to to INSERT_STRING are made with consecutive
++ * input characters and the first MIN_MATCH bytes of str are valid
++ * (except for the last MIN_MATCH-1 bytes of the input file).
++ */
++#ifdef FASTEST
++#define INSERT_STRING(s, str, match_head) \
++ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
++ match_head = s->head[s->ins_h], \
++ s->head[s->ins_h] = (Pos)(str))
++#else
++#define INSERT_STRING(s, str, match_head) \
++ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
++ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
++ s->head[s->ins_h] = (Pos)(str))
++#endif
++
++/* ===========================================================================
++ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
++ * prev[] will be initialized on the fly.
++ */
++#define CLEAR_HASH(s) \
++ s->head[s->hash_size-1] = NIL; \
++ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
++
++/* ========================================================================= */
++int ZEXPORT deflateInit_(strm, level, version, stream_size)
++ z_streamp strm;
++ int level;
++ const char *version;
++ int stream_size;
++{
++ return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
++ Z_DEFAULT_STRATEGY, version, stream_size);
++ /* To do: ignore strm->next_in if we use it as window */
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
++ version, stream_size)
++ z_streamp strm;
++ int level;
++ int method;
++ int windowBits;
++ int memLevel;
++ int strategy;
++ const char *version;
++ int stream_size;
++{
++ deflate_state *s;
++ int wrap = 1;
++ static const char my_version[] = ZLIB_VERSION;
++
++ ushf *overlay;
++ /* We overlay pending_buf and d_buf+l_buf. This works since the average
++ * output size for (length,distance) codes is <= 24 bits.
++ */
++
++ if (version == Z_NULL || version[0] != my_version[0] ||
++ stream_size != sizeof(z_stream)) {
++ return Z_VERSION_ERROR;
++ }
++ if (strm == Z_NULL) return Z_STREAM_ERROR;
++
++ strm->msg = Z_NULL;
++ if (strm->zalloc == (alloc_func)0) {
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zalloc = zcalloc;
++ strm->opaque = (voidpf)0;
++#endif
++ }
++ if (strm->zfree == (free_func)0)
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zfree = zcfree;
++#endif
++
++#ifdef FASTEST
++ if (level != 0) level = 1;
++#else
++ if (level == Z_DEFAULT_COMPRESSION) level = 6;
++#endif
++
++ if (windowBits < 0) { /* suppress zlib wrapper */
++ wrap = 0;
++ windowBits = -windowBits;
++ }
++#ifdef GZIP
++ else if (windowBits > 15) {
++ wrap = 2; /* write gzip wrapper instead */
++ windowBits -= 16;
++ }
++#endif
++ if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
++ windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
++ strategy < 0 || strategy > Z_FIXED) {
++ return Z_STREAM_ERROR;
++ }
++ if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
++ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
++ if (s == Z_NULL) return Z_MEM_ERROR;
++ strm->state = (struct internal_state FAR *)s;
++ s->strm = strm;
++
++ s->wrap = wrap;
++ s->gzhead = Z_NULL;
++ s->w_bits = windowBits;
++ s->w_size = 1 << s->w_bits;
++ s->w_mask = s->w_size - 1;
++
++ s->hash_bits = memLevel + 7;
++ s->hash_size = 1 << s->hash_bits;
++ s->hash_mask = s->hash_size - 1;
++ s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
++
++ s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
++ s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
++ s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
++
++ s->high_water = 0; /* nothing written to s->window yet */
++
++ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
++
++ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
++ s->pending_buf = (uchf *) overlay;
++ s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
++
++ if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
++ s->pending_buf == Z_NULL) {
++ s->status = FINISH_STATE;
++ strm->msg = ERR_MSG(Z_MEM_ERROR);
++ deflateEnd (strm);
++ return Z_MEM_ERROR;
++ }
++ s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
++ s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
++
++ s->level = level;
++ s->strategy = strategy;
++ s->method = (Byte)method;
++
++ return deflateReset(strm);
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
++ z_streamp strm;
++ const Bytef *dictionary;
++ uInt dictLength;
++{
++ deflate_state *s;
++ uInt str, n;
++ int wrap;
++ unsigned avail;
++ z_const unsigned char *next;
++
++ if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
++ return Z_STREAM_ERROR;
++ s = strm->state;
++ wrap = s->wrap;
++ if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
++ return Z_STREAM_ERROR;
++
++ /* when using zlib wrappers, compute Adler-32 for provided dictionary */
++ if (wrap == 1)
++ strm->adler = adler32(strm->adler, dictionary, dictLength);
++ s->wrap = 0; /* avoid computing Adler-32 in read_buf */
++
++ /* if dictionary would fill window, just replace the history */
++ if (dictLength >= s->w_size) {
++ if (wrap == 0) { /* already empty otherwise */
++ CLEAR_HASH(s);
++ s->strstart = 0;
++ s->block_start = 0L;
++ s->insert = 0;
++ }
++ dictionary += dictLength - s->w_size; /* use the tail */
++ dictLength = s->w_size;
++ }
++
++ /* insert dictionary into window and hash */
++ avail = strm->avail_in;
++ next = strm->next_in;
++ strm->avail_in = dictLength;
++ strm->next_in = (z_const Bytef *)dictionary;
++ fill_window(s);
++ while (s->lookahead >= MIN_MATCH) {
++ str = s->strstart;
++ n = s->lookahead - (MIN_MATCH-1);
++ do {
++ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
++#ifndef FASTEST
++ s->prev[str & s->w_mask] = s->head[s->ins_h];
++#endif
++ s->head[s->ins_h] = (Pos)str;
++ str++;
++ } while (--n);
++ s->strstart = str;
++ s->lookahead = MIN_MATCH-1;
++ fill_window(s);
++ }
++ s->strstart += s->lookahead;
++ s->block_start = (long)s->strstart;
++ s->insert = s->lookahead;
++ s->lookahead = 0;
++ s->match_length = s->prev_length = MIN_MATCH-1;
++ s->match_available = 0;
++ strm->next_in = next;
++ strm->avail_in = avail;
++ s->wrap = wrap;
++ return Z_OK;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateResetKeep (strm)
++ z_streamp strm;
++{
++ deflate_state *s;
++
++ if (strm == Z_NULL || strm->state == Z_NULL ||
++ strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
++ return Z_STREAM_ERROR;
++ }
++
++ strm->total_in = strm->total_out = 0;
++ strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
++ strm->data_type = Z_UNKNOWN;
++
++ s = (deflate_state *)strm->state;
++ s->pending = 0;
++ s->pending_out = s->pending_buf;
++
++ if (s->wrap < 0) {
++ s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
++ }
++ s->status = s->wrap ? INIT_STATE : BUSY_STATE;
++ strm->adler =
++#ifdef GZIP
++ s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
++#endif
++ adler32(0L, Z_NULL, 0);
++ s->last_flush = Z_NO_FLUSH;
++
++ _tr_init(s);
++
++ return Z_OK;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateReset (strm)
++ z_streamp strm;
++{
++ int ret;
++
++ ret = deflateResetKeep(strm);
++ if (ret == Z_OK)
++ lm_init(strm->state);
++ return ret;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateSetHeader (strm, head)
++ z_streamp strm;
++ gz_headerp head;
++{
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ if (strm->state->wrap != 2) return Z_STREAM_ERROR;
++ strm->state->gzhead = head;
++ return Z_OK;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflatePending (strm, pending, bits)
++ unsigned *pending;
++ int *bits;
++ z_streamp strm;
++{
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ if (pending != Z_NULL)
++ *pending = strm->state->pending;
++ if (bits != Z_NULL)
++ *bits = strm->state->bi_valid;
++ return Z_OK;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflatePrime (strm, bits, value)
++ z_streamp strm;
++ int bits;
++ int value;
++{
++ deflate_state *s;
++ int put;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ s = strm->state;
++ if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
++ return Z_BUF_ERROR;
++ do {
++ put = Buf_size - s->bi_valid;
++ if (put > bits)
++ put = bits;
++ s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
++ s->bi_valid += put;
++ _tr_flush_bits(s);
++ value >>= put;
++ bits -= put;
++ } while (bits);
++ return Z_OK;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateParams(strm, level, strategy)
++ z_streamp strm;
++ int level;
++ int strategy;
++{
++ deflate_state *s;
++ compress_func func;
++ int err = Z_OK;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ s = strm->state;
++
++#ifdef FASTEST
++ if (level != 0) level = 1;
++#else
++ if (level == Z_DEFAULT_COMPRESSION) level = 6;
++#endif
++ if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
++ return Z_STREAM_ERROR;
++ }
++ func = configuration_table[s->level].func;
++
++ if ((strategy != s->strategy || func != configuration_table[level].func) &&
++ strm->total_in != 0) {
++ /* Flush the last buffer: */
++ err = deflate(strm, Z_BLOCK);
++ if (err == Z_BUF_ERROR && s->pending == 0)
++ err = Z_OK;
++ }
++ if (s->level != level) {
++ s->level = level;
++ s->max_lazy_match = configuration_table[level].max_lazy;
++ s->good_match = configuration_table[level].good_length;
++ s->nice_match = configuration_table[level].nice_length;
++ s->max_chain_length = configuration_table[level].max_chain;
++ }
++ s->strategy = strategy;
++ return err;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
++ z_streamp strm;
++ int good_length;
++ int max_lazy;
++ int nice_length;
++ int max_chain;
++{
++ deflate_state *s;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ s = strm->state;
++ s->good_match = good_length;
++ s->max_lazy_match = max_lazy;
++ s->nice_match = nice_length;
++ s->max_chain_length = max_chain;
++ return Z_OK;
++}
++
++/* =========================================================================
++ * For the default windowBits of 15 and memLevel of 8, this function returns
++ * a close to exact, as well as small, upper bound on the compressed size.
++ * They are coded as constants here for a reason--if the #define's are
++ * changed, then this function needs to be changed as well. The return
++ * value for 15 and 8 only works for those exact settings.
++ *
++ * For any setting other than those defaults for windowBits and memLevel,
++ * the value returned is a conservative worst case for the maximum expansion
++ * resulting from using fixed blocks instead of stored blocks, which deflate
++ * can emit on compressed data for some combinations of the parameters.
++ *
++ * This function could be more sophisticated to provide closer upper bounds for
++ * every combination of windowBits and memLevel. But even the conservative
++ * upper bound of about 14% expansion does not seem onerous for output buffer
++ * allocation.
++ */
++uLong ZEXPORT deflateBound(strm, sourceLen)
++ z_streamp strm;
++ uLong sourceLen;
++{
++ deflate_state *s;
++ uLong complen, wraplen;
++ Bytef *str;
++
++ /* conservative upper bound for compressed data */
++ complen = sourceLen +
++ ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
++
++ /* if can't get parameters, return conservative bound plus zlib wrapper */
++ if (strm == Z_NULL || strm->state == Z_NULL)
++ return complen + 6;
++
++ /* compute wrapper length */
++ s = strm->state;
++ switch (s->wrap) {
++ case 0: /* raw deflate */
++ wraplen = 0;
++ break;
++ case 1: /* zlib wrapper */
++ wraplen = 6 + (s->strstart ? 4 : 0);
++ break;
++ case 2: /* gzip wrapper */
++ wraplen = 18;
++ if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
++ if (s->gzhead->extra != Z_NULL)
++ wraplen += 2 + s->gzhead->extra_len;
++ str = s->gzhead->name;
++ if (str != Z_NULL)
++ do {
++ wraplen++;
++ } while (*str++);
++ str = s->gzhead->comment;
++ if (str != Z_NULL)
++ do {
++ wraplen++;
++ } while (*str++);
++ if (s->gzhead->hcrc)
++ wraplen += 2;
++ }
++ break;
++ default: /* for compiler happiness */
++ wraplen = 6;
++ }
++
++ /* if not default parameters, return conservative bound */
++ if (s->w_bits != 15 || s->hash_bits != 8 + 7)
++ return complen + wraplen;
++
++ /* default settings: return tight bound for that case */
++ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
++ (sourceLen >> 25) + 13 - 6 + wraplen;
++}
++
++/* =========================================================================
++ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
++ * IN assertion: the stream state is correct and there is enough room in
++ * pending_buf.
++ */
++local void putShortMSB (s, b)
++ deflate_state *s;
++ uInt b;
++{
++ put_byte(s, (Byte)(b >> 8));
++ put_byte(s, (Byte)(b & 0xff));
++}
++
++/* =========================================================================
++ * Flush as much pending output as possible. All deflate() output goes
++ * through this function so some applications may wish to modify it
++ * to avoid allocating a large strm->next_out buffer and copying into it.
++ * (See also read_buf()).
++ */
++local void flush_pending(strm)
++ z_streamp strm;
++{
++ unsigned len;
++ deflate_state *s = strm->state;
++
++ _tr_flush_bits(s);
++ len = s->pending;
++ if (len > strm->avail_out) len = strm->avail_out;
++ if (len == 0) return;
++
++ zmemcpy(strm->next_out, s->pending_out, len);
++ strm->next_out += len;
++ s->pending_out += len;
++ strm->total_out += len;
++ strm->avail_out -= len;
++ s->pending -= len;
++ if (s->pending == 0) {
++ s->pending_out = s->pending_buf;
++ }
++}
++
++/* ========================================================================= */
++int ZEXPORT deflate (strm, flush)
++ z_streamp strm;
++ int flush;
++{
++ int old_flush; /* value of flush param for previous deflate call */
++ deflate_state *s;
++
++ if (strm == Z_NULL || strm->state == Z_NULL ||
++ flush > Z_BLOCK || flush < 0) {
++ return Z_STREAM_ERROR;
++ }
++ s = strm->state;
++
++ if (strm->next_out == Z_NULL ||
++ (strm->next_in == Z_NULL && strm->avail_in != 0) ||
++ (s->status == FINISH_STATE && flush != Z_FINISH)) {
++ ERR_RETURN(strm, Z_STREAM_ERROR);
++ }
++ if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
++
++ s->strm = strm; /* just in case */
++ old_flush = s->last_flush;
++ s->last_flush = flush;
++
++ /* Write the header */
++ if (s->status == INIT_STATE) {
++#ifdef GZIP
++ if (s->wrap == 2) {
++ strm->adler = crc32(0L, Z_NULL, 0);
++ put_byte(s, 31);
++ put_byte(s, 139);
++ put_byte(s, 8);
++ if (s->gzhead == Z_NULL) {
++ put_byte(s, 0);
++ put_byte(s, 0);
++ put_byte(s, 0);
++ put_byte(s, 0);
++ put_byte(s, 0);
++ put_byte(s, s->level == 9 ? 2 :
++ (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
++ 4 : 0));
++ put_byte(s, OS_CODE);
++ s->status = BUSY_STATE;
++ }
++ else {
++ put_byte(s, (s->gzhead->text ? 1 : 0) +
++ (s->gzhead->hcrc ? 2 : 0) +
++ (s->gzhead->extra == Z_NULL ? 0 : 4) +
++ (s->gzhead->name == Z_NULL ? 0 : 8) +
++ (s->gzhead->comment == Z_NULL ? 0 : 16)
++ );
++ put_byte(s, (Byte)(s->gzhead->time & 0xff));
++ put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
++ put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
++ put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
++ put_byte(s, s->level == 9 ? 2 :
++ (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
++ 4 : 0));
++ put_byte(s, s->gzhead->os & 0xff);
++ if (s->gzhead->extra != Z_NULL) {
++ put_byte(s, s->gzhead->extra_len & 0xff);
++ put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
++ }
++ if (s->gzhead->hcrc)
++ strm->adler = crc32(strm->adler, s->pending_buf,
++ s->pending);
++ s->gzindex = 0;
++ s->status = EXTRA_STATE;
++ }
++ }
++ else
++#endif
++ {
++ uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
++ uInt level_flags;
++
++ if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
++ level_flags = 0;
++ else if (s->level < 6)
++ level_flags = 1;
++ else if (s->level == 6)
++ level_flags = 2;
++ else
++ level_flags = 3;
++ header |= (level_flags << 6);
++ if (s->strstart != 0) header |= PRESET_DICT;
++ header += 31 - (header % 31);
++
++ s->status = BUSY_STATE;
++ putShortMSB(s, header);
++
++ /* Save the adler32 of the preset dictionary: */
++ if (s->strstart != 0) {
++ putShortMSB(s, (uInt)(strm->adler >> 16));
++ putShortMSB(s, (uInt)(strm->adler & 0xffff));
++ }
++ strm->adler = adler32(0L, Z_NULL, 0);
++ }
++ }
++#ifdef GZIP
++ if (s->status == EXTRA_STATE) {
++ if (s->gzhead->extra != Z_NULL) {
++ uInt beg = s->pending; /* start of bytes to update crc */
++
++ while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
++ if (s->pending == s->pending_buf_size) {
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ flush_pending(strm);
++ beg = s->pending;
++ if (s->pending == s->pending_buf_size)
++ break;
++ }
++ put_byte(s, s->gzhead->extra[s->gzindex]);
++ s->gzindex++;
++ }
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ if (s->gzindex == s->gzhead->extra_len) {
++ s->gzindex = 0;
++ s->status = NAME_STATE;
++ }
++ }
++ else
++ s->status = NAME_STATE;
++ }
++ if (s->status == NAME_STATE) {
++ if (s->gzhead->name != Z_NULL) {
++ uInt beg = s->pending; /* start of bytes to update crc */
++ int val;
++
++ do {
++ if (s->pending == s->pending_buf_size) {
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ flush_pending(strm);
++ beg = s->pending;
++ if (s->pending == s->pending_buf_size) {
++ val = 1;
++ break;
++ }
++ }
++ val = s->gzhead->name[s->gzindex++];
++ put_byte(s, val);
++ } while (val != 0);
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ if (val == 0) {
++ s->gzindex = 0;
++ s->status = COMMENT_STATE;
++ }
++ }
++ else
++ s->status = COMMENT_STATE;
++ }
++ if (s->status == COMMENT_STATE) {
++ if (s->gzhead->comment != Z_NULL) {
++ uInt beg = s->pending; /* start of bytes to update crc */
++ int val;
++
++ do {
++ if (s->pending == s->pending_buf_size) {
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ flush_pending(strm);
++ beg = s->pending;
++ if (s->pending == s->pending_buf_size) {
++ val = 1;
++ break;
++ }
++ }
++ val = s->gzhead->comment[s->gzindex++];
++ put_byte(s, val);
++ } while (val != 0);
++ if (s->gzhead->hcrc && s->pending > beg)
++ strm->adler = crc32(strm->adler, s->pending_buf + beg,
++ s->pending - beg);
++ if (val == 0)
++ s->status = HCRC_STATE;
++ }
++ else
++ s->status = HCRC_STATE;
++ }
++ if (s->status == HCRC_STATE) {
++ if (s->gzhead->hcrc) {
++ if (s->pending + 2 > s->pending_buf_size)
++ flush_pending(strm);
++ if (s->pending + 2 <= s->pending_buf_size) {
++ put_byte(s, (Byte)(strm->adler & 0xff));
++ put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
++ strm->adler = crc32(0L, Z_NULL, 0);
++ s->status = BUSY_STATE;
++ }
++ }
++ else
++ s->status = BUSY_STATE;
++ }
++#endif
++
++ /* Flush as much pending output as possible */
++ if (s->pending != 0) {
++ flush_pending(strm);
++ if (strm->avail_out == 0) {
++ /* Since avail_out is 0, deflate will be called again with
++ * more output space, but possibly with both pending and
++ * avail_in equal to zero. There won't be anything to do,
++ * but this is not an error situation so make sure we
++ * return OK instead of BUF_ERROR at next call of deflate:
++ */
++ s->last_flush = -1;
++ return Z_OK;
++ }
++
++ /* Make sure there is something to do and avoid duplicate consecutive
++ * flushes. For repeated and useless calls with Z_FINISH, we keep
++ * returning Z_STREAM_END instead of Z_BUF_ERROR.
++ */
++ } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
++ flush != Z_FINISH) {
++ ERR_RETURN(strm, Z_BUF_ERROR);
++ }
++
++ /* User must not provide more input after the first FINISH: */
++ if (s->status == FINISH_STATE && strm->avail_in != 0) {
++ ERR_RETURN(strm, Z_BUF_ERROR);
++ }
++
++ /* Start a new block or continue the current one.
++ */
++ if (strm->avail_in != 0 || s->lookahead != 0 ||
++ (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
++ block_state bstate;
++
++ bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
++ (s->strategy == Z_RLE ? deflate_rle(s, flush) :
++ (*(configuration_table[s->level].func))(s, flush));
++
++ if (bstate == finish_started || bstate == finish_done) {
++ s->status = FINISH_STATE;
++ }
++ if (bstate == need_more || bstate == finish_started) {
++ if (strm->avail_out == 0) {
++ s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
++ }
++ return Z_OK;
++ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
++ * of deflate should use the same flush parameter to make sure
++ * that the flush is complete. So we don't have to output an
++ * empty block here, this will be done at next call. This also
++ * ensures that for a very small output buffer, we emit at most
++ * one empty block.
++ */
++ }
++ if (bstate == block_done) {
++ if (flush == Z_PARTIAL_FLUSH) {
++ _tr_align(s);
++ } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
++ _tr_stored_block(s, (char*)0, 0L, 0);
++ /* For a full flush, this empty block will be recognized
++ * as a special marker by inflate_sync().
++ */
++ if (flush == Z_FULL_FLUSH) {
++ CLEAR_HASH(s); /* forget history */
++ if (s->lookahead == 0) {
++ s->strstart = 0;
++ s->block_start = 0L;
++ s->insert = 0;
++ }
++ }
++ }
++ flush_pending(strm);
++ if (strm->avail_out == 0) {
++ s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
++ return Z_OK;
++ }
++ }
++ }
++ Assert(strm->avail_out > 0, "bug2");
++
++ if (flush != Z_FINISH) return Z_OK;
++ if (s->wrap <= 0) return Z_STREAM_END;
++
++ /* Write the trailer */
++#ifdef GZIP
++ if (s->wrap == 2) {
++ put_byte(s, (Byte)(strm->adler & 0xff));
++ put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
++ put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
++ put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
++ put_byte(s, (Byte)(strm->total_in & 0xff));
++ put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
++ put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
++ put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
++ }
++ else
++#endif
++ {
++ putShortMSB(s, (uInt)(strm->adler >> 16));
++ putShortMSB(s, (uInt)(strm->adler & 0xffff));
++ }
++ flush_pending(strm);
++ /* If avail_out is zero, the application will call deflate again
++ * to flush the rest.
++ */
++ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
++ return s->pending != 0 ? Z_OK : Z_STREAM_END;
++}
++
++/* ========================================================================= */
++int ZEXPORT deflateEnd (strm)
++ z_streamp strm;
++{
++ int status;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++
++ status = strm->state->status;
++ if (status != INIT_STATE &&
++ status != EXTRA_STATE &&
++ status != NAME_STATE &&
++ status != COMMENT_STATE &&
++ status != HCRC_STATE &&
++ status != BUSY_STATE &&
++ status != FINISH_STATE) {
++ return Z_STREAM_ERROR;
++ }
++
++ /* Deallocate in reverse order of allocations: */
++ TRY_FREE(strm, strm->state->pending_buf);
++ TRY_FREE(strm, strm->state->head);
++ TRY_FREE(strm, strm->state->prev);
++ TRY_FREE(strm, strm->state->window);
++
++ ZFREE(strm, strm->state);
++ strm->state = Z_NULL;
++
++ return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
++}
++
++/* =========================================================================
++ * Copy the source state to the destination state.
++ * To simplify the source, this is not supported for 16-bit MSDOS (which
++ * doesn't have enough memory anyway to duplicate compression states).
++ */
++int ZEXPORT deflateCopy (dest, source)
++ z_streamp dest;
++ z_streamp source;
++{
++#ifdef MAXSEG_64K
++ return Z_STREAM_ERROR;
++#else
++ deflate_state *ds;
++ deflate_state *ss;
++ ushf *overlay;
++
++
++ if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
++ return Z_STREAM_ERROR;
++ }
++
++ ss = source->state;
++
++ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
++
++ ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
++ if (ds == Z_NULL) return Z_MEM_ERROR;
++ dest->state = (struct internal_state FAR *) ds;
++ zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
++ ds->strm = dest;
++
++ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
++ ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
++ ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
++ overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
++ ds->pending_buf = (uchf *) overlay;
++
++ if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
++ ds->pending_buf == Z_NULL) {
++ deflateEnd (dest);
++ return Z_MEM_ERROR;
++ }
++ /* following zmemcpy do not work for 16-bit MSDOS */
++ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
++ zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
++ zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
++ zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
++
++ ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
++ ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
++ ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
++
++ ds->l_desc.dyn_tree = ds->dyn_ltree;
++ ds->d_desc.dyn_tree = ds->dyn_dtree;
++ ds->bl_desc.dyn_tree = ds->bl_tree;
++
++ return Z_OK;
++#endif /* MAXSEG_64K */
++}
++
++/* ===========================================================================
++ * Read a new buffer from the current input stream, update the adler32
++ * and total number of bytes read. All deflate() input goes through
++ * this function so some applications may wish to modify it to avoid
++ * allocating a large strm->next_in buffer and copying from it.
++ * (See also flush_pending()).
++ */
++local int read_buf(strm, buf, size)
++ z_streamp strm;
++ Bytef *buf;
++ unsigned size;
++{
++ unsigned len = strm->avail_in;
++
++ if (len > size) len = size;
++ if (len == 0) return 0;
++
++ strm->avail_in -= len;
++
++ zmemcpy(buf, strm->next_in, len);
++ if (strm->state->wrap == 1) {
++ strm->adler = adler32(strm->adler, buf, len);
++ }
++#ifdef GZIP
++ else if (strm->state->wrap == 2) {
++ strm->adler = crc32(strm->adler, buf, len);
++ }
++#endif
++ strm->next_in += len;
++ strm->total_in += len;
++
++ return (int)len;
++}
++
++/* ===========================================================================
++ * Initialize the "longest match" routines for a new zlib stream
++ */
++local void lm_init (s)
++ deflate_state *s;
++{
++ s->window_size = (ulg)2L*s->w_size;
++
++ CLEAR_HASH(s);
++
++ /* Set the default configuration parameters:
++ */
++ s->max_lazy_match = configuration_table[s->level].max_lazy;
++ s->good_match = configuration_table[s->level].good_length;
++ s->nice_match = configuration_table[s->level].nice_length;
++ s->max_chain_length = configuration_table[s->level].max_chain;
++
++ s->strstart = 0;
++ s->block_start = 0L;
++ s->lookahead = 0;
++ s->insert = 0;
++ s->match_length = s->prev_length = MIN_MATCH-1;
++ s->match_available = 0;
++ s->ins_h = 0;
++#ifndef FASTEST
++#ifdef ASMV
++ match_init(); /* initialize the asm code */
++#endif
++#endif
++}
++
++#ifndef FASTEST
++/* ===========================================================================
++ * Set match_start to the longest match starting at the given string and
++ * return its length. Matches shorter or equal to prev_length are discarded,
++ * in which case the result is equal to prev_length and match_start is
++ * garbage.
++ * IN assertions: cur_match is the head of the hash chain for the current
++ * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
++ * OUT assertion: the match length is not greater than s->lookahead.
++ */
++#ifndef ASMV
++/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
++ * match.S. The code will be functionally equivalent.
++ */
++local uInt longest_match(s, cur_match)
++ deflate_state *s;
++ IPos cur_match; /* current match */
++{
++ unsigned chain_length = s->max_chain_length;/* max hash chain length */
++ register Bytef *scan = s->window + s->strstart; /* current string */
++ register Bytef *match; /* matched string */
++ register int len; /* length of current match */
++ int best_len = s->prev_length; /* best match length so far */
++ int nice_match = s->nice_match; /* stop if match long enough */
++ IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
++ s->strstart - (IPos)MAX_DIST(s) : NIL;
++ /* Stop when cur_match becomes <= limit. To simplify the code,
++ * we prevent matches with the string of window index 0.
++ */
++ Posf *prev = s->prev;
++ uInt wmask = s->w_mask;
++
++#ifdef UNALIGNED_OK
++ /* Compare two bytes at a time. Note: this is not always beneficial.
++ * Try with and without -DUNALIGNED_OK to check.
++ */
++ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
++ register ush scan_start = *(ushf*)scan;
++ register ush scan_end = *(ushf*)(scan+best_len-1);
++#else
++ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
++ register Byte scan_end1 = scan[best_len-1];
++ register Byte scan_end = scan[best_len];
++#endif
++
++ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
++ * It is easy to get rid of this optimization if necessary.
++ */
++ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
++
++ /* Do not waste too much time if we already have a good match: */
++ if (s->prev_length >= s->good_match) {
++ chain_length >>= 2;
++ }
++ /* Do not look for matches beyond the end of the input. This is necessary
++ * to make deflate deterministic.
++ */
++ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
++
++ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
++
++ do {
++ Assert(cur_match < s->strstart, "no future");
++ match = s->window + cur_match;
++
++ /* Skip to next match if the match length cannot increase
++ * or if the match length is less than 2. Note that the checks below
++ * for insufficient lookahead only occur occasionally for performance
++ * reasons. Therefore uninitialized memory will be accessed, and
++ * conditional jumps will be made that depend on those values.
++ * However the length of the match is limited to the lookahead, so
++ * the output of deflate is not affected by the uninitialized values.
++ */
++#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
++ /* This code assumes sizeof(unsigned short) == 2. Do not use
++ * UNALIGNED_OK if your compiler uses a different size.
++ */
++ if (*(ushf*)(match+best_len-1) != scan_end ||
++ *(ushf*)match != scan_start) continue;
++
++ /* It is not necessary to compare scan[2] and match[2] since they are
++ * always equal when the other bytes match, given that the hash keys
++ * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
++ * strstart+3, +5, ... up to strstart+257. We check for insufficient
++ * lookahead only every 4th comparison; the 128th check will be made
++ * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
++ * necessary to put more guard bytes at the end of the window, or
++ * to check more often for insufficient lookahead.
++ */
++ Assert(scan[2] == match[2], "scan[2]?");
++ scan++, match++;
++ do {
++ } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
++ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
++ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
++ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
++ scan < strend);
++ /* The funny "do {}" generates better code on most compilers */
++
++ /* Here, scan <= window+strstart+257 */
++ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
++ if (*scan == *match) scan++;
++
++ len = (MAX_MATCH - 1) - (int)(strend-scan);
++ scan = strend - (MAX_MATCH-1);
++
++#else /* UNALIGNED_OK */
++
++ if (match[best_len] != scan_end ||
++ match[best_len-1] != scan_end1 ||
++ *match != *scan ||
++ *++match != scan[1]) continue;
++
++ /* The check at best_len-1 can be removed because it will be made
++ * again later. (This heuristic is not always a win.)
++ * It is not necessary to compare scan[2] and match[2] since they
++ * are always equal when the other bytes match, given that
++ * the hash keys are equal and that HASH_BITS >= 8.
++ */
++ scan += 2, match++;
++ Assert(*scan == *match, "match[2]?");
++
++ /* We check for insufficient lookahead only every 8th comparison;
++ * the 256th check will be made at strstart+258.
++ */
++ do {
++ } while (*++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ scan < strend);
++
++ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
++
++ len = MAX_MATCH - (int)(strend - scan);
++ scan = strend - MAX_MATCH;
++
++#endif /* UNALIGNED_OK */
++
++ if (len > best_len) {
++ s->match_start = cur_match;
++ best_len = len;
++ if (len >= nice_match) break;
++#ifdef UNALIGNED_OK
++ scan_end = *(ushf*)(scan+best_len-1);
++#else
++ scan_end1 = scan[best_len-1];
++ scan_end = scan[best_len];
++#endif
++ }
++ } while ((cur_match = prev[cur_match & wmask]) > limit
++ && --chain_length != 0);
++
++ if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
++ return s->lookahead;
++}
++#endif /* ASMV */
++
++#else /* FASTEST */
++
++/* ---------------------------------------------------------------------------
++ * Optimized version for FASTEST only
++ */
++local uInt longest_match(s, cur_match)
++ deflate_state *s;
++ IPos cur_match; /* current match */
++{
++ register Bytef *scan = s->window + s->strstart; /* current string */
++ register Bytef *match; /* matched string */
++ register int len; /* length of current match */
++ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
++
++ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
++ * It is easy to get rid of this optimization if necessary.
++ */
++ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
++
++ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
++
++ Assert(cur_match < s->strstart, "no future");
++
++ match = s->window + cur_match;
++
++ /* Return failure if the match length is less than 2:
++ */
++ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
++
++ /* The check at best_len-1 can be removed because it will be made
++ * again later. (This heuristic is not always a win.)
++ * It is not necessary to compare scan[2] and match[2] since they
++ * are always equal when the other bytes match, given that
++ * the hash keys are equal and that HASH_BITS >= 8.
++ */
++ scan += 2, match += 2;
++ Assert(*scan == *match, "match[2]?");
++
++ /* We check for insufficient lookahead only every 8th comparison;
++ * the 256th check will be made at strstart+258.
++ */
++ do {
++ } while (*++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ *++scan == *++match && *++scan == *++match &&
++ scan < strend);
++
++ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
++
++ len = MAX_MATCH - (int)(strend - scan);
++
++ if (len < MIN_MATCH) return MIN_MATCH - 1;
++
++ s->match_start = cur_match;
++ return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
++}
++
++#endif /* FASTEST */
++
++#ifdef DEBUG
++/* ===========================================================================
++ * Check that the match at match_start is indeed a match.
++ */
++local void check_match(s, start, match, length)
++ deflate_state *s;
++ IPos start, match;
++ int length;
++{
++ /* check that the match is indeed a match */
++ if (zmemcmp(s->window + match,
++ s->window + start, length) != EQUAL) {
++ fprintf(stderr, " start %u, match %u, length %d\n",
++ start, match, length);
++ do {
++ fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
++ } while (--length != 0);
++ z_error("invalid match");
++ }
++ if (z_verbose > 1) {
++ fprintf(stderr,"\\[%d,%d]", start-match, length);
++ do { putc(s->window[start++], stderr); } while (--length != 0);
++ }
++}
++#else
++# define check_match(s, start, match, length)
++#endif /* DEBUG */
++
++/* ===========================================================================
++ * Fill the window when the lookahead becomes insufficient.
++ * Updates strstart and lookahead.
++ *
++ * IN assertion: lookahead < MIN_LOOKAHEAD
++ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
++ * At least one byte has been read, or avail_in == 0; reads are
++ * performed for at least two bytes (required for the zip translate_eol
++ * option -- not supported here).
++ */
++local void fill_window(s)
++ deflate_state *s;
++{
++ register unsigned n, m;
++ register Posf *p;
++ unsigned more; /* Amount of free space at the end of the window. */
++ uInt wsize = s->w_size;
++
++ Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
++
++ do {
++ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
++
++ /* Deal with !@#$% 64K limit: */
++ if (sizeof(int) <= 2) {
++ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
++ more = wsize;
++
++ } else if (more == (unsigned)(-1)) {
++ /* Very unlikely, but possible on 16 bit machine if
++ * strstart == 0 && lookahead == 1 (input done a byte at time)
++ */
++ more--;
++ }
++ }
++
++ /* If the window is almost full and there is insufficient lookahead,
++ * move the upper half to the lower one to make room in the upper half.
++ */
++ if (s->strstart >= wsize+MAX_DIST(s)) {
++
++ zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
++ s->match_start -= wsize;
++ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
++ s->block_start -= (long) wsize;
++
++ /* Slide the hash table (could be avoided with 32 bit values
++ at the expense of memory usage). We slide even when level == 0
++ to keep the hash table consistent if we switch back to level > 0
++ later. (Using level 0 permanently is not an optimal usage of
++ zlib, so we don't care about this pathological case.)
++ */
++ n = s->hash_size;
++ p = &s->head[n];
++ do {
++ m = *--p;
++ *p = (Pos)(m >= wsize ? m-wsize : NIL);
++ } while (--n);
++
++ n = wsize;
++#ifndef FASTEST
++ p = &s->prev[n];
++ do {
++ m = *--p;
++ *p = (Pos)(m >= wsize ? m-wsize : NIL);
++ /* If n is not on any hash chain, prev[n] is garbage but
++ * its value will never be used.
++ */
++ } while (--n);
++#endif
++ more += wsize;
++ }
++ if (s->strm->avail_in == 0) break;
++
++ /* If there was no sliding:
++ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
++ * more == window_size - lookahead - strstart
++ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
++ * => more >= window_size - 2*WSIZE + 2
++ * In the BIG_MEM or MMAP case (not yet supported),
++ * window_size == input_size + MIN_LOOKAHEAD &&
++ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
++ * Otherwise, window_size == 2*WSIZE so more >= 2.
++ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
++ */
++ Assert(more >= 2, "more < 2");
++
++ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
++ s->lookahead += n;
++
++ /* Initialize the hash value now that we have some input: */
++ if (s->lookahead + s->insert >= MIN_MATCH) {
++ uInt str = s->strstart - s->insert;
++ s->ins_h = s->window[str];
++ UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
++#if MIN_MATCH != 3
++ Call UPDATE_HASH() MIN_MATCH-3 more times
++#endif
++ while (s->insert) {
++ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
++#ifndef FASTEST
++ s->prev[str & s->w_mask] = s->head[s->ins_h];
++#endif
++ s->head[s->ins_h] = (Pos)str;
++ str++;
++ s->insert--;
++ if (s->lookahead + s->insert < MIN_MATCH)
++ break;
++ }
++ }
++ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
++ * but this is not important since only literal bytes will be emitted.
++ */
++
++ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
++
++ /* If the WIN_INIT bytes after the end of the current data have never been
++ * written, then zero those bytes in order to avoid memory check reports of
++ * the use of uninitialized (or uninitialised as Julian writes) bytes by
++ * the longest match routines. Update the high water mark for the next
++ * time through here. WIN_INIT is set to MAX_MATCH since the longest match
++ * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
++ */
++ if (s->high_water < s->window_size) {
++ ulg curr = s->strstart + (ulg)(s->lookahead);
++ ulg init;
++
++ if (s->high_water < curr) {
++ /* Previous high water mark below current data -- zero WIN_INIT
++ * bytes or up to end of window, whichever is less.
++ */
++ init = s->window_size - curr;
++ if (init > WIN_INIT)
++ init = WIN_INIT;
++ zmemzero(s->window + curr, (unsigned)init);
++ s->high_water = curr + init;
++ }
++ else if (s->high_water < (ulg)curr + WIN_INIT) {
++ /* High water mark at or above current data, but below current data
++ * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
++ * to end of window, whichever is less.
++ */
++ init = (ulg)curr + WIN_INIT - s->high_water;
++ if (init > s->window_size - s->high_water)
++ init = s->window_size - s->high_water;
++ zmemzero(s->window + s->high_water, (unsigned)init);
++ s->high_water += init;
++ }
++ }
++
++ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
++ "not enough room for search");
++}
++
++/* ===========================================================================
++ * Flush the current block, with given end-of-file flag.
++ * IN assertion: strstart is set to the end of the current match.
++ */
++#define FLUSH_BLOCK_ONLY(s, last) { \
++ _tr_flush_block(s, (s->block_start >= 0L ? \
++ (charf *)&s->window[(unsigned)s->block_start] : \
++ (charf *)Z_NULL), \
++ (ulg)((long)s->strstart - s->block_start), \
++ (last)); \
++ s->block_start = s->strstart; \
++ flush_pending(s->strm); \
++ Tracev((stderr,"[FLUSH]")); \
++}
++
++/* Same but force premature exit if necessary. */
++#define FLUSH_BLOCK(s, last) { \
++ FLUSH_BLOCK_ONLY(s, last); \
++ if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
++}
++
++/* ===========================================================================
++ * Copy without compression as much as possible from the input stream, return
++ * the current block state.
++ * This function does not insert new strings in the dictionary since
++ * uncompressible data is probably not useful. This function is used
++ * only for the level=0 compression option.
++ * NOTE: this function should be optimized to avoid extra copying from
++ * window to pending_buf.
++ */
++local block_state deflate_stored(s, flush)
++ deflate_state *s;
++ int flush;
++{
++ /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
++ * to pending_buf_size, and each stored block has a 5 byte header:
++ */
++ ulg max_block_size = 0xffff;
++ ulg max_start;
++
++ if (max_block_size > s->pending_buf_size - 5) {
++ max_block_size = s->pending_buf_size - 5;
++ }
++
++ /* Copy as much as possible from input to output: */
++ for (;;) {
++ /* Fill the window as much as possible: */
++ if (s->lookahead <= 1) {
++
++ Assert(s->strstart < s->w_size+MAX_DIST(s) ||
++ s->block_start >= (long)s->w_size, "slide too late");
++
++ fill_window(s);
++ if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
++
++ if (s->lookahead == 0) break; /* flush the current block */
++ }
++ Assert(s->block_start >= 0L, "block gone");
++
++ s->strstart += s->lookahead;
++ s->lookahead = 0;
++
++ /* Emit a stored block if pending_buf will be full: */
++ max_start = s->block_start + max_block_size;
++ if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
++ /* strstart == 0 is possible when wraparound on 16-bit machine */
++ s->lookahead = (uInt)(s->strstart - max_start);
++ s->strstart = (uInt)max_start;
++ FLUSH_BLOCK(s, 0);
++ }
++ /* Flush if we may have to slide, otherwise block_start may become
++ * negative and the data will be gone:
++ */
++ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
++ FLUSH_BLOCK(s, 0);
++ }
++ }
++ s->insert = 0;
++ if (flush == Z_FINISH) {
++ FLUSH_BLOCK(s, 1);
++ return finish_done;
++ }
++ if ((long)s->strstart > s->block_start)
++ FLUSH_BLOCK(s, 0);
++ return block_done;
++}
++
++/* ===========================================================================
++ * Compress as much as possible from the input stream, return the current
++ * block state.
++ * This function does not perform lazy evaluation of matches and inserts
++ * new strings in the dictionary only for unmatched strings or for short
++ * matches. It is used only for the fast compression options.
++ */
++local block_state deflate_fast(s, flush)
++ deflate_state *s;
++ int flush;
++{
++ IPos hash_head; /* head of the hash chain */
++ int bflush; /* set if current block must be flushed */
++
++ for (;;) {
++ /* Make sure that we always have enough lookahead, except
++ * at the end of the input file. We need MAX_MATCH bytes
++ * for the next match, plus MIN_MATCH bytes to insert the
++ * string following the next match.
++ */
++ if (s->lookahead < MIN_LOOKAHEAD) {
++ fill_window(s);
++ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
++ return need_more;
++ }
++ if (s->lookahead == 0) break; /* flush the current block */
++ }
++
++ /* Insert the string window[strstart .. strstart+2] in the
++ * dictionary, and set hash_head to the head of the hash chain:
++ */
++ hash_head = NIL;
++ if (s->lookahead >= MIN_MATCH) {
++ INSERT_STRING(s, s->strstart, hash_head);
++ }
++
++ /* Find the longest match, discarding those <= prev_length.
++ * At this point we have always match_length < MIN_MATCH
++ */
++ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
++ /* To simplify the code, we prevent matches with the string
++ * of window index 0 (in particular we have to avoid a match
++ * of the string with itself at the start of the input file).
++ */
++ s->match_length = longest_match (s, hash_head);
++ /* longest_match() sets match_start */
++ }
++ if (s->match_length >= MIN_MATCH) {
++ check_match(s, s->strstart, s->match_start, s->match_length);
++
++ _tr_tally_dist(s, s->strstart - s->match_start,
++ s->match_length - MIN_MATCH, bflush);
++
++ s->lookahead -= s->match_length;
++
++ /* Insert new strings in the hash table only if the match length
++ * is not too large. This saves time but degrades compression.
++ */
++#ifndef FASTEST
++ if (s->match_length <= s->max_insert_length &&
++ s->lookahead >= MIN_MATCH) {
++ s->match_length--; /* string at strstart already in table */
++ do {
++ s->strstart++;
++ INSERT_STRING(s, s->strstart, hash_head);
++ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
++ * always MIN_MATCH bytes ahead.
++ */
++ } while (--s->match_length != 0);
++ s->strstart++;
++ } else
++#endif
++ {
++ s->strstart += s->match_length;
++ s->match_length = 0;
++ s->ins_h = s->window[s->strstart];
++ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
++#if MIN_MATCH != 3
++ Call UPDATE_HASH() MIN_MATCH-3 more times
++#endif
++ /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
++ * matter since it will be recomputed at next deflate call.
++ */
++ }
++ } else {
++ /* No match, output a literal byte */
++ Tracevv((stderr,"%c", s->window[s->strstart]));
++ _tr_tally_lit (s, s->window[s->strstart], bflush);
++ s->lookahead--;
++ s->strstart++;
++ }
++ if (bflush) FLUSH_BLOCK(s, 0);
++ }
++ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
++ if (flush == Z_FINISH) {
++ FLUSH_BLOCK(s, 1);
++ return finish_done;
++ }
++ if (s->last_lit)
++ FLUSH_BLOCK(s, 0);
++ return block_done;
++}
++
++#ifndef FASTEST
++/* ===========================================================================
++ * Same as above, but achieves better compression. We use a lazy
++ * evaluation for matches: a match is finally adopted only if there is
++ * no better match at the next window position.
++ */
++local block_state deflate_slow(s, flush)
++ deflate_state *s;
++ int flush;
++{
++ IPos hash_head; /* head of hash chain */
++ int bflush; /* set if current block must be flushed */
++
++ /* Process the input block. */
++ for (;;) {
++ /* Make sure that we always have enough lookahead, except
++ * at the end of the input file. We need MAX_MATCH bytes
++ * for the next match, plus MIN_MATCH bytes to insert the
++ * string following the next match.
++ */
++ if (s->lookahead < MIN_LOOKAHEAD) {
++ fill_window(s);
++ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
++ return need_more;
++ }
++ if (s->lookahead == 0) break; /* flush the current block */
++ }
++
++ /* Insert the string window[strstart .. strstart+2] in the
++ * dictionary, and set hash_head to the head of the hash chain:
++ */
++ hash_head = NIL;
++ if (s->lookahead >= MIN_MATCH) {
++ INSERT_STRING(s, s->strstart, hash_head);
++ }
++
++ /* Find the longest match, discarding those <= prev_length.
++ */
++ s->prev_length = s->match_length, s->prev_match = s->match_start;
++ s->match_length = MIN_MATCH-1;
++
++ if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
++ s->strstart - hash_head <= MAX_DIST(s)) {
++ /* To simplify the code, we prevent matches with the string
++ * of window index 0 (in particular we have to avoid a match
++ * of the string with itself at the start of the input file).
++ */
++ s->match_length = longest_match (s, hash_head);
++ /* longest_match() sets match_start */
++
++ if (s->match_length <= 5 && (s->strategy == Z_FILTERED
++#if TOO_FAR <= 32767
++ || (s->match_length == MIN_MATCH &&
++ s->strstart - s->match_start > TOO_FAR)
++#endif
++ )) {
++
++ /* If prev_match is also MIN_MATCH, match_start is garbage
++ * but we will ignore the current match anyway.
++ */
++ s->match_length = MIN_MATCH-1;
++ }
++ }
++ /* If there was a match at the previous step and the current
++ * match is not better, output the previous match:
++ */
++ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
++ uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
++ /* Do not insert strings in hash table beyond this. */
++
++ check_match(s, s->strstart-1, s->prev_match, s->prev_length);
++
++ _tr_tally_dist(s, s->strstart -1 - s->prev_match,
++ s->prev_length - MIN_MATCH, bflush);
++
++ /* Insert in hash table all strings up to the end of the match.
++ * strstart-1 and strstart are already inserted. If there is not
++ * enough lookahead, the last two strings are not inserted in
++ * the hash table.
++ */
++ s->lookahead -= s->prev_length-1;
++ s->prev_length -= 2;
++ do {
++ if (++s->strstart <= max_insert) {
++ INSERT_STRING(s, s->strstart, hash_head);
++ }
++ } while (--s->prev_length != 0);
++ s->match_available = 0;
++ s->match_length = MIN_MATCH-1;
++ s->strstart++;
++
++ if (bflush) FLUSH_BLOCK(s, 0);
++
++ } else if (s->match_available) {
++ /* If there was no match at the previous position, output a
++ * single literal. If there was a match but the current match
++ * is longer, truncate the previous match to a single literal.
++ */
++ Tracevv((stderr,"%c", s->window[s->strstart-1]));
++ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
++ if (bflush) {
++ FLUSH_BLOCK_ONLY(s, 0);
++ }
++ s->strstart++;
++ s->lookahead--;
++ if (s->strm->avail_out == 0) return need_more;
++ } else {
++ /* There is no previous match to compare with, wait for
++ * the next step to decide.
++ */
++ s->match_available = 1;
++ s->strstart++;
++ s->lookahead--;
++ }
++ }
++ Assert (flush != Z_NO_FLUSH, "no flush?");
++ if (s->match_available) {
++ Tracevv((stderr,"%c", s->window[s->strstart-1]));
++ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
++ s->match_available = 0;
++ }
++ s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
++ if (flush == Z_FINISH) {
++ FLUSH_BLOCK(s, 1);
++ return finish_done;
++ }
++ if (s->last_lit)
++ FLUSH_BLOCK(s, 0);
++ return block_done;
++}
++#endif /* FASTEST */
++
++/* ===========================================================================
++ * For Z_RLE, simply look for runs of bytes, generate matches only of distance
++ * one. Do not maintain a hash table. (It will be regenerated if this run of
++ * deflate switches away from Z_RLE.)
++ */
++local block_state deflate_rle(s, flush)
++ deflate_state *s;
++ int flush;
++{
++ int bflush; /* set if current block must be flushed */
++ uInt prev; /* byte at distance one to match */
++ Bytef *scan, *strend; /* scan goes up to strend for length of run */
++
++ for (;;) {
++ /* Make sure that we always have enough lookahead, except
++ * at the end of the input file. We need MAX_MATCH bytes
++ * for the longest run, plus one for the unrolled loop.
++ */
++ if (s->lookahead <= MAX_MATCH) {
++ fill_window(s);
++ if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
++ return need_more;
++ }
++ if (s->lookahead == 0) break; /* flush the current block */
++ }
++
++ /* See how many times the previous byte repeats */
++ s->match_length = 0;
++ if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
++ scan = s->window + s->strstart - 1;
++ prev = *scan;
++ if (prev == *++scan && prev == *++scan && prev == *++scan) {
++ strend = s->window + s->strstart + MAX_MATCH;
++ do {
++ } while (prev == *++scan && prev == *++scan &&
++ prev == *++scan && prev == *++scan &&
++ prev == *++scan && prev == *++scan &&
++ prev == *++scan && prev == *++scan &&
++ scan < strend);
++ s->match_length = MAX_MATCH - (int)(strend - scan);
++ if (s->match_length > s->lookahead)
++ s->match_length = s->lookahead;
++ }
++ Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
++ }
++
++ /* Emit match if have run of MIN_MATCH or longer, else emit literal */
++ if (s->match_length >= MIN_MATCH) {
++ check_match(s, s->strstart, s->strstart - 1, s->match_length);
++
++ _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
++
++ s->lookahead -= s->match_length;
++ s->strstart += s->match_length;
++ s->match_length = 0;
++ } else {
++ /* No match, output a literal byte */
++ Tracevv((stderr,"%c", s->window[s->strstart]));
++ _tr_tally_lit (s, s->window[s->strstart], bflush);
++ s->lookahead--;
++ s->strstart++;
++ }
++ if (bflush) FLUSH_BLOCK(s, 0);
++ }
++ s->insert = 0;
++ if (flush == Z_FINISH) {
++ FLUSH_BLOCK(s, 1);
++ return finish_done;
++ }
++ if (s->last_lit)
++ FLUSH_BLOCK(s, 0);
++ return block_done;
++}
++
++/* ===========================================================================
++ * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
++ * (It will be regenerated if this run of deflate switches away from Huffman.)
++ */
++local block_state deflate_huff(s, flush)
++ deflate_state *s;
++ int flush;
++{
++ int bflush; /* set if current block must be flushed */
++
++ for (;;) {
++ /* Make sure that we have a literal to write. */
++ if (s->lookahead == 0) {
++ fill_window(s);
++ if (s->lookahead == 0) {
++ if (flush == Z_NO_FLUSH)
++ return need_more;
++ break; /* flush the current block */
++ }
++ }
++
++ /* Output a literal byte */
++ s->match_length = 0;
++ Tracevv((stderr,"%c", s->window[s->strstart]));
++ _tr_tally_lit (s, s->window[s->strstart], bflush);
++ s->lookahead--;
++ s->strstart++;
++ if (bflush) FLUSH_BLOCK(s, 0);
++ }
++ s->insert = 0;
++ if (flush == Z_FINISH) {
++ FLUSH_BLOCK(s, 1);
++ return finish_done;
++ }
++ if (s->last_lit)
++ FLUSH_BLOCK(s, 0);
++ return block_done;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/deflate.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,370 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* deflate.h -- internal compression state
++ * Copyright (C) 1995-2012 Jean-loup Gailly
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* WARNING: this file should *not* be used by applications. It is
++ part of the implementation of the compression library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++/* @(#) $Id$ */
++
++#ifndef DEFLATE_H
++#define DEFLATE_H
++
++#include "zutil.h"
++
++/* define NO_GZIP when compiling if you want to disable gzip header and
++ trailer creation by deflate(). NO_GZIP would be used to avoid linking in
++ the crc code when it is not needed. For shared libraries, gzip encoding
++ should be left enabled. */
++#ifndef NO_GZIP
++# define GZIP
++#endif
++
++/* ===========================================================================
++ * Internal compression state.
++ */
++
++#define LENGTH_CODES 29
++/* number of length codes, not counting the special END_BLOCK code */
++
++#define LITERALS 256
++/* number of literal bytes 0..255 */
++
++#define L_CODES (LITERALS+1+LENGTH_CODES)
++/* number of Literal or Length codes, including the END_BLOCK code */
++
++#define D_CODES 30
++/* number of distance codes */
++
++#define BL_CODES 19
++/* number of codes used to transfer the bit lengths */
++
++#define HEAP_SIZE (2*L_CODES+1)
++/* maximum heap size */
++
++#define MAX_BITS 15
++/* All codes must not exceed MAX_BITS bits */
++
++#define Buf_size 16
++/* size of bit buffer in bi_buf */
++
++#define INIT_STATE 42
++#define EXTRA_STATE 69
++#define NAME_STATE 73
++#define COMMENT_STATE 91
++#define HCRC_STATE 103
++#define BUSY_STATE 113
++#define FINISH_STATE 666
++/* Stream status */
++
++
++/* Data structure describing a single value and its code string. */
++typedef struct ct_data_s {
++ union {
++ ush freq; /* frequency count */
++ ush code; /* bit string */
++ } fc;
++ union {
++ ush dad; /* father node in Huffman tree */
++ ush len; /* length of bit string */
++ } dl;
++} FAR ct_data;
++
++#define Freq fc.freq
++#define Code fc.code
++#define Dad dl.dad
++#define Len dl.len
++
++typedef struct static_tree_desc_s static_tree_desc;
++
++typedef struct tree_desc_s {
++ ct_data *dyn_tree; /* the dynamic tree */
++ int max_code; /* largest code with non zero frequency */
++ static_tree_desc *stat_desc; /* the corresponding static tree */
++} FAR tree_desc;
++
++typedef ush Pos;
++typedef Pos FAR Posf;
++typedef unsigned IPos;
++
++/* A Pos is an index in the character window. We use short instead of int to
++ * save space in the various tables. IPos is used only for parameter passing.
++ */
++
++typedef struct internal_state {
++ z_streamp strm; /* pointer back to this zlib stream */
++ int status; /* as the name implies */
++ Bytef *pending_buf; /* output still pending */
++ ulg pending_buf_size; /* size of pending_buf */
++ Bytef *pending_out; /* next pending byte to output to the stream */
++ uInt pending; /* nb of bytes in the pending buffer */
++ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
++ gz_headerp gzhead; /* gzip header information to write */
++ uInt gzindex; /* where in extra, name, or comment */
++ Byte method; /* can only be DEFLATED */
++ int last_flush; /* value of flush param for previous deflate call */
++
++ /* used by deflate.c: */
++
++ uInt w_size; /* LZ77 window size (32K by default) */
++ uInt w_bits; /* log2(w_size) (8..16) */
++ uInt w_mask; /* w_size - 1 */
++
++ Bytef *window;
++ /* Sliding window. Input bytes are read into the second half of the window,
++ * and move to the first half later to keep a dictionary of at least wSize
++ * bytes. With this organization, matches are limited to a distance of
++ * wSize-MAX_MATCH bytes, but this ensures that IO is always
++ * performed with a length multiple of the block size. Also, it limits
++ * the window size to 64K, which is quite useful on MSDOS.
++ * To do: use the user input buffer as sliding window.
++ */
++
++ ulg window_size;
++ /* Actual size of window: 2*wSize, except when the user input buffer
++ * is directly used as sliding window.
++ */
++
++ Posf *prev;
++ /* Link to older string with same hash index. To limit the size of this
++ * array to 64K, this link is maintained only for the last 32K strings.
++ * An index in this array is thus a window index modulo 32K.
++ */
++
++ Posf *head; /* Heads of the hash chains or NIL. */
++
++ uInt ins_h; /* hash index of string to be inserted */
++ uInt hash_size; /* number of elements in hash table */
++ uInt hash_bits; /* log2(hash_size) */
++ uInt hash_mask; /* hash_size-1 */
++
++ uInt hash_shift;
++ /* Number of bits by which ins_h must be shifted at each input
++ * step. It must be such that after MIN_MATCH steps, the oldest
++ * byte no longer takes part in the hash key, that is:
++ * hash_shift * MIN_MATCH >= hash_bits
++ */
++
++ long block_start;
++ /* Window position at the beginning of the current output block. Gets
++ * negative when the window is moved backwards.
++ */
++
++ uInt match_length; /* length of best match */
++ IPos prev_match; /* previous match */
++ int match_available; /* set if previous match exists */
++ uInt strstart; /* start of string to insert */
++ uInt match_start; /* start of matching string */
++ uInt lookahead; /* number of valid bytes ahead in window */
++
++ uInt prev_length;
++ /* Length of the best match at previous step. Matches not greater than this
++ * are discarded. This is used in the lazy match evaluation.
++ */
++
++ uInt max_chain_length;
++ /* To speed up deflation, hash chains are never searched beyond this
++ * length. A higher limit improves compression ratio but degrades the
++ * speed.
++ */
++
++ uInt max_lazy_match;
++ /* Attempt to find a better match only when the current match is strictly
++ * smaller than this value. This mechanism is used only for compression
++ * levels >= 4.
++ */
++# define max_insert_length max_lazy_match
++ /* Insert new strings in the hash table only if the match length is not
++ * greater than this length. This saves time but degrades compression.
++ * max_insert_length is used only for compression levels <= 3.
++ */
++
++ int level; /* compression level (1..9) */
++ int strategy; /* favor or force Huffman coding*/
++
++ uInt good_match;
++ /* Use a faster search when the previous match is longer than this */
++
++ int nice_match; /* Stop searching when current match exceeds this */
++
++ /* used by trees.c: */
++ /* Didn't use ct_data typedef below to suppress compiler warning */
++ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
++ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
++ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
++
++ struct tree_desc_s l_desc; /* desc. for literal tree */
++ struct tree_desc_s d_desc; /* desc. for distance tree */
++ struct tree_desc_s bl_desc; /* desc. for bit length tree */
++
++ ush bl_count[MAX_BITS+1];
++ /* number of codes at each bit length for an optimal tree */
++
++ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
++ int heap_len; /* number of elements in the heap */
++ int heap_max; /* element of largest frequency */
++ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
++ * The same heap array is used to build all trees.
++ */
++
++ uch depth[2*L_CODES+1];
++ /* Depth of each subtree used as tie breaker for trees of equal frequency
++ */
++
++ uchf *l_buf; /* buffer for literals or lengths */
++
++ uInt lit_bufsize;
++ /* Size of match buffer for literals/lengths. There are 4 reasons for
++ * limiting lit_bufsize to 64K:
++ * - frequencies can be kept in 16 bit counters
++ * - if compression is not successful for the first block, all input
++ * data is still in the window so we can still emit a stored block even
++ * when input comes from standard input. (This can also be done for
++ * all blocks if lit_bufsize is not greater than 32K.)
++ * - if compression is not successful for a file smaller than 64K, we can
++ * even emit a stored file instead of a stored block (saving 5 bytes).
++ * This is applicable only for zip (not gzip or zlib).
++ * - creating new Huffman trees less frequently may not provide fast
++ * adaptation to changes in the input data statistics. (Take for
++ * example a binary file with poorly compressible code followed by
++ * a highly compressible string table.) Smaller buffer sizes give
++ * fast adaptation but have of course the overhead of transmitting
++ * trees more frequently.
++ * - I can't count above 4
++ */
++
++ uInt last_lit; /* running index in l_buf */
++
++ ushf *d_buf;
++ /* Buffer for distances. To simplify the code, d_buf and l_buf have
++ * the same number of elements. To use different lengths, an extra flag
++ * array would be necessary.
++ */
++
++ ulg opt_len; /* bit length of current block with optimal trees */
++ ulg static_len; /* bit length of current block with static trees */
++ uInt matches; /* number of string matches in current block */
++ uInt insert; /* bytes at end of window left to insert */
++
++#ifdef DEBUG
++ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
++ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
++#endif
++
++ ush bi_buf;
++ /* Output buffer. bits are inserted starting at the bottom (least
++ * significant bits).
++ */
++ int bi_valid;
++ /* Number of valid bits in bi_buf. All bits above the last valid bit
++ * are always zero.
++ */
++
++ ulg high_water;
++ /* High water mark offset in window for initialized bytes -- bytes above
++ * this are set to zero in order to avoid memory check warnings when
++ * longest match routines access bytes past the input. This is then
++ * updated to the new high water mark.
++ */
++
++} FAR deflate_state;
++
++/* Output a byte on the stream.
++ * IN assertion: there is enough room in pending_buf.
++ */
++#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
++
++
++#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
++/* Minimum amount of lookahead, except at the end of the input file.
++ * See deflate.c for comments about the MIN_MATCH+1.
++ */
++
++#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
++/* In order to simplify the code, particularly on 16 bit machines, match
++ * distances are limited to MAX_DIST instead of WSIZE.
++ */
++
++#define WIN_INIT MAX_MATCH
++/* Number of bytes after end of data in window to initialize in order to avoid
++ memory checker errors from longest match routines */
++
++ /* in trees.c */
++void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
++int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
++void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
++ ulg stored_len, int last));
++void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
++void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
++void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
++ ulg stored_len, int last));
++
++#define d_code(dist) \
++ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
++/* Mapping from a distance to a distance code. dist is the distance - 1 and
++ * must not have side effects. _dist_code[256] and _dist_code[257] are never
++ * used.
++ */
++
++#ifndef DEBUG
++/* Inline versions of _tr_tally for speed: */
++
++#if defined(GEN_TREES_H) || !defined(STDC)
++ extern uch ZLIB_INTERNAL _length_code[];
++ extern uch ZLIB_INTERNAL _dist_code[];
++#else
++ extern const uch ZLIB_INTERNAL _length_code[];
++ extern const uch ZLIB_INTERNAL _dist_code[];
++#endif
++
++# define _tr_tally_lit(s, c, flush) \
++ { uch cc = (c); \
++ s->d_buf[s->last_lit] = 0; \
++ s->l_buf[s->last_lit++] = cc; \
++ s->dyn_ltree[cc].Freq++; \
++ flush = (s->last_lit == s->lit_bufsize-1); \
++ }
++# define _tr_tally_dist(s, distance, length, flush) \
++ { uch len = (length); \
++ ush dist = (distance); \
++ s->d_buf[s->last_lit] = dist; \
++ s->l_buf[s->last_lit++] = len; \
++ dist--; \
++ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
++ s->dyn_dtree[d_code(dist)].Freq++; \
++ flush = (s->last_lit == s->lit_bufsize-1); \
++ }
++#else
++# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
++# define _tr_tally_dist(s, distance, length, flush) \
++ flush = _tr_tally(s, distance, length)
++#endif
++
++#endif /* DEFLATE_H */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/gzclose.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,49 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* gzclose.c -- zlib gzclose() function
++ * Copyright (C) 2004, 2010 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "gzguts.h"
++
++/* gzclose() is in a separate file so that it is linked in only if it is used.
++ That way the other gzclose functions can be used instead to avoid linking in
++ unneeded compression or decompression routines. */
++int ZEXPORT gzclose(file)
++ gzFile file;
++{
++#ifndef NO_GZCOMPRESS
++ gz_statep state;
++
++ if (file == NULL)
++ return Z_STREAM_ERROR;
++ state = (gz_statep)file;
++
++ return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
++#else
++ return gzclose_r(file);
++#endif
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/gzguts.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,233 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* gzguts.h -- zlib internal header definitions for gz* operations
++ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#ifdef _LARGEFILE64_SOURCE
++# ifndef _LARGEFILE_SOURCE
++# define _LARGEFILE_SOURCE 1
++# endif
++# ifdef _FILE_OFFSET_BITS
++# undef _FILE_OFFSET_BITS
++# endif
++#endif
++
++#ifdef HAVE_HIDDEN
++# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
++#else
++# define ZLIB_INTERNAL
++#endif
++
++#include <stdio.h>
++#include "zlib.h"
++#ifdef STDC
++# include <string.h>
++# include <stdlib.h>
++# include <limits.h>
++#endif
++#include <fcntl.h>
++
++#ifdef _WIN32
++# include <stddef.h>
++#endif
++
++#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
++# include <io.h>
++#endif
++
++#ifdef WINAPI_FAMILY
++# define open _open
++# define read _read
++# define write _write
++# define close _close
++#endif
++
++#ifdef NO_DEFLATE /* for compatibility with old definition */
++# define NO_GZCOMPRESS
++#endif
++
++#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
++# ifndef HAVE_VSNPRINTF
++# define HAVE_VSNPRINTF
++# endif
++#endif
++
++#if defined(__CYGWIN__)
++# ifndef HAVE_VSNPRINTF
++# define HAVE_VSNPRINTF
++# endif
++#endif
++
++#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
++# ifndef HAVE_VSNPRINTF
++# define HAVE_VSNPRINTF
++# endif
++#endif
++
++#ifndef HAVE_VSNPRINTF
++# ifdef MSDOS
++/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
++ but for now we just assume it doesn't. */
++# define NO_vsnprintf
++# endif
++# ifdef __TURBOC__
++# define NO_vsnprintf
++# endif
++# ifdef WIN32
++/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
++# if !defined(vsnprintf) && !defined(NO_vsnprintf)
++# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
++# define vsnprintf _vsnprintf
++# endif
++# endif
++# endif
++# ifdef __SASC
++# define NO_vsnprintf
++# endif
++# ifdef VMS
++# define NO_vsnprintf
++# endif
++# ifdef __OS400__
++# define NO_vsnprintf
++# endif
++# ifdef __MVS__
++# define NO_vsnprintf
++# endif
++#endif
++
++/* unlike snprintf (which is required in C99, yet still not supported by
++ Microsoft more than a decade later!), _snprintf does not guarantee null
++ termination of the result -- however this is only used in gzlib.c where
++ the result is assured to fit in the space provided */
++#ifdef _MSC_VER
++# define snprintf _snprintf
++#endif
++
++#ifndef local
++# define local static
++#endif
++/* compile with -Dlocal if your debugger can't find static symbols */
++
++/* gz* functions always use library allocation functions */
++#ifndef STDC
++ extern voidp malloc OF((uInt size));
++ extern void free OF((voidpf ptr));
++#endif
++
++/* get errno and strerror definition */
++#if defined UNDER_CE
++# include <windows.h>
++# define zstrerror() gz_strwinerror((DWORD)GetLastError())
++#else
++# ifndef NO_STRERROR
++# include <errno.h>
++# define zstrerror() strerror(errno)
++# else
++# define zstrerror() "stdio error (consult errno)"
++# endif
++#endif
++
++/* provide prototypes for these when building zlib without LFS */
++#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
++ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
++ ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
++ ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
++ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
++#endif
++
++/* default memLevel */
++#if MAX_MEM_LEVEL >= 8
++# define DEF_MEM_LEVEL 8
++#else
++# define DEF_MEM_LEVEL MAX_MEM_LEVEL
++#endif
++
++/* default i/o buffer size -- double this for output when reading (this and
++ twice this must be able to fit in an unsigned type) */
++#define GZBUFSIZE 8192
++
++/* gzip modes, also provide a little integrity check on the passed structure */
++#define GZ_NONE 0
++#define GZ_READ 7247
++#define GZ_WRITE 31153
++#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
++
++/* values for gz_state how */
++#define LOOK 0 /* look for a gzip header */
++#define COPY 1 /* copy input directly */
++#define GZIP 2 /* decompress a gzip stream */
++
++/* internal gzip file state data structure */
++typedef struct {
++ /* exposed contents for gzgetc() macro */
++ struct gzFile_s x; /* "x" for exposed */
++ /* x.have: number of bytes available at x.next */
++ /* x.next: next output data to deliver or write */
++ /* x.pos: current position in uncompressed data */
++ /* used for both reading and writing */
++ int mode; /* see gzip modes above */
++ int fd; /* file descriptor */
++ char *path; /* path or fd for error messages */
++ unsigned size; /* buffer size, zero if not allocated yet */
++ unsigned want; /* requested buffer size, default is GZBUFSIZE */
++ unsigned char *in; /* input buffer */
++ unsigned char *out; /* output buffer (double-sized when reading) */
++ int direct; /* 0 if processing gzip, 1 if transparent */
++ /* just for reading */
++ int how; /* 0: get header, 1: copy, 2: decompress */
++ z_off64_t start; /* where the gzip data started, for rewinding */
++ int eof; /* true if end of input file reached */
++ int past; /* true if read requested past end */
++ /* just for writing */
++ int level; /* compression level */
++ int strategy; /* compression strategy */
++ /* seek request */
++ z_off64_t skip; /* amount to skip (already rewound if backwards) */
++ int seek; /* true if seek request pending */
++ /* error information */
++ int err; /* error code */
++ char *msg; /* error message */
++ /* zlib inflate or deflate stream */
++ z_stream strm; /* stream structure in-place (not a pointer) */
++} gz_state;
++typedef gz_state FAR *gz_statep;
++
++/* shared functions */
++void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
++#if defined UNDER_CE
++char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
++#endif
++
++/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
++ value -- needed when comparing unsigned to z_off64_t, which is signed
++ (possible z_off64_t types off_t, off64_t, and long are all signed) */
++#ifdef INT_MAX
++# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
++#else
++unsigned ZLIB_INTERNAL gz_intmax OF((void));
++# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
++#endif
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/gzlib.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,658 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* gzlib.c -- zlib functions common to reading and writing gzip files
++ * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "gzguts.h"
++
++#if defined(_WIN32) && !defined(__BORLANDC__)
++# define LSEEK _lseeki64
++#else
++#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
++# define LSEEK lseek64
++#else
++# define LSEEK lseek
++#endif
++#endif
++
++/* Local functions */
++local void gz_reset OF((gz_statep));
++local gzFile gz_open OF((const void *, int, const char *));
++
++#if defined UNDER_CE
++
++/* Map the Windows error number in ERROR to a locale-dependent error message
++ string and return a pointer to it. Typically, the values for ERROR come
++ from GetLastError.
++
++ The string pointed to shall not be modified by the application, but may be
++ overwritten by a subsequent call to gz_strwinerror
++
++ The gz_strwinerror function does not change the current setting of
++ GetLastError. */
++char ZLIB_INTERNAL *gz_strwinerror (error)
++ DWORD error;
++{
++ static char buf[1024];
++
++ wchar_t *msgbuf;
++ DWORD lasterr = GetLastError();
++ DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
++ | FORMAT_MESSAGE_ALLOCATE_BUFFER,
++ NULL,
++ error,
++ 0, /* Default language */
++ (LPVOID)&msgbuf,
++ 0,
++ NULL);
++ if (chars != 0) {
++ /* If there is an \r\n appended, zap it. */
++ if (chars >= 2
++ && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
++ chars -= 2;
++ msgbuf[chars] = 0;
++ }
++
++ if (chars > sizeof (buf) - 1) {
++ chars = sizeof (buf) - 1;
++ msgbuf[chars] = 0;
++ }
++
++ wcstombs(buf, msgbuf, chars + 1);
++ LocalFree(msgbuf);
++ }
++ else {
++ sprintf(buf, "unknown win32 error (%ld)", error);
++ }
++
++ SetLastError(lasterr);
++ return buf;
++}
++
++#endif /* UNDER_CE */
++
++/* Reset gzip file state */
++local void gz_reset(state)
++ gz_statep state;
++{
++ state->x.have = 0; /* no output data available */
++ if (state->mode == GZ_READ) { /* for reading ... */
++ state->eof = 0; /* not at end of file */
++ state->past = 0; /* have not read past end yet */
++ state->how = LOOK; /* look for gzip header */
++ }
++ state->seek = 0; /* no seek request pending */
++ gz_error(state, Z_OK, NULL); /* clear error */
++ state->x.pos = 0; /* no uncompressed data yet */
++ state->strm.avail_in = 0; /* no input data yet */
++}
++
++/* Open a gzip file either by name or file descriptor. */
++local gzFile gz_open(path, fd, mode)
++ const void *path;
++ int fd;
++ const char *mode;
++{
++ gz_statep state;
++ size_t len;
++ int oflag;
++#ifdef O_CLOEXEC
++ int cloexec = 0;
++#endif
++#ifdef O_EXCL
++ int exclusive = 0;
++#endif
++
++ /* check input */
++ if (path == NULL)
++ return NULL;
++
++ /* allocate gzFile structure to return */
++ state = (gz_statep)malloc(sizeof(gz_state));
++ if (state == NULL)
++ return NULL;
++ state->size = 0; /* no buffers allocated yet */
++ state->want = GZBUFSIZE; /* requested buffer size */
++ state->msg = NULL; /* no error message yet */
++
++ /* interpret mode */
++ state->mode = GZ_NONE;
++ state->level = Z_DEFAULT_COMPRESSION;
++ state->strategy = Z_DEFAULT_STRATEGY;
++ state->direct = 0;
++ while (*mode) {
++ if (*mode >= '0' && *mode <= '9')
++ state->level = *mode - '0';
++ else
++ switch (*mode) {
++ case 'r':
++ state->mode = GZ_READ;
++ break;
++#ifndef NO_GZCOMPRESS
++ case 'w':
++ state->mode = GZ_WRITE;
++ break;
++ case 'a':
++ state->mode = GZ_APPEND;
++ break;
++#endif
++ case '+': /* can't read and write at the same time */
++ free(state);
++ return NULL;
++ case 'b': /* ignore -- will request binary anyway */
++ break;
++#ifdef O_CLOEXEC
++ case 'e':
++ cloexec = 1;
++ break;
++#endif
++#ifdef O_EXCL
++ case 'x':
++ exclusive = 1;
++ break;
++#endif
++ case 'f':
++ state->strategy = Z_FILTERED;
++ break;
++ case 'h':
++ state->strategy = Z_HUFFMAN_ONLY;
++ break;
++ case 'R':
++ state->strategy = Z_RLE;
++ break;
++ case 'F':
++ state->strategy = Z_FIXED;
++ break;
++ case 'T':
++ state->direct = 1;
++ break;
++ default: /* could consider as an error, but just ignore */
++ ;
++ }
++ mode++;
++ }
++
++ /* must provide an "r", "w", or "a" */
++ if (state->mode == GZ_NONE) {
++ free(state);
++ return NULL;
++ }
++
++ /* can't force transparent read */
++ if (state->mode == GZ_READ) {
++ if (state->direct) {
++ free(state);
++ return NULL;
++ }
++ state->direct = 1; /* for empty file */
++ }
++
++ /* save the path name for error messages */
++#ifdef _WIN32
++ if (fd == -2) {
++ len = wcstombs(NULL, path, 0);
++ if (len == (size_t)-1)
++ len = 0;
++ }
++ else
++#endif
++ len = strlen((const char *)path);
++ state->path = (char *)malloc(len + 1);
++ if (state->path == NULL) {
++ free(state);
++ return NULL;
++ }
++#ifdef _WIN32
++ if (fd == -2)
++ if (len)
++ wcstombs(state->path, path, len + 1);
++ else
++ *(state->path) = 0;
++ else
++#endif
++#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
++ snprintf(state->path, len + 1, "%s", (const char *)path);
++#else
++ strcpy(state->path, path);
++#endif
++
++ /* compute the flags for open() */
++ oflag =
++#ifdef O_LARGEFILE
++ O_LARGEFILE |
++#endif
++#ifdef O_BINARY
++ O_BINARY |
++#endif
++#ifdef O_CLOEXEC
++ (cloexec ? O_CLOEXEC : 0) |
++#endif
++ (state->mode == GZ_READ ?
++ O_RDONLY :
++ (O_WRONLY | O_CREAT |
++#ifdef O_EXCL
++ (exclusive ? O_EXCL : 0) |
++#endif
++ (state->mode == GZ_WRITE ?
++ O_TRUNC :
++ O_APPEND)));
++
++ /* open the file with the appropriate flags (or just use fd) */
++ state->fd = fd > -1 ? fd : (
++#ifdef _WIN32
++ fd == -2 ? _wopen(path, oflag, 0666) :
++#endif
++ open((const char *)path, oflag, 0666));
++ if (state->fd == -1) {
++ free(state->path);
++ free(state);
++ return NULL;
++ }
++ if (state->mode == GZ_APPEND)
++ state->mode = GZ_WRITE; /* simplify later checks */
++
++ /* save the current position for rewinding (only if reading) */
++ if (state->mode == GZ_READ) {
++ state->start = LSEEK(state->fd, 0, SEEK_CUR);
++ if (state->start == -1) state->start = 0;
++ }
++
++ /* initialize stream */
++ gz_reset(state);
++
++ /* return stream */
++ return (gzFile)state;
++}
++
++/* -- see zlib.h -- */
++gzFile ZEXPORT gzopen(path, mode)
++ const char *path;
++ const char *mode;
++{
++ return gz_open(path, -1, mode);
++}
++
++/* -- see zlib.h -- */
++gzFile ZEXPORT gzopen64(path, mode)
++ const char *path;
++ const char *mode;
++{
++ return gz_open(path, -1, mode);
++}
++
++/* -- see zlib.h -- */
++gzFile ZEXPORT gzdopen(fd, mode)
++ int fd;
++ const char *mode;
++{
++ char *path; /* identifier for error messages */
++ gzFile gz;
++
++ if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
++ return NULL;
++#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
++ snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
++#else
++ sprintf(path, "<fd:%d>", fd); /* for debugging */
++#endif
++ gz = gz_open(path, fd, mode);
++ free(path);
++ return gz;
++}
++
++/* -- see zlib.h -- */
++#ifdef _WIN32
++gzFile ZEXPORT gzopen_w(path, mode)
++ const wchar_t *path;
++ const char *mode;
++{
++ return gz_open(path, -2, mode);
++}
++#endif
++
++/* -- see zlib.h -- */
++int ZEXPORT gzbuffer(file, size)
++ gzFile file;
++ unsigned size;
++{
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return -1;
++
++ /* make sure we haven't already allocated memory */
++ if (state->size != 0)
++ return -1;
++
++ /* check and set requested size */
++ if (size < 2)
++ size = 2; /* need two bytes to check magic header */
++ state->want = size;
++ return 0;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzrewind(file)
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++
++ /* check that we're reading and that there's no error */
++ if (state->mode != GZ_READ ||
++ (state->err != Z_OK && state->err != Z_BUF_ERROR))
++ return -1;
++
++ /* back up and start over */
++ if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
++ return -1;
++ gz_reset(state);
++ return 0;
++}
++
++/* -- see zlib.h -- */
++z_off64_t ZEXPORT gzseek64(file, offset, whence)
++ gzFile file;
++ z_off64_t offset;
++ int whence;
++{
++ unsigned n;
++ z_off64_t ret;
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return -1;
++
++ /* check that there's no error */
++ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
++ return -1;
++
++ /* can only seek from start or relative to current position */
++ if (whence != SEEK_SET && whence != SEEK_CUR)
++ return -1;
++
++ /* normalize offset to a SEEK_CUR specification */
++ if (whence == SEEK_SET)
++ offset -= state->x.pos;
++ else if (state->seek)
++ offset += state->skip;
++ state->seek = 0;
++
++ /* if within raw area while reading, just go there */
++ if (state->mode == GZ_READ && state->how == COPY &&
++ state->x.pos + offset >= 0) {
++ ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
++ if (ret == -1)
++ return -1;
++ state->x.have = 0;
++ state->eof = 0;
++ state->past = 0;
++ state->seek = 0;
++ gz_error(state, Z_OK, NULL);
++ state->strm.avail_in = 0;
++ state->x.pos += offset;
++ return state->x.pos;
++ }
++
++ /* calculate skip amount, rewinding if needed for back seek when reading */
++ if (offset < 0) {
++ if (state->mode != GZ_READ) /* writing -- can't go backwards */
++ return -1;
++ offset += state->x.pos;
++ if (offset < 0) /* before start of file! */
++ return -1;
++ if (gzrewind(file) == -1) /* rewind, then skip to offset */
++ return -1;
++ }
++
++ /* if reading, skip what's in output buffer (one less gzgetc() check) */
++ if (state->mode == GZ_READ) {
++ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
++ (unsigned)offset : state->x.have;
++ state->x.have -= n;
++ state->x.next += n;
++ state->x.pos += n;
++ offset -= n;
++ }
++
++ /* request skip (if not zero) */
++ if (offset) {
++ state->seek = 1;
++ state->skip = offset;
++ }
++ return state->x.pos + offset;
++}
++
++/* -- see zlib.h -- */
++z_off_t ZEXPORT gzseek(file, offset, whence)
++ gzFile file;
++ z_off_t offset;
++ int whence;
++{
++ z_off64_t ret;
++
++ ret = gzseek64(file, (z_off64_t)offset, whence);
++ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
++}
++
++/* -- see zlib.h -- */
++z_off64_t ZEXPORT gztell64(file)
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return -1;
++
++ /* return position */
++ return state->x.pos + (state->seek ? state->skip : 0);
++}
++
++/* -- see zlib.h -- */
++z_off_t ZEXPORT gztell(file)
++ gzFile file;
++{
++ z_off64_t ret;
++
++ ret = gztell64(file);
++ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
++}
++
++/* -- see zlib.h -- */
++z_off64_t ZEXPORT gzoffset64(file)
++ gzFile file;
++{
++ z_off64_t offset;
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return -1;
++
++ /* compute and return effective offset in file */
++ offset = LSEEK(state->fd, 0, SEEK_CUR);
++ if (offset == -1)
++ return -1;
++ if (state->mode == GZ_READ) /* reading */
++ offset -= state->strm.avail_in; /* don't count buffered input */
++ return offset;
++}
++
++/* -- see zlib.h -- */
++z_off_t ZEXPORT gzoffset(file)
++ gzFile file;
++{
++ z_off64_t ret;
++
++ ret = gzoffset64(file);
++ return ret == (z_off_t)ret ? (z_off_t)ret : -1;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzeof(file)
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return 0;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return 0;
++
++ /* return end-of-file state */
++ return state->mode == GZ_READ ? state->past : 0;
++}
++
++/* -- see zlib.h -- */
++const char * ZEXPORT gzerror(file, errnum)
++ gzFile file;
++ int *errnum;
++{
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return NULL;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return NULL;
++
++ /* return error information */
++ if (errnum != NULL)
++ *errnum = state->err;
++ return state->err == Z_MEM_ERROR ? "out of memory" :
++ (state->msg == NULL ? "" : state->msg);
++}
++
++/* -- see zlib.h -- */
++void ZEXPORT gzclearerr(file)
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure and check integrity */
++ if (file == NULL)
++ return;
++ state = (gz_statep)file;
++ if (state->mode != GZ_READ && state->mode != GZ_WRITE)
++ return;
++
++ /* clear error and end-of-file */
++ if (state->mode == GZ_READ) {
++ state->eof = 0;
++ state->past = 0;
++ }
++ gz_error(state, Z_OK, NULL);
++}
++
++/* Create an error message in allocated memory and set state->err and
++ state->msg accordingly. Free any previous error message already there. Do
++ not try to free or allocate space if the error is Z_MEM_ERROR (out of
++ memory). Simply save the error message as a static string. If there is an
++ allocation failure constructing the error message, then convert the error to
++ out of memory. */
++void ZLIB_INTERNAL gz_error(state, err, msg)
++ gz_statep state;
++ int err;
++ const char *msg;
++{
++ /* free previously allocated message and clear */
++ if (state->msg != NULL) {
++ if (state->err != Z_MEM_ERROR)
++ free(state->msg);
++ state->msg = NULL;
++ }
++
++ /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
++ if (err != Z_OK && err != Z_BUF_ERROR)
++ state->x.have = 0;
++
++ /* set error code, and if no message, then done */
++ state->err = err;
++ if (msg == NULL)
++ return;
++
++ /* for an out of memory error, return literal string when requested */
++ if (err == Z_MEM_ERROR)
++ return;
++
++ /* construct error message with path */
++ if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
++ NULL) {
++ state->err = Z_MEM_ERROR;
++ return;
++ }
++#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
++ snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
++ "%s%s%s", state->path, ": ", msg);
++#else
++ strcpy(state->msg, state->path);
++ strcat(state->msg, ": ");
++ strcat(state->msg, msg);
++#endif
++ return;
++}
++
++#ifndef INT_MAX
++/* portably return maximum value for an int (when limits.h presumed not
++ available) -- we need to do this to cover cases where 2's complement not
++ used, since C standard permits 1's complement and sign-bit representations,
++ otherwise we could just use ((unsigned)-1) >> 1 */
++unsigned ZLIB_INTERNAL gz_intmax()
++{
++ unsigned p, q;
++
++ p = 1;
++ do {
++ q = p;
++ p <<= 1;
++ p++;
++ } while (p > q);
++ return q >> 1;
++}
++#endif
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/gzread.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,618 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* gzread.c -- zlib functions for reading gzip files
++ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "gzguts.h"
++
++/* Local functions */
++local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
++local int gz_avail OF((gz_statep));
++local int gz_look OF((gz_statep));
++local int gz_decomp OF((gz_statep));
++local int gz_fetch OF((gz_statep));
++local int gz_skip OF((gz_statep, z_off64_t));
++
++/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
++ state->fd, and update state->eof, state->err, and state->msg as appropriate.
++ This function needs to loop on read(), since read() is not guaranteed to
++ read the number of bytes requested, depending on the type of descriptor. */
++local int gz_load(state, buf, len, have)
++ gz_statep state;
++ unsigned char *buf;
++ unsigned len;
++ unsigned *have;
++{
++ int ret;
++
++ *have = 0;
++ do {
++ ret = read(state->fd, buf + *have, len - *have);
++ if (ret <= 0)
++ break;
++ *have += ret;
++ } while (*have < len);
++ if (ret < 0) {
++ gz_error(state, Z_ERRNO, zstrerror());
++ return -1;
++ }
++ if (ret == 0)
++ state->eof = 1;
++ return 0;
++}
++
++/* Load up input buffer and set eof flag if last data loaded -- return -1 on
++ error, 0 otherwise. Note that the eof flag is set when the end of the input
++ file is reached, even though there may be unused data in the buffer. Once
++ that data has been used, no more attempts will be made to read the file.
++ If strm->avail_in != 0, then the current data is moved to the beginning of
++ the input buffer, and then the remainder of the buffer is loaded with the
++ available data from the input file. */
++local int gz_avail(state)
++ gz_statep state;
++{
++ unsigned got;
++ z_streamp strm = &(state->strm);
++
++ if (state->err != Z_OK && state->err != Z_BUF_ERROR)
++ return -1;
++ if (state->eof == 0) {
++ if (strm->avail_in) { /* copy what's there to the start */
++ unsigned char *p = state->in;
++ unsigned const char *q = strm->next_in;
++ unsigned n = strm->avail_in;
++ do {
++ *p++ = *q++;
++ } while (--n);
++ }
++ if (gz_load(state, state->in + strm->avail_in,
++ state->size - strm->avail_in, &got) == -1)
++ return -1;
++ strm->avail_in += got;
++ strm->next_in = state->in;
++ }
++ return 0;
++}
++
++/* Look for gzip header, set up for inflate or copy. state->x.have must be 0.
++ If this is the first time in, allocate required memory. state->how will be
++ left unchanged if there is no more input data available, will be set to COPY
++ if there is no gzip header and direct copying will be performed, or it will
++ be set to GZIP for decompression. If direct copying, then leftover input
++ data from the input buffer will be copied to the output buffer. In that
++ case, all further file reads will be directly to either the output buffer or
++ a user buffer. If decompressing, the inflate state will be initialized.
++ gz_look() will return 0 on success or -1 on failure. */
++local int gz_look(state)
++ gz_statep state;
++{
++ z_streamp strm = &(state->strm);
++
++ /* allocate read buffers and inflate memory */
++ if (state->size == 0) {
++ /* allocate buffers */
++ state->in = (unsigned char *)malloc(state->want);
++ state->out = (unsigned char *)malloc(state->want << 1);
++ if (state->in == NULL || state->out == NULL) {
++ if (state->out != NULL)
++ free(state->out);
++ if (state->in != NULL)
++ free(state->in);
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++ state->size = state->want;
++
++ /* allocate inflate memory */
++ state->strm.zalloc = Z_NULL;
++ state->strm.zfree = Z_NULL;
++ state->strm.opaque = Z_NULL;
++ state->strm.avail_in = 0;
++ state->strm.next_in = Z_NULL;
++ if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
++ free(state->out);
++ free(state->in);
++ state->size = 0;
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++ }
++
++ /* get at least the magic bytes in the input buffer */
++ if (strm->avail_in < 2) {
++ if (gz_avail(state) == -1)
++ return -1;
++ if (strm->avail_in == 0)
++ return 0;
++ }
++
++ /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
++ a logical dilemma here when considering the case of a partially written
++ gzip file, to wit, if a single 31 byte is written, then we cannot tell
++ whether this is a single-byte file, or just a partially written gzip
++ file -- for here we assume that if a gzip file is being written, then
++ the header will be written in a single operation, so that reading a
++ single byte is sufficient indication that it is not a gzip file) */
++ if (strm->avail_in > 1 &&
++ strm->next_in[0] == 31 && strm->next_in[1] == 139) {
++ inflateReset(strm);
++ state->how = GZIP;
++ state->direct = 0;
++ return 0;
++ }
++
++ /* no gzip header -- if we were decoding gzip before, then this is trailing
++ garbage. Ignore the trailing garbage and finish. */
++ if (state->direct == 0) {
++ strm->avail_in = 0;
++ state->eof = 1;
++ state->x.have = 0;
++ return 0;
++ }
++
++ /* doing raw i/o, copy any leftover input to output -- this assumes that
++ the output buffer is larger than the input buffer, which also assures
++ space for gzungetc() */
++ state->x.next = state->out;
++ if (strm->avail_in) {
++ memcpy(state->x.next, strm->next_in, strm->avail_in);
++ state->x.have = strm->avail_in;
++ strm->avail_in = 0;
++ }
++ state->how = COPY;
++ state->direct = 1;
++ return 0;
++}
++
++/* Decompress from input to the provided next_out and avail_out in the state.
++ On return, state->x.have and state->x.next point to the just decompressed
++ data. If the gzip stream completes, state->how is reset to LOOK to look for
++ the next gzip stream or raw data, once state->x.have is depleted. Returns 0
++ on success, -1 on failure. */
++local int gz_decomp(state)
++ gz_statep state;
++{
++ int ret = Z_OK;
++ unsigned had;
++ z_streamp strm = &(state->strm);
++
++ /* fill output buffer up to end of deflate stream */
++ had = strm->avail_out;
++ do {
++ /* get more input for inflate() */
++ if (strm->avail_in == 0 && gz_avail(state) == -1)
++ return -1;
++ if (strm->avail_in == 0) {
++ gz_error(state, Z_BUF_ERROR, "unexpected end of file");
++ break;
++ }
++
++ /* decompress and handle errors */
++ ret = inflate(strm, Z_NO_FLUSH);
++ if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
++ gz_error(state, Z_STREAM_ERROR,
++ "internal error: inflate stream corrupt");
++ return -1;
++ }
++ if (ret == Z_MEM_ERROR) {
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++ if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
++ gz_error(state, Z_DATA_ERROR,
++ strm->msg == NULL ? "compressed data error" : strm->msg);
++ return -1;
++ }
++ } while (strm->avail_out && ret != Z_STREAM_END);
++
++ /* update available output */
++ state->x.have = had - strm->avail_out;
++ state->x.next = strm->next_out - state->x.have;
++
++ /* if the gzip stream completed successfully, look for another */
++ if (ret == Z_STREAM_END)
++ state->how = LOOK;
++
++ /* good decompression */
++ return 0;
++}
++
++/* Fetch data and put it in the output buffer. Assumes state->x.have is 0.
++ Data is either copied from the input file or decompressed from the input
++ file depending on state->how. If state->how is LOOK, then a gzip header is
++ looked for to determine whether to copy or decompress. Returns -1 on error,
++ otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
++ end of the input file has been reached and all data has been processed. */
++local int gz_fetch(state)
++ gz_statep state;
++{
++ z_streamp strm = &(state->strm);
++
++ do {
++ switch(state->how) {
++ case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
++ if (gz_look(state) == -1)
++ return -1;
++ if (state->how == LOOK)
++ return 0;
++ break;
++ case COPY: /* -> COPY */
++ if (gz_load(state, state->out, state->size << 1, &(state->x.have))
++ == -1)
++ return -1;
++ state->x.next = state->out;
++ return 0;
++ case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
++ strm->avail_out = state->size << 1;
++ strm->next_out = state->out;
++ if (gz_decomp(state) == -1)
++ return -1;
++ }
++ } while (state->x.have == 0 && (!state->eof || strm->avail_in));
++ return 0;
++}
++
++/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
++local int gz_skip(state, len)
++ gz_statep state;
++ z_off64_t len;
++{
++ unsigned n;
++
++ /* skip over len bytes or reach end-of-file, whichever comes first */
++ while (len)
++ /* skip over whatever is in output buffer */
++ if (state->x.have) {
++ n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
++ (unsigned)len : state->x.have;
++ state->x.have -= n;
++ state->x.next += n;
++ state->x.pos += n;
++ len -= n;
++ }
++
++ /* output buffer empty -- return if we're at the end of the input */
++ else if (state->eof && state->strm.avail_in == 0)
++ break;
++
++ /* need more data to skip -- load up output buffer */
++ else {
++ /* get more output, looking for header if required */
++ if (gz_fetch(state) == -1)
++ return -1;
++ }
++ return 0;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzread(file, buf, len)
++ gzFile file;
++ voidp buf;
++ unsigned len;
++{
++ unsigned got, n;
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that we're reading and that there's no (serious) error */
++ if (state->mode != GZ_READ ||
++ (state->err != Z_OK && state->err != Z_BUF_ERROR))
++ return -1;
++
++ /* since an int is returned, make sure len fits in one, otherwise return
++ with an error (this avoids the flaw in the interface) */
++ if ((int)len < 0) {
++ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
++ return -1;
++ }
++
++ /* if len is zero, avoid unnecessary operations */
++ if (len == 0)
++ return 0;
++
++ /* process a skip request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_skip(state, state->skip) == -1)
++ return -1;
++ }
++
++ /* get len bytes to buf, or less than len if at the end */
++ got = 0;
++ do {
++ /* first just try copying data from the output buffer */
++ if (state->x.have) {
++ n = state->x.have > len ? len : state->x.have;
++ memcpy(buf, state->x.next, n);
++ state->x.next += n;
++ state->x.have -= n;
++ }
++
++ /* output buffer empty -- return if we're at the end of the input */
++ else if (state->eof && strm->avail_in == 0) {
++ state->past = 1; /* tried to read past end */
++ break;
++ }
++
++ /* need output data -- for small len or new stream load up our output
++ buffer */
++ else if (state->how == LOOK || len < (state->size << 1)) {
++ /* get more output, looking for header if required */
++ if (gz_fetch(state) == -1)
++ return -1;
++ continue; /* no progress yet -- go back to copy above */
++ /* the copy above assures that we will leave with space in the
++ output buffer, allowing at least one gzungetc() to succeed */
++ }
++
++ /* large len -- read directly into user buffer */
++ else if (state->how == COPY) { /* read directly */
++ if (gz_load(state, (unsigned char *)buf, len, &n) == -1)
++ return -1;
++ }
++
++ /* large len -- decompress directly into user buffer */
++ else { /* state->how == GZIP */
++ strm->avail_out = len;
++ strm->next_out = (unsigned char *)buf;
++ if (gz_decomp(state) == -1)
++ return -1;
++ n = state->x.have;
++ state->x.have = 0;
++ }
++
++ /* update progress */
++ len -= n;
++ buf = (char *)buf + n;
++ got += n;
++ state->x.pos += n;
++ } while (len);
++
++ /* return number of bytes read into user buffer (will fit in int) */
++ return (int)got;
++}
++
++/* -- see zlib.h -- */
++#ifdef Z_PREFIX_SET
++# undef z_gzgetc
++#else
++# undef gzgetc
++#endif
++int ZEXPORT gzgetc(file)
++ gzFile file;
++{
++ int ret;
++ unsigned char buf[1];
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++
++ /* check that we're reading and that there's no (serious) error */
++ if (state->mode != GZ_READ ||
++ (state->err != Z_OK && state->err != Z_BUF_ERROR))
++ return -1;
++
++ /* try output buffer (no need to check for skip request) */
++ if (state->x.have) {
++ state->x.have--;
++ state->x.pos++;
++ return *(state->x.next)++;
++ }
++
++ /* nothing there -- try gzread() */
++ ret = gzread(file, buf, 1);
++ return ret < 1 ? -1 : buf[0];
++}
++
++int ZEXPORT gzgetc_(file)
++gzFile file;
++{
++ return gzgetc(file);
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzungetc(c, file)
++ int c;
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++
++ /* check that we're reading and that there's no (serious) error */
++ if (state->mode != GZ_READ ||
++ (state->err != Z_OK && state->err != Z_BUF_ERROR))
++ return -1;
++
++ /* process a skip request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_skip(state, state->skip) == -1)
++ return -1;
++ }
++
++ /* can't push EOF */
++ if (c < 0)
++ return -1;
++
++ /* if output buffer empty, put byte at end (allows more pushing) */
++ if (state->x.have == 0) {
++ state->x.have = 1;
++ state->x.next = state->out + (state->size << 1) - 1;
++ state->x.next[0] = c;
++ state->x.pos--;
++ state->past = 0;
++ return c;
++ }
++
++ /* if no room, give up (must have already done a gzungetc()) */
++ if (state->x.have == (state->size << 1)) {
++ gz_error(state, Z_DATA_ERROR, "out of room to push characters");
++ return -1;
++ }
++
++ /* slide output data if needed and insert byte before existing data */
++ if (state->x.next == state->out) {
++ unsigned char *src = state->out + state->x.have;
++ unsigned char *dest = state->out + (state->size << 1);
++ while (src > state->out)
++ *--dest = *--src;
++ state->x.next = dest;
++ }
++ state->x.have++;
++ state->x.next--;
++ state->x.next[0] = c;
++ state->x.pos--;
++ state->past = 0;
++ return c;
++}
++
++/* -- see zlib.h -- */
++char * ZEXPORT gzgets(file, buf, len)
++ gzFile file;
++ char *buf;
++ int len;
++{
++ unsigned left, n;
++ char *str;
++ unsigned char *eol;
++ gz_statep state;
++
++ /* check parameters and get internal structure */
++ if (file == NULL || buf == NULL || len < 1)
++ return NULL;
++ state = (gz_statep)file;
++
++ /* check that we're reading and that there's no (serious) error */
++ if (state->mode != GZ_READ ||
++ (state->err != Z_OK && state->err != Z_BUF_ERROR))
++ return NULL;
++
++ /* process a skip request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_skip(state, state->skip) == -1)
++ return NULL;
++ }
++
++ /* copy output bytes up to new line or len - 1, whichever comes first --
++ append a terminating zero to the string (we don't check for a zero in
++ the contents, let the user worry about that) */
++ str = buf;
++ left = (unsigned)len - 1;
++ if (left) do {
++ /* assure that something is in the output buffer */
++ if (state->x.have == 0 && gz_fetch(state) == -1)
++ return NULL; /* error */
++ if (state->x.have == 0) { /* end of file */
++ state->past = 1; /* read past end */
++ break; /* return what we have */
++ }
++
++ /* look for end-of-line in current output buffer */
++ n = state->x.have > left ? left : state->x.have;
++ eol = (unsigned char *)memchr(state->x.next, '\n', n);
++ if (eol != NULL)
++ n = (unsigned)(eol - state->x.next) + 1;
++
++ /* copy through end-of-line, or remainder if not found */
++ memcpy(buf, state->x.next, n);
++ state->x.have -= n;
++ state->x.next += n;
++ state->x.pos += n;
++ left -= n;
++ buf += n;
++ } while (left && eol == NULL);
++
++ /* return terminated string, or if nothing, end of file */
++ if (buf == str)
++ return NULL;
++ buf[0] = 0;
++ return str;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzdirect(file)
++ gzFile file;
++{
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return 0;
++ state = (gz_statep)file;
++
++ /* if the state is not known, but we can find out, then do so (this is
++ mainly for right after a gzopen() or gzdopen()) */
++ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
++ (void)gz_look(state);
++
++ /* return 1 if transparent, 0 if processing a gzip stream */
++ return state->direct;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzclose_r(file)
++ gzFile file;
++{
++ int ret, err;
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return Z_STREAM_ERROR;
++ state = (gz_statep)file;
++
++ /* check that we're reading */
++ if (state->mode != GZ_READ)
++ return Z_STREAM_ERROR;
++
++ /* free memory and close file */
++ if (state->size) {
++ inflateEnd(&(state->strm));
++ free(state->out);
++ free(state->in);
++ }
++ err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
++ gz_error(state, Z_OK, NULL);
++ free(state->path);
++ ret = close(state->fd);
++ free(state);
++ return ret ? Z_ERRNO : err;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/gzwrite.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,601 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* gzwrite.c -- zlib functions for writing gzip files
++ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "gzguts.h"
++
++/* Local functions */
++local int gz_init OF((gz_statep));
++local int gz_comp OF((gz_statep, int));
++local int gz_zero OF((gz_statep, z_off64_t));
++
++/* Initialize state for writing a gzip file. Mark initialization by setting
++ state->size to non-zero. Return -1 on failure or 0 on success. */
++local int gz_init(state)
++ gz_statep state;
++{
++ int ret;
++ z_streamp strm = &(state->strm);
++
++ /* allocate input buffer */
++ state->in = (unsigned char *)malloc(state->want);
++ if (state->in == NULL) {
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++
++ /* only need output buffer and deflate state if compressing */
++ if (!state->direct) {
++ /* allocate output buffer */
++ state->out = (unsigned char *)malloc(state->want);
++ if (state->out == NULL) {
++ free(state->in);
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++
++ /* allocate deflate memory, set up for gzip compression */
++ strm->zalloc = Z_NULL;
++ strm->zfree = Z_NULL;
++ strm->opaque = Z_NULL;
++ ret = deflateInit2(strm, state->level, Z_DEFLATED,
++ MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
++ if (ret != Z_OK) {
++ free(state->out);
++ free(state->in);
++ gz_error(state, Z_MEM_ERROR, "out of memory");
++ return -1;
++ }
++ }
++
++ /* mark state as initialized */
++ state->size = state->want;
++
++ /* initialize write buffer if compressing */
++ if (!state->direct) {
++ strm->avail_out = state->size;
++ strm->next_out = state->out;
++ state->x.next = strm->next_out;
++ }
++ return 0;
++}
++
++/* Compress whatever is at avail_in and next_in and write to the output file.
++ Return -1 if there is an error writing to the output file, otherwise 0.
++ flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
++ then the deflate() state is reset to start a new gzip stream. If gz->direct
++ is true, then simply write to the output file without compressing, and
++ ignore flush. */
++local int gz_comp(state, flush)
++ gz_statep state;
++ int flush;
++{
++ int ret, got;
++ unsigned have;
++ z_streamp strm = &(state->strm);
++
++ /* allocate memory if this is the first time through */
++ if (state->size == 0 && gz_init(state) == -1)
++ return -1;
++
++ /* write directly if requested */
++ if (state->direct) {
++ got = write(state->fd, strm->next_in, strm->avail_in);
++ if (got < 0 || (unsigned)got != strm->avail_in) {
++ gz_error(state, Z_ERRNO, zstrerror());
++ return -1;
++ }
++ strm->avail_in = 0;
++ return 0;
++ }
++
++ /* run deflate() on provided input until it produces no more output */
++ ret = Z_OK;
++ do {
++ /* write out current buffer contents if full, or if flushing, but if
++ doing Z_FINISH then don't write until we get to Z_STREAM_END */
++ if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
++ (flush != Z_FINISH || ret == Z_STREAM_END))) {
++ have = (unsigned)(strm->next_out - state->x.next);
++ if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
++ (unsigned)got != have)) {
++ gz_error(state, Z_ERRNO, zstrerror());
++ return -1;
++ }
++ if (strm->avail_out == 0) {
++ strm->avail_out = state->size;
++ strm->next_out = state->out;
++ }
++ state->x.next = strm->next_out;
++ }
++
++ /* compress */
++ have = strm->avail_out;
++ ret = deflate(strm, flush);
++ if (ret == Z_STREAM_ERROR) {
++ gz_error(state, Z_STREAM_ERROR,
++ "internal error: deflate stream corrupt");
++ return -1;
++ }
++ have -= strm->avail_out;
++ } while (have);
++
++ /* if that completed a deflate stream, allow another to start */
++ if (flush == Z_FINISH)
++ deflateReset(strm);
++
++ /* all done, no errors */
++ return 0;
++}
++
++/* Compress len zeros to output. Return -1 on error, 0 on success. */
++local int gz_zero(state, len)
++ gz_statep state;
++ z_off64_t len;
++{
++ int first;
++ unsigned n;
++ z_streamp strm = &(state->strm);
++
++ /* consume whatever's left in the input buffer */
++ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
++ return -1;
++
++ /* compress len zeros (len guaranteed > 0) */
++ first = 1;
++ while (len) {
++ n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
++ (unsigned)len : state->size;
++ if (first) {
++ memset(state->in, 0, n);
++ first = 0;
++ }
++ strm->avail_in = n;
++ strm->next_in = state->in;
++ state->x.pos += n;
++ if (gz_comp(state, Z_NO_FLUSH) == -1)
++ return -1;
++ len -= n;
++ }
++ return 0;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzwrite(file, buf, len)
++ gzFile file;
++ voidpc buf;
++ unsigned len;
++{
++ unsigned put = len;
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return 0;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return 0;
++
++ /* since an int is returned, make sure len fits in one, otherwise return
++ with an error (this avoids the flaw in the interface) */
++ if ((int)len < 0) {
++ gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
++ return 0;
++ }
++
++ /* if len is zero, avoid unnecessary operations */
++ if (len == 0)
++ return 0;
++
++ /* allocate memory if this is the first time through */
++ if (state->size == 0 && gz_init(state) == -1)
++ return 0;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return 0;
++ }
++
++ /* for small len, copy to input buffer, otherwise compress directly */
++ if (len < state->size) {
++ /* copy to input buffer, compress when full */
++ do {
++ unsigned have, copy;
++
++ if (strm->avail_in == 0)
++ strm->next_in = state->in;
++ have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
++ copy = state->size - have;
++ if (copy > len)
++ copy = len;
++ memcpy(state->in + have, buf, copy);
++ strm->avail_in += copy;
++ state->x.pos += copy;
++ buf = (const char *)buf + copy;
++ len -= copy;
++ if (len && gz_comp(state, Z_NO_FLUSH) == -1)
++ return 0;
++ } while (len);
++ }
++ else {
++ /* consume whatever's left in the input buffer */
++ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
++ return 0;
++
++ /* directly compress user buffer to file */
++ strm->avail_in = len;
++ strm->next_in = (z_const Bytef *)buf;
++ state->x.pos += len;
++ if (gz_comp(state, Z_NO_FLUSH) == -1)
++ return 0;
++ }
++
++ /* input was all buffered or compressed (put will fit in int) */
++ return (int)put;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzputc(file, c)
++ gzFile file;
++ int c;
++{
++ unsigned have;
++ unsigned char buf[1];
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return -1;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return -1;
++ }
++
++ /* try writing to input buffer for speed (state->size == 0 if buffer not
++ initialized) */
++ if (state->size) {
++ if (strm->avail_in == 0)
++ strm->next_in = state->in;
++ have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
++ if (have < state->size) {
++ state->in[have] = c;
++ strm->avail_in++;
++ state->x.pos++;
++ return c & 0xff;
++ }
++ }
++
++ /* no room in buffer or not initialized, use gz_write() */
++ buf[0] = c;
++ if (gzwrite(file, buf, 1) != 1)
++ return -1;
++ return c & 0xff;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzputs(file, str)
++ gzFile file;
++ const char *str;
++{
++ int ret;
++ unsigned len;
++
++ /* write string */
++ len = (unsigned)strlen(str);
++ ret = gzwrite(file, str, len);
++ return ret == 0 && len != 0 ? -1 : ret;
++}
++
++#if defined(STDC) || defined(Z_HAVE_STDARG_H)
++#include <stdarg.h>
++
++/* -- see zlib.h -- */
++int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
++{
++ int size, len;
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return 0;
++
++ /* make sure we have some buffer space */
++ if (state->size == 0 && gz_init(state) == -1)
++ return 0;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return 0;
++ }
++
++ /* consume whatever's left in the input buffer */
++ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
++ return 0;
++
++ /* do the printf() into the input buffer, put length in len */
++ size = (int)(state->size);
++ state->in[size - 1] = 0;
++#ifdef NO_vsnprintf
++# ifdef HAS_vsprintf_void
++ (void)vsprintf((char *)(state->in), format, va);
++ for (len = 0; len < size; len++)
++ if (state->in[len] == 0) break;
++# else
++ len = vsprintf((char *)(state->in), format, va);
++# endif
++#else
++# ifdef HAS_vsnprintf_void
++ (void)vsnprintf((char *)(state->in), size, format, va);
++ len = strlen((char *)(state->in));
++# else
++ len = vsnprintf((char *)(state->in), size, format, va);
++# endif
++#endif
++
++ /* check that printf() results fit in buffer */
++ if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
++ return 0;
++
++ /* update buffer and position, defer compression until needed */
++ strm->avail_in = (unsigned)len;
++ strm->next_in = state->in;
++ state->x.pos += len;
++ return len;
++}
++
++int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
++{
++ va_list va;
++ int ret;
++
++ va_start(va, format);
++ ret = gzvprintf(file, format, va);
++ va_end(va);
++ return ret;
++}
++
++#else /* !STDC && !Z_HAVE_STDARG_H */
++
++/* -- see zlib.h -- */
++int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
++ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
++ gzFile file;
++ const char *format;
++ int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
++ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
++{
++ int size, len;
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that can really pass pointer in ints */
++ if (sizeof(int) != sizeof(void *))
++ return 0;
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return 0;
++
++ /* make sure we have some buffer space */
++ if (state->size == 0 && gz_init(state) == -1)
++ return 0;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return 0;
++ }
++
++ /* consume whatever's left in the input buffer */
++ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
++ return 0;
++
++ /* do the printf() into the input buffer, put length in len */
++ size = (int)(state->size);
++ state->in[size - 1] = 0;
++#ifdef NO_snprintf
++# ifdef HAS_sprintf_void
++ sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
++ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
++ for (len = 0; len < size; len++)
++ if (state->in[len] == 0) break;
++# else
++ len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
++ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
++# endif
++#else
++# ifdef HAS_snprintf_void
++ snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
++ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
++ len = strlen((char *)(state->in));
++# else
++ len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
++ a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
++ a19, a20);
++# endif
++#endif
++
++ /* check that printf() results fit in buffer */
++ if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
++ return 0;
++
++ /* update buffer and position, defer compression until needed */
++ strm->avail_in = (unsigned)len;
++ strm->next_in = state->in;
++ state->x.pos += len;
++ return len;
++}
++
++#endif
++
++/* -- see zlib.h -- */
++int ZEXPORT gzflush(file, flush)
++ gzFile file;
++ int flush;
++{
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return -1;
++ state = (gz_statep)file;
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return Z_STREAM_ERROR;
++
++ /* check flush parameter */
++ if (flush < 0 || flush > Z_FINISH)
++ return Z_STREAM_ERROR;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return -1;
++ }
++
++ /* compress remaining data with requested flush */
++ gz_comp(state, flush);
++ return state->err;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzsetparams(file, level, strategy)
++ gzFile file;
++ int level;
++ int strategy;
++{
++ gz_statep state;
++ z_streamp strm;
++
++ /* get internal structure */
++ if (file == NULL)
++ return Z_STREAM_ERROR;
++ state = (gz_statep)file;
++ strm = &(state->strm);
++
++ /* check that we're writing and that there's no error */
++ if (state->mode != GZ_WRITE || state->err != Z_OK)
++ return Z_STREAM_ERROR;
++
++ /* if no change is requested, then do nothing */
++ if (level == state->level && strategy == state->strategy)
++ return Z_OK;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ return -1;
++ }
++
++ /* change compression parameters for subsequent input */
++ if (state->size) {
++ /* flush previous input with previous parameters before changing */
++ if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
++ return state->err;
++ deflateParams(strm, level, strategy);
++ }
++ state->level = level;
++ state->strategy = strategy;
++ return Z_OK;
++}
++
++/* -- see zlib.h -- */
++int ZEXPORT gzclose_w(file)
++ gzFile file;
++{
++ int ret = Z_OK;
++ gz_statep state;
++
++ /* get internal structure */
++ if (file == NULL)
++ return Z_STREAM_ERROR;
++ state = (gz_statep)file;
++
++ /* check that we're writing */
++ if (state->mode != GZ_WRITE)
++ return Z_STREAM_ERROR;
++
++ /* check for seek request */
++ if (state->seek) {
++ state->seek = 0;
++ if (gz_zero(state, state->skip) == -1)
++ ret = state->err;
++ }
++
++ /* flush, free memory, and close file */
++ if (gz_comp(state, Z_FINISH) == -1)
++ ret = state->err;
++ if (state->size) {
++ if (!state->direct) {
++ (void)deflateEnd(&(state->strm));
++ free(state->out);
++ }
++ free(state->in);
++ }
++ gz_error(state, Z_OK, NULL);
++ free(state->path);
++ if (close(state->fd) == -1)
++ ret = Z_ERRNO;
++ free(state);
++ return ret;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/infback.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,664 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* infback.c -- inflate using a call-back interface
++ * Copyright (C) 1995-2011 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/*
++ This code is largely copied from inflate.c. Normally either infback.o or
++ inflate.o would be linked into an application--not both. The interface
++ with inffast.c is retained so that optimized assembler-coded versions of
++ inflate_fast() can be used with either inflate.c or infback.c.
++ */
++
++#include "zutil.h"
++#include "inftrees.h"
++#include "inflate.h"
++#include "inffast.h"
++
++/* function prototypes */
++local void fixedtables OF((struct inflate_state FAR *state));
++
++/*
++ strm provides memory allocation functions in zalloc and zfree, or
++ Z_NULL to use the library memory allocation functions.
++
++ windowBits is in the range 8..15, and window is a user-supplied
++ window and output buffer that is 2**windowBits bytes.
++ */
++int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
++z_streamp strm;
++int windowBits;
++unsigned char FAR *window;
++const char *version;
++int stream_size;
++{
++ struct inflate_state FAR *state;
++
++ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
++ stream_size != (int)(sizeof(z_stream)))
++ return Z_VERSION_ERROR;
++ if (strm == Z_NULL || window == Z_NULL ||
++ windowBits < 8 || windowBits > 15)
++ return Z_STREAM_ERROR;
++ strm->msg = Z_NULL; /* in case we return an error */
++ if (strm->zalloc == (alloc_func)0) {
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zalloc = zcalloc;
++ strm->opaque = (voidpf)0;
++#endif
++ }
++ if (strm->zfree == (free_func)0)
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zfree = zcfree;
++#endif
++ state = (struct inflate_state FAR *)ZALLOC(strm, 1,
++ sizeof(struct inflate_state));
++ if (state == Z_NULL) return Z_MEM_ERROR;
++ Tracev((stderr, "inflate: allocated\n"));
++ strm->state = (struct internal_state FAR *)state;
++ state->dmax = 32768U;
++ state->wbits = windowBits;
++ state->wsize = 1U << windowBits;
++ state->window = window;
++ state->wnext = 0;
++ state->whave = 0;
++ return Z_OK;
++}
++
++/*
++ Return state with length and distance decoding tables and index sizes set to
++ fixed code decoding. Normally this returns fixed tables from inffixed.h.
++ If BUILDFIXED is defined, then instead this routine builds the tables the
++ first time it's called, and returns those tables the first time and
++ thereafter. This reduces the size of the code by about 2K bytes, in
++ exchange for a little execution time. However, BUILDFIXED should not be
++ used for threaded applications, since the rewriting of the tables and virgin
++ may not be thread-safe.
++ */
++local void fixedtables(state)
++struct inflate_state FAR *state;
++{
++#ifdef BUILDFIXED
++ static int virgin = 1;
++ static code *lenfix, *distfix;
++ static code fixed[544];
++
++ /* build fixed huffman tables if first call (may not be thread safe) */
++ if (virgin) {
++ unsigned sym, bits;
++ static code *next;
++
++ /* literal/length table */
++ sym = 0;
++ while (sym < 144) state->lens[sym++] = 8;
++ while (sym < 256) state->lens[sym++] = 9;
++ while (sym < 280) state->lens[sym++] = 7;
++ while (sym < 288) state->lens[sym++] = 8;
++ next = fixed;
++ lenfix = next;
++ bits = 9;
++ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
++
++ /* distance table */
++ sym = 0;
++ while (sym < 32) state->lens[sym++] = 5;
++ distfix = next;
++ bits = 5;
++ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
++
++ /* do this just once */
++ virgin = 0;
++ }
++#else /* !BUILDFIXED */
++# include "inffixed.h"
++#endif /* BUILDFIXED */
++ state->lencode = lenfix;
++ state->lenbits = 9;
++ state->distcode = distfix;
++ state->distbits = 5;
++}
++
++/* Macros for inflateBack(): */
++
++/* Load returned state from inflate_fast() */
++#define LOAD() \
++ do { \
++ put = strm->next_out; \
++ left = strm->avail_out; \
++ next = strm->next_in; \
++ have = strm->avail_in; \
++ hold = state->hold; \
++ bits = state->bits; \
++ } while (0)
++
++/* Set state from registers for inflate_fast() */
++#define RESTORE() \
++ do { \
++ strm->next_out = put; \
++ strm->avail_out = left; \
++ strm->next_in = next; \
++ strm->avail_in = have; \
++ state->hold = hold; \
++ state->bits = bits; \
++ } while (0)
++
++/* Clear the input bit accumulator */
++#define INITBITS() \
++ do { \
++ hold = 0; \
++ bits = 0; \
++ } while (0)
++
++/* Assure that some input is available. If input is requested, but denied,
++ then return a Z_BUF_ERROR from inflateBack(). */
++#define PULL() \
++ do { \
++ if (have == 0) { \
++ have = in(in_desc, &next); \
++ if (have == 0) { \
++ next = Z_NULL; \
++ ret = Z_BUF_ERROR; \
++ goto inf_leave; \
++ } \
++ } \
++ } while (0)
++
++/* Get a byte of input into the bit accumulator, or return from inflateBack()
++ with an error if there is no input available. */
++#define PULLBYTE() \
++ do { \
++ PULL(); \
++ have--; \
++ hold += (unsigned long)(*next++) << bits; \
++ bits += 8; \
++ } while (0)
++
++/* Assure that there are at least n bits in the bit accumulator. If there is
++ not enough available input to do that, then return from inflateBack() with
++ an error. */
++#define NEEDBITS(n) \
++ do { \
++ while (bits < (unsigned)(n)) \
++ PULLBYTE(); \
++ } while (0)
++
++/* Return the low n bits of the bit accumulator (n < 16) */
++#define BITS(n) \
++ ((unsigned)hold & ((1U << (n)) - 1))
++
++/* Remove n bits from the bit accumulator */
++#define DROPBITS(n) \
++ do { \
++ hold >>= (n); \
++ bits -= (unsigned)(n); \
++ } while (0)
++
++/* Remove zero to seven bits as needed to go to a byte boundary */
++#define BYTEBITS() \
++ do { \
++ hold >>= bits & 7; \
++ bits -= bits & 7; \
++ } while (0)
++
++/* Assure that some output space is available, by writing out the window
++ if it's full. If the write fails, return from inflateBack() with a
++ Z_BUF_ERROR. */
++#define ROOM() \
++ do { \
++ if (left == 0) { \
++ put = state->window; \
++ left = state->wsize; \
++ state->whave = left; \
++ if (out(out_desc, put, left)) { \
++ ret = Z_BUF_ERROR; \
++ goto inf_leave; \
++ } \
++ } \
++ } while (0)
++
++/*
++ strm provides the memory allocation functions and window buffer on input,
++ and provides information on the unused input on return. For Z_DATA_ERROR
++ returns, strm will also provide an error message.
++
++ in() and out() are the call-back input and output functions. When
++ inflateBack() needs more input, it calls in(). When inflateBack() has
++ filled the window with output, or when it completes with data in the
++ window, it calls out() to write out the data. The application must not
++ change the provided input until in() is called again or inflateBack()
++ returns. The application must not change the window/output buffer until
++ inflateBack() returns.
++
++ in() and out() are called with a descriptor parameter provided in the
++ inflateBack() call. This parameter can be a structure that provides the
++ information required to do the read or write, as well as accumulated
++ information on the input and output such as totals and check values.
++
++ in() should return zero on failure. out() should return non-zero on
++ failure. If either in() or out() fails, than inflateBack() returns a
++ Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
++ was in() or out() that caused in the error. Otherwise, inflateBack()
++ returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
++ error, or Z_MEM_ERROR if it could not allocate memory for the state.
++ inflateBack() can also return Z_STREAM_ERROR if the input parameters
++ are not correct, i.e. strm is Z_NULL or the state was not initialized.
++ */
++int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
++z_streamp strm;
++in_func in;
++void FAR *in_desc;
++out_func out;
++void FAR *out_desc;
++{
++ struct inflate_state FAR *state;
++ z_const unsigned char FAR *next; /* next input */
++ unsigned char FAR *put; /* next output */
++ unsigned have, left; /* available input and output */
++ unsigned long hold; /* bit buffer */
++ unsigned bits; /* bits in bit buffer */
++ unsigned copy; /* number of stored or match bytes to copy */
++ unsigned char FAR *from; /* where to copy match bytes from */
++ code here; /* current decoding table entry */
++ code last; /* parent table entry */
++ unsigned len; /* length to copy for repeats, bits to drop */
++ int ret; /* return code */
++ static const unsigned short order[19] = /* permutation of code lengths */
++ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
++
++ /* Check that the strm exists and that the state was initialized */
++ if (strm == Z_NULL || strm->state == Z_NULL)
++ return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++
++ /* Reset the state */
++ strm->msg = Z_NULL;
++ state->mode = TYPE;
++ state->last = 0;
++ state->whave = 0;
++ next = strm->next_in;
++ have = next != Z_NULL ? strm->avail_in : 0;
++ hold = 0;
++ bits = 0;
++ put = state->window;
++ left = state->wsize;
++
++ /* Inflate until end of block marked as last */
++ for (;;)
++ switch (state->mode) {
++ case TYPE:
++ /* determine and dispatch block type */
++ if (state->last) {
++ BYTEBITS();
++ state->mode = DONE;
++ break;
++ }
++ NEEDBITS(3);
++ state->last = BITS(1);
++ DROPBITS(1);
++ switch (BITS(2)) {
++ case 0: /* stored block */
++ Tracev((stderr, "inflate: stored block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = STORED;
++ break;
++ case 1: /* fixed block */
++ fixedtables(state);
++ Tracev((stderr, "inflate: fixed codes block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = LEN; /* decode codes */
++ break;
++ case 2: /* dynamic block */
++ Tracev((stderr, "inflate: dynamic codes block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = TABLE;
++ break;
++ case 3:
++ strm->msg = (char *)"invalid block type";
++ state->mode = BAD;
++ }
++ DROPBITS(2);
++ break;
++
++ case STORED:
++ /* get and verify stored block length */
++ BYTEBITS(); /* go to byte boundary */
++ NEEDBITS(32);
++ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
++ strm->msg = (char *)"invalid stored block lengths";
++ state->mode = BAD;
++ break;
++ }
++ state->length = (unsigned)hold & 0xffff;
++ Tracev((stderr, "inflate: stored length %u\n",
++ state->length));
++ INITBITS();
++
++ /* copy stored block from input to output */
++ while (state->length != 0) {
++ copy = state->length;
++ PULL();
++ ROOM();
++ if (copy > have) copy = have;
++ if (copy > left) copy = left;
++ zmemcpy(put, next, copy);
++ have -= copy;
++ next += copy;
++ left -= copy;
++ put += copy;
++ state->length -= copy;
++ }
++ Tracev((stderr, "inflate: stored end\n"));
++ state->mode = TYPE;
++ break;
++
++ case TABLE:
++ /* get dynamic table entries descriptor */
++ NEEDBITS(14);
++ state->nlen = BITS(5) + 257;
++ DROPBITS(5);
++ state->ndist = BITS(5) + 1;
++ DROPBITS(5);
++ state->ncode = BITS(4) + 4;
++ DROPBITS(4);
++#ifndef PKZIP_BUG_WORKAROUND
++ if (state->nlen > 286 || state->ndist > 30) {
++ strm->msg = (char *)"too many length or distance symbols";
++ state->mode = BAD;
++ break;
++ }
++#endif
++ Tracev((stderr, "inflate: table sizes ok\n"));
++
++ /* get code length code lengths (not a typo) */
++ state->have = 0;
++ while (state->have < state->ncode) {
++ NEEDBITS(3);
++ state->lens[order[state->have++]] = (unsigned short)BITS(3);
++ DROPBITS(3);
++ }
++ while (state->have < 19)
++ state->lens[order[state->have++]] = 0;
++ state->next = state->codes;
++ state->lencode = (code const FAR *)(state->next);
++ state->lenbits = 7;
++ ret = inflate_table(CODES, state->lens, 19, &(state->next),
++ &(state->lenbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid code lengths set";
++ state->mode = BAD;
++ break;
++ }
++ Tracev((stderr, "inflate: code lengths ok\n"));
++
++ /* get length and distance code code lengths */
++ state->have = 0;
++ while (state->have < state->nlen + state->ndist) {
++ for (;;) {
++ here = state->lencode[BITS(state->lenbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if (here.val < 16) {
++ DROPBITS(here.bits);
++ state->lens[state->have++] = here.val;
++ }
++ else {
++ if (here.val == 16) {
++ NEEDBITS(here.bits + 2);
++ DROPBITS(here.bits);
++ if (state->have == 0) {
++ strm->msg = (char *)"invalid bit length repeat";
++ state->mode = BAD;
++ break;
++ }
++ len = (unsigned)(state->lens[state->have - 1]);
++ copy = 3 + BITS(2);
++ DROPBITS(2);
++ }
++ else if (here.val == 17) {
++ NEEDBITS(here.bits + 3);
++ DROPBITS(here.bits);
++ len = 0;
++ copy = 3 + BITS(3);
++ DROPBITS(3);
++ }
++ else {
++ NEEDBITS(here.bits + 7);
++ DROPBITS(here.bits);
++ len = 0;
++ copy = 11 + BITS(7);
++ DROPBITS(7);
++ }
++ if (state->have + copy > state->nlen + state->ndist) {
++ strm->msg = (char *)"invalid bit length repeat";
++ state->mode = BAD;
++ break;
++ }
++ while (copy--)
++ state->lens[state->have++] = (unsigned short)len;
++ }
++ }
++
++ /* handle error breaks in while */
++ if (state->mode == BAD) break;
++
++ /* check for end-of-block code (better have one) */
++ if (state->lens[256] == 0) {
++ strm->msg = (char *)"invalid code -- missing end-of-block";
++ state->mode = BAD;
++ break;
++ }
++
++ /* build code tables -- note: do not change the lenbits or distbits
++ values here (9 and 6) without reading the comments in inftrees.h
++ concerning the ENOUGH constants, which depend on those values */
++ state->next = state->codes;
++ state->lencode = (code const FAR *)(state->next);
++ state->lenbits = 9;
++ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
++ &(state->lenbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid literal/lengths set";
++ state->mode = BAD;
++ break;
++ }
++ state->distcode = (code const FAR *)(state->next);
++ state->distbits = 6;
++ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
++ &(state->next), &(state->distbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid distances set";
++ state->mode = BAD;
++ break;
++ }
++ Tracev((stderr, "inflate: codes ok\n"));
++ state->mode = LEN;
++
++ case LEN:
++ /* use inflate_fast() if we have enough input and output */
++ if (have >= 6 && left >= 258) {
++ RESTORE();
++ if (state->whave < state->wsize)
++ state->whave = state->wsize - left;
++ inflate_fast(strm, state->wsize);
++ LOAD();
++ break;
++ }
++
++ /* get a literal, length, or end-of-block code */
++ for (;;) {
++ here = state->lencode[BITS(state->lenbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if (here.op && (here.op & 0xf0) == 0) {
++ last = here;
++ for (;;) {
++ here = state->lencode[last.val +
++ (BITS(last.bits + last.op) >> last.bits)];
++ if ((unsigned)(last.bits + here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ DROPBITS(last.bits);
++ }
++ DROPBITS(here.bits);
++ state->length = (unsigned)here.val;
++
++ /* process literal */
++ if (here.op == 0) {
++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
++ "inflate: literal '%c'\n" :
++ "inflate: literal 0x%02x\n", here.val));
++ ROOM();
++ *put++ = (unsigned char)(state->length);
++ left--;
++ state->mode = LEN;
++ break;
++ }
++
++ /* process end of block */
++ if (here.op & 32) {
++ Tracevv((stderr, "inflate: end of block\n"));
++ state->mode = TYPE;
++ break;
++ }
++
++ /* invalid code */
++ if (here.op & 64) {
++ strm->msg = (char *)"invalid literal/length code";
++ state->mode = BAD;
++ break;
++ }
++
++ /* length code -- get extra bits, if any */
++ state->extra = (unsigned)(here.op) & 15;
++ if (state->extra != 0) {
++ NEEDBITS(state->extra);
++ state->length += BITS(state->extra);
++ DROPBITS(state->extra);
++ }
++ Tracevv((stderr, "inflate: length %u\n", state->length));
++
++ /* get distance code */
++ for (;;) {
++ here = state->distcode[BITS(state->distbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if ((here.op & 0xf0) == 0) {
++ last = here;
++ for (;;) {
++ here = state->distcode[last.val +
++ (BITS(last.bits + last.op) >> last.bits)];
++ if ((unsigned)(last.bits + here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ DROPBITS(last.bits);
++ }
++ DROPBITS(here.bits);
++ if (here.op & 64) {
++ strm->msg = (char *)"invalid distance code";
++ state->mode = BAD;
++ break;
++ }
++ state->offset = (unsigned)here.val;
++
++ /* get distance extra bits, if any */
++ state->extra = (unsigned)(here.op) & 15;
++ if (state->extra != 0) {
++ NEEDBITS(state->extra);
++ state->offset += BITS(state->extra);
++ DROPBITS(state->extra);
++ }
++ if (state->offset > state->wsize - (state->whave < state->wsize ?
++ left : 0)) {
++ strm->msg = (char *)"invalid distance too far back";
++ state->mode = BAD;
++ break;
++ }
++ Tracevv((stderr, "inflate: distance %u\n", state->offset));
++
++ /* copy match from window to output */
++ do {
++ ROOM();
++ copy = state->wsize - state->offset;
++ if (copy < left) {
++ from = put + copy;
++ copy = left - copy;
++ }
++ else {
++ from = put - state->offset;
++ copy = left;
++ }
++ if (copy > state->length) copy = state->length;
++ state->length -= copy;
++ left -= copy;
++ do {
++ *put++ = *from++;
++ } while (--copy);
++ } while (state->length != 0);
++ break;
++
++ case DONE:
++ /* inflate stream terminated properly -- write leftover output */
++ ret = Z_STREAM_END;
++ if (left < state->wsize) {
++ if (out(out_desc, state->window, state->wsize - left))
++ ret = Z_BUF_ERROR;
++ }
++ goto inf_leave;
++
++ case BAD:
++ ret = Z_DATA_ERROR;
++ goto inf_leave;
++
++ default: /* can't happen, but makes compilers happy */
++ ret = Z_STREAM_ERROR;
++ goto inf_leave;
++ }
++
++ /* Return unused input */
++ inf_leave:
++ strm->next_in = next;
++ strm->avail_in = have;
++ return ret;
++}
++
++int ZEXPORT inflateBackEnd(strm)
++z_streamp strm;
++{
++ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
++ return Z_STREAM_ERROR;
++ ZFREE(strm, strm->state);
++ strm->state = Z_NULL;
++ Tracev((stderr, "inflate: end\n"));
++ return Z_OK;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inffast.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,364 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inffast.c -- fast decoding
++ * Copyright (C) 1995-2008, 2010, 2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "zutil.h"
++#include "inftrees.h"
++#include "inflate.h"
++#include "inffast.h"
++
++#ifndef ASMINF
++
++/* Allow machine dependent optimization for post-increment or pre-increment.
++ Based on testing to date,
++ Pre-increment preferred for:
++ - PowerPC G3 (Adler)
++ - MIPS R5000 (Randers-Pehrson)
++ Post-increment preferred for:
++ - none
++ No measurable difference:
++ - Pentium III (Anderson)
++ - M68060 (Nikl)
++ */
++#ifdef POSTINC
++# define OFF 0
++# define PUP(a) *(a)++
++#else
++# define OFF 1
++# define PUP(a) *++(a)
++#endif
++
++/*
++ Decode literal, length, and distance codes and write out the resulting
++ literal and match bytes until either not enough input or output is
++ available, an end-of-block is encountered, or a data error is encountered.
++ When large enough input and output buffers are supplied to inflate(), for
++ example, a 16K input buffer and a 64K output buffer, more than 95% of the
++ inflate execution time is spent in this routine.
++
++ Entry assumptions:
++
++ state->mode == LEN
++ strm->avail_in >= 6
++ strm->avail_out >= 258
++ start >= strm->avail_out
++ state->bits < 8
++
++ On return, state->mode is one of:
++
++ LEN -- ran out of enough output space or enough available input
++ TYPE -- reached end of block code, inflate() to interpret next block
++ BAD -- error in block data
++
++ Notes:
++
++ - The maximum input bits used by a length/distance pair is 15 bits for the
++ length code, 5 bits for the length extra, 15 bits for the distance code,
++ and 13 bits for the distance extra. This totals 48 bits, or six bytes.
++ Therefore if strm->avail_in >= 6, then there is enough input to avoid
++ checking for available input while decoding.
++
++ - The maximum bytes that a single length/distance pair can output is 258
++ bytes, which is the maximum length that can be coded. inflate_fast()
++ requires strm->avail_out >= 258 for each loop to avoid checking for
++ output space.
++ */
++void ZLIB_INTERNAL inflate_fast(strm, start)
++z_streamp strm;
++unsigned start; /* inflate()'s starting value for strm->avail_out */
++{
++ struct inflate_state FAR *state;
++ z_const unsigned char FAR *in; /* local strm->next_in */
++ z_const unsigned char FAR *last; /* have enough input while in < last */
++ unsigned char FAR *out; /* local strm->next_out */
++ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
++ unsigned char FAR *end; /* while out < end, enough space available */
++#ifdef INFLATE_STRICT
++ unsigned dmax; /* maximum distance from zlib header */
++#endif
++ unsigned wsize; /* window size or zero if not using window */
++ unsigned whave; /* valid bytes in the window */
++ unsigned wnext; /* window write index */
++ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
++ unsigned long hold; /* local strm->hold */
++ unsigned bits; /* local strm->bits */
++ code const FAR *lcode; /* local strm->lencode */
++ code const FAR *dcode; /* local strm->distcode */
++ unsigned lmask; /* mask for first level of length codes */
++ unsigned dmask; /* mask for first level of distance codes */
++ code here; /* retrieved table entry */
++ unsigned op; /* code bits, operation, extra bits, or */
++ /* window position, window bytes to copy */
++ unsigned len; /* match length, unused bytes */
++ unsigned dist; /* match distance */
++ unsigned char FAR *from; /* where to copy match from */
++
++ /* copy state to local variables */
++ state = (struct inflate_state FAR *)strm->state;
++ in = strm->next_in - OFF;
++ last = in + (strm->avail_in - 5);
++ out = strm->next_out - OFF;
++ beg = out - (start - strm->avail_out);
++ end = out + (strm->avail_out - 257);
++#ifdef INFLATE_STRICT
++ dmax = state->dmax;
++#endif
++ wsize = state->wsize;
++ whave = state->whave;
++ wnext = state->wnext;
++ window = state->window;
++ hold = state->hold;
++ bits = state->bits;
++ lcode = state->lencode;
++ dcode = state->distcode;
++ lmask = (1U << state->lenbits) - 1;
++ dmask = (1U << state->distbits) - 1;
++
++ /* decode literals and length/distances until end-of-block or not enough
++ input data or output space */
++ do {
++ if (bits < 15) {
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ }
++ here = lcode[hold & lmask];
++ dolen:
++ op = (unsigned)(here.bits);
++ hold >>= op;
++ bits -= op;
++ op = (unsigned)(here.op);
++ if (op == 0) { /* literal */
++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
++ "inflate: literal '%c'\n" :
++ "inflate: literal 0x%02x\n", here.val));
++ PUP(out) = (unsigned char)(here.val);
++ }
++ else if (op & 16) { /* length base */
++ len = (unsigned)(here.val);
++ op &= 15; /* number of extra bits */
++ if (op) {
++ if (bits < op) {
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ }
++ len += (unsigned)hold & ((1U << op) - 1);
++ hold >>= op;
++ bits -= op;
++ }
++ Tracevv((stderr, "inflate: length %u\n", len));
++ if (bits < 15) {
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ }
++ here = dcode[hold & dmask];
++ dodist:
++ op = (unsigned)(here.bits);
++ hold >>= op;
++ bits -= op;
++ op = (unsigned)(here.op);
++ if (op & 16) { /* distance base */
++ dist = (unsigned)(here.val);
++ op &= 15; /* number of extra bits */
++ if (bits < op) {
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ if (bits < op) {
++ hold += (unsigned long)(PUP(in)) << bits;
++ bits += 8;
++ }
++ }
++ dist += (unsigned)hold & ((1U << op) - 1);
++#ifdef INFLATE_STRICT
++ if (dist > dmax) {
++ strm->msg = (char *)"invalid distance too far back";
++ state->mode = BAD;
++ break;
++ }
++#endif
++ hold >>= op;
++ bits -= op;
++ Tracevv((stderr, "inflate: distance %u\n", dist));
++ op = (unsigned)(out - beg); /* max distance in output */
++ if (dist > op) { /* see if copy from window */
++ op = dist - op; /* distance back in window */
++ if (op > whave) {
++ if (state->sane) {
++ strm->msg =
++ (char *)"invalid distance too far back";
++ state->mode = BAD;
++ break;
++ }
++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
++ if (len <= op - whave) {
++ do {
++ PUP(out) = 0;
++ } while (--len);
++ continue;
++ }
++ len -= op - whave;
++ do {
++ PUP(out) = 0;
++ } while (--op > whave);
++ if (op == 0) {
++ from = out - dist;
++ do {
++ PUP(out) = PUP(from);
++ } while (--len);
++ continue;
++ }
++#endif
++ }
++ from = window - OFF;
++ if (wnext == 0) { /* very common case */
++ from += wsize - op;
++ if (op < len) { /* some from window */
++ len -= op;
++ do {
++ PUP(out) = PUP(from);
++ } while (--op);
++ from = out - dist; /* rest from output */
++ }
++ }
++ else if (wnext < op) { /* wrap around window */
++ from += wsize + wnext - op;
++ op -= wnext;
++ if (op < len) { /* some from end of window */
++ len -= op;
++ do {
++ PUP(out) = PUP(from);
++ } while (--op);
++ from = window - OFF;
++ if (wnext < len) { /* some from start of window */
++ op = wnext;
++ len -= op;
++ do {
++ PUP(out) = PUP(from);
++ } while (--op);
++ from = out - dist; /* rest from output */
++ }
++ }
++ }
++ else { /* contiguous in window */
++ from += wnext - op;
++ if (op < len) { /* some from window */
++ len -= op;
++ do {
++ PUP(out) = PUP(from);
++ } while (--op);
++ from = out - dist; /* rest from output */
++ }
++ }
++ while (len > 2) {
++ PUP(out) = PUP(from);
++ PUP(out) = PUP(from);
++ PUP(out) = PUP(from);
++ len -= 3;
++ }
++ if (len) {
++ PUP(out) = PUP(from);
++ if (len > 1)
++ PUP(out) = PUP(from);
++ }
++ }
++ else {
++ from = out - dist; /* copy direct from output */
++ do { /* minimum length is three */
++ PUP(out) = PUP(from);
++ PUP(out) = PUP(from);
++ PUP(out) = PUP(from);
++ len -= 3;
++ } while (len > 2);
++ if (len) {
++ PUP(out) = PUP(from);
++ if (len > 1)
++ PUP(out) = PUP(from);
++ }
++ }
++ }
++ else if ((op & 64) == 0) { /* 2nd level distance code */
++ here = dcode[here.val + (hold & ((1U << op) - 1))];
++ goto dodist;
++ }
++ else {
++ strm->msg = (char *)"invalid distance code";
++ state->mode = BAD;
++ break;
++ }
++ }
++ else if ((op & 64) == 0) { /* 2nd level length code */
++ here = lcode[here.val + (hold & ((1U << op) - 1))];
++ goto dolen;
++ }
++ else if (op & 32) { /* end-of-block */
++ Tracevv((stderr, "inflate: end of block\n"));
++ state->mode = TYPE;
++ break;
++ }
++ else {
++ strm->msg = (char *)"invalid literal/length code";
++ state->mode = BAD;
++ break;
++ }
++ } while (in < last && out < end);
++
++ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
++ len = bits >> 3;
++ in -= len;
++ bits -= len << 3;
++ hold &= (1U << bits) - 1;
++
++ /* update state and return */
++ strm->next_in = in + OFF;
++ strm->next_out = out + OFF;
++ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
++ strm->avail_out = (unsigned)(out < end ?
++ 257 + (end - out) : 257 - (out - end));
++ state->hold = hold;
++ state->bits = bits;
++ return;
++}
++
++/*
++ inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
++ - Using bit fields for code structure
++ - Different op definition to avoid & for extra bits (do & for table bits)
++ - Three separate decoding do-loops for direct, window, and wnext == 0
++ - Special case for distance > 1 copies to do overlapped load and store copy
++ - Explicit branch predictions (based on measured branch probabilities)
++ - Deferring match copy and interspersed it with decoding subsequent codes
++ - Swapping literal/length else
++ - Swapping window/direct else
++ - Larger unrolled copy loops (three is about right)
++ - Moving len -= 3 statement into middle of loop
++ */
++
++#endif /* !ASMINF */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inffast.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,35 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inffast.h -- header to use inffast.c
++ * Copyright (C) 1995-2003, 2010 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* WARNING: this file should *not* be used by applications. It is
++ part of the implementation of the compression library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inffixed.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,118 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++ /* inffixed.h -- table for decoding fixed codes
++ * Generated automatically by makefixed().
++ */
++
++ /* WARNING: this file should *not* be used by applications.
++ It is part of the implementation of this library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++ static const code lenfix[512] = {
++ {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
++ {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
++ {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
++ {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
++ {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
++ {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
++ {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
++ {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
++ {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
++ {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
++ {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
++ {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
++ {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
++ {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
++ {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
++ {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
++ {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
++ {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
++ {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
++ {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
++ {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
++ {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
++ {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
++ {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
++ {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
++ {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
++ {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
++ {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
++ {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
++ {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
++ {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
++ {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
++ {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
++ {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
++ {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
++ {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
++ {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
++ {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
++ {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
++ {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
++ {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
++ {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
++ {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
++ {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
++ {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
++ {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
++ {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
++ {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
++ {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
++ {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
++ {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
++ {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
++ {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
++ {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
++ {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
++ {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
++ {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
++ {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
++ {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
++ {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
++ {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
++ {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
++ {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
++ {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
++ {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
++ {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
++ {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
++ {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
++ {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
++ {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
++ {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
++ {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
++ {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
++ {0,9,255}
++ };
++
++ static const code distfix[32] = {
++ {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
++ {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
++ {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
++ {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
++ {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
++ {22,5,193},{64,5,0}
++ };
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inflate.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,1536 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inflate.c -- zlib decompression
++ * Copyright (C) 1995-2012 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/*
++ * Change history:
++ *
++ * 1.2.beta0 24 Nov 2002
++ * - First version -- complete rewrite of inflate to simplify code, avoid
++ * creation of window when not needed, minimize use of window when it is
++ * needed, make inffast.c even faster, implement gzip decoding, and to
++ * improve code readability and style over the previous zlib inflate code
++ *
++ * 1.2.beta1 25 Nov 2002
++ * - Use pointers for available input and output checking in inffast.c
++ * - Remove input and output counters in inffast.c
++ * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
++ * - Remove unnecessary second byte pull from length extra in inffast.c
++ * - Unroll direct copy to three copies per loop in inffast.c
++ *
++ * 1.2.beta2 4 Dec 2002
++ * - Change external routine names to reduce potential conflicts
++ * - Correct filename to inffixed.h for fixed tables in inflate.c
++ * - Make hbuf[] unsigned char to match parameter type in inflate.c
++ * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
++ * to avoid negation problem on Alphas (64 bit) in inflate.c
++ *
++ * 1.2.beta3 22 Dec 2002
++ * - Add comments on state->bits assertion in inffast.c
++ * - Add comments on op field in inftrees.h
++ * - Fix bug in reuse of allocated window after inflateReset()
++ * - Remove bit fields--back to byte structure for speed
++ * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
++ * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
++ * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
++ * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
++ * - Use local copies of stream next and avail values, as well as local bit
++ * buffer and bit count in inflate()--for speed when inflate_fast() not used
++ *
++ * 1.2.beta4 1 Jan 2003
++ * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
++ * - Move a comment on output buffer sizes from inffast.c to inflate.c
++ * - Add comments in inffast.c to introduce the inflate_fast() routine
++ * - Rearrange window copies in inflate_fast() for speed and simplification
++ * - Unroll last copy for window match in inflate_fast()
++ * - Use local copies of window variables in inflate_fast() for speed
++ * - Pull out common wnext == 0 case for speed in inflate_fast()
++ * - Make op and len in inflate_fast() unsigned for consistency
++ * - Add FAR to lcode and dcode declarations in inflate_fast()
++ * - Simplified bad distance check in inflate_fast()
++ * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
++ * source file infback.c to provide a call-back interface to inflate for
++ * programs like gzip and unzip -- uses window as output buffer to avoid
++ * window copying
++ *
++ * 1.2.beta5 1 Jan 2003
++ * - Improved inflateBack() interface to allow the caller to provide initial
++ * input in strm.
++ * - Fixed stored blocks bug in inflateBack()
++ *
++ * 1.2.beta6 4 Jan 2003
++ * - Added comments in inffast.c on effectiveness of POSTINC
++ * - Typecasting all around to reduce compiler warnings
++ * - Changed loops from while (1) or do {} while (1) to for (;;), again to
++ * make compilers happy
++ * - Changed type of window in inflateBackInit() to unsigned char *
++ *
++ * 1.2.beta7 27 Jan 2003
++ * - Changed many types to unsigned or unsigned short to avoid warnings
++ * - Added inflateCopy() function
++ *
++ * 1.2.0 9 Mar 2003
++ * - Changed inflateBack() interface to provide separate opaque descriptors
++ * for the in() and out() functions
++ * - Changed inflateBack() argument and in_func typedef to swap the length
++ * and buffer address return values for the input function
++ * - Check next_in and next_out for Z_NULL on entry to inflate()
++ *
++ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
++ */
++
++#include "zutil.h"
++#include "inftrees.h"
++#include "inflate.h"
++#include "inffast.h"
++
++#ifdef MAKEFIXED
++# ifndef BUILDFIXED
++# define BUILDFIXED
++# endif
++#endif
++
++/* function prototypes */
++local void fixedtables OF((struct inflate_state FAR *state));
++local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
++ unsigned copy));
++#ifdef BUILDFIXED
++ void makefixed OF((void));
++#endif
++local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
++ unsigned len));
++
++int ZEXPORT inflateResetKeep(strm)
++z_streamp strm;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ strm->total_in = strm->total_out = state->total = 0;
++ strm->msg = Z_NULL;
++ if (state->wrap) /* to support ill-conceived Java test suite */
++ strm->adler = state->wrap & 1;
++ state->mode = HEAD;
++ state->last = 0;
++ state->havedict = 0;
++ state->dmax = 32768U;
++ state->head = Z_NULL;
++ state->hold = 0;
++ state->bits = 0;
++ state->lencode = state->distcode = state->next = state->codes;
++ state->sane = 1;
++ state->back = -1;
++ Tracev((stderr, "inflate: reset\n"));
++ return Z_OK;
++}
++
++int ZEXPORT inflateReset(strm)
++z_streamp strm;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ state->wsize = 0;
++ state->whave = 0;
++ state->wnext = 0;
++ return inflateResetKeep(strm);
++}
++
++int ZEXPORT inflateReset2(strm, windowBits)
++z_streamp strm;
++int windowBits;
++{
++ int wrap;
++ struct inflate_state FAR *state;
++
++ /* get the state */
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++
++ /* extract wrap request from windowBits parameter */
++ if (windowBits < 0) {
++ wrap = 0;
++ windowBits = -windowBits;
++ }
++ else {
++ wrap = (windowBits >> 4) + 1;
++#ifdef GUNZIP
++ if (windowBits < 48)
++ windowBits &= 15;
++#endif
++ }
++
++ /* set number of window bits, free window if different */
++ if (windowBits && (windowBits < 8 || windowBits > 15))
++ return Z_STREAM_ERROR;
++ if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
++ ZFREE(strm, state->window);
++ state->window = Z_NULL;
++ }
++
++ /* update state and reset the rest of it */
++ state->wrap = wrap;
++ state->wbits = (unsigned)windowBits;
++ return inflateReset(strm);
++}
++
++int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
++z_streamp strm;
++int windowBits;
++const char *version;
++int stream_size;
++{
++ int ret;
++ struct inflate_state FAR *state;
++
++ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
++ stream_size != (int)(sizeof(z_stream)))
++ return Z_VERSION_ERROR;
++ if (strm == Z_NULL) return Z_STREAM_ERROR;
++ strm->msg = Z_NULL; /* in case we return an error */
++ if (strm->zalloc == (alloc_func)0) {
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zalloc = zcalloc;
++ strm->opaque = (voidpf)0;
++#endif
++ }
++ if (strm->zfree == (free_func)0)
++#ifdef Z_SOLO
++ return Z_STREAM_ERROR;
++#else
++ strm->zfree = zcfree;
++#endif
++ state = (struct inflate_state FAR *)
++ ZALLOC(strm, 1, sizeof(struct inflate_state));
++ if (state == Z_NULL) return Z_MEM_ERROR;
++ Tracev((stderr, "inflate: allocated\n"));
++ strm->state = (struct internal_state FAR *)state;
++ state->window = Z_NULL;
++ ret = inflateReset2(strm, windowBits);
++ if (ret != Z_OK) {
++ ZFREE(strm, state);
++ strm->state = Z_NULL;
++ }
++ return ret;
++}
++
++int ZEXPORT inflateInit_(strm, version, stream_size)
++z_streamp strm;
++const char *version;
++int stream_size;
++{
++ return inflateInit2_(strm, DEF_WBITS, version, stream_size);
++}
++
++int ZEXPORT inflatePrime(strm, bits, value)
++z_streamp strm;
++int bits;
++int value;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ if (bits < 0) {
++ state->hold = 0;
++ state->bits = 0;
++ return Z_OK;
++ }
++ if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
++ value &= (1L << bits) - 1;
++ state->hold += value << state->bits;
++ state->bits += bits;
++ return Z_OK;
++}
++
++/*
++ Return state with length and distance decoding tables and index sizes set to
++ fixed code decoding. Normally this returns fixed tables from inffixed.h.
++ If BUILDFIXED is defined, then instead this routine builds the tables the
++ first time it's called, and returns those tables the first time and
++ thereafter. This reduces the size of the code by about 2K bytes, in
++ exchange for a little execution time. However, BUILDFIXED should not be
++ used for threaded applications, since the rewriting of the tables and virgin
++ may not be thread-safe.
++ */
++local void fixedtables(state)
++struct inflate_state FAR *state;
++{
++#ifdef BUILDFIXED
++ static int virgin = 1;
++ static code *lenfix, *distfix;
++ static code fixed[544];
++
++ /* build fixed huffman tables if first call (may not be thread safe) */
++ if (virgin) {
++ unsigned sym, bits;
++ static code *next;
++
++ /* literal/length table */
++ sym = 0;
++ while (sym < 144) state->lens[sym++] = 8;
++ while (sym < 256) state->lens[sym++] = 9;
++ while (sym < 280) state->lens[sym++] = 7;
++ while (sym < 288) state->lens[sym++] = 8;
++ next = fixed;
++ lenfix = next;
++ bits = 9;
++ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
++
++ /* distance table */
++ sym = 0;
++ while (sym < 32) state->lens[sym++] = 5;
++ distfix = next;
++ bits = 5;
++ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
++
++ /* do this just once */
++ virgin = 0;
++ }
++#else /* !BUILDFIXED */
++# include "inffixed.h"
++#endif /* BUILDFIXED */
++ state->lencode = lenfix;
++ state->lenbits = 9;
++ state->distcode = distfix;
++ state->distbits = 5;
++}
++
++#ifdef MAKEFIXED
++#include <stdio.h>
++
++/*
++ Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
++ defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
++ those tables to stdout, which would be piped to inffixed.h. A small program
++ can simply call makefixed to do this:
++
++ void makefixed(void);
++
++ int main(void)
++ {
++ makefixed();
++ return 0;
++ }
++
++ Then that can be linked with zlib built with MAKEFIXED defined and run:
++
++ a.out > inffixed.h
++ */
++void makefixed()
++{
++ unsigned low, size;
++ struct inflate_state state;
++
++ fixedtables(&state);
++ puts(" /* inffixed.h -- table for decoding fixed codes");
++ puts(" * Generated automatically by makefixed().");
++ puts(" */");
++ puts("");
++ puts(" /* WARNING: this file should *not* be used by applications.");
++ puts(" It is part of the implementation of this library and is");
++ puts(" subject to change. Applications should only use zlib.h.");
++ puts(" */");
++ puts("");
++ size = 1U << 9;
++ printf(" static const code lenfix[%u] = {", size);
++ low = 0;
++ for (;;) {
++ if ((low % 7) == 0) printf("\n ");
++ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
++ state.lencode[low].bits, state.lencode[low].val);
++ if (++low == size) break;
++ putchar(',');
++ }
++ puts("\n };");
++ size = 1U << 5;
++ printf("\n static const code distfix[%u] = {", size);
++ low = 0;
++ for (;;) {
++ if ((low % 6) == 0) printf("\n ");
++ printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
++ state.distcode[low].val);
++ if (++low == size) break;
++ putchar(',');
++ }
++ puts("\n };");
++}
++#endif /* MAKEFIXED */
++
++/*
++ Update the window with the last wsize (normally 32K) bytes written before
++ returning. If window does not exist yet, create it. This is only called
++ when a window is already in use, or when output has been written during this
++ inflate call, but the end of the deflate stream has not been reached yet.
++ It is also called to create a window for dictionary data when a dictionary
++ is loaded.
++
++ Providing output buffers larger than 32K to inflate() should provide a speed
++ advantage, since only the last 32K of output is copied to the sliding window
++ upon return from inflate(), and since all distances after the first 32K of
++ output will fall in the output data, making match copies simpler and faster.
++ The advantage may be dependent on the size of the processor's data caches.
++ */
++local int updatewindow(strm, end, copy)
++z_streamp strm;
++const Bytef *end;
++unsigned copy;
++{
++ struct inflate_state FAR *state;
++ unsigned dist;
++
++ state = (struct inflate_state FAR *)strm->state;
++
++ /* if it hasn't been done already, allocate space for the window */
++ if (state->window == Z_NULL) {
++ state->window = (unsigned char FAR *)
++ ZALLOC(strm, 1U << state->wbits,
++ sizeof(unsigned char));
++ if (state->window == Z_NULL) return 1;
++ }
++
++ /* if window not in use yet, initialize */
++ if (state->wsize == 0) {
++ state->wsize = 1U << state->wbits;
++ state->wnext = 0;
++ state->whave = 0;
++ }
++
++ /* copy state->wsize or less output bytes into the circular window */
++ if (copy >= state->wsize) {
++ zmemcpy(state->window, end - state->wsize, state->wsize);
++ state->wnext = 0;
++ state->whave = state->wsize;
++ }
++ else {
++ dist = state->wsize - state->wnext;
++ if (dist > copy) dist = copy;
++ zmemcpy(state->window + state->wnext, end - copy, dist);
++ copy -= dist;
++ if (copy) {
++ zmemcpy(state->window, end - copy, copy);
++ state->wnext = copy;
++ state->whave = state->wsize;
++ }
++ else {
++ state->wnext += dist;
++ if (state->wnext == state->wsize) state->wnext = 0;
++ if (state->whave < state->wsize) state->whave += dist;
++ }
++ }
++ return 0;
++}
++
++/* Macros for inflate(): */
++
++/* check function to use adler32() for zlib or crc32() for gzip */
++#ifdef GUNZIP
++# define UPDATE(check, buf, len) \
++ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
++#else
++# define UPDATE(check, buf, len) adler32(check, buf, len)
++#endif
++
++/* check macros for header crc */
++#ifdef GUNZIP
++# define CRC2(check, word) \
++ do { \
++ hbuf[0] = (unsigned char)(word); \
++ hbuf[1] = (unsigned char)((word) >> 8); \
++ check = crc32(check, hbuf, 2); \
++ } while (0)
++
++# define CRC4(check, word) \
++ do { \
++ hbuf[0] = (unsigned char)(word); \
++ hbuf[1] = (unsigned char)((word) >> 8); \
++ hbuf[2] = (unsigned char)((word) >> 16); \
++ hbuf[3] = (unsigned char)((word) >> 24); \
++ check = crc32(check, hbuf, 4); \
++ } while (0)
++#endif
++
++/* Load registers with state in inflate() for speed */
++#define LOAD() \
++ do { \
++ put = strm->next_out; \
++ left = strm->avail_out; \
++ next = strm->next_in; \
++ have = strm->avail_in; \
++ hold = state->hold; \
++ bits = state->bits; \
++ } while (0)
++
++/* Restore state from registers in inflate() */
++#define RESTORE() \
++ do { \
++ strm->next_out = put; \
++ strm->avail_out = left; \
++ strm->next_in = next; \
++ strm->avail_in = have; \
++ state->hold = hold; \
++ state->bits = bits; \
++ } while (0)
++
++/* Clear the input bit accumulator */
++#define INITBITS() \
++ do { \
++ hold = 0; \
++ bits = 0; \
++ } while (0)
++
++/* Get a byte of input into the bit accumulator, or return from inflate()
++ if there is no input available. */
++#define PULLBYTE() \
++ do { \
++ if (have == 0) goto inf_leave; \
++ have--; \
++ hold += (unsigned long)(*next++) << bits; \
++ bits += 8; \
++ } while (0)
++
++/* Assure that there are at least n bits in the bit accumulator. If there is
++ not enough available input to do that, then return from inflate(). */
++#define NEEDBITS(n) \
++ do { \
++ while (bits < (unsigned)(n)) \
++ PULLBYTE(); \
++ } while (0)
++
++/* Return the low n bits of the bit accumulator (n < 16) */
++#define BITS(n) \
++ ((unsigned)hold & ((1U << (n)) - 1))
++
++/* Remove n bits from the bit accumulator */
++#define DROPBITS(n) \
++ do { \
++ hold >>= (n); \
++ bits -= (unsigned)(n); \
++ } while (0)
++
++/* Remove zero to seven bits as needed to go to a byte boundary */
++#define BYTEBITS() \
++ do { \
++ hold >>= bits & 7; \
++ bits -= bits & 7; \
++ } while (0)
++
++/*
++ inflate() uses a state machine to process as much input data and generate as
++ much output data as possible before returning. The state machine is
++ structured roughly as follows:
++
++ for (;;) switch (state) {
++ ...
++ case STATEn:
++ if (not enough input data or output space to make progress)
++ return;
++ ... make progress ...
++ state = STATEm;
++ break;
++ ...
++ }
++
++ so when inflate() is called again, the same case is attempted again, and
++ if the appropriate resources are provided, the machine proceeds to the
++ next state. The NEEDBITS() macro is usually the way the state evaluates
++ whether it can proceed or should return. NEEDBITS() does the return if
++ the requested bits are not available. The typical use of the BITS macros
++ is:
++
++ NEEDBITS(n);
++ ... do something with BITS(n) ...
++ DROPBITS(n);
++
++ where NEEDBITS(n) either returns from inflate() if there isn't enough
++ input left to load n bits into the accumulator, or it continues. BITS(n)
++ gives the low n bits in the accumulator. When done, DROPBITS(n) drops
++ the low n bits off the accumulator. INITBITS() clears the accumulator
++ and sets the number of available bits to zero. BYTEBITS() discards just
++ enough bits to put the accumulator on a byte boundary. After BYTEBITS()
++ and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
++
++ NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
++ if there is no input available. The decoding of variable length codes uses
++ PULLBYTE() directly in order to pull just enough bytes to decode the next
++ code, and no more.
++
++ Some states loop until they get enough input, making sure that enough
++ state information is maintained to continue the loop where it left off
++ if NEEDBITS() returns in the loop. For example, want, need, and keep
++ would all have to actually be part of the saved state in case NEEDBITS()
++ returns:
++
++ case STATEw:
++ while (want < need) {
++ NEEDBITS(n);
++ keep[want++] = BITS(n);
++ DROPBITS(n);
++ }
++ state = STATEx;
++ case STATEx:
++
++ As shown above, if the next state is also the next case, then the break
++ is omitted.
++
++ A state may also return if there is not enough output space available to
++ complete that state. Those states are copying stored data, writing a
++ literal byte, and copying a matching string.
++
++ When returning, a "goto inf_leave" is used to update the total counters,
++ update the check value, and determine whether any progress has been made
++ during that inflate() call in order to return the proper return code.
++ Progress is defined as a change in either strm->avail_in or strm->avail_out.
++ When there is a window, goto inf_leave will update the window with the last
++ output written. If a goto inf_leave occurs in the middle of decompression
++ and there is no window currently, goto inf_leave will create one and copy
++ output to the window for the next call of inflate().
++
++ In this implementation, the flush parameter of inflate() only affects the
++ return code (per zlib.h). inflate() always writes as much as possible to
++ strm->next_out, given the space available and the provided input--the effect
++ documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
++ the allocation of and copying into a sliding window until necessary, which
++ provides the effect documented in zlib.h for Z_FINISH when the entire input
++ stream available. So the only thing the flush parameter actually does is:
++ when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
++ will return Z_BUF_ERROR if it has not reached the end of the stream.
++ */
++
++int ZEXPORT inflate(strm, flush)
++z_streamp strm;
++int flush;
++{
++ struct inflate_state FAR *state;
++ z_const unsigned char FAR *next; /* next input */
++ unsigned char FAR *put; /* next output */
++ unsigned have, left; /* available input and output */
++ unsigned long hold; /* bit buffer */
++ unsigned bits; /* bits in bit buffer */
++ unsigned in, out; /* save starting available input and output */
++ unsigned copy; /* number of stored or match bytes to copy */
++ unsigned char FAR *from; /* where to copy match bytes from */
++ code here; /* current decoding table entry */
++ code last; /* parent table entry */
++ unsigned len; /* length to copy for repeats, bits to drop */
++ int ret; /* return code */
++#ifdef GUNZIP
++ unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
++#endif
++ static const unsigned short order[19] = /* permutation of code lengths */
++ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
++
++ if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
++ (strm->next_in == Z_NULL && strm->avail_in != 0))
++ return Z_STREAM_ERROR;
++
++ state = (struct inflate_state FAR *)strm->state;
++ if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
++ LOAD();
++ in = have;
++ out = left;
++ ret = Z_OK;
++ for (;;)
++ switch (state->mode) {
++ case HEAD:
++ if (state->wrap == 0) {
++ state->mode = TYPEDO;
++ break;
++ }
++ NEEDBITS(16);
++#ifdef GUNZIP
++ if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
++ state->check = crc32(0L, Z_NULL, 0);
++ CRC2(state->check, hold);
++ INITBITS();
++ state->mode = FLAGS;
++ break;
++ }
++ state->flags = 0; /* expect zlib header */
++ if (state->head != Z_NULL)
++ state->head->done = -1;
++ if (!(state->wrap & 1) || /* check if zlib header allowed */
++#else
++ if (
++#endif
++ ((BITS(8) << 8) + (hold >> 8)) % 31) {
++ strm->msg = (char *)"incorrect header check";
++ state->mode = BAD;
++ break;
++ }
++ if (BITS(4) != Z_DEFLATED) {
++ strm->msg = (char *)"unknown compression method";
++ state->mode = BAD;
++ break;
++ }
++ DROPBITS(4);
++ len = BITS(4) + 8;
++ if (state->wbits == 0)
++ state->wbits = len;
++ else if (len > state->wbits) {
++ strm->msg = (char *)"invalid window size";
++ state->mode = BAD;
++ break;
++ }
++ state->dmax = 1U << len;
++ Tracev((stderr, "inflate: zlib header ok\n"));
++ strm->adler = state->check = adler32(0L, Z_NULL, 0);
++ state->mode = hold & 0x200 ? DICTID : TYPE;
++ INITBITS();
++ break;
++#ifdef GUNZIP
++ case FLAGS:
++ NEEDBITS(16);
++ state->flags = (int)(hold);
++ if ((state->flags & 0xff) != Z_DEFLATED) {
++ strm->msg = (char *)"unknown compression method";
++ state->mode = BAD;
++ break;
++ }
++ if (state->flags & 0xe000) {
++ strm->msg = (char *)"unknown header flags set";
++ state->mode = BAD;
++ break;
++ }
++ if (state->head != Z_NULL)
++ state->head->text = (int)((hold >> 8) & 1);
++ if (state->flags & 0x0200) CRC2(state->check, hold);
++ INITBITS();
++ state->mode = TIME;
++ case TIME:
++ NEEDBITS(32);
++ if (state->head != Z_NULL)
++ state->head->time = hold;
++ if (state->flags & 0x0200) CRC4(state->check, hold);
++ INITBITS();
++ state->mode = OS;
++ case OS:
++ NEEDBITS(16);
++ if (state->head != Z_NULL) {
++ state->head->xflags = (int)(hold & 0xff);
++ state->head->os = (int)(hold >> 8);
++ }
++ if (state->flags & 0x0200) CRC2(state->check, hold);
++ INITBITS();
++ state->mode = EXLEN;
++ case EXLEN:
++ if (state->flags & 0x0400) {
++ NEEDBITS(16);
++ state->length = (unsigned)(hold);
++ if (state->head != Z_NULL)
++ state->head->extra_len = (unsigned)hold;
++ if (state->flags & 0x0200) CRC2(state->check, hold);
++ INITBITS();
++ }
++ else if (state->head != Z_NULL)
++ state->head->extra = Z_NULL;
++ state->mode = EXTRA;
++ case EXTRA:
++ if (state->flags & 0x0400) {
++ copy = state->length;
++ if (copy > have) copy = have;
++ if (copy) {
++ if (state->head != Z_NULL &&
++ state->head->extra != Z_NULL) {
++ len = state->head->extra_len - state->length;
++ zmemcpy(state->head->extra + len, next,
++ len + copy > state->head->extra_max ?
++ state->head->extra_max - len : copy);
++ }
++ if (state->flags & 0x0200)
++ state->check = crc32(state->check, next, copy);
++ have -= copy;
++ next += copy;
++ state->length -= copy;
++ }
++ if (state->length) goto inf_leave;
++ }
++ state->length = 0;
++ state->mode = NAME;
++ case NAME:
++ if (state->flags & 0x0800) {
++ if (have == 0) goto inf_leave;
++ copy = 0;
++ do {
++ len = (unsigned)(next[copy++]);
++ if (state->head != Z_NULL &&
++ state->head->name != Z_NULL &&
++ state->length < state->head->name_max)
++ state->head->name[state->length++] = len;
++ } while (len && copy < have);
++ if (state->flags & 0x0200)
++ state->check = crc32(state->check, next, copy);
++ have -= copy;
++ next += copy;
++ if (len) goto inf_leave;
++ }
++ else if (state->head != Z_NULL)
++ state->head->name = Z_NULL;
++ state->length = 0;
++ state->mode = COMMENT;
++ case COMMENT:
++ if (state->flags & 0x1000) {
++ if (have == 0) goto inf_leave;
++ copy = 0;
++ do {
++ len = (unsigned)(next[copy++]);
++ if (state->head != Z_NULL &&
++ state->head->comment != Z_NULL &&
++ state->length < state->head->comm_max)
++ state->head->comment[state->length++] = len;
++ } while (len && copy < have);
++ if (state->flags & 0x0200)
++ state->check = crc32(state->check, next, copy);
++ have -= copy;
++ next += copy;
++ if (len) goto inf_leave;
++ }
++ else if (state->head != Z_NULL)
++ state->head->comment = Z_NULL;
++ state->mode = HCRC;
++ case HCRC:
++ if (state->flags & 0x0200) {
++ NEEDBITS(16);
++ if (hold != (state->check & 0xffff)) {
++ strm->msg = (char *)"header crc mismatch";
++ state->mode = BAD;
++ break;
++ }
++ INITBITS();
++ }
++ if (state->head != Z_NULL) {
++ state->head->hcrc = (int)((state->flags >> 9) & 1);
++ state->head->done = 1;
++ }
++ strm->adler = state->check = crc32(0L, Z_NULL, 0);
++ state->mode = TYPE;
++ break;
++#endif
++ case DICTID:
++ NEEDBITS(32);
++ strm->adler = state->check = ZSWAP32(hold);
++ INITBITS();
++ state->mode = DICT;
++ case DICT:
++ if (state->havedict == 0) {
++ RESTORE();
++ return Z_NEED_DICT;
++ }
++ strm->adler = state->check = adler32(0L, Z_NULL, 0);
++ state->mode = TYPE;
++ case TYPE:
++ if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
++ case TYPEDO:
++ if (state->last) {
++ BYTEBITS();
++ state->mode = CHECK;
++ break;
++ }
++ NEEDBITS(3);
++ state->last = BITS(1);
++ DROPBITS(1);
++ switch (BITS(2)) {
++ case 0: /* stored block */
++ Tracev((stderr, "inflate: stored block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = STORED;
++ break;
++ case 1: /* fixed block */
++ fixedtables(state);
++ Tracev((stderr, "inflate: fixed codes block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = LEN_; /* decode codes */
++ if (flush == Z_TREES) {
++ DROPBITS(2);
++ goto inf_leave;
++ }
++ break;
++ case 2: /* dynamic block */
++ Tracev((stderr, "inflate: dynamic codes block%s\n",
++ state->last ? " (last)" : ""));
++ state->mode = TABLE;
++ break;
++ case 3:
++ strm->msg = (char *)"invalid block type";
++ state->mode = BAD;
++ }
++ DROPBITS(2);
++ break;
++ case STORED:
++ BYTEBITS(); /* go to byte boundary */
++ NEEDBITS(32);
++ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
++ strm->msg = (char *)"invalid stored block lengths";
++ state->mode = BAD;
++ break;
++ }
++ state->length = (unsigned)hold & 0xffff;
++ Tracev((stderr, "inflate: stored length %u\n",
++ state->length));
++ INITBITS();
++ state->mode = COPY_;
++ if (flush == Z_TREES) goto inf_leave;
++ case COPY_:
++ state->mode = COPY;
++ case COPY:
++ copy = state->length;
++ if (copy) {
++ if (copy > have) copy = have;
++ if (copy > left) copy = left;
++ if (copy == 0) goto inf_leave;
++ zmemcpy(put, next, copy);
++ have -= copy;
++ next += copy;
++ left -= copy;
++ put += copy;
++ state->length -= copy;
++ break;
++ }
++ Tracev((stderr, "inflate: stored end\n"));
++ state->mode = TYPE;
++ break;
++ case TABLE:
++ NEEDBITS(14);
++ state->nlen = BITS(5) + 257;
++ DROPBITS(5);
++ state->ndist = BITS(5) + 1;
++ DROPBITS(5);
++ state->ncode = BITS(4) + 4;
++ DROPBITS(4);
++#ifndef PKZIP_BUG_WORKAROUND
++ if (state->nlen > 286 || state->ndist > 30) {
++ strm->msg = (char *)"too many length or distance symbols";
++ state->mode = BAD;
++ break;
++ }
++#endif
++ Tracev((stderr, "inflate: table sizes ok\n"));
++ state->have = 0;
++ state->mode = LENLENS;
++ case LENLENS:
++ while (state->have < state->ncode) {
++ NEEDBITS(3);
++ state->lens[order[state->have++]] = (unsigned short)BITS(3);
++ DROPBITS(3);
++ }
++ while (state->have < 19)
++ state->lens[order[state->have++]] = 0;
++ state->next = state->codes;
++ state->lencode = (const code FAR *)(state->next);
++ state->lenbits = 7;
++ ret = inflate_table(CODES, state->lens, 19, &(state->next),
++ &(state->lenbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid code lengths set";
++ state->mode = BAD;
++ break;
++ }
++ Tracev((stderr, "inflate: code lengths ok\n"));
++ state->have = 0;
++ state->mode = CODELENS;
++ case CODELENS:
++ while (state->have < state->nlen + state->ndist) {
++ for (;;) {
++ here = state->lencode[BITS(state->lenbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if (here.val < 16) {
++ DROPBITS(here.bits);
++ state->lens[state->have++] = here.val;
++ }
++ else {
++ if (here.val == 16) {
++ NEEDBITS(here.bits + 2);
++ DROPBITS(here.bits);
++ if (state->have == 0) {
++ strm->msg = (char *)"invalid bit length repeat";
++ state->mode = BAD;
++ break;
++ }
++ len = state->lens[state->have - 1];
++ copy = 3 + BITS(2);
++ DROPBITS(2);
++ }
++ else if (here.val == 17) {
++ NEEDBITS(here.bits + 3);
++ DROPBITS(here.bits);
++ len = 0;
++ copy = 3 + BITS(3);
++ DROPBITS(3);
++ }
++ else {
++ NEEDBITS(here.bits + 7);
++ DROPBITS(here.bits);
++ len = 0;
++ copy = 11 + BITS(7);
++ DROPBITS(7);
++ }
++ if (state->have + copy > state->nlen + state->ndist) {
++ strm->msg = (char *)"invalid bit length repeat";
++ state->mode = BAD;
++ break;
++ }
++ while (copy--)
++ state->lens[state->have++] = (unsigned short)len;
++ }
++ }
++
++ /* handle error breaks in while */
++ if (state->mode == BAD) break;
++
++ /* check for end-of-block code (better have one) */
++ if (state->lens[256] == 0) {
++ strm->msg = (char *)"invalid code -- missing end-of-block";
++ state->mode = BAD;
++ break;
++ }
++
++ /* build code tables -- note: do not change the lenbits or distbits
++ values here (9 and 6) without reading the comments in inftrees.h
++ concerning the ENOUGH constants, which depend on those values */
++ state->next = state->codes;
++ state->lencode = (const code FAR *)(state->next);
++ state->lenbits = 9;
++ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
++ &(state->lenbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid literal/lengths set";
++ state->mode = BAD;
++ break;
++ }
++ state->distcode = (const code FAR *)(state->next);
++ state->distbits = 6;
++ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
++ &(state->next), &(state->distbits), state->work);
++ if (ret) {
++ strm->msg = (char *)"invalid distances set";
++ state->mode = BAD;
++ break;
++ }
++ Tracev((stderr, "inflate: codes ok\n"));
++ state->mode = LEN_;
++ if (flush == Z_TREES) goto inf_leave;
++ case LEN_:
++ state->mode = LEN;
++ case LEN:
++ if (have >= 6 && left >= 258) {
++ RESTORE();
++ inflate_fast(strm, out);
++ LOAD();
++ if (state->mode == TYPE)
++ state->back = -1;
++ break;
++ }
++ state->back = 0;
++ for (;;) {
++ here = state->lencode[BITS(state->lenbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if (here.op && (here.op & 0xf0) == 0) {
++ last = here;
++ for (;;) {
++ here = state->lencode[last.val +
++ (BITS(last.bits + last.op) >> last.bits)];
++ if ((unsigned)(last.bits + here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ DROPBITS(last.bits);
++ state->back += last.bits;
++ }
++ DROPBITS(here.bits);
++ state->back += here.bits;
++ state->length = (unsigned)here.val;
++ if ((int)(here.op) == 0) {
++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
++ "inflate: literal '%c'\n" :
++ "inflate: literal 0x%02x\n", here.val));
++ state->mode = LIT;
++ break;
++ }
++ if (here.op & 32) {
++ Tracevv((stderr, "inflate: end of block\n"));
++ state->back = -1;
++ state->mode = TYPE;
++ break;
++ }
++ if (here.op & 64) {
++ strm->msg = (char *)"invalid literal/length code";
++ state->mode = BAD;
++ break;
++ }
++ state->extra = (unsigned)(here.op) & 15;
++ state->mode = LENEXT;
++ case LENEXT:
++ if (state->extra) {
++ NEEDBITS(state->extra);
++ state->length += BITS(state->extra);
++ DROPBITS(state->extra);
++ state->back += state->extra;
++ }
++ Tracevv((stderr, "inflate: length %u\n", state->length));
++ state->was = state->length;
++ state->mode = DIST;
++ case DIST:
++ for (;;) {
++ here = state->distcode[BITS(state->distbits)];
++ if ((unsigned)(here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ if ((here.op & 0xf0) == 0) {
++ last = here;
++ for (;;) {
++ here = state->distcode[last.val +
++ (BITS(last.bits + last.op) >> last.bits)];
++ if ((unsigned)(last.bits + here.bits) <= bits) break;
++ PULLBYTE();
++ }
++ DROPBITS(last.bits);
++ state->back += last.bits;
++ }
++ DROPBITS(here.bits);
++ state->back += here.bits;
++ if (here.op & 64) {
++ strm->msg = (char *)"invalid distance code";
++ state->mode = BAD;
++ break;
++ }
++ state->offset = (unsigned)here.val;
++ state->extra = (unsigned)(here.op) & 15;
++ state->mode = DISTEXT;
++ case DISTEXT:
++ if (state->extra) {
++ NEEDBITS(state->extra);
++ state->offset += BITS(state->extra);
++ DROPBITS(state->extra);
++ state->back += state->extra;
++ }
++#ifdef INFLATE_STRICT
++ if (state->offset > state->dmax) {
++ strm->msg = (char *)"invalid distance too far back";
++ state->mode = BAD;
++ break;
++ }
++#endif
++ Tracevv((stderr, "inflate: distance %u\n", state->offset));
++ state->mode = MATCH;
++ case MATCH:
++ if (left == 0) goto inf_leave;
++ copy = out - left;
++ if (state->offset > copy) { /* copy from window */
++ copy = state->offset - copy;
++ if (copy > state->whave) {
++ if (state->sane) {
++ strm->msg = (char *)"invalid distance too far back";
++ state->mode = BAD;
++ break;
++ }
++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
++ Trace((stderr, "inflate.c too far\n"));
++ copy -= state->whave;
++ if (copy > state->length) copy = state->length;
++ if (copy > left) copy = left;
++ left -= copy;
++ state->length -= copy;
++ do {
++ *put++ = 0;
++ } while (--copy);
++ if (state->length == 0) state->mode = LEN;
++ break;
++#endif
++ }
++ if (copy > state->wnext) {
++ copy -= state->wnext;
++ from = state->window + (state->wsize - copy);
++ }
++ else
++ from = state->window + (state->wnext - copy);
++ if (copy > state->length) copy = state->length;
++ }
++ else { /* copy from output */
++ from = put - state->offset;
++ copy = state->length;
++ }
++ if (copy > left) copy = left;
++ left -= copy;
++ state->length -= copy;
++ do {
++ *put++ = *from++;
++ } while (--copy);
++ if (state->length == 0) state->mode = LEN;
++ break;
++ case LIT:
++ if (left == 0) goto inf_leave;
++ *put++ = (unsigned char)(state->length);
++ left--;
++ state->mode = LEN;
++ break;
++ case CHECK:
++ if (state->wrap) {
++ NEEDBITS(32);
++ out -= left;
++ strm->total_out += out;
++ state->total += out;
++ if (out)
++ strm->adler = state->check =
++ UPDATE(state->check, put - out, out);
++ out = left;
++ if ((
++#ifdef GUNZIP
++ state->flags ? hold :
++#endif
++ ZSWAP32(hold)) != state->check) {
++ strm->msg = (char *)"incorrect data check";
++ state->mode = BAD;
++ break;
++ }
++ INITBITS();
++ Tracev((stderr, "inflate: check matches trailer\n"));
++ }
++#ifdef GUNZIP
++ state->mode = LENGTH;
++ case LENGTH:
++ if (state->wrap && state->flags) {
++ NEEDBITS(32);
++ if (hold != (state->total & 0xffffffffUL)) {
++ strm->msg = (char *)"incorrect length check";
++ state->mode = BAD;
++ break;
++ }
++ INITBITS();
++ Tracev((stderr, "inflate: length matches trailer\n"));
++ }
++#endif
++ state->mode = DONE;
++ case DONE:
++ ret = Z_STREAM_END;
++ goto inf_leave;
++ case BAD:
++ ret = Z_DATA_ERROR;
++ goto inf_leave;
++ case MEM:
++ return Z_MEM_ERROR;
++ case SYNC:
++ default:
++ return Z_STREAM_ERROR;
++ }
++
++ /*
++ Return from inflate(), updating the total counts and the check value.
++ If there was no progress during the inflate() call, return a buffer
++ error. Call updatewindow() to create and/or update the window state.
++ Note: a memory error from inflate() is non-recoverable.
++ */
++ inf_leave:
++ RESTORE();
++ if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
++ (state->mode < CHECK || flush != Z_FINISH)))
++ if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
++ state->mode = MEM;
++ return Z_MEM_ERROR;
++ }
++ in -= strm->avail_in;
++ out -= strm->avail_out;
++ strm->total_in += in;
++ strm->total_out += out;
++ state->total += out;
++ if (state->wrap && out)
++ strm->adler = state->check =
++ UPDATE(state->check, strm->next_out - out, out);
++ strm->data_type = state->bits + (state->last ? 64 : 0) +
++ (state->mode == TYPE ? 128 : 0) +
++ (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
++ if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
++ ret = Z_BUF_ERROR;
++ return ret;
++}
++
++int ZEXPORT inflateEnd(strm)
++z_streamp strm;
++{
++ struct inflate_state FAR *state;
++ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
++ return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ if (state->window != Z_NULL) ZFREE(strm, state->window);
++ ZFREE(strm, strm->state);
++ strm->state = Z_NULL;
++ Tracev((stderr, "inflate: end\n"));
++ return Z_OK;
++}
++
++int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
++z_streamp strm;
++Bytef *dictionary;
++uInt *dictLength;
++{
++ struct inflate_state FAR *state;
++
++ /* check state */
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++
++ /* copy dictionary */
++ if (state->whave && dictionary != Z_NULL) {
++ zmemcpy(dictionary, state->window + state->wnext,
++ state->whave - state->wnext);
++ zmemcpy(dictionary + state->whave - state->wnext,
++ state->window, state->wnext);
++ }
++ if (dictLength != Z_NULL)
++ *dictLength = state->whave;
++ return Z_OK;
++}
++
++int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
++z_streamp strm;
++const Bytef *dictionary;
++uInt dictLength;
++{
++ struct inflate_state FAR *state;
++ unsigned long dictid;
++ int ret;
++
++ /* check state */
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ if (state->wrap != 0 && state->mode != DICT)
++ return Z_STREAM_ERROR;
++
++ /* check for correct dictionary identifier */
++ if (state->mode == DICT) {
++ dictid = adler32(0L, Z_NULL, 0);
++ dictid = adler32(dictid, dictionary, dictLength);
++ if (dictid != state->check)
++ return Z_DATA_ERROR;
++ }
++
++ /* copy dictionary to window using updatewindow(), which will amend the
++ existing dictionary if appropriate */
++ ret = updatewindow(strm, dictionary + dictLength, dictLength);
++ if (ret) {
++ state->mode = MEM;
++ return Z_MEM_ERROR;
++ }
++ state->havedict = 1;
++ Tracev((stderr, "inflate: dictionary set\n"));
++ return Z_OK;
++}
++
++int ZEXPORT inflateGetHeader(strm, head)
++z_streamp strm;
++gz_headerp head;
++{
++ struct inflate_state FAR *state;
++
++ /* check state */
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
++
++ /* save header structure */
++ state->head = head;
++ head->done = 0;
++ return Z_OK;
++}
++
++/*
++ Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
++ or when out of input. When called, *have is the number of pattern bytes
++ found in order so far, in 0..3. On return *have is updated to the new
++ state. If on return *have equals four, then the pattern was found and the
++ return value is how many bytes were read including the last byte of the
++ pattern. If *have is less than four, then the pattern has not been found
++ yet and the return value is len. In the latter case, syncsearch() can be
++ called again with more data and the *have state. *have is initialized to
++ zero for the first call.
++ */
++local unsigned syncsearch(have, buf, len)
++unsigned FAR *have;
++const unsigned char FAR *buf;
++unsigned len;
++{
++ unsigned got;
++ unsigned next;
++
++ got = *have;
++ next = 0;
++ while (next < len && got < 4) {
++ if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
++ got++;
++ else if (buf[next])
++ got = 0;
++ else
++ got = 4 - got;
++ next++;
++ }
++ *have = got;
++ return next;
++}
++
++int ZEXPORT inflateSync(strm)
++z_streamp strm;
++{
++ unsigned len; /* number of bytes to look at or looked at */
++ unsigned long in, out; /* temporary to save total_in and total_out */
++ unsigned char buf[4]; /* to restore bit buffer to byte string */
++ struct inflate_state FAR *state;
++
++ /* check parameters */
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
++
++ /* if first time, start search in bit buffer */
++ if (state->mode != SYNC) {
++ state->mode = SYNC;
++ state->hold <<= state->bits & 7;
++ state->bits -= state->bits & 7;
++ len = 0;
++ while (state->bits >= 8) {
++ buf[len++] = (unsigned char)(state->hold);
++ state->hold >>= 8;
++ state->bits -= 8;
++ }
++ state->have = 0;
++ syncsearch(&(state->have), buf, len);
++ }
++
++ /* search available input */
++ len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
++ strm->avail_in -= len;
++ strm->next_in += len;
++ strm->total_in += len;
++
++ /* return no joy or set up to restart inflate() on a new block */
++ if (state->have != 4) return Z_DATA_ERROR;
++ in = strm->total_in; out = strm->total_out;
++ inflateReset(strm);
++ strm->total_in = in; strm->total_out = out;
++ state->mode = TYPE;
++ return Z_OK;
++}
++
++/*
++ Returns true if inflate is currently at the end of a block generated by
++ Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
++ implementation to provide an additional safety check. PPP uses
++ Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
++ block. When decompressing, PPP checks that at the end of input packet,
++ inflate is waiting for these length bytes.
++ */
++int ZEXPORT inflateSyncPoint(strm)
++z_streamp strm;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ return state->mode == STORED && state->bits == 0;
++}
++
++int ZEXPORT inflateCopy(dest, source)
++z_streamp dest;
++z_streamp source;
++{
++ struct inflate_state FAR *state;
++ struct inflate_state FAR *copy;
++ unsigned char FAR *window;
++ unsigned wsize;
++
++ /* check input */
++ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
++ source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
++ return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)source->state;
++
++ /* allocate space */
++ copy = (struct inflate_state FAR *)
++ ZALLOC(source, 1, sizeof(struct inflate_state));
++ if (copy == Z_NULL) return Z_MEM_ERROR;
++ window = Z_NULL;
++ if (state->window != Z_NULL) {
++ window = (unsigned char FAR *)
++ ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
++ if (window == Z_NULL) {
++ ZFREE(source, copy);
++ return Z_MEM_ERROR;
++ }
++ }
++
++ /* copy state */
++ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
++ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
++ if (state->lencode >= state->codes &&
++ state->lencode <= state->codes + ENOUGH - 1) {
++ copy->lencode = copy->codes + (state->lencode - state->codes);
++ copy->distcode = copy->codes + (state->distcode - state->codes);
++ }
++ copy->next = copy->codes + (state->next - state->codes);
++ if (window != Z_NULL) {
++ wsize = 1U << state->wbits;
++ zmemcpy(window, state->window, wsize);
++ }
++ copy->window = window;
++ dest->state = (struct internal_state FAR *)copy;
++ return Z_OK;
++}
++
++int ZEXPORT inflateUndermine(strm, subvert)
++z_streamp strm;
++int subvert;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
++ state = (struct inflate_state FAR *)strm->state;
++ state->sane = !subvert;
++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
++ return Z_OK;
++#else
++ state->sane = 1;
++ return Z_DATA_ERROR;
++#endif
++}
++
++long ZEXPORT inflateMark(strm)
++z_streamp strm;
++{
++ struct inflate_state FAR *state;
++
++ if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
++ state = (struct inflate_state FAR *)strm->state;
++ return ((long)(state->back) << 16) +
++ (state->mode == COPY ? state->length :
++ (state->mode == MATCH ? state->was - state->length : 0));
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inflate.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,146 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inflate.h -- internal inflate state definition
++ * Copyright (C) 1995-2009 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* WARNING: this file should *not* be used by applications. It is
++ part of the implementation of the compression library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++/* define NO_GZIP when compiling if you want to disable gzip header and
++ trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
++ the crc code when it is not needed. For shared libraries, gzip decoding
++ should be left enabled. */
++#ifndef NO_GZIP
++# define GUNZIP
++#endif
++
++/* Possible inflate modes between inflate() calls */
++typedef enum {
++ HEAD, /* i: waiting for magic header */
++ FLAGS, /* i: waiting for method and flags (gzip) */
++ TIME, /* i: waiting for modification time (gzip) */
++ OS, /* i: waiting for extra flags and operating system (gzip) */
++ EXLEN, /* i: waiting for extra length (gzip) */
++ EXTRA, /* i: waiting for extra bytes (gzip) */
++ NAME, /* i: waiting for end of file name (gzip) */
++ COMMENT, /* i: waiting for end of comment (gzip) */
++ HCRC, /* i: waiting for header crc (gzip) */
++ DICTID, /* i: waiting for dictionary check value */
++ DICT, /* waiting for inflateSetDictionary() call */
++ TYPE, /* i: waiting for type bits, including last-flag bit */
++ TYPEDO, /* i: same, but skip check to exit inflate on new block */
++ STORED, /* i: waiting for stored size (length and complement) */
++ COPY_, /* i/o: same as COPY below, but only first time in */
++ COPY, /* i/o: waiting for input or output to copy stored block */
++ TABLE, /* i: waiting for dynamic block table lengths */
++ LENLENS, /* i: waiting for code length code lengths */
++ CODELENS, /* i: waiting for length/lit and distance code lengths */
++ LEN_, /* i: same as LEN below, but only first time in */
++ LEN, /* i: waiting for length/lit/eob code */
++ LENEXT, /* i: waiting for length extra bits */
++ DIST, /* i: waiting for distance code */
++ DISTEXT, /* i: waiting for distance extra bits */
++ MATCH, /* o: waiting for output space to copy string */
++ LIT, /* o: waiting for output space to write literal */
++ CHECK, /* i: waiting for 32-bit check value */
++ LENGTH, /* i: waiting for 32-bit length (gzip) */
++ DONE, /* finished check, done -- remain here until reset */
++ BAD, /* got a data error -- remain here until reset */
++ MEM, /* got an inflate() memory error -- remain here until reset */
++ SYNC /* looking for synchronization bytes to restart inflate() */
++} inflate_mode;
++
++/*
++ State transitions between above modes -
++
++ (most modes can go to BAD or MEM on error -- not shown for clarity)
++
++ Process header:
++ HEAD -> (gzip) or (zlib) or (raw)
++ (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
++ HCRC -> TYPE
++ (zlib) -> DICTID or TYPE
++ DICTID -> DICT -> TYPE
++ (raw) -> TYPEDO
++ Read deflate blocks:
++ TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
++ STORED -> COPY_ -> COPY -> TYPE
++ TABLE -> LENLENS -> CODELENS -> LEN_
++ LEN_ -> LEN
++ Read deflate codes in fixed or dynamic block:
++ LEN -> LENEXT or LIT or TYPE
++ LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
++ LIT -> LEN
++ Process trailer:
++ CHECK -> LENGTH -> DONE
++ */
++
++/* state maintained between inflate() calls. Approximately 10K bytes. */
++struct inflate_state {
++ inflate_mode mode; /* current inflate mode */
++ int last; /* true if processing last block */
++ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
++ int havedict; /* true if dictionary provided */
++ int flags; /* gzip header method and flags (0 if zlib) */
++ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
++ unsigned long check; /* protected copy of check value */
++ unsigned long total; /* protected copy of output count */
++ gz_headerp head; /* where to save gzip header information */
++ /* sliding window */
++ unsigned wbits; /* log base 2 of requested window size */
++ unsigned wsize; /* window size or zero if not using window */
++ unsigned whave; /* valid bytes in the window */
++ unsigned wnext; /* window write index */
++ unsigned char FAR *window; /* allocated sliding window, if needed */
++ /* bit accumulator */
++ unsigned long hold; /* input bit accumulator */
++ unsigned bits; /* number of bits in "in" */
++ /* for string and stored block copying */
++ unsigned length; /* literal or length of data to copy */
++ unsigned offset; /* distance back to copy string from */
++ /* for table and code decoding */
++ unsigned extra; /* extra bits needed */
++ /* fixed and dynamic code tables */
++ code const FAR *lencode; /* starting table for length/literal codes */
++ code const FAR *distcode; /* starting table for distance codes */
++ unsigned lenbits; /* index bits for lencode */
++ unsigned distbits; /* index bits for distcode */
++ /* dynamic table building */
++ unsigned ncode; /* number of code length code lengths */
++ unsigned nlen; /* number of length code lengths */
++ unsigned ndist; /* number of distance code lengths */
++ unsigned have; /* number of code lengths in lens[] */
++ code FAR *next; /* next available space in codes[] */
++ unsigned short lens[320]; /* temporary storage for code lengths */
++ unsigned short work[288]; /* work area for code table building */
++ code codes[ENOUGH]; /* space for code tables */
++ int sane; /* if false, allow invalid distance too far */
++ int back; /* bits back of last unprocessed length/lit */
++ unsigned was; /* initial length of match */
++};
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inftrees.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,330 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inftrees.c -- generate Huffman trees for efficient decoding
++ * Copyright (C) 1995-2013 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++#include "zutil.h"
++#include "inftrees.h"
++
++#define MAXBITS 15
++
++const char inflate_copyright[] =
++ " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
++/*
++ If you use the zlib library in a product, an acknowledgment is welcome
++ in the documentation of your product. If for some reason you cannot
++ include such an acknowledgment, I would appreciate that you keep this
++ copyright string in the executable of your product.
++ */
++
++/*
++ Build a set of tables to decode the provided canonical Huffman code.
++ The code lengths are lens[0..codes-1]. The result starts at *table,
++ whose indices are 0..2^bits-1. work is a writable array of at least
++ lens shorts, which is used as a work area. type is the type of code
++ to be generated, CODES, LENS, or DISTS. On return, zero is success,
++ -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
++ on return points to the next available entry's address. bits is the
++ requested root table index bits, and on return it is the actual root
++ table index bits. It will differ if the request is greater than the
++ longest code or if it is less than the shortest code.
++ */
++int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
++codetype type;
++unsigned short FAR *lens;
++unsigned codes;
++code FAR * FAR *table;
++unsigned FAR *bits;
++unsigned short FAR *work;
++{
++ unsigned len; /* a code's length in bits */
++ unsigned sym; /* index of code symbols */
++ unsigned min, max; /* minimum and maximum code lengths */
++ unsigned root; /* number of index bits for root table */
++ unsigned curr; /* number of index bits for current table */
++ unsigned drop; /* code bits to drop for sub-table */
++ int left; /* number of prefix codes available */
++ unsigned used; /* code entries in table used */
++ unsigned huff; /* Huffman code */
++ unsigned incr; /* for incrementing code, index */
++ unsigned fill; /* index for replicating entries */
++ unsigned low; /* low bits for current root entry */
++ unsigned mask; /* mask for low root bits */
++ code here; /* table entry for duplication */
++ code FAR *next; /* next available space in table */
++ const unsigned short FAR *base; /* base value table to use */
++ const unsigned short FAR *extra; /* extra bits table to use */
++ int end; /* use base and extra for symbol > end */
++ unsigned short count[MAXBITS+1]; /* number of codes of each length */
++ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
++ static const unsigned short lbase[31] = { /* Length codes 257..285 base */
++ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
++ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
++ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
++ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
++ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
++ static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
++ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
++ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
++ 8193, 12289, 16385, 24577, 0, 0};
++ static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
++ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
++ 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
++ 28, 28, 29, 29, 64, 64};
++
++ /*
++ Process a set of code lengths to create a canonical Huffman code. The
++ code lengths are lens[0..codes-1]. Each length corresponds to the
++ symbols 0..codes-1. The Huffman code is generated by first sorting the
++ symbols by length from short to long, and retaining the symbol order
++ for codes with equal lengths. Then the code starts with all zero bits
++ for the first code of the shortest length, and the codes are integer
++ increments for the same length, and zeros are appended as the length
++ increases. For the deflate format, these bits are stored backwards
++ from their more natural integer increment ordering, and so when the
++ decoding tables are built in the large loop below, the integer codes
++ are incremented backwards.
++
++ This routine assumes, but does not check, that all of the entries in
++ lens[] are in the range 0..MAXBITS. The caller must assure this.
++ 1..MAXBITS is interpreted as that code length. zero means that that
++ symbol does not occur in this code.
++
++ The codes are sorted by computing a count of codes for each length,
++ creating from that a table of starting indices for each length in the
++ sorted table, and then entering the symbols in order in the sorted
++ table. The sorted table is work[], with that space being provided by
++ the caller.
++
++ The length counts are used for other purposes as well, i.e. finding
++ the minimum and maximum length codes, determining if there are any
++ codes at all, checking for a valid set of lengths, and looking ahead
++ at length counts to determine sub-table sizes when building the
++ decoding tables.
++ */
++
++ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
++ for (len = 0; len <= MAXBITS; len++)
++ count[len] = 0;
++ for (sym = 0; sym < codes; sym++)
++ count[lens[sym]]++;
++
++ /* bound code lengths, force root to be within code lengths */
++ root = *bits;
++ for (max = MAXBITS; max >= 1; max--)
++ if (count[max] != 0) break;
++ if (root > max) root = max;
++ if (max == 0) { /* no symbols to code at all */
++ here.op = (unsigned char)64; /* invalid code marker */
++ here.bits = (unsigned char)1;
++ here.val = (unsigned short)0;
++ *(*table)++ = here; /* make a table to force an error */
++ *(*table)++ = here;
++ *bits = 1;
++ return 0; /* no symbols, but wait for decoding to report error */
++ }
++ for (min = 1; min < max; min++)
++ if (count[min] != 0) break;
++ if (root < min) root = min;
++
++ /* check for an over-subscribed or incomplete set of lengths */
++ left = 1;
++ for (len = 1; len <= MAXBITS; len++) {
++ left <<= 1;
++ left -= count[len];
++ if (left < 0) return -1; /* over-subscribed */
++ }
++ if (left > 0 && (type == CODES || max != 1))
++ return -1; /* incomplete set */
++
++ /* generate offsets into symbol table for each length for sorting */
++ offs[1] = 0;
++ for (len = 1; len < MAXBITS; len++)
++ offs[len + 1] = offs[len] + count[len];
++
++ /* sort symbols by length, by symbol order within each length */
++ for (sym = 0; sym < codes; sym++)
++ if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
++
++ /*
++ Create and fill in decoding tables. In this loop, the table being
++ filled is at next and has curr index bits. The code being used is huff
++ with length len. That code is converted to an index by dropping drop
++ bits off of the bottom. For codes where len is less than drop + curr,
++ those top drop + curr - len bits are incremented through all values to
++ fill the table with replicated entries.
++
++ root is the number of index bits for the root table. When len exceeds
++ root, sub-tables are created pointed to by the root entry with an index
++ of the low root bits of huff. This is saved in low to check for when a
++ new sub-table should be started. drop is zero when the root table is
++ being filled, and drop is root when sub-tables are being filled.
++
++ When a new sub-table is needed, it is necessary to look ahead in the
++ code lengths to determine what size sub-table is needed. The length
++ counts are used for this, and so count[] is decremented as codes are
++ entered in the tables.
++
++ used keeps track of how many table entries have been allocated from the
++ provided *table space. It is checked for LENS and DIST tables against
++ the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
++ the initial root table size constants. See the comments in inftrees.h
++ for more information.
++
++ sym increments through all symbols, and the loop terminates when
++ all codes of length max, i.e. all codes, have been processed. This
++ routine permits incomplete codes, so another loop after this one fills
++ in the rest of the decoding tables with invalid code markers.
++ */
++
++ /* set up for code type */
++ switch (type) {
++ case CODES:
++ base = extra = work; /* dummy value--not used */
++ end = 19;
++ break;
++ case LENS:
++ base = lbase;
++ base -= 257;
++ extra = lext;
++ extra -= 257;
++ end = 256;
++ break;
++ default: /* DISTS */
++ base = dbase;
++ extra = dext;
++ end = -1;
++ }
++
++ /* initialize state for loop */
++ huff = 0; /* starting code */
++ sym = 0; /* starting code symbol */
++ len = min; /* starting code length */
++ next = *table; /* current table to fill in */
++ curr = root; /* current table index bits */
++ drop = 0; /* current bits to drop from code for index */
++ low = (unsigned)(-1); /* trigger new sub-table when len > root */
++ used = 1U << root; /* use root table entries */
++ mask = used - 1; /* mask for comparing low */
++
++ /* check available table space */
++ if ((type == LENS && used > ENOUGH_LENS) ||
++ (type == DISTS && used > ENOUGH_DISTS))
++ return 1;
++
++ /* process all codes and make table entries */
++ for (;;) {
++ /* create table entry */
++ here.bits = (unsigned char)(len - drop);
++ if ((int)(work[sym]) < end) {
++ here.op = (unsigned char)0;
++ here.val = work[sym];
++ }
++ else if ((int)(work[sym]) > end) {
++ here.op = (unsigned char)(extra[work[sym]]);
++ here.val = base[work[sym]];
++ }
++ else {
++ here.op = (unsigned char)(32 + 64); /* end of block */
++ here.val = 0;
++ }
++
++ /* replicate for those indices with low len bits equal to huff */
++ incr = 1U << (len - drop);
++ fill = 1U << curr;
++ min = fill; /* save offset to next table */
++ do {
++ fill -= incr;
++ next[(huff >> drop) + fill] = here;
++ } while (fill != 0);
++
++ /* backwards increment the len-bit code huff */
++ incr = 1U << (len - 1);
++ while (huff & incr)
++ incr >>= 1;
++ if (incr != 0) {
++ huff &= incr - 1;
++ huff += incr;
++ }
++ else
++ huff = 0;
++
++ /* go to next symbol, update count, len */
++ sym++;
++ if (--(count[len]) == 0) {
++ if (len == max) break;
++ len = lens[work[sym]];
++ }
++
++ /* create new sub-table if needed */
++ if (len > root && (huff & mask) != low) {
++ /* if first time, transition to sub-tables */
++ if (drop == 0)
++ drop = root;
++
++ /* increment past last table */
++ next += min; /* here min is 1 << curr */
++
++ /* determine length of next table */
++ curr = len - drop;
++ left = (int)(1 << curr);
++ while (curr + drop < max) {
++ left -= count[curr + drop];
++ if (left <= 0) break;
++ curr++;
++ left <<= 1;
++ }
++
++ /* check for enough space */
++ used += 1U << curr;
++ if ((type == LENS && used > ENOUGH_LENS) ||
++ (type == DISTS && used > ENOUGH_DISTS))
++ return 1;
++
++ /* point entry in root table to sub-table */
++ low = huff & mask;
++ (*table)[low].op = (unsigned char)curr;
++ (*table)[low].bits = (unsigned char)root;
++ (*table)[low].val = (unsigned short)(next - *table);
++ }
++ }
++
++ /* fill in remaining table entry if code is incomplete (guaranteed to have
++ at most one remaining entry, since if the code is incomplete, the
++ maximum code length that was allowed to get this far is one bit) */
++ if (huff != 0) {
++ here.op = (unsigned char)64; /* invalid code marker */
++ here.bits = (unsigned char)(len - drop);
++ here.val = (unsigned short)0;
++ next[huff] = here;
++ }
++
++ /* set return parameters */
++ *table += used;
++ *bits = root;
++ return 0;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/inftrees.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,86 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* inftrees.h -- header to use inftrees.c
++ * Copyright (C) 1995-2005, 2010 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* WARNING: this file should *not* be used by applications. It is
++ part of the implementation of the compression library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++/* Structure for decoding tables. Each entry provides either the
++ information needed to do the operation requested by the code that
++ indexed that table entry, or it provides a pointer to another
++ table that indexes more bits of the code. op indicates whether
++ the entry is a pointer to another table, a literal, a length or
++ distance, an end-of-block, or an invalid code. For a table
++ pointer, the low four bits of op is the number of index bits of
++ that table. For a length or distance, the low four bits of op
++ is the number of extra bits to get after the code. bits is
++ the number of bits in this code or part of the code to drop off
++ of the bit buffer. val is the actual byte to output in the case
++ of a literal, the base length or distance, or the offset from
++ the current table to the next table. Each entry is four bytes. */
++typedef struct {
++ unsigned char op; /* operation, extra bits, table bits */
++ unsigned char bits; /* bits in this part of the code */
++ unsigned short val; /* offset in table or code value */
++} code;
++
++/* op values as set by inflate_table():
++ 00000000 - literal
++ 0000tttt - table link, tttt != 0 is the number of table index bits
++ 0001eeee - length or distance, eeee is the number of extra bits
++ 01100000 - end of block
++ 01000000 - invalid code
++ */
++
++/* Maximum size of the dynamic table. The maximum number of code structures is
++ 1444, which is the sum of 852 for literal/length codes and 592 for distance
++ codes. These values were found by exhaustive searches using the program
++ examples/enough.c found in the zlib distribtution. The arguments to that
++ program are the number of symbols, the initial root table size, and the
++ maximum bit length of a code. "enough 286 9 15" for literal/length codes
++ returns returns 852, and "enough 30 6 15" for distance codes returns 592.
++ The initial root table size (9 or 6) is found in the fifth argument of the
++ inflate_table() calls in inflate.c and infback.c. If the root table size is
++ changed, then these maximum sizes would be need to be recalculated and
++ updated. */
++#define ENOUGH_LENS 852
++#define ENOUGH_DISTS 592
++#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
++
++/* Type of code to build for inflate_table() */
++typedef enum {
++ CODES,
++ LENS,
++ DISTS
++} codetype;
++
++int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
++ unsigned codes, code FAR * FAR *table,
++ unsigned FAR *bits, unsigned short FAR *work));
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/patches/ChangeLog_java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,10 @@
++(1)renamed
++ adler32.c -> zadler32.c
++ zcrc32c -> zcrc32.c
++
++(2)added _LP64 to make uLong a 32-bit int on 64-bit platform
++ zconf.h:
++ uLong -> 32-bit int
++
++(3)updated crc32.c/crc32()
++ unsigned long -> uLong
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/trees.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,1250 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* trees.c -- output deflated data using Huffman coding
++ * Copyright (C) 1995-2012 Jean-loup Gailly
++ * detect_data_type() function provided freely by Cosmin Truta, 2006
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/*
++ * ALGORITHM
++ *
++ * The "deflation" process uses several Huffman trees. The more
++ * common source values are represented by shorter bit sequences.
++ *
++ * Each code tree is stored in a compressed form which is itself
++ * a Huffman encoding of the lengths of all the code strings (in
++ * ascending order by source values). The actual code strings are
++ * reconstructed from the lengths in the inflate process, as described
++ * in the deflate specification.
++ *
++ * REFERENCES
++ *
++ * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
++ * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
++ *
++ * Storer, James A.
++ * Data Compression: Methods and Theory, pp. 49-50.
++ * Computer Science Press, 1988. ISBN 0-7167-8156-5.
++ *
++ * Sedgewick, R.
++ * Algorithms, p290.
++ * Addison-Wesley, 1983. ISBN 0-201-06672-6.
++ */
++
++/* @(#) $Id$ */
++
++/* #define GEN_TREES_H */
++
++#include "deflate.h"
++
++#ifdef DEBUG
++# include <ctype.h>
++#endif
++
++/* ===========================================================================
++ * Constants
++ */
++
++#define MAX_BL_BITS 7
++/* Bit length codes must not exceed MAX_BL_BITS bits */
++
++#define END_BLOCK 256
++/* end of block literal code */
++
++#define REP_3_6 16
++/* repeat previous bit length 3-6 times (2 bits of repeat count) */
++
++#define REPZ_3_10 17
++/* repeat a zero length 3-10 times (3 bits of repeat count) */
++
++#define REPZ_11_138 18
++/* repeat a zero length 11-138 times (7 bits of repeat count) */
++
++local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
++ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
++
++local const int extra_dbits[D_CODES] /* extra bits for each distance code */
++ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
++
++local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
++ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
++
++local const uch bl_order[BL_CODES]
++ = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
++/* The lengths of the bit length codes are sent in order of decreasing
++ * probability, to avoid transmitting the lengths for unused bit length codes.
++ */
++
++/* ===========================================================================
++ * Local data. These are initialized only once.
++ */
++
++#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
++
++#if defined(GEN_TREES_H) || !defined(STDC)
++/* non ANSI compilers may not accept trees.h */
++
++local ct_data static_ltree[L_CODES+2];
++/* The static literal tree. Since the bit lengths are imposed, there is no
++ * need for the L_CODES extra codes used during heap construction. However
++ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
++ * below).
++ */
++
++local ct_data static_dtree[D_CODES];
++/* The static distance tree. (Actually a trivial tree since all codes use
++ * 5 bits.)
++ */
++
++uch _dist_code[DIST_CODE_LEN];
++/* Distance codes. The first 256 values correspond to the distances
++ * 3 .. 258, the last 256 values correspond to the top 8 bits of
++ * the 15 bit distances.
++ */
++
++uch _length_code[MAX_MATCH-MIN_MATCH+1];
++/* length code for each normalized match length (0 == MIN_MATCH) */
++
++local int base_length[LENGTH_CODES];
++/* First normalized length for each code (0 = MIN_MATCH) */
++
++local int base_dist[D_CODES];
++/* First normalized distance for each code (0 = distance of 1) */
++
++#else
++# include "trees.h"
++#endif /* GEN_TREES_H */
++
++struct static_tree_desc_s {
++ const ct_data *static_tree; /* static tree or NULL */
++ const intf *extra_bits; /* extra bits for each code or NULL */
++ int extra_base; /* base index for extra_bits */
++ int elems; /* max number of elements in the tree */
++ int max_length; /* max bit length for the codes */
++};
++
++local static_tree_desc static_l_desc =
++{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
++
++local static_tree_desc static_d_desc =
++{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
++
++local static_tree_desc static_bl_desc =
++{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
++
++/* ===========================================================================
++ * Local (static) routines in this file.
++ */
++
++local void tr_static_init OF((void));
++local void init_block OF((deflate_state *s));
++local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
++local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
++local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
++local void build_tree OF((deflate_state *s, tree_desc *desc));
++local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
++local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
++local int build_bl_tree OF((deflate_state *s));
++local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
++ int blcodes));
++local void compress_block OF((deflate_state *s, const ct_data *ltree,
++ const ct_data *dtree));
++local int detect_data_type OF((deflate_state *s));
++local unsigned bi_reverse OF((unsigned value, int length));
++local void bi_windup OF((deflate_state *s));
++local void bi_flush OF((deflate_state *s));
++local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
++ int header));
++
++#ifdef GEN_TREES_H
++local void gen_trees_header OF((void));
++#endif
++
++#ifndef DEBUG
++# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
++ /* Send a code of the given tree. c and tree must not have side effects */
++
++#else /* DEBUG */
++# define send_code(s, c, tree) \
++ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
++ send_bits(s, tree[c].Code, tree[c].Len); }
++#endif
++
++/* ===========================================================================
++ * Output a short LSB first on the stream.
++ * IN assertion: there is enough room in pendingBuf.
++ */
++#define put_short(s, w) { \
++ put_byte(s, (uch)((w) & 0xff)); \
++ put_byte(s, (uch)((ush)(w) >> 8)); \
++}
++
++/* ===========================================================================
++ * Send a value on a given number of bits.
++ * IN assertion: length <= 16 and value fits in length bits.
++ */
++#ifdef DEBUG
++local void send_bits OF((deflate_state *s, int value, int length));
++
++local void send_bits(s, value, length)
++ deflate_state *s;
++ int value; /* value to send */
++ int length; /* number of bits */
++{
++ Tracevv((stderr," l %2d v %4x ", length, value));
++ Assert(length > 0 && length <= 15, "invalid length");
++ s->bits_sent += (ulg)length;
++
++ /* If not enough room in bi_buf, use (valid) bits from bi_buf and
++ * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
++ * unused bits in value.
++ */
++ if (s->bi_valid > (int)Buf_size - length) {
++ s->bi_buf |= (ush)value << s->bi_valid;
++ put_short(s, s->bi_buf);
++ s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
++ s->bi_valid += length - Buf_size;
++ } else {
++ s->bi_buf |= (ush)value << s->bi_valid;
++ s->bi_valid += length;
++ }
++}
++#else /* !DEBUG */
++
++#define send_bits(s, value, length) \
++{ int len = length;\
++ if (s->bi_valid > (int)Buf_size - len) {\
++ int val = value;\
++ s->bi_buf |= (ush)val << s->bi_valid;\
++ put_short(s, s->bi_buf);\
++ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
++ s->bi_valid += len - Buf_size;\
++ } else {\
++ s->bi_buf |= (ush)(value) << s->bi_valid;\
++ s->bi_valid += len;\
++ }\
++}
++#endif /* DEBUG */
++
++
++/* the arguments must not have side effects */
++
++/* ===========================================================================
++ * Initialize the various 'constant' tables.
++ */
++local void tr_static_init()
++{
++#if defined(GEN_TREES_H) || !defined(STDC)
++ static int static_init_done = 0;
++ int n; /* iterates over tree elements */
++ int bits; /* bit counter */
++ int length; /* length value */
++ int code; /* code value */
++ int dist; /* distance index */
++ ush bl_count[MAX_BITS+1];
++ /* number of codes at each bit length for an optimal tree */
++
++ if (static_init_done) return;
++
++ /* For some embedded targets, global variables are not initialized: */
++#ifdef NO_INIT_GLOBAL_POINTERS
++ static_l_desc.static_tree = static_ltree;
++ static_l_desc.extra_bits = extra_lbits;
++ static_d_desc.static_tree = static_dtree;
++ static_d_desc.extra_bits = extra_dbits;
++ static_bl_desc.extra_bits = extra_blbits;
++#endif
++
++ /* Initialize the mapping length (0..255) -> length code (0..28) */
++ length = 0;
++ for (code = 0; code < LENGTH_CODES-1; code++) {
++ base_length[code] = length;
++ for (n = 0; n < (1<<extra_lbits[code]); n++) {
++ _length_code[length++] = (uch)code;
++ }
++ }
++ Assert (length == 256, "tr_static_init: length != 256");
++ /* Note that the length 255 (match length 258) can be represented
++ * in two different ways: code 284 + 5 bits or code 285, so we
++ * overwrite length_code[255] to use the best encoding:
++ */
++ _length_code[length-1] = (uch)code;
++
++ /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
++ dist = 0;
++ for (code = 0 ; code < 16; code++) {
++ base_dist[code] = dist;
++ for (n = 0; n < (1<<extra_dbits[code]); n++) {
++ _dist_code[dist++] = (uch)code;
++ }
++ }
++ Assert (dist == 256, "tr_static_init: dist != 256");
++ dist >>= 7; /* from now on, all distances are divided by 128 */
++ for ( ; code < D_CODES; code++) {
++ base_dist[code] = dist << 7;
++ for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
++ _dist_code[256 + dist++] = (uch)code;
++ }
++ }
++ Assert (dist == 256, "tr_static_init: 256+dist != 512");
++
++ /* Construct the codes of the static literal tree */
++ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
++ n = 0;
++ while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
++ while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
++ while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
++ while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
++ /* Codes 286 and 287 do not exist, but we must include them in the
++ * tree construction to get a canonical Huffman tree (longest code
++ * all ones)
++ */
++ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
++
++ /* The static distance tree is trivial: */
++ for (n = 0; n < D_CODES; n++) {
++ static_dtree[n].Len = 5;
++ static_dtree[n].Code = bi_reverse((unsigned)n, 5);
++ }
++ static_init_done = 1;
++
++# ifdef GEN_TREES_H
++ gen_trees_header();
++# endif
++#endif /* defined(GEN_TREES_H) || !defined(STDC) */
++}
++
++/* ===========================================================================
++ * Genererate the file trees.h describing the static trees.
++ */
++#ifdef GEN_TREES_H
++# ifndef DEBUG
++# include <stdio.h>
++# endif
++
++# define SEPARATOR(i, last, width) \
++ ((i) == (last)? "\n};\n\n" : \
++ ((i) % (width) == (width)-1 ? ",\n" : ", "))
++
++void gen_trees_header()
++{
++ FILE *header = fopen("trees.h", "w");
++ int i;
++
++ Assert (header != NULL, "Can't open trees.h");
++ fprintf(header,
++ "/* header created automatically with -DGEN_TREES_H */\n\n");
++
++ fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
++ for (i = 0; i < L_CODES+2; i++) {
++ fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
++ static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
++ }
++
++ fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
++ for (i = 0; i < D_CODES; i++) {
++ fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
++ static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
++ }
++
++ fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
++ for (i = 0; i < DIST_CODE_LEN; i++) {
++ fprintf(header, "%2u%s", _dist_code[i],
++ SEPARATOR(i, DIST_CODE_LEN-1, 20));
++ }
++
++ fprintf(header,
++ "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
++ for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
++ fprintf(header, "%2u%s", _length_code[i],
++ SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
++ }
++
++ fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
++ for (i = 0; i < LENGTH_CODES; i++) {
++ fprintf(header, "%1u%s", base_length[i],
++ SEPARATOR(i, LENGTH_CODES-1, 20));
++ }
++
++ fprintf(header, "local const int base_dist[D_CODES] = {\n");
++ for (i = 0; i < D_CODES; i++) {
++ fprintf(header, "%5u%s", base_dist[i],
++ SEPARATOR(i, D_CODES-1, 10));
++ }
++
++ fclose(header);
++}
++#endif /* GEN_TREES_H */
++
++/* ===========================================================================
++ * Initialize the tree data structures for a new zlib stream.
++ */
++void ZLIB_INTERNAL _tr_init(s)
++ deflate_state *s;
++{
++ tr_static_init();
++
++ s->l_desc.dyn_tree = s->dyn_ltree;
++ s->l_desc.stat_desc = &static_l_desc;
++
++ s->d_desc.dyn_tree = s->dyn_dtree;
++ s->d_desc.stat_desc = &static_d_desc;
++
++ s->bl_desc.dyn_tree = s->bl_tree;
++ s->bl_desc.stat_desc = &static_bl_desc;
++
++ s->bi_buf = 0;
++ s->bi_valid = 0;
++#ifdef DEBUG
++ s->compressed_len = 0L;
++ s->bits_sent = 0L;
++#endif
++
++ /* Initialize the first block of the first file: */
++ init_block(s);
++}
++
++/* ===========================================================================
++ * Initialize a new block.
++ */
++local void init_block(s)
++ deflate_state *s;
++{
++ int n; /* iterates over tree elements */
++
++ /* Initialize the trees. */
++ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
++ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
++ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
++
++ s->dyn_ltree[END_BLOCK].Freq = 1;
++ s->opt_len = s->static_len = 0L;
++ s->last_lit = s->matches = 0;
++}
++
++#define SMALLEST 1
++/* Index within the heap array of least frequent node in the Huffman tree */
++
++
++/* ===========================================================================
++ * Remove the smallest element from the heap and recreate the heap with
++ * one less element. Updates heap and heap_len.
++ */
++#define pqremove(s, tree, top) \
++{\
++ top = s->heap[SMALLEST]; \
++ s->heap[SMALLEST] = s->heap[s->heap_len--]; \
++ pqdownheap(s, tree, SMALLEST); \
++}
++
++/* ===========================================================================
++ * Compares to subtrees, using the tree depth as tie breaker when
++ * the subtrees have equal frequency. This minimizes the worst case length.
++ */
++#define smaller(tree, n, m, depth) \
++ (tree[n].Freq < tree[m].Freq || \
++ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
++
++/* ===========================================================================
++ * Restore the heap property by moving down the tree starting at node k,
++ * exchanging a node with the smallest of its two sons if necessary, stopping
++ * when the heap property is re-established (each father smaller than its
++ * two sons).
++ */
++local void pqdownheap(s, tree, k)
++ deflate_state *s;
++ ct_data *tree; /* the tree to restore */
++ int k; /* node to move down */
++{
++ int v = s->heap[k];
++ int j = k << 1; /* left son of k */
++ while (j <= s->heap_len) {
++ /* Set j to the smallest of the two sons: */
++ if (j < s->heap_len &&
++ smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
++ j++;
++ }
++ /* Exit if v is smaller than both sons */
++ if (smaller(tree, v, s->heap[j], s->depth)) break;
++
++ /* Exchange v with the smallest son */
++ s->heap[k] = s->heap[j]; k = j;
++
++ /* And continue down the tree, setting j to the left son of k */
++ j <<= 1;
++ }
++ s->heap[k] = v;
++}
++
++/* ===========================================================================
++ * Compute the optimal bit lengths for a tree and update the total bit length
++ * for the current block.
++ * IN assertion: the fields freq and dad are set, heap[heap_max] and
++ * above are the tree nodes sorted by increasing frequency.
++ * OUT assertions: the field len is set to the optimal bit length, the
++ * array bl_count contains the frequencies for each bit length.
++ * The length opt_len is updated; static_len is also updated if stree is
++ * not null.
++ */
++local void gen_bitlen(s, desc)
++ deflate_state *s;
++ tree_desc *desc; /* the tree descriptor */
++{
++ ct_data *tree = desc->dyn_tree;
++ int max_code = desc->max_code;
++ const ct_data *stree = desc->stat_desc->static_tree;
++ const intf *extra = desc->stat_desc->extra_bits;
++ int base = desc->stat_desc->extra_base;
++ int max_length = desc->stat_desc->max_length;
++ int h; /* heap index */
++ int n, m; /* iterate over the tree elements */
++ int bits; /* bit length */
++ int xbits; /* extra bits */
++ ush f; /* frequency */
++ int overflow = 0; /* number of elements with bit length too large */
++
++ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
++
++ /* In a first pass, compute the optimal bit lengths (which may
++ * overflow in the case of the bit length tree).
++ */
++ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
++
++ for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
++ n = s->heap[h];
++ bits = tree[tree[n].Dad].Len + 1;
++ if (bits > max_length) bits = max_length, overflow++;
++ tree[n].Len = (ush)bits;
++ /* We overwrite tree[n].Dad which is no longer needed */
++
++ if (n > max_code) continue; /* not a leaf node */
++
++ s->bl_count[bits]++;
++ xbits = 0;
++ if (n >= base) xbits = extra[n-base];
++ f = tree[n].Freq;
++ s->opt_len += (ulg)f * (bits + xbits);
++ if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
++ }
++ if (overflow == 0) return;
++
++ Trace((stderr,"\nbit length overflow\n"));
++ /* This happens for example on obj2 and pic of the Calgary corpus */
++
++ /* Find the first bit length which could increase: */
++ do {
++ bits = max_length-1;
++ while (s->bl_count[bits] == 0) bits--;
++ s->bl_count[bits]--; /* move one leaf down the tree */
++ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
++ s->bl_count[max_length]--;
++ /* The brother of the overflow item also moves one step up,
++ * but this does not affect bl_count[max_length]
++ */
++ overflow -= 2;
++ } while (overflow > 0);
++
++ /* Now recompute all bit lengths, scanning in increasing frequency.
++ * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
++ * lengths instead of fixing only the wrong ones. This idea is taken
++ * from 'ar' written by Haruhiko Okumura.)
++ */
++ for (bits = max_length; bits != 0; bits--) {
++ n = s->bl_count[bits];
++ while (n != 0) {
++ m = s->heap[--h];
++ if (m > max_code) continue;
++ if ((unsigned) tree[m].Len != (unsigned) bits) {
++ Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
++ s->opt_len += ((long)bits - (long)tree[m].Len)
++ *(long)tree[m].Freq;
++ tree[m].Len = (ush)bits;
++ }
++ n--;
++ }
++ }
++}
++
++/* ===========================================================================
++ * Generate the codes for a given tree and bit counts (which need not be
++ * optimal).
++ * IN assertion: the array bl_count contains the bit length statistics for
++ * the given tree and the field len is set for all tree elements.
++ * OUT assertion: the field code is set for all tree elements of non
++ * zero code length.
++ */
++local void gen_codes (tree, max_code, bl_count)
++ ct_data *tree; /* the tree to decorate */
++ int max_code; /* largest code with non zero frequency */
++ ushf *bl_count; /* number of codes at each bit length */
++{
++ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
++ ush code = 0; /* running code value */
++ int bits; /* bit index */
++ int n; /* code index */
++
++ /* The distribution counts are first used to generate the code values
++ * without bit reversal.
++ */
++ for (bits = 1; bits <= MAX_BITS; bits++) {
++ next_code[bits] = code = (code + bl_count[bits-1]) << 1;
++ }
++ /* Check that the bit counts in bl_count are consistent. The last code
++ * must be all ones.
++ */
++ Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
++ "inconsistent bit counts");
++ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
++
++ for (n = 0; n <= max_code; n++) {
++ int len = tree[n].Len;
++ if (len == 0) continue;
++ /* Now reverse the bits */
++ tree[n].Code = bi_reverse(next_code[len]++, len);
++
++ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
++ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
++ }
++}
++
++/* ===========================================================================
++ * Construct one Huffman tree and assigns the code bit strings and lengths.
++ * Update the total bit length for the current block.
++ * IN assertion: the field freq is set for all tree elements.
++ * OUT assertions: the fields len and code are set to the optimal bit length
++ * and corresponding code. The length opt_len is updated; static_len is
++ * also updated if stree is not null. The field max_code is set.
++ */
++local void build_tree(s, desc)
++ deflate_state *s;
++ tree_desc *desc; /* the tree descriptor */
++{
++ ct_data *tree = desc->dyn_tree;
++ const ct_data *stree = desc->stat_desc->static_tree;
++ int elems = desc->stat_desc->elems;
++ int n, m; /* iterate over heap elements */
++ int max_code = -1; /* largest code with non zero frequency */
++ int node; /* new node being created */
++
++ /* Construct the initial heap, with least frequent element in
++ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
++ * heap[0] is not used.
++ */
++ s->heap_len = 0, s->heap_max = HEAP_SIZE;
++
++ for (n = 0; n < elems; n++) {
++ if (tree[n].Freq != 0) {
++ s->heap[++(s->heap_len)] = max_code = n;
++ s->depth[n] = 0;
++ } else {
++ tree[n].Len = 0;
++ }
++ }
++
++ /* The pkzip format requires that at least one distance code exists,
++ * and that at least one bit should be sent even if there is only one
++ * possible code. So to avoid special checks later on we force at least
++ * two codes of non zero frequency.
++ */
++ while (s->heap_len < 2) {
++ node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
++ tree[node].Freq = 1;
++ s->depth[node] = 0;
++ s->opt_len--; if (stree) s->static_len -= stree[node].Len;
++ /* node is 0 or 1 so it does not have extra bits */
++ }
++ desc->max_code = max_code;
++
++ /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
++ * establish sub-heaps of increasing lengths:
++ */
++ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
++
++ /* Construct the Huffman tree by repeatedly combining the least two
++ * frequent nodes.
++ */
++ node = elems; /* next internal node of the tree */
++ do {
++ pqremove(s, tree, n); /* n = node of least frequency */
++ m = s->heap[SMALLEST]; /* m = node of next least frequency */
++
++ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
++ s->heap[--(s->heap_max)] = m;
++
++ /* Create a new node father of n and m */
++ tree[node].Freq = tree[n].Freq + tree[m].Freq;
++ s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
++ s->depth[n] : s->depth[m]) + 1);
++ tree[n].Dad = tree[m].Dad = (ush)node;
++#ifdef DUMP_BL_TREE
++ if (tree == s->bl_tree) {
++ fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
++ node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
++ }
++#endif
++ /* and insert the new node in the heap */
++ s->heap[SMALLEST] = node++;
++ pqdownheap(s, tree, SMALLEST);
++
++ } while (s->heap_len >= 2);
++
++ s->heap[--(s->heap_max)] = s->heap[SMALLEST];
++
++ /* At this point, the fields freq and dad are set. We can now
++ * generate the bit lengths.
++ */
++ gen_bitlen(s, (tree_desc *)desc);
++
++ /* The field len is now set, we can generate the bit codes */
++ gen_codes ((ct_data *)tree, max_code, s->bl_count);
++}
++
++/* ===========================================================================
++ * Scan a literal or distance tree to determine the frequencies of the codes
++ * in the bit length tree.
++ */
++local void scan_tree (s, tree, max_code)
++ deflate_state *s;
++ ct_data *tree; /* the tree to be scanned */
++ int max_code; /* and its largest code of non zero frequency */
++{
++ int n; /* iterates over all tree elements */
++ int prevlen = -1; /* last emitted length */
++ int curlen; /* length of current code */
++ int nextlen = tree[0].Len; /* length of next code */
++ int count = 0; /* repeat count of the current code */
++ int max_count = 7; /* max repeat count */
++ int min_count = 4; /* min repeat count */
++
++ if (nextlen == 0) max_count = 138, min_count = 3;
++ tree[max_code+1].Len = (ush)0xffff; /* guard */
++
++ for (n = 0; n <= max_code; n++) {
++ curlen = nextlen; nextlen = tree[n+1].Len;
++ if (++count < max_count && curlen == nextlen) {
++ continue;
++ } else if (count < min_count) {
++ s->bl_tree[curlen].Freq += count;
++ } else if (curlen != 0) {
++ if (curlen != prevlen) s->bl_tree[curlen].Freq++;
++ s->bl_tree[REP_3_6].Freq++;
++ } else if (count <= 10) {
++ s->bl_tree[REPZ_3_10].Freq++;
++ } else {
++ s->bl_tree[REPZ_11_138].Freq++;
++ }
++ count = 0; prevlen = curlen;
++ if (nextlen == 0) {
++ max_count = 138, min_count = 3;
++ } else if (curlen == nextlen) {
++ max_count = 6, min_count = 3;
++ } else {
++ max_count = 7, min_count = 4;
++ }
++ }
++}
++
++/* ===========================================================================
++ * Send a literal or distance tree in compressed form, using the codes in
++ * bl_tree.
++ */
++local void send_tree (s, tree, max_code)
++ deflate_state *s;
++ ct_data *tree; /* the tree to be scanned */
++ int max_code; /* and its largest code of non zero frequency */
++{
++ int n; /* iterates over all tree elements */
++ int prevlen = -1; /* last emitted length */
++ int curlen; /* length of current code */
++ int nextlen = tree[0].Len; /* length of next code */
++ int count = 0; /* repeat count of the current code */
++ int max_count = 7; /* max repeat count */
++ int min_count = 4; /* min repeat count */
++
++ /* tree[max_code+1].Len = -1; */ /* guard already set */
++ if (nextlen == 0) max_count = 138, min_count = 3;
++
++ for (n = 0; n <= max_code; n++) {
++ curlen = nextlen; nextlen = tree[n+1].Len;
++ if (++count < max_count && curlen == nextlen) {
++ continue;
++ } else if (count < min_count) {
++ do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
++
++ } else if (curlen != 0) {
++ if (curlen != prevlen) {
++ send_code(s, curlen, s->bl_tree); count--;
++ }
++ Assert(count >= 3 && count <= 6, " 3_6?");
++ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
++
++ } else if (count <= 10) {
++ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
++
++ } else {
++ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
++ }
++ count = 0; prevlen = curlen;
++ if (nextlen == 0) {
++ max_count = 138, min_count = 3;
++ } else if (curlen == nextlen) {
++ max_count = 6, min_count = 3;
++ } else {
++ max_count = 7, min_count = 4;
++ }
++ }
++}
++
++/* ===========================================================================
++ * Construct the Huffman tree for the bit lengths and return the index in
++ * bl_order of the last bit length code to send.
++ */
++local int build_bl_tree(s)
++ deflate_state *s;
++{
++ int max_blindex; /* index of last bit length code of non zero freq */
++
++ /* Determine the bit length frequencies for literal and distance trees */
++ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
++ scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
++
++ /* Build the bit length tree: */
++ build_tree(s, (tree_desc *)(&(s->bl_desc)));
++ /* opt_len now includes the length of the tree representations, except
++ * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
++ */
++
++ /* Determine the number of bit length codes to send. The pkzip format
++ * requires that at least 4 bit length codes be sent. (appnote.txt says
++ * 3 but the actual value used is 4.)
++ */
++ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
++ if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
++ }
++ /* Update opt_len to include the bit length tree and counts */
++ s->opt_len += 3*(max_blindex+1) + 5+5+4;
++ Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
++ s->opt_len, s->static_len));
++
++ return max_blindex;
++}
++
++/* ===========================================================================
++ * Send the header for a block using dynamic Huffman trees: the counts, the
++ * lengths of the bit length codes, the literal tree and the distance tree.
++ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
++ */
++local void send_all_trees(s, lcodes, dcodes, blcodes)
++ deflate_state *s;
++ int lcodes, dcodes, blcodes; /* number of codes for each tree */
++{
++ int rank; /* index in bl_order */
++
++ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
++ Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
++ "too many codes");
++ Tracev((stderr, "\nbl counts: "));
++ send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
++ send_bits(s, dcodes-1, 5);
++ send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
++ for (rank = 0; rank < blcodes; rank++) {
++ Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
++ send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
++ }
++ Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
++
++ send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
++ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
++
++ send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
++ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
++}
++
++/* ===========================================================================
++ * Send a stored block
++ */
++void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
++ deflate_state *s;
++ charf *buf; /* input block */
++ ulg stored_len; /* length of input block */
++ int last; /* one if this is the last block for a file */
++{
++ send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
++#ifdef DEBUG
++ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
++ s->compressed_len += (stored_len + 4) << 3;
++#endif
++ copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
++}
++
++/* ===========================================================================
++ * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
++ */
++void ZLIB_INTERNAL _tr_flush_bits(s)
++ deflate_state *s;
++{
++ bi_flush(s);
++}
++
++/* ===========================================================================
++ * Send one empty static block to give enough lookahead for inflate.
++ * This takes 10 bits, of which 7 may remain in the bit buffer.
++ */
++void ZLIB_INTERNAL _tr_align(s)
++ deflate_state *s;
++{
++ send_bits(s, STATIC_TREES<<1, 3);
++ send_code(s, END_BLOCK, static_ltree);
++#ifdef DEBUG
++ s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
++#endif
++ bi_flush(s);
++}
++
++/* ===========================================================================
++ * Determine the best encoding for the current block: dynamic trees, static
++ * trees or store, and output the encoded block to the zip file.
++ */
++void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
++ deflate_state *s;
++ charf *buf; /* input block, or NULL if too old */
++ ulg stored_len; /* length of input block */
++ int last; /* one if this is the last block for a file */
++{
++ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
++ int max_blindex = 0; /* index of last bit length code of non zero freq */
++
++ /* Build the Huffman trees unless a stored block is forced */
++ if (s->level > 0) {
++
++ /* Check if the file is binary or text */
++ if (s->strm->data_type == Z_UNKNOWN)
++ s->strm->data_type = detect_data_type(s);
++
++ /* Construct the literal and distance trees */
++ build_tree(s, (tree_desc *)(&(s->l_desc)));
++ Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
++ s->static_len));
++
++ build_tree(s, (tree_desc *)(&(s->d_desc)));
++ Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
++ s->static_len));
++ /* At this point, opt_len and static_len are the total bit lengths of
++ * the compressed block data, excluding the tree representations.
++ */
++
++ /* Build the bit length tree for the above two trees, and get the index
++ * in bl_order of the last bit length code to send.
++ */
++ max_blindex = build_bl_tree(s);
++
++ /* Determine the best encoding. Compute the block lengths in bytes. */
++ opt_lenb = (s->opt_len+3+7)>>3;
++ static_lenb = (s->static_len+3+7)>>3;
++
++ Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
++ opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
++ s->last_lit));
++
++ if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
++
++ } else {
++ Assert(buf != (char*)0, "lost buf");
++ opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
++ }
++
++#ifdef FORCE_STORED
++ if (buf != (char*)0) { /* force stored block */
++#else
++ if (stored_len+4 <= opt_lenb && buf != (char*)0) {
++ /* 4: two words for the lengths */
++#endif
++ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
++ * Otherwise we can't have processed more than WSIZE input bytes since
++ * the last block flush, because compression would have been
++ * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
++ * transform a block into a stored block.
++ */
++ _tr_stored_block(s, buf, stored_len, last);
++
++#ifdef FORCE_STATIC
++ } else if (static_lenb >= 0) { /* force static trees */
++#else
++ } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
++#endif
++ send_bits(s, (STATIC_TREES<<1)+last, 3);
++ compress_block(s, (const ct_data *)static_ltree,
++ (const ct_data *)static_dtree);
++#ifdef DEBUG
++ s->compressed_len += 3 + s->static_len;
++#endif
++ } else {
++ send_bits(s, (DYN_TREES<<1)+last, 3);
++ send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
++ max_blindex+1);
++ compress_block(s, (const ct_data *)s->dyn_ltree,
++ (const ct_data *)s->dyn_dtree);
++#ifdef DEBUG
++ s->compressed_len += 3 + s->opt_len;
++#endif
++ }
++ Assert (s->compressed_len == s->bits_sent, "bad compressed size");
++ /* The above check is made mod 2^32, for files larger than 512 MB
++ * and uLong implemented on 32 bits.
++ */
++ init_block(s);
++
++ if (last) {
++ bi_windup(s);
++#ifdef DEBUG
++ s->compressed_len += 7; /* align on byte boundary */
++#endif
++ }
++ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
++ s->compressed_len-7*last));
++}
++
++/* ===========================================================================
++ * Save the match info and tally the frequency counts. Return true if
++ * the current block must be flushed.
++ */
++int ZLIB_INTERNAL _tr_tally (s, dist, lc)
++ deflate_state *s;
++ unsigned dist; /* distance of matched string */
++ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
++{
++ s->d_buf[s->last_lit] = (ush)dist;
++ s->l_buf[s->last_lit++] = (uch)lc;
++ if (dist == 0) {
++ /* lc is the unmatched char */
++ s->dyn_ltree[lc].Freq++;
++ } else {
++ s->matches++;
++ /* Here, lc is the match length - MIN_MATCH */
++ dist--; /* dist = match distance - 1 */
++ Assert((ush)dist < (ush)MAX_DIST(s) &&
++ (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
++ (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
++
++ s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
++ s->dyn_dtree[d_code(dist)].Freq++;
++ }
++
++#ifdef TRUNCATE_BLOCK
++ /* Try to guess if it is profitable to stop the current block here */
++ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
++ /* Compute an upper bound for the compressed length */
++ ulg out_length = (ulg)s->last_lit*8L;
++ ulg in_length = (ulg)((long)s->strstart - s->block_start);
++ int dcode;
++ for (dcode = 0; dcode < D_CODES; dcode++) {
++ out_length += (ulg)s->dyn_dtree[dcode].Freq *
++ (5L+extra_dbits[dcode]);
++ }
++ out_length >>= 3;
++ Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
++ s->last_lit, in_length, out_length,
++ 100L - out_length*100L/in_length));
++ if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
++ }
++#endif
++ return (s->last_lit == s->lit_bufsize-1);
++ /* We avoid equality with lit_bufsize because of wraparound at 64K
++ * on 16 bit machines and because stored blocks are restricted to
++ * 64K-1 bytes.
++ */
++}
++
++/* ===========================================================================
++ * Send the block data compressed using the given Huffman trees
++ */
++local void compress_block(s, ltree, dtree)
++ deflate_state *s;
++ const ct_data *ltree; /* literal tree */
++ const ct_data *dtree; /* distance tree */
++{
++ unsigned dist; /* distance of matched string */
++ int lc; /* match length or unmatched char (if dist == 0) */
++ unsigned lx = 0; /* running index in l_buf */
++ unsigned code; /* the code to send */
++ int extra; /* number of extra bits to send */
++
++ if (s->last_lit != 0) do {
++ dist = s->d_buf[lx];
++ lc = s->l_buf[lx++];
++ if (dist == 0) {
++ send_code(s, lc, ltree); /* send a literal byte */
++ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
++ } else {
++ /* Here, lc is the match length - MIN_MATCH */
++ code = _length_code[lc];
++ send_code(s, code+LITERALS+1, ltree); /* send the length code */
++ extra = extra_lbits[code];
++ if (extra != 0) {
++ lc -= base_length[code];
++ send_bits(s, lc, extra); /* send the extra length bits */
++ }
++ dist--; /* dist is now the match distance - 1 */
++ code = d_code(dist);
++ Assert (code < D_CODES, "bad d_code");
++
++ send_code(s, code, dtree); /* send the distance code */
++ extra = extra_dbits[code];
++ if (extra != 0) {
++ dist -= base_dist[code];
++ send_bits(s, dist, extra); /* send the extra distance bits */
++ }
++ } /* literal or match pair ? */
++
++ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
++ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
++ "pendingBuf overflow");
++
++ } while (lx < s->last_lit);
++
++ send_code(s, END_BLOCK, ltree);
++}
++
++/* ===========================================================================
++ * Check if the data type is TEXT or BINARY, using the following algorithm:
++ * - TEXT if the two conditions below are satisfied:
++ * a) There are no non-portable control characters belonging to the
++ * "black list" (0..6, 14..25, 28..31).
++ * b) There is at least one printable character belonging to the
++ * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
++ * - BINARY otherwise.
++ * - The following partially-portable control characters form a
++ * "gray list" that is ignored in this detection algorithm:
++ * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
++ * IN assertion: the fields Freq of dyn_ltree are set.
++ */
++local int detect_data_type(s)
++ deflate_state *s;
++{
++ /* black_mask is the bit mask of black-listed bytes
++ * set bits 0..6, 14..25, and 28..31
++ * 0xf3ffc07f = binary 11110011111111111100000001111111
++ */
++ unsigned long black_mask = 0xf3ffc07fUL;
++ int n;
++
++ /* Check for non-textual ("black-listed") bytes. */
++ for (n = 0; n <= 31; n++, black_mask >>= 1)
++ if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
++ return Z_BINARY;
++
++ /* Check for textual ("white-listed") bytes. */
++ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
++ || s->dyn_ltree[13].Freq != 0)
++ return Z_TEXT;
++ for (n = 32; n < LITERALS; n++)
++ if (s->dyn_ltree[n].Freq != 0)
++ return Z_TEXT;
++
++ /* There are no "black-listed" or "white-listed" bytes:
++ * this stream either is empty or has tolerated ("gray-listed") bytes only.
++ */
++ return Z_BINARY;
++}
++
++/* ===========================================================================
++ * Reverse the first len bits of a code, using straightforward code (a faster
++ * method would use a table)
++ * IN assertion: 1 <= len <= 15
++ */
++local unsigned bi_reverse(code, len)
++ unsigned code; /* the value to invert */
++ int len; /* its bit length */
++{
++ register unsigned res = 0;
++ do {
++ res |= code & 1;
++ code >>= 1, res <<= 1;
++ } while (--len > 0);
++ return res >> 1;
++}
++
++/* ===========================================================================
++ * Flush the bit buffer, keeping at most 7 bits in it.
++ */
++local void bi_flush(s)
++ deflate_state *s;
++{
++ if (s->bi_valid == 16) {
++ put_short(s, s->bi_buf);
++ s->bi_buf = 0;
++ s->bi_valid = 0;
++ } else if (s->bi_valid >= 8) {
++ put_byte(s, (Byte)s->bi_buf);
++ s->bi_buf >>= 8;
++ s->bi_valid -= 8;
++ }
++}
++
++/* ===========================================================================
++ * Flush the bit buffer and align the output on a byte boundary
++ */
++local void bi_windup(s)
++ deflate_state *s;
++{
++ if (s->bi_valid > 8) {
++ put_short(s, s->bi_buf);
++ } else if (s->bi_valid > 0) {
++ put_byte(s, (Byte)s->bi_buf);
++ }
++ s->bi_buf = 0;
++ s->bi_valid = 0;
++#ifdef DEBUG
++ s->bits_sent = (s->bits_sent+7) & ~7;
++#endif
++}
++
++/* ===========================================================================
++ * Copy a stored block, storing first the length and its
++ * one's complement if requested.
++ */
++local void copy_block(s, buf, len, header)
++ deflate_state *s;
++ charf *buf; /* the input data */
++ unsigned len; /* its length */
++ int header; /* true if block header must be written */
++{
++ bi_windup(s); /* align on byte boundary */
++
++ if (header) {
++ put_short(s, (ush)len);
++ put_short(s, (ush)~len);
++#ifdef DEBUG
++ s->bits_sent += 2*16;
++#endif
++ }
++#ifdef DEBUG
++ s->bits_sent += (ulg)len<<3;
++#endif
++ while (len--) {
++ put_byte(s, *buf++);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/trees.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,152 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* header created automatically with -DGEN_TREES_H */
++
++local const ct_data static_ltree[L_CODES+2] = {
++{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
++{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
++{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
++{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
++{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
++{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
++{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
++{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
++{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
++{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
++{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
++{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
++{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
++{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
++{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
++{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
++{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
++{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
++{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
++{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
++{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
++{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
++{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
++{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
++{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
++{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
++{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
++{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
++{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
++{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
++{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
++{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
++{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
++{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
++{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
++{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
++{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
++{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
++{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
++{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
++{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
++{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
++{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
++{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
++{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
++{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
++{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
++{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
++{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
++{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
++{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
++{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
++{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
++{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
++{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
++{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
++{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
++{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
++};
++
++local const ct_data static_dtree[D_CODES] = {
++{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
++{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
++{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
++{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
++{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
++{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
++};
++
++const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
++ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
++ 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
++10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
++11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
++12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
++13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
++13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
++14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
++14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
++14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
++15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
++15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
++15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
++18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
++23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
++24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
++26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
++26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
++27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
++27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
++28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
++28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
++28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
++29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
++29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
++29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
++};
++
++const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
++ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
++13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
++17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
++19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
++21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
++22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
++23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
++24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
++25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
++25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
++26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
++26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
++27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
++};
++
++local const int base_length[LENGTH_CODES] = {
++0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
++64, 80, 96, 112, 128, 160, 192, 224, 0
++};
++
++local const int base_dist[D_CODES] = {
++ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
++ 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
++ 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
++};
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/uncompr.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,83 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* uncompr.c -- decompress a memory buffer
++ * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* @(#) $Id$ */
++
++#define ZLIB_INTERNAL
++#include "zlib.h"
++
++/* ===========================================================================
++ Decompresses the source buffer into the destination buffer. sourceLen is
++ the byte length of the source buffer. Upon entry, destLen is the total
++ size of the destination buffer, which must be large enough to hold the
++ entire uncompressed data. (The size of the uncompressed data must have
++ been saved previously by the compressor and transmitted to the decompressor
++ by some mechanism outside the scope of this compression library.)
++ Upon exit, destLen is the actual size of the compressed buffer.
++
++ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
++ enough memory, Z_BUF_ERROR if there was not enough room in the output
++ buffer, or Z_DATA_ERROR if the input data was corrupted.
++*/
++int ZEXPORT uncompress (dest, destLen, source, sourceLen)
++ Bytef *dest;
++ uLongf *destLen;
++ const Bytef *source;
++ uLong sourceLen;
++{
++ z_stream stream;
++ int err;
++
++ stream.next_in = (z_const Bytef *)source;
++ stream.avail_in = (uInt)sourceLen;
++ /* Check for source > 64K on 16-bit machine: */
++ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
++
++ stream.next_out = dest;
++ stream.avail_out = (uInt)*destLen;
++ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
++
++ stream.zalloc = (alloc_func)0;
++ stream.zfree = (free_func)0;
++
++ err = inflateInit(&stream);
++ if (err != Z_OK) return err;
++
++ err = inflate(&stream, Z_FINISH);
++ if (err != Z_STREAM_END) {
++ inflateEnd(&stream);
++ if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
++ return Z_DATA_ERROR;
++ return err;
++ }
++ *destLen = stream.total_out;
++
++ err = inflateEnd(&stream);
++ return err;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zadler32.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,203 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* adler32.c -- compute the Adler-32 checksum of a data stream
++ * Copyright (C) 1995-2011 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* @(#) $Id$ */
++
++#include "zutil.h"
++
++#define local static
++
++local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
++
++#define BASE 65521 /* largest prime smaller than 65536 */
++#define NMAX 5552
++/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
++
++#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
++#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
++#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
++#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
++#define DO16(buf) DO8(buf,0); DO8(buf,8);
++
++/* use NO_DIVIDE if your processor does not do division in hardware --
++ try it both ways to see which is faster */
++#ifdef NO_DIVIDE
++/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
++ (thank you to John Reiser for pointing this out) */
++# define CHOP(a) \
++ do { \
++ unsigned long tmp = a >> 16; \
++ a &= 0xffffUL; \
++ a += (tmp << 4) - tmp; \
++ } while (0)
++# define MOD28(a) \
++ do { \
++ CHOP(a); \
++ if (a >= BASE) a -= BASE; \
++ } while (0)
++# define MOD(a) \
++ do { \
++ CHOP(a); \
++ MOD28(a); \
++ } while (0)
++# define MOD63(a) \
++ do { /* this assumes a is not negative */ \
++ z_off64_t tmp = a >> 32; \
++ a &= 0xffffffffL; \
++ a += (tmp << 8) - (tmp << 5) + tmp; \
++ tmp = a >> 16; \
++ a &= 0xffffL; \
++ a += (tmp << 4) - tmp; \
++ tmp = a >> 16; \
++ a &= 0xffffL; \
++ a += (tmp << 4) - tmp; \
++ if (a >= BASE) a -= BASE; \
++ } while (0)
++#else
++# define MOD(a) a %= BASE
++# define MOD28(a) a %= BASE
++# define MOD63(a) a %= BASE
++#endif
++
++/* ========================================================================= */
++uLong ZEXPORT adler32(adler, buf, len)
++ uLong adler;
++ const Bytef *buf;
++ uInt len;
++{
++ unsigned long sum2;
++ unsigned n;
++
++ /* split Adler-32 into component sums */
++ sum2 = (adler >> 16) & 0xffff;
++ adler &= 0xffff;
++
++ /* in case user likes doing a byte at a time, keep it fast */
++ if (len == 1) {
++ adler += buf[0];
++ if (adler >= BASE)
++ adler -= BASE;
++ sum2 += adler;
++ if (sum2 >= BASE)
++ sum2 -= BASE;
++ return adler | (sum2 << 16);
++ }
++
++ /* initial Adler-32 value (deferred check for len == 1 speed) */
++ if (buf == Z_NULL)
++ return 1L;
++
++ /* in case short lengths are provided, keep it somewhat fast */
++ if (len < 16) {
++ while (len--) {
++ adler += *buf++;
++ sum2 += adler;
++ }
++ if (adler >= BASE)
++ adler -= BASE;
++ MOD28(sum2); /* only added so many BASE's */
++ return adler | (sum2 << 16);
++ }
++
++ /* do length NMAX blocks -- requires just one modulo operation */
++ while (len >= NMAX) {
++ len -= NMAX;
++ n = NMAX / 16; /* NMAX is divisible by 16 */
++ do {
++ DO16(buf); /* 16 sums unrolled */
++ buf += 16;
++ } while (--n);
++ MOD(adler);
++ MOD(sum2);
++ }
++
++ /* do remaining bytes (less than NMAX, still just one modulo) */
++ if (len) { /* avoid modulos if none remaining */
++ while (len >= 16) {
++ len -= 16;
++ DO16(buf);
++ buf += 16;
++ }
++ while (len--) {
++ adler += *buf++;
++ sum2 += adler;
++ }
++ MOD(adler);
++ MOD(sum2);
++ }
++
++ /* return recombined sums */
++ return adler | (sum2 << 16);
++}
++
++/* ========================================================================= */
++local uLong adler32_combine_(adler1, adler2, len2)
++ uLong adler1;
++ uLong adler2;
++ z_off64_t len2;
++{
++ unsigned long sum1;
++ unsigned long sum2;
++ unsigned rem;
++
++ /* for negative len, return invalid adler32 as a clue for debugging */
++ if (len2 < 0)
++ return 0xffffffffUL;
++
++ /* the derivation of this formula is left as an exercise for the reader */
++ MOD63(len2); /* assumes len2 >= 0 */
++ rem = (unsigned)len2;
++ sum1 = adler1 & 0xffff;
++ sum2 = rem * sum1;
++ MOD(sum2);
++ sum1 += (adler2 & 0xffff) + BASE - 1;
++ sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
++ if (sum1 >= BASE) sum1 -= BASE;
++ if (sum1 >= BASE) sum1 -= BASE;
++ if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
++ if (sum2 >= BASE) sum2 -= BASE;
++ return sum1 | (sum2 << 16);
++}
++
++/* ========================================================================= */
++uLong ZEXPORT adler32_combine(adler1, adler2, len2)
++ uLong adler1;
++ uLong adler2;
++ z_off_t len2;
++{
++ return adler32_combine_(adler1, adler2, len2);
++}
++
++uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
++ uLong adler1;
++ uLong adler2;
++ z_off64_t len2;
++{
++ return adler32_combine_(adler1, adler2, len2);
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zconf.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,543 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* zconf.h -- configuration of the zlib compression library
++ * Copyright (C) 1995-2013 Jean-loup Gailly.
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* @(#) $Id$ */
++
++#ifndef ZCONF_H
++#define ZCONF_H
++
++/* for _LP64 */
++#include <sys/types.h>
++
++/*
++ * If you *really* need a unique prefix for all types and library functions,
++ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
++ * Even better than compiling with -DZ_PREFIX would be to use configure to set
++ * this permanently in zconf.h using "./configure --zprefix".
++ */
++#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
++# define Z_PREFIX_SET
++
++/* all linked symbols */
++# define _dist_code z__dist_code
++# define _length_code z__length_code
++# define _tr_align z__tr_align
++# define _tr_flush_bits z__tr_flush_bits
++# define _tr_flush_block z__tr_flush_block
++# define _tr_init z__tr_init
++# define _tr_stored_block z__tr_stored_block
++# define _tr_tally z__tr_tally
++# define adler32 z_adler32
++# define adler32_combine z_adler32_combine
++# define adler32_combine64 z_adler32_combine64
++# ifndef Z_SOLO
++# define compress z_compress
++# define compress2 z_compress2
++# define compressBound z_compressBound
++# endif
++# define crc32 z_crc32
++# define crc32_combine z_crc32_combine
++# define crc32_combine64 z_crc32_combine64
++# define deflate z_deflate
++# define deflateBound z_deflateBound
++# define deflateCopy z_deflateCopy
++# define deflateEnd z_deflateEnd
++# define deflateInit2_ z_deflateInit2_
++# define deflateInit_ z_deflateInit_
++# define deflateParams z_deflateParams
++# define deflatePending z_deflatePending
++# define deflatePrime z_deflatePrime
++# define deflateReset z_deflateReset
++# define deflateResetKeep z_deflateResetKeep
++# define deflateSetDictionary z_deflateSetDictionary
++# define deflateSetHeader z_deflateSetHeader
++# define deflateTune z_deflateTune
++# define deflate_copyright z_deflate_copyright
++# define get_crc_table z_get_crc_table
++# ifndef Z_SOLO
++# define gz_error z_gz_error
++# define gz_intmax z_gz_intmax
++# define gz_strwinerror z_gz_strwinerror
++# define gzbuffer z_gzbuffer
++# define gzclearerr z_gzclearerr
++# define gzclose z_gzclose
++# define gzclose_r z_gzclose_r
++# define gzclose_w z_gzclose_w
++# define gzdirect z_gzdirect
++# define gzdopen z_gzdopen
++# define gzeof z_gzeof
++# define gzerror z_gzerror
++# define gzflush z_gzflush
++# define gzgetc z_gzgetc
++# define gzgetc_ z_gzgetc_
++# define gzgets z_gzgets
++# define gzoffset z_gzoffset
++# define gzoffset64 z_gzoffset64
++# define gzopen z_gzopen
++# define gzopen64 z_gzopen64
++# ifdef _WIN32
++# define gzopen_w z_gzopen_w
++# endif
++# define gzprintf z_gzprintf
++# define gzvprintf z_gzvprintf
++# define gzputc z_gzputc
++# define gzputs z_gzputs
++# define gzread z_gzread
++# define gzrewind z_gzrewind
++# define gzseek z_gzseek
++# define gzseek64 z_gzseek64
++# define gzsetparams z_gzsetparams
++# define gztell z_gztell
++# define gztell64 z_gztell64
++# define gzungetc z_gzungetc
++# define gzwrite z_gzwrite
++# endif
++# define inflate z_inflate
++# define inflateBack z_inflateBack
++# define inflateBackEnd z_inflateBackEnd
++# define inflateBackInit_ z_inflateBackInit_
++# define inflateCopy z_inflateCopy
++# define inflateEnd z_inflateEnd
++# define inflateGetHeader z_inflateGetHeader
++# define inflateInit2_ z_inflateInit2_
++# define inflateInit_ z_inflateInit_
++# define inflateMark z_inflateMark
++# define inflatePrime z_inflatePrime
++# define inflateReset z_inflateReset
++# define inflateReset2 z_inflateReset2
++# define inflateSetDictionary z_inflateSetDictionary
++# define inflateGetDictionary z_inflateGetDictionary
++# define inflateSync z_inflateSync
++# define inflateSyncPoint z_inflateSyncPoint
++# define inflateUndermine z_inflateUndermine
++# define inflateResetKeep z_inflateResetKeep
++# define inflate_copyright z_inflate_copyright
++# define inflate_fast z_inflate_fast
++# define inflate_table z_inflate_table
++# ifndef Z_SOLO
++# define uncompress z_uncompress
++# endif
++# define zError z_zError
++# ifndef Z_SOLO
++# define zcalloc z_zcalloc
++# define zcfree z_zcfree
++# endif
++# define zlibCompileFlags z_zlibCompileFlags
++# define zlibVersion z_zlibVersion
++
++/* all zlib typedefs in zlib.h and zconf.h */
++# define Byte z_Byte
++# define Bytef z_Bytef
++# define alloc_func z_alloc_func
++# define charf z_charf
++# define free_func z_free_func
++# ifndef Z_SOLO
++# define gzFile z_gzFile
++# endif
++# define gz_header z_gz_header
++# define gz_headerp z_gz_headerp
++# define in_func z_in_func
++# define intf z_intf
++# define out_func z_out_func
++# define uInt z_uInt
++# define uIntf z_uIntf
++# define uLong z_uLong
++# define uLongf z_uLongf
++# define voidp z_voidp
++# define voidpc z_voidpc
++# define voidpf z_voidpf
++
++/* all zlib structs in zlib.h and zconf.h */
++# define gz_header_s z_gz_header_s
++# define internal_state z_internal_state
++
++#endif
++
++#if defined(__MSDOS__) && !defined(MSDOS)
++# define MSDOS
++#endif
++#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
++# define OS2
++#endif
++#if defined(_WINDOWS) && !defined(WINDOWS)
++# define WINDOWS
++#endif
++#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
++# ifndef WIN32
++# define WIN32
++# endif
++#endif
++#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
++# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
++# ifndef SYS16BIT
++# define SYS16BIT
++# endif
++# endif
++#endif
++
++/*
++ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
++ * than 64k bytes at a time (needed on systems with 16-bit int).
++ */
++#ifdef SYS16BIT
++# define MAXSEG_64K
++#endif
++#ifdef MSDOS
++# define UNALIGNED_OK
++#endif
++
++#ifdef __STDC_VERSION__
++# ifndef STDC
++# define STDC
++# endif
++# if __STDC_VERSION__ >= 199901L
++# ifndef STDC99
++# define STDC99
++# endif
++# endif
++#endif
++#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
++# define STDC
++#endif
++#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
++# define STDC
++#endif
++#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
++# define STDC
++#endif
++#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
++# define STDC
++#endif
++
++#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
++# define STDC
++#endif
++
++#ifndef STDC
++# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
++# define const /* note: need a more gentle solution here */
++# endif
++#endif
++
++#if defined(ZLIB_CONST) && !defined(z_const)
++# define z_const const
++#else
++# define z_const
++#endif
++
++/* Some Mac compilers merge all .h files incorrectly: */
++#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
++# define NO_DUMMY_DECL
++#endif
++
++/* Maximum value for memLevel in deflateInit2 */
++#ifndef MAX_MEM_LEVEL
++# ifdef MAXSEG_64K
++# define MAX_MEM_LEVEL 8
++# else
++# define MAX_MEM_LEVEL 9
++# endif
++#endif
++
++/* Maximum value for windowBits in deflateInit2 and inflateInit2.
++ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
++ * created by gzip. (Files created by minigzip can still be extracted by
++ * gzip.)
++ */
++#ifndef MAX_WBITS
++# define MAX_WBITS 15 /* 32K LZ77 window */
++#endif
++
++/* The memory requirements for deflate are (in bytes):
++ (1 << (windowBits+2)) + (1 << (memLevel+9))
++ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
++ plus a few kilobytes for small objects. For example, if you want to reduce
++ the default memory requirements from 256K to 128K, compile with
++ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
++ Of course this will generally degrade compression (there's no free lunch).
++
++ The memory requirements for inflate are (in bytes) 1 << windowBits
++ that is, 32K for windowBits=15 (default value) plus a few kilobytes
++ for small objects.
++*/
++
++ /* Type declarations */
++
++#ifndef OF /* function prototypes */
++# ifdef STDC
++# define OF(args) args
++# else
++# define OF(args) ()
++# endif
++#endif
++
++#ifndef Z_ARG /* function prototypes for stdarg */
++# if defined(STDC) || defined(Z_HAVE_STDARG_H)
++# define Z_ARG(args) args
++# else
++# define Z_ARG(args) ()
++# endif
++#endif
++
++/* The following definitions for FAR are needed only for MSDOS mixed
++ * model programming (small or medium model with some far allocations).
++ * This was tested only with MSC; for other MSDOS compilers you may have
++ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
++ * just define FAR to be empty.
++ */
++#ifdef SYS16BIT
++# if defined(M_I86SM) || defined(M_I86MM)
++ /* MSC small or medium model */
++# define SMALL_MEDIUM
++# ifdef _MSC_VER
++# define FAR _far
++# else
++# define FAR far
++# endif
++# endif
++# if (defined(__SMALL__) || defined(__MEDIUM__))
++ /* Turbo C small or medium model */
++# define SMALL_MEDIUM
++# ifdef __BORLANDC__
++# define FAR _far
++# else
++# define FAR far
++# endif
++# endif
++#endif
++
++#if defined(WINDOWS) || defined(WIN32)
++ /* If building or using zlib as a DLL, define ZLIB_DLL.
++ * This is not mandatory, but it offers a little performance increase.
++ */
++# ifdef ZLIB_DLL
++# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
++# ifdef ZLIB_INTERNAL
++# define ZEXTERN extern __declspec(dllexport)
++# else
++# define ZEXTERN extern __declspec(dllimport)
++# endif
++# endif
++# endif /* ZLIB_DLL */
++ /* If building or using zlib with the WINAPI/WINAPIV calling convention,
++ * define ZLIB_WINAPI.
++ * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
++ */
++# ifdef ZLIB_WINAPI
++# ifdef FAR
++# undef FAR
++# endif
++# include <windows.h>
++ /* No need for _export, use ZLIB.DEF instead. */
++ /* For complete Windows compatibility, use WINAPI, not __stdcall. */
++# define ZEXPORT WINAPI
++# ifdef WIN32
++# define ZEXPORTVA WINAPIV
++# else
++# define ZEXPORTVA FAR CDECL
++# endif
++# endif
++#endif
++
++#if defined (__BEOS__)
++# ifdef ZLIB_DLL
++# ifdef ZLIB_INTERNAL
++# define ZEXPORT __declspec(dllexport)
++# define ZEXPORTVA __declspec(dllexport)
++# else
++# define ZEXPORT __declspec(dllimport)
++# define ZEXPORTVA __declspec(dllimport)
++# endif
++# endif
++#endif
++
++#ifndef ZEXTERN
++# define ZEXTERN extern
++#endif
++#ifndef ZEXPORT
++# define ZEXPORT
++#endif
++#ifndef ZEXPORTVA
++# define ZEXPORTVA
++#endif
++
++#ifndef FAR
++# define FAR
++#endif
++
++#if !defined(__MACTYPES__)
++typedef unsigned char Byte; /* 8 bits */
++#endif
++typedef unsigned int uInt; /* 16 bits or more */
++
++#ifdef _LP64
++typedef unsigned int uLong; /* 32 bits or more */
++#else
++typedef unsigned long uLong; /* 32 bits or more */
++#endif
++
++#ifdef SMALL_MEDIUM
++ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
++# define Bytef Byte FAR
++#else
++ typedef Byte FAR Bytef;
++#endif
++typedef char FAR charf;
++typedef int FAR intf;
++typedef uInt FAR uIntf;
++typedef uLong FAR uLongf;
++
++#ifdef STDC
++ typedef void const *voidpc;
++ typedef void FAR *voidpf;
++ typedef void *voidp;
++#else
++ typedef Byte const *voidpc;
++ typedef Byte FAR *voidpf;
++ typedef Byte *voidp;
++#endif
++
++#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
++# include <limits.h>
++# if (UINT_MAX == 0xffffffffUL)
++# define Z_U4 unsigned
++# elif (ULONG_MAX == 0xffffffffUL)
++# define Z_U4 unsigned long
++# elif (USHRT_MAX == 0xffffffffUL)
++# define Z_U4 unsigned short
++# endif
++#endif
++
++#ifdef Z_U4
++ typedef Z_U4 z_crc_t;
++#else
++ typedef unsigned long z_crc_t;
++#endif
++
++#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
++# define Z_HAVE_UNISTD_H
++#endif
++
++#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
++# define Z_HAVE_STDARG_H
++#endif
++
++#ifdef STDC
++# ifndef Z_SOLO
++# include <sys/types.h> /* for off_t */
++# endif
++#endif
++
++#if defined(STDC) || defined(Z_HAVE_STDARG_H)
++# ifndef Z_SOLO
++# include <stdarg.h> /* for va_list */
++# endif
++#endif
++
++#ifdef _WIN32
++# ifndef Z_SOLO
++# include <stddef.h> /* for wchar_t */
++# endif
++#endif
++
++/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
++ * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
++ * though the former does not conform to the LFS document), but considering
++ * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
++ * equivalently requesting no 64-bit operations
++ */
++#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
++# undef _LARGEFILE64_SOURCE
++#endif
++
++#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
++# define Z_HAVE_UNISTD_H
++#endif
++#ifndef Z_SOLO
++# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
++# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
++# ifdef VMS
++# include <unixio.h> /* for off_t */
++# endif
++# ifndef z_off_t
++# define z_off_t off_t
++# endif
++# endif
++#endif
++
++#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
++# define Z_LFS64
++#endif
++
++#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
++# define Z_LARGE64
++#endif
++
++#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
++# define Z_WANT64
++#endif
++
++#if !defined(SEEK_SET) && !defined(Z_SOLO)
++# define SEEK_SET 0 /* Seek from beginning of file. */
++# define SEEK_CUR 1 /* Seek from current position. */
++# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
++#endif
++
++#ifndef z_off_t
++# define z_off_t long
++#endif
++
++#if !defined(_WIN32) && defined(Z_LARGE64)
++# define z_off64_t off64_t
++#else
++# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
++# define z_off64_t __int64
++# else
++# define z_off64_t z_off_t
++# endif
++#endif
++
++/* MVS linker does not support external names larger than 8 bytes */
++#if defined(__MVS__)
++ #pragma map(deflateInit_,"DEIN")
++ #pragma map(deflateInit2_,"DEIN2")
++ #pragma map(deflateEnd,"DEEND")
++ #pragma map(deflateBound,"DEBND")
++ #pragma map(inflateInit_,"ININ")
++ #pragma map(inflateInit2_,"ININ2")
++ #pragma map(inflateEnd,"INEND")
++ #pragma map(inflateSync,"INSY")
++ #pragma map(inflateSetDictionary,"INSEDI")
++ #pragma map(compressBound,"CMBND")
++ #pragma map(inflate_table,"INTABL")
++ #pragma map(inflate_fast,"INFA")
++ #pragma map(inflate_copyright,"INCOPY")
++#endif
++
++#endif /* ZCONF_H */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zcrc32.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,449 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* crc32.c -- compute the CRC-32 of a data stream
++ * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ *
++ * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
++ * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
++ * tables for updating the shift register in one step with three exclusive-ors
++ * instead of four steps with four exclusive-ors. This results in about a
++ * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
++ */
++
++/* @(#) $Id$ */
++
++/*
++ Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
++ protection on the static variables used to control the first-use generation
++ of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
++ first call get_crc_table() to initialize the tables before allowing more than
++ one thread to use crc32().
++
++ DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
++ */
++
++#ifdef MAKECRCH
++# include <stdio.h>
++# ifndef DYNAMIC_CRC_TABLE
++# define DYNAMIC_CRC_TABLE
++# endif /* !DYNAMIC_CRC_TABLE */
++#endif /* MAKECRCH */
++
++#include "zutil.h" /* for STDC and FAR definitions */
++
++#define local static
++
++/* Definitions for doing the crc four data bytes at a time. */
++#if !defined(NOBYFOUR) && defined(Z_U4)
++# define BYFOUR
++#endif
++#ifdef BYFOUR
++ local unsigned long crc32_little OF((unsigned long,
++ const unsigned char FAR *, unsigned));
++ local unsigned long crc32_big OF((unsigned long,
++ const unsigned char FAR *, unsigned));
++# define TBLS 8
++#else
++# define TBLS 1
++#endif /* BYFOUR */
++
++/* Local functions for crc concatenation */
++local unsigned long gf2_matrix_times OF((unsigned long *mat,
++ unsigned long vec));
++local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
++local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
++
++
++#ifdef DYNAMIC_CRC_TABLE
++
++local volatile int crc_table_empty = 1;
++local z_crc_t FAR crc_table[TBLS][256];
++local void make_crc_table OF((void));
++#ifdef MAKECRCH
++ local void write_table OF((FILE *, const z_crc_t FAR *));
++#endif /* MAKECRCH */
++/*
++ Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
++ x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
++
++ Polynomials over GF(2) are represented in binary, one bit per coefficient,
++ with the lowest powers in the most significant bit. Then adding polynomials
++ is just exclusive-or, and multiplying a polynomial by x is a right shift by
++ one. If we call the above polynomial p, and represent a byte as the
++ polynomial q, also with the lowest power in the most significant bit (so the
++ byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
++ where a mod b means the remainder after dividing a by b.
++
++ This calculation is done using the shift-register method of multiplying and
++ taking the remainder. The register is initialized to zero, and for each
++ incoming bit, x^32 is added mod p to the register if the bit is a one (where
++ x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
++ x (which is shifting right by one and adding x^32 mod p if the bit shifted
++ out is a one). We start with the highest power (least significant bit) of
++ q and repeat for all eight bits of q.
++
++ The first table is simply the CRC of all possible eight bit values. This is
++ all the information needed to generate CRCs on data a byte at a time for all
++ combinations of CRC register values and incoming bytes. The remaining tables
++ allow for word-at-a-time CRC calculation for both big-endian and little-
++ endian machines, where a word is four bytes.
++*/
++local void make_crc_table()
++{
++ z_crc_t c;
++ int n, k;
++ z_crc_t poly; /* polynomial exclusive-or pattern */
++ /* terms of polynomial defining this crc (except x^32): */
++ static volatile int first = 1; /* flag to limit concurrent making */
++ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
++
++ /* See if another task is already doing this (not thread-safe, but better
++ than nothing -- significantly reduces duration of vulnerability in
++ case the advice about DYNAMIC_CRC_TABLE is ignored) */
++ if (first) {
++ first = 0;
++
++ /* make exclusive-or pattern from polynomial (0xedb88320UL) */
++ poly = 0;
++ for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
++ poly |= (z_crc_t)1 << (31 - p[n]);
++
++ /* generate a crc for every 8-bit value */
++ for (n = 0; n < 256; n++) {
++ c = (z_crc_t)n;
++ for (k = 0; k < 8; k++)
++ c = c & 1 ? poly ^ (c >> 1) : c >> 1;
++ crc_table[0][n] = c;
++ }
++
++#ifdef BYFOUR
++ /* generate crc for each value followed by one, two, and three zeros,
++ and then the byte reversal of those as well as the first table */
++ for (n = 0; n < 256; n++) {
++ c = crc_table[0][n];
++ crc_table[4][n] = ZSWAP32(c);
++ for (k = 1; k < 4; k++) {
++ c = crc_table[0][c & 0xff] ^ (c >> 8);
++ crc_table[k][n] = c;
++ crc_table[k + 4][n] = ZSWAP32(c);
++ }
++ }
++#endif /* BYFOUR */
++
++ crc_table_empty = 0;
++ }
++ else { /* not first */
++ /* wait for the other guy to finish (not efficient, but rare) */
++ while (crc_table_empty)
++ ;
++ }
++
++#ifdef MAKECRCH
++ /* write out CRC tables to crc32.h */
++ {
++ FILE *out;
++
++ out = fopen("crc32.h", "w");
++ if (out == NULL) return;
++ fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
++ fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
++ fprintf(out, "local const z_crc_t FAR ");
++ fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
++ write_table(out, crc_table[0]);
++# ifdef BYFOUR
++ fprintf(out, "#ifdef BYFOUR\n");
++ for (k = 1; k < 8; k++) {
++ fprintf(out, " },\n {\n");
++ write_table(out, crc_table[k]);
++ }
++ fprintf(out, "#endif\n");
++# endif /* BYFOUR */
++ fprintf(out, " }\n};\n");
++ fclose(out);
++ }
++#endif /* MAKECRCH */
++}
++
++#ifdef MAKECRCH
++local void write_table(out, table)
++ FILE *out;
++ const z_crc_t FAR *table;
++{
++ int n;
++
++ for (n = 0; n < 256; n++)
++ fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
++ (unsigned long)(table[n]),
++ n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
++}
++#endif /* MAKECRCH */
++
++#else /* !DYNAMIC_CRC_TABLE */
++/* ========================================================================
++ * Tables of CRC-32s of all single-byte values, made by make_crc_table().
++ */
++#include "crc32.h"
++#endif /* DYNAMIC_CRC_TABLE */
++
++/* =========================================================================
++ * This function can be used by asm versions of crc32()
++ */
++const z_crc_t FAR * ZEXPORT get_crc_table()
++{
++#ifdef DYNAMIC_CRC_TABLE
++ if (crc_table_empty)
++ make_crc_table();
++#endif /* DYNAMIC_CRC_TABLE */
++ return (const z_crc_t FAR *)crc_table;
++}
++
++/* ========================================================================= */
++#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
++#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
++
++/* ========================================================================= */
++uLong ZEXPORT crc32(crc, buf, len)
++ uLong crc;
++ const unsigned char FAR *buf;
++ uInt len;
++{
++ if (buf == Z_NULL) return 0UL;
++
++#ifdef DYNAMIC_CRC_TABLE
++ if (crc_table_empty)
++ make_crc_table();
++#endif /* DYNAMIC_CRC_TABLE */
++
++#ifdef BYFOUR
++ if (sizeof(void *) == sizeof(ptrdiff_t)) {
++ z_crc_t endian;
++
++ endian = 1;
++ if (*((unsigned char *)(&endian)))
++ return (uLong)crc32_little(crc, buf, len);
++ else
++ return (uLong)crc32_big(crc, buf, len);
++ }
++#endif /* BYFOUR */
++ crc = crc ^ 0xffffffffUL;
++ while (len >= 8) {
++ DO8;
++ len -= 8;
++ }
++ if (len) do {
++ DO1;
++ } while (--len);
++ return crc ^ 0xffffffffUL;
++}
++
++#ifdef BYFOUR
++
++/* ========================================================================= */
++#define DOLIT4 c ^= *buf4++; \
++ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
++ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
++#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
++
++/* ========================================================================= */
++local unsigned long crc32_little(crc, buf, len)
++ unsigned long crc;
++ const unsigned char FAR *buf;
++ unsigned len;
++{
++ register z_crc_t c;
++ register const z_crc_t FAR *buf4;
++
++ c = (z_crc_t)crc;
++ c = ~c;
++ while (len && ((ptrdiff_t)buf & 3)) {
++ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
++ len--;
++ }
++
++ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
++ while (len >= 32) {
++ DOLIT32;
++ len -= 32;
++ }
++ while (len >= 4) {
++ DOLIT4;
++ len -= 4;
++ }
++ buf = (const unsigned char FAR *)buf4;
++
++ if (len) do {
++ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
++ } while (--len);
++ c = ~c;
++ return (unsigned long)c;
++}
++
++/* ========================================================================= */
++#define DOBIG4 c ^= *++buf4; \
++ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
++ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
++#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
++
++/* ========================================================================= */
++local unsigned long crc32_big(crc, buf, len)
++ unsigned long crc;
++ const unsigned char FAR *buf;
++ unsigned len;
++{
++ register z_crc_t c;
++ register const z_crc_t FAR *buf4;
++
++ c = ZSWAP32((z_crc_t)crc);
++ c = ~c;
++ while (len && ((ptrdiff_t)buf & 3)) {
++ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
++ len--;
++ }
++
++ buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
++ buf4--;
++ while (len >= 32) {
++ DOBIG32;
++ len -= 32;
++ }
++ while (len >= 4) {
++ DOBIG4;
++ len -= 4;
++ }
++ buf4++;
++ buf = (const unsigned char FAR *)buf4;
++
++ if (len) do {
++ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
++ } while (--len);
++ c = ~c;
++ return (unsigned long)(ZSWAP32(c));
++}
++
++#endif /* BYFOUR */
++
++#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
++
++/* ========================================================================= */
++local unsigned long gf2_matrix_times(mat, vec)
++ unsigned long *mat;
++ unsigned long vec;
++{
++ unsigned long sum;
++
++ sum = 0;
++ while (vec) {
++ if (vec & 1)
++ sum ^= *mat;
++ vec >>= 1;
++ mat++;
++ }
++ return sum;
++}
++
++/* ========================================================================= */
++local void gf2_matrix_square(square, mat)
++ unsigned long *square;
++ unsigned long *mat;
++{
++ int n;
++
++ for (n = 0; n < GF2_DIM; n++)
++ square[n] = gf2_matrix_times(mat, mat[n]);
++}
++
++/* ========================================================================= */
++local uLong crc32_combine_(crc1, crc2, len2)
++ uLong crc1;
++ uLong crc2;
++ z_off64_t len2;
++{
++ int n;
++ unsigned long row;
++ unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
++ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
++
++ /* degenerate case (also disallow negative lengths) */
++ if (len2 <= 0)
++ return crc1;
++
++ /* put operator for one zero bit in odd */
++ odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
++ row = 1;
++ for (n = 1; n < GF2_DIM; n++) {
++ odd[n] = row;
++ row <<= 1;
++ }
++
++ /* put operator for two zero bits in even */
++ gf2_matrix_square(even, odd);
++
++ /* put operator for four zero bits in odd */
++ gf2_matrix_square(odd, even);
++
++ /* apply len2 zeros to crc1 (first square will put the operator for one
++ zero byte, eight zero bits, in even) */
++ do {
++ /* apply zeros operator for this bit of len2 */
++ gf2_matrix_square(even, odd);
++ if (len2 & 1)
++ crc1 = gf2_matrix_times(even, crc1);
++ len2 >>= 1;
++
++ /* if no more bits set, then done */
++ if (len2 == 0)
++ break;
++
++ /* another iteration of the loop with odd and even swapped */
++ gf2_matrix_square(odd, even);
++ if (len2 & 1)
++ crc1 = gf2_matrix_times(odd, crc1);
++ len2 >>= 1;
++
++ /* if no more bits set, then done */
++ } while (len2 != 0);
++
++ /* return combined crc */
++ crc1 ^= crc2;
++ return crc1;
++}
++
++/* ========================================================================= */
++uLong ZEXPORT crc32_combine(crc1, crc2, len2)
++ uLong crc1;
++ uLong crc2;
++ z_off_t len2;
++{
++ return crc32_combine_(crc1, crc2, len2);
++}
++
++uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
++ uLong crc1;
++ uLong crc2;
++ z_off64_t len2;
++{
++ return crc32_combine_(crc1, crc2, len2);
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zlib.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,1792 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* zlib.h -- interface of the 'zlib' general purpose compression library
++ version 1.2.8, April 28th, 2013
++
++ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
++
++ This software is provided 'as-is', without any express or implied
++ warranty. In no event will the authors be held liable for any damages
++ arising from the use of this software.
++
++ Permission is granted to anyone to use this software for any purpose,
++ including commercial applications, and to alter it and redistribute it
++ freely, subject to the following restrictions:
++
++ 1. The origin of this software must not be misrepresented; you must not
++ claim that you wrote the original software. If you use this software
++ in a product, an acknowledgment in the product documentation would be
++ appreciated but is not required.
++ 2. Altered source versions must be plainly marked as such, and must not be
++ misrepresented as being the original software.
++ 3. This notice may not be removed or altered from any source distribution.
++
++ Jean-loup Gailly Mark Adler
++ jloup@gzip.org madler@alumni.caltech.edu
++
++
++ The data format used by the zlib library is described by RFCs (Request for
++ Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
++ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
++*/
++
++#ifndef ZLIB_H
++#define ZLIB_H
++
++#include "zconf.h"
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#define ZLIB_VERSION "1.2.8"
++#define ZLIB_VERNUM 0x1280
++#define ZLIB_VER_MAJOR 1
++#define ZLIB_VER_MINOR 2
++#define ZLIB_VER_REVISION 8
++#define ZLIB_VER_SUBREVISION 0
++
++/*
++ The 'zlib' compression library provides in-memory compression and
++ decompression functions, including integrity checks of the uncompressed data.
++ This version of the library supports only one compression method (deflation)
++ but other algorithms will be added later and will have the same stream
++ interface.
++
++ Compression can be done in a single step if the buffers are large enough,
++ or can be done by repeated calls of the compression function. In the latter
++ case, the application must provide more input and/or consume the output
++ (providing more output space) before each call.
++
++ The compressed data format used by default by the in-memory functions is
++ the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
++ around a deflate stream, which is itself documented in RFC 1951.
++
++ The library also supports reading and writing files in gzip (.gz) format
++ with an interface similar to that of stdio using the functions that start
++ with "gz". The gzip format is different from the zlib format. gzip is a
++ gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
++
++ This library can optionally read and write gzip streams in memory as well.
++
++ The zlib format was designed to be compact and fast for use in memory
++ and on communications channels. The gzip format was designed for single-
++ file compression on file systems, has a larger header than zlib to maintain
++ directory information, and uses a different, slower check method than zlib.
++
++ The library does not install any signal handler. The decoder checks
++ the consistency of the compressed data, so the library should never crash
++ even in case of corrupted input.
++*/
++
++typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
++typedef void (*free_func) OF((voidpf opaque, voidpf address));
++
++struct internal_state;
++
++typedef struct z_stream_s {
++ z_const Bytef *next_in; /* next input byte */
++ uInt avail_in; /* number of bytes available at next_in */
++ uLong total_in; /* total number of input bytes read so far */
++
++ Bytef *next_out; /* next output byte should be put there */
++ uInt avail_out; /* remaining free space at next_out */
++ uLong total_out; /* total number of bytes output so far */
++
++ z_const char *msg; /* last error message, NULL if no error */
++ struct internal_state FAR *state; /* not visible by applications */
++
++ alloc_func zalloc; /* used to allocate the internal state */
++ free_func zfree; /* used to free the internal state */
++ voidpf opaque; /* private data object passed to zalloc and zfree */
++
++ int data_type; /* best guess about the data type: binary or text */
++ uLong adler; /* adler32 value of the uncompressed data */
++ uLong reserved; /* reserved for future use */
++} z_stream;
++
++typedef z_stream FAR *z_streamp;
++
++/*
++ gzip header information passed to and from zlib routines. See RFC 1952
++ for more details on the meanings of these fields.
++*/
++typedef struct gz_header_s {
++ int text; /* true if compressed data believed to be text */
++ uLong time; /* modification time */
++ int xflags; /* extra flags (not used when writing a gzip file) */
++ int os; /* operating system */
++ Bytef *extra; /* pointer to extra field or Z_NULL if none */
++ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
++ uInt extra_max; /* space at extra (only when reading header) */
++ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
++ uInt name_max; /* space at name (only when reading header) */
++ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
++ uInt comm_max; /* space at comment (only when reading header) */
++ int hcrc; /* true if there was or will be a header crc */
++ int done; /* true when done reading gzip header (not used
++ when writing a gzip file) */
++} gz_header;
++
++typedef gz_header FAR *gz_headerp;
++
++/*
++ The application must update next_in and avail_in when avail_in has dropped
++ to zero. It must update next_out and avail_out when avail_out has dropped
++ to zero. The application must initialize zalloc, zfree and opaque before
++ calling the init function. All other fields are set by the compression
++ library and must not be updated by the application.
++
++ The opaque value provided by the application will be passed as the first
++ parameter for calls of zalloc and zfree. This can be useful for custom
++ memory management. The compression library attaches no meaning to the
++ opaque value.
++
++ zalloc must return Z_NULL if there is not enough memory for the object.
++ If zlib is used in a multi-threaded application, zalloc and zfree must be
++ thread safe.
++
++ On 16-bit systems, the functions zalloc and zfree must be able to allocate
++ exactly 65536 bytes, but will not be required to allocate more than this if
++ the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers
++ returned by zalloc for objects of exactly 65536 bytes *must* have their
++ offset normalized to zero. The default allocation function provided by this
++ library ensures this (see zutil.c). To reduce memory requirements and avoid
++ any allocation of 64K objects, at the expense of compression ratio, compile
++ the library with -DMAX_WBITS=14 (see zconf.h).
++
++ The fields total_in and total_out can be used for statistics or progress
++ reports. After compression, total_in holds the total size of the
++ uncompressed data and may be saved for use in the decompressor (particularly
++ if the decompressor wants to decompress everything in a single step).
++*/
++
++ /* constants */
++
++#define Z_NO_FLUSH 0
++#define Z_PARTIAL_FLUSH 1
++#define Z_SYNC_FLUSH 2
++#define Z_FULL_FLUSH 3
++#define Z_FINISH 4
++#define Z_BLOCK 5
++#define Z_TREES 6
++/* Allowed flush values; see deflate() and inflate() below for details */
++
++#define Z_OK 0
++#define Z_STREAM_END 1
++#define Z_NEED_DICT 2
++#define Z_ERRNO (-1)
++#define Z_STREAM_ERROR (-2)
++#define Z_DATA_ERROR (-3)
++#define Z_MEM_ERROR (-4)
++#define Z_BUF_ERROR (-5)
++#define Z_VERSION_ERROR (-6)
++/* Return codes for the compression/decompression functions. Negative values
++ * are errors, positive values are used for special but normal events.
++ */
++
++#define Z_NO_COMPRESSION 0
++#define Z_BEST_SPEED 1
++#define Z_BEST_COMPRESSION 9
++#define Z_DEFAULT_COMPRESSION (-1)
++/* compression levels */
++
++#define Z_FILTERED 1
++#define Z_HUFFMAN_ONLY 2
++#define Z_RLE 3
++#define Z_FIXED 4
++#define Z_DEFAULT_STRATEGY 0
++/* compression strategy; see deflateInit2() below for details */
++
++#define Z_BINARY 0
++#define Z_TEXT 1
++#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
++#define Z_UNKNOWN 2
++/* Possible values of the data_type field (though see inflate()) */
++
++#define Z_DEFLATED 8
++/* The deflate compression method (the only one supported in this version) */
++
++#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
++
++#define zlib_version zlibVersion()
++/* for compatibility with versions < 1.0.2 */
++
++
++ /* basic functions */
++
++ZEXTERN const char * ZEXPORT zlibVersion OF((void));
++/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
++ If the first character differs, the library code actually used is not
++ compatible with the zlib.h header file used by the application. This check
++ is automatically made by deflateInit and inflateInit.
++ */
++
++/*
++ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
++
++ Initializes the internal stream state for compression. The fields
++ zalloc, zfree and opaque must be initialized before by the caller. If
++ zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
++ allocation functions.
++
++ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
++ 1 gives best speed, 9 gives best compression, 0 gives no compression at all
++ (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
++ requests a default compromise between speed and compression (currently
++ equivalent to level 6).
++
++ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_STREAM_ERROR if level is not a valid compression level, or
++ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
++ with the version assumed by the caller (ZLIB_VERSION). msg is set to null
++ if there is no error message. deflateInit does not perform any compression:
++ this will be done by deflate().
++*/
++
++
++ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
++/*
++ deflate compresses as much data as possible, and stops when the input
++ buffer becomes empty or the output buffer becomes full. It may introduce
++ some output latency (reading input without producing any output) except when
++ forced to flush.
++
++ The detailed semantics are as follows. deflate performs one or both of the
++ following actions:
++
++ - Compress more input starting at next_in and update next_in and avail_in
++ accordingly. If not all input can be processed (because there is not
++ enough room in the output buffer), next_in and avail_in are updated and
++ processing will resume at this point for the next call of deflate().
++
++ - Provide more output starting at next_out and update next_out and avail_out
++ accordingly. This action is forced if the parameter flush is non zero.
++ Forcing flush frequently degrades the compression ratio, so this parameter
++ should be set only when necessary (in interactive applications). Some
++ output may be provided even if flush is not set.
++
++ Before the call of deflate(), the application should ensure that at least
++ one of the actions is possible, by providing more input and/or consuming more
++ output, and updating avail_in or avail_out accordingly; avail_out should
++ never be zero before the call. The application can consume the compressed
++ output when it wants, for example when the output buffer is full (avail_out
++ == 0), or after each call of deflate(). If deflate returns Z_OK and with
++ zero avail_out, it must be called again after making room in the output
++ buffer because there might be more output pending.
++
++ Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
++ decide how much data to accumulate before producing output, in order to
++ maximize compression.
++
++ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
++ flushed to the output buffer and the output is aligned on a byte boundary, so
++ that the decompressor can get all input data available so far. (In
++ particular avail_in is zero after the call if enough output space has been
++ provided before the call.) Flushing may degrade compression for some
++ compression algorithms and so it should be used only when necessary. This
++ completes the current deflate block and follows it with an empty stored block
++ that is three bits plus filler bits to the next byte, followed by four bytes
++ (00 00 ff ff).
++
++ If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
++ output buffer, but the output is not aligned to a byte boundary. All of the
++ input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
++ This completes the current deflate block and follows it with an empty fixed
++ codes block that is 10 bits long. This assures that enough bytes are output
++ in order for the decompressor to finish the block before the empty fixed code
++ block.
++
++ If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
++ for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
++ seven bits of the current block are held to be written as the next byte after
++ the next deflate block is completed. In this case, the decompressor may not
++ be provided enough bits at this point in order to complete decompression of
++ the data provided so far to the compressor. It may need to wait for the next
++ block to be emitted. This is for advanced applications that need to control
++ the emission of deflate blocks.
++
++ If flush is set to Z_FULL_FLUSH, all output is flushed as with
++ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
++ restart from this point if previous compressed data has been damaged or if
++ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
++ compression.
++
++ If deflate returns with avail_out == 0, this function must be called again
++ with the same value of the flush parameter and more output space (updated
++ avail_out), until the flush is complete (deflate returns with non-zero
++ avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
++ avail_out is greater than six to avoid repeated flush markers due to
++ avail_out == 0 on return.
++
++ If the parameter flush is set to Z_FINISH, pending input is processed,
++ pending output is flushed and deflate returns with Z_STREAM_END if there was
++ enough output space; if deflate returns with Z_OK, this function must be
++ called again with Z_FINISH and more output space (updated avail_out) but no
++ more input data, until it returns with Z_STREAM_END or an error. After
++ deflate has returned Z_STREAM_END, the only possible operations on the stream
++ are deflateReset or deflateEnd.
++
++ Z_FINISH can be used immediately after deflateInit if all the compression
++ is to be done in a single step. In this case, avail_out must be at least the
++ value returned by deflateBound (see below). Then deflate is guaranteed to
++ return Z_STREAM_END. If not enough output space is provided, deflate will
++ not return Z_STREAM_END, and it must be called again as described above.
++
++ deflate() sets strm->adler to the adler32 checksum of all input read
++ so far (that is, total_in bytes).
++
++ deflate() may update strm->data_type if it can make a good guess about
++ the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
++ binary. This field is only for information purposes and does not affect the
++ compression algorithm in any manner.
++
++ deflate() returns Z_OK if some progress has been made (more input
++ processed or more output produced), Z_STREAM_END if all input has been
++ consumed and all output has been produced (only when flush is set to
++ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
++ if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
++ (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
++ fatal, and deflate() can be called again with more input and more output
++ space to continue compressing.
++*/
++
++
++ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
++/*
++ All dynamically allocated data structures for this stream are freed.
++ This function discards any unprocessed input and does not flush any pending
++ output.
++
++ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
++ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
++ prematurely (some input or output was discarded). In the error case, msg
++ may be set but then points to a static string (which must not be
++ deallocated).
++*/
++
++
++/*
++ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
++
++ Initializes the internal stream state for decompression. The fields
++ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
++ the caller. If next_in is not Z_NULL and avail_in is large enough (the
++ exact value depends on the compression method), inflateInit determines the
++ compression method from the zlib header and allocates all data structures
++ accordingly; otherwise the allocation will be deferred to the first call of
++ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
++ use default allocation functions.
++
++ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
++ version assumed by the caller, or Z_STREAM_ERROR if the parameters are
++ invalid, such as a null pointer to the structure. msg is set to null if
++ there is no error message. inflateInit does not perform any decompression
++ apart from possibly reading the zlib header if present: actual decompression
++ will be done by inflate(). (So next_in and avail_in may be modified, but
++ next_out and avail_out are unused and unchanged.) The current implementation
++ of inflateInit() does not process any header information -- that is deferred
++ until inflate() is called.
++*/
++
++
++ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
++/*
++ inflate decompresses as much data as possible, and stops when the input
++ buffer becomes empty or the output buffer becomes full. It may introduce
++ some output latency (reading input without producing any output) except when
++ forced to flush.
++
++ The detailed semantics are as follows. inflate performs one or both of the
++ following actions:
++
++ - Decompress more input starting at next_in and update next_in and avail_in
++ accordingly. If not all input can be processed (because there is not
++ enough room in the output buffer), next_in is updated and processing will
++ resume at this point for the next call of inflate().
++
++ - Provide more output starting at next_out and update next_out and avail_out
++ accordingly. inflate() provides as much output as possible, until there is
++ no more input data or no more space in the output buffer (see below about
++ the flush parameter).
++
++ Before the call of inflate(), the application should ensure that at least
++ one of the actions is possible, by providing more input and/or consuming more
++ output, and updating the next_* and avail_* values accordingly. The
++ application can consume the uncompressed output when it wants, for example
++ when the output buffer is full (avail_out == 0), or after each call of
++ inflate(). If inflate returns Z_OK and with zero avail_out, it must be
++ called again after making room in the output buffer because there might be
++ more output pending.
++
++ The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
++ Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
++ output as possible to the output buffer. Z_BLOCK requests that inflate()
++ stop if and when it gets to the next deflate block boundary. When decoding
++ the zlib or gzip format, this will cause inflate() to return immediately
++ after the header and before the first block. When doing a raw inflate,
++ inflate() will go ahead and process the first block, and will return when it
++ gets to the end of that block, or when it runs out of data.
++
++ The Z_BLOCK option assists in appending to or combining deflate streams.
++ Also to assist in this, on return inflate() will set strm->data_type to the
++ number of unused bits in the last byte taken from strm->next_in, plus 64 if
++ inflate() is currently decoding the last block in the deflate stream, plus
++ 128 if inflate() returned immediately after decoding an end-of-block code or
++ decoding the complete header up to just before the first byte of the deflate
++ stream. The end-of-block will not be indicated until all of the uncompressed
++ data from that block has been written to strm->next_out. The number of
++ unused bits may in general be greater than seven, except when bit 7 of
++ data_type is set, in which case the number of unused bits will be less than
++ eight. data_type is set as noted here every time inflate() returns for all
++ flush options, and so can be used to determine the amount of currently
++ consumed input in bits.
++
++ The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
++ end of each deflate block header is reached, before any actual data in that
++ block is decoded. This allows the caller to determine the length of the
++ deflate block header for later use in random access within a deflate block.
++ 256 is added to the value of strm->data_type when inflate() returns
++ immediately after reaching the end of the deflate block header.
++
++ inflate() should normally be called until it returns Z_STREAM_END or an
++ error. However if all decompression is to be performed in a single step (a
++ single call of inflate), the parameter flush should be set to Z_FINISH. In
++ this case all pending input is processed and all pending output is flushed;
++ avail_out must be large enough to hold all of the uncompressed data for the
++ operation to complete. (The size of the uncompressed data may have been
++ saved by the compressor for this purpose.) The use of Z_FINISH is not
++ required to perform an inflation in one step. However it may be used to
++ inform inflate that a faster approach can be used for the single inflate()
++ call. Z_FINISH also informs inflate to not maintain a sliding window if the
++ stream completes, which reduces inflate's memory footprint. If the stream
++ does not complete, either because not all of the stream is provided or not
++ enough output space is provided, then a sliding window will be allocated and
++ inflate() can be called again to continue the operation as if Z_NO_FLUSH had
++ been used.
++
++ In this implementation, inflate() always flushes as much output as
++ possible to the output buffer, and always uses the faster approach on the
++ first call. So the effects of the flush parameter in this implementation are
++ on the return value of inflate() as noted below, when inflate() returns early
++ when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
++ memory for a sliding window when Z_FINISH is used.
++
++ If a preset dictionary is needed after this call (see inflateSetDictionary
++ below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
++ chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
++ strm->adler to the Adler-32 checksum of all output produced so far (that is,
++ total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
++ below. At the end of the stream, inflate() checks that its computed adler32
++ checksum is equal to that saved by the compressor and returns Z_STREAM_END
++ only if the checksum is correct.
++
++ inflate() can decompress and check either zlib-wrapped or gzip-wrapped
++ deflate data. The header type is detected automatically, if requested when
++ initializing with inflateInit2(). Any information contained in the gzip
++ header is not retained, so applications that need that information should
++ instead use raw inflate, see inflateInit2() below, or inflateBack() and
++ perform their own processing of the gzip header and trailer. When processing
++ gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
++ producted so far. The CRC-32 is checked against the gzip trailer.
++
++ inflate() returns Z_OK if some progress has been made (more input processed
++ or more output produced), Z_STREAM_END if the end of the compressed data has
++ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
++ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
++ corrupted (input stream not conforming to the zlib format or incorrect check
++ value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
++ next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
++ Z_BUF_ERROR if no progress is possible or if there was not enough room in the
++ output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
++ inflate() can be called again with more input and more output space to
++ continue decompressing. If Z_DATA_ERROR is returned, the application may
++ then call inflateSync() to look for a good compression block if a partial
++ recovery of the data is desired.
++*/
++
++
++ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
++/*
++ All dynamically allocated data structures for this stream are freed.
++ This function discards any unprocessed input and does not flush any pending
++ output.
++
++ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
++ was inconsistent. In the error case, msg may be set but then points to a
++ static string (which must not be deallocated).
++*/
++
++
++ /* Advanced functions */
++
++/*
++ The following functions are needed only in some special applications.
++*/
++
++/*
++ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
++ int level,
++ int method,
++ int windowBits,
++ int memLevel,
++ int strategy));
++
++ This is another version of deflateInit with more compression options. The
++ fields next_in, zalloc, zfree and opaque must be initialized before by the
++ caller.
++
++ The method parameter is the compression method. It must be Z_DEFLATED in
++ this version of the library.
++
++ The windowBits parameter is the base two logarithm of the window size
++ (the size of the history buffer). It should be in the range 8..15 for this
++ version of the library. Larger values of this parameter result in better
++ compression at the expense of memory usage. The default value is 15 if
++ deflateInit is used instead.
++
++ windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
++ determines the window size. deflate() will then generate raw deflate data
++ with no zlib header or trailer, and will not compute an adler32 check value.
++
++ windowBits can also be greater than 15 for optional gzip encoding. Add
++ 16 to windowBits to write a simple gzip header and trailer around the
++ compressed data instead of a zlib wrapper. The gzip header will have no
++ file name, no extra data, no comment, no modification time (set to zero), no
++ header crc, and the operating system will be set to 255 (unknown). If a
++ gzip stream is being written, strm->adler is a crc32 instead of an adler32.
++
++ The memLevel parameter specifies how much memory should be allocated
++ for the internal compression state. memLevel=1 uses minimum memory but is
++ slow and reduces compression ratio; memLevel=9 uses maximum memory for
++ optimal speed. The default value is 8. See zconf.h for total memory usage
++ as a function of windowBits and memLevel.
++
++ The strategy parameter is used to tune the compression algorithm. Use the
++ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
++ filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
++ string match), or Z_RLE to limit match distances to one (run-length
++ encoding). Filtered data consists mostly of small values with a somewhat
++ random distribution. In this case, the compression algorithm is tuned to
++ compress them better. The effect of Z_FILTERED is to force more Huffman
++ coding and less string matching; it is somewhat intermediate between
++ Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
++ fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
++ strategy parameter only affects the compression ratio but not the
++ correctness of the compressed output even if it is not set appropriately.
++ Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
++ decoder for special applications.
++
++ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
++ method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
++ incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
++ set to null if there is no error message. deflateInit2 does not perform any
++ compression: this will be done by deflate().
++*/
++
++ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
++ const Bytef *dictionary,
++ uInt dictLength));
++/*
++ Initializes the compression dictionary from the given byte sequence
++ without producing any compressed output. When using the zlib format, this
++ function must be called immediately after deflateInit, deflateInit2 or
++ deflateReset, and before any call of deflate. When doing raw deflate, this
++ function must be called either before any call of deflate, or immediately
++ after the completion of a deflate block, i.e. after all input has been
++ consumed and all output has been delivered when using any of the flush
++ options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
++ compressor and decompressor must use exactly the same dictionary (see
++ inflateSetDictionary).
++
++ The dictionary should consist of strings (byte sequences) that are likely
++ to be encountered later in the data to be compressed, with the most commonly
++ used strings preferably put towards the end of the dictionary. Using a
++ dictionary is most useful when the data to be compressed is short and can be
++ predicted with good accuracy; the data can then be compressed better than
++ with the default empty dictionary.
++
++ Depending on the size of the compression data structures selected by
++ deflateInit or deflateInit2, a part of the dictionary may in effect be
++ discarded, for example if the dictionary is larger than the window size
++ provided in deflateInit or deflateInit2. Thus the strings most likely to be
++ useful should be put at the end of the dictionary, not at the front. In
++ addition, the current implementation of deflate will use at most the window
++ size minus 262 bytes of the provided dictionary.
++
++ Upon return of this function, strm->adler is set to the adler32 value
++ of the dictionary; the decompressor may later use this value to determine
++ which dictionary has been used by the compressor. (The adler32 value
++ applies to the whole dictionary even if only a subset of the dictionary is
++ actually used by the compressor.) If a raw deflate was requested, then the
++ adler32 value is not computed and strm->adler is not set.
++
++ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
++ parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
++ inconsistent (for example if deflate has already been called for this stream
++ or if not at a block boundary for raw deflate). deflateSetDictionary does
++ not perform any compression: this will be done by deflate().
++*/
++
++ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
++ z_streamp source));
++/*
++ Sets the destination stream as a complete copy of the source stream.
++
++ This function can be useful when several compression strategies will be
++ tried, for example when there are several ways of pre-processing the input
++ data with a filter. The streams that will be discarded should then be freed
++ by calling deflateEnd. Note that deflateCopy duplicates the internal
++ compression state which can be quite large, so this strategy is slow and can
++ consume lots of memory.
++
++ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
++ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
++ (such as zalloc being Z_NULL). msg is left unchanged in both source and
++ destination.
++*/
++
++ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
++/*
++ This function is equivalent to deflateEnd followed by deflateInit,
++ but does not free and reallocate all the internal compression state. The
++ stream will keep the same compression level and any other attributes that
++ may have been set by deflateInit2.
++
++ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent (such as zalloc or state being Z_NULL).
++*/
++
++ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
++ int level,
++ int strategy));
++/*
++ Dynamically update the compression level and compression strategy. The
++ interpretation of level and strategy is as in deflateInit2. This can be
++ used to switch between compression and straight copy of the input data, or
++ to switch to a different kind of input data requiring a different strategy.
++ If the compression level is changed, the input available so far is
++ compressed with the old level (and may be flushed); the new level will take
++ effect only at the next call of deflate().
++
++ Before the call of deflateParams, the stream state must be set as for
++ a call of deflate(), since the currently available input may have to be
++ compressed and flushed. In particular, strm->avail_out must be non-zero.
++
++ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
++ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
++ strm->avail_out was zero.
++*/
++
++ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
++ int good_length,
++ int max_lazy,
++ int nice_length,
++ int max_chain));
++/*
++ Fine tune deflate's internal compression parameters. This should only be
++ used by someone who understands the algorithm used by zlib's deflate for
++ searching for the best matching string, and even then only by the most
++ fanatic optimizer trying to squeeze out the last compressed bit for their
++ specific input data. Read the deflate.c source code for the meaning of the
++ max_lazy, good_length, nice_length, and max_chain parameters.
++
++ deflateTune() can be called after deflateInit() or deflateInit2(), and
++ returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
++ */
++
++ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
++ uLong sourceLen));
++/*
++ deflateBound() returns an upper bound on the compressed size after
++ deflation of sourceLen bytes. It must be called after deflateInit() or
++ deflateInit2(), and after deflateSetHeader(), if used. This would be used
++ to allocate an output buffer for deflation in a single pass, and so would be
++ called before deflate(). If that first deflate() call is provided the
++ sourceLen input bytes, an output buffer allocated to the size returned by
++ deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
++ to return Z_STREAM_END. Note that it is possible for the compressed size to
++ be larger than the value returned by deflateBound() if flush options other
++ than Z_FINISH or Z_NO_FLUSH are used.
++*/
++
++ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
++ unsigned *pending,
++ int *bits));
++/*
++ deflatePending() returns the number of bytes and bits of output that have
++ been generated, but not yet provided in the available output. The bytes not
++ provided would be due to the available output space having being consumed.
++ The number of bits of output not provided are between 0 and 7, where they
++ await more bits to join them in order to fill out a full byte. If pending
++ or bits are Z_NULL, then those values are not set.
++
++ deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent.
++ */
++
++ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
++ int bits,
++ int value));
++/*
++ deflatePrime() inserts bits in the deflate output stream. The intent
++ is that this function is used to start off the deflate output with the bits
++ leftover from a previous deflate stream when appending to it. As such, this
++ function can only be used for raw deflate, and must be used before the first
++ deflate() call after a deflateInit2() or deflateReset(). bits must be less
++ than or equal to 16, and that many of the least significant bits of value
++ will be inserted in the output.
++
++ deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
++ room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
++ source stream state was inconsistent.
++*/
++
++ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
++ gz_headerp head));
++/*
++ deflateSetHeader() provides gzip header information for when a gzip
++ stream is requested by deflateInit2(). deflateSetHeader() may be called
++ after deflateInit2() or deflateReset() and before the first call of
++ deflate(). The text, time, os, extra field, name, and comment information
++ in the provided gz_header structure are written to the gzip header (xflag is
++ ignored -- the extra flags are set according to the compression level). The
++ caller must assure that, if not Z_NULL, name and comment are terminated with
++ a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
++ available there. If hcrc is true, a gzip header crc is included. Note that
++ the current versions of the command-line version of gzip (up through version
++ 1.3.x) do not support header crc's, and will report that it is a "multi-part
++ gzip file" and give up.
++
++ If deflateSetHeader is not used, the default gzip header has text false,
++ the time set to zero, and os set to 255, with no extra, name, or comment
++ fields. The gzip header is returned to the default state by deflateReset().
++
++ deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent.
++*/
++
++/*
++ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
++ int windowBits));
++
++ This is another version of inflateInit with an extra parameter. The
++ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
++ before by the caller.
++
++ The windowBits parameter is the base two logarithm of the maximum window
++ size (the size of the history buffer). It should be in the range 8..15 for
++ this version of the library. The default value is 15 if inflateInit is used
++ instead. windowBits must be greater than or equal to the windowBits value
++ provided to deflateInit2() while compressing, or it must be equal to 15 if
++ deflateInit2() was not used. If a compressed stream with a larger window
++ size is given as input, inflate() will return with the error code
++ Z_DATA_ERROR instead of trying to allocate a larger window.
++
++ windowBits can also be zero to request that inflate use the window size in
++ the zlib header of the compressed stream.
++
++ windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
++ determines the window size. inflate() will then process raw deflate data,
++ not looking for a zlib or gzip header, not generating a check value, and not
++ looking for any check values for comparison at the end of the stream. This
++ is for use with other formats that use the deflate compressed data format
++ such as zip. Those formats provide their own check values. If a custom
++ format is developed using the raw deflate format for compressed data, it is
++ recommended that a check value such as an adler32 or a crc32 be applied to
++ the uncompressed data as is done in the zlib, gzip, and zip formats. For
++ most applications, the zlib format should be used as is. Note that comments
++ above on the use in deflateInit2() applies to the magnitude of windowBits.
++
++ windowBits can also be greater than 15 for optional gzip decoding. Add
++ 32 to windowBits to enable zlib and gzip decoding with automatic header
++ detection, or add 16 to decode only the gzip format (the zlib format will
++ return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
++ crc32 instead of an adler32.
++
++ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
++ version assumed by the caller, or Z_STREAM_ERROR if the parameters are
++ invalid, such as a null pointer to the structure. msg is set to null if
++ there is no error message. inflateInit2 does not perform any decompression
++ apart from possibly reading the zlib header if present: actual decompression
++ will be done by inflate(). (So next_in and avail_in may be modified, but
++ next_out and avail_out are unused and unchanged.) The current implementation
++ of inflateInit2() does not process any header information -- that is
++ deferred until inflate() is called.
++*/
++
++ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
++ const Bytef *dictionary,
++ uInt dictLength));
++/*
++ Initializes the decompression dictionary from the given uncompressed byte
++ sequence. This function must be called immediately after a call of inflate,
++ if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
++ can be determined from the adler32 value returned by that call of inflate.
++ The compressor and decompressor must use exactly the same dictionary (see
++ deflateSetDictionary). For raw inflate, this function can be called at any
++ time to set the dictionary. If the provided dictionary is smaller than the
++ window and there is already data in the window, then the provided dictionary
++ will amend what's there. The application must insure that the dictionary
++ that was used for compression is provided.
++
++ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
++ parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
++ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
++ expected one (incorrect adler32 value). inflateSetDictionary does not
++ perform any decompression: this will be done by subsequent calls of
++ inflate().
++*/
++
++ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
++ Bytef *dictionary,
++ uInt *dictLength));
++/*
++ Returns the sliding dictionary being maintained by inflate. dictLength is
++ set to the number of bytes in the dictionary, and that many bytes are copied
++ to dictionary. dictionary must have enough space, where 32768 bytes is
++ always enough. If inflateGetDictionary() is called with dictionary equal to
++ Z_NULL, then only the dictionary length is returned, and nothing is copied.
++ Similary, if dictLength is Z_NULL, then it is not set.
++
++ inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
++ stream state is inconsistent.
++*/
++
++ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
++/*
++ Skips invalid compressed data until a possible full flush point (see above
++ for the description of deflate with Z_FULL_FLUSH) can be found, or until all
++ available input is skipped. No output is provided.
++
++ inflateSync searches for a 00 00 FF FF pattern in the compressed data.
++ All full flush points have this pattern, but not all occurrences of this
++ pattern are full flush points.
++
++ inflateSync returns Z_OK if a possible full flush point has been found,
++ Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
++ has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
++ In the success case, the application may save the current current value of
++ total_in which indicates where valid compressed data was found. In the
++ error case, the application may repeatedly call inflateSync, providing more
++ input each time, until success or end of the input data.
++*/
++
++ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
++ z_streamp source));
++/*
++ Sets the destination stream as a complete copy of the source stream.
++
++ This function can be useful when randomly accessing a large stream. The
++ first pass through the stream can periodically record the inflate state,
++ allowing restarting inflate at those points when randomly accessing the
++ stream.
++
++ inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
++ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
++ (such as zalloc being Z_NULL). msg is left unchanged in both source and
++ destination.
++*/
++
++ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
++/*
++ This function is equivalent to inflateEnd followed by inflateInit,
++ but does not free and reallocate all the internal decompression state. The
++ stream will keep attributes that may have been set by inflateInit2.
++
++ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent (such as zalloc or state being Z_NULL).
++*/
++
++ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
++ int windowBits));
++/*
++ This function is the same as inflateReset, but it also permits changing
++ the wrap and window size requests. The windowBits parameter is interpreted
++ the same as it is for inflateInit2.
++
++ inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent (such as zalloc or state being Z_NULL), or if
++ the windowBits parameter is invalid.
++*/
++
++ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
++ int bits,
++ int value));
++/*
++ This function inserts bits in the inflate input stream. The intent is
++ that this function is used to start inflating at a bit position in the
++ middle of a byte. The provided bits will be used before any bytes are used
++ from next_in. This function should only be used with raw inflate, and
++ should be used before the first inflate() call after inflateInit2() or
++ inflateReset(). bits must be less than or equal to 16, and that many of the
++ least significant bits of value will be inserted in the input.
++
++ If bits is negative, then the input stream bit buffer is emptied. Then
++ inflatePrime() can be called again to put bits in the buffer. This is used
++ to clear out bits leftover after feeding inflate a block description prior
++ to feeding inflate codes.
++
++ inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent.
++*/
++
++ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
++/*
++ This function returns two values, one in the lower 16 bits of the return
++ value, and the other in the remaining upper bits, obtained by shifting the
++ return value down 16 bits. If the upper value is -1 and the lower value is
++ zero, then inflate() is currently decoding information outside of a block.
++ If the upper value is -1 and the lower value is non-zero, then inflate is in
++ the middle of a stored block, with the lower value equaling the number of
++ bytes from the input remaining to copy. If the upper value is not -1, then
++ it is the number of bits back from the current bit position in the input of
++ the code (literal or length/distance pair) currently being processed. In
++ that case the lower value is the number of bytes already emitted for that
++ code.
++
++ A code is being processed if inflate is waiting for more input to complete
++ decoding of the code, or if it has completed decoding but is waiting for
++ more output space to write the literal or match data.
++
++ inflateMark() is used to mark locations in the input data for random
++ access, which may be at bit positions, and to note those cases where the
++ output of a code may span boundaries of random access blocks. The current
++ location in the input stream can be determined from avail_in and data_type
++ as noted in the description for the Z_BLOCK flush parameter for inflate.
++
++ inflateMark returns the value noted above or -1 << 16 if the provided
++ source stream state was inconsistent.
++*/
++
++ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
++ gz_headerp head));
++/*
++ inflateGetHeader() requests that gzip header information be stored in the
++ provided gz_header structure. inflateGetHeader() may be called after
++ inflateInit2() or inflateReset(), and before the first call of inflate().
++ As inflate() processes the gzip stream, head->done is zero until the header
++ is completed, at which time head->done is set to one. If a zlib stream is
++ being decoded, then head->done is set to -1 to indicate that there will be
++ no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
++ used to force inflate() to return immediately after header processing is
++ complete and before any actual data is decompressed.
++
++ The text, time, xflags, and os fields are filled in with the gzip header
++ contents. hcrc is set to true if there is a header CRC. (The header CRC
++ was valid if done is set to one.) If extra is not Z_NULL, then extra_max
++ contains the maximum number of bytes to write to extra. Once done is true,
++ extra_len contains the actual extra field length, and extra contains the
++ extra field, or that field truncated if extra_max is less than extra_len.
++ If name is not Z_NULL, then up to name_max characters are written there,
++ terminated with a zero unless the length is greater than name_max. If
++ comment is not Z_NULL, then up to comm_max characters are written there,
++ terminated with a zero unless the length is greater than comm_max. When any
++ of extra, name, or comment are not Z_NULL and the respective field is not
++ present in the header, then that field is set to Z_NULL to signal its
++ absence. This allows the use of deflateSetHeader() with the returned
++ structure to duplicate the header. However if those fields are set to
++ allocated memory, then the application will need to save those pointers
++ elsewhere so that they can be eventually freed.
++
++ If inflateGetHeader is not used, then the header information is simply
++ discarded. The header is always checked for validity, including the header
++ CRC if present. inflateReset() will reset the process to discard the header
++ information. The application would need to call inflateGetHeader() again to
++ retrieve the header from the next gzip stream.
++
++ inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
++ stream state was inconsistent.
++*/
++
++/*
++ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
++ unsigned char FAR *window));
++
++ Initialize the internal stream state for decompression using inflateBack()
++ calls. The fields zalloc, zfree and opaque in strm must be initialized
++ before the call. If zalloc and zfree are Z_NULL, then the default library-
++ derived memory allocation routines are used. windowBits is the base two
++ logarithm of the window size, in the range 8..15. window is a caller
++ supplied buffer of that size. Except for special applications where it is
++ assured that deflate was used with small window sizes, windowBits must be 15
++ and a 32K byte window must be supplied to be able to decompress general
++ deflate streams.
++
++ See inflateBack() for the usage of these routines.
++
++ inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
++ the parameters are invalid, Z_MEM_ERROR if the internal state could not be
++ allocated, or Z_VERSION_ERROR if the version of the library does not match
++ the version of the header file.
++*/
++
++typedef unsigned (*in_func) OF((void FAR *,
++ z_const unsigned char FAR * FAR *));
++typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
++
++ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
++ in_func in, void FAR *in_desc,
++ out_func out, void FAR *out_desc));
++/*
++ inflateBack() does a raw inflate with a single call using a call-back
++ interface for input and output. This is potentially more efficient than
++ inflate() for file i/o applications, in that it avoids copying between the
++ output and the sliding window by simply making the window itself the output
++ buffer. inflate() can be faster on modern CPUs when used with large
++ buffers. inflateBack() trusts the application to not change the output
++ buffer passed by the output function, at least until inflateBack() returns.
++
++ inflateBackInit() must be called first to allocate the internal state
++ and to initialize the state with the user-provided window buffer.
++ inflateBack() may then be used multiple times to inflate a complete, raw
++ deflate stream with each call. inflateBackEnd() is then called to free the
++ allocated state.
++
++ A raw deflate stream is one with no zlib or gzip header or trailer.
++ This routine would normally be used in a utility that reads zip or gzip
++ files and writes out uncompressed files. The utility would decode the
++ header and process the trailer on its own, hence this routine expects only
++ the raw deflate stream to decompress. This is different from the normal
++ behavior of inflate(), which expects either a zlib or gzip header and
++ trailer around the deflate stream.
++
++ inflateBack() uses two subroutines supplied by the caller that are then
++ called by inflateBack() for input and output. inflateBack() calls those
++ routines until it reads a complete deflate stream and writes out all of the
++ uncompressed data, or until it encounters an error. The function's
++ parameters and return types are defined above in the in_func and out_func
++ typedefs. inflateBack() will call in(in_desc, &buf) which should return the
++ number of bytes of provided input, and a pointer to that input in buf. If
++ there is no input available, in() must return zero--buf is ignored in that
++ case--and inflateBack() will return a buffer error. inflateBack() will call
++ out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
++ should return zero on success, or non-zero on failure. If out() returns
++ non-zero, inflateBack() will return with an error. Neither in() nor out()
++ are permitted to change the contents of the window provided to
++ inflateBackInit(), which is also the buffer that out() uses to write from.
++ The length written by out() will be at most the window size. Any non-zero
++ amount of input may be provided by in().
++
++ For convenience, inflateBack() can be provided input on the first call by
++ setting strm->next_in and strm->avail_in. If that input is exhausted, then
++ in() will be called. Therefore strm->next_in must be initialized before
++ calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
++ immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
++ must also be initialized, and then if strm->avail_in is not zero, input will
++ initially be taken from strm->next_in[0 .. strm->avail_in - 1].
++
++ The in_desc and out_desc parameters of inflateBack() is passed as the
++ first parameter of in() and out() respectively when they are called. These
++ descriptors can be optionally used to pass any information that the caller-
++ supplied in() and out() functions need to do their job.
++
++ On return, inflateBack() will set strm->next_in and strm->avail_in to
++ pass back any unused input that was provided by the last in() call. The
++ return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
++ if in() or out() returned an error, Z_DATA_ERROR if there was a format error
++ in the deflate stream (in which case strm->msg is set to indicate the nature
++ of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
++ In the case of Z_BUF_ERROR, an input or output error can be distinguished
++ using strm->next_in which will be Z_NULL only if in() returned an error. If
++ strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
++ non-zero. (in() will always be called before out(), so strm->next_in is
++ assured to be defined if out() returns non-zero.) Note that inflateBack()
++ cannot return Z_OK.
++*/
++
++ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
++/*
++ All memory allocated by inflateBackInit() is freed.
++
++ inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
++ state was inconsistent.
++*/
++
++ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
++/* Return flags indicating compile-time options.
++
++ Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
++ 1.0: size of uInt
++ 3.2: size of uLong
++ 5.4: size of voidpf (pointer)
++ 7.6: size of z_off_t
++
++ Compiler, assembler, and debug options:
++ 8: DEBUG
++ 9: ASMV or ASMINF -- use ASM code
++ 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
++ 11: 0 (reserved)
++
++ One-time table building (smaller code, but not thread-safe if true):
++ 12: BUILDFIXED -- build static block decoding tables when needed
++ 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
++ 14,15: 0 (reserved)
++
++ Library content (indicates missing functionality):
++ 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
++ deflate code when not needed)
++ 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
++ and decode gzip streams (to avoid linking crc code)
++ 18-19: 0 (reserved)
++
++ Operation variations (changes in library functionality):
++ 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
++ 21: FASTEST -- deflate algorithm with only one, lowest compression level
++ 22,23: 0 (reserved)
++
++ The sprintf variant used by gzprintf (zero is best):
++ 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
++ 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
++ 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
++
++ Remainder:
++ 27-31: 0 (reserved)
++ */
++
++#ifndef Z_SOLO
++
++ /* utility functions */
++
++/*
++ The following utility functions are implemented on top of the basic
++ stream-oriented functions. To simplify the interface, some default options
++ are assumed (compression level and memory usage, standard memory allocation
++ functions). The source code of these utility functions can be modified if
++ you need special options.
++*/
++
++ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
++ const Bytef *source, uLong sourceLen));
++/*
++ Compresses the source buffer into the destination buffer. sourceLen is
++ the byte length of the source buffer. Upon entry, destLen is the total size
++ of the destination buffer, which must be at least the value returned by
++ compressBound(sourceLen). Upon exit, destLen is the actual size of the
++ compressed buffer.
++
++ compress returns Z_OK if success, Z_MEM_ERROR if there was not
++ enough memory, Z_BUF_ERROR if there was not enough room in the output
++ buffer.
++*/
++
++ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
++ const Bytef *source, uLong sourceLen,
++ int level));
++/*
++ Compresses the source buffer into the destination buffer. The level
++ parameter has the same meaning as in deflateInit. sourceLen is the byte
++ length of the source buffer. Upon entry, destLen is the total size of the
++ destination buffer, which must be at least the value returned by
++ compressBound(sourceLen). Upon exit, destLen is the actual size of the
++ compressed buffer.
++
++ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
++ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
++ Z_STREAM_ERROR if the level parameter is invalid.
++*/
++
++ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
++/*
++ compressBound() returns an upper bound on the compressed size after
++ compress() or compress2() on sourceLen bytes. It would be used before a
++ compress() or compress2() call to allocate the destination buffer.
++*/
++
++ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
++ const Bytef *source, uLong sourceLen));
++/*
++ Decompresses the source buffer into the destination buffer. sourceLen is
++ the byte length of the source buffer. Upon entry, destLen is the total size
++ of the destination buffer, which must be large enough to hold the entire
++ uncompressed data. (The size of the uncompressed data must have been saved
++ previously by the compressor and transmitted to the decompressor by some
++ mechanism outside the scope of this compression library.) Upon exit, destLen
++ is the actual size of the uncompressed buffer.
++
++ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
++ enough memory, Z_BUF_ERROR if there was not enough room in the output
++ buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
++ the case where there is not enough room, uncompress() will fill the output
++ buffer with the uncompressed data up to that point.
++*/
++
++ /* gzip file access functions */
++
++/*
++ This library supports reading and writing files in gzip (.gz) format with
++ an interface similar to that of stdio, using the functions that start with
++ "gz". The gzip format is different from the zlib format. gzip is a gzip
++ wrapper, documented in RFC 1952, wrapped around a deflate stream.
++*/
++
++typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
++
++/*
++ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
++
++ Opens a gzip (.gz) file for reading or writing. The mode parameter is as
++ in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
++ a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
++ compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
++ for fixed code compression as in "wb9F". (See the description of
++ deflateInit2 for more information about the strategy parameter.) 'T' will
++ request transparent writing or appending with no compression and not using
++ the gzip format.
++
++ "a" can be used instead of "w" to request that the gzip stream that will
++ be written be appended to the file. "+" will result in an error, since
++ reading and writing to the same gzip file is not supported. The addition of
++ "x" when writing will create the file exclusively, which fails if the file
++ already exists. On systems that support it, the addition of "e" when
++ reading or writing will set the flag to close the file on an execve() call.
++
++ These functions, as well as gzip, will read and decode a sequence of gzip
++ streams in a file. The append function of gzopen() can be used to create
++ such a file. (Also see gzflush() for another way to do this.) When
++ appending, gzopen does not test whether the file begins with a gzip stream,
++ nor does it look for the end of the gzip streams to begin appending. gzopen
++ will simply append a gzip stream to the existing file.
++
++ gzopen can be used to read a file which is not in gzip format; in this
++ case gzread will directly read from the file without decompression. When
++ reading, this will be detected automatically by looking for the magic two-
++ byte gzip header.
++
++ gzopen returns NULL if the file could not be opened, if there was
++ insufficient memory to allocate the gzFile state, or if an invalid mode was
++ specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
++ errno can be checked to determine if the reason gzopen failed was that the
++ file could not be opened.
++*/
++
++ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
++/*
++ gzdopen associates a gzFile with the file descriptor fd. File descriptors
++ are obtained from calls like open, dup, creat, pipe or fileno (if the file
++ has been previously opened with fopen). The mode parameter is as in gzopen.
++
++ The next call of gzclose on the returned gzFile will also close the file
++ descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
++ fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
++ mode);. The duplicated descriptor should be saved to avoid a leak, since
++ gzdopen does not close fd if it fails. If you are using fileno() to get the
++ file descriptor from a FILE *, then you will have to use dup() to avoid
++ double-close()ing the file descriptor. Both gzclose() and fclose() will
++ close the associated file descriptor, so they need to have different file
++ descriptors.
++
++ gzdopen returns NULL if there was insufficient memory to allocate the
++ gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
++ provided, or '+' was provided), or if fd is -1. The file descriptor is not
++ used until the next gz* read, write, seek, or close operation, so gzdopen
++ will not detect if fd is invalid (unless fd is -1).
++*/
++
++ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
++/*
++ Set the internal buffer size used by this library's functions. The
++ default buffer size is 8192 bytes. This function must be called after
++ gzopen() or gzdopen(), and before any other calls that read or write the
++ file. The buffer memory allocation is always deferred to the first read or
++ write. Two buffers are allocated, either both of the specified size when
++ writing, or one of the specified size and the other twice that size when
++ reading. A larger buffer size of, for example, 64K or 128K bytes will
++ noticeably increase the speed of decompression (reading).
++
++ The new buffer size also affects the maximum length for gzprintf().
++
++ gzbuffer() returns 0 on success, or -1 on failure, such as being called
++ too late.
++*/
++
++ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
++/*
++ Dynamically update the compression level or strategy. See the description
++ of deflateInit2 for the meaning of these parameters.
++
++ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
++ opened for writing.
++*/
++
++ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
++/*
++ Reads the given number of uncompressed bytes from the compressed file. If
++ the input file is not in gzip format, gzread copies the given number of
++ bytes into the buffer directly from the file.
++
++ After reaching the end of a gzip stream in the input, gzread will continue
++ to read, looking for another gzip stream. Any number of gzip streams may be
++ concatenated in the input file, and will all be decompressed by gzread().
++ If something other than a gzip stream is encountered after a gzip stream,
++ that remaining trailing garbage is ignored (and no error is returned).
++
++ gzread can be used to read a gzip file that is being concurrently written.
++ Upon reaching the end of the input, gzread will return with the available
++ data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
++ gzclearerr can be used to clear the end of file indicator in order to permit
++ gzread to be tried again. Z_OK indicates that a gzip stream was completed
++ on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
++ middle of a gzip stream. Note that gzread does not return -1 in the event
++ of an incomplete gzip stream. This error is deferred until gzclose(), which
++ will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
++ stream. Alternatively, gzerror can be used before gzclose to detect this
++ case.
++
++ gzread returns the number of uncompressed bytes actually read, less than
++ len for end of file, or -1 for error.
++*/
++
++ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
++ voidpc buf, unsigned len));
++/*
++ Writes the given number of uncompressed bytes into the compressed file.
++ gzwrite returns the number of uncompressed bytes written or 0 in case of
++ error.
++*/
++
++ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
++/*
++ Converts, formats, and writes the arguments to the compressed file under
++ control of the format string, as in fprintf. gzprintf returns the number of
++ uncompressed bytes actually written, or 0 in case of error. The number of
++ uncompressed bytes written is limited to 8191, or one less than the buffer
++ size given to gzbuffer(). The caller should assure that this limit is not
++ exceeded. If it is exceeded, then gzprintf() will return an error (0) with
++ nothing written. In this case, there may also be a buffer overflow with
++ unpredictable consequences, which is possible only if zlib was compiled with
++ the insecure functions sprintf() or vsprintf() because the secure snprintf()
++ or vsnprintf() functions were not available. This can be determined using
++ zlibCompileFlags().
++*/
++
++ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
++/*
++ Writes the given null-terminated string to the compressed file, excluding
++ the terminating null character.
++
++ gzputs returns the number of characters written, or -1 in case of error.
++*/
++
++ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
++/*
++ Reads bytes from the compressed file until len-1 characters are read, or a
++ newline character is read and transferred to buf, or an end-of-file
++ condition is encountered. If any characters are read or if len == 1, the
++ string is terminated with a null character. If no characters are read due
++ to an end-of-file or len < 1, then the buffer is left untouched.
++
++ gzgets returns buf which is a null-terminated string, or it returns NULL
++ for end-of-file or in case of error. If there was an error, the contents at
++ buf are indeterminate.
++*/
++
++ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
++/*
++ Writes c, converted to an unsigned char, into the compressed file. gzputc
++ returns the value that was written, or -1 in case of error.
++*/
++
++ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
++/*
++ Reads one byte from the compressed file. gzgetc returns this byte or -1
++ in case of end of file or error. This is implemented as a macro for speed.
++ As such, it does not do all of the checking the other functions do. I.e.
++ it does not check to see if file is NULL, nor whether the structure file
++ points to has been clobbered or not.
++*/
++
++ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
++/*
++ Push one character back onto the stream to be read as the first character
++ on the next read. At least one character of push-back is allowed.
++ gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
++ fail if c is -1, and may fail if a character has been pushed but not read
++ yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
++ output buffer size of pushed characters is allowed. (See gzbuffer above.)
++ The pushed character will be discarded if the stream is repositioned with
++ gzseek() or gzrewind().
++*/
++
++ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
++/*
++ Flushes all pending output into the compressed file. The parameter flush
++ is as in the deflate() function. The return value is the zlib error number
++ (see function gzerror below). gzflush is only permitted when writing.
++
++ If the flush parameter is Z_FINISH, the remaining data is written and the
++ gzip stream is completed in the output. If gzwrite() is called again, a new
++ gzip stream will be started in the output. gzread() is able to read such
++ concatented gzip streams.
++
++ gzflush should be called only when strictly necessary because it will
++ degrade compression if called too often.
++*/
++
++/*
++ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
++ z_off_t offset, int whence));
++
++ Sets the starting position for the next gzread or gzwrite on the given
++ compressed file. The offset represents a number of bytes in the
++ uncompressed data stream. The whence parameter is defined as in lseek(2);
++ the value SEEK_END is not supported.
++
++ If the file is opened for reading, this function is emulated but can be
++ extremely slow. If the file is opened for writing, only forward seeks are
++ supported; gzseek then compresses a sequence of zeroes up to the new
++ starting position.
++
++ gzseek returns the resulting offset location as measured in bytes from
++ the beginning of the uncompressed stream, or -1 in case of error, in
++ particular if the file is opened for writing and the new starting position
++ would be before the current position.
++*/
++
++ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
++/*
++ Rewinds the given file. This function is supported only for reading.
++
++ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
++*/
++
++/*
++ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
++
++ Returns the starting position for the next gzread or gzwrite on the given
++ compressed file. This position represents a number of bytes in the
++ uncompressed data stream, and is zero when starting, even if appending or
++ reading a gzip stream from the middle of a file using gzdopen().
++
++ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
++*/
++
++/*
++ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
++
++ Returns the current offset in the file being read or written. This offset
++ includes the count of bytes that precede the gzip stream, for example when
++ appending or when using gzdopen() for reading. When reading, the offset
++ does not include as yet unused buffered input. This information can be used
++ for a progress indicator. On error, gzoffset() returns -1.
++*/
++
++ZEXTERN int ZEXPORT gzeof OF((gzFile file));
++/*
++ Returns true (1) if the end-of-file indicator has been set while reading,
++ false (0) otherwise. Note that the end-of-file indicator is set only if the
++ read tried to go past the end of the input, but came up short. Therefore,
++ just like feof(), gzeof() may return false even if there is no more data to
++ read, in the event that the last read request was for the exact number of
++ bytes remaining in the input file. This will happen if the input file size
++ is an exact multiple of the buffer size.
++
++ If gzeof() returns true, then the read functions will return no more data,
++ unless the end-of-file indicator is reset by gzclearerr() and the input file
++ has grown since the previous end of file was detected.
++*/
++
++ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
++/*
++ Returns true (1) if file is being copied directly while reading, or false
++ (0) if file is a gzip stream being decompressed.
++
++ If the input file is empty, gzdirect() will return true, since the input
++ does not contain a gzip stream.
++
++ If gzdirect() is used immediately after gzopen() or gzdopen() it will
++ cause buffers to be allocated to allow reading the file to determine if it
++ is a gzip file. Therefore if gzbuffer() is used, it should be called before
++ gzdirect().
++
++ When writing, gzdirect() returns true (1) if transparent writing was
++ requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
++ gzdirect() is not needed when writing. Transparent writing must be
++ explicitly requested, so the application already knows the answer. When
++ linking statically, using gzdirect() will include all of the zlib code for
++ gzip file reading and decompression, which may not be desired.)
++*/
++
++ZEXTERN int ZEXPORT gzclose OF((gzFile file));
++/*
++ Flushes all pending output if necessary, closes the compressed file and
++ deallocates the (de)compression state. Note that once file is closed, you
++ cannot call gzerror with file, since its structures have been deallocated.
++ gzclose must not be called more than once on the same file, just as free
++ must not be called more than once on the same allocation.
++
++ gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
++ file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
++ last read ended in the middle of a gzip stream, or Z_OK on success.
++*/
++
++ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
++ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
++/*
++ Same as gzclose(), but gzclose_r() is only for use when reading, and
++ gzclose_w() is only for use when writing or appending. The advantage to
++ using these instead of gzclose() is that they avoid linking in zlib
++ compression or decompression code that is not used when only reading or only
++ writing respectively. If gzclose() is used, then both compression and
++ decompression code will be included the application when linking to a static
++ zlib library.
++*/
++
++ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
++/*
++ Returns the error message for the last error which occurred on the given
++ compressed file. errnum is set to zlib error number. If an error occurred
++ in the file system and not in the compression library, errnum is set to
++ Z_ERRNO and the application may consult errno to get the exact error code.
++
++ The application must not modify the returned string. Future calls to
++ this function may invalidate the previously returned string. If file is
++ closed, then the string previously returned by gzerror will no longer be
++ available.
++
++ gzerror() should be used to distinguish errors from end-of-file for those
++ functions above that do not distinguish those cases in their return values.
++*/
++
++ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
++/*
++ Clears the error and end-of-file flags for file. This is analogous to the
++ clearerr() function in stdio. This is useful for continuing to read a gzip
++ file that is being written concurrently.
++*/
++
++#endif /* !Z_SOLO */
++
++ /* checksum functions */
++
++/*
++ These functions are not related to compression but are exported
++ anyway because they might be useful in applications using the compression
++ library.
++*/
++
++ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
++/*
++ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
++ return the updated checksum. If buf is Z_NULL, this function returns the
++ required initial value for the checksum.
++
++ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
++ much faster.
++
++ Usage example:
++
++ uLong adler = adler32(0L, Z_NULL, 0);
++
++ while (read_buffer(buffer, length) != EOF) {
++ adler = adler32(adler, buffer, length);
++ }
++ if (adler != original_adler) error();
++*/
++
++/*
++ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
++ z_off_t len2));
++
++ Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
++ and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
++ each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
++ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
++ that the z_off_t type (like off_t) is a signed integer. If len2 is
++ negative, the result has no meaning or utility.
++*/
++
++ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
++/*
++ Update a running CRC-32 with the bytes buf[0..len-1] and return the
++ updated CRC-32. If buf is Z_NULL, this function returns the required
++ initial value for the crc. Pre- and post-conditioning (one's complement) is
++ performed within this function so it shouldn't be done by the application.
++
++ Usage example:
++
++ uLong crc = crc32(0L, Z_NULL, 0);
++
++ while (read_buffer(buffer, length) != EOF) {
++ crc = crc32(crc, buffer, length);
++ }
++ if (crc != original_crc) error();
++*/
++
++/*
++ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
++
++ Combine two CRC-32 check values into one. For two sequences of bytes,
++ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
++ calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
++ check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
++ len2.
++*/
++
++
++ /* various hacks, don't look :) */
++
++/* deflateInit and inflateInit are macros to allow checking the zlib version
++ * and the compiler's view of z_stream:
++ */
++ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
++ const char *version, int stream_size));
++ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
++ const char *version, int stream_size));
++ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
++ int windowBits, int memLevel,
++ int strategy, const char *version,
++ int stream_size));
++ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
++ const char *version, int stream_size));
++ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
++ unsigned char FAR *window,
++ const char *version,
++ int stream_size));
++#define deflateInit(strm, level) \
++ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
++#define inflateInit(strm) \
++ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
++#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
++ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
++ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
++#define inflateInit2(strm, windowBits) \
++ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
++ (int)sizeof(z_stream))
++#define inflateBackInit(strm, windowBits, window) \
++ inflateBackInit_((strm), (windowBits), (window), \
++ ZLIB_VERSION, (int)sizeof(z_stream))
++
++#ifndef Z_SOLO
++
++/* gzgetc() macro and its supporting function and exposed data structure. Note
++ * that the real internal state is much larger than the exposed structure.
++ * This abbreviated structure exposes just enough for the gzgetc() macro. The
++ * user should not mess with these exposed elements, since their names or
++ * behavior could change in the future, perhaps even capriciously. They can
++ * only be used by the gzgetc() macro. You have been warned.
++ */
++struct gzFile_s {
++ unsigned have;
++ unsigned char *next;
++ z_off64_t pos;
++};
++ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
++#ifdef Z_PREFIX_SET
++# undef z_gzgetc
++# define z_gzgetc(g) \
++ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
++#else
++# define gzgetc(g) \
++ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
++#endif
++
++/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
++ * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
++ * both are true, the application gets the *64 functions, and the regular
++ * functions are changed to 64 bits) -- in case these are set on systems
++ * without large file support, _LFS64_LARGEFILE must also be true
++ */
++#ifdef Z_LARGE64
++ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
++ ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
++ ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
++ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
++ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
++ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
++#endif
++
++#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
++# ifdef Z_PREFIX_SET
++# define z_gzopen z_gzopen64
++# define z_gzseek z_gzseek64
++# define z_gztell z_gztell64
++# define z_gzoffset z_gzoffset64
++# define z_adler32_combine z_adler32_combine64
++# define z_crc32_combine z_crc32_combine64
++# else
++# define gzopen gzopen64
++# define gzseek gzseek64
++# define gztell gztell64
++# define gzoffset gzoffset64
++# define adler32_combine adler32_combine64
++# define crc32_combine crc32_combine64
++# endif
++# ifndef Z_LARGE64
++ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
++ ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
++ ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
++ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
++ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
++ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
++# endif
++#else
++ ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
++ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
++ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
++ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
++ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
++ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
++#endif
++
++#else /* Z_SOLO */
++
++ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
++ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
++
++#endif /* !Z_SOLO */
++
++/* hack for buggy compilers */
++#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
++ struct internal_state {int dummy;};
++#endif
++
++/* undocumented functions */
++ZEXTERN const char * ZEXPORT zError OF((int));
++ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
++ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
++ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
++ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
++ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
++#if defined(_WIN32) && !defined(Z_SOLO)
++ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
++ const char *mode));
++#endif
++#if defined(STDC) || defined(Z_HAVE_STDARG_H)
++# ifndef Z_SOLO
++ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
++ const char *format,
++ va_list va));
++# endif
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* ZLIB_H */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zutil.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,348 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* zutil.c -- target dependent utility functions for the compression library
++ * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* @(#) $Id$ */
++
++#include "zutil.h"
++#ifndef Z_SOLO
++# include "gzguts.h"
++#endif
++
++#ifndef NO_DUMMY_DECL
++struct internal_state {int dummy;}; /* for buggy compilers */
++#endif
++
++z_const char * const z_errmsg[10] = {
++"need dictionary", /* Z_NEED_DICT 2 */
++"stream end", /* Z_STREAM_END 1 */
++"", /* Z_OK 0 */
++"file error", /* Z_ERRNO (-1) */
++"stream error", /* Z_STREAM_ERROR (-2) */
++"data error", /* Z_DATA_ERROR (-3) */
++"insufficient memory", /* Z_MEM_ERROR (-4) */
++"buffer error", /* Z_BUF_ERROR (-5) */
++"incompatible version",/* Z_VERSION_ERROR (-6) */
++""};
++
++
++const char * ZEXPORT zlibVersion()
++{
++ return ZLIB_VERSION;
++}
++
++uLong ZEXPORT zlibCompileFlags()
++{
++ uLong flags;
++
++ flags = 0;
++ switch ((int)(sizeof(uInt))) {
++ case 2: break;
++ case 4: flags += 1; break;
++ case 8: flags += 2; break;
++ default: flags += 3;
++ }
++ switch ((int)(sizeof(uLong))) {
++ case 2: break;
++ case 4: flags += 1 << 2; break;
++ case 8: flags += 2 << 2; break;
++ default: flags += 3 << 2;
++ }
++ switch ((int)(sizeof(voidpf))) {
++ case 2: break;
++ case 4: flags += 1 << 4; break;
++ case 8: flags += 2 << 4; break;
++ default: flags += 3 << 4;
++ }
++ switch ((int)(sizeof(z_off_t))) {
++ case 2: break;
++ case 4: flags += 1 << 6; break;
++ case 8: flags += 2 << 6; break;
++ default: flags += 3 << 6;
++ }
++#ifdef DEBUG
++ flags += 1 << 8;
++#endif
++#if defined(ASMV) || defined(ASMINF)
++ flags += 1 << 9;
++#endif
++#ifdef ZLIB_WINAPI
++ flags += 1 << 10;
++#endif
++#ifdef BUILDFIXED
++ flags += 1 << 12;
++#endif
++#ifdef DYNAMIC_CRC_TABLE
++ flags += 1 << 13;
++#endif
++#ifdef NO_GZCOMPRESS
++ flags += 1L << 16;
++#endif
++#ifdef NO_GZIP
++ flags += 1L << 17;
++#endif
++#ifdef PKZIP_BUG_WORKAROUND
++ flags += 1L << 20;
++#endif
++#ifdef FASTEST
++ flags += 1L << 21;
++#endif
++#if defined(STDC) || defined(Z_HAVE_STDARG_H)
++# ifdef NO_vsnprintf
++ flags += 1L << 25;
++# ifdef HAS_vsprintf_void
++ flags += 1L << 26;
++# endif
++# else
++# ifdef HAS_vsnprintf_void
++ flags += 1L << 26;
++# endif
++# endif
++#else
++ flags += 1L << 24;
++# ifdef NO_snprintf
++ flags += 1L << 25;
++# ifdef HAS_sprintf_void
++ flags += 1L << 26;
++# endif
++# else
++# ifdef HAS_snprintf_void
++ flags += 1L << 26;
++# endif
++# endif
++#endif
++ return flags;
++}
++
++#ifdef DEBUG
++
++# ifndef verbose
++# define verbose 0
++# endif
++int ZLIB_INTERNAL z_verbose = verbose;
++
++void ZLIB_INTERNAL z_error (m)
++ char *m;
++{
++ fprintf(stderr, "%s\n", m);
++ exit(1);
++}
++#endif
++
++/* exported to allow conversion of error code to string for compress() and
++ * uncompress()
++ */
++const char * ZEXPORT zError(err)
++ int err;
++{
++ return ERR_MSG(err);
++}
++
++#if defined(_WIN32_WCE)
++ /* The Microsoft C Run-Time Library for Windows CE doesn't have
++ * errno. We define it as a global variable to simplify porting.
++ * Its value is always 0 and should not be used.
++ */
++ int errno = 0;
++#endif
++
++#ifndef HAVE_MEMCPY
++
++void ZLIB_INTERNAL zmemcpy(dest, source, len)
++ Bytef* dest;
++ const Bytef* source;
++ uInt len;
++{
++ if (len == 0) return;
++ do {
++ *dest++ = *source++; /* ??? to be unrolled */
++ } while (--len != 0);
++}
++
++int ZLIB_INTERNAL zmemcmp(s1, s2, len)
++ const Bytef* s1;
++ const Bytef* s2;
++ uInt len;
++{
++ uInt j;
++
++ for (j = 0; j < len; j++) {
++ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
++ }
++ return 0;
++}
++
++void ZLIB_INTERNAL zmemzero(dest, len)
++ Bytef* dest;
++ uInt len;
++{
++ if (len == 0) return;
++ do {
++ *dest++ = 0; /* ??? to be unrolled */
++ } while (--len != 0);
++}
++#endif
++
++#ifndef Z_SOLO
++
++#ifdef SYS16BIT
++
++#ifdef __TURBOC__
++/* Turbo C in 16-bit mode */
++
++# define MY_ZCALLOC
++
++/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
++ * and farmalloc(64K) returns a pointer with an offset of 8, so we
++ * must fix the pointer. Warning: the pointer must be put back to its
++ * original form in order to free it, use zcfree().
++ */
++
++#define MAX_PTR 10
++/* 10*64K = 640K */
++
++local int next_ptr = 0;
++
++typedef struct ptr_table_s {
++ voidpf org_ptr;
++ voidpf new_ptr;
++} ptr_table;
++
++local ptr_table table[MAX_PTR];
++/* This table is used to remember the original form of pointers
++ * to large buffers (64K). Such pointers are normalized with a zero offset.
++ * Since MSDOS is not a preemptive multitasking OS, this table is not
++ * protected from concurrent access. This hack doesn't work anyway on
++ * a protected system like OS/2. Use Microsoft C instead.
++ */
++
++voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
++{
++ voidpf buf = opaque; /* just to make some compilers happy */
++ ulg bsize = (ulg)items*size;
++
++ /* If we allocate less than 65520 bytes, we assume that farmalloc
++ * will return a usable pointer which doesn't have to be normalized.
++ */
++ if (bsize < 65520L) {
++ buf = farmalloc(bsize);
++ if (*(ush*)&buf != 0) return buf;
++ } else {
++ buf = farmalloc(bsize + 16L);
++ }
++ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
++ table[next_ptr].org_ptr = buf;
++
++ /* Normalize the pointer to seg:0 */
++ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
++ *(ush*)&buf = 0;
++ table[next_ptr++].new_ptr = buf;
++ return buf;
++}
++
++void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
++{
++ int n;
++ if (*(ush*)&ptr != 0) { /* object < 64K */
++ farfree(ptr);
++ return;
++ }
++ /* Find the original pointer */
++ for (n = 0; n < next_ptr; n++) {
++ if (ptr != table[n].new_ptr) continue;
++
++ farfree(table[n].org_ptr);
++ while (++n < next_ptr) {
++ table[n-1] = table[n];
++ }
++ next_ptr--;
++ return;
++ }
++ ptr = opaque; /* just to make some compilers happy */
++ Assert(0, "zcfree: ptr not found");
++}
++
++#endif /* __TURBOC__ */
++
++
++#ifdef M_I86
++/* Microsoft C in 16-bit mode */
++
++# define MY_ZCALLOC
++
++#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
++# define _halloc halloc
++# define _hfree hfree
++#endif
++
++voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
++{
++ if (opaque) opaque = 0; /* to make compiler happy */
++ return _halloc((long)items, size);
++}
++
++void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
++{
++ if (opaque) opaque = 0; /* to make compiler happy */
++ _hfree(ptr);
++}
++
++#endif /* M_I86 */
++
++#endif /* SYS16BIT */
++
++
++#ifndef MY_ZCALLOC /* Any system without a special alloc function */
++
++#ifndef STDC
++extern voidp malloc OF((uInt size));
++extern voidp calloc OF((uInt items, uInt size));
++extern void free OF((voidpf ptr));
++#endif
++
++voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
++ voidpf opaque;
++ unsigned items;
++ unsigned size;
++{
++ if (opaque) items += size - size; /* make compiler happy */
++ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
++ (voidpf)calloc(items, size);
++}
++
++void ZLIB_INTERNAL zcfree (opaque, ptr)
++ voidpf opaque;
++ voidpf ptr;
++{
++ free(ptr);
++ if (opaque) return; /* make compiler happy */
++}
++
++#endif /* MY_ZCALLOC */
++
++#endif /* !Z_SOLO */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/share/native/java/util/zip/zlib-1.2.8/zutil.h Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,277 @@
++/*
++ * 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++/* zutil.h -- internal interface and configuration of the compression library
++ * Copyright (C) 1995-2013 Jean-loup Gailly.
++ * For conditions of distribution and use, see copyright notice in zlib.h
++ */
++
++/* WARNING: this file should *not* be used by applications. It is
++ part of the implementation of the compression library and is
++ subject to change. Applications should only use zlib.h.
++ */
++
++/* @(#) $Id$ */
++
++#ifndef ZUTIL_H
++#define ZUTIL_H
++
++#ifdef HAVE_HIDDEN
++# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
++#else
++# define ZLIB_INTERNAL
++#endif
++
++#include "zlib.h"
++
++#if defined(STDC) && !defined(Z_SOLO)
++# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
++# include <stddef.h>
++# endif
++# include <string.h>
++# include <stdlib.h>
++#endif
++
++#ifdef Z_SOLO
++ typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
++#endif
++
++#ifndef local
++# define local static
++#endif
++/* compile with -Dlocal if your debugger can't find static symbols */
++
++typedef unsigned char uch;
++typedef uch FAR uchf;
++typedef unsigned short ush;
++typedef ush FAR ushf;
++typedef unsigned long ulg;
++
++extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
++/* (size given to avoid silly warnings with Visual C++) */
++
++#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
++
++#define ERR_RETURN(strm,err) \
++ return (strm->msg = ERR_MSG(err), (err))
++/* To be used only when the state is known to be valid */
++
++ /* common constants */
++
++#ifndef DEF_WBITS
++# define DEF_WBITS MAX_WBITS
++#endif
++/* default windowBits for decompression. MAX_WBITS is for compression only */
++
++#if MAX_MEM_LEVEL >= 8
++# define DEF_MEM_LEVEL 8
++#else
++# define DEF_MEM_LEVEL MAX_MEM_LEVEL
++#endif
++/* default memLevel */
++
++#define STORED_BLOCK 0
++#define STATIC_TREES 1
++#define DYN_TREES 2
++/* The three kinds of block type */
++
++#define MIN_MATCH 3
++#define MAX_MATCH 258
++/* The minimum and maximum match lengths */
++
++#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
++
++ /* target dependencies */
++
++#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
++# define OS_CODE 0x00
++# ifndef Z_SOLO
++# if defined(__TURBOC__) || defined(__BORLANDC__)
++# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
++ /* Allow compilation with ANSI keywords only enabled */
++ void _Cdecl farfree( void *block );
++ void *_Cdecl farmalloc( unsigned long nbytes );
++# else
++# include <alloc.h>
++# endif
++# else /* MSC or DJGPP */
++# include <malloc.h>
++# endif
++# endif
++#endif
++
++#ifdef AMIGA
++# define OS_CODE 0x01
++#endif
++
++#if defined(VAXC) || defined(VMS)
++# define OS_CODE 0x02
++# define F_OPEN(name, mode) \
++ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
++#endif
++
++#if defined(ATARI) || defined(atarist)
++# define OS_CODE 0x05
++#endif
++
++#ifdef OS2
++# define OS_CODE 0x06
++# if defined(M_I86) && !defined(Z_SOLO)
++# include <malloc.h>
++# endif
++#endif
++
++#if defined(MACOS) || defined(TARGET_OS_MAC)
++# define OS_CODE 0x07
++# ifndef Z_SOLO
++# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
++# include <unix.h> /* for fdopen */
++# else
++# ifndef fdopen
++# define fdopen(fd,mode) NULL /* No fdopen() */
++# endif
++# endif
++# endif
++#endif
++
++#ifdef TOPS20
++# define OS_CODE 0x0a
++#endif
++
++#ifdef WIN32
++# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
++# define OS_CODE 0x0b
++# endif
++#endif
++
++#ifdef __50SERIES /* Prime/PRIMOS */
++# define OS_CODE 0x0f
++#endif
++
++#if defined(_BEOS_) || defined(RISCOS)
++# define fdopen(fd,mode) NULL /* No fdopen() */
++#endif
++
++#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
++# if defined(_WIN32_WCE)
++# define fdopen(fd,mode) NULL /* No fdopen() */
++# ifndef _PTRDIFF_T_DEFINED
++ typedef int ptrdiff_t;
++# define _PTRDIFF_T_DEFINED
++# endif
++# else
++# define fdopen(fd,type) _fdopen(fd,type)
++# endif
++#endif
++
++#if defined(__BORLANDC__) && !defined(MSDOS)
++ #pragma warn -8004
++ #pragma warn -8008
++ #pragma warn -8066
++#endif
++
++/* provide prototypes for these when building zlib without LFS */
++#if !defined(_WIN32) && \
++ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
++ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
++ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
++#endif
++
++ /* common defaults */
++
++#ifndef OS_CODE
++# define OS_CODE 0x03 /* assume Unix */
++#endif
++
++#ifndef F_OPEN
++# define F_OPEN(name, mode) fopen((name), (mode))
++#endif
++
++ /* functions */
++
++#if defined(pyr) || defined(Z_SOLO)
++# define NO_MEMCPY
++#endif
++#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
++ /* Use our own functions for small and medium model with MSC <= 5.0.
++ * You may have to use the same strategy for Borland C (untested).
++ * The __SC__ check is for Symantec.
++ */
++# define NO_MEMCPY
++#endif
++#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
++# define HAVE_MEMCPY
++#endif
++#ifdef HAVE_MEMCPY
++# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
++# define zmemcpy _fmemcpy
++# define zmemcmp _fmemcmp
++# define zmemzero(dest, len) _fmemset(dest, 0, len)
++# else
++# define zmemcpy memcpy
++# define zmemcmp memcmp
++# define zmemzero(dest, len) memset(dest, 0, len)
++# endif
++#else
++ void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
++ int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
++ void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
++#endif
++
++/* Diagnostic functions */
++#ifdef DEBUG
++# include <stdio.h>
++ extern int ZLIB_INTERNAL z_verbose;
++ extern void ZLIB_INTERNAL z_error OF((char *m));
++# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
++# define Trace(x) {if (z_verbose>=0) fprintf x ;}
++# define Tracev(x) {if (z_verbose>0) fprintf x ;}
++# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
++# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
++# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
++#else
++# define Assert(cond,msg)
++# define Trace(x)
++# define Tracev(x)
++# define Tracevv(x)
++# define Tracec(c,x)
++# define Tracecv(c,x)
++#endif
++
++#ifndef Z_SOLO
++ voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
++ unsigned size));
++ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
++#endif
++
++#define ZALLOC(strm, items, size) \
++ (*((strm)->zalloc))((strm)->opaque, (items), (size))
++#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
++#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
++
++/* Reverse the bytes in a 32-bit value */
++#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
++ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
++
++#endif /* ZUTIL_H */
+--- ./jdk/src/share/native/sun/awt/libpng/CHANGES Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/CHANGES Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2011, 2015, 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
+@@ -23,8 +23,6 @@
+ * questions.
+ */
+
+-#if 0
+-libpng_changes(){ /*
+ CHANGES - changes for libpng
+
+ Version 0.2
+@@ -205,7 +203,7 @@
+ Fixed serious bug with < 8bpp images introduced in 0.95
+ Fixed 256-color transparency bug (Greg Roelofs)
+ Fixed up documentation (Greg Roelofs, Laszlo Nyul)
+- Fixed "error" in pngconf.h for Linux setjmp() behaviour
++ Fixed "error" in pngconf.h for Linux setjmp() behavior
+ Fixed DOS medium model support (Tim Wegner)
+ Fixed png_check_keyword() for case with error in static string text
+ Added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
+@@ -222,18 +220,20 @@
+ Added more typecasts. 65536L becomes (png_uint_32)65536L, etc. (Glenn R-P)
+ Minor corrections in libpng.txt
+ Added simple sRGB support (Glenn R-P)
+- Easier conditional compiling, e.g. define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
++ Easier conditional compiling, e.g.,
++ define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
+ all configurable options can be selected from command-line instead
+ of having to edit pngconf.h (Glenn R-P)
+ Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
+ Added more conditions for png_do_background, to avoid changing
+ black pixels to background when a background is supplied and
+ no pixels are transparent
+- Repaired PNG_NO_STDIO behaviour
+- Tested NODIV support and made it default behaviour (Greg Roelofs)
++ Repaired PNG_NO_STDIO behavior
++ Tested NODIV support and made it default behavior (Greg Roelofs)
+ Added "-m" option and PNGTEST_DEBUG_MEMORY to pngtest (John Bowler)
+ Regularized version numbering scheme and bumped shared-library major
+- version number to 2 to avoid problems with libpng 0.89 apps (Greg Roelofs)
++ version number to 2 to avoid problems with libpng 0.89 apps
++ (Greg Roelofs)
+
+ Version 0.98 [January, 1998]
+ Cleaned up some typos in libpng.txt and in code documentation
+@@ -1803,7 +1803,7 @@
+ Removed AC_FUNC_MALLOC from configure.ac
+ Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
+ Change "logical" to "bitwise" throughout documentation.
+- Detect and fix attempt to write wrong iCCP profile length.
++ Detect and fix attempt to write wrong iCCP profile length (CVE-2006-7244)
+
+ Version 1.0.21, 1.2.13 [November 14, 2006]
+ Fix potential buffer overflow in sPLT chunk handler.
+@@ -2386,7 +2386,7 @@
+
+ Version 1.4.0beta73 [August 1, 2009]
+ Reject attempt to write iCCP chunk with negative embedded profile length
+- (JD Chen)
++ (JD Chen) (CVE-2009-5063).
+
+ Version 1.4.0beta74 [August 8, 2009]
+ Changed png_ptr and info_ptr member "trans" to "trans_alpha".
+@@ -3174,8 +3174,8 @@
+ in version 1.5.0beta36 but is not noted in the CHANGES. Similarly,
+ it was changed from png_charpp to png_const_bytepp in png_set_iCCP().
+ Ensure that png_rgb_to_gray ignores palette mapped images, if libpng
+- internally happens to call it with one.
+- Fixed a failure to handle palette mapped images correctly.
++ internally happens to call it with one, and fixed a failure to handle
++ palette mapped images correctly. This fixes CVE-2690.
+
+ Version 1.5.1beta02 [January 14, 2011]
+ Fixed a bug in handling of interlaced images (bero at arklinux.org).
+@@ -3314,8 +3314,8 @@
+
+ Version 1.5.3beta01 [April 1, 2011]
+ Re-initialize the zlib compressor before compressing non-IDAT chunks.
+- Added API functions to set parameters for zlib compression of non-IDAT
+- chunks.
++ Added API functions (png_set_text_compression_level() and four others) to
++ set parameters for zlib compression of non-IDAT chunks.
+
+ Version 1.5.3beta02 [April 3, 2011]
+ Updated scripts/symbols.def with new API functions.
+@@ -3372,7 +3372,7 @@
+ dependency of the tIME-supporting RFC1132 code on stdio is removed and
+ PNG_NO_WARNINGS does actually work now.
+ Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
+- was introduced in libpng-1.2.20beta01.
++ was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
+ Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
+ optimization configureable.
+ IDAT compression failed if preceded by a compressed text chunk (bug
+@@ -3403,7 +3403,8 @@
+ Documented png_set_alpha_mode(), other changes in libpng.3/libpng-manual.txt
+ The cHRM chunk now sets the defaults for png_set_rgb_to_gray() (when negative
+ parameters are supplied by the caller), while in the absence of cHRM
+- sRGB/Rec 709 values are still used.
++ sRGB/Rec 709 values are still used. This introduced a divide-by-zero
++ bug in png_handle_cHRM().
+ The bKGD chunk no longer overwrites the background value set by
+ png_set_background(), allowing the latter to be used before the file
+ header is read. It never performed any useful function to override
+@@ -3443,7 +3444,8 @@
+ Frank Busse, CVE-2011-2501, related to CVE-2004-0421).
+
+ Version 1.5.3beta11 [June 11, 2011]
+- Fixed png_handle_sCAL which is broken in 1.5; added sCAL to pngtest.png
++ Fixed png_handle_sCAL which is broken in 1.5. This fixes CVE 2011-2692.
++ Added sCAL to pngtest.png
+ Revised documentation about png_set_user_limits() to say that it also affects
+ png writing.
+ Revised handling of png_set_user_limits() so that it can increase the
+@@ -3468,7 +3470,7 @@
+ Removed string/memory macros that are no longer used and are not
+ necessarily fully supportable, particularly png_strncpy and png_snprintf.
+ Added log option to pngvalid.c and attempted to improve gamma messages.
+-
++
+ Version 1.5.3 [omitted]
+ People found the presence of a beta release following an rc release
+ to be confusing; therefore we bump the version to libpng-1.5.4beta01
+@@ -3532,6 +3534,1620 @@
+ Define PNG_ALLOCATED to "restrict" only if MSC_VER >= 1400.
+
+ Version 1.5.4 [July 7, 2011]
++ No changes.
++
++Version 1.5.5beta01 [July 13, 2011]
++ Fixed some typos and made other minor changes in the manual.
++ Updated contrib/pngminus/makefile.std (Samuli Souminen)
++
++Version 1.5.5beta02 [July 14, 2011]
++ Revised Makefile.am and Makefile.in to look in the right directory for
++ pnglibconf.h.prebuilt
++
++Version 1.5.5beta03 [July 27, 2011]
++ Enabled compilation with g++ compiler. This compiler does not recognize
++ the file extension, so it always compiles with C++ rules. Made minor
++ changes to pngrutil.c to cast results where C++ expects it but C does not.
++ Minor editing of libpng.3 and libpng-manual.txt.
++
++Version 1.5.5beta04 [July 29, 2011]
++ Revised CMakeLists.txt (Clifford Yapp)
++ Updated commentary about the png_rgb_to_gray() default coefficients
++ in the manual and in pngrtran.c
++
++Version 1.5.5beta05 [August 17, 2011]
++ Prevent unexpected API exports from non-libpng DLLs on Windows. The "_DLL"
++ is removed from the test of whether a DLL is being built (this erroneously
++ caused the libpng APIs to be marked as DLL exports in static builds under
++ Microsoft Visual Studio). Almost all of the libpng building configuration
++ is moved from pngconf.h to pngpriv.h, but PNG_DLL_EXPORT remains in
++ pngconf.h, though, so that it is colocated with the import definition (it
++ is no longer used anywhere in the installed headers). The VStudio project
++ definitions have been cleaned up: "_USRDLL" has been removed from the
++ static library builds (this was incorrect), and PNG_USE_DLL has been added
++ to pngvalid to test the functionality (pngtest does not supply it,
++ deliberately). The spurious "_EXPORTS" has been removed from the
++ libpng build (all these errors were a result of copy/paste between project
++ configurations.)
++ Added new types and internal functions for CIE RGB end point handling to
++ pngpriv.h (functions yet to be implemented).
++
++Version 1.5.5beta06 [August 26, 2011]
++ Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set in CMakeLists.txt
++ (Clifford Yap)
++ Fixes to rgb_to_gray and cHRM XYZ APIs (John Bowler):
++ The rgb_to_gray code had errors when combined with gamma correction.
++ Some pixels were treated as true grey when they weren't and such pixels
++ and true grey ones were not gamma corrected (the original value of the
++ red component was used instead). APIs to get and set cHRM using color
++ space end points have been added and the rgb_to_gray code that defaults
++ based on cHRM, and the divide-by-zero bug in png_handle_cHRM (CERT
++ VU#477046, CVE-2011-3328, introduced in 1.5.4) have been corrected.
++ A considerable number of tests has been added to pngvalid for the
++ rgb_to_gray transform.
++ Arithmetic errors in rgb_to_gray whereby the calculated gray value was
++ truncated to the bit depth rather than rounded have been fixed except in
++ the 8-bit non-gamma-corrected case (where consistency seems more important
++ than correctness.) The code still has considerable inaccuracies in the
++ 8-bit case because 8-bit linear arithmetic is used.
++
++Version 1.5.5beta07 [September 7, 2011]
++ Added "$(ARCH)" option to makefile.darwin
++ Added SunOS support to configure.ac and Makefile.am
++ Changed png_chunk_benign_error() to png_warning() in png.c, in
++ png_XYZ_from_xy_checked().
++
++Version 1.5.5beta08 [September 10, 2011]
++ Fixed 64-bit compilation errors (gcc). The errors fixed relate
++ to conditions where types that are 32 bits in the GCC 32-bit
++ world (uLong and png_size_t) become 64 bits in the 64-bit
++ world. This produces potential truncation errors which the
++ compiler correctly flags.
++ Relocated new HAVE_SOLARIS_LD definition in configure.ac
++ Constant changes for 64-bit compatibility (removal of L suffixes). The
++ 16-bit cases still use "L" as we don't have a 16-bit test system.
++
++Version 1.5.5rc01 [September 15, 2011]
++ Removed "L" suffixes in pngpriv.h
++
++Version 1.5.5 [September 22, 2011]
++ No changes.
++
++Version 1.5.6beta01 [September 22, 2011]
++ Fixed some 64-bit type conversion warnings in pngrtran.c
++ Moved row_info from png_struct to a local variable.
++ The various interlace mask arrays have been made into arrays of
++ bytes and made PNG_CONST and static (previously some arrays were
++ marked PNG_CONST and some weren't).
++ Additional checks have been added to the transform code to validate the
++ pixel depths after the transforms on both read and write.
++ Removed some redundant code from pngwrite.c, in png_destroy_write_struct().
++ Changed chunk reading/writing code to use png_uint_32 instead of png_byte[4].
++ This removes the need to allocate temporary strings for chunk names on
++ the stack in the read/write code. Unknown chunk handling still uses the
++ string form because this is exposed in the API.
++
++Version 1.5.6beta02 [September 26, 2011]
++ Added a note in the manual the png_read_update_info() must be called only
++ once with a particular info_ptr.
++ Fixed a typo in the definition of the new PNG_STRING_FROM_CHUNK(s,c) macro.
++
++Version 1.5.6beta03 [September 28, 2011]
++ Revised test-pngtest.sh to report FAIL when pngtest fails.
++ Added "--strict" option to pngtest, to report FAIL when the failure is
++ only because the resulting valid files are different.
++ Revised CMakeLists.txt to work with mingw and removed some material from
++ CMakeLists.txt that is no longer useful in libpng-1.5.
++
++Version 1.5.6beta04 [October 5, 2011]
++ Fixed typo in Makefile.in and Makefile.am ("-M Wl" should be "-M -Wl")."
++
++Version 1.5.6beta05 [October 12, 2011]
++ Speed up png_combine_row() for interlaced images. This reduces the generality
++ of the code, allowing it to be optimized for Adam7 interlace. The masks
++ passed to png_combine_row() are now generated internally, avoiding
++ some code duplication and localizing the interlace handling somewhat.
++ Align png_struct::row_buf - previously it was always unaligned, caused by
++ a bug in the code that attempted to align it; the code needs to subtract
++ one from the pointer to take account of the filter byte prepended to
++ each row.
++ Optimized png_combine_row() when rows are aligned. This gains a small
++ percentage for 16-bit and 32-bit pixels in the typical case where the
++ output row buffers are appropriately aligned. The optimization was not
++ previously possible because the png_struct buffer was always misaligned.
++ Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
++
++Version 1.5.6beta06 [October 17, 2011]
++ Removed two redundant tests for unitialized row.
++ Fixed a relatively harmless memory overwrite in compressed text writing
++ with a 1 byte zlib buffer.
++ Add ability to call png_read_update_info multiple times to pngvalid.c.
++ Fixes for multiple calls to png_read_update_info. These fixes attend to
++ most of the errors revealed in pngvalid, however doing the gamma work
++ twice results in inaccuracies that can't be easily fixed. There is now
++ a warning in the code if this is going to happen.
++ Turned on multiple png_read_update_info in pngvalid transform tests.
++ Prevent libpng from overwriting unused bits at the end of the image when
++ it is not byte aligned, while reading. Prior to libpng-1.5.6 libpng would
++ overwrite the partial byte at the end of each row if the row width was not
++ an exact multiple of 8 bits and the image is not interlaced.
++
++Version 1.5.6beta07 [October 21, 2011]
++ Made png_ptr->prev_row an aligned pointer into png_ptr->big_prev_row
++ (Mans Rullgard).
++
++Version 1.5.6rc01 [October 26, 2011]
++ Changed misleading "Missing PLTE before cHRM" warning to "Out of place cHRM"
++
++Version 1.5.6rc02 [October 27, 2011]
++ Added LSR() macro to defend against buggy compilers that evaluate non-taken
++ code branches and complain about out-of-range shifts.
++
++Version 1.5.6rc03 [October 28, 2011]
++ Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
++ Fixed compiler warnings with Intel and MSYS compilers. The logical shift
++ fix for Microsoft Visual C is required by other compilers, so this
++ enables that fix for all compilers when using compile-time constants.
++ Under MSYS 'byte' is a name declared in a system header file, so we
++ changed the name of a local variable to avoid the warnings that result.
++ Added #define PNG_ALIGN_TYPE PNG_ALIGN_NONE to contrib/pngminim/*/pngusr.h
++
++Version 1.5.6 [November 3, 2011]
++ No changes.
++
++Version 1.5.7beta01 [November 4, 2011]
++ Added support for ARM processor, when decoding all PNG up-filtered rows
++ and any other-filtered rows with 3 or 4 bytes per pixel (Mans Rullgard).
++ Fixed bug in pngvalid on early allocation failure; fixed type cast in
++ pngmem.c; pngvalid would attempt to call png_error() if the allocation
++ of a png_struct or png_info failed. This would probably have led to a
++ crash. The pngmem.c implementation of png_malloc() included a cast
++ to png_size_t which would fail on large allocations on 16-bit systems.
++ Fix for the preprocessor of the Intel C compiler. The preprocessor
++ splits adjacent @ signs with a space; this changes the concatentation
++ token from @-@-@ to PNG_JOIN; that should work with all compiler
++ preprocessors.
++ Paeth filter speed improvements from work by Siarhei Siamashka. This
++ changes the 'Paeth' reconstruction function to improve the GCC code
++ generation on x86. The changes are only part of the suggested ones;
++ just the changes that definitely improve speed and remain simple.
++ The changes also slightly increase the clarity of the code.
++
++Version 1.5.7beta02 [November 11, 2011]
++ Check compression_type parameter in png_get_iCCP and remove spurious
++ casts. The compression_type parameter is always assigned to, so must
++ be non-NULL. The cast of the profile length potentially truncated the
++ value unnecessarily on a 16-bit int system, so the cast of the (byte)
++ compression type to (int) is specified by ANSI-C anyway.
++ Fixed FP division by zero in pngvalid.c; the 'test_pixel' code left
++ the sBIT fields in the test pixel as 0, which resulted in a floating
++ point division by zero which was irrelevant but causes systems where
++ FP exceptions cause a crash. Added code to pngvalid to turn on FP
++ exceptions if the appropriate glibc support is there to ensure this is
++ tested in the future.
++ Updated scripts/pnglibconf.mak and scripts/makefile.std to handle the
++ new PNG_JOIN macro.
++ Added versioning to pnglibconf.h comments.
++ Simplified read/write API initial version; basic read/write tested on
++ a variety of images, limited documentation (in the header file.)
++ Installed more accurate linear to sRGB conversion tables. The slightly
++ modified tables reduce the number of 16-bit values that
++ convert to an off-by-one 8-bit value. The "makesRGB.c" code that was used
++ to generate the tables is now in a contrib/sRGBtables sub-directory.
++
++Version 1.5.7beta03 [November 17, 2011]
++ Removed PNG_CONST from the sRGB table declarations in pngpriv.h and png.c
++ Added run-time detection of NEON support.
++ Added contrib/libtests; includes simplified API test and timing test and
++ a color conversion utility for rapid checking of failed 'pngstest' results.
++ Multiple transform bug fixes plus a work-round for double gamma correction.
++ libpng does not support more than one transform that requires linear data
++ at once - if this is tried typically the results is double gamma
++ correction. Since the simplified APIs can need rgb to gray combined with
++ a compose operation it is necessary to do one of these outside the main
++ libpng transform code. This check-in also contains fixes to various bugs
++ in the simplified APIs themselves and to some bugs in compose and rgb to
++ gray (on palette) itself.
++ Fixes for C++ compilation using g++ When libpng source is compiled
++ using g++. The compiler imposes C++ rules on the C source; thus it
++ is desireable to make the source work with either C or C++ rules
++ without throwing away useful error information. This change adds
++ png_voidcast to allow C semantic (void*) cases or the corresponding
++ C++ static_cast operation, as appropriate.
++ Added --noexecstack to assembler file compilation. GCC does not set
++ this on assembler compilation, even though it does on C compilation.
++ This creates security issues if assembler code is enabled; the
++ work-around is to set it by default in the flags for $(CCAS)
++ Work around compilers that don't support declaration of const data. Some
++ compilers fault 'extern const' data declarations (because the data is
++ not initialized); this turns on const-ness only for compilers where
++ this is known to work.
++
++Version 1.5.7beta04 [November 17, 2011]
++ Since the gcc driver does not recognize the --noexecstack flag, we must
++ use the -Wa prefix to have it passed through to the assembler.
++ Also removed a duplicate setting of this flag.
++ Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
++
++Version 1.5.7beta05 [November 25, 2011]
++ Removed "zTXt" from warning in generic chunk decompression function.
++ Validate time settings passed to pngset() and png_convert_to_rfc1123()
++ (Frank Busse).
++ Added MINGW support to CMakeLists.txt
++ Reject invalid compression flag or method when reading the iTXt chunk.
++ Backed out 'simplified' API changes. The API seems too complex and there
++ is a lack of consensus or enthusiasm for the proposals. The API also
++ reveals significant bugs inside libpng (double gamma correction and the
++ known bug of being unable to retrieve a corrected palette). It seems
++ better to wait until the bugs, at least, are corrected.
++ Moved pngvalid.c into contrib/libtests
++ Rebuilt Makefile.in, configure, etc., with autoconf-2.68
++
++Version 1.5.7rc01 [December 1, 2011]
++ Replaced an "#if" with "#ifdef" in pngrtran.c
++ Revised #if PNG_DO_BC block in png.c (use #ifdef and add #else)
++
++Version 1.5.7rc02 [December 5, 2011]
++ Revised project files and contrib/pngvalid/pngvalid.c to account for
++ the relocation of pngvalid into contrib/libtests.
++ Revised pngconf.h to use " __declspec(restrict)" only when MSC_VER >= 1400,
++ as in libpng-1.5.4.
++ Put CRLF line endings in the owatcom project files.
++
++Version 1.5.7rc03 [December 7, 2011]
++ Updated CMakeLists.txt to account for the relocation of pngvalid.c
++
++Version 1.5.7 [December 15, 2011]
++ Minor fixes to pngvalid.c for gcc 4.6.2 compatibility to remove warnings
++ reported by earlier versions.
++ Fixed minor memset/sizeof errors in pngvalid.c.
++
++Version 1.6.0beta01 [December 15, 2011]
++ Removed machine-generated configure files from the GIT repository (they will
++ continue to appear in the tarball distributions and in the libpng15 and
++ earlier GIT branches).
++ Restored the new 'simplified' API, which was started in libpng-1.5.7beta02
++ but later deleted from libpng-1.5.7beta05.
++ Added example programs for the new 'simplified' API.
++ Added ANSI-C (C90) headers and require them, and take advantage of the
++ change. Also fixed some of the projects/* and contrib/* files that needed
++ updates for libpng16 and the move of pngvalid.c.
++ With this change the required ANSI-C header files are assumed to exist: the
++ implementation must provide float.h, limits.h, stdarg.h and stddef.h and
++ libpng relies on limits.h and stddef.h existing and behaving as defined
++ (the other two required headers aren't used). Non-ANSI systems that don't
++ have stddef.h or limits.h will have to provide an appropriate fake
++ containing the relevant types and #defines.
++ The use of FAR/far has been eliminated and the definition of png_alloc_size_t
++ is now controlled by a flag so that 'small size_t' systems can select it
++ if necessary. Libpng 1.6 may not currently work on such systems -- it
++ seems likely that it will ask 'malloc' for more than 65535 bytes with any
++ image that has a sufficiently large row size (rather than simply failing
++ to read such images).
++ New tools directory containing tools used to generate libpng code.
++ Fixed race conditions in parallel make builds. With higher degrees of
++ parallelism during 'make' the use of the same temporary file names such
++ as 'dfn*' can result in a race where a temporary file from one arm of the
++ build is deleted or overwritten in another arm. This changes the
++ temporary files for suffix rules to always use $* and ensures that the
++ non-suffix rules use unique file names.
++
++Version 1.6.0beta02 [December 21, 2011]
++ Correct configure builds where build and source directories are separate.
++ The include path of 'config.h' was erroneously made relative in pngvalid.c
++ in libpng 1.5.7.
++
++Version 1.6.0beta03 [December 22, 2011]
++ Start-up code size improvements, error handler flexibility. These changes
++ alter how the tricky allocation of the initial png_struct and png_info
++ structures are handled. png_info is now handled in pretty much the same
++ way as everything else, except that the allocations handle NULL return
++ silently. png_struct is changed in a similar way on allocation and on
++ deallocation a 'safety' error handler is put in place (which should never
++ be required). The error handler itself is changed to permit mismatches
++ in the application and libpng error buffer size; however, this means a
++ silent change to the API to return the jmp_buf if the size doesn't match
++ the size from the libpng compilation; libpng now allocates the memory and
++ this may fail. Overall these changes result in slight code size
++ reductions; however, this is a reduction in code that is always executed
++ so is particularly valuable. Overall on a 64-bit system the libpng DLL
++ decreases in code size by 1733 bytes. pngerror.o increases in size by
++ about 465 bytes because of the new functionality.
++ Added png_convert_to_rfc1123_buffer() and deprecated png_convert_to_rfc1123()
++ to avoid including a spurious buffer in the png_struct.
++
++Version 1.6.0beta04 [December 30, 2011]
++ Regenerated configure scripts with automake-1.11.2
++ Eliminated png_info_destroy(). It is now used only in png.c and only calls
++ one other internal function and memset().
++ Enabled png_get_sCAL_fixed() if floating point APIs are enabled. Previously
++ it was disabled whenever internal fixed point arithmetic was selected,
++ which meant it didn't exist even on systems where FP was available but not
++ preferred.
++ Added pngvalid.c compile time checks for const APIs.
++ Implemented 'restrict' for png_info and png_struct. Because of the way
++ libpng works both png_info and png_struct are always accessed via a
++ single pointer. This means adding C99 'restrict' to the pointer gives
++ the compiler some opportunity to optimize the code. This change allows
++ that.
++ Moved AC_MSG_CHECKING([if libraries can be versioned]) later to the proper
++ location in configure.ac (Gilles Espinasse).
++ Changed png_memcpy to C assignment where appropriate. Changed all those
++ uses of png_memcpy that were doing a simple assignment to assignments
++ (all those cases where the thing being copied is a non-array C L-value).
++ Added some error checking to png_set_*() routines.
++ Removed the reference to the non-exported function png_memcpy() from
++ example.c.
++ Fixed the Visual C 64-bit build - it requires jmp_buf to be aligned, but
++ it had become misaligned.
++ Revised contrib/pngminus/pnm2png.c to avoid warnings when png_uint_32
++ and unsigned long are of different sizes.
++
++Version 1.6.0beta05 [January 15, 2012]
++ Updated manual with description of the simplified API (copied from png.h)
++ Fix bug in pngerror.c: some long warnings were being improperly truncated
++ (CVE-2011-3464, bug introduced in libpng-1.5.3beta05).
++
++Version 1.6.0beta06 [January 24, 2012]
++ Added palette support to the simplified APIs. This commit
++ changes some of the macro definitions in png.h, app code
++ may need corresponding changes.
++ Increased the formatted warning buffer to 192 bytes.
++ Added color-map support to simplified API. This is an initial version for
++ review; the documentation has not yet been updated.
++ Fixed Min/GW uninstall to remove libpng.dll.a
++
++Version 1.6.0beta07 [January 28, 2012]
++ Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
++ compiler issues slightly different warnings from those issued by the
++ current vesions of GCC. This eliminates those warnings by
++ adding/removing casts and small code rewrites.
++ Updated configure.ac from autoupdate: added --enable-werror option.
++ Also some layout regularization and removal of introduced tab characters
++ (replaced with 3-character indentation). Obsolete macros identified by
++ autoupdate have been removed; the replacements are all in 2.59 so
++ the pre-req hasn't been changed. --enable-werror checks for support
++ for -Werror (or the given argument) in the compiler. This mimics the
++ gcc configure option by allowing -Werror to be turned on safely; without
++ the option the tests written in configure itself fail compilation because
++ they cause compiler warnings.
++ Rewrote autogen.sh to run autoreconf instead of running tools one-by-one.
++ Conditionalize the install rules for MINGW and CYGWIN in CMakeLists.txt and
++ set CMAKE_LIBRARY_OUTPUT_DIRECTORY to "lib" on all platforms (C. Yapp).
++ Freeze libtool files in the 'scripts' directory. This version of autogen.sh
++ attempts to dissuade people from running it when it is not, or should not,
++ be necessary. In fact, autogen.sh does not work when run in a libpng
++ directory extracted from a tar distribution anymore. You must run it in
++ a GIT clone instead.
++ Added two images to contrib/pngsuite (1-bit and 2-bit transparent grayscale),
++ and renamed three whose names were inconsistent with those in
++ pngsuite/README.txt.
++
++Version 1.6.0beta08 [February 1, 2012]
++ Fixed Image::colormap misalignment in pngstest.c
++ Check libtool/libtoolize version number (2.4.2) in configure.ac
++ Divide test-pngstest.sh into separate pngstest runs for basic and
++ transparent images.
++ Moved automake options to AM_INIT_AUTOMAKE in configure.ac
++ Added color-tests, silent-rules (Not yet implemented in Makefile.am) and
++ version checking to configure.ac
++ Improved pngstest speed by not doing redundant tests and add const to
++ the background parameter of png_image_finish_read. The --background
++ option is now done automagically only when required, so that commandline
++ option no longer exists.
++ Cleaned up pngpriv.h to consistently declare all functions and data.
++ Also eliminated PNG_CONST_DATA, which is apparently not needed but we
++ can't be sure until it is gone.
++ Added symbol prefixing that allows all the libpng external symbols
++ to be prefixed (suggested by Reuben Hawkins).
++ Updated "ftbb*.png" list in the owatcom and vstudio projects.
++ Fixed 'prefix' builds on clean systems. The generation of pngprefix.h
++ should not require itself.
++ Updated INSTALL to explain that autogen.sh must be run in a GIT clone,
++ not in a libpng directory extracted from a tar distribution.
++
++Version 1.6.0beta09 [February 1, 2012]
++ Reverted the prebuilt configure files to libpng-1.6.0beta05 condition.
++
++Version 1.6.0beta10 [February 3, 2012]
++ Added Z_SOLO for zlib-1.2.6+ and correct pngstest tests
++ Updated list of test images in CMakeLists.txt
++ Updated the prebuilt configure files to current condition.
++ Revised INSTALL information about autogen.sh; it works in tar distributions.
++
++Version 1.6.0beta11 [February 16, 2012]
++ Fix character count in pngstest command in projects/owatcom/pngstest.tgt
++ Revised test-pngstest.sh to report PASS/FAIL for each image.
++ Updated documentation about the simplified API.
++ Corrected estimate of error in libpng png_set_rgb_to_gray API. The API is
++ extremely inaccurate for sRGB conversions because it uses an 8-bit
++ intermediate linear value and it does not use the sRGB transform, so it
++ suffers from the known instability in gamma transforms for values close
++ to 0 (see Poynton). The net result is that the calculation has a maximum
++ error of 14.99/255; 0.5/255^(1/2.2). pngstest now uses 15 for the
++ permitted 8-bit error. This may still not be enough because of arithmetic
++ error.
++ Removed some unused arrays (with #ifdef) from png_read_push_finish_row().
++ Fixed a memory overwrite bug in simplified read of RGB PNG with
++ non-linear gamma Also bugs in the error checking in pngread.c and changed
++ quite a lot of the checks in pngstest.c to be correct; either correctly
++ written or not over-optimistic. The pngstest changes are insufficient to
++ allow all possible RGB transforms to be passed; pngstest cmppixel needs
++ to be rewritten to make it clearer which errors it allows and then changed
++ to permit known inaccuracies.
++ Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h
++ Fixed fixed/float API export conditionals. 1) If FIXED_POINT or
++ FLOATING_POINT options were switched off, png.h ended up with lone ';'
++ characters. This is not valid ANSI-C outside a function. The ';'
++ characters have been moved inside the definition of PNG_FP_EXPORT and
++ PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
++ of the corresponding functions were completely omitted, even though some
++ of them are still used internally. The result is still valid, but
++ produces warnings from gcc with some warning options (including -Wall). The
++ fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
++ when png.h is included from pngpriv.h.
++ Check for invalid palette index while reading paletted PNG. When one is
++ found, issue a warning and increase png_ptr->num_palette accordingly.
++ Apps are responsible for checking to see if that happened.
++
++Version 1.6.0beta12 [February 18, 2012]
++ Do not increase num_palette on invalid_index.
++ Relocated check for invalid palette index to pngrtran.c, after unpacking
++ the sub-8-bit pixels.
++ Fixed CVE-2011-3026 buffer overrun bug. This bug was introduced when
++ iCCP chunk support was added at libpng-1.0.6. Deal more correctly with the
++ test on iCCP chunk length. Also removed spurious casts that may hide
++ problems on 16-bit systems.
++
++Version 1.6.0beta13 [February 24, 2012]
++ Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
++ pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
++ now that png_ptr->buffer is inaccessible to applications, the special
++ handling is no longer useful.
++ Added PNG_SAFE_LIMITS feature to pnglibconf.dfa, pngpriv.h, and new
++ pngusr.dfa to reset the user limits to safe ones if PNG_SAFE_LIMITS is
++ defined. To enable, use "CPPFLAGS=-DPNG_SAFE_LIMITS_SUPPORTED=1" on the
++ configure command or put #define PNG_SAFE_LIMITS_SUPPORTED in
++ pnglibconf.h.prebuilt and pnglibconf.h.
++
++Version 1.6.0beta14 [February 27, 2012]
++ Added information about the new limits in the manual.
++ Updated Makefile.in
++
++Version 1.6.0beta15 [March 2, 2012]
++ Removed unused "current_text" members of png_struct and the png_free()
++ of png_ptr->current_text from pngread.c
++ Rewrote pngstest.c for substantial speed improvement.
++ Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
++ spurious check in pngwrite.c
++ Added PNG_IMAGE_FLAG_FAST for the benefit of applications that store
++ intermediate files, or intermediate in-memory data, while processing
++ image data with the simplified API. The option makes the files larger
++ but faster to write and read. pngstest now uses this by default; this
++ can be disabled with the --slow option.
++ Improved pngstest fine tuning of error numbers, new test file generator.
++ The generator generates images that test the full range of sample values,
++ allow the error numbers in pngstest to be tuned and checked. makepng
++ also allows generation of images with extra chunks, although this is
++ still work-in-progress.
++ Added check for invalid palette index while reading.
++ Fixed some bugs in ICC profile writing. The code should now accept
++ all potentially valid ICC profiles and reject obviously invalid ones.
++ It now uses png_error() to do so rather than casually writing a PNG
++ without the necessary color data.
++ Removed whitespace from the end of lines in all source files and scripts.
++
++Version 1.6.0beta16 [March 6, 2012]
++ Relocated palette-index checking function from pngrutil.c to pngtrans.c
++ Added palette-index checking while writing.
++ Changed png_inflate() and calling routines to avoid overflow problems.
++ This is an intermediate check-in that solves the immediate problems and
++ introduces one performance improvement (avoiding a copy via png_ptr->zbuf.)
++ Further changes will be made to make ICC profile handling more secure.
++ Fixed build warnings (MSVC, GCC, GCC v3). Cygwin GCC with default options
++ declares 'index' as a global, causing a warning if it is used as a local
++ variable. GCC 64-bit warns about assigning a (size_t) (unsigned 64-bit)
++ to an (int) (signed 32-bit). MSVC, however, warns about using the
++ unary '-' operator on an unsigned value (even though it is well defined
++ by ANSI-C to be ~x+1). The padding calculation was changed to use a
++ different method. Removed the tests on png_ptr->pass.
++ Added contrib/libtests/tarith.c to test internal arithmetic functions from
++ png.c. This is a libpng maintainer program used to validate changes to the
++ internal arithmetic functions.
++ Made read 'inflate' handling like write 'deflate' handling. The read
++ code now claims and releases png_ptr->zstream, like the write code.
++ The bug whereby the progressive reader failed to release the zstream
++ is now fixed, all initialization is delayed, and the code checks for
++ changed parameters on deflate rather than always calling
++ deflatedEnd/deflateInit.
++ Validate the zTXt strings in pngvalid.
++ Added code to validate the windowBits value passed to deflateInit2().
++ If the call to deflateInit2() is wrong a png_warning will be issued
++ (in fact this is harmless, but the PNG data produced may be sub-optimal).
++
++Version 1.6.0beta17 [March 10, 2012]
++ Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
++ Reject all iCCP chunks after the first, even if the first one is invalid.
++ Deflate/inflate was reworked to move common zlib calls into single
++ functions [rw]util.c. A new shared keyword check routine was also added
++ and the 'zbuf' is no longer allocated on progressive read. It is now
++ possible to call png_inflate() incrementally. A warning is no longer
++ issued if the language tag or translated keyword in the iTXt chunk
++ has zero length.
++ If benign errors are disabled use maximum window on ancilliary inflate.
++ This works round a bug introduced in 1.5.4 where compressed ancillary
++ chunks could end up with a too-small windowBits value in the deflate
++ header.
++
++Version 1.6.0beta18 [March 16, 2012]
++ Issue a png_benign_error() instead of png_warning() about bad palette index.
++ In pngtest, treat benign errors as errors if "-strict" is present.
++ Fixed an off-by-one error in the palette index checking function.
++ Fixed a compiler warning under Cygwin (Windows-7, 32-bit system)
++ Revised example.c to put text strings in a temporary character array
++ instead of directly assigning string constants to png_textp members.
++ This avoids compiler warnings when -Wwrite-strings is enabled.
++ Added output flushing to aid debugging under Visual Studio. Unfortunately
++ this is necessary because the VS2010 output window otherwise simply loses
++ the error messages on error (they weren't flushed to the window before
++ the process exited, apparently!)
++ Added configuration support for benign errors and changed the read
++ default. Also changed some warnings in the iCCP and sRGB handling
++ from to benign errors. Configuration now makes read benign
++ errors warnings and write benign errors to errors by default (thus
++ changing the behavior on read). The simplified API always forces
++ read benign errors to warnings (regardless of the system default, unless
++ this is disabled in which case the simplified API can't be built.)
++
++Version 1.6.0beta19 [March 18, 2012]
++ Work around for duplicate row start calls; added warning messages.
++ This turns on PNG_FLAG_DETECT_UNINITIALIZED to detect app code that
++ fails to call one of the 'start' routines (not enabled in libpng-1.5
++ because it is technically an API change, since it did normally work
++ before.) It also makes duplicate calls to png_read_start_row (an
++ internal function called at the start of the image read) benign, as
++ they were before changes to use png_inflate_claim. Somehow webkit is
++ causing this to happen; this is probably a mis-feature in the zlib
++ changes so this commit is only a work-round.
++ Removed erroneous setting of DETECT_UNINITIALIZED and added more
++ checks. The code now does a png_error if an attempt is made to do the
++ row initialization twice; this is an application error and it has
++ serious consequences because the transform data in png_struct is
++ changed by each call.
++ Added application error reporting and added chunk names to read
++ benign errors; also added --strict to pngstest - not enabled
++ yet because a warning is produced.
++ Avoid the double gamma correction warning in the simplified API.
++ This allows the --strict option to pass in the pngstest checks
++
++Version 1.6.0beta20 [March 29, 2012]
++ Changed chunk handler warnings into benign errors, incrementally load iCCP
++ Added checksum-icc.c to contrib/tools
++ Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
++ Recognize known sRGB ICC profiles while reading; prefer writing the
++ iCCP profile over writing the sRGB chunk, controlled by the
++ PNG_sRGB_PROFILE_CHECKS option.
++ Revised png_set_text_2() to avoid potential memory corruption (fixes
++ CVE-2011-3048, also known as CVE-2012-3425).
++
++Version 1.6.0beta21 [April 27, 2012]
++ Revised scripts/makefile.darwin: use system zlib; remove quotes around
++ architecture list; add missing ppc architecture; add architecture options
++ to shared library link; don't try to create a shared lib based on missing
++ RELEASE variable.
++ Enable png_set_check_for_invalid_index() for both read and write.
++ Removed #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED in pngpriv.h around
++ declaration of png_handle_unknown().
++ Added -lssp_nonshared in a comment in scripts/makefile.freebsd
++ and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
++
++Version 1.6.0beta22 [May 23, 2012]
++ Removed need for -Wno-cast-align with clang. clang correctly warns on
++ alignment increasing pointer casts when -Wcast-align is passed. This
++ fixes the cases that clang warns about either by eliminating the
++ casts from png_bytep to png_uint_16p (pngread.c), or, for pngrutil.c
++ where the cast is previously verified or pngstest.c where it is OK, by
++ introducing new png_aligncast macros to do the cast in a way that clang
++ accepts.
++
++Version 1.6.0beta23 [June 6, 2012]
++ Revised CMakeLists.txt to not attempt to make a symlink under mingw.
++ Made fixes for new optimization warnings from gcc 4.7.0. The compiler
++ performs an optimization which is safe; however it then warns about it.
++ Changing the type of 'palette_number' in pngvalid.c removes the warning.
++ Do not depend upon a GCC feature macro being available for use in generating
++ the linker mapfile symbol prefix.
++ Improved performance of new do_check_palette_indexes() function (only
++ update the value when it actually increases, move test for whether
++ the check is wanted out of the function.
++
++Version 1.6.0beta24 [June 7, 2012]
++ Don't check palette indexes if num_palette is 0 (as it can be in MNG files).
++
++Version 1.6.0beta25 [June 16, 2012]
++ Revised png_set_keep_unknown_chunks() so num_chunks < 0 means ignore all
++ unknown chunks and all known chunks except for IHDR, PLTE, tRNS, IDAT,
++ and IEND. Previously it only meant ignore all unknown chunks, the
++ same as num_chunks == 0. Revised png_image_skip_unused_chunks() to
++ provide a list of chunks to be processed instead of a list of chunks to
++ ignore. Revised contrib/gregbook/readpng2.c accordingly.
++
++Version 1.6.0beta26 [July 10, 2012]
++ Removed scripts/makefile.cegcc from the *.zip and *.7z distributions; it
++ depends on configure, which is not included in those archives.
++ Moved scripts/chkfmt to contrib/tools.
++ Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
++
++Version 1.6.0beta27 [August 11, 2012]
++ Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
++ Do not use __restrict when GNUC is <= 3.1
++ Removed references to png_zalloc() and png_zfree() from the manual.
++ Fixed configurations where floating point is completely disabled. Because
++ of the changes to support symbol prefixing PNG_INTERNAL_FUNCTION declares
++ floating point APIs during libpng builds even if they are completely
++ disabled. This requires the png floating point types (png_double*) to be
++ declared even though the functions are never actually defined. This
++ change provides a dummy definition so that the declarations work, yet any
++ implementation will fail to compile because of an incomplete type.
++ Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
++ strcpy() was accidentally re-introduced in libpng16; this change replaces
++ it with strncpy().
++ Eliminated use of png_sizeof(); use sizeof() instead.
++ Use a consistent style for (sizeof type) and (sizeof (array))
++ Cleanup of png_set_filler(). This function does very different things on
++ read and write. In libpng 1.6 the two cases can be distinguished and
++ considerable code cleanup, and extra error checking, is possible. This
++ makes calls on the write side that have no effect be ignored with a
++ png_app_error(), which can be disabled in the app using
++ png_set_benign_errors(), and removes the spurious use of usr_channels
++ on the read side.
++ Insist on autotools 1.12.1 for git builds because there are security issues
++ with 1.12 and insisting on anything less would allow 1.12 to be used.
++ Removed info_ptr->signature[8] from WRITE-only builds.
++ Add some conditions for compiling png_fixed(). This is a small function
++ but it requires "-lm" on some platforms.
++ Cause pngtest --strict to fail on any warning from libpng (not just errors)
++ and cause it not to fail at the comparison step if libpng lacks support
++ for writing chunks that it reads from the input (currently only implemented
++ for compressed text chunks).
++ Make all three "make check" test programs work without READ or WRITE support.
++ Now "make check" will succeed even if libpng is compiled with -DPNG_NO_READ
++ or -DPNG_NO_WRITE. The tests performed are reduced, but the basic reading
++ and writing of a PNG file is always tested by one or more of the tests.
++ Consistently use strlen(), memset(), memcpy(), and memcmp() instead of the
++ png_strlen(), png_memset(), png_memcpy(), and png_memcmp() macros.
++ Removed the png_sizeof(), png_strlen(), png_memset(), png_memcpy(), and
++ png_memcmp() macros.
++ Work around gcc 3.x and Microsoft Visual Studio 2010 complaints. Both object
++ to the split initialization of num_chunks.
++
++Version 1.6.0beta28 [August 29, 2012]
++ Unknown handling fixes and clean up. This adds more correct option
++ control of the unknown handling, corrects the pre-existing bug where
++ the per-chunk 'keep' setting is ignored and makes it possible to skip
++ IDAT chunks in the sequential reader (broken in earlier 1.6 versions).
++ There is a new test program, test-unknown.c, which is a work in progress
++ (not currently part of the test suite). Comments in the header files now
++ explain how the unknown handling works.
++ Allow fine grain control of unknown chunk APIs. This change allows
++ png_set_keep_unknown_chunks() to be turned off if not required and causes
++ both read and write to behave appropriately (on read this is only possible
++ if the user callback is used to handle unknown chunks). The change
++ also removes the support for storing unknown chunks in the info_struct
++ if the only unknown handling enabled is via the callback, allowing libpng
++ to be configured with callback reading and none of the unnecessary code.
++ Corrected fix for unknown handling in pngtest. This reinstates the
++ libpng handling of unknown chunks other than vpAg and sTER (including
++ unsafe-to-copy chunks which were dropped before) and eliminates the
++ repositioning of vpAg and sTER in pngtest.png by changing pngtest.png
++ (so the chunks are where libpng would put them).
++ Added "tunknown" test and corrected a logic error in png_handle_unknown()
++ when SAVE support is absent. Moved the shell test scripts for
++ contrib/libtests from the libpng top directory to contrib/libtests.
++ png_handle_unknown() must always read or skip the chunk, if
++ SAVE_UNKNOWN_CHUNKS is turned off *and* the application does not set
++ a user callback an unknown chunk will not be read, leading to a read
++ error, which was revealed by the "tunknown" test.
++ Cleaned up and corrected ICC profile handling.
++ contrib/libtests/makepng: corrected 'rgb' and 'gray' cases. profile_error
++ messages could be truncated; made a correct buffer size calculation and
++ adjusted pngerror.c appropriately. png_icc_check_* checking improved;
++ changed the functions to receive the correct color type of the PNG on read
++ or write and check that it matches the color space of the profile (despite
++ what the comments said before, there is danger in assuming the app will
++ cope correctly with an RGB profile on a grayscale image and, since it
++ violates the PNG spec, allowing it is certain to produce inconsistent
++ app behavior and might even cause app crashes.) Check that profiles
++ contain the tags needed to process the PNG (tags all required by the ICC
++ spec). Removed unused PNG_STATIC from pngpriv.h.
++
++Version 1.6.0beta29 [September 4, 2012]
++ Fixed the simplified API example programs to add the *colormap parameter
++ to several of he API and improved the error message if the version field
++ is not set.
++ Added contrib/examples/* to the *.zip and *.7z distributions.
++ Updated simplified API synopses and description of the png_image structure
++ in the manual.
++ Made makepng and pngtest produce identical PNGs, add "--relaxed" option
++ to pngtest. The "--relaxed" option turns off the benign errors that are
++ enabled by default in pre-RC builds. makepng can now write ICC profiles
++ where the length has not been extended to a multiple of 4, and pngtest
++ now intercepts all libpng errors, allowing the previously-introduced
++ "--strict test" on no warnings to actually work.
++ Improved ICC profile handling including cHRM chunk generation and fixed
++ Cygwin+MSVC build errors. The ICC profile handling now includes more
++ checking. Several errors that caused rejection of the profile are now
++ handled with a warning in such a way that the invalid profiles will be
++ read by default in release (but not pre-RC) builds but will not be
++ written by default. The easy part of handling the cHRM chunk is written,
++ where the ICC profile contains the required data. The more difficult
++ part plus guessing a gAMA value requires code to pass selected RGB values
++ through the profile.
++
++Version 1.6.0beta30 [October 24, 2012]
++ Changed ICC profile matrix/vector types to not depend on array type rules.
++ By the ANSI-C standard the new types should be identical to the previous
++ versions, and all known versions of gcc tested with the previous versions
++ except for GCC-4.2.1 work with this version. The change makes the ANSI-C
++ rule that const applied to an array of elements applies instead to the
++ elements in the array moot by explicitly applying const to the base
++ elements of the png_icc_matrix and png_icc_vector types. The accidental
++ (harmless) 'const' previously applied to the parameters of two of the
++ functions have also been removed.
++ Added a work around for GCC 4.2 optimization bug.
++ Marked the broken (bad white point) original HP sRGB profiles correctly and
++ correct comments.
++ Added -DZ_SOLO to contrib/pngminim/*/makefile to work with zlib-1.2.7
++ Use /MDd for vstudio debug builds. Also added pngunkown to the vstudio
++ builds, fixed build errors and corrected a minor exit code error in
++ pngvalid if the 'touch' file name is invalid.
++ Add updated WARNING file to projects/vstudio from libpng 1.5/vstudio
++ Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in
++ pngrtran.c (Domani Hannes).
++
++Version 1.6.0beta31 [November 1, 2012]
++ Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
++ Made pngvalid so that it will build outside the libpng source tree.
++ Made builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
++ Made PNG_NO_READ_GAMMA switch off interfaces that depend on READ_GAMMA.
++ Prior to 1.6.0 switching off READ_GAMMA did unpredictable things to the
++ interfaces that use it (specifically, png_do_background in 1.4 would
++ simply display composite for grayscale images but do composition
++ with the incorrect arithmetic for color ones). In 1.6 the semantic
++ of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
++ depends on it; this obliges people who set it to consider whether they
++ really want it off if they happen to use any of the interfaces in
++ question (typically most users who disable it won't).
++ Fixed GUIDs in projects/vstudio. Some were duplicated or missing,
++ resulting in VS2010 having to update the files.
++ Removed non-working ICC profile support code that was mostly added to
++ libpng-1.6.0beta29 and beta30. There was too much code for too little
++ gain; implementing full ICC color correction may be desireable but is left
++ up to applications.
++
++Version 1.6.0beta32 [November 25, 2012]
++ Fixed an intermittent SEGV in pngstest due to an uninitialized array element.
++ Added the ability for contrib/libtests/makepng.c to make a PNG with just one
++ color. This is useful for debugging pngstest color inaccuracy reports.
++ Fixed error checking in the simplified write API (Olaf van der Spek)
++ Made png_user_version_check() ok to use with libpng version 1.10.x and later.
++
++Version 1.6.0beta33 [December 15, 2012]
++ Fixed typo in png.c (PNG_SET_CHUNK_MALLOC_MAX should be PNG_CHUNK_MALLOC_MAX)
++ that causes the MALLOC_MAX limit not to work (John Bowler)
++ Change png_warning() to png_app_error() in pngwrite.c and comment the
++ fall-through condition.
++ Change png_warning() to png_app_warning() in png_write_tRNS().
++ Rearranged the ARM-NEON optimizations: Isolated the machine specific code
++ to the hardware subdirectory and added comments to pngrutil.c so that
++ implementors of other optimizations know what to do.
++ Fixed cases of unquoted DESTDIR in Makefile.am
++ Rebuilt Makefile.in, etc., with autoconf-2.69 and automake-1.12.5.
++
++Version 1.6.0beta34 [December 19, 2012]
++ Cleaned up whitespace in the synopsis portion of the manpage "libpng.3"
++ Disassembled the version number in scripts/options.awk (necessary for
++ building on SunOs).
++
++Version 1.6.0beta35 [December 23, 2012]
++ Made default Zlib compression settings be configurable. This adds #defines to
++ pnglibconf.h to control the defaults.
++ Fixed Windows build issues, enabled ARM compilation. Various warnings issued
++ by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old
++ GCCs.) ARM support is enabled by default in zlib.props (unsupported by
++ Microsoft) and ARM compilation is made possible by deleting the check for
++ x86. The test programs cannot be run because they are not signed.
++
++Version 1.6.0beta36 [January 2, 2013]
++ Discontinued distributing libpng-1.x.x.tar.bz2.
++ Discontinued distributing libpng-1.7.0-1.6.0-diff.txt and similar.
++ Rebuilt configure with autoconf-2.69 (inadvertently not done in beta33)
++ Fixed 'make distcheck' on SUN OS - libpng.so was not being removed
++
++Version 1.6.0beta37 [January 10, 2013]
++ Fixed conceivable but difficult to repro overflow. Also added two test
++ programs to generate and test a PNG which should have the problem.
++
++Version 1.6.0beta39 [January 19, 2013]
++ Again corrected attempt at overflow detection in png_set_unknown_chunks()
++ (CVE-2013-7353). Added overflow detection in png_set_sPLT() and
++ png_set_text_2() (CVE-2013-7354).
++
++Version 1.6.0beta40 [January 20, 2013]
++ Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs
++
++Version 1.6.0rc01 [January 26, 2013]
++ No changes.
++
++Version 1.6.0rc02 [February 4, 2013]
++ Added png_get_palette_max() function.
++
++Version 1.6.0rc03 [February 5, 2013]
++ Fixed the png_get_palette_max API.
++
++Version 1.6.0rc04 [February 7, 2013]
++ Turn serial tests back on (recently turned off by autotools upgrade).
++
++Version 1.6.0rc05 [February 8, 2013]
++ Update manual about png_get_palette_max().
++
++Version 1.6.0rc06 [February 9, 2013]
++ Fixed missing dependency in --prefix builds The intermediate
++ internal 'prefix.h' file can only be generated correctly after
++ pnglibconf.h, however the dependency was not in Makefile.am. The
++ symptoms are unpredictable depending on the order make chooses to
++ build pngprefix.h and pnglibconf.h, often the error goes unnoticed
++ because there is a system pnglibconf.h to use instead.
++
++Version 1.6.0rc07 [February 10, 2013]
++ Enclosed the new png_get_palette_max in #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
++ block, and revised pnglibconf.h and pnglibconf.h.prebuilt accordingly.
++
++Version 1.6.0rc08 [February 10, 2013]
++ Fix typo in png.h #ifdef
++
++Version 1.6.0 [February 14, 2013]
++ No changes.
++
++Version 1.6.1beta01 [February 16, 2013]
++ Made symbol prefixing work with the ARM neon optimizations. Also allow
++ pngpriv.h to be included for preprocessor definitions only, so it can
++ be used in non-C/C++ files. Back ported from libpng 1.7.
++ Made sRGB check numbers consistent.
++ Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
++ Removed cc -E workround, corrected png_get_palette_max API Tested on
++ SUN OS cc 5.9, which demonstrates the tokenization problem previously
++ avoided by using /lib/cpp. Since all .dfn output is now protected in
++ double quotes unless it is to be macro substituted the fix should
++ work everywhere.
++ Enabled parallel tests - back ported from libpng-1.7.
++ scripts/pnglibconf.dfa formatting improvements back ported from libpng17.
++ Fixed a race condition in the creation of the build 'scripts' directory
++ while building with a parallel make.
++ Use approved/supported Android method to check for NEON, use Linux/POSIX
++ 1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
++ library calls (ported from libpng15).
++
++Version 1.6.1beta02 [February 19, 2013]
++ Use parentheses more consistently in "#if defined(MACRO)" tests.
++ Folded long lines.
++ Reenabled code to allow zero length PLTE chunks for MNG.
++
++Version 1.6.1beta03 [February 22, 2013]
++ Fixed ALIGNED_MEMORY support.
++ Allow run-time ARM NEON checking to be disabled. A new configure option:
++ --enable-arm-neon=always will stop the run-time checks. New checks
++ within arm/arm_init.c will cause the code not to be compiled unless
++ __ARM_NEON__ is set. This should make it fail safe (if someone asks
++ for it on then the build will fail if it can't be done.)
++ Updated the INSTALL document.
++
++Version 1.6.1beta04 [February 27, 2013]
++ Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
++ Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
++ Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
++ with CRLF line endings.
++
++Version 1.6.1beta05 [March 1, 2013]
++ Avoid a possible memory leak in contrib/gregbook/readpng.c
++
++Version 1.6.1beta06 [March 4, 2013]
++ Better documentation of unknown handling API interactions.
++ Corrected Android builds and corrected libpng.vers with symbol
++ prefixing. This adds an API to set optimization options externally,
++ providing an alternative and general solution for the non-portable
++ run-time tests used by the ARM Neon code. It also makes those tests
++ compile and link on Android.
++ The order of settings vs options in pnglibconf.h is reversed to allow
++ settings to depend on options and options can now set (or override) the
++ defaults for settings.
++
++Version 1.6.1beta07 [March 7, 2013]
++ Corrected simplified API default gamma for color-mapped output, added
++ a flag to change default. In 1.6.0 when the simplified API was used
++ to produce color-mapped output from an input image with no gamma
++ information the gamma assumed for the input could be different from
++ that assumed for non-color-mapped output. In particular 16-bit depth
++ input files were assumed to be sRGB encoded, whereas in the 'direct'
++ case they were assumed to have linear data. This was an error. The
++ fix makes the simplified API treat all input files the same way and
++ adds a new flag to the png_image::flags member to allow the
++ application/user to specify that 16-bit files contain sRGB data
++ rather than the default linear.
++ Fixed bugs in the pngpixel and makepng test programs.
++
++Version 1.6.1beta08 [March 7, 2013]
++ Fixed CMakelists.txt to allow building a single variant of the library
++ (Claudio Bley):
++ Introduced a PNG_LIB_TARGETS variable that lists all activated library
++ targets. It is an error if this variable ends up empty, ie. you have
++ to build at least one library variant.
++ Made the *_COPY targets only depend on library targets actually being build.
++ Use PNG_LIB_TARGETS to unify a code path.
++ Changed the CREATE_SYMLINK macro to expect the full path to a file as the
++ first argument. When symlinking the filename component of that path is
++ determined and used as the link target.
++ Use copy_if_different in the CREATE_SYMLINK macro.
++
++Version 1.6.1beta09 [March 13, 2013]
++ Eliminated two warnings from the Intel C compiler. The warnings are
++ technically valid, although a reasonable treatment of division would
++ show it to be incorrect.
++
++Version 1.6.1rc01 [March 21, 2013]
++ No changes.
++
++Version 1.6.1 [March 28, 2013]
++ No changes.
++
++Version 1.6.2beta01 [April 14, 2013]
++ Updated documentation of 1.5.x to 1.6.x changes in iCCP chunk handling.
++ Fixed incorrect warning of excess deflate data. End condition - the
++ warning would be produced if the end of the deflate stream wasn't read
++ in the last row. The warning is harmless.
++ Corrected the test on user transform changes on read. It was in the
++ png_set of the transform function, but that doesn't matter unless the
++ transform function changes the rowbuf size, and that is only valid if
++ transform_info is called.
++ Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
++ (Flavio Medeiros).
++ Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
++ Bug was introduced in libpng-1.6.0.
++
++Version 1.6.2rc01 [April 18, 2013]
++ Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
++ written by libpng-1.6.0 and 1.6.1.
++ Disallow storing sRGB information when the sRGB is not supported.
++
++Version 1.6.2rc02 [April 18, 2013]
++ Merge pngtest.c with libpng-1.7.0
++
++Version 1.6.2rc03 [April 22, 2013]
++ Trivial spelling cleanup.
++
++Version 1.6.2rc04 and 1.6.2rc05 [omitted]
++
++Version 1.6.2rc06 [April 24, 2013]
++ Reverted to version 1.6.2rc03. Recent changes to arm/neon support
++ have been ported to libpng-1.7.0beta09 and will reappear in version
++ 1.6.3beta01.
++
++Version 1.6.2 [April 25, 2013]
++ No changes.
++
++Version 1.6.3beta01 [April 25, 2013]
++ Revised stack marking in arm/filter_neon.S and configure.ac.
++ Ensure that NEON filter stuff is completely disabled when switched 'off'.
++ Previously the ARM NEON specific files were still built if the option
++ was switched 'off' as opposed to being explicitly disabled.
++
++Version 1.6.3beta02 [April 26, 2013]
++ Test for 'arm*' not just 'arm' in the host_cpu configure variable.
++ Rebuilt the configure scripts.
++
++Version 1.6.3beta03 [April 30, 2013]
++ Expanded manual paragraph about writing private chunks, particularly
++ the need to call png_set_keep_unknown_chunks() when writing them.
++ Avoid dereferencing NULL pointer possibly returned from
++ png_create_write_struct() (Andrew Church).
++
++Version 1.6.3beta05 [May 9, 2013]
++ Calculate our own zlib windowBits when decoding rather than trusting the
++ CMF bytes in the PNG datastream.
++ Added an option to force maximum window size for inflating, which was
++ the behavior of libpng15 and earlier.
++ Added png-fix-itxt and png-fix-too-far-back to the built programs and
++ removed warnings from the source code and timepng that are revealed as
++ a result.
++ Detect wrong libpng versions linked to png-fix-too-far-back, which currently
++ only works with libpng versions that can be made to reliably fail when
++ the deflate data contains an out-of-window reference. This means only
++ 1.6 and later.
++ Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
++ message which it is easier to work round than ignore.
++ Updated contrib/pngminus/pnm2png.c (Paul Stewart):
++ Check for EOF
++ Ignore "#" delimited comments in input file to pnm2png.c.
++ Fixed whitespace handling
++ Added a call to png_set_packing()
++ Initialize dimension values so if sscanf fails at least we have known
++ invalid values.
++ Attempt to detect configuration issues with png-fix-too-far-back, which
++ requires both the correct libpng and the correct zlib to function
++ correctly.
++ Check ZLIB_VERNUM for mismatches, enclose #error in quotes
++ Added information in the documentation about problems with and fixes for
++ the bad CRC and bad iTXt chunk situations.
++
++Version 1.6.3beta06 [May 12, 2013]
++ Allow contrib/pngminus/pnm2png.c to compile without WRITE_INVERT and
++ WRITE_PACK supported (writes error message that it can't read P1 or
++ P4 PBM files).
++ Improved png-fix-too-far-back usage message, added --suffix option.
++ Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
++ right zlib header files.
++ Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
++
++Version 1.6.3beta07 [June 8, 2013]
++ Removed a redundant test in png_set_IHDR().
++ Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
++ Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
++ Enclose the prototypes for the simplified write API in
++ #ifdef PNG_STDIO_SUPPORTED/#endif
++ Make ARM NEON support work at compile time (not just configure time).
++ This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
++ using a compiler that compiles for multiple architectures at one time.
++ Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
++ pnglibconf.h, allowing more of the decisions to be made internally
++ (pngpriv.h) during the compile. Without this, symbol prefixing is broken
++ under certain circumstances on ARM platforms. Now only the API parts of
++ the optimizations ('check' vs 'api') are exposed in the public header files
++ except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
++ decision about whether or not to use the optimizations.
++ Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
++ Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
++ on __ARM_NEON__ from configure time to compile time. This breaks symbol
++ prefixing because the definition of the special png_init_filter_functions
++ call was hidden at configure time if the relevant compiler arguments are
++ passed in CFLAGS as opposed to CC. This change attempts to avoid all
++ the confusion that would result by declaring the init function even when
++ it is not used, so that it will always get prefixed.
++
++Version 1.6.3beta08 [June 18, 2013]
++ Revised libpng.3 so that "doclifter" can process it.
++
++Version 1.6.3beta09 [June 27, 2013]
++ Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
++ as parameters for png_set_gamma(). These have been available since
++ libpng-1.5.4.
++ Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
++ to check all compressed chunks known to libpng.
++
++Version 1.6.3beta10 [July 5, 2013]
++ Updated documentation to show default behavior of benign errors correctly.
++ Only compile ARM code when PNG_READ_SUPPORTED is defined.
++ Fixed undefined behavior in contrib/tools/pngfix.c and added new strip
++ option. pngfix relied on undefined behavior and even a simple change from
++ gcc to g++ caused it to fail. The new strip option 'unsafe' has been
++ implemented and is the default if --max is given. Option names have
++ been clarified, with --strip=transform now stripping the bKGD chunk,
++ which was stripped previously with --strip=unused.
++ Added all documented chunk types to pngpriv.h
++ Unified pngfix.c source with libpng17.
++
++Version 1.6.3rc01 [July 11, 2013]
++ No changes.
++
++Version 1.6.3 [July 18, 2013]
++ Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
++ Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
++ may be erroneously issued by code-checking applications.
++
++Version 1.6.4beta01 [August 21, 2013]
++ Added information about png_set_options() to the manual.
++ Delay calling png_init_filter_functions() until a row with nonzero filter
++ is found.
++
++Version 1.6.4beta02 [August 30, 2013]
++ Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
++ prototype, definition, and usage. Made it depend on
++ PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
++
++Version 1.6.4rc01 [September 5, 2013]
++ No changes.
++
++Version 1.6.4 [September 12, 2013]
++ No changes.
++
++Version 1.6.5 [September 14, 2013]
++ Removed two stray lines of code from arm/arm_init.c.
++
++Version 1.6.6 [September 16, 2013]
++ Removed two stray lines of code from arm/arm_init.c, again.
++
++Version 1.6.7beta01 [September 30, 2013]
++ Revised unknown chunk code to correct several bugs in the NO_SAVE_/NO_WRITE
++ combination
++ Allow HANDLE_AS_UNKNOWN to work when other options are configured off. Also
++ fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
++ which terminates the make options (as by default in recent versions of
++ Gentoo).
++ Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
++ png_modifier are greater than that of png_store and as a consequence
++ compilation of pngvalid.c results in a warning about increased alignment
++ requirements because of the bare cast to (png_modifier*). The code is safe,
++ because the pointer is known to point to a stack allocated png_modifier,
++ but this change avoids the warning.
++ Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
++ compiled without the CHECK option it defaulted to on, not off.
++ Check user callback behavior in pngunknown.c. Previous versions compiled
++ if SAVE_UNKNOWN was not available but did nothing since the callback
++ was never implemented.
++ Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
++
++Version 1.6.7beta02 [October 12, 2013]
++ Made changes for compatibility with automake 1.14:
++ 1) Added the 'compile' program to the list of programs that must be cleaned
++ in autogen.sh
++ 2) Added 'subdir-objects' which causes .c files in sub-directories to be
++ compiled such that the corresponding .o files are also in the
++ sub-directory. This is because automake 1.14 warns that the
++ current behavior of compiling to the top level directory may be removed
++ in the future.
++ 3) Updated dependencies on pnglibconf.h to match the new .o locations and
++ added all the files in contrib/libtests and contrib/tools that depend
++ on pnglibconf.h
++ 4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
++ way of handling the dependencies of sources that are machine generated;
++ unfortunately it only works if the user does 'make all' or 'make check',
++ so the dependencies (3) are still required.
++ Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
++ compiler complains about casting a string literal as (char*), so copied the
++ treatment of z_const from the library code into pngfix.c
++ Simplified error message code in pngunknown. The simplification has the
++ useful side effect of avoiding a bogus warning generated by the latest
++ version of the Intel C compiler (it objects to
++ condition ? string-literal : string-literal).
++ Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
++ removing the 1.14 'compile' script but never checking for it.
++
++Version 1.6.7beta03 [October 19, 2013]
++ Added ARMv8 support (James Yu <james.yu at linaro.org>). Added file
++ arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
++ Revised pngvalid to generate size images with as many filters as it can
++ manage, limited by the number of rows.
++ Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
++ and detect the broken GCC compilers.
++
++Version 1.6.7beta04 [October 26, 2013]
++ Allow clang derived from older GCC versions to use ARM intrinsics. This
++ causes all clang builds that use -mfpu=neon to use the intrinsics code,
++ not the assembler code. This has only been tested on iOS 7. It may be
++ necessary to exclude some earlier clang versions but this seems unlikely.
++ Changed NEON implementation selection mechanism. This allows assembler
++ or intrinsics to be turned on at compile time during the build by defining
++ PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1). This macro
++ is undefined by default and the build type is selected in pngpriv.h.
++
++Version 1.6.7rc01 [November 2, 2013]
++ No changes.
++
++Version 1.6.7rc02 [November 7, 2013]
++ Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
++ checking macros take an unsigned char argument, not a signed char.
++
++Version 1.6.7 [November 14, 2013]
++ No changes.
++
++Version 1.6.8beta01 [November 24, 2013]
++ Moved prototype for png_handle_unknown() in pngpriv.h outside of
++ the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
++ Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
++ Conditionally compile some unused functions reported by -Wall in
++ pngminim.
++ Fixed 'minimal' builds. Various obviously useful minimal configurations
++ don't build because of missing contrib/libtests test programs and
++ overly complex dependencies in scripts/pnglibconf.dfa. This change
++ adds contrib/conftest/*.dfa files that can be used in automatic build
++ scripts to ensure that these configurations continue to build.
++ Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
++ Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
++ This reverts to the previous 'static' implementation and works round
++ the 'unused static function' warning by using PNG_UNUSED().
++
++Version 1.6.8beta02 [November 30, 2013]
++ Removed or marked PNG_UNUSED some harmless "dead assignments" reported
++ by clang scan-build.
++ Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
++ to '"%s" m' to improve portability among compilers.
++ Changed png_free_default() to free() in pngtest.c
++
++Version 1.6.8rc01 [December 12, 2013]
++ Tidied up pngfix inits and fixed pngtest no-write builds.
++
++Version 1.6.8rc02 [December 14, 2013]
++ Handle zero-length PLTE chunk or NULL palette with png_error()
++ instead of png_chunk_report(), which by default issues a warning
++ rather than an error, leading to later reading from a NULL pointer
++ (png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
++ and VU#650142. Libpng-1.6.1 through 1.6.7 are vulnerable.
++ Libpng-1.6.0 and earlier do not have this bug.
++
++Version 1.6.8 [December 19, 2013]
++ No changes.
++
++Version 1.6.9beta01 [December 26, 2013]
++ Bookkeeping: Moved functions around (no changes). Moved transform
++ function definitions before the place where they are called so that
++ they can be made static. Move the intrapixel functions and the
++ grayscale palette builder out of the png?tran.c files. The latter
++ isn't a transform function and is no longer used internally, and the
++ former MNG specific functions are better placed in pngread/pngwrite.c
++ Made transform implementation functions static. This makes the internal
++ functions called by png_do_{read|write}_transformations static. On an
++ x86-64 DLL build (Gentoo Linux) this reduces the size of the text
++ segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
++ maintenance by removing the declarations from pngpriv.h and allowing
++ easier changes to the internal interfaces.
++ Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
++ in the tar distributions.
++
++Version 1.6.9beta02 [January 1, 2014]
++ Added checks for libpng 1.5 to pngvalid.c. This supports the use of
++ this version of pngvalid in libpng 1.5
++ Merged with pngvalid.c from libpng-1.7 changes to create a single
++ pngvalid.c
++ Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
++ Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
++ Merged libpng-1.7.0 changes to make no-interlace configurations work
++ with test programs.
++ Revised pngvalid.c to support libpng 1.5, which does not support the
++ PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
++ pngvalid.c
++ Allow unversioned links created on install to be disabled in configure.
++ In configure builds 'make install' changes/adds links like png.h
++ and libpng.a to point to the newly installed, versioned, files (e.g.
++ libpng17/png.h and libpng17.a). Three new configure options and some
++ rearrangement of Makefile.am allow creation of these links to be disabled.
++
++Version 1.6.9beta03 [January 10, 2014]
++ Removed potentially misleading warning from png_check_IHDR().
++
++Version 1.6.9beta04 [January 20, 2014]
++ Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
++ Added clang attribute support (Cosmin).
++
++Version 1.6.9rc01 [January 28, 2014]
++ No changes.
++
++Version 1.6.9rc02 [January 30, 2014]
++ Quiet an uninitialized memory warning from VC2013 in png_get_png().
++
++Version 1.6.9 [February 6, 2014]
++
++Version 1.6.10beta01 [February 9, 2014]
++ Backported changes from libpng-1.7.0beta30 and beta31:
++ Fixed a large number of instances where PNGCBAPI was omitted from
++ function definitions.
++ Added pngimage test program for png_read_png() and png_write_png()
++ with two new test scripts.
++ Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
++ png_set_packing() in png_read_png().
++ Fixed combination of ~alpha with shift. On read invert alpha, processing
++ occurred after shift processing, which causes the final values to be
++ outside the range that should be produced by the shift. Reversing the
++ order on read makes the two transforms work together correctly and mirrors
++ the order used on write.
++ Do not read invalid sBIT chunks. Previously libpng only checked sBIT
++ values on write, so a malicious PNG writer could therefore cause
++ the read code to return an invalid sBIT chunk, which might lead to
++ application errors or crashes. Such chunks are now skipped (with
++ chunk_benign_error).
++ Make png_read_png() and png_write_png() prototypes in png.h depend
++ upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
++ Support builds with unsupported PNG_TRANSFORM_* values. All of the
++ PNG_TRANSFORM_* values are always defined in png.h and, because they
++ are used for both read and write in some cases, it is not reliable
++ to #if out ones that are totally unsupported. This change adds error
++ detection in png_read_image() and png_write_image() to do a
++ png_app_error() if the app requests something that cannot be done
++ and it adds corresponding code to pngimage.c to handle such options
++ by not attempting to test them.
++
++Version 1.6.10beta02 [February 23, 2014]
++ Moved redefines of png_error(), png_warning(), png_chunk_error(),
++ and png_chunk_warning() from pngpriv.h to png.h to make them visible
++ to libpng-calling applications.
++ Moved OS dependent code from arm/arm_init.c, to allow the included
++ implementation of the ARM NEON discovery function to be set at
++ build-time and provide sample implementations from the current code in the
++ contrib/arm-neon subdirectory. The __linux__ code has also been changed to
++ compile and link on Android by using /proc/cpuinfo, and the old linux code
++ is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
++ dependencies apart from opening /proc/cpuinfo and is C90 compliant.
++ Check for info_ptr == NULL early in png_read_end() so we don't need to
++ run all the png_handle_*() and depend on them to return if info_ptr == NULL.
++ This improves the performance of png_read_end(png_ptr, NULL) and makes
++ it more robust against future programming errors.
++ Check for __has_extension before using it in pngconf.h, to
++ support older Clang versions (Jeremy Sequoia).
++ Treat CRC error handling with png_set_crc_action(), instead of with
++ png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
++ Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
++ so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
++ Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
++ after recognizing the IDAT chunk, which avoids an infinite loop while
++ reading a datastream whose first IDAT chunk is of zero-length.
++ This fixes CERT VU#684412 and CVE-2014-0333.
++ Don't recognize known sRGB profiles as sRGB if they have been hacked,
++ but don't reject them and don't issue a copyright violation warning.
++
++Version 1.6.10beta03 [February 25, 2014]
++ Moved some documentation from png.h to libpng.3 and libpng-manual.txt
++ Minor editing of contrib/arm-neon/README and contrib/examples/*.c
++
++Version 1.6.10rc01 [February 27, 2014]
++ Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
++ and PNG_USR_CONFIG -> PNG_USER_CONFIG).
++
++Version 1.6.10rc02 [February 28, 2014]
++ Removed unreachable return statement after png_chunk_error()
++ in pngrutil.c
++
++Version 1.6.10rc03 [March 4, 2014]
++ Un-deprecated png_data_freer().
++
++Version 1.6.10 [March 6, 2014]
++ No changes.
++
++Version 1.6.11beta01 [March 17, 2014]
++ Use "if (value != 0)" instead of "if (value)" consistently.
++ Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
++ Moved configuration information from the manual to the INSTALL file.
++
++Version 1.6.11beta02 [April 6, 2014]
++ Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
++ they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
++ when using its "__builtin_pow()" function.
++ Silence 'unused parameter' build warnings (Cosmin Truta).
++ $(CP) is now used alongside $(RM_F). Also, use 'copy' instead of 'cp'
++ where applicable, and applied other minor makefile changes (Cosmin).
++ Don't warn about invalid dimensions exceeding user limits (Cosmin).
++ Allow an easy replacement of the default pre-built configuration
++ header with a custom header, via the make PNGLIBCONF_H_PREBUILT
++ macro (Cosmin).
++
++Version 1.6.11beta03 [April 6, 2014]
++ Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
++ with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
++ Optionally use __builtin_bswap16() in png_do_swap().
++
++Version 1.6.11beta04 [April 19, 2014]
++ Made progressive reading of interlaced images consistent with the
++ behavior of the sequential reader and consistent with the manual, by
++ moving some code out of the PNG_READ_INTERLACING_SUPPORTED blocks. The
++ row_callback now receives the proper pass number and unexpanded rows, when
++ png_combine_row() isn't built or used, and png_set_interlace_handling()
++ is not called.
++ Allow PNG_sRGB_PROFILE_CHECKING = (-1) to mean no sRGB profile checking.
++
++Version 1.6.11beta05 [April 26, 2014]
++ Do not reject ICC V2 profiles that lack padding (Kai-Uwe Behrmann).
++ Relocated closing bracket of the sRGB profile test loop to avoid getting
++ "Not recognizing known sRGB profile that has been edited" warning for
++ ICC V2 profiles that lack the MD5 signature in the profile header.
++
++Version 1.6.11beta06 [May 19, 2014]
++ Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
++
++Version 1.6.11rc01 [May 27, 2014]
++ No changes.
++
++Version 1.6.11rc02 [June 3, 2014]
++ Test ZLIB_VERNUM instead of PNG_ZLIB_VERNUM in contrib/tools/pngfix.c
++
++Version 1.6.11 [June 5, 2014]
++ No changes.
++
++Version 1.6.12rc01 [June 6, 2014]
++ Relocated new code from 1.6.11beta06 in png.c to a point after the
++ declarations (Max Stepin).
++
++Version 1.6.12rc02 [June 7, 2014]
++ Changed file permissions of contrib/tools/intgamma.sh,
++ test-driver, and compile from 0644 to 0755 (Cosmin).
++
++Version 1.6.12rc03 [June 8, 2014]
++ Ensure "__has_attribute()" macro exists before trying to use it with
++ old clang compilers (MacPorts Ticket #43939).
++
++Version 1.6.12 [June 12, 2014]
++ No changes.
++
++Version 1.6.13beta01 [July 4, 2014]
++ Quieted -Wsign-compare and -Wclobber compiler warnings in
++ contrib/pngminus/*.c
++ Added "(void) png_ptr;" where needed in contrib/gregbook to quiet
++ compiler complaints about unused pointers.
++ Split a long output string in contrib/gregbook/rpng2-x.c.
++ Added "PNG_SET_OPTION" requirement for sRGB chunk support to pnglibconf.dfa,
++ Needed for write-only support (John Bowler).
++ Changed "if defined(__ARM_NEON__)" to
++ "if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
++ Fixed clang no-warning builds: png_digit was defined but never used.
++
++Version 1.6.13beta02 [July 21, 2014]
++ Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
++ (bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11.
++ Also fixed makefile.bc32, makefile.bor, makefile.msc, makefile.intel, and
++ makefile.tc3 similarly.
++
++Version 1.6.13beta03 [August 3, 2014]
++ Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
++ due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
++ definitions from pngconf.h.
++ Ensure that CMakeLists.txt makes the target "lib" directory before making
++ symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
++
++Version 1.6.13beta04 [August 8, 2014]
++ Added opinion that the ECCN (Export Control Classification Number) for
++ libpng is EAR99 to the README file.
++ Eliminated use of "$<" in makefile explicit rules, when copying
++ $PNGLIBCONF_H_PREBUILT. This does not work on some versions of make;
++ bug introduced in libpng version 1.6.11.
++
++Version 1.6.13rc01 [August 14, 2014]
++ Made "ccopts" agree with "CFLAGS" in scripts/makefile.hp* and makefile.*sunu
++
++Version 1.6.13 [August 21, 2014]
++ No changes.
++
++Version 1.6.14beta01 [September 14, 2014]
++ Guard usage of png_ptr->options with #ifdef PNG_SET_OPTION_SUPPORTED.
++ Do not build contrib/tools/pngfix.c when PNG_SETJMP_NOT_SUPPORTED,
++ to allow "make" to complete without setjmp support (bug report by
++ Claudio Fontana)
++ Add "#include <setjmp.h>" to contrib/tools/pngfix.c (John Bowler)
++
++Version 1.6.14beta02 [September 18, 2014]
++ Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
++ because usleep() is deprecated.
++ Define usleep() in contrib/gregbook/rpng2-x.c if not already defined
++ in unistd.h and nanosleep() is not available; fixes error introduced
++ in libpng-1.6.13.
++ Disable floating point exception handling in pngvalid.c when
++ PNG_FLOATING_ARITHMETIC is not supported (bug report by "zootus
++ at users.sourceforge.net").
++
++Version 1.6.14beta03 [September 19, 2014]
++ Define FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in pngvalid.c if not
++ already defined. Revert floating point exception handling in pngvalid.c
++ to version 1.6.14beta01 behavior.
++
++Version 1.6.14beta04 [September 27, 2014]
++ Fixed incorrect handling of the iTXt compression flag in pngrutil.c
++ (bug report by Shunsaku Hirata). Bug was introduced in libpng-1.6.0.
++
++Version 1.6.14beta05 [October 1, 2014]
++ Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa
++
++Version 1.6.14beta06 [October 5, 2014]
++ Removed unused "text_len" parameter from private function png_write_zTXt().
++ Conditionally compile some code in png_deflate_claim(), when
++ PNG_WARNINGS_SUPPORTED and PNG_ERROR_TEXT_SUPPORTED are disabled.
++ Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
++ Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
++ to pnglibconf.dfa.
++ Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
++ to make it possible to configure a libpng that supports iCCP but not TEXT.
++
++Version 1.6.14beta07 [October 7, 2014]
++ Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
++ Only mark text chunks as written after successfully writing them.
++
++Version 1.6.14rc01 [October 15, 2014]
++ Fixed some typos in comments.
++
++Version 1.6.14rc02 [October 17, 2014]
++ Changed png_convert_to_rfc_1123() to png_convert_to_rfc_1123_buffer()
++ in the manual, to reflect the change made in libpng-1.6.0.
++ Updated README file to explain that direct access to the png_struct
++ and info_struct members has not been permitted since libpng-1.5.0.
++
++Version 1.6.14 [October 23, 2014]
++ No changes.
++
++Version 1.6.15beta01 [October 29, 2014]
++ Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
++ Simplified png_free_data().
++ Added missing "ptr = NULL" after some instances of png_free().
++
++Version 1.6.15beta02 [November 1, 2014]
++ Changed remaining "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
++
++Version 1.6.15beta03 [November 3, 2014]
++ Added PNG_USE_ARM_NEON configuration flag (Marcin Juszkiewicz).
++
++Version 1.6.15beta04 [November 4, 2014]
++ Removed new PNG_USE_ARM_NEON configuration flag and made a one-line
++ revision to configure.ac to support ARM on aarch64 instead (John Bowler).
++
++Version 1.6.15beta05 [November 5, 2014]
++ Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
++ example.c, pngtest.c, and applications in the contrib directory.
++ Avoid out-of-bounds memory access in png_user_version_check().
++ Simplified and future-proofed png_user_version_check().
++ Fixed GCC unsigned int->float warnings. Various versions of GCC
++ seem to generate warnings when an unsigned value is implicitly
++ converted to double. This is probably a GCC bug but this change
++ avoids the issue by explicitly converting to (int) where safe.
++ Free all allocated memory in pngimage. The file buffer cache was left
++ allocated at the end of the program, harmless but it causes memory
++ leak reports from clang.
++ Fixed array size calculations to avoid warnings. At various points
++ in the code the number of elements in an array is calculated using
++ sizeof. This generates a compile time constant of type (size_t) which
++ is then typically assigned to an (unsigned int) or (int). Some versions
++ of GCC on 64-bit systems warn about the apparent narrowing, even though
++ the same compiler does apparently generate the correct, in-range,
++ numeric constant. This adds appropriate, safe, casts to make the
++ warnings go away.
++
++Version 1.6.15beta06 [November 6, 2014]
++ Reverted use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING
++ in the manual, example.c, pngtest.c, and applications in the contrib
++ directory. It was incorrect advice.
++
++Version 1.6.15beta07 [November 7, 2014]
++ Removed #ifdef PNG_16BIT_SUPPORTED/#endif around png_product2(); it is
++ needed by png_reciprocal2().
++ Added #ifdef PNG_16BIT_SUPPORTED/#endif around png_log16bit() and
++ png_do_swap().
++ Changed all "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */"
++
++Version 1.6.15beta08 [November 8, 2014]
++ More housecleaning in *.h
++
++Version 1.6.15rc01 [November 13, 2014]
++
++Version 1.6.15rc02 [November 14, 2014]
++ The macros passed in the command line to Borland make were ignored if
++ similarly-named macros were already defined in makefiles. This behavior
++ is different from POSIX make and other make programs. Surround the
++ macro definitions with ifndef guards (Cosmin).
++
++Version 1.6.15rc03 [November 16, 2014]
++ Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in scripts/makefile.vcwin32.
++ Removed the obsolete $ARCH variable from scripts/makefile.darwin.
++
++Version 1.6.15 [November 20, 2014]
++ No changes.
++
++Version 1.6.16beta01 [December 14, 2014]
++ Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
++ don't do alignment correctly.
++ Revised Makefile.am and scripts/symbols.dfn to work with MinGW/MSYS
++ (Bob Friesenhahn).
++
++Version 1.6.16beta02 [December 15, 2014]
++ Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
++ renamed scripts/*.dfn to scripts/*.c (John Bowler).
++
++Version 1.6.16beta03 [December 21, 2014]
++ Quiet a "comparison always true" warning in pngstest.c (John Bowler).
++
++Version 1.6.16rc01 [December 21, 2014]
++ Restored a test on width that was removed from png.c at libpng-1.6.9
++ (Bug report by Alex Eubanks).
++
++Version 1.6.16rc02 [December 21, 2014]
++ Undid the update to pngrutil.c in 1.6.16rc01.
++
++Version 1.6.16rc03 [December 21, 2014]
++ Fixed an overflow in png_combine_row with very wide interlaced images.
++
++Version 1.6.16 [December 22, 2014]
++ No changes.
+
+ Send comments/corrections/commendations to png-mng-implement at lists.sf.net
+ (subscription required; visit
+@@ -3540,5 +5156,3 @@
+ or to glennrp at users.sourceforge.net
+
+ Glenn R-P
+-*/ }
+-#endif
+--- ./jdk/src/share/native/sun/awt/libpng/LICENSE Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/LICENSE Fri Apr 10 09:21:28 2015 -0700
+@@ -10,8 +10,8 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
+-Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
++Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+
+@@ -108,4 +108,4 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+--- ./jdk/src/share/native/sun/awt/libpng/README Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/README Fri Apr 10 09:21:28 2015 -0700
+@@ -1,11 +1,11 @@
+-README for libpng version 1.5.4 - July 7, 2011 (shared library 15.0)
++README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
+ See the note about version numbers near the top of png.h
+
+ See INSTALL for instructions on how to install libpng.
+
+-Libpng comes in several distribution formats. Get libpng-*.tar.gz,
+-libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
+-in the text files, or lpng*.zip if you want DOS-style line endings.
++Libpng comes in several distribution formats. Get libpng-*.tar.gz or
++libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
++or lpng*.7z or lpng*.zip if you want DOS-style line endings.
+
+ Version 0.89 was the first official release of libpng. Don't let the
+ fact that it's the first release fool you. The libpng library has been in
+@@ -23,18 +23,25 @@
+ png_uint_32, which will affect shared-library applications that use
+ this function.
+
+-To avoid problems with changes to the internals of png_info_struct,
++To avoid problems with changes to the internals of png info_struct,
+ new APIs have been made available in 0.95 to avoid direct application
+ access to info_ptr. These functions are the png_set_<chunk> and
+ png_get_<chunk> functions. These functions should be used when
+ accessing/storing the info_struct data, rather than manipulating it
+ directly, to avoid such problems in the future.
+
+-It is important to note that the APIs do not make current programs
++It is important to note that the APIs did not make current programs
+ that access the info struct directly incompatible with the new
+-library. However, it is strongly suggested that new programs use
+-the new APIs (as shown in example.c and pngtest.c), and older programs
+-be converted to the new format, to facilitate upgrades in the future.
++library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
++be a transitional release, members of the png_struct and the
++info_struct can still be accessed, but the compiler will issue a
++warning about deprecated usage. Since libpng-1.5.0, direct access
++to these structs is not allowed, and the definitions of the structs
++reside in private pngstruct.h and pnginfo.h header files that are not
++accessible to applications. It is strongly suggested that new
++programs use the new APIs (as shown in example.c and pngtest.c), and
++older programs be converted to the new format, to facilitate upgrades
++in the future.
+ ****
+
+ Additions since 0.90 include the ability to compile libpng as a
+@@ -77,17 +84,21 @@
+ You can use zlib as a drop-in replacement for fread() and fwrite() if
+ you are so inclined.
+
+-zlib should be available at the same place that libpng is, or at.
+-ftp://ftp.info-zip.org/pub/infozip/zlib
++zlib should be available at the same place that libpng is, or at zlib.net.
+
+ You may also want a copy of the PNG specification. It is available
+ as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
+ these at http://www.libpng.org/pub/png/documents/
+
+ This code is currently being archived at libpng.sf.net in the
+-[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
+-at GO GRAPHSUP. If you can't find it in any of those places,
+-e-mail me, and I'll help you find it.
++[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
++in any of those places, e-mail me, and I'll help you find it.
++
++I am not a lawyer, but I believe that the Export Control Classification
++Number (ECCN) for libpng is EAR99, which means not subject to export
++controls or International Traffic in Arms Regulations (ITAR) because it
++is open source, publicly available software, that does not contain any
++encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
+
+ If you have any code changes, requests, problems, etc., please e-mail
+ them to me. Also, I'd appreciate any make files or project files,
+@@ -105,7 +116,7 @@
+ development group.
+
+ Send comments/corrections/commendations to png-mng-implement at
+-lists.sourceforge.net (subscription required; visit
++lists.sourceforge.net (subscription required; visit
+ https://lists.sourceforge.net/lists/listinfo/png-mng-implement
+ to subscribe) or to glennrp at users.sourceforge.net
+
+@@ -123,7 +134,7 @@
+ to others, if necessary.
+
+ Please do not send suggestions on how to change PNG. We have
+-been discussing PNG for sixteen years now, and it is official and
++been discussing PNG for nineteen years now, and it is official and
+ finished. If you have suggestions for libpng, however, I'll
+ gladly listen. Even if your suggestion is not used immediately,
+ it may be used later.
+@@ -167,23 +178,25 @@
+ pngwrite.c => High-level write functions
+ pngwtran.c => Write data transformations
+ pngwutil.c => Write utility functions
++ arm => Contains optimized code for the ARM platform
+ contrib => Contributions
++ examples => Example programs
+ gregbook => source code for PNG reading and writing, from
+ Greg Roelofs' "PNG: The Definitive Guide",
+ O'Reilly, 1999
+- msvctest => Builds and runs pngtest using a MSVC workspace
+- pngminus => Simple pnm2png and png2pnm programs
+- pngsuite => Test images
+- visupng => Contains a MSVC workspace for VisualPng
++ libtests => Test programs
++ pngminim => Minimal decoder, encoder, and progressive decoder
++ programs demonstrating use of pngusr.dfa
++ pngminus => Simple pnm2png and png2pnm programs
++ pngsuite => Test images
++ tools => Various tools
++ visupng => Contains a MSVC workspace for VisualPng
+ projects => Contains project files and workspaces for
+ building a DLL
+- cbuilder5 => Contains a Borland workspace for building
+- libpng and zlib
+- visualc6 => Contains a Microsoft Visual C++ (MSVC)
+- workspace for building libpng and zlib
++ owatcom => Contains a WATCOM project for building libpng
+ visualc71 => Contains a Microsoft Visual C++ (MSVC)
+ workspace for building libpng and zlib
+- xcode => Contains an Apple xcode
++ vstudio => Contains a Microsoft Visual C++ (MSVC)
+ workspace for building libpng and zlib
+ scripts => Directory containing scripts for building libpng:
+ (see scripts/README.txt for the list of scripts)
+--- ./jdk/src/share/native/sun/awt/libpng/png.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/png.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.16 [December 22, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -42,7 +42,7 @@
+ #include "pngpriv.h"
+
+ /* Generate a compiler error if there is an old png.h in the search path. */
+-typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4;
++typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+
+ /* Tells libpng that we have already handled the first "num_bytes" bytes
+ * of the PNG file signature. If the PNG data is embedded into another
+@@ -52,7 +52,7 @@
+
+ #ifdef PNG_READ_SUPPORTED
+ void PNGAPI
+-png_set_sig_bytes(png_structp png_ptr, int num_bytes)
++png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
+ {
+ png_debug(1, "in png_set_sig_bytes");
+
+@@ -71,7 +71,7 @@
+ * can simply check the remaining bytes for extra assurance. Returns
+ * an integer less than, equal to, or greater than zero if sig is found,
+ * respectively, to be less than, to match, or be greater than the correct
+- * PNG signature (this is the same behaviour as strcmp, memcmp, etc).
++ * PNG signature (this is the same behavior as strcmp, memcmp, etc).
+ */
+ int PNGAPI
+ png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
+@@ -90,52 +90,47 @@
+ if (start + num_to_check > 8)
+ num_to_check = 8 - start;
+
+- return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
++ return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
+ }
+
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* READ */
+
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+ /* Function to allocate memory for zlib */
+ PNG_FUNCTION(voidpf /* PRIVATE */,
+ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
+ {
+- png_voidp ptr;
+- png_structp p=(png_structp)png_ptr;
+- png_uint_32 save_flags=p->flags;
+- png_alloc_size_t num_bytes;
++ png_alloc_size_t num_bytes = size;
+
+ if (png_ptr == NULL)
+- return (NULL);
+-
+- if (items > PNG_UINT_32_MAX/size)
++ return NULL;
++
++ if (items >= (~(png_alloc_size_t)0)/size)
+ {
+- png_warning (p, "Potential overflow in png_zalloc()");
+- return (NULL);
++ png_warning (png_voidcast(png_structrp, png_ptr),
++ "Potential overflow in png_zalloc()");
++ return NULL;
+ }
+- num_bytes = (png_alloc_size_t)items * size;
+-
+- p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
+- ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
+- p->flags=save_flags;
+-
+- return ((voidpf)ptr);
++
++ num_bytes *= items;
++ return png_malloc_warn(png_voidcast(png_structrp, png_ptr), num_bytes);
+ }
+
+ /* Function to free memory for zlib */
+ void /* PRIVATE */
+ png_zfree(voidpf png_ptr, voidpf ptr)
+ {
+- png_free((png_structp)png_ptr, (png_voidp)ptr);
++ png_free(png_voidcast(png_const_structrp,png_ptr), ptr);
+ }
+
+ /* Reset the CRC variable to 32 bits of 1's. Care must be taken
+ * in case CRC is > 32 bits to leave the top bits 0.
+ */
+ void /* PRIVATE */
+-png_reset_crc(png_structp png_ptr)
++png_reset_crc(png_structrp png_ptr)
+ {
+- png_ptr->crc = crc32(0, Z_NULL, 0);
++ /* The cast is safe because the crc is a 32 bit value. */
++ png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
+ }
+
+ /* Calculate the CRC over a section of data. We can only pass as
+@@ -144,119 +139,254 @@
+ * trouble of calculating it.
+ */
+ void /* PRIVATE */
+-png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length)
++png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
+ {
+ int need_crc = 1;
+
+- if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
++ if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
+ {
+ if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
+ (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
+ need_crc = 0;
+ }
+
+- else /* critical */
++ else /* critical */
+ {
+- if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
++ if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
+ need_crc = 0;
+ }
+
+- if (need_crc)
+- png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length);
++ /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
++ * systems it is a 64 bit value. crc32, however, returns 32 bits so the
++ * following cast is safe. 'uInt' may be no more than 16 bits, so it is
++ * necessary to perform a loop here.
++ */
++ if (need_crc != 0 && length > 0)
++ {
++ uLong crc = png_ptr->crc; /* Should never issue a warning */
++
++ do
++ {
++ uInt safe_length = (uInt)length;
++ if (safe_length == 0)
++ safe_length = (uInt)-1; /* evil, but safe */
++
++ crc = crc32(crc, ptr, safe_length);
++
++ /* The following should never issue compiler warnings; if they do the
++ * target system has characteristics that will probably violate other
++ * assumptions within the libpng code.
++ */
++ ptr += safe_length;
++ length -= safe_length;
++ }
++ while (length > 0);
++
++ /* And the following is always safe because the crc is only 32 bits. */
++ png_ptr->crc = (png_uint_32)crc;
++ }
+ }
+
+ /* Check a user supplied version number, called from both read and write
+- * functions that create a png_struct
++ * functions that create a png_struct.
+ */
+ int
+-png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver)
++png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
+ {
+- if (user_png_ver)
++ /* Libpng versions 1.0.0 and later are binary compatible if the version
++ * string matches through the second '.'; we must recompile any
++ * applications that use any older library version.
++ */
++
++ if (user_png_ver != NULL)
+ {
+- int i = 0;
++ int i = -1;
++ int found_dots = 0;
+
+ do
+ {
+- if (user_png_ver[i] != png_libpng_ver[i])
++ i++;
++ if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+- } while (png_libpng_ver[i++]);
++ if (user_png_ver[i] == '.')
++ found_dots++;
++ } while (found_dots < 2 && user_png_ver[i] != 0 &&
++ PNG_LIBPNG_VER_STRING[i] != 0);
+ }
+
+ else
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+
+- if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
++ if ((png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) != 0)
+ {
+- /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
+- * we must recompile any applications that use any older library version.
+- * For versions after libpng 1.0, we will be compatible, so we need
+- * only check the first digit.
+- */
+- if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
+- (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
+- (user_png_ver[0] == '0' && user_png_ver[2] < '9'))
+- {
+ #ifdef PNG_WARNINGS_SUPPORTED
+- size_t pos = 0;
+- char m[128];
+-
+- pos = png_safecat(m, sizeof m, pos, "Application built with libpng-");
+- pos = png_safecat(m, sizeof m, pos, user_png_ver);
+- pos = png_safecat(m, sizeof m, pos, " but running with ");
+- pos = png_safecat(m, sizeof m, pos, png_libpng_ver);
+-
+- png_warning(png_ptr, m);
++ size_t pos = 0;
++ char m[128];
++
++ pos = png_safecat(m, (sizeof m), pos,
++ "Application built with libpng-");
++ pos = png_safecat(m, (sizeof m), pos, user_png_ver);
++ pos = png_safecat(m, (sizeof m), pos, " but running with ");
++ pos = png_safecat(m, (sizeof m), pos, PNG_LIBPNG_VER_STRING);
++ PNG_UNUSED(pos)
++
++ png_warning(png_ptr, m);
+ #endif
+
+ #ifdef PNG_ERROR_NUMBERS_SUPPORTED
+- png_ptr->flags = 0;
++ png_ptr->flags = 0;
+ #endif
+
+- return 0;
+- }
++ return 0;
+ }
+
+ /* Success return. */
+ return 1;
+ }
+
+-/* Allocate the memory for an info_struct for the application. We don't
+- * really need the png_ptr, but it could potentially be useful in the
+- * future. This should be used in favour of malloc(png_sizeof(png_info))
+- * and png_info_init() so that applications that want to use a shared
+- * libpng don't have to be recompiled if png_info changes size.
++/* Generic function to create a png_struct for either read or write - this
++ * contains the common initialization.
+ */
++PNG_FUNCTION(png_structp /* PRIVATE */,
++png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
++ png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
++ png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
++{
++ png_struct create_struct;
++# ifdef PNG_SETJMP_SUPPORTED
++ jmp_buf create_jmp_buf;
++# endif
++
++ /* This temporary stack-allocated structure is used to provide a place to
++ * build enough context to allow the user provided memory allocator (if any)
++ * to be called.
++ */
++ memset(&create_struct, 0, (sizeof create_struct));
++
++ /* Added at libpng-1.2.6 */
++# ifdef PNG_USER_LIMITS_SUPPORTED
++ create_struct.user_width_max = PNG_USER_WIDTH_MAX;
++ create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
++
++# ifdef PNG_USER_CHUNK_CACHE_MAX
++ /* Added at libpng-1.2.43 and 1.4.0 */
++ create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
++# endif
++
++# ifdef PNG_USER_CHUNK_MALLOC_MAX
++ /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
++ * in png_struct regardless.
++ */
++ create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
++# endif
++# endif
++
++ /* The following two API calls simply set fields in png_struct, so it is safe
++ * to do them now even though error handling is not yet set up.
++ */
++# ifdef PNG_USER_MEM_SUPPORTED
++ png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
++# else
++ PNG_UNUSED(mem_ptr)
++ PNG_UNUSED(malloc_fn)
++ PNG_UNUSED(free_fn)
++# endif
++
++ /* (*error_fn) can return control to the caller after the error_ptr is set,
++ * this will result in a memory leak unless the error_fn does something
++ * extremely sophisticated. The design lacks merit but is implicit in the
++ * API.
++ */
++ png_set_error_fn(&create_struct, error_ptr, error_fn, warn_fn);
++
++# ifdef PNG_SETJMP_SUPPORTED
++ if (!setjmp(create_jmp_buf))
++ {
++ /* Temporarily fake out the longjmp information until we have
++ * successfully completed this function. This only works if we have
++ * setjmp() support compiled in, but it is safe - this stuff should
++ * never happen.
++ */
++ create_struct.jmp_buf_ptr = &create_jmp_buf;
++ create_struct.jmp_buf_size = 0; /*stack allocation*/
++ create_struct.longjmp_fn = longjmp;
++# else
++ {
++# endif
++ /* Call the general version checker (shared with read and write code):
++ */
++ if (png_user_version_check(&create_struct, user_png_ver) != 0)
++ {
++ png_structrp png_ptr = png_voidcast(png_structrp,
++ png_malloc_warn(&create_struct, (sizeof *png_ptr)));
++
++ if (png_ptr != NULL)
++ {
++ /* png_ptr->zstream holds a back-pointer to the png_struct, so
++ * this can only be done now:
++ */
++ create_struct.zstream.zalloc = png_zalloc;
++ create_struct.zstream.zfree = png_zfree;
++ create_struct.zstream.opaque = png_ptr;
++
++# ifdef PNG_SETJMP_SUPPORTED
++ /* Eliminate the local error handling: */
++ create_struct.jmp_buf_ptr = NULL;
++ create_struct.jmp_buf_size = 0;
++ create_struct.longjmp_fn = 0;
++# endif
++
++ *png_ptr = create_struct;
++
++ /* This is the successful return point */
++ return png_ptr;
++ }
++ }
++ }
++
++ /* A longjmp because of a bug in the application storage allocator or a
++ * simple failure to allocate the png_struct.
++ */
++ return NULL;
++}
++
++/* Allocate the memory for an info_struct for the application. */
+ PNG_FUNCTION(png_infop,PNGAPI
+-png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED)
++png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED)
+ {
+- png_infop info_ptr;
++ png_inforp info_ptr;
+
+ png_debug(1, "in png_create_info_struct");
+
+ if (png_ptr == NULL)
+- return (NULL);
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
+- png_ptr->malloc_fn, png_ptr->mem_ptr);
+-#else
+- info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
+-#endif
++ return NULL;
++
++ /* Use the internal API that does not (or at least should not) error out, so
++ * that this call always returns ok. The application typically sets up the
++ * error handling *after* creating the info_struct because this is the way it
++ * has always been done in 'example.c'.
++ */
++ info_ptr = png_voidcast(png_inforp, png_malloc_base(png_ptr,
++ (sizeof *info_ptr)));
++
+ if (info_ptr != NULL)
+- png_info_init_3(&info_ptr, png_sizeof(png_info));
+-
+- return (info_ptr);
++ memset(info_ptr, 0, (sizeof *info_ptr));
++
++ return info_ptr;
+ }
+
+ /* This function frees the memory associated with a single info struct.
+ * Normally, one would use either png_destroy_read_struct() or
+ * png_destroy_write_struct() to free an info struct, but this may be
+- * useful for some applications.
++ * useful for some applications. From libpng 1.6.0 this function is also used
++ * internally to implement the png_info release part of the 'struct' destroy
++ * APIs. This ensures that all possible approaches free the same data (all of
++ * it).
+ */
+ void PNGAPI
+-png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
++png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
+ {
+- png_infop info_ptr = NULL;
++ png_inforp info_ptr = NULL;
+
+ png_debug(1, "in png_destroy_info_struct");
+
+@@ -268,46 +398,57 @@
+
+ if (info_ptr != NULL)
+ {
+- png_info_destroy(png_ptr, info_ptr);
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn,
+- png_ptr->mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)info_ptr);
+-#endif
++ /* Do this first in case of an error below; if the app implements its own
++ * memory management this can lead to png_free calling png_error, which
++ * will abort this routine and return control to the app error handler.
++ * An infinite loop may result if it then tries to free the same info
++ * ptr.
++ */
+ *info_ptr_ptr = NULL;
++
++ png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
++ memset(info_ptr, 0, (sizeof *info_ptr));
++ png_free(png_ptr, info_ptr);
+ }
+ }
+
+ /* Initialize the info structure. This is now an internal function (0.89)
+ * and applications using it are urged to use png_create_info_struct()
+- * instead.
++ * instead. Use deprecated in 1.6.0, internal use removed (used internally it
++ * is just a memset).
++ *
++ * NOTE: it is almost inconceivable that this API is used because it bypasses
++ * the user-memory mechanism and the user error handling/warning mechanisms in
++ * those cases where it does anything other than a memset.
+ */
+-
+-void PNGAPI
+-png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
++PNG_FUNCTION(void,PNGAPI
++png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
++ PNG_DEPRECATED)
+ {
+- png_infop info_ptr = *ptr_ptr;
++ png_inforp info_ptr = *ptr_ptr;
+
+ png_debug(1, "in png_info_init_3");
+
+ if (info_ptr == NULL)
+ return;
+
+- if (png_sizeof(png_info) > png_info_struct_size)
++ if ((sizeof (png_info)) > png_info_struct_size)
+ {
+- png_destroy_struct(info_ptr);
+- info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
++ *ptr_ptr = NULL;
++ /* The following line is why this API should not be used: */
++ free(info_ptr);
++ info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
++ (sizeof *info_ptr)));
+ *ptr_ptr = info_ptr;
+ }
+
+ /* Set everything to 0 */
+- png_memset(info_ptr, 0, png_sizeof(png_info));
++ memset(info_ptr, 0, (sizeof *info_ptr));
+ }
+
++/* The following API is not called internally */
+ void PNGAPI
+-png_data_freer(png_structp png_ptr, png_infop info_ptr,
++png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
+ int freer, png_uint_32 mask)
+ {
+ png_debug(1, "in png_data_freer");
+@@ -322,12 +463,11 @@
+ info_ptr->free_me &= ~mask;
+
+ else
+- png_warning(png_ptr,
+- "Unknown freer parameter in png_data_freer");
++ png_error(png_ptr, "Unknown freer parameter in png_data_freer");
+ }
+
+ void PNGAPI
+-png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
++png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
+ int num)
+ {
+ png_debug(1, "in png_free_data");
+@@ -337,32 +477,32 @@
+
+ #ifdef PNG_TEXT_SUPPORTED
+ /* Free text item num or (if num == -1) all text items */
+- if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
++ if (info_ptr->text != 0 &&
++ ((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
+ {
+ if (num != -1)
+ {
+- if (info_ptr->text && info_ptr->text[num].key)
+- {
+- png_free(png_ptr, info_ptr->text[num].key);
+- info_ptr->text[num].key = NULL;
+- }
++ png_free(png_ptr, info_ptr->text[num].key);
++ info_ptr->text[num].key = NULL;
+ }
+
+ else
+ {
+ int i;
++
+ for (i = 0; i < info_ptr->num_text; i++)
+- png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
++ png_free(png_ptr, info_ptr->text[i].key);
++
+ png_free(png_ptr, info_ptr->text);
+ info_ptr->text = NULL;
+- info_ptr->num_text=0;
++ info_ptr->num_text = 0;
+ }
+ }
+ #endif
+
+ #ifdef PNG_tRNS_SUPPORTED
+ /* Free any tRNS entry */
+- if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
++ if (((mask & PNG_FREE_TRNS) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->trans_alpha);
+ info_ptr->trans_alpha = NULL;
+@@ -372,7 +512,7 @@
+
+ #ifdef PNG_sCAL_SUPPORTED
+ /* Free any sCAL entry */
+- if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
++ if (((mask & PNG_FREE_SCAL) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->scal_s_width);
+ png_free(png_ptr, info_ptr->scal_s_height);
+@@ -384,20 +524,20 @@
+
+ #ifdef PNG_pCAL_SUPPORTED
+ /* Free any pCAL entry */
+- if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
++ if (((mask & PNG_FREE_PCAL) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->pcal_purpose);
+ png_free(png_ptr, info_ptr->pcal_units);
+ info_ptr->pcal_purpose = NULL;
+ info_ptr->pcal_units = NULL;
++
+ if (info_ptr->pcal_params != NULL)
+ {
+ int i;
+- for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
+- {
++
++ for (i = 0; i < info_ptr->pcal_nparams; i++)
+ png_free(png_ptr, info_ptr->pcal_params[i]);
+- info_ptr->pcal_params[i] = NULL;
+- }
++
+ png_free(png_ptr, info_ptr->pcal_params);
+ info_ptr->pcal_params = NULL;
+ }
+@@ -406,8 +546,8 @@
+ #endif
+
+ #ifdef PNG_iCCP_SUPPORTED
+- /* Free any iCCP entry */
+- if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
++ /* Free any profile entry */
++ if (((mask & PNG_FREE_ICCP) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->iccp_name);
+ png_free(png_ptr, info_ptr->iccp_profile);
+@@ -419,26 +559,28 @@
+
+ #ifdef PNG_sPLT_SUPPORTED
+ /* Free a given sPLT entry, or (if num == -1) all sPLT entries */
+- if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
++ if (info_ptr->splt_palettes != 0 &&
++ ((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
+ {
+ if (num != -1)
+ {
+- if (info_ptr->splt_palettes)
+- {
+- png_free(png_ptr, info_ptr->splt_palettes[num].name);
+- png_free(png_ptr, info_ptr->splt_palettes[num].entries);
+- info_ptr->splt_palettes[num].name = NULL;
+- info_ptr->splt_palettes[num].entries = NULL;
+- }
++ png_free(png_ptr, info_ptr->splt_palettes[num].name);
++ png_free(png_ptr, info_ptr->splt_palettes[num].entries);
++ info_ptr->splt_palettes[num].name = NULL;
++ info_ptr->splt_palettes[num].entries = NULL;
+ }
+
+ else
+ {
+- if (info_ptr->splt_palettes_num)
++ if (info_ptr->splt_palettes_num != 0)
+ {
+ int i;
+- for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
+- png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);
++
++ for (i = 0; i < info_ptr->splt_palettes_num; i++)
++ {
++ png_free(png_ptr, info_ptr->splt_palettes[i].name);
++ png_free(png_ptr, info_ptr->splt_palettes[i].entries);
++ }
+
+ png_free(png_ptr, info_ptr->splt_palettes);
+ info_ptr->splt_palettes = NULL;
+@@ -449,32 +591,24 @@
+ }
+ #endif
+
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+- if (png_ptr->unknown_chunk.data)
+- {
+- png_free(png_ptr, png_ptr->unknown_chunk.data);
+- png_ptr->unknown_chunk.data = NULL;
+- }
+-
+- if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++ if (info_ptr->unknown_chunks != 0 &&
++ ((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
+ {
+ if (num != -1)
+ {
+- if (info_ptr->unknown_chunks)
+- {
+- png_free(png_ptr, info_ptr->unknown_chunks[num].data);
+- info_ptr->unknown_chunks[num].data = NULL;
+- }
++ png_free(png_ptr, info_ptr->unknown_chunks[num].data);
++ info_ptr->unknown_chunks[num].data = NULL;
+ }
+
+ else
+ {
+ int i;
+
+- if (info_ptr->unknown_chunks_num)
++ if (info_ptr->unknown_chunks_num != 0)
+ {
+ for (i = 0; i < info_ptr->unknown_chunks_num; i++)
+- png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
++ png_free(png_ptr, info_ptr->unknown_chunks[i].data);
+
+ png_free(png_ptr, info_ptr->unknown_chunks);
+ info_ptr->unknown_chunks = NULL;
+@@ -486,7 +620,7 @@
+
+ #ifdef PNG_hIST_SUPPORTED
+ /* Free any hIST entry */
+- if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
++ if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
+ {
+ png_free(png_ptr, info_ptr->hist);
+ info_ptr->hist = NULL;
+@@ -495,9 +629,9 @@
+ #endif
+
+ /* Free any PLTE entry that was internally allocated */
+- if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
++ if (((mask & PNG_FREE_PLTE) & info_ptr->free_me) != 0)
+ {
+- png_zfree(png_ptr, info_ptr->palette);
++ png_free(png_ptr, info_ptr->palette);
+ info_ptr->palette = NULL;
+ info_ptr->valid &= ~PNG_INFO_PLTE;
+ info_ptr->num_palette = 0;
+@@ -505,16 +639,14 @@
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ /* Free any image bits attached to the info structure */
+- if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
++ if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
+ {
+- if (info_ptr->row_pointers)
++ if (info_ptr->row_pointers != 0)
+ {
+- int row;
+- for (row = 0; row < (int)info_ptr->height; row++)
+- {
++ png_uint_32 row;
++ for (row = 0; row < info_ptr->height; row++)
+ png_free(png_ptr, info_ptr->row_pointers[row]);
+- info_ptr->row_pointers[row] = NULL;
+- }
++
+ png_free(png_ptr, info_ptr->row_pointers);
+ info_ptr->row_pointers = NULL;
+ }
+@@ -527,37 +659,14 @@
+
+ info_ptr->free_me &= ~mask;
+ }
+-
+-/* This is an internal routine to free any memory that the info struct is
+- * pointing to before re-using it or freeing the struct itself. Recall
+- * that png_free() checks for NULL pointers for us.
+- */
+-void /* PRIVATE */
+-png_info_destroy(png_structp png_ptr, png_infop info_ptr)
+-{
+- png_debug(1, "in png_info_destroy");
+-
+- png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
+-
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- if (png_ptr->num_chunk_list)
+- {
+- png_free(png_ptr, png_ptr->chunk_list);
+- png_ptr->chunk_list = NULL;
+- png_ptr->num_chunk_list = 0;
+- }
+-#endif
+-
+- png_info_init_3(&info_ptr, png_sizeof(png_info));
+-}
+-#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
++#endif /* READ || WRITE */
+
+ /* This function returns a pointer to the io_ptr associated with the user
+ * functions. The application should free any memory associated with this
+ * pointer before png_write_destroy() or png_read_destroy() are called.
+ */
+ png_voidp PNGAPI
+-png_get_io_ptr(png_structp png_ptr)
++png_get_io_ptr(png_const_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+ return (NULL);
+@@ -570,11 +679,11 @@
+ /* Initialize the default input/output functions for the PNG file. If you
+ * use your own read or write routines, you can call either png_set_read_fn()
+ * or png_set_write_fn() instead of png_init_io(). If you have defined
+- * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't
+- * necessarily available.
++ * PNG_NO_STDIO or otherwise disabled PNG_STDIO_SUPPORTED, you must use a
++ * function of your own because "FILE *" isn't necessarily available.
+ */
+ void PNGAPI
+-png_init_io(png_structp png_ptr, png_FILE_p fp)
++png_init_io(png_structrp png_ptr, png_FILE_p fp)
+ {
+ png_debug(1, "in png_init_io");
+
+@@ -585,44 +694,64 @@
+ }
+ # endif
+
++#ifdef PNG_SAVE_INT_32_SUPPORTED
++/* The png_save_int_32 function assumes integers are stored in two's
++ * complement format. If this isn't the case, then this routine needs to
++ * be modified to write data in two's complement format. Note that,
++ * the following works correctly even if png_int_32 has more than 32 bits
++ * (compare the more complex code required on read for sign extension.)
++ */
++void PNGAPI
++png_save_int_32(png_bytep buf, png_int_32 i)
++{
++ buf[0] = (png_byte)((i >> 24) & 0xff);
++ buf[1] = (png_byte)((i >> 16) & 0xff);
++ buf[2] = (png_byte)((i >> 8) & 0xff);
++ buf[3] = (png_byte)(i & 0xff);
++}
++#endif
++
+ # ifdef PNG_TIME_RFC1123_SUPPORTED
+ /* Convert the supplied time into an RFC 1123 string suitable for use in
+ * a "Creation Time" or other text-based time string.
+ */
+-png_const_charp PNGAPI
+-png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
++int PNGAPI
++png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
+ {
+ static PNG_CONST char short_months[12][4] =
+ {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+
+- if (png_ptr == NULL)
+- return (NULL);
++ if (out == NULL)
++ return 0;
++
++ if (ptime->year > 9999 /* RFC1123 limitation */ ||
++ ptime->month == 0 || ptime->month > 12 ||
++ ptime->day == 0 || ptime->day > 31 ||
++ ptime->hour > 23 || ptime->minute > 59 ||
++ ptime->second > 60)
++ return 0;
+
+ {
+ size_t pos = 0;
+- char number_buf[5]; /* enough for a four digit year */
+-
+-# define APPEND_STRING(string)\
+- pos = png_safecat(png_ptr->time_buffer, sizeof png_ptr->time_buffer,\
+- pos, (string))
++ char number_buf[5]; /* enough for a four-digit year */
++
++# define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
+ # define APPEND_NUMBER(format, value)\
+ APPEND_STRING(PNG_FORMAT_NUMBER(number_buf, format, (value)))
+-# define APPEND(ch)\
+- if (pos < (sizeof png_ptr->time_buffer)-1)\
+- png_ptr->time_buffer[pos++] = (ch)
+-
+- APPEND_NUMBER(PNG_NUMBER_FORMAT_u, (unsigned)ptime->day % 32);
++# define APPEND(ch) if (pos < 28) out[pos++] = (ch)
++
++ APPEND_NUMBER(PNG_NUMBER_FORMAT_u, (unsigned)ptime->day);
+ APPEND(' ');
+- APPEND_STRING(short_months[(ptime->month - 1) % 12]);
++ APPEND_STRING(short_months[(ptime->month - 1)]);
+ APPEND(' ');
+ APPEND_NUMBER(PNG_NUMBER_FORMAT_u, ptime->year);
+ APPEND(' ');
+- APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->hour % 24);
++ APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->hour);
+ APPEND(':');
+- APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->minute % 60);
++ APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->minute);
+ APPEND(':');
+- APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second % 61);
++ APPEND_NUMBER(PNG_NUMBER_FORMAT_02u, (unsigned)ptime->second);
+ APPEND_STRING(" +0000"); /* This reliably terminates the buffer */
+
+ # undef APPEND
+@@ -630,14 +759,37 @@
+ # undef APPEND_STRING
+ }
+
+- return png_ptr->time_buffer;
++ return 1;
+ }
+-# endif /* PNG_TIME_RFC1123_SUPPORTED */
+-
+-#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
+-
++
++# if PNG_LIBPNG_VER < 10700
++/* To do: remove the following from libpng-1.7 */
++/* Original API that uses a private buffer in png_struct.
++ * Deprecated because it causes png_struct to carry a spurious temporary
++ * buffer (png_struct::time_buffer), better to have the caller pass this in.
++ */
+ png_const_charp PNGAPI
+-png_get_copyright(png_const_structp png_ptr)
++png_convert_to_rfc1123(png_structrp png_ptr, png_const_timep ptime)
++{
++ if (png_ptr != NULL)
++ {
++ /* The only failure above if png_ptr != NULL is from an invalid ptime */
++ if (png_convert_to_rfc1123_buffer(png_ptr->time_buffer, ptime) == 0)
++ png_warning(png_ptr, "Ignoring invalid time value");
++
++ else
++ return png_ptr->time_buffer;
++ }
++
++ return NULL;
++}
++# endif
++# endif /* TIME_RFC1123 */
++
++#endif /* READ || WRITE */
++
++png_const_charp PNGAPI
++png_get_copyright(png_const_structrp png_ptr)
+ {
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
+ #ifdef PNG_STRING_COPYRIGHT
+@@ -645,14 +797,14 @@
+ #else
+ # ifdef __STDC__
+ return PNG_STRING_NEWLINE \
+- "libpng version 1.5.4 - July 7, 2011" PNG_STRING_NEWLINE \
+- "Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
++ "libpng version 1.6.16 - December 22, 2014" PNG_STRING_NEWLINE \
++ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
+ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
+ PNG_STRING_NEWLINE;
+ # else
+- return "libpng version 1.5.4 - July 7, 2011\
+- Copyright (c) 1998-2011 Glenn Randers-Pehrson\
++ return "libpng version 1.6.16 - December 22, 2014\
++ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
+ Copyright (c) 1996-1997 Andreas Dilger\
+ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
+ # endif
+@@ -668,14 +820,14 @@
+ * it is guaranteed that png.c uses the correct version of png.h.
+ */
+ png_const_charp PNGAPI
+-png_get_libpng_ver(png_const_structp png_ptr)
++png_get_libpng_ver(png_const_structrp png_ptr)
+ {
+ /* Version of *.c files used when building libpng */
+ return png_get_header_ver(png_ptr);
+ }
+
+ png_const_charp PNGAPI
+-png_get_header_ver(png_const_structp png_ptr)
++png_get_header_ver(png_const_structrp png_ptr)
+ {
+ /* Version of *.h files used when building libpng */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
+@@ -683,7 +835,7 @@
+ }
+
+ png_const_charp PNGAPI
+-png_get_header_version(png_const_structp png_ptr)
++png_get_header_version(png_const_structrp png_ptr)
+ {
+ /* Returns longer string containing both version and date */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
+@@ -698,37 +850,122 @@
+ #endif
+ }
+
+-#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+-# ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
++/* NOTE: this routine is not used internally! */
++/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
++ * large of png_color. This lets grayscale images be treated as
++ * paletted. Most useful for gamma correction and simplification
++ * of code. This API is not used internally.
++ */
++void PNGAPI
++png_build_grayscale_palette(int bit_depth, png_colorp palette)
++{
++ int num_palette;
++ int color_inc;
++ int i;
++ int v;
++
++ png_debug(1, "in png_do_build_grayscale_palette");
++
++ if (palette == NULL)
++ return;
++
++ switch (bit_depth)
++ {
++ case 1:
++ num_palette = 2;
++ color_inc = 0xff;
++ break;
++
++ case 2:
++ num_palette = 4;
++ color_inc = 0x55;
++ break;
++
++ case 4:
++ num_palette = 16;
++ color_inc = 0x11;
++ break;
++
++ case 8:
++ num_palette = 256;
++ color_inc = 1;
++ break;
++
++ default:
++ num_palette = 0;
++ color_inc = 0;
++ break;
++ }
++
++ for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
++ {
++ palette[i].red = (png_byte)v;
++ palette[i].green = (png_byte)v;
++ palette[i].blue = (png_byte)v;
++ }
++}
++#endif
++
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+ int PNGAPI
+-png_handle_as_unknown(png_structp png_ptr, png_const_bytep chunk_name)
++png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
+ {
+ /* Check chunk_name and return "keep" value if it's on the list, else 0 */
+- int i;
+- png_bytep p;
+- if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list<=0)
+- return 0;
+-
+- p = png_ptr->chunk_list + png_ptr->num_chunk_list*5 - 5;
+- for (i = png_ptr->num_chunk_list; i; i--, p -= 5)
+- if (!png_memcmp(chunk_name, p, 4))
+- return ((int)*(p + 4));
+- return 0;
++ png_const_bytep p, p_end;
++
++ if (png_ptr == NULL || chunk_name == NULL || png_ptr->num_chunk_list == 0)
++ return PNG_HANDLE_CHUNK_AS_DEFAULT;
++
++ p_end = png_ptr->chunk_list;
++ p = p_end + png_ptr->num_chunk_list*5; /* beyond end */
++
++ /* The code is the fifth byte after each four byte string. Historically this
++ * code was always searched from the end of the list, this is no longer
++ * necessary because the 'set' routine handles duplicate entries correcty.
++ */
++ do /* num_chunk_list > 0, so at least one */
++ {
++ p -= 5;
++
++ if (memcmp(chunk_name, p, 4) == 0)
++ return p[4];
++ }
++ while (p > p_end);
++
++ /* This means that known chunks should be processed and unknown chunks should
++ * be handled according to the value of png_ptr->unknown_default; this can be
++ * confusing because, as a result, there are two levels of defaulting for
++ * unknown chunks.
++ */
++ return PNG_HANDLE_CHUNK_AS_DEFAULT;
+ }
+-# endif
+-#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
++
++#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
++ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
++int /* PRIVATE */
++png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
++{
++ png_byte chunk_string[5];
++
++ PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name);
++ return png_handle_as_unknown(png_ptr, chunk_string);
++}
++#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
++#endif /* SET_UNKNOWN_CHUNKS */
+
+ #ifdef PNG_READ_SUPPORTED
+ /* This function, added to libpng-1.0.6g, is untested. */
+ int PNGAPI
+-png_reset_zstream(png_structp png_ptr)
++png_reset_zstream(png_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+ return Z_STREAM_ERROR;
+
++ /* WARNING: this resets the window bits to the maximum! */
+ return (inflateReset(&png_ptr->zstream));
+ }
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* READ */
+
+ /* This function was added to libpng-1.0.7 */
+ png_uint_32 PNGAPI
+@@ -741,93 +978,1530 @@
+
+
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+-# ifdef PNG_SIZE_T
+-/* Added at libpng version 1.2.6 */
+- PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
+-png_size_t PNGAPI
+-png_convert_size(size_t size)
++/* Ensure that png_ptr->zstream.msg holds some appropriate error message string.
++ * If it doesn't 'ret' is used to set it to something appropriate, even in cases
++ * like Z_OK or Z_STREAM_END where the error code is apparently a success code.
++ */
++void /* PRIVATE */
++png_zstream_error(png_structrp png_ptr, int ret)
+ {
+- if (size > (png_size_t)-1)
+- PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */
+-
+- return ((png_size_t)size);
++ /* Translate 'ret' into an appropriate error string, priority is given to the
++ * one in zstream if set. This always returns a string, even in cases like
++ * Z_OK or Z_STREAM_END where the error code is a success code.
++ */
++ if (png_ptr->zstream.msg == NULL) switch (ret)
++ {
++ default:
++ case Z_OK:
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return code");
++ break;
++
++ case Z_STREAM_END:
++ /* Normal exit */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected end of LZ stream");
++ break;
++
++ case Z_NEED_DICT:
++ /* This means the deflate stream did not have a dictionary; this
++ * indicates a bogus PNG.
++ */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("missing LZ dictionary");
++ break;
++
++ case Z_ERRNO:
++ /* gz APIs only: should not happen */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("zlib IO error");
++ break;
++
++ case Z_STREAM_ERROR:
++ /* internal libpng error */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("bad parameters to zlib");
++ break;
++
++ case Z_DATA_ERROR:
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("damaged LZ stream");
++ break;
++
++ case Z_MEM_ERROR:
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("insufficient memory");
++ break;
++
++ case Z_BUF_ERROR:
++ /* End of input or output; not a problem if the caller is doing
++ * incremental read or write.
++ */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("truncated");
++ break;
++
++ case Z_VERSION_ERROR:
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("unsupported zlib version");
++ break;
++
++ case PNG_UNEXPECTED_ZLIB_RETURN:
++ /* Compile errors here mean that zlib now uses the value co-opted in
++ * pngpriv.h for PNG_UNEXPECTED_ZLIB_RETURN; update the switch above
++ * and change pngpriv.h. Note that this message is "... return",
++ * whereas the default/Z_OK one is "... return code".
++ */
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("unexpected zlib return");
++ break;
++ }
+ }
+-# endif /* PNG_SIZE_T */
++
++/* png_convert_size: a PNGAPI but no longer in png.h, so deleted
++ * at libpng 1.5.5!
++ */
+
+ /* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
+-# ifdef PNG_CHECK_cHRM_SUPPORTED
++#ifdef PNG_GAMMA_SUPPORTED /* always set if COLORSPACE */
++static int
++png_colorspace_check_gamma(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_fixed_point gAMA, int from)
++ /* This is called to check a new gamma value against an existing one. The
++ * routine returns false if the new gamma value should not be written.
++ *
++ * 'from' says where the new gamma value comes from:
++ *
++ * 0: the new gamma value is the libpng estimate for an ICC profile
++ * 1: the new gamma value comes from a gAMA chunk
++ * 2: the new gamma value comes from an sRGB chunk
++ */
++{
++ png_fixed_point gtest;
++
++ if ((colorspace->flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
++ (png_muldiv(&gtest, colorspace->gamma, PNG_FP_1, gAMA) == 0 ||
++ png_gamma_significant(gtest) != 0))
++ {
++ /* Either this is an sRGB image, in which case the calculated gamma
++ * approximation should match, or this is an image with a profile and the
++ * value libpng calculates for the gamma of the profile does not match the
++ * value recorded in the file. The former, sRGB, case is an error, the
++ * latter is just a warning.
++ */
++ if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0 || from == 2)
++ {
++ png_chunk_report(png_ptr, "gamma value does not match sRGB",
++ PNG_CHUNK_ERROR);
++ /* Do not overwrite an sRGB value */
++ return from == 2;
++ }
++
++ else /* sRGB tag not involved */
++ {
++ png_chunk_report(png_ptr, "gamma value does not match libpng estimate",
++ PNG_CHUNK_WARNING);
++ return from == 1;
++ }
++ }
++
++ return 1;
++}
++
++void /* PRIVATE */
++png_colorspace_set_gamma(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_fixed_point gAMA)
++{
++ /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
++ * occur. Since the fixed point representation is asymetrical it is
++ * possible for 1/gamma to overflow the limit of 21474 and this means the
++ * gamma value must be at least 5/100000 and hence at most 20000.0. For
++ * safety the limits here are a little narrower. The values are 0.00016 to
++ * 6250.0, which are truly ridiculous gamma values (and will produce
++ * displays that are all black or all white.)
++ *
++ * In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk
++ * handling code, which only required the value to be >0.
++ */
++ png_const_charp errmsg;
++
++ if (gAMA < 16 || gAMA > 625000000)
++ errmsg = "gamma value out of range";
++
++# ifdef PNG_READ_gAMA_SUPPORTED
++ /* Allow the application to set the gamma value more than once */
++ else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
++ (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
++ errmsg = "duplicate";
++# endif
++
++ /* Do nothing if the colorspace is already invalid */
++ else if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
++ return;
++
++ else
++ {
++ if (png_colorspace_check_gamma(png_ptr, colorspace, gAMA,
++ 1/*from gAMA*/) != 0)
++ {
++ /* Store this gamma value. */
++ colorspace->gamma = gAMA;
++ colorspace->flags |=
++ (PNG_COLORSPACE_HAVE_GAMMA | PNG_COLORSPACE_FROM_gAMA);
++ }
++
++ /* At present if the check_gamma test fails the gamma of the colorspace is
++ * not updated however the colorspace is not invalidated. This
++ * corresponds to the case where the existing gamma comes from an sRGB
++ * chunk or profile. An error message has already been output.
++ */
++ return;
++ }
++
++ /* Error exit - errmsg has been set. */
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_chunk_report(png_ptr, errmsg, PNG_CHUNK_WRITE_ERROR);
++}
++
++void /* PRIVATE */
++png_colorspace_sync_info(png_const_structrp png_ptr, png_inforp info_ptr)
++{
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
++ {
++ /* Everything is invalid */
++ info_ptr->valid &= ~(PNG_INFO_gAMA|PNG_INFO_cHRM|PNG_INFO_sRGB|
++ PNG_INFO_iCCP);
++
++# ifdef PNG_COLORSPACE_SUPPORTED
++ /* Clean up the iCCP profile now if it won't be used. */
++ png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
++# else
++ PNG_UNUSED(png_ptr)
++# endif
++ }
++
++ else
++ {
++# ifdef PNG_COLORSPACE_SUPPORTED
++ /* Leave the INFO_iCCP flag set if the pngset.c code has already set
++ * it; this allows a PNG to contain a profile which matches sRGB and
++ * yet still have that profile retrievable by the application.
++ */
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
++ info_ptr->valid |= PNG_INFO_sRGB;
++
++ else
++ info_ptr->valid &= ~PNG_INFO_sRGB;
++
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
++ info_ptr->valid |= PNG_INFO_cHRM;
++
++ else
++ info_ptr->valid &= ~PNG_INFO_cHRM;
++# endif
++
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
++ info_ptr->valid |= PNG_INFO_gAMA;
++
++ else
++ info_ptr->valid &= ~PNG_INFO_gAMA;
++ }
++}
++
++#ifdef PNG_READ_SUPPORTED
++void /* PRIVATE */
++png_colorspace_sync(png_const_structrp png_ptr, png_inforp info_ptr)
++{
++ if (info_ptr == NULL) /* reduce code size; check here not in the caller */
++ return;
++
++ info_ptr->colorspace = png_ptr->colorspace;
++ png_colorspace_sync_info(png_ptr, info_ptr);
++}
++#endif
++#endif
++
++#ifdef PNG_COLORSPACE_SUPPORTED
++/* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for
++ * cHRM, as opposed to using chromaticities. These internal APIs return
++ * non-zero on a parameter error. The X, Y and Z values are required to be
++ * positive and less than 1.0.
++ */
++static int
++png_xy_from_XYZ(png_xy *xy, const png_XYZ *XYZ)
++{
++ png_int_32 d, dwhite, whiteX, whiteY;
++
++ d = XYZ->red_X + XYZ->red_Y + XYZ->red_Z;
++ if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, d) == 0)
++ return 1;
++ if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, d) == 0)
++ return 1;
++ dwhite = d;
++ whiteX = XYZ->red_X;
++ whiteY = XYZ->red_Y;
++
++ d = XYZ->green_X + XYZ->green_Y + XYZ->green_Z;
++ if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, d) == 0)
++ return 1;
++ if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, d) == 0)
++ return 1;
++ dwhite += d;
++ whiteX += XYZ->green_X;
++ whiteY += XYZ->green_Y;
++
++ d = XYZ->blue_X + XYZ->blue_Y + XYZ->blue_Z;
++ if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, d) == 0)
++ return 1;
++ if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, d) == 0)
++ return 1;
++ dwhite += d;
++ whiteX += XYZ->blue_X;
++ whiteY += XYZ->blue_Y;
++
++ /* The reference white is simply the sum of the end-point (X,Y,Z) vectors,
++ * thus:
++ */
++ if (png_muldiv(&xy->whitex, whiteX, PNG_FP_1, dwhite) == 0)
++ return 1;
++ if (png_muldiv(&xy->whitey, whiteY, PNG_FP_1, dwhite) == 0)
++ return 1;
++
++ return 0;
++}
++
++static int
++png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
++{
++ png_fixed_point red_inverse, green_inverse, blue_scale;
++ png_fixed_point left, right, denominator;
++
++ /* Check xy and, implicitly, z. Note that wide gamut color spaces typically
++ * have end points with 0 tristimulus values (these are impossible end
++ * points, but they are used to cover the possible colors.)
++ */
++ if (xy->redx < 0 || xy->redx > PNG_FP_1) return 1;
++ if (xy->redy < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
++ if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
++ if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
++ if (xy->bluex < 0 || xy->bluex > PNG_FP_1) return 1;
++ if (xy->bluey < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
++ if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
++ if (xy->whitey < 0 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
++
++ /* The reverse calculation is more difficult because the original tristimulus
++ * value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
++ * derived values were recorded in the cHRM chunk;
++ * (red,green,blue,white)x(x,y). This loses one degree of freedom and
++ * therefore an arbitrary ninth value has to be introduced to undo the
++ * original transformations.
++ *
++ * Think of the original end-points as points in (X,Y,Z) space. The
++ * chromaticity values (c) have the property:
++ *
++ * C
++ * c = ---------
++ * X + Y + Z
++ *
++ * For each c (x,y,z) from the corresponding original C (X,Y,Z). Thus the
++ * three chromaticity values (x,y,z) for each end-point obey the
++ * relationship:
++ *
++ * x + y + z = 1
++ *
++ * This describes the plane in (X,Y,Z) space that intersects each axis at the
++ * value 1.0; call this the chromaticity plane. Thus the chromaticity
++ * calculation has scaled each end-point so that it is on the x+y+z=1 plane
++ * and chromaticity is the intersection of the vector from the origin to the
++ * (X,Y,Z) value with the chromaticity plane.
++ *
++ * To fully invert the chromaticity calculation we would need the three
++ * end-point scale factors, (red-scale, green-scale, blue-scale), but these
++ * were not recorded. Instead we calculated the reference white (X,Y,Z) and
++ * recorded the chromaticity of this. The reference white (X,Y,Z) would have
++ * given all three of the scale factors since:
++ *
++ * color-C = color-c * color-scale
++ * white-C = red-C + green-C + blue-C
++ * = red-c*red-scale + green-c*green-scale + blue-c*blue-scale
++ *
++ * But cHRM records only white-x and white-y, so we have lost the white scale
++ * factor:
++ *
++ * white-C = white-c*white-scale
++ *
++ * To handle this the inverse transformation makes an arbitrary assumption
++ * about white-scale:
++ *
++ * Assume: white-Y = 1.0
++ * Hence: white-scale = 1/white-y
++ * Or: red-Y + green-Y + blue-Y = 1.0
++ *
++ * Notice the last statement of the assumption gives an equation in three of
++ * the nine values we want to calculate. 8 more equations come from the
++ * above routine as summarised at the top above (the chromaticity
++ * calculation):
++ *
++ * Given: color-x = color-X / (color-X + color-Y + color-Z)
++ * Hence: (color-x - 1)*color-X + color.x*color-Y + color.x*color-Z = 0
++ *
++ * This is 9 simultaneous equations in the 9 variables "color-C" and can be
++ * solved by Cramer's rule. Cramer's rule requires calculating 10 9x9 matrix
++ * determinants, however this is not as bad as it seems because only 28 of
++ * the total of 90 terms in the various matrices are non-zero. Nevertheless
++ * Cramer's rule is notoriously numerically unstable because the determinant
++ * calculation involves the difference of large, but similar, numbers. It is
++ * difficult to be sure that the calculation is stable for real world values
++ * and it is certain that it becomes unstable where the end points are close
++ * together.
++ *
++ * So this code uses the perhaps slightly less optimal but more
++ * understandable and totally obvious approach of calculating color-scale.
++ *
++ * This algorithm depends on the precision in white-scale and that is
++ * (1/white-y), so we can immediately see that as white-y approaches 0 the
++ * accuracy inherent in the cHRM chunk drops off substantially.
++ *
++ * libpng arithmetic: a simple inversion of the above equations
++ * ------------------------------------------------------------
++ *
++ * white_scale = 1/white-y
++ * white-X = white-x * white-scale
++ * white-Y = 1.0
++ * white-Z = (1 - white-x - white-y) * white_scale
++ *
++ * white-C = red-C + green-C + blue-C
++ * = red-c*red-scale + green-c*green-scale + blue-c*blue-scale
++ *
++ * This gives us three equations in (red-scale,green-scale,blue-scale) where
++ * all the coefficients are now known:
++ *
++ * red-x*red-scale + green-x*green-scale + blue-x*blue-scale
++ * = white-x/white-y
++ * red-y*red-scale + green-y*green-scale + blue-y*blue-scale = 1
++ * red-z*red-scale + green-z*green-scale + blue-z*blue-scale
++ * = (1 - white-x - white-y)/white-y
++ *
++ * In the last equation color-z is (1 - color-x - color-y) so we can add all
++ * three equations together to get an alternative third:
++ *
++ * red-scale + green-scale + blue-scale = 1/white-y = white-scale
++ *
++ * So now we have a Cramer's rule solution where the determinants are just
++ * 3x3 - far more tractible. Unfortunately 3x3 determinants still involve
++ * multiplication of three coefficients so we can't guarantee to avoid
++ * overflow in the libpng fixed point representation. Using Cramer's rule in
++ * floating point is probably a good choice here, but it's not an option for
++ * fixed point. Instead proceed to simplify the first two equations by
++ * eliminating what is likely to be the largest value, blue-scale:
++ *
++ * blue-scale = white-scale - red-scale - green-scale
++ *
++ * Hence:
++ *
++ * (red-x - blue-x)*red-scale + (green-x - blue-x)*green-scale =
++ * (white-x - blue-x)*white-scale
++ *
++ * (red-y - blue-y)*red-scale + (green-y - blue-y)*green-scale =
++ * 1 - blue-y*white-scale
++ *
++ * And now we can trivially solve for (red-scale,green-scale):
++ *
++ * green-scale =
++ * (white-x - blue-x)*white-scale - (red-x - blue-x)*red-scale
++ * -----------------------------------------------------------
++ * green-x - blue-x
++ *
++ * red-scale =
++ * 1 - blue-y*white-scale - (green-y - blue-y) * green-scale
++ * ---------------------------------------------------------
++ * red-y - blue-y
++ *
++ * Hence:
++ *
++ * red-scale =
++ * ( (green-x - blue-x) * (white-y - blue-y) -
++ * (green-y - blue-y) * (white-x - blue-x) ) / white-y
++ * -------------------------------------------------------------------------
++ * (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
++ *
++ * green-scale =
++ * ( (red-y - blue-y) * (white-x - blue-x) -
++ * (red-x - blue-x) * (white-y - blue-y) ) / white-y
++ * -------------------------------------------------------------------------
++ * (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
++ *
++ * Accuracy:
++ * The input values have 5 decimal digits of accuracy. The values are all in
++ * the range 0 < value < 1, so simple products are in the same range but may
++ * need up to 10 decimal digits to preserve the original precision and avoid
++ * underflow. Because we are using a 32-bit signed representation we cannot
++ * match this; the best is a little over 9 decimal digits, less than 10.
++ *
++ * The approach used here is to preserve the maximum precision within the
++ * signed representation. Because the red-scale calculation above uses the
++ * difference between two products of values that must be in the range -1..+1
++ * it is sufficient to divide the product by 7; ceil(100,000/32767*2). The
++ * factor is irrelevant in the calculation because it is applied to both
++ * numerator and denominator.
++ *
++ * Note that the values of the differences of the products of the
++ * chromaticities in the above equations tend to be small, for example for
++ * the sRGB chromaticities they are:
++ *
++ * red numerator: -0.04751
++ * green numerator: -0.08788
++ * denominator: -0.2241 (without white-y multiplication)
++ *
++ * The resultant Y coefficients from the chromaticities of some widely used
++ * color space definitions are (to 15 decimal places):
++ *
++ * sRGB
++ * 0.212639005871510 0.715168678767756 0.072192315360734
++ * Kodak ProPhoto
++ * 0.288071128229293 0.711843217810102 0.000085653960605
++ * Adobe RGB
++ * 0.297344975250536 0.627363566255466 0.075291458493998
++ * Adobe Wide Gamut RGB
++ * 0.258728243040113 0.724682314948566 0.016589442011321
++ */
++ /* By the argument, above overflow should be impossible here. The return
++ * value of 2 indicates an internal error to the caller.
++ */
++ if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 7) == 0)
++ return 2;
++ if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 7) == 0)
++ return 2;
++ denominator = left - right;
++
++ /* Now find the red numerator. */
++ if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
++ return 2;
++ if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
++ return 2;
++
++ /* Overflow is possible here and it indicates an extreme set of PNG cHRM
++ * chunk values. This calculation actually returns the reciprocal of the
++ * scale value because this allows us to delay the multiplication of white-y
++ * into the denominator, which tends to produce a small number.
++ */
++ if (png_muldiv(&red_inverse, xy->whitey, denominator, left-right) == 0 ||
++ red_inverse <= xy->whitey /* r+g+b scales = white scale */)
++ return 1;
++
++ /* Similarly for green_inverse: */
++ if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
++ return 2;
++ if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
++ return 2;
++ if (png_muldiv(&green_inverse, xy->whitey, denominator, left-right) == 0 ||
++ green_inverse <= xy->whitey)
++ return 1;
++
++ /* And the blue scale, the checks above guarantee this can't overflow but it
++ * can still produce 0 for extreme cHRM values.
++ */
++ blue_scale = png_reciprocal(xy->whitey) - png_reciprocal(red_inverse) -
++ png_reciprocal(green_inverse);
++ if (blue_scale <= 0)
++ return 1;
++
++
++ /* And fill in the png_XYZ: */
++ if (png_muldiv(&XYZ->red_X, xy->redx, PNG_FP_1, red_inverse) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->red_Y, xy->redy, PNG_FP_1, red_inverse) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->red_Z, PNG_FP_1 - xy->redx - xy->redy, PNG_FP_1,
++ red_inverse) == 0)
++ return 1;
++
++ if (png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->green_Z, PNG_FP_1 - xy->greenx - xy->greeny, PNG_FP_1,
++ green_inverse) == 0)
++ return 1;
++
++ if (png_muldiv(&XYZ->blue_X, xy->bluex, blue_scale, PNG_FP_1) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->blue_Y, xy->bluey, blue_scale, PNG_FP_1) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->blue_Z, PNG_FP_1 - xy->bluex - xy->bluey, blue_scale,
++ PNG_FP_1) == 0)
++ return 1;
++
++ return 0; /*success*/
++}
++
++static int
++png_XYZ_normalize(png_XYZ *XYZ)
++{
++ png_int_32 Y;
++
++ if (XYZ->red_Y < 0 || XYZ->green_Y < 0 || XYZ->blue_Y < 0 ||
++ XYZ->red_X < 0 || XYZ->green_X < 0 || XYZ->blue_X < 0 ||
++ XYZ->red_Z < 0 || XYZ->green_Z < 0 || XYZ->blue_Z < 0)
++ return 1;
++
++ /* Normalize by scaling so the sum of the end-point Y values is PNG_FP_1.
++ * IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore
++ * relying on addition of two positive values producing a negative one is not
++ * safe.
++ */
++ Y = XYZ->red_Y;
++ if (0x7fffffff - Y < XYZ->green_X)
++ return 1;
++ Y += XYZ->green_Y;
++ if (0x7fffffff - Y < XYZ->blue_X)
++ return 1;
++ Y += XYZ->blue_Y;
++
++ if (Y != PNG_FP_1)
++ {
++ if (png_muldiv(&XYZ->red_X, XYZ->red_X, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->red_Y, XYZ->red_Y, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->red_Z, XYZ->red_Z, PNG_FP_1, Y) == 0)
++ return 1;
++
++ if (png_muldiv(&XYZ->green_X, XYZ->green_X, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->green_Y, XYZ->green_Y, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->green_Z, XYZ->green_Z, PNG_FP_1, Y) == 0)
++ return 1;
++
++ if (png_muldiv(&XYZ->blue_X, XYZ->blue_X, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->blue_Y, XYZ->blue_Y, PNG_FP_1, Y) == 0)
++ return 1;
++ if (png_muldiv(&XYZ->blue_Z, XYZ->blue_Z, PNG_FP_1, Y) == 0)
++ return 1;
++ }
++
++ return 0;
++}
++
++static int
++png_colorspace_endpoints_match(const png_xy *xy1, const png_xy *xy2, int delta)
++{
++ /* Allow an error of +/-0.01 (absolute value) on each chromaticity */
++ if (PNG_OUT_OF_RANGE(xy1->whitex, xy2->whitex,delta) ||
++ PNG_OUT_OF_RANGE(xy1->whitey, xy2->whitey,delta) ||
++ PNG_OUT_OF_RANGE(xy1->redx, xy2->redx, delta) ||
++ PNG_OUT_OF_RANGE(xy1->redy, xy2->redy, delta) ||
++ PNG_OUT_OF_RANGE(xy1->greenx, xy2->greenx,delta) ||
++ PNG_OUT_OF_RANGE(xy1->greeny, xy2->greeny,delta) ||
++ PNG_OUT_OF_RANGE(xy1->bluex, xy2->bluex, delta) ||
++ PNG_OUT_OF_RANGE(xy1->bluey, xy2->bluey, delta))
++ return 0;
++ return 1;
++}
++
++/* Added in libpng-1.6.0, a different check for the validity of a set of cHRM
++ * chunk chromaticities. Earlier checks used to simply look for the overflow
++ * condition (where the determinant of the matrix to solve for XYZ ends up zero
++ * because the chromaticity values are not all distinct.) Despite this it is
++ * theoretically possible to produce chromaticities that are apparently valid
++ * but that rapidly degrade to invalid, potentially crashing, sets because of
++ * arithmetic inaccuracies when calculations are performed on them. The new
++ * check is to round-trip xy -> XYZ -> xy and then check that the result is
++ * within a small percentage of the original.
++ */
++static int
++png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
++{
++ int result;
++ png_xy xy_test;
++
++ /* As a side-effect this routine also returns the XYZ endpoints. */
++ result = png_XYZ_from_xy(XYZ, xy);
++ if (result != 0)
++ return result;
++
++ result = png_xy_from_XYZ(&xy_test, XYZ);
++ if (result != 0)
++ return result;
++
++ if (png_colorspace_endpoints_match(xy, &xy_test,
++ 5/*actually, the math is pretty accurate*/) != 0)
++ return 0;
++
++ /* Too much slip */
++ return 1;
++}
++
++/* This is the check going the other way. The XYZ is modified to normalize it
++ * (another side-effect) and the xy chromaticities are returned.
++ */
++static int
++png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
++{
++ int result;
++ png_XYZ XYZtemp;
++
++ result = png_XYZ_normalize(XYZ);
++ if (result != 0)
++ return result;
++
++ result = png_xy_from_XYZ(xy, XYZ);
++ if (result != 0)
++ return result;
++
++ XYZtemp = *XYZ;
++ return png_colorspace_check_xy(&XYZtemp, xy);
++}
++
++/* Used to check for an endpoint match against sRGB */
++static const png_xy sRGB_xy = /* From ITU-R BT.709-3 */
++{
++ /* color x y */
++ /* red */ 64000, 33000,
++ /* green */ 30000, 60000,
++ /* blue */ 15000, 6000,
++ /* white */ 31270, 32900
++};
++
++static int
++png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, const png_xy *xy, const png_XYZ *XYZ,
++ int preferred)
++{
++ if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
++ return 0;
++
++ /* The consistency check is performed on the chromaticities; this factors out
++ * variations because of the normalization (or not) of the end point Y
++ * values.
++ */
++ if (preferred < 2 &&
++ (colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
++ {
++ /* The end points must be reasonably close to any we already have. The
++ * following allows an error of up to +/-.001
++ */
++ if (png_colorspace_endpoints_match(xy, &colorspace->end_points_xy,
++ 100) == 0)
++ {
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_benign_error(png_ptr, "inconsistent chromaticities");
++ return 0; /* failed */
++ }
++
++ /* Only overwrite with preferred values */
++ if (preferred == 0)
++ return 1; /* ok, but no change */
++ }
++
++ colorspace->end_points_xy = *xy;
++ colorspace->end_points_XYZ = *XYZ;
++ colorspace->flags |= PNG_COLORSPACE_HAVE_ENDPOINTS;
++
++ /* The end points are normally quoted to two decimal digits, so allow +/-0.01
++ * on this test.
++ */
++ if (png_colorspace_endpoints_match(xy, &sRGB_xy, 1000) != 0)
++ colorspace->flags |= PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB;
++
++ else
++ colorspace->flags &= PNG_COLORSPACE_CANCEL(
++ PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
++
++ return 2; /* ok and changed */
++}
+
+ int /* PRIVATE */
+-png_check_cHRM_fixed(png_structp png_ptr,
+- png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
+- png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
+- png_fixed_point blue_x, png_fixed_point blue_y)
++png_colorspace_set_chromaticities(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, const png_xy *xy, int preferred)
+ {
+- int ret = 1;
+- unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
+-
+- png_debug(1, "in function png_check_cHRM_fixed");
+-
+- if (png_ptr == NULL)
++ /* We must check the end points to ensure they are reasonable - in the past
++ * color management systems have crashed as a result of getting bogus
++ * colorant values, while this isn't the fault of libpng it is the
++ * responsibility of libpng because PNG carries the bomb and libpng is in a
++ * position to protect against it.
++ */
++ png_XYZ XYZ;
++
++ switch (png_colorspace_check_xy(&XYZ, xy))
++ {
++ case 0: /* success */
++ return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, xy, &XYZ,
++ preferred);
++
++ case 1:
++ /* We can't invert the chromaticities so we can't produce value XYZ
++ * values. Likely as not a color management system will fail too.
++ */
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_benign_error(png_ptr, "invalid chromaticities");
++ break;
++
++ default:
++ /* libpng is broken; this should be a warning but if it happens we
++ * want error reports so for the moment it is an error.
++ */
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_error(png_ptr, "internal error checking chromaticities");
++ break;
++ }
++
++ return 0; /* failed */
++}
++
++int /* PRIVATE */
++png_colorspace_set_endpoints(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, const png_XYZ *XYZ_in, int preferred)
++{
++ png_XYZ XYZ = *XYZ_in;
++ png_xy xy;
++
++ switch (png_colorspace_check_XYZ(&xy, &XYZ))
++ {
++ case 0:
++ return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, &xy, &XYZ,
++ preferred);
++
++ case 1:
++ /* End points are invalid. */
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_benign_error(png_ptr, "invalid end points");
++ break;
++
++ default:
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++ png_error(png_ptr, "internal error checking chromaticities");
++ break;
++ }
++
++ return 0; /* failed */
++}
++
++#if defined(PNG_sRGB_SUPPORTED) || defined(PNG_iCCP_SUPPORTED)
++/* Error message generation */
++static char
++png_icc_tag_char(png_uint_32 byte)
++{
++ byte &= 0xff;
++ if (byte >= 32 && byte <= 126)
++ return (char)byte;
++ else
++ return '?';
++}
++
++static void
++png_icc_tag_name(char *name, png_uint_32 tag)
++{
++ name[0] = '\'';
++ name[1] = png_icc_tag_char(tag >> 24);
++ name[2] = png_icc_tag_char(tag >> 16);
++ name[3] = png_icc_tag_char(tag >> 8);
++ name[4] = png_icc_tag_char(tag );
++ name[5] = '\'';
++}
++
++static int
++is_ICC_signature_char(png_alloc_size_t it)
++{
++ return it == 32 || (it >= 48 && it <= 57) || (it >= 65 && it <= 90) ||
++ (it >= 97 && it <= 122);
++}
++
++static int
++is_ICC_signature(png_alloc_size_t it)
++{
++ return is_ICC_signature_char(it >> 24) /* checks all the top bits */ &&
++ is_ICC_signature_char((it >> 16) & 0xff) &&
++ is_ICC_signature_char((it >> 8) & 0xff) &&
++ is_ICC_signature_char(it & 0xff);
++}
++
++static int
++png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_charp name, png_alloc_size_t value, png_const_charp reason)
++{
++ size_t pos;
++ char message[196]; /* see below for calculation */
++
++ if (colorspace != NULL)
++ colorspace->flags |= PNG_COLORSPACE_INVALID;
++
++ pos = png_safecat(message, (sizeof message), 0, "profile '"); /* 9 chars */
++ pos = png_safecat(message, pos+79, pos, name); /* Truncate to 79 chars */
++ pos = png_safecat(message, (sizeof message), pos, "': "); /* +2 = 90 */
++ if (is_ICC_signature(value) != 0)
++ {
++ /* So 'value' is at most 4 bytes and the following cast is safe */
++ png_icc_tag_name(message+pos, (png_uint_32)value);
++ pos += 6; /* total +8; less than the else clause */
++ message[pos++] = ':';
++ message[pos++] = ' ';
++ }
++# ifdef PNG_WARNINGS_SUPPORTED
++ else
++ {
++ char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114*/
++
++ pos = png_safecat(message, (sizeof message), pos,
++ png_format_number(number, number+(sizeof number),
++ PNG_NUMBER_FORMAT_x, value));
++ pos = png_safecat(message, (sizeof message), pos, "h: "); /*+2 = 116*/
++ }
++# endif
++ /* The 'reason' is an arbitrary message, allow +79 maximum 195 */
++ pos = png_safecat(message, (sizeof message), pos, reason);
++ PNG_UNUSED(pos)
++
++ /* This is recoverable, but make it unconditionally an app_error on write to
++ * avoid writing invalid ICC profiles into PNG files (i.e., we handle them
++ * on read, with a warning, but on write unless the app turns off
++ * application errors the PNG won't be written.)
++ */
++ png_chunk_report(png_ptr, message,
++ (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
++
++ return 0;
++}
++#endif /* sRGB || iCCP */
++
++#ifdef PNG_sRGB_SUPPORTED
++int /* PRIVATE */
++png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ int intent)
++{
++ /* sRGB sets known gamma, end points and (from the chunk) intent. */
++ /* IMPORTANT: these are not necessarily the values found in an ICC profile
++ * because ICC profiles store values adapted to a D50 environment; it is
++ * expected that the ICC profile mediaWhitePointTag will be D50; see the
++ * checks and code elsewhere to understand this better.
++ *
++ * These XYZ values, which are accurate to 5dp, produce rgb to gray
++ * coefficients of (6968,23435,2366), which are reduced (because they add up
++ * to 32769 not 32768) to (6968,23434,2366). These are the values that
++ * libpng has traditionally used (and are the best values given the 15bit
++ * algorithm used by the rgb to gray code.)
++ */
++ static const png_XYZ sRGB_XYZ = /* D65 XYZ (*not* the D50 adapted values!) */
++ {
++ /* color X Y Z */
++ /* red */ 41239, 21264, 1933,
++ /* green */ 35758, 71517, 11919,
++ /* blue */ 18048, 7219, 95053
++ };
++
++ /* Do nothing if the colorspace is already invalidated. */
++ if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
+ return 0;
+
+- /* (x,y,z) values are first limited to 0..100000 (PNG_FP_1), the white
+- * y must also be greater than 0. To test for the upper limit calculate
+- * (PNG_FP_1-y) - x must be <= to this for z to be >= 0 (and the expression
+- * cannot overflow.) At this point we know x and y are >= 0 and (x+y) is
+- * <= PNG_FP_1. The previous test on PNG_MAX_UINT_31 is removed because it
+- * pointless (and it produces compiler warnings!)
++ /* Check the intent, then check for existing settings. It is valid for the
++ * PNG file to have cHRM or gAMA chunks along with sRGB, but the values must
++ * be consistent with the correct values. If, however, this function is
++ * called below because an iCCP chunk matches sRGB then it is quite
++ * conceivable that an older app recorded incorrect gAMA and cHRM because of
++ * an incorrect calculation based on the values in the profile - this does
++ * *not* invalidate the profile (though it still produces an error, which can
++ * be ignored.)
+ */
+- if (white_x < 0 || white_y <= 0 ||
+- red_x < 0 || red_y < 0 ||
+- green_x < 0 || green_y < 0 ||
+- blue_x < 0 || blue_y < 0)
++ if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
++ return png_icc_profile_error(png_ptr, colorspace, "sRGB",
++ (unsigned)intent, "invalid sRGB rendering intent");
++
++ if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
++ colorspace->rendering_intent != intent)
++ return png_icc_profile_error(png_ptr, colorspace, "sRGB",
++ (unsigned)intent, "inconsistent rendering intents");
++
++ if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
+ {
+- png_warning(png_ptr,
+- "Ignoring attempt to set negative chromaticity value");
+- ret = 0;
++ png_benign_error(png_ptr, "duplicate sRGB information ignored");
++ return 0;
+ }
+- /* And (x+y) must be <= PNG_FP_1 (so z is >= 0) */
+- if (white_x > PNG_FP_1 - white_y)
++
++ /* If the standard sRGB cHRM chunk does not match the one from the PNG file
++ * warn but overwrite the value with the correct one.
++ */
++ if ((colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0 &&
++ !png_colorspace_endpoints_match(&sRGB_xy, &colorspace->end_points_xy,
++ 100))
++ png_chunk_report(png_ptr, "cHRM chunk does not match sRGB",
++ PNG_CHUNK_ERROR);
++
++ /* This check is just done for the error reporting - the routine always
++ * returns true when the 'from' argument corresponds to sRGB (2).
++ */
++ (void)png_colorspace_check_gamma(png_ptr, colorspace, PNG_GAMMA_sRGB_INVERSE,
++ 2/*from sRGB*/);
++
++ /* intent: bugs in GCC force 'int' to be used as the parameter type. */
++ colorspace->rendering_intent = (png_uint_16)intent;
++ colorspace->flags |= PNG_COLORSPACE_HAVE_INTENT;
++
++ /* endpoints */
++ colorspace->end_points_xy = sRGB_xy;
++ colorspace->end_points_XYZ = sRGB_XYZ;
++ colorspace->flags |=
++ (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
++
++ /* gamma */
++ colorspace->gamma = PNG_GAMMA_sRGB_INVERSE;
++ colorspace->flags |= PNG_COLORSPACE_HAVE_GAMMA;
++
++ /* Finally record that we have an sRGB profile */
++ colorspace->flags |=
++ (PNG_COLORSPACE_MATCHES_sRGB|PNG_COLORSPACE_FROM_sRGB);
++
++ return 1; /* set */
++}
++#endif /* sRGB */
++
++#ifdef PNG_iCCP_SUPPORTED
++/* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value
++ * is XYZ(0.9642,1.0,0.8249), which scales to:
++ *
++ * (63189.8112, 65536, 54060.6464)
++ */
++static const png_byte D50_nCIEXYZ[12] =
++ { 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d };
++
++int /* PRIVATE */
++png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_charp name, png_uint_32 profile_length)
++{
++ if (profile_length < 132)
++ return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
++ "too short");
++
++ return 1;
++}
++
++int /* PRIVATE */
++png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_charp name, png_uint_32 profile_length,
++ png_const_bytep profile/* first 132 bytes only */, int color_type)
++{
++ png_uint_32 temp;
++
++ /* Length check; this cannot be ignored in this code because profile_length
++ * is used later to check the tag table, so even if the profile seems over
++ * long profile_length from the caller must be correct. The caller can fix
++ * this up on read or write by just passing in the profile header length.
++ */
++ temp = png_get_uint_32(profile);
++ if (temp != profile_length)
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "length does not match profile");
++
++ temp = (png_uint_32) (*(profile+8));
++ if (temp > 3 && (profile_length & 3))
++ return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
++ "invalid length");
++
++ temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
++ if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
++ profile_length < 132+12*temp) /* truncated tag table */
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "tag count too large");
++
++ /* The 'intent' must be valid or we can't store it, ICC limits the intent to
++ * 16 bits.
++ */
++ temp = png_get_uint_32(profile+64);
++ if (temp >= 0xffff) /* The ICC limit */
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "invalid rendering intent");
++
++ /* This is just a warning because the profile may be valid in future
++ * versions.
++ */
++ if (temp >= PNG_sRGB_INTENT_LAST)
++ (void)png_icc_profile_error(png_ptr, NULL, name, temp,
++ "intent outside defined range");
++
++ /* At this point the tag table can't be checked because it hasn't necessarily
++ * been loaded; however, various header fields can be checked. These checks
++ * are for values permitted by the PNG spec in an ICC profile; the PNG spec
++ * restricts the profiles that can be passed in an iCCP chunk (they must be
++ * appropriate to processing PNG data!)
++ */
++
++ /* Data checks (could be skipped). These checks must be independent of the
++ * version number; however, the version number doesn't accomodate changes in
++ * the header fields (just the known tags and the interpretation of the
++ * data.)
++ */
++ temp = png_get_uint_32(profile+36); /* signature 'ascp' */
++ if (temp != 0x61637370)
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "invalid signature");
++
++ /* Currently the PCS illuminant/adopted white point (the computational
++ * white point) are required to be D50,
++ * however the profile contains a record of the illuminant so perhaps ICC
++ * expects to be able to change this in the future (despite the rationale in
++ * the introduction for using a fixed PCS adopted white.) Consequently the
++ * following is just a warning.
++ */
++ if (memcmp(profile+68, D50_nCIEXYZ, 12) != 0)
++ (void)png_icc_profile_error(png_ptr, NULL, name, 0/*no tag value*/,
++ "PCS illuminant is not D50");
++
++ /* The PNG spec requires this:
++ * "If the iCCP chunk is present, the image samples conform to the colour
++ * space represented by the embedded ICC profile as defined by the
++ * International Color Consortium [ICC]. The colour space of the ICC profile
++ * shall be an RGB colour space for colour images (PNG colour types 2, 3, and
++ * 6), or a greyscale colour space for greyscale images (PNG colour types 0
++ * and 4)."
++ *
++ * This checking code ensures the embedded profile (on either read or write)
++ * conforms to the specification requirements. Notice that an ICC 'gray'
++ * color-space profile contains the information to transform the monochrome
++ * data to XYZ or L*a*b (according to which PCS the profile uses) and this
++ * should be used in preference to the standard libpng K channel replication
++ * into R, G and B channels.
++ *
++ * Previously it was suggested that an RGB profile on grayscale data could be
++ * handled. However it it is clear that using an RGB profile in this context
++ * must be an error - there is no specification of what it means. Thus it is
++ * almost certainly more correct to ignore the profile.
++ */
++ temp = png_get_uint_32(profile+16); /* data colour space field */
++ switch (temp)
+ {
+- png_warning(png_ptr, "Invalid cHRM white point");
+- ret = 0;
++ case 0x52474220: /* 'RGB ' */
++ if ((color_type & PNG_COLOR_MASK_COLOR) == 0)
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "RGB color space not permitted on grayscale PNG");
++ break;
++
++ case 0x47524159: /* 'GRAY' */
++ if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "Gray color space not permitted on RGB PNG");
++ break;
++
++ default:
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "invalid ICC profile color space");
+ }
+
+- if (red_x > PNG_FP_1 - red_y)
++ /* It is up to the application to check that the profile class matches the
++ * application requirements; the spec provides no guidance, but it's pretty
++ * weird if the profile is not scanner ('scnr'), monitor ('mntr'), printer
++ * ('prtr') or 'spac' (for generic color spaces). Issue a warning in these
++ * cases. Issue an error for device link or abstract profiles - these don't
++ * contain the records necessary to transform the color-space to anything
++ * other than the target device (and not even that for an abstract profile).
++ * Profiles of these classes may not be embedded in images.
++ */
++ temp = png_get_uint_32(profile+12); /* profile/device class */
++ switch (temp)
+ {
+- png_warning(png_ptr, "Invalid cHRM red point");
+- ret = 0;
++ case 0x73636E72: /* 'scnr' */
++ case 0x6D6E7472: /* 'mntr' */
++ case 0x70727472: /* 'prtr' */
++ case 0x73706163: /* 'spac' */
++ /* All supported */
++ break;
++
++ case 0x61627374: /* 'abst' */
++ /* May not be embedded in an image */
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "invalid embedded Abstract ICC profile");
++
++ case 0x6C696E6B: /* 'link' */
++ /* DeviceLink profiles cannot be interpreted in a non-device specific
++ * fashion, if an app uses the AToB0Tag in the profile the results are
++ * undefined unless the result is sent to the intended device,
++ * therefore a DeviceLink profile should not be found embedded in a
++ * PNG.
++ */
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "unexpected DeviceLink ICC profile class");
++
++ case 0x6E6D636C: /* 'nmcl' */
++ /* A NamedColor profile is also device specific, however it doesn't
++ * contain an AToB0 tag that is open to misinterpretation. Almost
++ * certainly it will fail the tests below.
++ */
++ (void)png_icc_profile_error(png_ptr, NULL, name, temp,
++ "unexpected NamedColor ICC profile class");
++ break;
++
++ default:
++ /* To allow for future enhancements to the profile accept unrecognized
++ * profile classes with a warning, these then hit the test below on the
++ * tag content to ensure they are backward compatible with one of the
++ * understood profiles.
++ */
++ (void)png_icc_profile_error(png_ptr, NULL, name, temp,
++ "unrecognized ICC profile class");
++ break;
+ }
+
+- if (green_x > PNG_FP_1 - green_y)
++ /* For any profile other than a device link one the PCS must be encoded
++ * either in XYZ or Lab.
++ */
++ temp = png_get_uint_32(profile+20);
++ switch (temp)
+ {
+- png_warning(png_ptr, "Invalid cHRM green point");
+- ret = 0;
++ case 0x58595A20: /* 'XYZ ' */
++ case 0x4C616220: /* 'Lab ' */
++ break;
++
++ default:
++ return png_icc_profile_error(png_ptr, colorspace, name, temp,
++ "unexpected ICC PCS encoding");
+ }
+
+- if (blue_x > PNG_FP_1 - blue_y)
++ return 1;
++}
++
++int /* PRIVATE */
++png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_charp name, png_uint_32 profile_length,
++ png_const_bytep profile /* header plus whole tag table */)
++{
++ png_uint_32 tag_count = png_get_uint_32(profile+128);
++ png_uint_32 itag;
++ png_const_bytep tag = profile+132; /* The first tag */
++
++ /* First scan all the tags in the table and add bits to the icc_info value
++ * (temporarily in 'tags').
++ */
++ for (itag=0; itag < tag_count; ++itag, tag += 12)
+ {
+- png_warning(png_ptr, "Invalid cHRM blue point");
+- ret = 0;
++ png_uint_32 tag_id = png_get_uint_32(tag+0);
++ png_uint_32 tag_start = png_get_uint_32(tag+4); /* must be aligned */
++ png_uint_32 tag_length = png_get_uint_32(tag+8);/* not padded */
++
++ /* The ICC specification does not exclude zero length tags, therefore the
++ * start might actually be anywhere if there is no data, but this would be
++ * a clear abuse of the intent of the standard so the start is checked for
++ * being in range. All defined tag types have an 8 byte header - a 4 byte
++ * type signature then 0.
++ */
++ if ((tag_start & 3) != 0)
++ {
++ /* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is
++ * only a warning here because libpng does not care about the
++ * alignment.
++ */
++ (void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
++ "ICC profile tag start not a multiple of 4");
++ }
++
++ /* This is a hard error; potentially it can cause read outside the
++ * profile.
++ */
++ if (tag_start > profile_length || tag_length > profile_length - tag_start)
++ return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
++ "ICC profile tag outside profile");
+ }
+
+- png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
+- png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);
+-
+- if (xy_hi == yx_hi && xy_lo == yx_lo)
++ return 1; /* success, maybe with warnings */
++}
++
++#if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
++/* Information about the known ICC sRGB profiles */
++static const struct
++{
++ png_uint_32 adler, crc, length;
++ png_uint_32 md5[4];
++ png_byte have_md5;
++ png_byte is_broken;
++ png_uint_16 intent;
++
++# define PNG_MD5(a,b,c,d) { a, b, c, d }, (a!=0)||(b!=0)||(c!=0)||(d!=0)
++# define PNG_ICC_CHECKSUM(adler, crc, md5, intent, broke, date, length, fname)\
++ { adler, crc, length, md5, broke, intent },
++
++} png_sRGB_checks[] =
++{
++ /* This data comes from contrib/tools/checksum-icc run on downloads of
++ * all four ICC sRGB profiles from www.color.org.
++ */
++ /* adler32, crc32, MD5[4], intent, date, length, file-name */
++ PNG_ICC_CHECKSUM(0x0a3fd9f6, 0x3b8772b9,
++ PNG_MD5(0x29f83dde, 0xaff255ae, 0x7842fae4, 0xca83390d), 0, 0,
++ "2009/03/27 21:36:31", 3048, "sRGB_IEC61966-2-1_black_scaled.icc")
++
++ /* ICC sRGB v2 perceptual no black-compensation: */
++ PNG_ICC_CHECKSUM(0x4909e5e1, 0x427ebb21,
++ PNG_MD5(0xc95bd637, 0xe95d8a3b, 0x0df38f99, 0xc1320389), 1, 0,
++ "2009/03/27 21:37:45", 3052, "sRGB_IEC61966-2-1_no_black_scaling.icc")
++
++ PNG_ICC_CHECKSUM(0xfd2144a1, 0x306fd8ae,
++ PNG_MD5(0xfc663378, 0x37e2886b, 0xfd72e983, 0x8228f1b8), 0, 0,
++ "2009/08/10 17:28:01", 60988, "sRGB_v4_ICC_preference_displayclass.icc")
++
++ /* ICC sRGB v4 perceptual */
++ PNG_ICC_CHECKSUM(0x209c35d2, 0xbbef7812,
++ PNG_MD5(0x34562abf, 0x994ccd06, 0x6d2c5721, 0xd0d68c5d), 0, 0,
++ "2007/07/25 00:05:37", 60960, "sRGB_v4_ICC_preference.icc")
++
++ /* The following profiles have no known MD5 checksum. If there is a match
++ * on the (empty) MD5 the other fields are used to attempt a match and
++ * a warning is produced. The first two of these profiles have a 'cprt' tag
++ * which suggests that they were also made by Hewlett Packard.
++ */
++ PNG_ICC_CHECKSUM(0xa054d762, 0x5d5129ce,
++ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 0,
++ "2004/07/21 18:57:42", 3024, "sRGB_IEC61966-2-1_noBPC.icc")
++
++ /* This is a 'mntr' (display) profile with a mediaWhitePointTag that does not
++ * match the D50 PCS illuminant in the header (it is in fact the D65 values,
++ * so the white point is recorded as the un-adapted value.) The profiles
++ * below only differ in one byte - the intent - and are basically the same as
++ * the previous profile except for the mediaWhitePointTag error and a missing
++ * chromaticAdaptationTag.
++ */
++ PNG_ICC_CHECKSUM(0xf784f3fb, 0x182ea552,
++ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 0, 1/*broken*/,
++ "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 perceptual")
++
++ PNG_ICC_CHECKSUM(0x0398f3fc, 0xf29e526d,
++ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 1/*broken*/,
++ "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 media-relative")
++};
++
++static int
++png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
++ png_const_bytep profile, uLong adler)
++{
++ /* The quick check is to verify just the MD5 signature and trust the
++ * rest of the data. Because the profile has already been verified for
++ * correctness this is safe. png_colorspace_set_sRGB will check the 'intent'
++ * field too, so if the profile has been edited with an intent not defined
++ * by sRGB (but maybe defined by a later ICC specification) the read of
++ * the profile will fail at that point.
++ */
++
++ png_uint_32 length = 0;
++ png_uint_32 intent = 0x10000; /* invalid */
++#if PNG_sRGB_PROFILE_CHECKS > 1
++ uLong crc = 0; /* the value for 0 length data */
++#endif
++ unsigned int i;
++
++#ifdef PNG_SET_OPTION_SUPPORTED
++ /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
++ if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
++ PNG_OPTION_ON)
++ return 0;
++#endif
++
++ for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
+ {
+- png_warning(png_ptr,
+- "Ignoring attempt to set cHRM RGB triangle with zero area");
+- ret = 0;
++ if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] &&
++ png_get_uint_32(profile+88) == png_sRGB_checks[i].md5[1] &&
++ png_get_uint_32(profile+92) == png_sRGB_checks[i].md5[2] &&
++ png_get_uint_32(profile+96) == png_sRGB_checks[i].md5[3])
++ {
++ /* This may be one of the old HP profiles without an MD5, in that
++ * case we can only use the length and Adler32 (note that these
++ * are not used by default if there is an MD5!)
++ */
++# if PNG_sRGB_PROFILE_CHECKS == 0
++ if (png_sRGB_checks[i].have_md5 != 0)
++ return 1+png_sRGB_checks[i].is_broken;
++# endif
++
++ /* Profile is unsigned or more checks have been configured in. */
++ if (length == 0)
++ {
++ length = png_get_uint_32(profile);
++ intent = png_get_uint_32(profile+64);
++ }
++
++ /* Length *and* intent must match */
++ if (length == png_sRGB_checks[i].length &&
++ intent == png_sRGB_checks[i].intent)
++ {
++ /* Now calculate the adler32 if not done already. */
++ if (adler == 0)
++ {
++ adler = adler32(0, NULL, 0);
++ adler = adler32(adler, profile, length);
++ }
++
++ if (adler == png_sRGB_checks[i].adler)
++ {
++ /* These basic checks suggest that the data has not been
++ * modified, but if the check level is more than 1 perform
++ * our own crc32 checksum on the data.
++ */
++# if PNG_sRGB_PROFILE_CHECKS > 1
++ if (crc == 0)
++ {
++ crc = crc32(0, NULL, 0);
++ crc = crc32(crc, profile, length);
++ }
++
++ /* So this check must pass for the 'return' below to happen.
++ */
++ if (crc == png_sRGB_checks[i].crc)
++# endif
++ {
++ if (png_sRGB_checks[i].is_broken != 0)
++ {
++ /* These profiles are known to have bad data that may cause
++ * problems if they are used, therefore attempt to
++ * discourage their use, skip the 'have_md5' warning below,
++ * which is made irrelevant by this error.
++ */
++ png_chunk_report(png_ptr, "known incorrect sRGB profile",
++ PNG_CHUNK_ERROR);
++ }
++
++ /* Warn that this being done; this isn't even an error since
++ * the profile is perfectly valid, but it would be nice if
++ * people used the up-to-date ones.
++ */
++ else if (png_sRGB_checks[i].have_md5 == 0)
++ {
++ png_chunk_report(png_ptr, "out-of-date sRGB profile with"
++ " no signature",
++ PNG_CHUNK_WARNING);
++ }
++
++ return 1+png_sRGB_checks[i].is_broken;
++ }
++ }
++
++# if PNG_sRGB_PROFILE_CHECKS > 0
++ /* The signature matched, but the profile had been changed in some
++ * way. This probably indicates a data error or uninformed hacking.
++ * Fall through to "no match".
++ */
++ png_chunk_report(png_ptr, "Not recognizing known sRGB profile that"
++ " has been edited",
++ PNG_CHUNK_WARNING);
++ break;
++# endif
++ }
++ }
+ }
+
+- return ret;
++ return 0; /* no match */
+ }
+-# endif /* PNG_CHECK_cHRM_SUPPORTED */
+-
++#endif
++
++#ifdef PNG_sRGB_SUPPORTED
+ void /* PRIVATE */
+-png_check_IHDR(png_structp png_ptr,
++png_icc_set_sRGB(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
++{
++ /* Is this profile one of the known ICC sRGB profiles? If it is, just set
++ * the sRGB information.
++ */
++#if PNG_sRGB_PROFILE_CHECKS >= 0
++ if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
++#endif
++ (void)png_colorspace_set_sRGB(png_ptr, colorspace,
++ (int)/*already checked*/png_get_uint_32(profile+64));
++}
++#endif /* READ_sRGB */
++
++int /* PRIVATE */
++png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_charp name, png_uint_32 profile_length, png_const_bytep profile,
++ int color_type)
++{
++ if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
++ return 0;
++
++ if (png_icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
++ png_icc_check_header(png_ptr, colorspace, name, profile_length, profile,
++ color_type) != 0 &&
++ png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
++ profile) != 0)
++ {
++# ifdef PNG_sRGB_SUPPORTED
++ /* If no sRGB support, don't try storing sRGB information */
++ png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
++# endif
++ return 1;
++ }
++
++ /* Failure case */
++ return 0;
++}
++#endif /* iCCP */
++
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++void /* PRIVATE */
++png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
++{
++ /* Set the rgb_to_gray coefficients from the colorspace. */
++ if (png_ptr->rgb_to_gray_coefficients_set == 0 &&
++ (png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
++ {
++ /* png_set_background has not been called, get the coefficients from the Y
++ * values of the colorspace colorants.
++ */
++ png_fixed_point r = png_ptr->colorspace.end_points_XYZ.red_Y;
++ png_fixed_point g = png_ptr->colorspace.end_points_XYZ.green_Y;
++ png_fixed_point b = png_ptr->colorspace.end_points_XYZ.blue_Y;
++ png_fixed_point total = r+g+b;
++
++ if (total > 0 &&
++ r >= 0 && png_muldiv(&r, r, 32768, total) && r >= 0 && r <= 32768 &&
++ g >= 0 && png_muldiv(&g, g, 32768, total) && g >= 0 && g <= 32768 &&
++ b >= 0 && png_muldiv(&b, b, 32768, total) && b >= 0 && b <= 32768 &&
++ r+g+b <= 32769)
++ {
++ /* We allow 0 coefficients here. r+g+b may be 32769 if two or
++ * all of the coefficients were rounded up. Handle this by
++ * reducing the *largest* coefficient by 1; this matches the
++ * approach used for the default coefficients in pngrtran.c
++ */
++ int add = 0;
++
++ if (r+g+b > 32768)
++ add = -1;
++ else if (r+g+b < 32768)
++ add = 1;
++
++ if (add != 0)
++ {
++ if (g >= r && g >= b)
++ g += add;
++ else if (r >= g && r >= b)
++ r += add;
++ else
++ b += add;
++ }
++
++ /* Check for an internal error. */
++ if (r+g+b != 32768)
++ png_error(png_ptr,
++ "internal error handling cHRM coefficients");
++
++ else
++ {
++ png_ptr->rgb_to_gray_red_coeff = (png_uint_16)r;
++ png_ptr->rgb_to_gray_green_coeff = (png_uint_16)g;
++ }
++ }
++
++ /* This is a png_error at present even though it could be ignored -
++ * it should never happen, but it is important that if it does, the
++ * bug is fixed.
++ */
++ else
++ png_error(png_ptr, "internal error handling cHRM->XYZ");
++ }
++}
++#endif
++
++#endif /* COLORSPACE */
++
++#ifdef __GNUC__
++/* This exists solely to work round a warning from GNU C. */
++static int /* PRIVATE */
++png_gt(size_t a, size_t b)
++{
++ return a > b;
++}
++#else
++# define png_gt(a,b) ((a) > (b))
++#endif
++
++void /* PRIVATE */
++png_check_IHDR(png_const_structrp png_ptr,
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)
+@@ -840,53 +2514,68 @@
+ png_warning(png_ptr, "Image width is zero in IHDR");
+ error = 1;
+ }
++ else if (width > PNG_UINT_31_MAX)
++ {
++ png_warning(png_ptr, "Invalid image width in IHDR");
++ error = 1;
++ }
++
++ else if (png_gt(width,
++ (PNG_SIZE_MAX >> 3) /* 8-byte RGBA pixels */
++ - 48 /* big_row_buf hack */
++ - 1 /* filter byte */
++ - 7*8 /* rounding width to multiple of 8 pix */
++ - 8)) /* extra max_pixel_depth pad */
++ {
++ /* The size of the row must be within the limits of this architecture.
++ * Because the read code can perform arbitrary transformations the
++ * maximum size is checked here. Because the code in png_read_start_row
++ * adds extra space "for safety's sake" in several places a conservative
++ * limit is used here.
++ *
++ * NOTE: it would be far better to check the size that is actually used,
++ * but the effect in the real world is minor and the changes are more
++ * extensive, therefore much more dangerous and much more difficult to
++ * write in a way that avoids compiler warnings.
++ */
++ png_warning(png_ptr, "Image width is too large for this architecture");
++ error = 1;
++ }
++ else
++ {
++# ifdef PNG_SET_USER_LIMITS_SUPPORTED
++ if (width > png_ptr->user_width_max)
++# else
++ if (width > PNG_USER_WIDTH_MAX)
++# endif
++ {
++ png_warning(png_ptr, "Image width exceeds user limit in IHDR");
++ error = 1;
++ }
++ }
+
+ if (height == 0)
+ {
+ png_warning(png_ptr, "Image height is zero in IHDR");
+ error = 1;
+ }
+-
+-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
+- if (width > png_ptr->user_width_max)
+-
+-# else
+- if (width > PNG_USER_WIDTH_MAX)
+-# endif
+- {
+- png_warning(png_ptr, "Image width exceeds user limit in IHDR");
+- error = 1;
+- }
+-
+-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
+- if (height > png_ptr->user_height_max)
+-# else
+- if (height > PNG_USER_HEIGHT_MAX)
+-# endif
+- {
+- png_warning(png_ptr, "Image height exceeds user limit in IHDR");
+- error = 1;
+- }
+-
+- if (width > PNG_UINT_31_MAX)
+- {
+- png_warning(png_ptr, "Invalid image width in IHDR");
+- error = 1;
+- }
+-
+- if (height > PNG_UINT_31_MAX)
++ else if (height > PNG_UINT_31_MAX)
+ {
+ png_warning(png_ptr, "Invalid image height in IHDR");
+ error = 1;
+ }
+-
+- if (width > (PNG_UINT_32_MAX
+- >> 3) /* 8-byte RGBA pixels */
+- - 48 /* bigrowbuf hack */
+- - 1 /* filter byte */
+- - 7*8 /* rounding of width to multiple of 8 pixels */
+- - 8) /* extra max_pixel_depth pad */
+- png_warning(png_ptr, "Width is too large for libpng to process pixels");
++ else
++ {
++# ifdef PNG_SET_USER_LIMITS_SUPPORTED
++ if (height > png_ptr->user_height_max)
++# else
++ if (height > PNG_USER_HEIGHT_MAX)
++# endif
++ {
++ png_warning(png_ptr, "Image height exceeds user limit in IHDR");
++ error = 1;
++ }
++ }
+
+ /* Check other values */
+ if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
+@@ -934,13 +2623,13 @@
+ * 4. The filter_method is 64 and
+ * 5. The color_type is RGB or RGBA
+ */
+- if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) &&
+- png_ptr->mng_features_permitted)
++ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 &&
++ png_ptr->mng_features_permitted != 0)
+ png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
+
+ if (filter_type != PNG_FILTER_TYPE_BASE)
+ {
+- if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
++ if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
+ (filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
+ ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
+ (color_type == PNG_COLOR_TYPE_RGB ||
+@@ -950,7 +2639,7 @@
+ error = 1;
+ }
+
+- if (png_ptr->mode & PNG_HAVE_PNG_SIGNATURE)
++ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0)
+ {
+ png_warning(png_ptr, "Invalid filter method in IHDR");
+ error = 1;
+@@ -1010,7 +2699,7 @@
+ switch ((state & PNG_FP_STATE) + (type & PNG_FP_SAW_ANY))
+ {
+ case PNG_FP_INTEGER + PNG_FP_SAW_SIGN:
+- if (state & PNG_FP_SAW_ANY)
++ if ((state & PNG_FP_SAW_ANY) != 0)
+ goto PNG_FP_End; /* not a part of the number */
+
+ png_fp_add(state, type);
+@@ -1018,10 +2707,10 @@
+
+ case PNG_FP_INTEGER + PNG_FP_SAW_DOT:
+ /* Ok as trailer, ok as lead of fraction. */
+- if (state & PNG_FP_SAW_DOT) /* two dots */
++ if ((state & PNG_FP_SAW_DOT) != 0) /* two dots */
+ goto PNG_FP_End;
+
+- else if (state & PNG_FP_SAW_DIGIT) /* trailing dot? */
++ else if ((state & PNG_FP_SAW_DIGIT) != 0) /* trailing dot? */
+ png_fp_add(state, type);
+
+ else
+@@ -1030,7 +2719,7 @@
+ break;
+
+ case PNG_FP_INTEGER + PNG_FP_SAW_DIGIT:
+- if (state & PNG_FP_SAW_DOT) /* delayed fraction */
++ if ((state & PNG_FP_SAW_DOT) != 0) /* delayed fraction */
+ png_fp_set(state, PNG_FP_FRACTION | PNG_FP_SAW_DOT);
+
+ png_fp_add(state, type | PNG_FP_WAS_VALID);
+@@ -1068,7 +2757,7 @@
+ break;
+
+ case PNG_FP_EXPONENT + PNG_FP_SAW_SIGN:
+- if (state & PNG_FP_SAW_ANY)
++ if ((state & PNG_FP_SAW_ANY) != 0)
+ goto PNG_FP_End; /* not a part of the number */
+
+ png_fp_add(state, PNG_FP_SAW_SIGN);
+@@ -1111,15 +2800,15 @@
+ int state=0;
+ png_size_t char_index=0;
+
+- if (png_check_fp_number(string, size, &state, &char_index) &&
++ if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
+ (char_index == size || string[char_index] == 0))
+ return state /* must be non-zero - see above */;
+
+ return 0; /* i.e. fail */
+ }
+-#endif /* pCAL or sCAL */
+-
+-#ifdef PNG_READ_sCAL_SUPPORTED
++#endif /* pCAL || sCAL */
++
++#ifdef PNG_sCAL_SUPPORTED
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ /* Utility used below - a simple accurate power of ten from an integral
+ * exponent.
+@@ -1151,7 +2840,7 @@
+ }
+ while (power > 0);
+
+- if (recip) d = 1/d;
++ if (recip != 0) d = 1/d;
+ }
+ /* else power is 0 and d is 1 */
+
+@@ -1162,7 +2851,7 @@
+ * precision.
+ */
+ void /* PRIVATE */
+-png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
++png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
+ double fp, unsigned int precision)
+ {
+ /* We use standard functions from math.h, but not printf because
+@@ -1365,8 +3054,9 @@
+
+ if (exp_b10 != (-1))
+ {
+- if (exp_b10 == 0) *ascii++ = 46, --size; /* counted
+- above */
++ if (exp_b10 == 0)
++ *ascii++ = 46, --size; /* counted above */
++
+ --exp_b10;
+ }
+ *ascii++ = (char)(48 + (int)d), ++cdigits;
+@@ -1411,18 +3101,30 @@
+ size -= cdigits;
+
+ *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
+- if (exp_b10 < 0)
++
++ /* The following use of an unsigned temporary avoids ambiguities in
++ * the signed arithmetic on exp_b10 and permits GCC at least to do
++ * better optimization.
++ */
+ {
+- *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
+- exp_b10 = -exp_b10;
+- }
+-
+- cdigits = 0;
+-
+- while (exp_b10 > 0)
+- {
+- exponent[cdigits++] = (char)(48 + exp_b10 % 10);
+- exp_b10 /= 10;
++ unsigned int uexp_b10;
++
++ if (exp_b10 < 0)
++ {
++ *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
++ uexp_b10 = -exp_b10;
++ }
++
++ else
++ uexp_b10 = exp_b10;
++
++ cdigits = 0;
++
++ while (uexp_b10 > 0)
++ {
++ exponent[cdigits++] = (char)(48 + uexp_b10 % 10);
++ uexp_b10 /= 10;
++ }
+ }
+
+ /* Need another size check here for the exponent digits, so
+@@ -1464,8 +3166,8 @@
+ /* Function to format a fixed point value in ASCII.
+ */
+ void /* PRIVATE */
+-png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
+- png_fixed_point fp)
++png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
++ png_size_t size, png_fixed_point fp)
+ {
+ /* Require space for 10 decimal digits, a decimal point, a minus sign and a
+ * trailing \0, 13 characters:
+@@ -1480,7 +3182,7 @@
+ else
+ num = fp;
+
+- if (num <= 0x80000000U) /* else overflowed */
++ if (num <= 0x80000000) /* else overflowed */
+ {
+ unsigned int ndigits = 0, first = 16 /* flag value */;
+ char digits[10];
+@@ -1535,21 +3237,30 @@
+ #endif /* READ_SCAL */
+
+ #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
+- !defined(PNG_FIXED_POINT_MACRO_SUPPORTED)
++ !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
++ (defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
++ defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
++ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
++ (defined(PNG_sCAL_SUPPORTED) && \
++ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
+ png_fixed_point
+-png_fixed(png_structp png_ptr, double fp, png_const_charp text)
++png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
+ {
+ double r = floor(100000 * fp + .5);
+
+ if (r > 2147483647. || r < -2147483648.)
+ png_fixed_error(png_ptr, text);
+
++# ifndef PNG_ERROR_TEXT_SUPPORTED
++ PNG_UNUSED(text)
++# endif
++
+ return (png_fixed_point)r;
+ }
+ #endif
+
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || \
+- defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG__READ_pHYs_SUPPORTED)
++#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
++ defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
+ /* muldiv functions */
+ /* This API takes signed arguments and rounds the result to the nearest
+ * integer (or, for a fixed point number - the standard argument - to
+@@ -1653,11 +3364,12 @@
+ if (s00 >= (D >> 1))
+ ++result;
+
+- if (negative)
++ if (negative != 0)
+ result = -result;
+
+ /* Check for overflow. */
+- if ((negative && result <= 0) || (!negative && result >= 0))
++ if ((negative != 0 && result <= 0) ||
++ (negative == 0 && result >= 0))
+ {
+ *res = result;
+ return 1;
+@@ -1676,12 +3388,12 @@
+ * result.
+ */
+ png_fixed_point
+-png_muldiv_warn(png_structp png_ptr, png_fixed_point a, png_int_32 times,
++png_muldiv_warn(png_const_structrp png_ptr, png_fixed_point a, png_int_32 times,
+ png_int_32 divisor)
+ {
+ png_fixed_point result;
+
+- if (png_muldiv(&result, a, times, divisor))
++ if (png_muldiv(&result, a, times, divisor) != 0)
+ return result;
+
+ png_warning(png_ptr, "fixed point overflow ignored");
+@@ -1689,7 +3401,7 @@
+ }
+ #endif
+
+-#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gammma */
++#ifdef PNG_GAMMA_SUPPORTED /* more fixed point functions for gamma */
+ /* Calculate a reciprocal, return 0 on div-by-zero or overflow. */
+ png_fixed_point
+ png_reciprocal(png_fixed_point a)
+@@ -1702,34 +3414,48 @@
+ #else
+ png_fixed_point res;
+
+- if (png_muldiv(&res, 100000, 100000, a))
++ if (png_muldiv(&res, 100000, 100000, a) != 0)
+ return res;
+ #endif
+
+ return 0; /* error/overflow */
+ }
+
++/* This is the shared test on whether a gamma value is 'significant' - whether
++ * it is worth doing gamma correction.
++ */
++int /* PRIVATE */
++png_gamma_significant(png_fixed_point gamma_val)
++{
++ return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
++ gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
++}
++#endif
++
++#ifdef PNG_READ_GAMMA_SUPPORTED
++#if defined(PNG_16BIT_SUPPORTED) || !defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
+ /* A local convenience routine. */
+ static png_fixed_point
+ png_product2(png_fixed_point a, png_fixed_point b)
+ {
+ /* The required result is 1/a * 1/b; the following preserves accuracy. */
+-#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
++# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+ double r = a * 1E-5;
+ r *= b;
+ r = floor(r+.5);
+
+ if (r <= 2147483647. && r >= -2147483648.)
+ return (png_fixed_point)r;
+-#else
++# else
+ png_fixed_point res;
+
+- if (png_muldiv(&res, a, b, 100000))
++ if (png_muldiv(&res, a, b, 100000) != 0)
+ return res;
+-#endif
++# endif
+
+ return 0; /* overflow */
+ }
++#endif /* 16BIT || !FLOATING_ARITHMETIC */
+
+ /* The inverse of the above. */
+ png_fixed_point
+@@ -1759,73 +3485,28 @@
+ }
+ #endif /* READ_GAMMA */
+
+-#ifdef PNG_CHECK_cHRM_SUPPORTED
+-/* Added at libpng version 1.2.34 (Dec 8, 2008) and 1.4.0 (Jan 2,
+- * 2010: moved from pngset.c) */
+-/*
+- * Multiply two 32-bit numbers, V1 and V2, using 32-bit
+- * arithmetic, to produce a 64-bit result in the HI/LO words.
+- *
+- * A B
+- * x C D
+- * ------
+- * AD || BD
+- * AC || CB || 0
+- *
+- * where A and B are the high and low 16-bit words of V1,
+- * C and D are the 16-bit words of V2, AD is the product of
+- * A and D, and X || Y is (X << 16) + Y.
+-*/
+-
+-void /* PRIVATE */
+-png_64bit_product (long v1, long v2, unsigned long *hi_product,
+- unsigned long *lo_product)
+-{
+- int a, b, c, d;
+- long lo, hi, x, y;
+-
+- a = (v1 >> 16) & 0xffff;
+- b = v1 & 0xffff;
+- c = (v2 >> 16) & 0xffff;
+- d = v2 & 0xffff;
+-
+- lo = b * d; /* BD */
+- x = a * d + c * b; /* AD + CB */
+- y = ((lo >> 16) & 0xffff) + x;
+-
+- lo = (lo & 0xffff) | ((y & 0xffff) << 16);
+- hi = (y >> 16) & 0xffff;
+-
+- hi += a * c; /* AC */
+-
+- *hi_product = (unsigned long)hi;
+- *lo_product = (unsigned long)lo;
+-}
+-#endif /* CHECK_cHRM */
+-
+ #ifdef PNG_READ_GAMMA_SUPPORTED /* gamma table code */
+ #ifndef PNG_FLOATING_ARITHMETIC_SUPPORTED
+ /* Fixed point gamma.
+ *
++ * The code to calculate the tables used below can be found in the shell script
++ * contrib/tools/intgamma.sh
++ *
+ * To calculate gamma this code implements fast log() and exp() calls using only
+ * fixed point arithmetic. This code has sufficient precision for either 8-bit
+ * or 16-bit sample values.
+ *
+ * The tables used here were calculated using simple 'bc' programs, but C double
+- * precision floating point arithmetic would work fine. The programs are given
+- * at the head of each table.
++ * precision floating point arithmetic would work fine.
+ *
+ * 8-bit log table
+ * This is a table of -log(value/255)/log(2) for 'value' in the range 128 to
+ * 255, so it's the base 2 logarithm of a normalized 8-bit floating point
+ * mantissa. The numbers are 32-bit fractions.
+ */
+-static png_uint_32
++static const png_uint_32
+ png_8bit_l2[128] =
+ {
+-# if PNG_DO_BC
+- for (i=128;i<256;++i) { .5 - l(i/255)/l(2)*65536*65536; }
+-# endif
+ 4270715492U, 4222494797U, 4174646467U, 4127164793U, 4080044201U, 4033279239U,
+ 3986864580U, 3940795015U, 3895065449U, 3849670902U, 3804606499U, 3759867474U,
+ 3715449162U, 3671346997U, 3627556511U, 3584073329U, 3540893168U, 3498011834U,
+@@ -1848,6 +3529,7 @@
+ 324227938U, 298676034U, 273229066U, 247886176U, 222646516U, 197509248U,
+ 172473545U, 147538590U, 122703574U, 97967701U, 73330182U, 48790236U,
+ 24347096U, 0U
++
+ #if 0
+ /* The following are the values for 16-bit tables - these work fine for the
+ * 8-bit conversions but produce very slightly larger errors in the 16-bit
+@@ -1869,18 +3551,18 @@
+ #endif
+ };
+
+-PNG_STATIC png_int_32
++static png_int_32
+ png_log8bit(unsigned int x)
+ {
+ unsigned int lg2 = 0;
+ /* Each time 'x' is multiplied by 2, 1 must be subtracted off the final log,
+ * because the log is actually negate that means adding 1. The final
+ * returned value thus has the range 0 (for 255 input) to 7.994 (for 1
+- * input), return 7.99998 for the overflow (log 0) case - so the result is
++ * input), return -1 for the overflow (log 0) case, - so the result is
+ * always at most 19 bits.
+ */
+ if ((x &= 0xff) == 0)
+- return 0xffffffff;
++ return -1;
+
+ if ((x & 0xf0) == 0)
+ lg2 = 4, x <<= 4;
+@@ -1925,14 +3607,15 @@
+ * Zero (257): 0
+ * End (258): 23499
+ */
+-PNG_STATIC png_int_32
++#ifdef PNG_16BIT_SUPPORTED
++static png_int_32
+ png_log16bit(png_uint_32 x)
+ {
+ unsigned int lg2 = 0;
+
+ /* As above, but now the input has 16 bits. */
+ if ((x &= 0xffff) == 0)
+- return 0xffffffff;
++ return -1;
+
+ if ((x & 0xff00) == 0)
+ lg2 = 8, x <<= 8;
+@@ -1975,14 +3658,15 @@
+ /* Safe, because the result can't have more than 20 bits: */
+ return (png_int_32)((lg2 + 2048) >> 12);
+ }
++#endif /* 16BIT */
+
+ /* The 'exp()' case must invert the above, taking a 20-bit fixed point
+ * logarithmic value and returning a 16 or 8-bit number as appropriate. In
+ * each case only the low 16 bits are relevant - the fraction - since the
+ * integer bits (the top 4) simply determine a shift.
+ *
+- * The worst case is the 16-bit distinction between 65535 and 65534, this
+- * requires perhaps spurious accuracty in the decoding of the logarithm to
++ * The worst case is the 16-bit distinction between 65535 and 65534. This
++ * requires perhaps spurious accuracy in the decoding of the logarithm to
+ * distinguish log2(65535/65534.5) - 10^-5 or 17 bits. There is little chance
+ * of getting this accuracy in practice.
+ *
+@@ -1990,12 +3674,9 @@
+ * frational part of the logarithm by using an accurate 32-bit value from the
+ * top four fractional bits then multiplying in the remaining bits.
+ */
+-static png_uint_32
++static const png_uint_32
+ png_32bit_exp[16] =
+ {
+-# if PNG_DO_BC
+- for (i=0;i<16;++i) { .5 + e(-i/16*l(2))*2^32; }
+-# endif
+ /* NOTE: the first entry is deliberately set to the maximum 32-bit value. */
+ 4294967295U, 4112874773U, 3938502376U, 3771522796U, 3611622603U, 3458501653U,
+ 3311872529U, 3171459999U, 3037000500U, 2908241642U, 2784941738U, 2666869345U,
+@@ -2003,7 +3684,7 @@
+ };
+
+ /* Adjustment table; provided to explain the numbers in the code below. */
+-#if PNG_DO_BC
++#if 0
+ for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"}
+ 11 44937.64284865548751208448
+ 10 45180.98734845585101160448
+@@ -2019,7 +3700,7 @@
+ 0 45425.85339951654943850496
+ #endif
+
+-PNG_STATIC png_uint_32
++static png_uint_32
+ png_exp(png_fixed_point x)
+ {
+ if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
+@@ -2067,13 +3748,13 @@
+ return 0;
+ }
+
+-PNG_STATIC png_byte
++static png_byte
+ png_exp8bit(png_fixed_point lg2)
+ {
+ /* Get a 32-bit value: */
+ png_uint_32 x = png_exp(lg2);
+
+- /* Convert the 32-bit value to 0..255 by multiplying by 256-1, note that the
++ /* Convert the 32-bit value to 0..255 by multiplying by 256-1. Note that the
+ * second, rounding, step can't overflow because of the first, subtraction,
+ * step.
+ */
+@@ -2081,7 +3762,8 @@
+ return (png_byte)((x + 0x7fffffU) >> 24);
+ }
+
+-PNG_STATIC png_uint_16
++#ifdef PNG_16BIT_SUPPORTED
++static png_uint_16
+ png_exp16bit(png_fixed_point lg2)
+ {
+ /* Get a 32-bit value: */
+@@ -2091,6 +3773,7 @@
+ x -= x >> 16;
+ return (png_uint_16)((x + 32767U) >> 16);
+ }
++#endif /* 16BIT */
+ #endif /* FLOATING_ARITHMETIC */
+
+ png_byte
+@@ -2099,13 +3782,37 @@
+ if (value > 0 && value < 255)
+ {
+ # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+- double r = floor(255*pow(value/255.,gamma_val*.00001)+.5);
++ /* 'value' is unsigned, ANSI-C90 requires the compiler to correctly
++ * convert this to a floating point value. This includes values that
++ * would overflow if 'value' were to be converted to 'int'.
++ *
++ * Apparently GCC, however, does an intermediate conversion to (int)
++ * on some (ARM) but not all (x86) platforms, possibly because of
++ * hardware FP limitations. (E.g. if the hardware conversion always
++ * assumes the integer register contains a signed value.) This results
++ * in ANSI-C undefined behavior for large values.
++ *
++ * Other implementations on the same machine might actually be ANSI-C90
++ * conformant and therefore compile spurious extra code for the large
++ * values.
++ *
++ * We can be reasonably sure that an unsigned to float conversion
++ * won't be faster than an int to float one. Therefore this code
++ * assumes responsibility for the undefined behavior, which it knows
++ * can't happen because of the check above.
++ *
++ * Note the argument to this routine is an (unsigned int) because, on
++ * 16-bit platforms, it is assigned a value which might be out of
++ * range for an (int); that would result in undefined behavior in the
++ * caller if the *argument* ('value') were to be declared (int).
++ */
++ double r = floor(255*pow((int)/*SAFE*/value/255.,gamma_val*.00001)+.5);
+ return (png_byte)r;
+ # else
+ png_int_32 lg2 = png_log8bit(value);
+ png_fixed_point res;
+
+- if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1))
++ if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1) != 0)
+ return png_exp8bit(res);
+
+ /* Overflow. */
+@@ -2116,19 +3823,26 @@
+ return (png_byte)value;
+ }
+
++#ifdef PNG_16BIT_SUPPORTED
+ png_uint_16
+ png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
+ {
+ if (value > 0 && value < 65535)
+ {
+ # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+- double r = floor(65535*pow(value/65535.,gamma_val*.00001)+.5);
++ /* The same (unsigned int)->(double) constraints apply here as above,
++ * however in this case the (unsigned int) to (int) conversion can
++ * overflow on an ANSI-C90 compliant system so the cast needs to ensure
++ * that this is not possible.
++ */
++ double r = floor(65535*pow((png_int_32)value/65535.,
++ gamma_val*.00001)+.5);
+ return (png_uint_16)r;
+ # else
+ png_int_32 lg2 = png_log16bit(value);
+ png_fixed_point res;
+
+- if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1))
++ if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1) != 0)
+ return png_exp16bit(res);
+
+ /* Overflow. */
+@@ -2138,6 +3852,7 @@
+
+ return (png_uint_16)value;
+ }
++#endif /* 16BIT */
+
+ /* This does the right thing based on the bit_depth field of the
+ * png_struct, interpreting values as 8-bit or 16-bit. While the result
+@@ -2145,26 +3860,22 @@
+ * 8-bit (as are the arguments.)
+ */
+ png_uint_16 /* PRIVATE */
+-png_gamma_correct(png_structp png_ptr, unsigned int value,
++png_gamma_correct(png_structrp png_ptr, unsigned int value,
+ png_fixed_point gamma_val)
+ {
+ if (png_ptr->bit_depth == 8)
+ return png_gamma_8bit_correct(value, gamma_val);
+
++#ifdef PNG_16BIT_SUPPORTED
+ else
+ return png_gamma_16bit_correct(value, gamma_val);
++#else
++ /* should not reach this */
++ return 0;
++#endif /* 16BIT */
+ }
+
+-/* This is the shared test on whether a gamma value is 'significant' - whether
+- * it is worth doing gamma correction.
+- */
+-int /* PRIVATE */
+-png_gamma_significant(png_fixed_point gamma_val)
+-{
+- return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
+- gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
+-}
+-
++#ifdef PNG_16BIT_SUPPORTED
+ /* Internal function to build a single 16-bit table - the table consists of
+ * 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount
+ * to shift the input values right (or 16-number_of_signifiant_bits).
+@@ -2174,27 +3885,33 @@
+ * should be somewhere that will be cleaned.
+ */
+ static void
+-png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
++png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
+ PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ {
+ /* Various values derived from 'shift': */
+ PNG_CONST unsigned int num = 1U << (8U - shift);
++#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
++ /* CSE the division and work round wacky GCC warnings (see the comments
++ * in png_gamma_8bit_correct for where these come from.)
++ */
++ PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1);
++#endif
+ PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
+ PNG_CONST unsigned int max_by_2 = 1U << (15U-shift);
+ unsigned int i;
+
+ png_uint_16pp table = *ptable =
+- (png_uint_16pp)png_calloc(png_ptr, num * png_sizeof(png_uint_16p));
++ (png_uint_16pp)png_calloc(png_ptr, num * (sizeof (png_uint_16p)));
+
+ for (i = 0; i < num; i++)
+ {
+ png_uint_16p sub_table = table[i] =
+- (png_uint_16p)png_malloc(png_ptr, 256 * png_sizeof(png_uint_16));
++ (png_uint_16p)png_malloc(png_ptr, 256 * (sizeof (png_uint_16)));
+
+ /* The 'threshold' test is repeated here because it can arise for one of
+ * the 16-bit tables even if the others don't hit it.
+ */
+- if (png_gamma_significant(gamma_val))
++ if (png_gamma_significant(gamma_val) != 0)
+ {
+ /* The old code would overflow at the end and this would cause the
+ * 'pow' function to return a result >1, resulting in an
+@@ -2210,10 +3927,13 @@
+ png_uint_32 ig = (j << (8-shift)) + i;
+ # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+ /* Inline the 'max' scaling operation: */
+- double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5);
++ /* See png_gamma_8bit_correct for why the cast to (int) is
++ * required here.
++ */
++ double d = floor(65535.*pow(ig*fmax, gamma_val*.00001)+.5);
+ sub_table[j] = (png_uint_16)d;
+ # else
+- if (shift)
++ if (shift != 0)
+ ig = (ig * 65535U + max_by_2)/max;
+
+ sub_table[j] = png_gamma_16bit_correct(ig, gamma_val);
+@@ -2229,7 +3949,7 @@
+ {
+ png_uint_32 ig = (j << (8-shift)) + i;
+
+- if (shift)
++ if (shift != 0)
+ ig = (ig * 65535U + max_by_2)/max;
+
+ sub_table[j] = (png_uint_16)ig;
+@@ -2242,7 +3962,7 @@
+ * required.
+ */
+ static void
+-png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable,
++png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
+ PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ {
+ PNG_CONST unsigned int num = 1U << (8U - shift);
+@@ -2251,15 +3971,15 @@
+ png_uint_32 last;
+
+ png_uint_16pp table = *ptable =
+- (png_uint_16pp)png_calloc(png_ptr, num * png_sizeof(png_uint_16p));
++ (png_uint_16pp)png_calloc(png_ptr, num * (sizeof (png_uint_16p)));
+
+ /* 'num' is the number of tables and also the number of low bits of low
+ * bits of the input 16-bit value used to select a table. Each table is
+- * itself index by the high 8 bits of the value.
++ * itself indexed by the high 8 bits of the value.
+ */
+ for (i = 0; i < num; i++)
+ table[i] = (png_uint_16p)png_malloc(png_ptr,
+- 256 * png_sizeof(png_uint_16));
++ 256 * (sizeof (png_uint_16)));
+
+ /* 'gamma_val' is set to the reciprocal of the value calculated above, so
+ * pow(out,g) is an *input* value. 'last' is the last input value set.
+@@ -2303,23 +4023,84 @@
+ last++;
+ }
+ }
++#endif /* 16BIT */
+
+ /* Build a single 8-bit table: same as the 16-bit case but much simpler (and
+ * typically much faster). Note that libpng currently does no sBIT processing
+- * (apparently contrary to the spec) so a 256 entry table is always generated.
++ * (apparently contrary to the spec) so a 256-entry table is always generated.
+ */
+ static void
+-png_build_8bit_table(png_structp png_ptr, png_bytepp ptable,
++png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable,
+ PNG_CONST png_fixed_point gamma_val)
+ {
+ unsigned int i;
+ png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
+
+- if (png_gamma_significant(gamma_val)) for (i=0; i<256; i++)
+- table[i] = png_gamma_8bit_correct(i, gamma_val);
+-
+- else for (i=0; i<256; ++i)
+- table[i] = (png_byte)i;
++ if (png_gamma_significant(gamma_val) != 0)
++ for (i=0; i<256; i++)
++ table[i] = png_gamma_8bit_correct(i, gamma_val);
++
++ else
++ for (i=0; i<256; ++i)
++ table[i] = (png_byte)i;
++}
++
++/* Used from png_read_destroy and below to release the memory used by the gamma
++ * tables.
++ */
++void /* PRIVATE */
++png_destroy_gamma_table(png_structrp png_ptr)
++{
++ png_free(png_ptr, png_ptr->gamma_table);
++ png_ptr->gamma_table = NULL;
++
++#ifdef PNG_16BIT_SUPPORTED
++ if (png_ptr->gamma_16_table != NULL)
++ {
++ int i;
++ int istop = (1 << (8 - png_ptr->gamma_shift));
++ for (i = 0; i < istop; i++)
++ {
++ png_free(png_ptr, png_ptr->gamma_16_table[i]);
++ }
++ png_free(png_ptr, png_ptr->gamma_16_table);
++ png_ptr->gamma_16_table = NULL;
++ }
++#endif /* 16BIT */
++
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
++ defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
++ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
++ png_free(png_ptr, png_ptr->gamma_from_1);
++ png_ptr->gamma_from_1 = NULL;
++ png_free(png_ptr, png_ptr->gamma_to_1);
++ png_ptr->gamma_to_1 = NULL;
++
++#ifdef PNG_16BIT_SUPPORTED
++ if (png_ptr->gamma_16_from_1 != NULL)
++ {
++ int i;
++ int istop = (1 << (8 - png_ptr->gamma_shift));
++ for (i = 0; i < istop; i++)
++ {
++ png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
++ }
++ png_free(png_ptr, png_ptr->gamma_16_from_1);
++ png_ptr->gamma_16_from_1 = NULL;
++ }
++ if (png_ptr->gamma_16_to_1 != NULL)
++ {
++ int i;
++ int istop = (1 << (8 - png_ptr->gamma_shift));
++ for (i = 0; i < istop; i++)
++ {
++ png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
++ }
++ png_free(png_ptr, png_ptr->gamma_16_to_1);
++ png_ptr->gamma_16_to_1 = NULL;
++ }
++#endif /* 16BIT */
++#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+ }
+
+ /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
+@@ -2328,35 +4109,48 @@
+ * we don't need to allocate > 64K chunks for a full 16-bit table.
+ */
+ void /* PRIVATE */
+-png_build_gamma_table(png_structp png_ptr, int bit_depth)
++png_build_gamma_table(png_structrp png_ptr, int bit_depth)
+ {
+ png_debug(1, "in png_build_gamma_table");
+
++ /* Remove any existing table; this copes with multiple calls to
++ * png_read_update_info. The warning is because building the gamma tables
++ * multiple times is a performance hit - it's harmless but the ability to call
++ * png_read_update_info() multiple times is new in 1.5.6 so it seems sensible
++ * to warn if the app introduces such a hit.
++ */
++ if (png_ptr->gamma_table != NULL || png_ptr->gamma_16_table != NULL)
++ {
++ png_warning(png_ptr, "gamma table being rebuilt");
++ png_destroy_gamma_table(png_ptr);
++ }
++
+ if (bit_depth <= 8)
+ {
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
+- png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->gamma,
++ png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
+
+ #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
+ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+- if (png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY))
++ if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
+ {
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_to_1,
+- png_reciprocal(png_ptr->gamma));
++ png_reciprocal(png_ptr->colorspace.gamma));
+
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
+ png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
+- png_ptr->gamma/* Probably doing rgb_to_gray */);
++ png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+ }
+ #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+ }
++#ifdef PNG_16BIT_SUPPORTED
+ else
+ {
+ png_byte shift, sig_bit;
+
+- if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ sig_bit = png_ptr->sig_bit.red;
+
+@@ -2376,7 +4170,7 @@
+ * Where 'iv' is the input color value and 'ov' is the output value -
+ * pow(iv, gamma).
+ *
+- * Thus the gamma table consists of up to 256 256 entry tables. The table
++ * Thus the gamma table consists of up to 256 256-entry tables. The table
+ * is selected by the (8-gamma_shift) most significant of the low 8 bits of
+ * the color value then indexed by the upper 8 bits:
+ *
+@@ -2393,7 +4187,7 @@
+ else
+ shift = 0; /* keep all 16 bits */
+
+- if (png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8))
++ if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
+ {
+ /* PNG_MAX_GAMMA_8 is the number of bits to keep - effectively
+ * the significant bits in the *input* when the output will
+@@ -2408,32 +4202,28 @@
+
+ png_ptr->gamma_shift = shift;
+
+-#ifdef PNG_16BIT_SUPPORTED
+ /* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
+ * PNG_COMPOSE). This effectively smashed the background calculation for
+ * 16-bit output because the 8-bit table assumes the result will be reduced
+ * to 8 bits.
+ */
+- if (png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8))
+-#endif
++ if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
+ png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
+- png_ptr->screen_gamma > 0 ? png_product2(png_ptr->gamma,
++ png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
+
+-#ifdef PNG_16BIT_SUPPORTED
+ else
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
+- png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->gamma,
++ png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
+-#endif
+
+ #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
+ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+- if (png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY))
++ if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
+ {
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_to_1, shift,
+- png_reciprocal(png_ptr->gamma));
++ png_reciprocal(png_ptr->colorspace.gamma));
+
+ /* Notice that the '16 from 1' table should be full precision, however
+ * the lookup on this table still uses gamma_shift, so it can't be.
+@@ -2441,10 +4231,291 @@
+ */
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_from_1, shift,
+ png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
+- png_ptr->gamma/* Probably doing rgb_to_gray */);
++ png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+ }
+ #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+ }
++#endif /* 16BIT */
+ }
+ #endif /* READ_GAMMA */
+-#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
++
++/* HARDWARE OR SOFTWARE OPTION SUPPORT */
++#ifdef PNG_SET_OPTION_SUPPORTED
++int PNGAPI
++png_set_option(png_structrp png_ptr, int option, int onoff)
++{
++ if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
++ (option & 1) == 0)
++ {
++ int mask = 3 << option;
++ int setting = (2 + (onoff != 0)) << option;
++ int current = png_ptr->options;
++
++ png_ptr->options = (png_byte)((current & ~mask) | setting);
++
++ return (current & mask) >> option;
++ }
++
++ return PNG_OPTION_INVALID;
++}
++#endif
++
++/* sRGB support */
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++/* sRGB conversion tables; these are machine generated with the code in
++ * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
++ * specification (see the article at http://en.wikipedia.org/wiki/SRGB)
++ * is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
++ * The sRGB to linear table is exact (to the nearest 16 bit linear fraction).
++ * The inverse (linear to sRGB) table has accuracies as follows:
++ *
++ * For all possible (255*65535+1) input values:
++ *
++ * error: -0.515566 - 0.625971, 79441 (0.475369%) of readings inexact
++ *
++ * For the input values corresponding to the 65536 16-bit values:
++ *
++ * error: -0.513727 - 0.607759, 308 (0.469978%) of readings inexact
++ *
++ * In all cases the inexact readings are only off by one.
++ */
++
++#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
++/* The convert-to-sRGB table is only currently required for read. */
++const png_uint_16 png_sRGB_table[256] =
++{
++ 0,20,40,60,80,99,119,139,
++ 159,179,199,219,241,264,288,313,
++ 340,367,396,427,458,491,526,562,
++ 599,637,677,718,761,805,851,898,
++ 947,997,1048,1101,1156,1212,1270,1330,
++ 1391,1453,1517,1583,1651,1720,1790,1863,
++ 1937,2013,2090,2170,2250,2333,2418,2504,
++ 2592,2681,2773,2866,2961,3058,3157,3258,
++ 3360,3464,3570,3678,3788,3900,4014,4129,
++ 4247,4366,4488,4611,4736,4864,4993,5124,
++ 5257,5392,5530,5669,5810,5953,6099,6246,
++ 6395,6547,6700,6856,7014,7174,7335,7500,
++ 7666,7834,8004,8177,8352,8528,8708,8889,
++ 9072,9258,9445,9635,9828,10022,10219,10417,
++ 10619,10822,11028,11235,11446,11658,11873,12090,
++ 12309,12530,12754,12980,13209,13440,13673,13909,
++ 14146,14387,14629,14874,15122,15371,15623,15878,
++ 16135,16394,16656,16920,17187,17456,17727,18001,
++ 18277,18556,18837,19121,19407,19696,19987,20281,
++ 20577,20876,21177,21481,21787,22096,22407,22721,
++ 23038,23357,23678,24002,24329,24658,24990,25325,
++ 25662,26001,26344,26688,27036,27386,27739,28094,
++ 28452,28813,29176,29542,29911,30282,30656,31033,
++ 31412,31794,32179,32567,32957,33350,33745,34143,
++ 34544,34948,35355,35764,36176,36591,37008,37429,
++ 37852,38278,38706,39138,39572,40009,40449,40891,
++ 41337,41785,42236,42690,43147,43606,44069,44534,
++ 45002,45473,45947,46423,46903,47385,47871,48359,
++ 48850,49344,49841,50341,50844,51349,51858,52369,
++ 52884,53401,53921,54445,54971,55500,56032,56567,
++ 57105,57646,58190,58737,59287,59840,60396,60955,
++ 61517,62082,62650,63221,63795,64372,64952,65535
++};
++#endif /* SIMPLIFIED_READ */
++
++/* The base/delta tables are required for both read and write (but currently
++ * only the simplified versions.)
++ */
++const png_uint_16 png_sRGB_base[512] =
++{
++ 128,1782,3383,4644,5675,6564,7357,8074,
++ 8732,9346,9921,10463,10977,11466,11935,12384,
++ 12816,13233,13634,14024,14402,14769,15125,15473,
++ 15812,16142,16466,16781,17090,17393,17690,17981,
++ 18266,18546,18822,19093,19359,19621,19879,20133,
++ 20383,20630,20873,21113,21349,21583,21813,22041,
++ 22265,22487,22707,22923,23138,23350,23559,23767,
++ 23972,24175,24376,24575,24772,24967,25160,25352,
++ 25542,25730,25916,26101,26284,26465,26645,26823,
++ 27000,27176,27350,27523,27695,27865,28034,28201,
++ 28368,28533,28697,28860,29021,29182,29341,29500,
++ 29657,29813,29969,30123,30276,30429,30580,30730,
++ 30880,31028,31176,31323,31469,31614,31758,31902,
++ 32045,32186,32327,32468,32607,32746,32884,33021,
++ 33158,33294,33429,33564,33697,33831,33963,34095,
++ 34226,34357,34486,34616,34744,34873,35000,35127,
++ 35253,35379,35504,35629,35753,35876,35999,36122,
++ 36244,36365,36486,36606,36726,36845,36964,37083,
++ 37201,37318,37435,37551,37668,37783,37898,38013,
++ 38127,38241,38354,38467,38580,38692,38803,38915,
++ 39026,39136,39246,39356,39465,39574,39682,39790,
++ 39898,40005,40112,40219,40325,40431,40537,40642,
++ 40747,40851,40955,41059,41163,41266,41369,41471,
++ 41573,41675,41777,41878,41979,42079,42179,42279,
++ 42379,42478,42577,42676,42775,42873,42971,43068,
++ 43165,43262,43359,43456,43552,43648,43743,43839,
++ 43934,44028,44123,44217,44311,44405,44499,44592,
++ 44685,44778,44870,44962,45054,45146,45238,45329,
++ 45420,45511,45601,45692,45782,45872,45961,46051,
++ 46140,46229,46318,46406,46494,46583,46670,46758,
++ 46846,46933,47020,47107,47193,47280,47366,47452,
++ 47538,47623,47709,47794,47879,47964,48048,48133,
++ 48217,48301,48385,48468,48552,48635,48718,48801,
++ 48884,48966,49048,49131,49213,49294,49376,49458,
++ 49539,49620,49701,49782,49862,49943,50023,50103,
++ 50183,50263,50342,50422,50501,50580,50659,50738,
++ 50816,50895,50973,51051,51129,51207,51285,51362,
++ 51439,51517,51594,51671,51747,51824,51900,51977,
++ 52053,52129,52205,52280,52356,52432,52507,52582,
++ 52657,52732,52807,52881,52956,53030,53104,53178,
++ 53252,53326,53400,53473,53546,53620,53693,53766,
++ 53839,53911,53984,54056,54129,54201,54273,54345,
++ 54417,54489,54560,54632,54703,54774,54845,54916,
++ 54987,55058,55129,55199,55269,55340,55410,55480,
++ 55550,55620,55689,55759,55828,55898,55967,56036,
++ 56105,56174,56243,56311,56380,56448,56517,56585,
++ 56653,56721,56789,56857,56924,56992,57059,57127,
++ 57194,57261,57328,57395,57462,57529,57595,57662,
++ 57728,57795,57861,57927,57993,58059,58125,58191,
++ 58256,58322,58387,58453,58518,58583,58648,58713,
++ 58778,58843,58908,58972,59037,59101,59165,59230,
++ 59294,59358,59422,59486,59549,59613,59677,59740,
++ 59804,59867,59930,59993,60056,60119,60182,60245,
++ 60308,60370,60433,60495,60558,60620,60682,60744,
++ 60806,60868,60930,60992,61054,61115,61177,61238,
++ 61300,61361,61422,61483,61544,61605,61666,61727,
++ 61788,61848,61909,61969,62030,62090,62150,62211,
++ 62271,62331,62391,62450,62510,62570,62630,62689,
++ 62749,62808,62867,62927,62986,63045,63104,63163,
++ 63222,63281,63340,63398,63457,63515,63574,63632,
++ 63691,63749,63807,63865,63923,63981,64039,64097,
++ 64155,64212,64270,64328,64385,64443,64500,64557,
++ 64614,64672,64729,64786,64843,64900,64956,65013,
++ 65070,65126,65183,65239,65296,65352,65409,65465
++};
++
++const png_byte png_sRGB_delta[512] =
++{
++ 207,201,158,129,113,100,90,82,77,72,68,64,61,59,56,54,
++ 52,50,49,47,46,45,43,42,41,40,39,39,38,37,36,36,
++ 35,34,34,33,33,32,32,31,31,30,30,30,29,29,28,28,
++ 28,27,27,27,27,26,26,26,25,25,25,25,24,24,24,24,
++ 23,23,23,23,23,22,22,22,22,22,22,21,21,21,21,21,
++ 21,20,20,20,20,20,20,20,20,19,19,19,19,19,19,19,
++ 19,18,18,18,18,18,18,18,18,18,18,17,17,17,17,17,
++ 17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,
++ 16,16,16,16,15,15,15,15,15,15,15,15,15,15,15,15,
++ 15,15,15,15,14,14,14,14,14,14,14,14,14,14,14,14,
++ 14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,
++ 13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,
++ 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
++ 12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11,
++ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
++ 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
++ 11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
++ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
++ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
++ 10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
++ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
++ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
++ 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
++ 9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,
++ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
++ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
++ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
++};
++#endif /* SIMPLIFIED READ/WRITE sRGB support */
++
++/* SIMPLIFIED READ/WRITE SUPPORT */
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++static int
++png_image_free_function(png_voidp argument)
++{
++ png_imagep image = png_voidcast(png_imagep, argument);
++ png_controlp cp = image->opaque;
++ png_control c;
++
++ /* Double check that we have a png_ptr - it should be impossible to get here
++ * without one.
++ */
++ if (cp->png_ptr == NULL)
++ return 0;
++
++ /* First free any data held in the control structure. */
++# ifdef PNG_STDIO_SUPPORTED
++ if (cp->owned_file != 0)
++ {
++ FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr);
++ cp->owned_file = 0;
++
++ /* Ignore errors here. */
++ if (fp != NULL)
++ {
++ cp->png_ptr->io_ptr = NULL;
++ (void)fclose(fp);
++ }
++ }
++# endif
++
++ /* Copy the control structure so that the original, allocated, version can be
++ * safely freed. Notice that a png_error here stops the remainder of the
++ * cleanup, but this is probably fine because that would indicate bad memory
++ * problems anyway.
++ */
++ c = *cp;
++ image->opaque = &c;
++ png_free(c.png_ptr, cp);
++
++ /* Then the structures, calling the correct API. */
++ if (c.for_write != 0)
++ {
++# ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
++ png_destroy_write_struct(&c.png_ptr, &c.info_ptr);
++# else
++ png_error(c.png_ptr, "simplified write not supported");
++# endif
++ }
++ else
++ {
++# ifdef PNG_SIMPLIFIED_READ_SUPPORTED
++ png_destroy_read_struct(&c.png_ptr, &c.info_ptr, NULL);
++# else
++ png_error(c.png_ptr, "simplified read not supported");
++# endif
++ }
++
++ /* Success. */
++ return 1;
++}
++
++void PNGAPI
++png_image_free(png_imagep image)
++{
++ /* Safely call the real function, but only if doing so is safe at this point
++ * (if not inside an error handling context). Otherwise assume
++ * png_safe_execute will call this API after the return.
++ */
++ if (image != NULL && image->opaque != NULL &&
++ image->opaque->error_buf == NULL)
++ {
++ /* Ignore errors here: */
++ (void)png_safe_execute(image, png_image_free_function, image);
++ image->opaque = NULL;
++ }
++}
++
++int /* PRIVATE */
++png_image_error(png_imagep image, png_const_charp error_message)
++{
++ /* Utility to log an error. */
++ png_safecat(image->message, (sizeof image->message), 0, error_message);
++ image->warning_or_error |= PNG_IMAGE_ERROR;
++ png_image_free(image);
++ return 0;
++}
++
++#endif /* SIMPLIFIED READ/WRITE */
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/png.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/png.h Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * libpng version 1.5.4 - July 7, 2011
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * libpng version 1.6.16, December 22, 2014
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -39,7 +39,7 @@
+ * Authors and maintainers:
+ * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
+ * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
+- * libpng versions 0.97, January 1998, through 1.5.4 - July 7, 2011: Glenn
++ * libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
+ * See also "Contributing Authors", below.
+ *
+ * Note about libpng version numbers:
+@@ -185,6 +185,61 @@
+ * 1.5.4beta01-08 15 10504 15.so.15.4[.0]
+ * 1.5.4rc01 15 10504 15.so.15.4[.0]
+ * 1.5.4 15 10504 15.so.15.4[.0]
++ * 1.5.5beta01-08 15 10505 15.so.15.5[.0]
++ * 1.5.5rc01 15 10505 15.so.15.5[.0]
++ * 1.5.5 15 10505 15.so.15.5[.0]
++ * 1.5.6beta01-07 15 10506 15.so.15.6[.0]
++ * 1.5.6rc01-03 15 10506 15.so.15.6[.0]
++ * 1.5.6 15 10506 15.so.15.6[.0]
++ * 1.5.7beta01-05 15 10507 15.so.15.7[.0]
++ * 1.5.7rc01-03 15 10507 15.so.15.7[.0]
++ * 1.5.7 15 10507 15.so.15.7[.0]
++ * 1.6.0beta01-40 16 10600 16.so.16.0[.0]
++ * 1.6.0rc01-08 16 10600 16.so.16.0[.0]
++ * 1.6.0 16 10600 16.so.16.0[.0]
++ * 1.6.1beta01-09 16 10601 16.so.16.1[.0]
++ * 1.6.1rc01 16 10601 16.so.16.1[.0]
++ * 1.6.1 16 10601 16.so.16.1[.0]
++ * 1.6.2beta01 16 10602 16.so.16.2[.0]
++ * 1.6.2rc01-06 16 10602 16.so.16.2[.0]
++ * 1.6.2 16 10602 16.so.16.2[.0]
++ * 1.6.3beta01-11 16 10603 16.so.16.3[.0]
++ * 1.6.3rc01 16 10603 16.so.16.3[.0]
++ * 1.6.3 16 10603 16.so.16.3[.0]
++ * 1.6.4beta01-02 16 10604 16.so.16.4[.0]
++ * 1.6.4rc01 16 10604 16.so.16.4[.0]
++ * 1.6.4 16 10604 16.so.16.4[.0]
++ * 1.6.5 16 10605 16.so.16.5[.0]
++ * 1.6.6 16 10606 16.so.16.6[.0]
++ * 1.6.7beta01-04 16 10607 16.so.16.7[.0]
++ * 1.6.7rc01-03 16 10607 16.so.16.7[.0]
++ * 1.6.7 16 10607 16.so.16.7[.0]
++ * 1.6.8beta01-02 16 10608 16.so.16.8[.0]
++ * 1.6.8rc01-02 16 10608 16.so.16.8[.0]
++ * 1.6.8 16 10608 16.so.16.8[.0]
++ * 1.6.9beta01-04 16 10609 16.so.16.9[.0]
++ * 1.6.9rc01-02 16 10609 16.so.16.9[.0]
++ * 1.6.9 16 10609 16.so.16.9[.0]
++ * 1.6.10beta01-03 16 10610 16.so.16.10[.0]
++ * 1.6.10rc01-03 16 10610 16.so.16.10[.0]
++ * 1.6.10 16 10610 16.so.16.10[.0]
++ * 1.6.11beta01-06 16 10611 16.so.16.11[.0]
++ * 1.6.11rc01-02 16 10611 16.so.16.11[.0]
++ * 1.6.11 16 10611 16.so.16.11[.0]
++ * 1.6.12rc01-03 16 10612 16.so.16.12[.0]
++ * 1.6.12 16 10612 16.so.16.12[.0]
++ * 1.6.13beta01-04 16 10613 16.so.16.13[.0]
++ * 1.6.13rc01-02 16 10613 16.so.16.13[.0]
++ * 1.6.13 16 10613 16.so.16.13[.0]
++ * 1.6.14beta01-07 16 10614 16.so.16.14[.0]
++ * 1.6.14rc01-02 16 10614 16.so.16.14[.0]
++ * 1.6.14 16 10614 16.so.16.14[.0]
++ * 1.6.15beta01-08 16 10615 16.so.16.15[.0]
++ * 1.6.15rc01-03 16 10615 16.so.16.15[.0]
++ * 1.6.15 16 10615 16.so.16.15[.0]
++ * 1.6.16beta01-03 16 10616 16.so.16.16[.0]
++ * 1.6.16rc01-02 16 10616 16.so.16.16[.0]
++ * 1.6.16 16 10616 16.so.16.16[.0]
+ *
+ * Henceforth the source version will match the shared-library major
+ * and minor numbers; the shared-library major version number will be
+@@ -194,7 +249,7 @@
+ * to the source version x.y.z (leading zeros in y and z). Beta versions
+ * were given the previous public release number plus a letter, until
+ * version 1.0.6j; from then on they were given the upcoming public
+- * release number plus "betaNN" or "rcN".
++ * release number plus "betaNN" or "rcNN".
+ *
+ * Binary incompatibility exists only when applications make direct access
+ * to the info_ptr or png_ptr members through png.h, and the compiled
+@@ -216,8 +271,8 @@
+ *
+ * This code is released under the libpng license.
+ *
+- * libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
+- * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
++ * libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
++ * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+ * distributed according to the same disclaimer and license as libpng-1.2.5
+ * with the following individual added to the list of Contributing Authors:
+ *
+@@ -328,28 +383,30 @@
+ * Y2K compliance in libpng:
+ * =========================
+ *
+- * July 7, 2011
++ * December 22, 2014
+ *
+ * Since the PNG Development group is an ad-hoc body, we can't make
+ * an official declaration.
+ *
+ * This is your unofficial assurance that libpng from version 0.71 and
+- * upward through 1.5.4 are Y2K compliant. It is my belief that
++ * upward through 1.6.16 are Y2K compliant. It is my belief that
+ * earlier versions were also Y2K compliant.
+ *
+ * Libpng only has two year fields. One is a 2-byte unsigned integer
+- * that will hold years up to 65535. The other holds the date in text
+- * format, and will hold years up to 9999.
++ * that will hold years up to 65535. The other, which is deprecated,
++ * holds the date in text format, and will hold years up to 9999.
+ *
+ * The integer is
+ * "png_uint_16 year" in png_time_struct.
+ *
+ * The string is
+- * "png_char time_buffer" in png_struct
++ * "char time_buffer[29]" in png_struct. This is no longer used
++ * in libpng-1.6.x and will be removed from libpng-1.7.0.
+ *
+ * There are seven time-related functions:
+- * png.c: png_convert_to_rfc_1123() in png.c
+- * (formerly png_convert_to_rfc_1152() in error)
++ * png.c: png_convert_to_rfc_1123_buffer() in png.c
++ * (formerly png_convert_to_rfc_1123() prior to libpng-1.5.x and
++ * png_convert_to_rfc_1152() in error prior to libpng-0.98)
+ * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
+ * png_convert_from_time_t() in pngwrite.c
+ * png_get_tIME() in pngget.c
+@@ -360,8 +417,8 @@
+ * All handle dates properly in a Y2K environment. The
+ * png_convert_from_time_t() function calls gmtime() to convert from system
+ * clock time, which returns (year - 1900), which we properly convert to
+- * the full 4-digit year. There is a possibility that applications using
+- * libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
++ * the full 4-digit year. There is a possibility that libpng applications
++ * are not passing 4-digit years into the png_convert_to_rfc_1123_buffer()
+ * function, or that they are incorrectly passing only a 2-digit year
+ * instead of "year - 1900" into the png_convert_from_struct_tm() function,
+ * but this is not under our control. The libpng documentation has always
+@@ -385,21 +442,27 @@
+ /* This is not the place to learn how to use libpng. The file libpng-manual.txt
+ * describes how to use libpng, and the file example.c summarizes it
+ * with some code on which to build. This file is useful for looking
+- * at the actual function definitions and structure components.
++ * at the actual function definitions and structure components. If that
++ * file has been stripped from your copy of libpng, you can find it at
++ * <http://www.libpng.org/pub/png/libpng-manual.txt>
++ *
++ * If you just need to read a PNG file and don't want to read the documentation
++ * skip to the end of this file and read the section entitled 'simplified API'.
+ */
+
+ /* Version information for png.h - this should match the version in png.c */
+-#define PNG_LIBPNG_VER_STRING "1.5.4"
++#define PNG_LIBPNG_VER_STRING "1.6.16"
+ #define PNG_HEADER_VERSION_STRING \
+- " libpng version 1.5.4 - July 7, 2011\n"
+-
+-#define PNG_LIBPNG_VER_SONUM 15
+-#define PNG_LIBPNG_VER_DLLNUM 15
++ " libpng version 1.6.16 - December 22, 2014\n"
++
++#define PNG_LIBPNG_VER_SONUM 16
++#define PNG_LIBPNG_VER_DLLNUM 16
+
+ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
+ #define PNG_LIBPNG_VER_MAJOR 1
+-#define PNG_LIBPNG_VER_MINOR 5
+-#define PNG_LIBPNG_VER_RELEASE 4
++#define PNG_LIBPNG_VER_MINOR 6
++#define PNG_LIBPNG_VER_RELEASE 16
++
+ /* This should match the numeric part of the final component of
+ * PNG_LIBPNG_VER_STRING, omitting any leading zero:
+ */
+@@ -421,7 +484,7 @@
+ #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
+ PNG_LIBPNG_BUILD_PRIVATE */
+
+-#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
++#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
+
+ /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
+ * We must not include leading zeros.
+@@ -429,7 +492,7 @@
+ * version 1.0.0 was mis-numbered 100 instead of 10000). From
+ * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
+ */
+-#define PNG_LIBPNG_VER 10504 /* 1.5.4 */
++#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
+
+ /* Library configuration: these options cannot be changed after
+ * the library has been built.
+@@ -442,25 +505,7 @@
+ #endif
+
+ #ifndef PNG_VERSION_INFO_ONLY
+-# ifndef PNG_BUILDING_SYMBOL_TABLE
+- /*
+- * Standard header files (not needed for the version info or while
+- * building symbol table -- see scripts/pnglibconf.dfa)
+- */
+-# ifdef PNG_SETJMP_SUPPORTED
+-# include <setjmp.h>
+-# endif
+-
+- /* Need the time information for converting tIME chunks, it
+- * defines struct tm:
+- */
+-# ifdef PNG_CONVERT_tIME_SUPPORTED
+- /* "time.h" functions are not supported on all operating systems */
+-# include <time.h>
+-# endif
+-# endif
+-
+-/* Machine specific configuration. */
++ /* Machine specific configuration. */
+ # include "pngconf.h"
+ #endif
+
+@@ -509,6 +554,7 @@
+ * 2. Type definitions (base types are defined in pngconf.h), structure
+ * definitions.
+ * 3. Exported library functions.
++ * 4. Simplified API.
+ *
+ * The library source code has additional files (principally pngpriv.h) that
+ * allow configuration of the library.
+@@ -551,7 +597,48 @@
+ /* This triggers a compiler error in png.c, if png.c and png.h
+ * do not agree upon the version number.
+ */
+-typedef char* png_libpng_version_1_5_4;
++typedef char* png_libpng_version_1_6_16;
++
++/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
++ *
++ * png_struct is the cache of information used while reading or writing a single
++ * PNG file. One of these is always required, although the simplified API
++ * (below) hides the creation and destruction of it.
++ */
++typedef struct png_struct_def png_struct;
++typedef const png_struct * png_const_structp;
++typedef png_struct * png_structp;
++typedef png_struct * * png_structpp;
++
++/* png_info contains information read from or to be written to a PNG file. One
++ * or more of these must exist while reading or creating a PNG file. The
++ * information is not used by libpng during read but is used to control what
++ * gets written when a PNG file is created. "png_get_" function calls read
++ * information during read and "png_set_" functions calls write information
++ * when creating a PNG.
++ * been moved into a separate header file that is not accessible to
++ * applications. Read libpng-manual.txt or libpng.3 for more info.
++ */
++typedef struct png_info_def png_info;
++typedef png_info * png_infop;
++typedef const png_info * png_const_infop;
++typedef png_info * * png_infopp;
++
++/* Types with names ending 'p' are pointer types. The corresponding types with
++ * names ending 'rp' are identical pointer types except that the pointer is
++ * marked 'restrict', which means that it is the only pointer to the object
++ * passed to the function. Applications should not use the 'restrict' types;
++ * it is always valid to pass 'p' to a pointer with a function argument of the
++ * corresponding 'rp' type. Different compilers have different rules with
++ * regard to type matching in the presence of 'restrict'. For backward
++ * compatibility libpng callbacks never have 'restrict' in their parameters and,
++ * consequentially, writing portable application code is extremely difficult if
++ * an attempt is made to use 'restrict'.
++ */
++typedef png_struct * PNG_RESTRICT png_structrp;
++typedef const png_struct * PNG_RESTRICT png_const_structrp;
++typedef png_info * PNG_RESTRICT png_inforp;
++typedef const png_info * PNG_RESTRICT png_const_inforp;
+
+ /* Three color definitions. The order of the red, green, and blue, (and the
+ * exact size) is not important, although the size of the fields need to
+@@ -563,9 +650,9 @@
+ png_byte green;
+ png_byte blue;
+ } png_color;
+-typedef png_color FAR * png_colorp;
+-typedef PNG_CONST png_color FAR * png_const_colorp;
+-typedef png_color FAR * FAR * png_colorpp;
++typedef png_color * png_colorp;
++typedef const png_color * png_const_colorp;
++typedef png_color * * png_colorpp;
+
+ typedef struct png_color_16_struct
+ {
+@@ -575,9 +662,9 @@
+ png_uint_16 blue;
+ png_uint_16 gray; /* for use in grayscale files */
+ } png_color_16;
+-typedef png_color_16 FAR * png_color_16p;
+-typedef PNG_CONST png_color_16 FAR * png_const_color_16p;
+-typedef png_color_16 FAR * FAR * png_color_16pp;
++typedef png_color_16 * png_color_16p;
++typedef const png_color_16 * png_const_color_16p;
++typedef png_color_16 * * png_color_16pp;
+
+ typedef struct png_color_8_struct
+ {
+@@ -587,9 +674,9 @@
+ png_byte gray; /* for use in grayscale files */
+ png_byte alpha; /* for alpha channel files */
+ } png_color_8;
+-typedef png_color_8 FAR * png_color_8p;
+-typedef PNG_CONST png_color_8 FAR * png_const_color_8p;
+-typedef png_color_8 FAR * FAR * png_color_8pp;
++typedef png_color_8 * png_color_8p;
++typedef const png_color_8 * png_const_color_8p;
++typedef png_color_8 * * png_color_8pp;
+
+ /*
+ * The following two structures are used for the in-core representation
+@@ -603,9 +690,9 @@
+ png_uint_16 alpha;
+ png_uint_16 frequency;
+ } png_sPLT_entry;
+-typedef png_sPLT_entry FAR * png_sPLT_entryp;
+-typedef PNG_CONST png_sPLT_entry FAR * png_const_sPLT_entryp;
+-typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
++typedef png_sPLT_entry * png_sPLT_entryp;
++typedef const png_sPLT_entry * png_const_sPLT_entryp;
++typedef png_sPLT_entry * * png_sPLT_entrypp;
+
+ /* When the depth of the sPLT palette is 8 bits, the color and alpha samples
+ * occupy the LSB of their respective members, and the MSB of each member
+@@ -619,18 +706,27 @@
+ png_sPLT_entryp entries; /* palette entries */
+ png_int_32 nentries; /* number of palette entries */
+ } png_sPLT_t;
+-typedef png_sPLT_t FAR * png_sPLT_tp;
+-typedef PNG_CONST png_sPLT_t FAR * png_const_sPLT_tp;
+-typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
++typedef png_sPLT_t * png_sPLT_tp;
++typedef const png_sPLT_t * png_const_sPLT_tp;
++typedef png_sPLT_t * * png_sPLT_tpp;
+
+ #ifdef PNG_TEXT_SUPPORTED
+ /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
+ * and whether that contents is compressed or not. The "key" field
+- * points to a regular zero-terminated C string. The "text", "lang", and
+- * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
++ * points to a regular zero-terminated C string. The "text" fields can be a
++ * regular C string, an empty string, or a NULL pointer.
+ * However, the structure returned by png_get_text() will always contain
+- * regular zero-terminated C strings (possibly empty), never NULL pointers,
+- * so they can be safely used in printf() and other string-handling functions.
++ * the "text" field as a regular zero-terminated C string (possibly
++ * empty), never a NULL pointer, so it can be safely used in printf() and
++ * other string-handling functions. Note that the "itxt_length", "lang", and
++ * "lang_key" members of the structure only exist when the library is built
++ * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by
++ * default without iTXt support. Also note that when iTXt *is* supported,
++ * the "lang" and "lang_key" fields contain NULL pointers when the
++ * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or
++ * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the
++ * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag"
++ * which is always 0 or 1, or its "compression method" which is always 0.
+ */
+ typedef struct png_text_struct
+ {
+@@ -649,9 +745,9 @@
+ png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
+ chars or a NULL pointer */
+ } png_text;
+-typedef png_text FAR * png_textp;
+-typedef PNG_CONST png_text FAR * png_const_textp;
+-typedef png_text FAR * FAR * png_textpp;
++typedef png_text * png_textp;
++typedef const png_text * png_const_textp;
++typedef png_text * * png_textpp;
+ #endif
+
+ /* Supported compression types for text in PNG files (tEXt, and zTXt).
+@@ -679,49 +775,45 @@
+ png_byte minute; /* minute of hour, 0 - 59 */
+ png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
+ } png_time;
+-typedef png_time FAR * png_timep;
+-typedef PNG_CONST png_time FAR * png_const_timep;
+-typedef png_time FAR * FAR * png_timepp;
+-
+-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+- defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
++typedef png_time * png_timep;
++typedef const png_time * png_const_timep;
++typedef png_time * * png_timepp;
++
++#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
++ defined(PNG_USER_CHUNKS_SUPPORTED)
+ /* png_unknown_chunk is a structure to hold queued chunks for which there is
+ * no specific support. The idea is that we can use this to queue
+ * up private chunks for output even though the library doesn't actually
+ * know about their semantics.
++ *
++ * The data in the structure is set by libpng on read and used on write.
+ */
+ typedef struct png_unknown_chunk_t
+ {
+- png_byte name[5];
+- png_byte *data;
++ png_byte name[5]; /* Textual chunk name with '\0' terminator */
++ png_byte *data; /* Data, should not be modified on read! */
+ png_size_t size;
+
+- /* libpng-using applications should NOT directly modify this byte. */
++ /* On write 'location' must be set using the flag values listed below.
++ * Notice that on read it is set by libpng however the values stored have
++ * more bits set than are listed below. Always treat the value as a
++ * bitmask. On write set only one bit - setting multiple bits may cause the
++ * chunk to be written in multiple places.
++ */
+ png_byte location; /* mode of operation at read time */
+ }
+-
+-
+ png_unknown_chunk;
+-typedef png_unknown_chunk FAR * png_unknown_chunkp;
+-typedef PNG_CONST png_unknown_chunk FAR * png_const_unknown_chunkp;
+-typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
++
++typedef png_unknown_chunk * png_unknown_chunkp;
++typedef const png_unknown_chunk * png_const_unknown_chunkp;
++typedef png_unknown_chunk * * png_unknown_chunkpp;
+ #endif
+
+-/* Values for the unknown chunk location byte */
+-
++/* Flag values for the unknown chunk location byte. */
+ #define PNG_HAVE_IHDR 0x01
+ #define PNG_HAVE_PLTE 0x02
+ #define PNG_AFTER_IDAT 0x08
+
+-/* The complete definition of png_info has, as of libpng-1.5.0,
+- * been moved into a separate header file that is not accessible to
+- * applications. Read libpng-manual.txt or libpng.3 for more info.
+- */
+-typedef struct png_info_def png_info;
+-typedef png_info FAR * png_infop;
+-typedef PNG_CONST png_info FAR * png_const_infop;
+-typedef png_info FAR * FAR * png_infopp;
+-
+ /* Maximum positive integer used in PNG is (2^31)-1 */
+ #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
+ #define PNG_UINT_32_MAX ((png_uint_32)(-1))
+@@ -821,7 +913,7 @@
+ #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
+ #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
+ #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
+-#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
++#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
+
+ /* This is used for the transformation routines, as some of them
+ * change these values for the row. It also should enable using
+@@ -837,16 +929,8 @@
+ png_byte pixel_depth; /* bits per pixel (depth * channels) */
+ } png_row_info;
+
+-typedef png_row_info FAR * png_row_infop;
+-typedef png_row_info FAR * FAR * png_row_infopp;
+-
+-/* The complete definition of png_struct has, as of libpng-1.5.0,
+- * been moved into a separate header file that is not accessible to
+- * applications. Read libpng-manual.txt or libpng.3 for more info.
+- */
+-typedef struct png_struct_def png_struct;
+-typedef PNG_CONST png_struct FAR * png_const_structp;
+-typedef png_struct FAR * png_structp;
++typedef png_row_info * png_row_infop;
++typedef png_row_info * * png_row_infopp;
+
+ /* These are the function types for the I/O functions and for the functions
+ * that allow the user to override the default I/O functions with his or her
+@@ -893,7 +977,8 @@
+ png_unknown_chunkp));
+ #endif
+ #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+-typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp));
++/* not used anywhere */
++/* typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); */
+ #endif
+
+ #ifdef PNG_SETJMP_SUPPORTED
+@@ -949,8 +1034,6 @@
+ png_alloc_size_t));
+ typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
+
+-typedef png_struct FAR * FAR * png_structpp;
+-
+ /* Section 3: exported functions
+ * Here are the function definitions most commonly used. This is not
+ * the place to find out how to use libpng. See libpng-manual.txt for the
+@@ -986,7 +1069,7 @@
+ /* Tell lib we have already handled the first <num_bytes> magic bytes.
+ * Handling more than 8 bytes from the beginning of the file is an error.
+ */
+-PNG_EXPORT(2, void, png_set_sig_bytes, (png_structp png_ptr, int num_bytes));
++PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
+
+ /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
+ * PNG file. Returns zero if the supplied bytes match the 8-byte PNG
+@@ -1014,9 +1097,9 @@
+ PNG_ALLOCATED);
+
+ PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size,
+- (png_const_structp png_ptr));
+-
+-PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr,
++ (png_const_structrp png_ptr));
++
++PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
+ png_size_t size));
+
+ /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
+@@ -1030,10 +1113,10 @@
+ * allocated by the library - the call will return NULL on a mismatch
+ * indicating an ABI mismatch.
+ */
+-PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
++PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
+ png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
+ # define png_jmpbuf(png_ptr) \
+- (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))
++ (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
+ #else
+ # define png_jmpbuf(png_ptr) \
+ (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
+@@ -1043,12 +1126,12 @@
+ * will use it; otherwise it will call PNG_ABORT(). This function was
+ * added in libpng-1.5.0.
+ */
+-PNG_EXPORTA(9, void, png_longjmp, (png_structp png_ptr, int val),
++PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val),
+ PNG_NORETURN);
+
+ #ifdef PNG_READ_SUPPORTED
+ /* Reset the compression stream */
+-PNG_EXPORT(10, int, png_reset_zstream, (png_structp png_ptr));
++PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED);
+ #endif
+
+ /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
+@@ -1066,91 +1149,107 @@
+ #endif
+
+ /* Write the PNG file signature. */
+-PNG_EXPORT(13, void, png_write_sig, (png_structp png_ptr));
++PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr));
+
+ /* Write a PNG chunk - size, type, (optional) data, CRC. */
+-PNG_EXPORT(14, void, png_write_chunk, (png_structp png_ptr, png_const_bytep
++PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep
+ chunk_name, png_const_bytep data, png_size_t length));
+
+ /* Write the start of a PNG chunk - length and chunk name. */
+-PNG_EXPORT(15, void, png_write_chunk_start, (png_structp png_ptr,
++PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
+ png_const_bytep chunk_name, png_uint_32 length));
+
+ /* Write the data of a PNG chunk started with png_write_chunk_start(). */
+-PNG_EXPORT(16, void, png_write_chunk_data, (png_structp png_ptr,
++PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr,
+ png_const_bytep data, png_size_t length));
+
+ /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
+-PNG_EXPORT(17, void, png_write_chunk_end, (png_structp png_ptr));
++PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr));
+
+ /* Allocate and initialize the info structure */
+-PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_structp png_ptr),
++PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr),
+ PNG_ALLOCATED);
+
+-PNG_EXPORT(19, void, png_info_init_3, (png_infopp info_ptr,
+- png_size_t png_info_struct_size));
++/* DEPRECATED: this function allowed init structures to be created using the
++ * default allocation method (typically malloc). Use is deprecated in 1.6.0 and
++ * the API will be removed in the future.
++ */
++PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr,
++ png_size_t png_info_struct_size), PNG_DEPRECATED);
+
+ /* Writes all the PNG information before the image. */
+ PNG_EXPORT(20, void, png_write_info_before_PLTE,
+- (png_structp png_ptr, png_infop info_ptr));
++ (png_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(21, void, png_write_info,
+- (png_structp png_ptr, png_infop info_ptr));
++ (png_structrp png_ptr, png_const_inforp info_ptr));
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read the information before the actual image data. */
+ PNG_EXPORT(22, void, png_read_info,
+- (png_structp png_ptr, png_infop info_ptr));
++ (png_structrp png_ptr, png_inforp info_ptr));
+ #endif
+
+ #ifdef PNG_TIME_RFC1123_SUPPORTED
+-PNG_EXPORT(23, png_const_charp, png_convert_to_rfc1123,
+- (png_structp png_ptr,
++ /* Convert to a US string format: there is no localization support in this
++ * routine. The original implementation used a 29 character buffer in
++ * png_struct, this will be removed in future versions.
++ */
++#if PNG_LIBPNG_VER < 10700
++/* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */
++PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr,
++ png_const_timep ptime),PNG_DEPRECATED);
++#endif
++PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29],
+ png_const_timep ptime));
+ #endif
+
+ #ifdef PNG_CONVERT_tIME_SUPPORTED
+ /* Convert from a struct tm to png_time */
+ PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
+- PNG_CONST struct tm FAR * ttime));
++ const struct tm * ttime));
+
+ /* Convert from time_t to png_time. Uses gmtime() */
+-PNG_EXPORT(25, void, png_convert_from_time_t,
+- (png_timep ptime, time_t ttime));
+-#endif /* PNG_CONVERT_tIME_SUPPORTED */
++PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
++#endif /* CONVERT_tIME */
+
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+ /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
+-PNG_EXPORT(26, void, png_set_expand, (png_structp png_ptr));
+-PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structp png_ptr));
+-PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structp png_ptr));
+-PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structp png_ptr));
++PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr));
++PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr));
++PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr));
++PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+ /* Expand to 16-bit channels, forces conversion of palette to RGB and expansion
+ * of a tRNS chunk if present.
+ */
+-PNG_EXPORT(221, void, png_set_expand_16, (png_structp png_ptr));
++PNG_EXPORT(221, void, png_set_expand_16, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
+ /* Use blue, green, red order for pixels. */
+-PNG_EXPORT(30, void, png_set_bgr, (png_structp png_ptr));
++PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ /* Expand the grayscale to 24-bit RGB if necessary. */
+-PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structp png_ptr));
++PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ /* Reduce RGB to grayscale. */
+-PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr,
+- int error_action, double red, double green));
+-PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr,
+- int error_action, png_fixed_point red, png_fixed_point green));
+-
+-PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp
++#define PNG_ERROR_ACTION_NONE 1
++#define PNG_ERROR_ACTION_WARN 2
++#define PNG_ERROR_ACTION_ERROR 3
++#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
++
++PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr,
++ int error_action, double red, double green))
++PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr,
++ int error_action, png_fixed_point red, png_fixed_point green))
++
++PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp
+ png_ptr));
+ #endif
+
+@@ -1160,9 +1259,9 @@
+ #endif
+
+ #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+-/* How the alpha channel is interpreted - this affects how the color channels of
+- * a PNG file are returned when an alpha channel, or tRNS chunk in a palette
+- * file, is present.
++/* How the alpha channel is interpreted - this affects how the color channels
++ * of a PNG file are returned to the calling application when an alpha channel,
++ * or a tRNS chunk in a palette file, is present.
+ *
+ * This has no effect on the way pixels are written into a PNG output
+ * datastream. The color samples in a PNG datastream are never premultiplied
+@@ -1170,33 +1269,19 @@
+ *
+ * The default is to return data according to the PNG specification: the alpha
+ * channel is a linear measure of the contribution of the pixel to the
+- * corresponding composited pixel. The gamma encoded color channels must be
+- * scaled according to the contribution and to do this it is necessary to undo
++ * corresponding composited pixel, and the color channels are unassociated
++ * (not premultiplied). The gamma encoded color channels must be scaled
++ * according to the contribution and to do this it is necessary to undo
+ * the encoding, scale the color values, perform the composition and reencode
+ * the values. This is the 'PNG' mode.
+ *
+ * The alternative is to 'associate' the alpha with the color information by
+- * storing color channel values that have been scaled by the alpha. The
+- * advantage is that the color channels can be resampled (the image can be
+- * scaled) in this form. The disadvantage is that normal practice is to store
+- * linear, not (gamma) encoded, values and this requires 16-bit channels for
+- * still images rather than the 8-bit channels that are just about sufficient if
+- * gamma encoding is used. In addition all non-transparent pixel values,
+- * including completely opaque ones, must be gamma encoded to produce the final
+- * image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
+- * latter being the two common names for associated alpha color channels.)
++ * storing color channel values that have been scaled by the alpha.
++ * image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
++ * (the latter being the two common names for associated alpha color channels).
+ *
+- * Since it is not necessary to perform arithmetic on opaque color values so
+- * long as they are not to be resampled and are in the final color space it is
+- * possible to optimize the handling of alpha by storing the opaque pixels in
+- * the PNG format (adjusted for the output color space) while storing partially
+- * opaque pixels in the standard, linear, format. The accuracy required for
+- * standard alpha composition is relatively low, because the pixels are
+- * isolated, therefore typically the accuracy loss in storing 8-bit linear
+- * values is acceptable. (This is not true if the alpha channel is used to
+- * simulate transparency over large areas - use 16 bits or the PNG mode in
+- * this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
+- * treated as opaque only if the alpha value is equal to the maximum value.
++ * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
++ * value is equal to the maximum value.
+ *
+ * The final choice is to gamma encode the alpha channel as well. This is
+ * broken because, in practice, no implementation that uses this choice
+@@ -1215,76 +1300,15 @@
+ #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */
+ #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
+
+-PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode,
+- double output_gamma));
+-PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr,
+- int mode, png_fixed_point output_gamma));
++PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode,
++ double output_gamma))
++PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
++ int mode, png_fixed_point output_gamma))
+ #endif
+
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
++#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
+ /* The output_gamma value is a screen gamma in libpng terminology: it expresses
+- * how to decode the output values, not how they are encoded. The values used
+- * correspond to the normal numbers used to describe the overall gamma of a
+- * computer display system; for example 2.2 for an sRGB conformant system. The
+- * values are scaled by 100000 in the _fixed version of the API (so 220000 for
+- * sRGB.)
+- *
+- * The inverse of the value is always used to provide a default for the PNG file
+- * encoding if it has no gAMA chunk and if png_set_gamma() has not been called
+- * to override the PNG gamma information.
+- *
+- * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
+- * opaque pixels however pixels with lower alpha values are not encoded,
+- * regardless of the output gamma setting.
+- *
+- * When the standard Porter Duff handling is requested with mode 1 the output
+- * encoding is set to be linear and the output_gamma value is only relevant
+- * as a default for input data that has no gamma information. The linear output
+- * encoding will be overridden if png_set_gamma() is called - the results may be
+- * highly unexpected!
+- *
+- * The following numbers are derived from the sRGB standard and the research
+- * behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
+- * 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
+- * correction required to take account of any differences in the color
+- * environment of the original scene and the intended display environment; the
+- * value expresses how to *decode* the image for display, not how the original
+- * data was *encoded*.
+- *
+- * sRGB provides a peg for the PNG standard by defining a viewing environment.
+- * sRGB itself, and earlier TV standards, actually use a more complex transform
+- * (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
+- * limited to simple power laws.) By saying that an image for direct display on
+- * an sRGB conformant system should be stored with a gAMA chunk value of 45455
+- * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
+- * makes it possible to derive values for other display systems and
+- * environments.
+- *
+- * The Mac value is deduced from the sRGB based on an assumption that the actual
+- * extra viewing correction used in early Mac display systems was implemented as
+- * a power 1.45 lookup table.
+- *
+- * Any system where a programmable lookup table is used or where the behavior of
+- * the final display device characteristics can be changed requires system
+- * specific code to obtain the current characteristic. However this can be
+- * difficult and most PNG gamma correction only requires an approximate value.
+- *
+- * By default, if png_set_alpha_mode() is not called, libpng assumes that all
+- * values are unencoded, linear, values and that the output device also has a
+- * linear characteristic. This is only very rarely correct - it is invariably
+- * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
+- * default if you don't know what the right answer is!
+- *
+- * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
+- * 10.6) which used a correction table to implement a somewhat lower gamma on an
+- * otherwise sRGB system.
+- *
+- * Both these values are reserved (not simple gamma values) in order to allow
+- * more precise correction internally in the future.
+- *
+- * NOTE: the following values can be passed to either the fixed or floating
+- * point APIs, but the floating point API will also accept floating point
+- * values.
++ * how to decode the output values, not how they are encoded.
+ */
+ #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
+ #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
+@@ -1369,51 +1393,50 @@
+ */
+
+ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+-PNG_EXPORT(36, void, png_set_strip_alpha, (png_structp png_ptr));
++PNG_EXPORT(36, void, png_set_strip_alpha, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
+ defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+-PNG_EXPORT(37, void, png_set_swap_alpha, (png_structp png_ptr));
++PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
+ defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+-PNG_EXPORT(38, void, png_set_invert_alpha, (png_structp png_ptr));
++PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
+ /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
+-PNG_EXPORT(39, void, png_set_filler, (png_structp png_ptr, png_uint_32 filler,
++PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
+ int flags));
+ /* The values of the PNG_FILLER_ defines should NOT be changed */
+ # define PNG_FILLER_BEFORE 0
+ # define PNG_FILLER_AFTER 1
+ /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
+-PNG_EXPORT(40, void, png_set_add_alpha,
+- (png_structp png_ptr, png_uint_32 filler,
+- int flags));
+-#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
++PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
++ png_uint_32 filler, int flags));
++#endif /* READ_FILLER || WRITE_FILLER */
+
+ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
+ /* Swap bytes in 16-bit depth files. */
+-PNG_EXPORT(41, void, png_set_swap, (png_structp png_ptr));
++PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
+ /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
+-PNG_EXPORT(42, void, png_set_packing, (png_structp png_ptr));
++PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
+ defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+ /* Swap packing order of pixels in bytes. */
+-PNG_EXPORT(43, void, png_set_packswap, (png_structp png_ptr));
++PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
+ /* Converts files to legal bit depths. */
+-PNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p
++PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p
+ true_bits));
+ #endif
+
+@@ -1425,12 +1448,12 @@
+ * necessary to call png_read_row or png_read_rows png_get_image_height
+ * times for each pass.
+ */
+-PNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr));
++PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
+ /* Invert monochrome files */
+-PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr));
++PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+@@ -1439,12 +1462,12 @@
+ * read. Doing so will result in unexpected behavior and possible warnings or
+ * errors if the PNG file contains a bKGD chunk.
+ */
+-PNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr,
++PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr,
+ png_const_color_16p background_color, int background_gamma_code,
+- int need_expand, double background_gamma));
+-PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
++ int need_expand, double background_gamma))
++PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr,
+ png_const_color_16p background_color, int background_gamma_code,
+- int need_expand, png_fixed_point background_gamma));
++ int need_expand, png_fixed_point background_gamma))
+ #endif
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+ # define PNG_BACKGROUND_GAMMA_UNKNOWN 0
+@@ -1455,23 +1478,22 @@
+
+ #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ /* Scale a 16-bit depth file down to 8-bit, accurately. */
+-PNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr));
++PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+ #define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
+ /* Strip the second byte of information from a 16-bit depth file. */
+-PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
++PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_QUANTIZE_SUPPORTED
+ /* Turn on quantizing, and reduce the palette to the number of colors
+ * available.
+ */
+-PNG_EXPORT(49, void, png_set_quantize,
+- (png_structp png_ptr, png_colorp palette,
+- int num_palette, int maximum_colors, png_const_uint_16p histogram,
+- int full_quantize));
++PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr,
++ png_colorp palette, int num_palette, int maximum_colors,
++ png_const_uint_16p histogram, int full_quantize));
+ #endif
+
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+@@ -1491,71 +1513,69 @@
+ * API (floating point or fixed.) Notice, however, that the 'file_gamma' value
+ * is the inverse of a 'screen gamma' value.
+ */
+-PNG_FP_EXPORT(50, void, png_set_gamma,
+- (png_structp png_ptr, double screen_gamma,
+- double override_file_gamma));
+-PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr,
+- png_fixed_point screen_gamma, png_fixed_point override_file_gamma));
++PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr,
++ double screen_gamma, double override_file_gamma))
++PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr,
++ png_fixed_point screen_gamma, png_fixed_point override_file_gamma))
+ #endif
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ /* Set how many lines between output flushes - 0 for no flushing */
+-PNG_EXPORT(51, void, png_set_flush, (png_structp png_ptr, int nrows));
++PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows));
+ /* Flush the current PNG output buffer */
+-PNG_EXPORT(52, void, png_write_flush, (png_structp png_ptr));
++PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr));
+ #endif
+
+ /* Optional update palette with requested transformations */
+-PNG_EXPORT(53, void, png_start_read_image, (png_structp png_ptr));
++PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr));
+
+ /* Optional call to update the users info structure */
+-PNG_EXPORT(54, void, png_read_update_info,
+- (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(54, void, png_read_update_info, (png_structrp png_ptr,
++ png_inforp info_ptr));
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read one or more rows of image data. */
+-PNG_EXPORT(55, void, png_read_rows, (png_structp png_ptr, png_bytepp row,
++PNG_EXPORT(55, void, png_read_rows, (png_structrp png_ptr, png_bytepp row,
+ png_bytepp display_row, png_uint_32 num_rows));
+ #endif
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read a row of data. */
+-PNG_EXPORT(56, void, png_read_row, (png_structp png_ptr, png_bytep row,
++PNG_EXPORT(56, void, png_read_row, (png_structrp png_ptr, png_bytep row,
+ png_bytep display_row));
+ #endif
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read the whole image into memory at once. */
+-PNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image));
++PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image));
+ #endif
+
+ /* Write a row of image data */
+-PNG_EXPORT(58, void, png_write_row,
+- (png_structp png_ptr, png_const_bytep row));
++PNG_EXPORT(58, void, png_write_row, (png_structrp png_ptr,
++ png_const_bytep row));
+
+ /* Write a few rows of image data: (*row) is not written; however, the type
+ * is declared as writeable to maintain compatibility with previous versions
+ * of libpng and to allow the 'display_row' array from read_rows to be passed
+ * unchanged to write_rows.
+ */
+-PNG_EXPORT(59, void, png_write_rows, (png_structp png_ptr, png_bytepp row,
++PNG_EXPORT(59, void, png_write_rows, (png_structrp png_ptr, png_bytepp row,
+ png_uint_32 num_rows));
+
+ /* Write the image data */
+-PNG_EXPORT(60, void, png_write_image,
+- (png_structp png_ptr, png_bytepp image));
++PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image));
+
+ /* Write the end of the PNG file. */
+-PNG_EXPORT(61, void, png_write_end,
+- (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(61, void, png_write_end, (png_structrp png_ptr,
++ png_inforp info_ptr));
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read the end of the PNG file. */
+-PNG_EXPORT(62, void, png_read_end, (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr));
+ #endif
+
+ /* Free any memory associated with the png_info_struct */
+-PNG_EXPORT(63, void, png_destroy_info_struct, (png_structp png_ptr,
++PNG_EXPORT(63, void, png_destroy_info_struct, (png_const_structrp png_ptr,
+ png_infopp info_ptr_ptr));
+
+ /* Free any memory associated with the png_struct and the png_info_structs */
+@@ -1567,8 +1587,8 @@
+ png_infopp info_ptr_ptr));
+
+ /* Set the libpng method of handling chunk CRC errors */
+-PNG_EXPORT(66, void, png_set_crc_action,
+- (png_structp png_ptr, int crit_action, int ancil_action));
++PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
++ int ancil_action));
+
+ /* Values for png_set_crc_action() say how to handle CRC errors in
+ * ancillary and critical chunks, and whether to use the data contained
+@@ -1597,8 +1617,8 @@
+ /* Set the filtering method(s) used by libpng. Currently, the only valid
+ * value for "method" is 0.
+ */
+-PNG_EXPORT(67, void, png_set_filter,
+- (png_structp png_ptr, int method, int filters));
++PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
++ int filters));
+
+ /* Flags for png_set_filter() to say which filters to use. The flags
+ * are chosen so that they don't conflict with real filter types
+@@ -1653,14 +1673,14 @@
+ * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
+ * to the UNWEIGHTED method, but with added encoding time/computation.
+ */
+-PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr,
++PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
+ int heuristic_method, int num_weights, png_const_doublep filter_weights,
+- png_const_doublep filter_costs));
++ png_const_doublep filter_costs))
+ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
+- (png_structp png_ptr,
+- int heuristic_method, int num_weights, png_const_fixed_point_p
+- filter_weights, png_const_fixed_point_p filter_costs));
+-#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
++ (png_structrp png_ptr, int heuristic_method, int num_weights,
++ png_const_fixed_point_p filter_weights,
++ png_const_fixed_point_p filter_costs))
++#endif /* WRITE_WEIGHTED_FILTER */
+
+ /* Heuristic used for row filter selection. These defines should NOT be
+ * changed.
+@@ -1678,45 +1698,45 @@
+ * for PNG images, and do considerably fewer caclulations. In the future,
+ * these values may not correspond directly to the zlib compression levels.
+ */
+-PNG_EXPORT(69, void, png_set_compression_level,
+- (png_structp png_ptr, int level));
+-
+-PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structp png_ptr,
++PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
++ int level));
++
++PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr,
+ int mem_level));
+
+-PNG_EXPORT(71, void, png_set_compression_strategy, (png_structp png_ptr,
++PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr,
+ int strategy));
+
+ /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
+ * smaller value of window_bits if it can do so safely.
+ */
+-PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structp png_ptr,
++PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr,
+ int window_bits));
+
+-PNG_EXPORT(73, void, png_set_compression_method, (png_structp png_ptr,
++PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
+ int method));
+ #endif
+
+ #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
+ /* Also set zlib parameters for compressing non-IDAT chunks */
+-PNG_EXPORT(222, void, png_set_text_compression_level,
+- (png_structp png_ptr, int level));
+-
+-PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structp png_ptr,
++PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr,
++ int level));
++
++PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr,
+ int mem_level));
+
+-PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structp png_ptr,
++PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr,
+ int strategy));
+
+ /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
+ * smaller value of window_bits if it can do so safely.
+ */
+-PNG_EXPORT(225, void, png_set_text_compression_window_bits, (png_structp
+- png_ptr, int window_bits));
+-
+-PNG_EXPORT(226, void, png_set_text_compression_method, (png_structp png_ptr,
++PNG_EXPORT(225, void, png_set_text_compression_window_bits,
++ (png_structrp png_ptr, int window_bits));
++
++PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
+ int method));
+-#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
++#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
+
+ /* These next functions are called for input/output, memory, and error
+ * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
+@@ -1729,7 +1749,7 @@
+
+ #ifdef PNG_STDIO_SUPPORTED
+ /* Initialize the input/output for the PNG file to the default functions. */
+-PNG_EXPORT(74, void, png_init_io, (png_structp png_ptr, png_FILE_p fp));
++PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp));
+ #endif
+
+ /* Replace the (error and abort), and warning functions with user
+@@ -1740,12 +1760,11 @@
+ * default function will be used.
+ */
+
+-PNG_EXPORT(75, void, png_set_error_fn,
+- (png_structp png_ptr, png_voidp error_ptr,
+- png_error_ptr error_fn, png_error_ptr warning_fn));
++PNG_EXPORT(75, void, png_set_error_fn, (png_structrp png_ptr,
++ png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
+
+ /* Return the user pointer associated with the error functions */
+-PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr));
++PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr));
+
+ /* Replace the default data output functions with a user supplied one(s).
+ * If buffered output is not used, then output_flush_fn can be set to NULL.
+@@ -1757,47 +1776,47 @@
+ * default flush function, which uses the standard *FILE structure, will
+ * be used.
+ */
+-PNG_EXPORT(77, void, png_set_write_fn, (png_structp png_ptr, png_voidp io_ptr,
++PNG_EXPORT(77, void, png_set_write_fn, (png_structrp png_ptr, png_voidp io_ptr,
+ png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
+
+ /* Replace the default data input function with a user supplied one. */
+-PNG_EXPORT(78, void, png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr,
++PNG_EXPORT(78, void, png_set_read_fn, (png_structrp png_ptr, png_voidp io_ptr,
+ png_rw_ptr read_data_fn));
+
+ /* Return the user pointer associated with the I/O functions */
+-PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_structp png_ptr));
+-
+-PNG_EXPORT(80, void, png_set_read_status_fn, (png_structp png_ptr,
++PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr));
++
++PNG_EXPORT(80, void, png_set_read_status_fn, (png_structrp png_ptr,
+ png_read_status_ptr read_row_fn));
+
+-PNG_EXPORT(81, void, png_set_write_status_fn, (png_structp png_ptr,
++PNG_EXPORT(81, void, png_set_write_status_fn, (png_structrp png_ptr,
+ png_write_status_ptr write_row_fn));
+
+ #ifdef PNG_USER_MEM_SUPPORTED
+ /* Replace the default memory allocation functions with user supplied one(s). */
+-PNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr,
++PNG_EXPORT(82, void, png_set_mem_fn, (png_structrp png_ptr, png_voidp mem_ptr,
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+ /* Return the user pointer associated with the memory functions */
+-PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr));
++PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+-PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structp png_ptr,
++PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr,
+ png_user_transform_ptr read_user_transform_fn));
+ #endif
+
+ #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+-PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr,
++PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr,
+ png_user_transform_ptr write_user_transform_fn));
+ #endif
+
+ #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+-PNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr,
++PNG_EXPORT(86, void, png_set_user_transform_info, (png_structrp png_ptr,
+ png_voidp user_transform_ptr, int user_transform_depth,
+ int user_transform_channels));
+ /* Return the user pointer associated with the user transform functions */
+ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
+@@ -1812,31 +1831,53 @@
+ * find the output pixel (x,y) given an interlaced sub-image pixel
+ * (row,col,pass). (See below for these macros.)
+ */
+-PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp));
+-PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp));
++PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structrp));
++PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
+ #endif
+
++#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
++/* This callback is called only for *unknown* chunks. If
++ * PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known
++ * chunks to be treated as unknown, however in this case the callback must do
++ * any processing required by the chunk (e.g. by calling the appropriate
++ * png_set_ APIs.)
++ *
++ * There is no write support - on write, by default, all the chunks in the
++ * 'unknown' list are written in the specified position.
++ *
++ * The integer return from the callback function is interpreted thus:
++ *
++ * negative: An error occured, png_chunk_error will be called.
++ * zero: The chunk was not handled, the chunk will be saved. A critical
++ * chunk will cause an error at this point unless it is to be saved.
++ * positive: The chunk was handled, libpng will ignore/discard it.
++ *
++ * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about
++ * how this behavior will change in libpng 1.7
++ */
++PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
++ png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
++#endif
++
+ #ifdef PNG_USER_CHUNKS_SUPPORTED
+-PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr,
+- png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
+-PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr));
++PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr));
+ #endif
+
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+ /* Sets the function callbacks for the push reader, and a pointer to a
+ * user-defined structure available to the callback functions.
+ */
+-PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr,
++PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structrp png_ptr,
+ png_voidp progressive_ptr, png_progressive_info_ptr info_fn,
+ png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
+
+ /* Returns the user pointer associated with the push read functions */
+-PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr));
++PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
++ (png_const_structrp png_ptr));
+
+ /* Function to be called when data becomes available */
+-PNG_EXPORT(92, void, png_process_data,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_bytep buffer, png_size_t buffer_size));
++PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
++ png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size));
+
+ /* A function which may be called *only* within png_process_data to stop the
+ * processing of any more data. The function returns the number of bytes
+@@ -1845,7 +1886,7 @@
+ * 'save' is set to true the routine will first save all the pending data and
+ * will always return 0.
+ */
+-PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save));
++PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
+
+ /* A function which may be called *only* outside (after) a call to
+ * png_process_data. It returns the number of bytes of data to skip in the
+@@ -1853,40 +1894,43 @@
+ * application must skip than number of bytes of input data and pass the
+ * following data to the next call to png_process_data.
+ */
+-PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp));
++PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
+
+ /* Function that combines rows. 'new_row' is a flag that should come from
+ * the callback and be non-NULL if anything needs to be done; the library
+ * stores its own version of the new data internally and ignores the passed
+ * in value.
+ */
+-PNG_EXPORT(93, void, png_progressive_combine_row, (png_structp png_ptr,
++PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
+ png_bytep old_row, png_const_bytep new_row));
+-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+-
+-PNG_EXPORTA(94, png_voidp, png_malloc,
+- (png_structp png_ptr, png_alloc_size_t size),
+- PNG_ALLOCATED);
++#endif /* PROGRESSIVE_READ */
++
++PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
++ png_alloc_size_t size), PNG_ALLOCATED);
+ /* Added at libpng version 1.4.0 */
+-PNG_EXPORTA(95, png_voidp, png_calloc,
+- (png_structp png_ptr, png_alloc_size_t size),
+- PNG_ALLOCATED);
++PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr,
++ png_alloc_size_t size), PNG_ALLOCATED);
+
+ /* Added at libpng version 1.2.4 */
+-PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_structp png_ptr,
++PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr,
+ png_alloc_size_t size), PNG_ALLOCATED);
+
+ /* Frees a pointer allocated by png_malloc() */
+-PNG_EXPORT(97, void, png_free, (png_structp png_ptr, png_voidp ptr));
++PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
+
+ /* Free data that was allocated internally */
+-PNG_EXPORT(98, void, png_free_data,
+- (png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num));
++PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 free_me, int num));
+
+ /* Reassign responsibility for freeing existing data, whether allocated
+- * by libpng or by the application */
+-PNG_EXPORT(99, void, png_data_freer,
+- (png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask));
++ * by libpng or by the application; this works on the png_info structure passed
++ * in, it does not change the state for other png_info structures.
++ *
++ * It is unlikely that this function works correctly as of 1.6.0 and using it
++ * may result either in memory leaks or double free of allocated data.
++ */
++PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int freer, png_uint_32 mask));
+
+ /* Assignments for png_data_freer */
+ #define PNG_DESTROY_WILL_FREE_DATA 1
+@@ -1899,8 +1943,10 @@
+ #define PNG_FREE_ROWS 0x0040
+ #define PNG_FREE_PCAL 0x0080
+ #define PNG_FREE_SCAL 0x0100
+-#define PNG_FREE_UNKN 0x0200
+-#define PNG_FREE_LIST 0x0400
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++# define PNG_FREE_UNKN 0x0200
++#endif
++/* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */
+ #define PNG_FREE_PLTE 0x1000
+ #define PNG_FREE_TRNS 0x2000
+ #define PNG_FREE_TEXT 0x4000
+@@ -1908,50 +1954,55 @@
+ #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
+
+ #ifdef PNG_USER_MEM_SUPPORTED
+-PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_structp png_ptr,
+- png_alloc_size_t size), PNG_ALLOCATED);
+-PNG_EXPORT(101, void, png_free_default, (png_structp png_ptr, png_voidp ptr));
++PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
++ png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED);
++PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr,
++ png_voidp ptr), PNG_DEPRECATED);
+ #endif
+
+ #ifdef PNG_ERROR_TEXT_SUPPORTED
+ /* Fatal error in PNG image of libpng - can't continue */
+-PNG_EXPORTA(102, void, png_error,
+- (png_structp png_ptr, png_const_charp error_message),
+- PNG_NORETURN);
++PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr,
++ png_const_charp error_message), PNG_NORETURN);
+
+ /* The same, but the chunk name is prepended to the error string. */
+-PNG_EXPORTA(103, void, png_chunk_error, (png_structp png_ptr,
++PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
+ png_const_charp error_message), PNG_NORETURN);
+
+ #else
+ /* Fatal error in PNG image of libpng - can't continue */
+-PNG_EXPORTA(104, void, png_err, (png_structp png_ptr), PNG_NORETURN);
++PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
++# define png_error(s1,s2) png_err(s1)
++# define png_chunk_error(s1,s2) png_err(s1)
+ #endif
+
+ #ifdef PNG_WARNINGS_SUPPORTED
+ /* Non-fatal error in libpng. Can continue, but may have a problem. */
+-PNG_EXPORT(105, void, png_warning, (png_structp png_ptr,
++PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr,
+ png_const_charp warning_message));
+
+ /* Non-fatal error in libpng, chunk name is prepended to message. */
+-PNG_EXPORT(106, void, png_chunk_warning, (png_structp png_ptr,
++PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
+ png_const_charp warning_message));
++#else
++# define png_warning(s1,s2) ((void)(s1))
++# define png_chunk_warning(s1,s2) ((void)(s1))
+ #endif
+
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ /* Benign error in libpng. Can continue, but may have a problem.
+ * User can choose whether to handle as a fatal error or as a warning. */
+-# undef png_benign_error
+-PNG_EXPORT(107, void, png_benign_error, (png_structp png_ptr,
++PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr,
+ png_const_charp warning_message));
+
+-/* Same, chunk name is prepended to message. */
+-# undef png_chunk_benign_error
+-PNG_EXPORT(108, void, png_chunk_benign_error, (png_structp png_ptr,
++#ifdef PNG_READ_SUPPORTED
++/* Same, chunk name is prepended to message (only during read) */
++PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr,
+ png_const_charp warning_message));
++#endif
+
+ PNG_EXPORT(109, void, png_set_benign_errors,
+- (png_structp png_ptr, int allowed));
++ (png_structrp png_ptr, int allowed));
+ #else
+ # ifdef PNG_ALLOW_BENIGN_ERRORS
+ # define png_benign_error png_warning
+@@ -1975,268 +2026,274 @@
+ * png_info_struct.
+ */
+ /* Returns "flag" if chunk data is valid in info_ptr. */
+-PNG_EXPORT(110, png_uint_32, png_get_valid,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_uint_32 flag));
++PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, png_uint_32 flag));
+
+ /* Returns number of bytes needed to hold a transformed row. */
+-PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ /* Returns row_pointers, which is an array of pointers to scanlines that was
+ * returned from png_read_png().
+ */
+-PNG_EXPORT(112, png_bytepp, png_get_rows,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
++
+ /* Set row_pointers, which is an array of pointers to scanlines for use
+ * by png_write_png().
+ */
+-PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr,
+- png_infop info_ptr, png_bytepp row_pointers));
++PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_bytepp row_pointers));
+ #endif
+
+ /* Returns number of color channels in image. */
+-PNG_EXPORT(114, png_byte, png_get_channels,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ #ifdef PNG_EASY_ACCESS_SUPPORTED
+ /* Returns image width in pixels. */
+-PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image height in pixels. */
+-PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image bit_depth. */
+-PNG_EXPORT(117, png_byte, png_get_bit_depth,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image color_type. */
+-PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image filter_type. */
+-PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image interlace_type. */
+-PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image compression_type. */
+-PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
+
+ /* Returns image resolution in pixels per meter, from pHYs chunk data. */
+ PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+
+ /* Returns pixel aspect ratio, computed from pHYs chunk data. */
+ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr))
+ PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr))
+
+ /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
+ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+ PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
+-
+-#endif /* PNG_EASY_ACCESS_SUPPORTED */
+-
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
++
++#endif /* EASY_ACCESS */
++
++#ifdef PNG_READ_SUPPORTED
+ /* Returns pointer to signature string read from PNG header */
+-PNG_EXPORT(130, png_const_bytep, png_get_signature,
+- (png_const_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr));
++#endif
+
+ #ifdef PNG_bKGD_SUPPORTED
+-PNG_EXPORT(131, png_uint_32, png_get_bKGD,
+- (png_const_structp png_ptr, png_infop info_ptr,
+- png_color_16p *background));
++PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_color_16p *background));
+ #endif
+
+ #ifdef PNG_bKGD_SUPPORTED
+-PNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr,
+- png_const_color_16p background));
++PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_color_16p background));
+ #endif
+
+ #ifdef PNG_cHRM_SUPPORTED
+-PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr,
+- png_const_infop info_ptr, double *white_x, double *white_y, double *red_x,
++PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x,
+ double *red_y, double *green_x, double *green_y, double *blue_x,
+- double *blue_y));
+-#ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */
++ double *blue_y))
++PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z,
++ double *green_X, double *green_Y, double *green_Z, double *blue_X,
++ double *blue_Y, double *blue_Z))
+ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,
+- (png_const_structp png_ptr,
+- png_const_infop info_ptr, png_fixed_point *int_white_x,
+- png_fixed_point *int_white_y, png_fixed_point *int_red_x,
+- png_fixed_point *int_red_y, png_fixed_point *int_green_x,
+- png_fixed_point *int_green_y, png_fixed_point *int_blue_x,
+- png_fixed_point *int_blue_y));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr,
++ png_fixed_point *int_white_x, png_fixed_point *int_white_y,
++ png_fixed_point *int_red_x, png_fixed_point *int_red_y,
++ png_fixed_point *int_green_x, png_fixed_point *int_green_y,
++ png_fixed_point *int_blue_x, png_fixed_point *int_blue_y))
++PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed,
++ (png_const_structrp png_ptr, png_const_inforp info_ptr,
++ png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
++ png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
++ png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
++ png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
++ png_fixed_point *int_blue_Z))
+ #endif
+-#endif
+
+ #ifdef PNG_cHRM_SUPPORTED
+-PNG_FP_EXPORT(135, void, png_set_cHRM,
+- (png_structp png_ptr, png_infop info_ptr,
++PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr,
++ png_inforp info_ptr,
+ double white_x, double white_y, double red_x, double red_y, double green_x,
+- double green_y, double blue_x, double blue_y));
+-PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr,
+- png_infop info_ptr, png_fixed_point int_white_x,
++ double green_y, double blue_x, double blue_y))
++PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr,
++ png_inforp info_ptr, double red_X, double red_Y, double red_Z,
++ double green_X, double green_Y, double green_Z, double blue_X,
++ double blue_Y, double blue_Z))
++PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_fixed_point int_white_x,
+ png_fixed_point int_white_y, png_fixed_point int_red_x,
+ png_fixed_point int_red_y, png_fixed_point int_green_x,
+ png_fixed_point int_green_y, png_fixed_point int_blue_x,
+- png_fixed_point int_blue_y));
++ png_fixed_point int_blue_y))
++PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
++ png_fixed_point int_red_Z, png_fixed_point int_green_X,
++ png_fixed_point int_green_Y, png_fixed_point int_green_Z,
++ png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
++ png_fixed_point int_blue_Z))
+ #endif
+
+ #ifdef PNG_gAMA_SUPPORTED
+-PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- double *file_gamma));
++PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, double *file_gamma))
+ PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_fixed_point *int_file_gamma));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr,
++ png_fixed_point *int_file_gamma))
+ #endif
+
+ #ifdef PNG_gAMA_SUPPORTED
+-PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr,
+- png_infop info_ptr, double file_gamma));
+-PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr,
+- png_infop info_ptr, png_fixed_point int_file_gamma));
++PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr,
++ png_inforp info_ptr, double file_gamma))
++PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_fixed_point int_file_gamma))
+ #endif
+
+ #ifdef PNG_hIST_SUPPORTED
+-PNG_EXPORT(141, png_uint_32, png_get_hIST,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_uint_16p *hist));
++PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_uint_16p *hist));
+ #endif
+
+ #ifdef PNG_hIST_SUPPORTED
+-PNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr,
+- png_infop info_ptr, png_const_uint_16p hist));
++PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_uint_16p hist));
+ #endif
+
+-PNG_EXPORT(143, png_uint_32, png_get_IHDR,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type,
+- int *interlace_method, int *compression_method, int *filter_method));
+-
+-PNG_EXPORT(144, void, png_set_IHDR,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
+- int interlace_method, int compression_method, int filter_method));
++PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height,
++ int *bit_depth, int *color_type, int *interlace_method,
++ int *compression_method, int *filter_method));
++
++PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
++ int color_type, int interlace_method, int compression_method,
++ int filter_method));
+
+ #ifdef PNG_oFFs_SUPPORTED
+-PNG_EXPORT(145, png_uint_32, png_get_oFFs,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type));
++PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
++ int *unit_type));
+ #endif
+
+ #ifdef PNG_oFFs_SUPPORTED
+-PNG_EXPORT(146, void, png_set_oFFs,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_int_32 offset_x, png_int_32 offset_y, int unit_type));
++PNG_EXPORT(146, void, png_set_oFFs, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y,
++ int unit_type));
+ #endif
+
+ #ifdef PNG_pCAL_SUPPORTED
+-PNG_EXPORT(147, png_uint_32, png_get_pCAL,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type,
+- int *nparams,
+- png_charp *units, png_charpp *params));
++PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_charp *purpose, png_int_32 *X0,
++ png_int_32 *X1, int *type, int *nparams, png_charp *units,
++ png_charpp *params));
+ #endif
+
+ #ifdef PNG_pCAL_SUPPORTED
+-PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr,
+- png_infop info_ptr,
+- png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
+- int nparams, png_const_charp units, png_charpp params));
++PNG_EXPORT(148, void, png_set_pCAL, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1,
++ int type, int nparams, png_const_charp units, png_charpp params));
+ #endif
+
+ #ifdef PNG_pHYs_SUPPORTED
+-PNG_EXPORT(149, png_uint_32, png_get_pHYs,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
++PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
++ int *unit_type));
+ #endif
+
+ #ifdef PNG_pHYs_SUPPORTED
+-PNG_EXPORT(150, void, png_set_pHYs,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 res_x, png_uint_32 res_y, int unit_type));
++PNG_EXPORT(150, void, png_set_pHYs, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
+ #endif
+
+-PNG_EXPORT(151, png_uint_32, png_get_PLTE,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_colorp *palette, int *num_palette));
+-
+-PNG_EXPORT(152, void, png_set_PLTE,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_const_colorp palette, int num_palette));
++PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_colorp *palette, int *num_palette));
++
++PNG_EXPORT(152, void, png_set_PLTE, (png_structrp png_ptr,
++ png_inforp info_ptr, png_const_colorp palette, int num_palette));
+
+ #ifdef PNG_sBIT_SUPPORTED
+-PNG_EXPORT(153, png_uint_32, png_get_sBIT,
+- (png_const_structp png_ptr, png_infop info_ptr,
+- png_color_8p *sig_bit));
++PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_color_8p *sig_bit));
+ #endif
+
+ #ifdef PNG_sBIT_SUPPORTED
+-PNG_EXPORT(154, void, png_set_sBIT,
+- (png_structp png_ptr, png_infop info_ptr, png_const_color_8p sig_bit));
++PNG_EXPORT(154, void, png_set_sBIT, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_color_8p sig_bit));
+ #endif
+
+ #ifdef PNG_sRGB_SUPPORTED
+-PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr,
+- png_const_infop info_ptr, int *file_srgb_intent));
++PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, int *file_srgb_intent));
+ #endif
+
+ #ifdef PNG_sRGB_SUPPORTED
+-PNG_EXPORT(156, void, png_set_sRGB,
+- (png_structp png_ptr, png_infop info_ptr, int srgb_intent));
+-PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_structp png_ptr,
+- png_infop info_ptr, int srgb_intent));
++PNG_EXPORT(156, void, png_set_sRGB, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int srgb_intent));
++PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int srgb_intent));
+ #endif
+
+ #ifdef PNG_iCCP_SUPPORTED
+-PNG_EXPORT(158, png_uint_32, png_get_iCCP,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_charpp name, int *compression_type, png_bytepp profile,
+- png_uint_32 *proflen));
++PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_charpp name, int *compression_type,
++ png_bytepp profile, png_uint_32 *proflen));
+ #endif
+
+ #ifdef PNG_iCCP_SUPPORTED
+-PNG_EXPORT(159, void, png_set_iCCP,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_const_charp name, int compression_type, png_const_bytep profile,
+- png_uint_32 proflen));
++PNG_EXPORT(159, void, png_set_iCCP, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_charp name, int compression_type,
++ png_const_bytep profile, png_uint_32 proflen));
+ #endif
+
+ #ifdef PNG_sPLT_SUPPORTED
+-PNG_EXPORT(160, png_uint_32, png_get_sPLT,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_sPLT_tpp entries));
++PNG_EXPORT(160, int, png_get_sPLT, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_sPLT_tpp entries));
+ #endif
+
+ #ifdef PNG_sPLT_SUPPORTED
+-PNG_EXPORT(161, void, png_set_sPLT,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_const_sPLT_tp entries, int nentries));
++PNG_EXPORT(161, void, png_set_sPLT, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_sPLT_tp entries, int nentries));
+ #endif
+
+ #ifdef PNG_TEXT_SUPPORTED
+ /* png_get_text also returns the number of text chunks in *num_text */
+-PNG_EXPORT(162, png_uint_32, png_get_text,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- png_textp *text_ptr, int *num_text));
++PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_textp *text_ptr, int *num_text));
+ #endif
+
+ /* Note while png_set_text() will accept a structure whose text,
+@@ -2247,116 +2304,220 @@
+ */
+
+ #ifdef PNG_TEXT_SUPPORTED
+-PNG_EXPORT(163, void, png_set_text,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_const_textp text_ptr, int num_text));
++PNG_EXPORT(163, void, png_set_text, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_textp text_ptr, int num_text));
+ #endif
+
+ #ifdef PNG_tIME_SUPPORTED
+-PNG_EXPORT(164, png_uint_32, png_get_tIME,
+- (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time));
++PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_timep *mod_time));
+ #endif
+
+ #ifdef PNG_tIME_SUPPORTED
+-PNG_EXPORT(165, void, png_set_tIME,
+- (png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time));
++PNG_EXPORT(165, void, png_set_tIME, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_timep mod_time));
+ #endif
+
+ #ifdef PNG_tRNS_SUPPORTED
+-PNG_EXPORT(166, png_uint_32, png_get_tRNS,
+- (png_const_structp png_ptr, png_infop info_ptr,
+- png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color));
++PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans,
++ png_color_16p *trans_color));
+ #endif
+
+ #ifdef PNG_tRNS_SUPPORTED
+-PNG_EXPORT(167, void, png_set_tRNS,
+- (png_structp png_ptr, png_infop info_ptr,
+- png_const_bytep trans_alpha, int num_trans,
++PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr,
++ png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans,
+ png_const_color_16p trans_color));
+ #endif
+
+ #ifdef PNG_sCAL_SUPPORTED
+-PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- int *unit, double *width, double *height));
+-#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
++PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, int *unit, double *width, double *height))
++#if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
++ defined(PNG_FLOATING_POINT_SUPPORTED)
+ /* NOTE: this API is currently implemented using floating point arithmetic,
+ * consequently it can only be used on systems with floating point support.
+ * In any case the range of values supported by png_fixed_point is small and it
+ * is highly recommended that png_get_sCAL_s be used instead.
+ */
+ PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed,
+- (png_structp png_ptr, png_const_infop info_ptr, int *unit,
+- png_fixed_point *width,
+- png_fixed_point *height));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
++ png_fixed_point *width, png_fixed_point *height))
+ #endif
+ PNG_EXPORT(169, png_uint_32, png_get_sCAL_s,
+- (png_const_structp png_ptr, png_const_infop info_ptr,
+- int *unit, png_charpp swidth, png_charpp sheight));
+-
+-PNG_FP_EXPORT(170, void, png_set_sCAL,
+- (png_structp png_ptr, png_infop info_ptr,
+- int unit, double width, double height));
+-PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr,
+- png_infop info_ptr, int unit, png_fixed_point width,
+- png_fixed_point height));
+-PNG_EXPORT(171, void, png_set_sCAL_s,
+- (png_structp png_ptr, png_infop info_ptr,
+- int unit, png_const_charp swidth, png_const_charp sheight));
+-#endif /* PNG_sCAL_SUPPORTED */
+-
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+-/* Provide a list of chunks and how they are to be handled, if the built-in
+- handling or default unknown chunk handling is not desired. Any chunks not
+- listed will be handled in the default manner. The IHDR and IEND chunks
+- must not be listed.
+- keep = 0: follow default behaviour
+- = 1: do not keep
+- = 2: keep only if safe-to-copy
+- = 3: keep even if unsafe-to-copy
+-*/
+-PNG_EXPORT(172, void, png_set_keep_unknown_chunks,
+- (png_structp png_ptr, int keep,
+- png_const_bytep chunk_list, int num_chunks));
+-PNG_EXPORT(173, int, png_handle_as_unknown, (png_structp png_ptr,
++ (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit,
++ png_charpp swidth, png_charpp sheight));
++
++PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int unit, double width, double height))
++PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int unit, png_fixed_point width,
++ png_fixed_point height))
++PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int unit,
++ png_const_charp swidth, png_const_charp sheight));
++#endif /* sCAL */
++
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++/* Provide the default handling for all unknown chunks or, optionally, for
++ * specific unknown chunks.
++ *
++ * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was
++ * ignored and the default was used, the per-chunk setting only had an effect on
++ * write. If you wish to have chunk-specific handling on read in code that must
++ * work on earlier versions you must use a user chunk callback to specify the
++ * desired handling (keep or discard.)
++ *
++ * The 'keep' parameter is a PNG_HANDLE_CHUNK_ value as listed below. The
++ * parameter is interpreted as follows:
++ *
++ * READ:
++ * PNG_HANDLE_CHUNK_AS_DEFAULT:
++ * Known chunks: do normal libpng processing, do not keep the chunk (but
++ * see the comments below about PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
++ * Unknown chunks: for a specific chunk use the global default, when used
++ * as the default discard the chunk data.
++ * PNG_HANDLE_CHUNK_NEVER:
++ * Discard the chunk data.
++ * PNG_HANDLE_CHUNK_IF_SAFE:
++ * Keep the chunk data if the chunk is not critical else raise a chunk
++ * error.
++ * PNG_HANDLE_CHUNK_ALWAYS:
++ * Keep the chunk data.
++ *
++ * If the chunk data is saved it can be retrieved using png_get_unknown_chunks,
++ * below. Notice that specifying "AS_DEFAULT" as a global default is equivalent
++ * to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks
++ * it simply resets the behavior to the libpng default.
++ *
++ * INTERACTION WTIH USER CHUNK CALLBACKS:
++ * The per-chunk handling is always used when there is a png_user_chunk_ptr
++ * callback and the callback returns 0; the chunk is then always stored *unless*
++ * it is critical and the per-chunk setting is other than ALWAYS. Notice that
++ * the global default is *not* used in this case. (In effect the per-chunk
++ * value is incremented to at least IF_SAFE.)
++ *
++ * IMPORTANT NOTE: this behavior will change in libpng 1.7 - the global and
++ * per-chunk defaults will be honored. If you want to preserve the current
++ * behavior when your callback returns 0 you must set PNG_HANDLE_CHUNK_IF_SAFE
++ * as the default - if you don't do this libpng 1.6 will issue a warning.
++ *
++ * If you want unhandled unknown chunks to be discarded in libpng 1.6 and
++ * earlier simply return '1' (handled).
++ *
++ * PNG_HANDLE_AS_UNKNOWN_SUPPORTED:
++ * If this is *not* set known chunks will always be handled by libpng and
++ * will never be stored in the unknown chunk list. Known chunks listed to
++ * png_set_keep_unknown_chunks will have no effect. If it is set then known
++ * chunks listed with a keep other than AS_DEFAULT will *never* be processed
++ * by libpng, in addition critical chunks must either be processed by the
++ * callback or saved.
++ *
++ * The IHDR and IEND chunks must not be listed. Because this turns off the
++ * default handling for chunks that would otherwise be recognized the
++ * behavior of libpng transformations may well become incorrect!
++ *
++ * WRITE:
++ * When writing chunks the options only apply to the chunks specified by
++ * png_set_unknown_chunks (below), libpng will *always* write known chunks
++ * required by png_set_ calls and will always write the core critical chunks
++ * (as required for PLTE).
++ *
++ * Each chunk in the png_set_unknown_chunks list is looked up in the
++ * png_set_keep_unknown_chunks list to find the keep setting, this is then
++ * interpreted as follows:
++ *
++ * PNG_HANDLE_CHUNK_AS_DEFAULT:
++ * Write safe-to-copy chunks and write other chunks if the global
++ * default is set to _ALWAYS, otherwise don't write this chunk.
++ * PNG_HANDLE_CHUNK_NEVER:
++ * Do not write the chunk.
++ * PNG_HANDLE_CHUNK_IF_SAFE:
++ * Write the chunk if it is safe-to-copy, otherwise do not write it.
++ * PNG_HANDLE_CHUNK_ALWAYS:
++ * Write the chunk.
++ *
++ * Note that the default behavior is effectively the opposite of the read case -
++ * in read unknown chunks are not stored by default, in write they are written
++ * by default. Also the behavior of PNG_HANDLE_CHUNK_IF_SAFE is very different
++ * - on write the safe-to-copy bit is checked, on read the critical bit is
++ * checked and on read if the chunk is critical an error will be raised.
++ *
++ * num_chunks:
++ * ===========
++ * If num_chunks is positive, then the "keep" parameter specifies the manner
++ * for handling only those chunks appearing in the chunk_list array,
++ * otherwise the chunk list array is ignored.
++ *
++ * If num_chunks is 0 the "keep" parameter specifies the default behavior for
++ * unknown chunks, as described above.
++ *
++ * If num_chunks is negative, then the "keep" parameter specifies the manner
++ * for handling all unknown chunks plus all chunks recognized by libpng
++ * except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to
++ * be processed by libpng.
++ */
++PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
++ int keep, png_const_bytep chunk_list, int num_chunks));
++
++/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned;
++ * the result is therefore true (non-zero) if special handling is required,
++ * false for the default handling.
++ */
++PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr,
+ png_const_bytep chunk_name));
+ #endif
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+-PNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr,
+- png_infop info_ptr, png_const_unknown_chunkp unknowns,
++
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_unknown_chunkp unknowns,
+ int num_unknowns));
++ /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added
++ * unknowns to the location currently stored in the png_struct. This is
++ * invariably the wrong value on write. To fix this call the following API
++ * for each chunk in the list with the correct location. If you know your
++ * code won't be compiled on earlier versions you can rely on
++ * png_set_unknown_chunks(write-ptr, png_get_unknown_chunks(read-ptr)) doing
++ * the correct thing.
++ */
++
+ PNG_EXPORT(175, void, png_set_unknown_chunk_location,
+- (png_structp png_ptr, png_infop info_ptr, int chunk, int location));
+-PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr,
+- png_const_infop info_ptr, png_unknown_chunkpp entries));
++ (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location));
++
++PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structrp png_ptr,
++ png_inforp info_ptr, png_unknown_chunkpp entries));
+ #endif
+
+ /* Png_free_data() will turn off the "valid" flag for anything it frees.
+ * If you need to turn it off for a chunk that your application has freed,
+ * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
+ */
+-PNG_EXPORT(177, void, png_set_invalid,
+- (png_structp png_ptr, png_infop info_ptr, int mask));
++PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr,
++ png_inforp info_ptr, int mask));
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ /* The "params" pointer is currently not used and is for future expansion. */
+-PNG_EXPORT(178, void, png_read_png, (png_structp png_ptr, png_infop info_ptr,
+- int transforms, png_voidp params));
+-PNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr,
++#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
+ int transforms, png_voidp params));
+ #endif
++#ifdef PNG_WRITE_SUPPORTED
++PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
++ int transforms, png_voidp params));
++#endif
++#endif
+
+ PNG_EXPORT(180, png_const_charp, png_get_copyright,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ PNG_EXPORT(181, png_const_charp, png_get_header_ver,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ PNG_EXPORT(182, png_const_charp, png_get_header_version,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ PNG_EXPORT(183, png_const_charp, png_get_libpng_ver,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+-PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr,
++PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr,
+ png_uint_32 mng_features_permitted));
+ #endif
+
+@@ -2365,75 +2526,77 @@
+ #define PNG_HANDLE_CHUNK_NEVER 1
+ #define PNG_HANDLE_CHUNK_IF_SAFE 2
+ #define PNG_HANDLE_CHUNK_ALWAYS 3
++#define PNG_HANDLE_CHUNK_LAST 4
+
+ /* Strip the prepended error numbers ("#nnn ") from error and warning
+ * messages before passing them to the error or warning handler.
+ */
+ #ifdef PNG_ERROR_NUMBERS_SUPPORTED
+-PNG_EXPORT(185, void, png_set_strip_error_numbers,
+- (png_structp png_ptr,
++PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structrp png_ptr,
+ png_uint_32 strip_mode));
+ #endif
+
+ /* Added in libpng-1.2.6 */
+ #ifdef PNG_SET_USER_LIMITS_SUPPORTED
+-PNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr,
++PNG_EXPORT(186, void, png_set_user_limits, (png_structrp png_ptr,
+ png_uint_32 user_width_max, png_uint_32 user_height_max));
+ PNG_EXPORT(187, png_uint_32, png_get_user_width_max,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ PNG_EXPORT(188, png_uint_32, png_get_user_height_max,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ /* Added in libpng-1.4.0 */
+-PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr,
++PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structrp png_ptr,
+ png_uint_32 user_chunk_cache_max));
+ PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ /* Added in libpng-1.4.1 */
+-PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr,
++PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structrp png_ptr,
+ png_alloc_size_t user_chunk_cache_max));
+ PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+ #endif
+
+ #if defined(PNG_INCH_CONVERSIONS_SUPPORTED)
+ PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+
+ PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+
+ PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr));
+
+ PNG_FP_EXPORT(196, float, png_get_x_offset_inches,
+- (png_const_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr))
+ #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
+ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed,
+- (png_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr))
+ #endif
+
+-PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr,
+- png_const_infop info_ptr));
++PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr))
+ #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
+ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
+- (png_structp png_ptr, png_const_infop info_ptr));
++ (png_const_structrp png_ptr, png_const_inforp info_ptr))
+ #endif
+
+ # ifdef PNG_pHYs_SUPPORTED
+-PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr,
+- png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
++PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
++ png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
+ int *unit_type));
+-# endif /* PNG_pHYs_SUPPORTED */
+-#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
++# endif /* pHYs */
++#endif /* INCH_CONVERSIONS */
+
+ /* Added in libpng-1.4.0 */
+ #ifdef PNG_IO_STATE_SUPPORTED
+-PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr));
+-
+-PNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name,
+- (png_structp png_ptr), PNG_DEPRECATED);
++PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr));
++
++/* Removed from libpng 1.6; use png_get_io_chunk_type. */
++PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr),
++ PNG_DEPRECATED)
++
+ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
+- (png_const_structp png_ptr));
++ (png_const_structrp png_ptr));
+
+ /* The flags returned by png_get_io_state() are the following: */
+ # define PNG_IO_NONE 0x0000 /* no I/O at this moment */
+@@ -2445,7 +2608,7 @@
+ # define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
+ # define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
+ # define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
+-#endif /* ?PNG_IO_STATE_SUPPORTED */
++#endif /* IO_STATE */
+
+ /* Interlace support. The following macros are always defined so that if
+ * libpng interlace handling is turned off the macros may be used to handle
+@@ -2457,8 +2620,16 @@
+ * full, image which appears in a given pass. 'pass' is in the range 0
+ * to 6 and the result is in the range 0 to 7.
+ */
+-#define PNG_PASS_START_ROW(pass) (((1U&~(pass))<<(3-((pass)>>1)))&7)
+-#define PNG_PASS_START_COL(pass) (((1U& (pass))<<(3-(((pass)+1)>>1)))&7)
++#define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7)
++#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
++
++/* A macro to return the offset between pixels in the output row for a pair of
++ * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that
++ * follows. Note that ROW_OFFSET is the offset from one row to the next whereas
++ * COL_OFFSET is from one column to the next, within a row.
++ */
++#define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8)
++#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1))
+
+ /* Two macros to help evaluate the number of rows or columns in each
+ * pass. This is expressed as a shift - effectively log2 of the number or
+@@ -2481,10 +2652,10 @@
+ * necessary to find the row in the output image given a row in an interlaced
+ * image, so two more macros:
+ */
+-#define PNG_ROW_FROM_PASS_ROW(yIn, pass) \
+- (((yIn)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
+-#define PNG_COL_FROM_PASS_COL(xIn, pass) \
+- (((xIn)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
++#define PNG_ROW_FROM_PASS_ROW(y_in, pass) \
++ (((y_in)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
++#define PNG_COL_FROM_PASS_COL(x_in, pass) \
++ (((x_in)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
+
+ /* Two macros which return a boolean (0 or 1) saying whether the given row
+ * or column is in a particular pass. These use a common utility macro that
+@@ -2493,8 +2664,8 @@
+ * the tile.
+ */
+ #define PNG_PASS_MASK(pass,off) ( \
+- ((0x110145AFU>>(((7-(off))-(pass))<<2)) & 0xFU) | \
+- ((0x01145AF0U>>(((7-(off))-(pass))<<2)) & 0xF0U))
++ ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \
++ ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0))
+
+ #define PNG_ROW_IN_INTERLACE_PASS(y, pass) \
+ ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1)
+@@ -2520,14 +2691,14 @@
+ { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
+ * (png_uint_16)(alpha) \
+ + (png_uint_16)(bg)*(png_uint_16)(255 \
+- - (png_uint_16)(alpha)) + (png_uint_16)128); \
++ - (png_uint_16)(alpha)) + 128); \
+ (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
+
+ # define png_composite_16(composite, fg, alpha, bg) \
+ { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
+ * (png_uint_32)(alpha) \
+- + (png_uint_32)(bg)*(png_uint_32)(65535L \
+- - (png_uint_32)(alpha)) + (png_uint_32)32768L); \
++ + (png_uint_32)(bg)*(65535 \
++ - (png_uint_32)(alpha)) + 32768); \
+ (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
+
+ #else /* Standard method using integer division */
+@@ -2535,13 +2706,13 @@
+ # define png_composite(composite, fg, alpha, bg) \
+ (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
+ (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
+- (png_uint_16)127) / 255)
++ 127) / 255)
+
+ # define png_composite_16(composite, fg, alpha, bg) \
+ (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
+- (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
+- (png_uint_32)32767) / (png_uint_32)65535L)
+-#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
++ (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
++ 32767) / 65535)
++#endif /* READ_COMPOSITE_NODIV */
+
+ #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
+ PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
+@@ -2549,7 +2720,7 @@
+ PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf));
+ #endif
+
+-PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_structp png_ptr,
++PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr,
+ png_const_bytep buf));
+ /* No png_get_int_16 -- may be added if there's a real need for it. */
+
+@@ -2575,7 +2746,7 @@
+ * The png_get_int_32() routine assumes we are using two's complement
+ * format for negative values, which is almost certainly true.
+ */
+-# define png_get_uint_32(buf) \
++# define PNG_get_uint_32(buf) \
+ (((png_uint_32)(*(buf)) << 24) + \
+ ((png_uint_32)(*((buf) + 1)) << 16) + \
+ ((png_uint_32)(*((buf) + 2)) << 8) + \
+@@ -2584,27 +2755,550 @@
+ /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
+ * function) incorrectly returned a value of type png_uint_32.
+ */
+-# define png_get_uint_16(buf) \
++# define PNG_get_uint_16(buf) \
+ ((png_uint_16) \
+ (((unsigned int)(*(buf)) << 8) + \
+ ((unsigned int)(*((buf) + 1)))))
+
+-# define png_get_int_32(buf) \
++# define PNG_get_int_32(buf) \
+ ((png_int_32)((*(buf) & 0x80) \
+ ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
+ : (png_int_32)png_get_uint_32(buf)))
++
++ /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
++ * but defining a macro name prefixed with PNG_PREFIX.
++ */
++# ifndef PNG_PREFIX
++# define png_get_uint_32(buf) PNG_get_uint_32(buf)
++# define png_get_uint_16(buf) PNG_get_uint_16(buf)
++# define png_get_int_32(buf) PNG_get_int_32(buf)
++# endif
++#else
++# ifdef PNG_PREFIX
++ /* No macros; revert to the (redefined) function */
++# define PNG_get_uint_32 (png_get_uint_32)
++# define PNG_get_uint_16 (png_get_uint_16)
++# define PNG_get_int_32 (png_get_int_32)
++# endif
+ #endif
+
+-/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
+- * defs
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++/*******************************************************************************
++ * SIMPLIFIED API
++ *******************************************************************************
++ *
++ * Please read the documentation in libpng-manual.txt (TODO: write said
++ * documentation) if you don't understand what follows.
++ *
++ * The simplified API hides the details of both libpng and the PNG file format
++ * itself. It allows PNG files to be read into a very limited number of
++ * in-memory bitmap formats or to be written from the same formats. If these
++ * formats do not accomodate your needs then you can, and should, use the more
++ * sophisticated APIs above - these support a wide variety of in-memory formats
++ * and a wide variety of sophisticated transformations to those formats as well
++ * as a wide variety of APIs to manipulate ancillary information.
++ *
++ * To read a PNG file using the simplified API:
++ *
++ * 1) Declare a 'png_image' structure (see below) on the stack and set the
++ * version field to PNG_IMAGE_VERSION.
++ * 2) Call the appropriate png_image_begin_read... function.
++ * 3) Set the png_image 'format' member to the required sample format.
++ * 4) Allocate a buffer for the image and, if required, the color-map.
++ * 5) Call png_image_finish_read to read the image and, if required, the
++ * color-map into your buffers.
++ *
++ * There are no restrictions on the format of the PNG input itself; all valid
++ * color types, bit depths, and interlace methods are acceptable, and the
++ * input image is transformed as necessary to the requested in-memory format
++ * during the png_image_finish_read() step. The only caveat is that if you
++ * request a color-mapped image from a PNG that is full-color or makes
++ * complex use of an alpha channel the transformation is extremely lossy and the
++ * result may look terrible.
++ *
++ * To write a PNG file using the simplified API:
++ *
++ * 1) Declare a 'png_image' structure on the stack and memset() it to all zero.
++ * 2) Initialize the members of the structure that describe the image, setting
++ * the 'format' member to the format of the image samples.
++ * 3) Call the appropriate png_image_write... function with a pointer to the
++ * image and, if necessary, the color-map to write the PNG data.
++ *
++ * png_image is a structure that describes the in-memory format of an image
++ * when it is being read or defines the in-memory format of an image that you
++ * need to write:
+ */
++#define PNG_IMAGE_VERSION 1
++
++typedef struct png_control *png_controlp;
++typedef struct
++{
++ png_controlp opaque; /* Initialize to NULL, free with png_image_free */
++ png_uint_32 version; /* Set to PNG_IMAGE_VERSION */
++ png_uint_32 width; /* Image width in pixels (columns) */
++ png_uint_32 height; /* Image height in pixels (rows) */
++ png_uint_32 format; /* Image format as defined below */
++ png_uint_32 flags; /* A bit mask containing informational flags */
++ png_uint_32 colormap_entries;
++ /* Number of entries in the color-map */
++
++ /* In the event of an error or warning the following field will be set to a
++ * non-zero value and the 'message' field will contain a '\0' terminated
++ * string with the libpng error or warning message. If both warnings and
++ * an error were encountered, only the error is recorded. If there
++ * are multiple warnings, only the first one is recorded.
++ *
++ * The upper 30 bits of this value are reserved, the low two bits contain
++ * a value as follows:
++ */
++# define PNG_IMAGE_WARNING 1
++# define PNG_IMAGE_ERROR 2
++ /*
++ * The result is a two-bit code such that a value more than 1 indicates
++ * a failure in the API just called:
++ *
++ * 0 - no warning or error
++ * 1 - warning
++ * 2 - error
++ * 3 - error preceded by warning
++ */
++# define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1)
++
++ png_uint_32 warning_or_error;
++
++ char message[64];
++} png_image, *png_imagep;
++
++/* The samples of the image have one to four channels whose components have
++ * original values in the range 0 to 1.0:
++ *
++ * 1: A single gray or luminance channel (G).
++ * 2: A gray/luminance channel and an alpha channel (GA).
++ * 3: Three red, green, blue color channels (RGB).
++ * 4: Three color channels and an alpha channel (RGBA).
++ *
++ * The components are encoded in one of two ways:
++ *
++ * a) As a small integer, value 0..255, contained in a single byte. For the
++ * alpha channel the original value is simply value/255. For the color or
++ * luminance channels the value is encoded according to the sRGB specification
++ * and matches the 8-bit format expected by typical display devices.
++ *
++ * The color/gray channels are not scaled (pre-multiplied) by the alpha
++ * channel and are suitable for passing to color management software.
++ *
++ * b) As a value in the range 0..65535, contained in a 2-byte integer. All
++ * channels can be converted to the original value by dividing by 65535; all
++ * channels are linear. Color channels use the RGB encoding (RGB end-points) of
++ * the sRGB specification. This encoding is identified by the
++ * PNG_FORMAT_FLAG_LINEAR flag below.
++ *
++ * When the simplified API needs to convert between sRGB and linear colorspaces,
++ * the actual sRGB transfer curve defined in the sRGB specification (see the
++ * article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
++ * approximation used elsewhere in libpng.
++ *
++ * When an alpha channel is present it is expected to denote pixel coverage
++ * of the color or luminance channels and is returned as an associated alpha
++ * channel: the color/gray channels are scaled (pre-multiplied) by the alpha
++ * value.
++ *
++ * The samples are either contained directly in the image data, between 1 and 8
++ * bytes per pixel according to the encoding, or are held in a color-map indexed
++ * by bytes in the image data. In the case of a color-map the color-map entries
++ * are individual samples, encoded as above, and the image data has one byte per
++ * pixel to select the relevant sample from the color-map.
++ */
++
++/* PNG_FORMAT_*
++ *
++ * #defines to be used in png_image::format. Each #define identifies a
++ * particular layout of sample data and, if present, alpha values. There are
++ * separate defines for each of the two component encodings.
++ *
++ * A format is built up using single bit flag values. All combinations are
++ * valid. Formats can be built up from the flag values or you can use one of
++ * the predefined values below. When testing formats always use the FORMAT_FLAG
++ * macros to test for individual features - future versions of the library may
++ * add new flags.
++ *
++ * When reading or writing color-mapped images the format should be set to the
++ * format of the entries in the color-map then png_image_{read,write}_colormap
++ * called to read or write the color-map and set the format correctly for the
++ * image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
++ *
++ * NOTE: libpng can be built with particular features disabled, if you see
++ * compiler errors because the definition of one of the following flags has been
++ * compiled out it is because libpng does not have the required support. It is
++ * possible, however, for the libpng configuration to enable the format on just
++ * read or just write; in that case you may see an error at run time. You can
++ * guard against this by checking for the definition of the appropriate
++ * "_SUPPORTED" macro, one of:
++ *
++ * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
++ */
++#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
++#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
++#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */
++#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
++
++#ifdef PNG_FORMAT_BGR_SUPPORTED
++# define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */
++#endif
++
++#ifdef PNG_FORMAT_AFIRST_SUPPORTED
++# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
++#endif
++
++/* Commonly used formats have predefined macros.
++ *
++ * First the single byte (sRGB) formats:
++ */
++#define PNG_FORMAT_GRAY 0
++#define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA
++#define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
++#define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR
++#define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
++#define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
++#define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
++#define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
++#define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
++
++/* Then the linear 2-byte formats. When naming these "Y" is used to
++ * indicate a luminance (gray) channel.
++ */
++#define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
++#define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
++#define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)
++#define PNG_FORMAT_LINEAR_RGB_ALPHA \
++ (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA)
++
++/* With color-mapped formats the image data is one byte for each pixel, the byte
++ * is an index into the color-map which is formatted as above. To obtain a
++ * color-mapped format it is sufficient just to add the PNG_FOMAT_FLAG_COLORMAP
++ * to one of the above definitions, or you can use one of the definitions below.
++ */
++#define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_COLORMAP)
++#define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_COLORMAP)
++#define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_COLORMAP)
++#define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB|PNG_FORMAT_FLAG_COLORMAP)
++#define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_COLORMAP)
++#define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR|PNG_FORMAT_FLAG_COLORMAP)
++
++/* PNG_IMAGE macros
++ *
++ * These are convenience macros to derive information from a png_image
++ * structure. The PNG_IMAGE_SAMPLE_ macros return values appropriate to the
++ * actual image sample values - either the entries in the color-map or the
++ * pixels in the image. The PNG_IMAGE_PIXEL_ macros return corresponding values
++ * for the pixels and will always return 1 for color-mapped formats. The
++ * remaining macros return information about the rows in the image and the
++ * complete image.
++ *
++ * NOTE: All the macros that take a png_image::format parameter are compile time
++ * constants if the format parameter is, itself, a constant. Therefore these
++ * macros can be used in array declarations and case labels where required.
++ * Similarly the macros are also pre-processor constants (sizeof is not used) so
++ * they can be used in #if tests.
++ *
++ * First the information about the samples.
++ */
++#define PNG_IMAGE_SAMPLE_CHANNELS(fmt)\
++ (((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA))+1)
++ /* Return the total number of channels in a given format: 1..4 */
++
++#define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)\
++ ((((fmt) & PNG_FORMAT_FLAG_LINEAR) >> 2)+1)
++ /* Return the size in bytes of a single component of a pixel or color-map
++ * entry (as appropriate) in the image: 1 or 2.
++ */
++
++#define PNG_IMAGE_SAMPLE_SIZE(fmt)\
++ (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt))
++ /* This is the size of the sample data for one sample. If the image is
++ * color-mapped it is the size of one color-map entry (and image pixels are
++ * one byte in size), otherwise it is the size of one image pixel.
++ */
++
++#define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt)\
++ (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256)
++ /* The maximum size of the color-map required by the format expressed in a
++ * count of components. This can be used to compile-time allocate a
++ * color-map:
++ *
++ * png_uint_16 colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(linear_fmt)];
++ *
++ * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)];
++ *
++ * Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the
++ * information from one of the png_image_begin_read_ APIs and dynamically
++ * allocate the required memory.
++ */
++
++/* Corresponding information about the pixels */
++#define PNG_IMAGE_PIXEL_(test,fmt)\
++ (((fmt)&PNG_FORMAT_FLAG_COLORMAP)?1:test(fmt))
++
++#define PNG_IMAGE_PIXEL_CHANNELS(fmt)\
++ PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS,fmt)
++ /* The number of separate channels (components) in a pixel; 1 for a
++ * color-mapped image.
++ */
++
++#define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)\
++ PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE,fmt)
++ /* The size, in bytes, of each component in a pixel; 1 for a color-mapped
++ * image.
++ */
++
++#define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE,fmt)
++ /* The size, in bytes, of a complete pixel; 1 for a color-mapped image. */
++
++/* Information about the whole row, or whole image */
++#define PNG_IMAGE_ROW_STRIDE(image)\
++ (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width)
++ /* Return the total number of components in a single row of the image; this
++ * is the minimum 'row stride', the minimum count of components between each
++ * row. For a color-mapped image this is the minimum number of bytes in a
++ * row.
++ */
++
++#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
++ (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
++ /* Return the size, in bytes, of an image buffer given a png_image and a row
++ * stride - the number of components to leave space for in each row.
++ */
++
++#define PNG_IMAGE_SIZE(image)\
++ PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image))
++ /* Return the size, in bytes, of the image in memory given just a png_image;
++ * the row stride is the minimum stride required for the image.
++ */
++
++#define PNG_IMAGE_COLORMAP_SIZE(image)\
++ (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries)
++ /* Return the size, in bytes, of the color-map of this image. If the image
++ * format is not a color-map format this will return a size sufficient for
++ * 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if
++ * you don't want to allocate a color-map in this case.
++ */
++
++/* PNG_IMAGE_FLAG_*
++ *
++ * Flags containing additional information about the image are held in the
++ * 'flags' field of png_image.
++ */
++#define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01
++ /* This indicates the the RGB values of the in-memory bitmap do not
++ * correspond to the red, green and blue end-points defined by sRGB.
++ */
++
++#define PNG_IMAGE_FLAG_FAST 0x02
++ /* On write emphasise speed over compression; the resultant PNG file will be
++ * larger but will be produced significantly faster, particular for large
++ * images. Do not use this option for images which will be distributed, only
++ * used it when producing intermediate files that will be read back in
++ * repeatedly. For a typical 24-bit image the option will double the read
++ * speed at the cost of increasing the image size by 25%, however for many
++ * more compressible images the PNG file can be 10 times larger with only a
++ * slight speed gain.
++ */
++
++#define PNG_IMAGE_FLAG_16BIT_sRGB 0x04
++ /* On read if the image is a 16-bit per component image and there is no gAMA
++ * or sRGB chunk assume that the components are sRGB encoded. Notice that
++ * images output by the simplified API always have gamma information; setting
++ * this flag only affects the interpretation of 16-bit images from an
++ * external source. It is recommended that the application expose this flag
++ * to the user; the user can normally easily recognize the difference between
++ * linear and sRGB encoding. This flag has no effect on write - the data
++ * passed to the write APIs must have the correct encoding (as defined
++ * above.)
++ *
++ * If the flag is not set (the default) input 16-bit per component data is
++ * assumed to be linear.
++ *
++ * NOTE: the flag can only be set after the png_image_begin_read_ call,
++ * because that call initializes the 'flags' field.
++ */
++
++#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
++/* READ APIs
++ * ---------
++ *
++ * The png_image passed to the read APIs must have been initialized by setting
++ * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.)
++ */
++#ifdef PNG_STDIO_SUPPORTED
++PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
++ const char *file_name));
++ /* The named file is opened for read and the image header is filled in
++ * from the PNG header in the file.
++ */
++
++PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
++ FILE* file));
++ /* The PNG header is read from the stdio FILE object. */
++#endif /* STDIO */
++
++PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
++ png_const_voidp memory, png_size_t size));
++ /* The PNG header is read from the given memory buffer. */
++
++PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
++ png_const_colorp background, void *buffer, png_int_32 row_stride,
++ void *colormap));
++ /* Finish reading the image into the supplied buffer and clean up the
++ * png_image structure.
++ *
++ * row_stride is the step, in byte or 2-byte units as appropriate,
++ * between adjacent rows. A positive stride indicates that the top-most row
++ * is first in the buffer - the normal top-down arrangement. A negative
++ * stride indicates that the bottom-most row is first in the buffer.
++ *
++ * background need only be supplied if an alpha channel must be removed from
++ * a png_byte format and the removal is to be done by compositing on a solid
++ * color; otherwise it may be NULL and any composition will be done directly
++ * onto the buffer. The value is an sRGB color to use for the background,
++ * for grayscale output the green channel is used.
++ *
++ * background must be supplied when an alpha channel must be removed from a
++ * single byte color-mapped output format, in other words if:
++ *
++ * 1) The original format from png_image_begin_read_from_* had
++ * PNG_FORMAT_FLAG_ALPHA set.
++ * 2) The format set by the application does not.
++ * 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and
++ * PNG_FORMAT_FLAG_LINEAR *not* set.
++ *
++ * For linear output removing the alpha channel is always done by compositing
++ * on black and background is ignored.
++ *
++ * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must
++ * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE.
++ * image->colormap_entries will be updated to the actual number of entries
++ * written to the colormap; this may be less than the original value.
++ */
++
++PNG_EXPORT(238, void, png_image_free, (png_imagep image));
++ /* Free any data allocated by libpng in image->opaque, setting the pointer to
++ * NULL. May be called at any time after the structure is initialized.
++ */
++#endif /* SIMPLIFIED_READ */
++
++#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
++#ifdef PNG_STDIO_SUPPORTED
++/* WRITE APIS
++ * ----------
++ * For write you must initialize a png_image structure to describe the image to
++ * be written. To do this use memset to set the whole structure to 0 then
++ * initialize fields describing your image.
++ *
++ * version: must be set to PNG_IMAGE_VERSION
++ * opaque: must be initialized to NULL
++ * width: image width in pixels
++ * height: image height in rows
++ * format: the format of the data (image and color-map) you wish to write
++ * flags: set to 0 unless one of the defined flags applies; set
++ * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB
++ * values do not correspond to the colors in sRGB.
++ * colormap_entries: set to the number of entries in the color-map (0 to 256)
++ */
++PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
++ const char *file, int convert_to_8bit, const void *buffer,
++ png_int_32 row_stride, const void *colormap));
++ /* Write the image to the named file. */
++
++PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
++ int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
++ const void *colormap));
++ /* Write the image to the given (FILE*). */
++
++/* With both write APIs if image is in one of the linear formats with 16-bit
++ * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
++ * gamma encoded according to the sRGB specification, otherwise a 16-bit linear
++ * encoded PNG file is written.
++ *
++ * With color-mapped data formats the colormap parameter point to a color-map
++ * with at least image->colormap_entries encoded in the specified format. If
++ * the format is linear the written PNG color-map will be converted to sRGB
++ * regardless of the convert_to_8_bit flag.
++ *
++ * With all APIs row_stride is handled as in the read APIs - it is the spacing
++ * from one row to the next in component sized units (1 or 2 bytes) and if
++ * negative indicates a bottom-up row layout in the buffer.
++ *
++ * Note that the write API does not support interlacing or sub-8-bit pixels.
++ */
++#endif /* STDIO */
++#endif /* SIMPLIFIED_WRITE */
++/*******************************************************************************
++ * END OF SIMPLIFIED API
++ ******************************************************************************/
++#endif /* SIMPLIFIED_{READ|WRITE} */
++
++#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
++PNG_EXPORT(242, void, png_set_check_for_invalid_index,
++ (png_structrp png_ptr, int allowed));
++# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
++PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
++ png_const_infop info_ptr));
++# endif
++#endif /* CHECK_FOR_INVALID_INDEX */
++
++/*******************************************************************************
++ * IMPLEMENTATION OPTIONS
++ *******************************************************************************
++ *
++ * Support for arbitrary implementation-specific optimizations. The API allows
++ * particular options to be turned on or off. 'Option' is the number of the
++ * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
++ * by the PNG_OPTION_ defines below.
++ *
++ * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
++ * are detected at run time, however sometimes it may be impossible
++ * to do this in user mode, in which case it is necessary to discover
++ * the capabilities in an OS specific way. Such capabilities are
++ * listed here when libpng has support for them and must be turned
++ * ON by the application if present.
++ *
++ * SOFTWARE: sometimes software optimizations actually result in performance
++ * decrease on some architectures or systems, or with some sets of
++ * PNG images. 'Software' options allow such optimizations to be
++ * selected at run time.
++ */
++#ifdef PNG_SET_OPTION_SUPPORTED
++#ifdef PNG_ARM_NEON_API_SUPPORTED
++# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
++#endif
++#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
++#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
++#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
++
++/* Return values: NOTE: there are four values and 'off' is *not* zero */
++#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
++#define PNG_OPTION_INVALID 1 /* Option number out of range */
++#define PNG_OPTION_OFF 2
++#define PNG_OPTION_ON 3
++
++PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
++ int onoff));
++#endif /* SET_OPTION */
++
++/*******************************************************************************
++ * END OF HARDWARE AND SOFTWARE OPTIONS
++ ******************************************************************************/
++
++/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
++ * defs, and in scripts/symbols.def.
++ */
+
+ /* The last ordinal number (this is the *last* one already used; the next
+- * one to use is one more than this.) Maintainer, remember to add an entry to
+- * scripts/symbols.def as well.
++ * one to use is one more than this.)
+ */
+ #ifdef PNG_EXPORT_LAST_ORDINAL
+- PNG_EXPORT_LAST_ORDINAL(229);
++ PNG_EXPORT_LAST_ORDINAL(244);
+ #endif
+
+ #ifdef __cplusplus
+--- ./jdk/src/share/native/sun/awt/libpng/pngconf.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngconf.h Fri Apr 10 09:21:28 2015 -0700
+@@ -29,9 +29,9 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * libpng version 1.5.4 - July 7, 2011
++ * libpng version 1.6.16,December 22, 2014
+ *
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -50,37 +50,73 @@
+ #ifndef PNGCONF_H
+ #define PNGCONF_H
+
+-#ifndef PNG_BUILDING_SYMBOL_TABLE
+-/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
+- * definition file for machine specific limits, this may impact the
+- * correctness of the definitons below (see uses of INT_MAX).
+- */
+-# ifndef PNG_NO_LIMITS_H
+-# include <limits.h>
++/* To do: Do all of this in scripts/pnglibconf.dfa */
++#ifdef PNG_SAFE_LIMITS_SUPPORTED
++# ifdef PNG_USER_WIDTH_MAX
++# undef PNG_USER_WIDTH_MAX
++# define PNG_USER_WIDTH_MAX 1000000L
+ # endif
+-
+-/* For the memory copy APIs (i.e. the standard definitions of these),
+- * because this file defines png_memcpy and so on the base APIs must
+- * be defined here.
+- */
+-# ifdef BSD
+-# include <strings.h>
+-# else
+-# include <string.h>
++# ifdef PNG_USER_HEIGHT_MAX
++# undef PNG_USER_HEIGHT_MAX
++# define PNG_USER_HEIGHT_MAX 1000000L
+ # endif
+-
+-/* For png_FILE_p - this provides the standard definition of a
+- * FILE
+- */
+-# ifdef PNG_STDIO_SUPPORTED
+-# include <stdio.h>
++# ifdef PNG_USER_CHUNK_MALLOC_MAX
++# undef PNG_USER_CHUNK_MALLOC_MAX
++# define PNG_USER_CHUNK_MALLOC_MAX 4000000L
++# endif
++# ifdef PNG_USER_CHUNK_CACHE_MAX
++# undef PNG_USER_CHUNK_CACHE_MAX
++# define PNG_USER_CHUNK_CACHE_MAX 128
+ # endif
+ #endif
+
++#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
++
++/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
++ * compiler for correct compilation. The following header files are required by
++ * the standard. If your compiler doesn't provide these header files, or they
++ * do not match the standard, you will need to provide/improve them.
++ */
++#include <limits.h>
++#include <stddef.h>
++
++/* Library header files. These header files are all defined by ISOC90; libpng
++ * expects conformant implementations, however, an ISOC90 conformant system need
++ * not provide these header files if the functionality cannot be implemented.
++ * In this case it will be necessary to disable the relevant parts of libpng in
++ * the build of pnglibconf.h.
++ *
++ * Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
++ * include this unnecessary header file.
++ */
++
++#ifdef PNG_STDIO_SUPPORTED
++ /* Required for the definition of FILE: */
++# include <stdio.h>
++#endif
++
++#ifdef PNG_SETJMP_SUPPORTED
++ /* Required for the definition of jmp_buf and the declaration of longjmp: */
++# include <setjmp.h>
++#endif
++
++#ifdef PNG_CONVERT_tIME_SUPPORTED
++ /* Required for struct tm: */
++# include <time.h>
++#endif
++
++#endif /* PNG_BUILDING_SYMBOL_TABLE */
++
++/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
++ * PNG_NO_CONST; this is no longer supported except for data declarations which
++ * apparently still cause problems in 2011 on some compilers.
++ */
++#define PNG_CONST const /* backward compatibility only */
++
+ /* This controls optimization of the reading of 16 and 32 bit values
+ * from PNG files. It can be set on a per-app-file basis - it
+- * just changes whether a macro is used to the function is called.
+- * The library builder sets the default, if read functions are not
++ * just changes whether a macro is used when the function is called.
++ * The library builder sets the default; if read functions are not
+ * built into the library the macro implementation is forced on.
+ */
+ #ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
+@@ -100,28 +136,13 @@
+ * may be changed on a per-file basis when compiling against libpng.
+ */
+
+-/* The PNGARG macro protects us against machines that don't have function
+- * prototypes (ie K&R style headers). If your compiler does not handle
+- * function prototypes, define this macro and use the included ansi2knr.
+- * I've always been able to use _NO_PROTO as the indicator, but you may
+- * need to drag the empty declaration out in front of here, or change the
+- * ifdef to suit your own needs.
++/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
++ * against legacy (pre ISOC90) compilers that did not understand function
++ * prototypes. It is not required for modern C compilers.
+ */
+ #ifndef PNGARG
+-
+-# ifdef OF /* zlib prototype munger */
+-# define PNGARG(arglist) OF(arglist)
+-# else
+-
+-# ifdef _NO_PROTO
+-# define PNGARG(arglist) ()
+-# else
+-# define PNGARG(arglist) arglist
+-# endif /* _NO_PROTO */
+-
+-# endif /* OF */
+-
+-#endif /* PNGARG */
++# define PNGARG(arglist) arglist
++#endif
+
+ /* Function calling conventions.
+ * =============================
+@@ -192,7 +213,9 @@
+ * 'type', compiler specific.
+ *
+ * PNG_DLL_EXPORT Set to the magic to use during a libpng build to
+- * make a symbol exported from the DLL.
++ * make a symbol exported from the DLL. Not used in the
++ * public header files; see pngpriv.h for how it is used
++ * in the libpng build.
+ *
+ * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
+ * from a DLL - used to define PNG_IMPEXP when
+@@ -203,18 +226,16 @@
+ * ==========================
+ * This code is used at build time to find PNG_IMPEXP, the API settings
+ * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
+- * import processing is possible. On Windows/x86 systems it also sets
++ * import processing is possible. On Windows systems it also sets
+ * compiler-specific macros to the values required to change the calling
+ * conventions of the various functions.
+ */
+-#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
+- defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
+- ( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
+- defined(_M_X64) || defined(_M_IA64) )
+- /* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
+- * builds under Cygwin or MinGW. Also includes Watcom builds but these need
+- * special treatment because they are not compatible with GCC or Visual C
+- * because of different calling conventions.
++#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
++ defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
++ /* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
++ * MinGW on any architecture currently supported by Windows. Also includes
++ * Watcom builds but these need special treatment because they are not
++ * compatible with GCC or Visual C because of different calling conventions.
+ */
+ # if PNG_API_RULE == 2
+ /* If this line results in an error, either because __watcall is not
+@@ -225,9 +246,12 @@
+ # define PNGCAPI __watcall
+ # endif
+
+-# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
++# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
+ # define PNGCAPI __cdecl
+ # if PNG_API_RULE == 1
++ /* If this line results in an error __stdcall is not understood and
++ * PNG_API_RULE should not have been set to '1'.
++ */
+ # define PNGAPI __stdcall
+ # endif
+ # else
+@@ -242,10 +266,11 @@
+ # define PNGAPI _stdcall
+ # endif
+ # endif /* compiler/api */
++
+ /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
+
+ # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
+- ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
++# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
+ # endif
+
+ # if (defined(_MSC_VER) && _MSC_VER < 800) ||\
+@@ -265,7 +290,7 @@
+ # endif
+ # endif /* compiler */
+
+-#else /* !Windows/x86 */
++#else /* !Windows */
+ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
+ # define PNGAPI _System
+ # else /* !Windows/x86 && !OS/2 */
+@@ -286,25 +311,14 @@
+ # define PNGAPI PNGCAPI
+ #endif
+
+-/* The default for PNG_IMPEXP depends on whether the library is
+- * being built or used.
++/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
++ * then in an internal header file when building the library, otherwise (when
++ * using the library) it is set here.
+ */
+ #ifndef PNG_IMPEXP
+-# ifdef PNGLIB_BUILD
+- /* Building the library */
+-# if (defined(DLL_EXPORT)/*from libtool*/ ||\
+- defined(_WINDLL) || defined(_DLL) || defined(__DLL__) ||\
+- defined(_USRDLL) ||\
+- defined(PNG_BUILD_DLL)) && defined(PNG_DLL_EXPORT)
+- /* Building a DLL. */
+-# define PNG_IMPEXP PNG_DLL_EXPORT
+-# endif /* DLL */
+-# else
+- /* Using the library */
+-# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
+- /* This forces use of a DLL, disallowing static linking */
+-# define PNG_IMPEXP PNG_DLL_IMPORT
+-# endif
++# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
++ /* This forces use of a DLL, disallowing static linking */
++# define PNG_IMPEXP PNG_DLL_IMPORT
+ # endif
+
+ # ifndef PNG_IMPEXP
+@@ -370,26 +384,48 @@
+
+ #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
+ /* Support for compiler specific function attributes. These are used
+- * so that where compiler support is available incorrect use of API
++ * so that where compiler support is available, incorrect use of API
+ * functions in png.h will generate compiler warnings. Added at libpng
+- * version 1.2.41.
++ * version 1.2.41. Disabling these removes the warnings but may also produce
++ * less efficient code.
+ */
+-# if defined(__GNUC__)
++# if defined(__clang__) && defined(__has_attribute)
++ /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
++# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
++# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
++# endif
++# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
++# define PNG_NORETURN __attribute__((__noreturn__))
++# endif
++# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
++# define PNG_ALLOCATED __attribute__((__malloc__))
++# endif
++# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
++# define PNG_DEPRECATED __attribute__((__deprecated__))
++# endif
++# if !defined(PNG_PRIVATE)
++# ifdef __has_extension
++# if __has_extension(attribute_unavailable_with_message)
++# define PNG_PRIVATE __attribute__((__unavailable__(\
++ "This function is not exported by libpng.")))
++# endif
++# endif
++# endif
++# ifndef PNG_RESTRICT
++# define PNG_RESTRICT __restrict
++# endif
++
++# elif defined(__GNUC__)
+ # ifndef PNG_USE_RESULT
+ # define PNG_USE_RESULT __attribute__((__warn_unused_result__))
+ # endif
+ # ifndef PNG_NORETURN
+ # define PNG_NORETURN __attribute__((__noreturn__))
+ # endif
+-# ifndef PNG_ALLOCATED
+-# define PNG_ALLOCATED __attribute__((__malloc__))
+-# endif
+-
+- /* This specifically protects structure members that should only be
+- * accessed from within the library, therefore should be empty during
+- * a library build.
+- */
+-# ifndef PNGLIB_BUILD
++# if __GNUC__ >= 3
++# ifndef PNG_ALLOCATED
++# define PNG_ALLOCATED __attribute__((__malloc__))
++# endif
+ # ifndef PNG_DEPRECATED
+ # define PNG_DEPRECATED __attribute__((__deprecated__))
+ # endif
+@@ -402,10 +438,14 @@
+ __attribute__((__deprecated__))
+ # endif
+ # endif
+-# endif /* PNGLIB_BUILD */
+-# endif /* __GNUC__ */
++# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
++# ifndef PNG_RESTRICT
++# define PNG_RESTRICT __restrict
++# endif
++# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
++# endif /* __GNUC__ >= 3 */
+
+-# if defined(_MSC_VER) && (_MSC_VER >= 1300)
++# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
+ # ifndef PNG_USE_RESULT
+ # define PNG_USE_RESULT /* not supported */
+ # endif
+@@ -417,20 +457,23 @@
+ # define PNG_ALLOCATED __declspec(restrict)
+ # endif
+ # endif
++# ifndef PNG_DEPRECATED
++# define PNG_DEPRECATED __declspec(deprecated)
++# endif
++# ifndef PNG_PRIVATE
++# define PNG_PRIVATE __declspec(deprecated)
++# endif
++# ifndef PNG_RESTRICT
++# if (_MSC_VER >= 1400)
++# define PNG_RESTRICT __restrict
++# endif
++# endif
+
+- /* This specifically protects structure members that should only be
+- * accessed from within the library, therefore should be empty during
+- * a library build.
+- */
+-# ifndef PNGLIB_BUILD
+-# ifndef PNG_DEPRECATED
+-# define PNG_DEPRECATED __declspec(deprecated)
+-# endif
+-# ifndef PNG_PRIVATE
+-# define PNG_PRIVATE __declspec(deprecated)
+-# endif
+-# endif /* PNGLIB_BUILD */
+-# endif /* _MSC_VER */
++# elif defined(__WATCOMC__)
++# ifndef PNG_RESTRICT
++# define PNG_RESTRICT __restrict
++# endif
++# endif
+ #endif /* PNG_PEDANTIC_WARNINGS */
+
+ #ifndef PNG_DEPRECATED
+@@ -448,10 +491,14 @@
+ #ifndef PNG_PRIVATE
+ # define PNG_PRIVATE /* This is a private libpng function */
+ #endif
++#ifndef PNG_RESTRICT
++# define PNG_RESTRICT /* The C99 "restrict" feature */
++#endif
++
+ #ifndef PNG_FP_EXPORT /* A floating point API. */
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ # define PNG_FP_EXPORT(ordinal, type, name, args)\
+- PNG_EXPORT(ordinal, type, name, args)
++ PNG_EXPORT(ordinal, type, name, args);
+ # else /* No floating point APIs */
+ # define PNG_FP_EXPORT(ordinal, type, name, args)
+ # endif
+@@ -459,189 +506,167 @@
+ #ifndef PNG_FIXED_EXPORT /* A fixed point API. */
+ # ifdef PNG_FIXED_POINT_SUPPORTED
+ # define PNG_FIXED_EXPORT(ordinal, type, name, args)\
+- PNG_EXPORT(ordinal, type, name, args)
++ PNG_EXPORT(ordinal, type, name, args);
+ # else /* No fixed point APIs */
+ # define PNG_FIXED_EXPORT(ordinal, type, name, args)
+ # endif
+ #endif
+
+-/* The following uses const char * instead of char * for error
+- * and warning message functions, so some compilers won't complain.
+- * If you do not want to use const, define PNG_NO_CONST here.
++#ifndef PNG_BUILDING_SYMBOL_TABLE
++/* Some typedefs to get us started. These should be safe on most of the common
++ * platforms.
+ *
+- * This should not change how the APIs are called, so it can be done
+- * on a per-file basis in the application.
++ * png_uint_32 and png_int_32 may, currently, be larger than required to hold a
++ * 32-bit value however this is not normally advisable.
++ *
++ * png_uint_16 and png_int_16 should always be two bytes in size - this is
++ * verified at library build time.
++ *
++ * png_byte must always be one byte in size.
++ *
++ * The checks below use constants from limits.h, as defined by the ISOC90
++ * standard.
+ */
+-#ifndef PNG_CONST
+-# ifndef PNG_NO_CONST
+-# define PNG_CONST const
+-# else
+-# define PNG_CONST
++#if CHAR_BIT == 8 && UCHAR_MAX == 255
++ typedef unsigned char png_byte;
++#else
++# error "libpng requires 8 bit bytes"
++#endif
++
++#if INT_MIN == -32768 && INT_MAX == 32767
++ typedef int png_int_16;
++#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
++ typedef short png_int_16;
++#else
++# error "libpng requires a signed 16 bit type"
++#endif
++
++#if UINT_MAX == 65535
++ typedef unsigned int png_uint_16;
++#elif USHRT_MAX == 65535
++ typedef unsigned short png_uint_16;
++#else
++# error "libpng requires an unsigned 16 bit type"
++#endif
++
++#if INT_MIN < -2147483646 && INT_MAX > 2147483646
++ typedef int png_int_32;
++#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
++ typedef long int png_int_32;
++#else
++# error "libpng requires a signed 32 bit (or more) type"
++#endif
++
++#if UINT_MAX > 4294967294
++ typedef unsigned int png_uint_32;
++#elif ULONG_MAX > 4294967294
++ typedef unsigned long int png_uint_32;
++#else
++# error "libpng requires an unsigned 32 bit (or more) type"
++#endif
++
++/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
++ * requires an ISOC90 compiler and relies on consistent behavior of sizeof.
++ */
++typedef size_t png_size_t;
++typedef ptrdiff_t png_ptrdiff_t;
++
++/* libpng needs to know the maximum value of 'size_t' and this controls the
++ * definition of png_alloc_size_t, below. This maximum value of size_t limits
++ * but does not control the maximum allocations the library makes - there is
++ * direct application control of this through png_set_user_limits().
++ */
++#ifndef PNG_SMALL_SIZE_T
++ /* Compiler specific tests for systems where size_t is known to be less than
++ * 32 bits (some of these systems may no longer work because of the lack of
++ * 'far' support; see above.)
++ */
++# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
++ (defined(_MSC_VER) && defined(MAXSEG_64K))
++# define PNG_SMALL_SIZE_T
+ # endif
+ #endif
+
+-/* Some typedefs to get us started. These should be safe on most of the
+- * common platforms. The typedefs should be at least as large as the
+- * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
+- * don't have to be exactly that size. Some compilers dislike passing
+- * unsigned shorts as function parameters, so you may be better off using
+- * unsigned int for png_uint_16.
++/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
++ * smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
++ * png_alloc_size_t are not necessary; in fact, it is recommended not to use
++ * them at all so that the compiler can complain when something turns out to be
++ * problematic.
++ *
++ * Casts in the other direction (from png_alloc_size_t to png_size_t or
++ * png_uint_32) should be explicitly applied; however, we do not expect to
++ * encounter practical situations that require such conversions.
++ *
++ * PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
++ * 4294967295 - i.e. less than the maximum value of png_uint_32.
++ */
++#ifdef PNG_SMALL_SIZE_T
++ typedef png_uint_32 png_alloc_size_t;
++#else
++ typedef png_size_t png_alloc_size_t;
++#endif
++
++/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
++ * implementations of Intel CPU specific support of user-mode segmented address
++ * spaces, where 16-bit pointers address more than 65536 bytes of memory using
++ * separate 'segment' registers. The implementation requires two different
++ * types of pointer (only one of which includes the segment value.)
++ *
++ * If required this support is available in version 1.2 of libpng and may be
++ * available in versions through 1.5, although the correctness of the code has
++ * not been verified recently.
+ */
+
+-#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
+-typedef unsigned int png_uint_32;
+-typedef int png_int_32;
+-#else
+-typedef unsigned long png_uint_32;
+-typedef long png_int_32;
+-#endif
+-typedef unsigned short png_uint_16;
+-typedef short png_int_16;
+-typedef unsigned char png_byte;
+-
+-#ifdef PNG_NO_SIZE_T
+-typedef unsigned int png_size_t;
+-#else
+-typedef size_t png_size_t;
+-#endif
+-#define png_sizeof(x) (sizeof (x))
+-
+-/* The following is needed for medium model support. It cannot be in the
+- * pngpriv.h header. Needs modification for other compilers besides
+- * MSC. Model independent support declares all arrays and pointers to be
+- * large using the far keyword. The zlib version used must also support
+- * model independent data. As of version zlib 1.0.4, the necessary changes
+- * have been made in zlib. The USE_FAR_KEYWORD define triggers other
+- * changes that are needed. (Tim Wegner)
+- */
+-
+-/* Separate compiler dependencies (problem here is that zlib.h always
+- * defines FAR. (SJT)
+- */
+-#ifdef __BORLANDC__
+-# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
+-# define LDATA 1
+-# else
+-# define LDATA 0
+-# endif
+- /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
+-# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
+-# define PNG_MAX_MALLOC_64K /* only used in build */
+-# if (LDATA != 1)
+-# ifndef FAR
+-# define FAR __far
+-# endif
+-# define USE_FAR_KEYWORD
+-# endif /* LDATA != 1 */
+- /* Possibly useful for moving data out of default segment.
+- * Uncomment it if you want. Could also define FARDATA as
+- * const if your compiler supports it. (SJT)
+-# define FARDATA FAR
+- */
+-# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
+-#endif /* __BORLANDC__ */
+-
+-
+-/* Suggest testing for specific compiler first before testing for
+- * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
+- * making reliance oncertain keywords suspect. (SJT)
+- */
+-
+-/* MSC Medium model */
+-#ifdef FAR
+-# ifdef M_I86MM
+-# define USE_FAR_KEYWORD
+-# define FARDATA FAR
+-# include <dos.h>
+-# endif
+-#endif
+-
+-/* SJT: default case */
+-#ifndef FAR
+-# define FAR
+-#endif
+-
+-/* At this point FAR is always defined */
+-#ifndef FARDATA
+-# define FARDATA
+-#endif
+-
+-/* Typedef for floating-point numbers that are converted
+- * to fixed-point with a multiple of 100,000, e.g., gamma
++/* Typedef for floating-point numbers that are converted to fixed-point with a
++ * multiple of 100,000, e.g., gamma
+ */
+ typedef png_int_32 png_fixed_point;
+
+ /* Add typedefs for pointers */
+-typedef void FAR * png_voidp;
+-typedef PNG_CONST void FAR * png_const_voidp;
+-typedef png_byte FAR * png_bytep;
+-typedef PNG_CONST png_byte FAR * png_const_bytep;
+-typedef png_uint_32 FAR * png_uint_32p;
+-typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
+-typedef png_int_32 FAR * png_int_32p;
+-typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
+-typedef png_uint_16 FAR * png_uint_16p;
+-typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
+-typedef png_int_16 FAR * png_int_16p;
+-typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
+-typedef char FAR * png_charp;
+-typedef PNG_CONST char FAR * png_const_charp;
+-typedef png_fixed_point FAR * png_fixed_point_p;
+-typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
+-typedef png_size_t FAR * png_size_tp;
+-typedef PNG_CONST png_size_t FAR * png_const_size_tp;
++typedef void * png_voidp;
++typedef const void * png_const_voidp;
++typedef png_byte * png_bytep;
++typedef const png_byte * png_const_bytep;
++typedef png_uint_32 * png_uint_32p;
++typedef const png_uint_32 * png_const_uint_32p;
++typedef png_int_32 * png_int_32p;
++typedef const png_int_32 * png_const_int_32p;
++typedef png_uint_16 * png_uint_16p;
++typedef const png_uint_16 * png_const_uint_16p;
++typedef png_int_16 * png_int_16p;
++typedef const png_int_16 * png_const_int_16p;
++typedef char * png_charp;
++typedef const char * png_const_charp;
++typedef png_fixed_point * png_fixed_point_p;
++typedef const png_fixed_point * png_const_fixed_point_p;
++typedef png_size_t * png_size_tp;
++typedef const png_size_t * png_const_size_tp;
+
+ #ifdef PNG_STDIO_SUPPORTED
+ typedef FILE * png_FILE_p;
+ #endif
+
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+-typedef double FAR * png_doublep;
+-typedef PNG_CONST double FAR * png_const_doublep;
++typedef double * png_doublep;
++typedef const double * png_const_doublep;
+ #endif
+
+ /* Pointers to pointers; i.e. arrays */
+-typedef png_byte FAR * FAR * png_bytepp;
+-typedef png_uint_32 FAR * FAR * png_uint_32pp;
+-typedef png_int_32 FAR * FAR * png_int_32pp;
+-typedef png_uint_16 FAR * FAR * png_uint_16pp;
+-typedef png_int_16 FAR * FAR * png_int_16pp;
+-typedef PNG_CONST char FAR * FAR * png_const_charpp;
+-typedef char FAR * FAR * png_charpp;
+-typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
++typedef png_byte * * png_bytepp;
++typedef png_uint_32 * * png_uint_32pp;
++typedef png_int_32 * * png_int_32pp;
++typedef png_uint_16 * * png_uint_16pp;
++typedef png_int_16 * * png_int_16pp;
++typedef const char * * png_const_charpp;
++typedef char * * png_charpp;
++typedef png_fixed_point * * png_fixed_point_pp;
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+-typedef double FAR * FAR * png_doublepp;
++typedef double * * png_doublepp;
+ #endif
+
+ /* Pointers to pointers to pointers; i.e., pointer to array */
+-typedef char FAR * FAR * FAR * png_charppp;
++typedef char * * * png_charppp;
+
+-/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
+- * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
+- * to png_alloc_size_t are not necessary; in fact, it is recommended
+- * not to use them at all so that the compiler can complain when something
+- * turns out to be problematic.
+- * Casts in the other direction (from png_alloc_size_t to png_size_t or
+- * png_uint_32) should be explicitly applied; however, we do not expect
+- * to encounter practical situations that require such conversions.
+- */
+-#if defined(__TURBOC__) && !defined(__FLAT__)
+- typedef unsigned long png_alloc_size_t;
+-#else
+-# if defined(_MSC_VER) && defined(MAXSEG_64K)
+- typedef unsigned long png_alloc_size_t;
+-# else
+- /* This is an attempt to detect an old Windows system where (int) is
+- * actually 16 bits, in that case png_malloc must have an argument with a
+- * bigger size to accomodate the requirements of the library.
+- */
+-# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
+- (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
+- typedef DWORD png_alloc_size_t;
+-# else
+- typedef png_size_t png_alloc_size_t;
+-# endif
+-# endif
+-#endif
++#endif /* PNG_BUILDING_SYMBOL_TABLE */
+
+ #endif /* PNGCONF_H */
+--- ./jdk/src/share/native/sun/awt/libpng/pngdebug.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngdebug.h Fri Apr 10 09:21:28 2015 -0700
+@@ -29,11 +29,11 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+- * Last changed in libpng 1.5.0 [January 6, 2011]
++ * Last changed in libpng 1.6.8 [December 19, 2013]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+@@ -53,7 +53,7 @@
+ * (actually ((void)0)).
+ *
+ * level: level of detail of message, starting at 0. A level 'n'
+- * message is preceded by 'n' tab characters (not implemented
++ * message is preceded by 'n' 3-space indentations (not implemented
+ * on Microsoft compilers unless PNG_DEBUG_FILE is also
+ * defined, to allow debug DLL compilation with no standard IO).
+ * message: a printf(3) style text string. A trailing '\n' is added
+@@ -105,32 +105,29 @@
+ # endif /* PNG_DEBUG_FILE */
+
+ # if (PNG_DEBUG > 1)
+-/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
+- * non-ISO compilers
+- */
+ # ifdef __STDC__
+ # ifndef png_debug
+ # define png_debug(l,m) \
+ do { \
+ int num_tabs=l; \
+- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
++ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
++ (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
+ } while (0)
+ # endif
+ # ifndef png_debug1
+ # define png_debug1(l,m,p1) \
+ do { \
+ int num_tabs=l; \
+- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
++ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
++ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
+ } while (0)
+ # endif
+ # ifndef png_debug2
+ # define png_debug2(l,m,p1,p2) \
+ do { \
+ int num_tabs=l; \
+- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+- (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
++ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
++ (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
+ } while (0)
+ # endif
+ # else /* __STDC __ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngerror.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngerror.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -48,14 +48,14 @@
+
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+
+-static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
++static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
+ png_const_charp error_message)),PNG_NORETURN);
+
+ #ifdef PNG_WARNINGS_SUPPORTED
+ static void /* PRIVATE */
+-png_default_warning PNGARG((png_structp png_ptr,
++png_default_warning PNGARG((png_const_structrp png_ptr,
+ png_const_charp warning_message));
+-#endif /* PNG_WARNINGS_SUPPORTED */
++#endif /* WARNINGS */
+
+ /* This function is called whenever there is a fatal error. This function
+ * should not be changed. If there is a need to handle errors differently,
+@@ -64,14 +64,15 @@
+ */
+ #ifdef PNG_ERROR_TEXT_SUPPORTED
+ PNG_FUNCTION(void,PNGAPI
+-png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
++png_error,(png_const_structrp png_ptr, png_const_charp error_message),
++ PNG_NORETURN)
+ {
+ #ifdef PNG_ERROR_NUMBERS_SUPPORTED
+ char msg[16];
+ if (png_ptr != NULL)
+ {
+- if (png_ptr->flags&
+- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
++ if ((png_ptr->flags &
++ (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
+ {
+ if (*error_message == PNG_LITERAL_SHARP)
+ {
+@@ -81,7 +82,7 @@
+ if (error_message[offset] == ' ')
+ break;
+
+- if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
++ if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
+ {
+ int i;
+ for (i = 0; i < offset - 1; i++)
+@@ -96,7 +97,7 @@
+
+ else
+ {
+- if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
++ if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
+ {
+ msg[0] = '0';
+ msg[1] = '\0';
+@@ -107,7 +108,8 @@
+ }
+ #endif
+ if (png_ptr != NULL && png_ptr->error_fn != NULL)
+- (*(png_ptr->error_fn))(png_ptr, error_message);
++ (*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
++ error_message);
+
+ /* If the custom handler doesn't exist, or if it returns,
+ use the default handler, which will not return. */
+@@ -115,7 +117,7 @@
+ }
+ #else
+ PNG_FUNCTION(void,PNGAPI
+-png_err,(png_structp png_ptr),PNG_NORETURN)
++png_err,(png_const_structrp png_ptr),PNG_NORETURN)
+ {
+ /* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
+ * erroneously as '\0', instead of the empty string "". This was
+@@ -123,13 +125,13 @@
+ * will crash in this case.
+ */
+ if (png_ptr != NULL && png_ptr->error_fn != NULL)
+- (*(png_ptr->error_fn))(png_ptr, "");
++ (*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr), "");
+
+ /* If the custom handler doesn't exist, or if it returns,
+ use the default handler, which will not return. */
+ png_default_error(png_ptr, "");
+ }
+-#endif /* PNG_ERROR_TEXT_SUPPORTED */
++#endif /* ERROR_TEXT */
+
+ /* Utility to safely appends strings to a buffer. This never errors out so
+ * error checking is not required in the caller.
+@@ -178,7 +180,7 @@
+ case PNG_NUMBER_FORMAT_fixed:
+ /* Needs five digits (the fraction) */
+ mincount = 5;
+- if (output || number % 10 != 0)
++ if (output != 0 || number % 10 != 0)
+ {
+ *--end = digits[number % 10];
+ output = 1;
+@@ -189,7 +191,7 @@
+ case PNG_NUMBER_FORMAT_02u:
+ /* Expects at least 2 digits. */
+ mincount = 2;
+- /* fall through */
++ /* FALL THROUGH */
+
+ case PNG_NUMBER_FORMAT_u:
+ *--end = digits[number % 10];
+@@ -199,7 +201,7 @@
+ case PNG_NUMBER_FORMAT_02x:
+ /* This format expects at least two digits */
+ mincount = 2;
+- /* fall through */
++ /* FALL THROUGH */
+
+ case PNG_NUMBER_FORMAT_x:
+ *--end = digits[number & 0xf];
+@@ -215,13 +217,13 @@
+ ++count;
+
+ /* Float a fixed number here: */
+- if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
++ if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
+ {
+ /* End of the fraction, but maybe nothing was output? In that case
+ * drop the decimal point. If the number is a true zero handle that
+ * here.
+ */
+- if (output)
++ if (output != 0)
+ *--end = '.';
+ else if (number == 0) /* and !output */
+ *--end = '0';
+@@ -239,14 +241,14 @@
+ * png_set_error_fn() to replace the warning function at run-time.
+ */
+ void PNGAPI
+-png_warning(png_structp png_ptr, png_const_charp warning_message)
++png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
+ {
+ int offset = 0;
+ if (png_ptr != NULL)
+ {
+ #ifdef PNG_ERROR_NUMBERS_SUPPORTED
+- if (png_ptr->flags&
+- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
++ if ((png_ptr->flags &
++ (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
+ #endif
+ {
+ if (*warning_message == PNG_LITERAL_SHARP)
+@@ -258,7 +260,8 @@
+ }
+ }
+ if (png_ptr != NULL && png_ptr->warning_fn != NULL)
+- (*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
++ (*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
++ warning_message + offset);
+ else
+ png_default_warning(png_ptr, warning_message + offset);
+ }
+@@ -306,38 +309,43 @@
+ }
+
+ void
+-png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
++png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
+ png_const_charp message)
+ {
+- /* The internal buffer is just 128 bytes - enough for all our messages,
+- * overflow doesn't happen because this code checks!
++ /* The internal buffer is just 192 bytes - enough for all our messages,
++ * overflow doesn't happen because this code checks! If someone figures
++ * out how to send us a message longer than 192 bytes, all that will
++ * happen is that the message will be truncated appropriately.
+ */
+- size_t i;
+- char msg[128];
++ size_t i = 0; /* Index in the msg[] buffer: */
++ char msg[192];
+
+- for (i=0; i<(sizeof msg)-1 && *message != '\0'; ++i)
++ /* Each iteration through the following loop writes at most one character
++ * to msg[i++] then returns here to validate that there is still space for
++ * the trailing '\0'. It may (in the case of a parameter) read more than
++ * one character from message[]; it must check for '\0' and continue to the
++ * test if it finds the end of string.
++ */
++ while (i<(sizeof msg)-1 && *message != '\0')
+ {
+- if (*message == '@')
++ /* '@' at end of string is now just printed (previously it was skipped);
++ * it is an error in the calling code to terminate the string with @.
++ */
++ if (p != NULL && *message == '@' && message[1] != '\0')
+ {
+- int parameter = -1;
+- switch (*++message)
+- {
+- case '1':
+- parameter = 0;
+- break;
++ int parameter_char = *++message; /* Consume the '@' */
++ static const char valid_parameters[] = "123456789";
++ int parameter = 0;
+
+- case '2':
+- parameter = 1;
+- break;
++ /* Search for the parameter digit, the index in the string is the
++ * parameter to use.
++ */
++ while (valid_parameters[parameter] != parameter_char &&
++ valid_parameters[parameter] != '\0')
++ ++parameter;
+
+- case '\0':
+- continue; /* To break out of the for loop above. */
+-
+- default:
+- break;
+- }
+-
+- if (parameter >= 0 && parameter < PNG_WARNING_PARAMETER_COUNT)
++ /* If the parameter digit is out of range it will just get printed. */
++ if (parameter < PNG_WARNING_PARAMETER_COUNT)
+ {
+ /* Append this parameter */
+ png_const_charp parm = p[parameter];
+@@ -347,47 +355,101 @@
+ * that parm[] has been initialized, so there is no guarantee of a
+ * trailing '\0':
+ */
+- for (; i<(sizeof msg)-1 && parm != '\0' && parm < pend; ++i)
+- msg[i] = *parm++;
++ while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
++ msg[i++] = *parm++;
+
++ /* Consume the parameter digit too: */
+ ++message;
+ continue;
+ }
+
+ /* else not a parameter and there is a character after the @ sign; just
+- * copy that.
++ * copy that. This is known not to be '\0' because of the test above.
+ */
+ }
+
+ /* At this point *message can't be '\0', even in the bad parameter case
+ * above where there is a lone '@' at the end of the message string.
+ */
+- msg[i] = *message++;
++ msg[i++] = *message++;
+ }
+
+ /* i is always less than (sizeof msg), so: */
+ msg[i] = '\0';
+
+- /* And this is the formatted message: */
++ /* And this is the formatted message. It may be larger than
++ * PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these
++ * are not (currently) formatted.
++ */
+ png_warning(png_ptr, msg);
+ }
+-#endif /* PNG_WARNINGS_SUPPORTED */
++#endif /* WARNINGS */
+
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ void PNGAPI
+-png_benign_error(png_structp png_ptr, png_const_charp error_message)
++png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
+ {
+- if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
++ if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
++ {
++# ifdef PNG_READ_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
++ png_ptr->chunk_name != 0)
++ png_chunk_warning(png_ptr, error_message);
++ else
++# endif
++ png_warning(png_ptr, error_message);
++ }
++
++ else
++ {
++# ifdef PNG_READ_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
++ png_ptr->chunk_name != 0)
++ png_chunk_error(png_ptr, error_message);
++ else
++# endif
++ png_error(png_ptr, error_message);
++ }
++
++# ifndef PNG_ERROR_TEXT_SUPPORTED
++ PNG_UNUSED(error_message)
++# endif
++}
++
++void /* PRIVATE */
++png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
++{
++ if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
+ png_warning(png_ptr, error_message);
+ else
+ png_error(png_ptr, error_message);
++
++# ifndef PNG_ERROR_TEXT_SUPPORTED
++ PNG_UNUSED(error_message)
++# endif
+ }
+-#endif
+
++void /* PRIVATE */
++png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
++{
++ if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
++ png_warning(png_ptr, error_message);
++ else
++ png_error(png_ptr, error_message);
++
++# ifndef PNG_ERROR_TEXT_SUPPORTED
++ PNG_UNUSED(error_message)
++# endif
++}
++#endif /* BENIGN_ERRORS */
++
++#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
++#if defined(PNG_WARNINGS_SUPPORTED) || \
++ (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
+ /* These utilities are used internally to build an error message that relates
+ * to the current chunk. The chunk name comes from png_ptr->chunk_name,
+- * this is used to prefix the message. The message is limited in length
+- * to 63 bytes, the name characters are output as hex digits wrapped in []
++ * which is used to prefix the message. The message is limited in length
++ * to 63 bytes. The name characters are output as hex digits wrapped in []
+ * if the character is invalid.
+ */
+ #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
+@@ -396,18 +458,19 @@
+ 'A', 'B', 'C', 'D', 'E', 'F'
+ };
+
+-#define PNG_MAX_ERROR_TEXT 64
+-#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
+ static void /* PRIVATE */
+-png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
++png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
+ error_message)
+ {
+- int iout = 0, iin = 0;
++ png_uint_32 chunk_name = png_ptr->chunk_name;
++ int iout = 0, ishift = 24;
+
+- while (iin < 4)
++ while (ishift >= 0)
+ {
+- int c = png_ptr->chunk_name[iin++];
+- if (isnonalpha(c))
++ int c = (int)(chunk_name >> ishift) & 0xff;
++
++ ishift -= 8;
++ if (isnonalpha(c) != 0)
+ {
+ buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
+ buffer[iout++] = png_digit[(c & 0xf0) >> 4];
+@@ -417,7 +480,7 @@
+
+ else
+ {
+- buffer[iout++] = (png_byte)c;
++ buffer[iout++] = (char)c;
+ }
+ }
+
+@@ -426,10 +489,11 @@
+
+ else
+ {
++ int iin = 0;
++
+ buffer[iout++] = ':';
+ buffer[iout++] = ' ';
+
+- iin = 0;
+ while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
+ buffer[iout++] = error_message[iin++];
+
+@@ -437,11 +501,11 @@
+ buffer[iout] = '\0';
+ }
+ }
+-#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
++#endif /* WARNINGS || ERROR_TEXT */
+
+ #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
+ PNG_FUNCTION(void,PNGAPI
+-png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
++png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
+ PNG_NORETURN)
+ {
+ char msg[18+PNG_MAX_ERROR_TEXT];
+@@ -454,11 +518,11 @@
+ png_error(png_ptr, msg);
+ }
+ }
+-#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
++#endif /* READ && ERROR_TEXT */
+
+ #ifdef PNG_WARNINGS_SUPPORTED
+ void PNGAPI
+-png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
++png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
+ {
+ char msg[18+PNG_MAX_ERROR_TEXT];
+ if (png_ptr == NULL)
+@@ -470,38 +534,83 @@
+ png_warning(png_ptr, msg);
+ }
+ }
+-#endif /* PNG_WARNINGS_SUPPORTED */
++#endif /* WARNINGS */
+
+ #ifdef PNG_READ_SUPPORTED
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ void PNGAPI
+-png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
++png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
++ error_message)
+ {
+- if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
++ if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
+ png_chunk_warning(png_ptr, error_message);
+
+ else
+ png_chunk_error(png_ptr, error_message);
++
++# ifndef PNG_ERROR_TEXT_SUPPORTED
++ PNG_UNUSED(error_message)
++# endif
+ }
+ #endif
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* READ */
++
++void /* PRIVATE */
++png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
++{
++# ifndef PNG_WARNINGS_SUPPORTED
++ PNG_UNUSED(message)
++# endif
++
++ /* This is always supported, but for just read or just write it
++ * unconditionally does the right thing.
++ */
++# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
++# endif
++
++# ifdef PNG_READ_SUPPORTED
++ {
++ if (error < PNG_CHUNK_ERROR)
++ png_chunk_warning(png_ptr, message);
++
++ else
++ png_chunk_benign_error(png_ptr, message);
++ }
++# endif
++
++# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
++ else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
++# endif
++
++# ifdef PNG_WRITE_SUPPORTED
++ {
++ if (error < PNG_CHUNK_WRITE_ERROR)
++ png_app_warning(png_ptr, message);
++
++ else
++ png_app_error(png_ptr, message);
++ }
++# endif
++}
+
+ #ifdef PNG_ERROR_TEXT_SUPPORTED
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+ PNG_FUNCTION(void,
+-png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
++png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
+ {
+ # define fixed_message "fixed point overflow in "
+ # define fixed_message_ln ((sizeof fixed_message)-1)
+ int iin;
+ char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
+- png_memcpy(msg, fixed_message, fixed_message_ln);
++ memcpy(msg, fixed_message, fixed_message_ln);
+ iin = 0;
+- if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
+- {
+- msg[fixed_message_ln + iin] = name[iin];
+- ++iin;
+- }
++ if (name != NULL)
++ while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
++ {
++ msg[fixed_message_ln + iin] = name[iin];
++ ++iin;
++ }
+ msg[fixed_message_ln + iin] = 0;
+ png_error(png_ptr, msg);
+ }
+@@ -513,14 +622,111 @@
+ * otherwise it is necessary for png_default_error to be overridden.
+ */
+ jmp_buf* PNGAPI
+-png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
++png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
+ size_t jmp_buf_size)
+ {
+- if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
++ /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
++ * and it must not change after that. Libpng doesn't care how big the
++ * buffer is, just that it doesn't change.
++ *
++ * If the buffer size is no *larger* than the size of jmp_buf when libpng is
++ * compiled a built in jmp_buf is returned; this preserves the pre-1.6.0
++ * semantics that this call will not fail. If the size is larger, however,
++ * the buffer is allocated and this may fail, causing the function to return
++ * NULL.
++ */
++ if (png_ptr == NULL)
+ return NULL;
+
++ if (png_ptr->jmp_buf_ptr == NULL)
++ {
++ png_ptr->jmp_buf_size = 0; /* not allocated */
++
++ if (jmp_buf_size <= (sizeof png_ptr->jmp_buf_local))
++ png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local;
++
++ else
++ {
++ png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
++ png_malloc_warn(png_ptr, jmp_buf_size));
++
++ if (png_ptr->jmp_buf_ptr == NULL)
++ return NULL; /* new NULL return on OOM */
++
++ png_ptr->jmp_buf_size = jmp_buf_size;
++ }
++ }
++
++ else /* Already allocated: check the size */
++ {
++ size_t size = png_ptr->jmp_buf_size;
++
++ if (size == 0)
++ {
++ size = (sizeof png_ptr->jmp_buf_local);
++ if (png_ptr->jmp_buf_ptr != &png_ptr->jmp_buf_local)
++ {
++ /* This is an internal error in libpng: somehow we have been left
++ * with a stack allocated jmp_buf when the application regained
++ * control. It's always possible to fix this up, but for the moment
++ * this is a png_error because that makes it easy to detect.
++ */
++ png_error(png_ptr, "Libpng jmp_buf still allocated");
++ /* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */
++ }
++ }
++
++ if (size != jmp_buf_size)
++ {
++ png_warning(png_ptr, "Application jmp_buf size changed");
++ return NULL; /* caller will probably crash: no choice here */
++ }
++ }
++
++ /* Finally fill in the function, now we have a satisfactory buffer. It is
++ * valid to change the function on every call.
++ */
+ png_ptr->longjmp_fn = longjmp_fn;
+- return &png_ptr->longjmp_buffer;
++ return png_ptr->jmp_buf_ptr;
++}
++
++void /* PRIVATE */
++png_free_jmpbuf(png_structrp png_ptr)
++{
++ if (png_ptr != NULL)
++ {
++ jmp_buf *jb = png_ptr->jmp_buf_ptr;
++
++ /* A size of 0 is used to indicate a local, stack, allocation of the
++ * pointer; used here and in png.c
++ */
++ if (jb != NULL && png_ptr->jmp_buf_size > 0)
++ {
++
++ /* This stuff is so that a failure to free the error control structure
++ * does not leave libpng in a state with no valid error handling: the
++ * free always succeeds, if there is an error it gets ignored.
++ */
++ if (jb != &png_ptr->jmp_buf_local)
++ {
++ /* Make an internal, libpng, jmp_buf to return here */
++ jmp_buf free_jmp_buf;
++
++ if (!setjmp(free_jmp_buf))
++ {
++ png_ptr->jmp_buf_ptr = &free_jmp_buf; /* come back here */
++ png_ptr->jmp_buf_size = 0; /* stack allocation */
++ png_ptr->longjmp_fn = longjmp;
++ png_free(png_ptr, jb); /* Return to setjmp on error */
++ }
++ }
++ }
++
++ /* *Always* cancel everything out: */
++ png_ptr->jmp_buf_size = 0;
++ png_ptr->jmp_buf_ptr = NULL;
++ png_ptr->longjmp_fn = 0;
++ }
+ }
+ #endif
+
+@@ -530,7 +736,7 @@
+ * error function pointer in png_set_error_fn().
+ */
+ static PNG_FUNCTION(void /* PRIVATE */,
+-png_default_error,(png_structp png_ptr, png_const_charp error_message),
++png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
+ PNG_NORETURN)
+ {
+ #ifdef PNG_CONSOLE_IO_SUPPORTED
+@@ -577,24 +783,23 @@
+ }
+
+ PNG_FUNCTION(void,PNGAPI
+-png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
++png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
+ {
+ #ifdef PNG_SETJMP_SUPPORTED
+- if (png_ptr && png_ptr->longjmp_fn)
+- {
+-# ifdef USE_FAR_KEYWORD
+- {
+- jmp_buf tmp_jmpbuf;
+- png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
+- png_ptr->longjmp_fn(tmp_jmpbuf, val);
+- }
++ if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
++ png_ptr->jmp_buf_ptr != NULL)
++ png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(val)
++#endif
+
+-# else
+- png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
+-# endif
+- }
+-#endif
+- /* Here if not setjmp support or if png_ptr is null. */
++ /* If control reaches this point, png_longjmp() must not return. The only
++ * choice is to terminate the whole process (or maybe the thread); to do
++ * this the ANSI-C abort() function is used unless a different method is
++ * implemented by overriding the default configuration setting for
++ * PNG_ABORT().
++ */
+ PNG_ABORT();
+ }
+
+@@ -605,7 +810,7 @@
+ * not used, but it is passed in case it may be useful.
+ */
+ static void /* PRIVATE */
+-png_default_warning(png_structp png_ptr, png_const_charp warning_message)
++png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
+ {
+ #ifdef PNG_CONSOLE_IO_SUPPORTED
+ # ifdef PNG_ERROR_NUMBERS_SUPPORTED
+@@ -647,15 +852,15 @@
+ #endif
+ PNG_UNUSED(png_ptr) /* Make compiler happy */
+ }
+-#endif /* PNG_WARNINGS_SUPPORTED */
++#endif /* WARNINGS */
+
+ /* This function is called when the application wants to use another method
+ * of handling errors and warnings. Note that the error function MUST NOT
+ * return to the calling routine or serious problems will occur. The return
+- * method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1)
++ * method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1)
+ */
+ void PNGAPI
+-png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
++png_set_error_fn(png_structrp png_ptr, png_voidp error_ptr,
+ png_error_ptr error_fn, png_error_ptr warning_fn)
+ {
+ if (png_ptr == NULL)
+@@ -676,7 +881,7 @@
+ * pointer before png_write_destroy and png_read_destroy are called.
+ */
+ png_voidp PNGAPI
+-png_get_error_ptr(png_const_structp png_ptr)
++png_get_error_ptr(png_const_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+ return NULL;
+@@ -687,7 +892,7 @@
+
+ #ifdef PNG_ERROR_NUMBERS_SUPPORTED
+ void PNGAPI
+-png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
++png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
+ {
+ if (png_ptr != NULL)
+ {
+@@ -697,4 +902,90 @@
+ }
+ }
+ #endif
+-#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
++
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++ /* Currently the above both depend on SETJMP_SUPPORTED, however it would be
++ * possible to implement without setjmp support just so long as there is some
++ * way to handle the error return here:
++ */
++PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
++png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
++ PNG_NORETURN)
++{
++ const png_const_structrp png_ptr = png_nonconst_ptr;
++ png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
++
++ /* An error is always logged here, overwriting anything (typically a warning)
++ * that is already there:
++ */
++ if (image != NULL)
++ {
++ png_safecat(image->message, (sizeof image->message), 0, error_message);
++ image->warning_or_error |= PNG_IMAGE_ERROR;
++
++ /* Retrieve the jmp_buf from within the png_control, making this work for
++ * C++ compilation too is pretty tricky: C++ wants a pointer to the first
++ * element of a jmp_buf, but C doesn't tell us the type of that.
++ */
++ if (image->opaque != NULL && image->opaque->error_buf != NULL)
++ longjmp(png_control_jmp_buf(image->opaque), 1);
++
++ /* Missing longjmp buffer, the following is to help debugging: */
++ {
++ size_t pos = png_safecat(image->message, (sizeof image->message), 0,
++ "bad longjmp: ");
++ png_safecat(image->message, (sizeof image->message), pos,
++ error_message);
++ }
++ }
++
++ /* Here on an internal programming error. */
++ abort();
++}
++
++#ifdef PNG_WARNINGS_SUPPORTED
++void /* PRIVATE */ PNGCBAPI
++png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
++{
++ const png_const_structrp png_ptr = png_nonconst_ptr;
++ png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
++
++ /* A warning is only logged if there is no prior warning or error. */
++ if (image->warning_or_error == 0)
++ {
++ png_safecat(image->message, (sizeof image->message), 0, warning_message);
++ image->warning_or_error |= PNG_IMAGE_WARNING;
++ }
++}
++#endif
++
++int /* PRIVATE */
++png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
++{
++ volatile png_imagep image = image_in;
++ volatile int result;
++ volatile png_voidp saved_error_buf;
++ jmp_buf safe_jmpbuf;
++
++ /* Safely execute function(arg) with png_error returning to this function. */
++ saved_error_buf = image->opaque->error_buf;
++ result = setjmp(safe_jmpbuf) == 0;
++
++ if (result != 0)
++ {
++
++ image->opaque->error_buf = safe_jmpbuf;
++ result = function(arg);
++ }
++
++ image->opaque->error_buf = saved_error_buf;
++
++ /* And do the cleanup prior to any failure return. */
++ if (result == 0)
++ png_image_free(image);
++
++ return result;
++}
++#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngget.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngget.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.1 [February 3, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -45,7 +45,7 @@
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
+
+ png_uint_32 PNGAPI
+-png_get_valid(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_uint_32 flag)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+@@ -55,7 +55,7 @@
+ }
+
+ png_size_t PNGAPI
+-png_get_rowbytes(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return(info_ptr->rowbytes);
+@@ -65,7 +65,7 @@
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ png_bytepp PNGAPI
+-png_get_rows(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return(info_ptr->row_pointers);
+@@ -77,7 +77,7 @@
+ #ifdef PNG_EASY_ACCESS_SUPPORTED
+ /* Easy access to info, added in libpng-0.99 */
+ png_uint_32 PNGAPI
+-png_get_image_width(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->width;
+@@ -86,7 +86,7 @@
+ }
+
+ png_uint_32 PNGAPI
+-png_get_image_height(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->height;
+@@ -95,7 +95,7 @@
+ }
+
+ png_byte PNGAPI
+-png_get_bit_depth(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->bit_depth;
+@@ -104,7 +104,7 @@
+ }
+
+ png_byte PNGAPI
+-png_get_color_type(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->color_type;
+@@ -113,7 +113,7 @@
+ }
+
+ png_byte PNGAPI
+-png_get_filter_type(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->filter_type;
+@@ -122,7 +122,7 @@
+ }
+
+ png_byte PNGAPI
+-png_get_interlace_type(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->interlace_type;
+@@ -131,7 +131,7 @@
+ }
+
+ png_byte PNGAPI
+-png_get_compression_type(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return info_ptr->compression_type;
+@@ -140,10 +140,12 @@
+ }
+
+ png_uint_32 PNGAPI
+-png_get_x_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
++ info_ptr)
+ {
+ #ifdef PNG_pHYs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function",
+ "png_get_x_pixels_per_meter");
+@@ -151,16 +153,21 @@
+ if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
+ return (info_ptr->x_pixels_per_unit);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+ }
+
+ png_uint_32 PNGAPI
+-png_get_y_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
++ info_ptr)
+ {
+ #ifdef PNG_pHYs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function",
+ "png_get_y_pixels_per_meter");
+@@ -168,16 +175,20 @@
+ if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
+ return (info_ptr->y_pixels_per_unit);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+ }
+
+ png_uint_32 PNGAPI
+-png_get_pixels_per_meter(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #ifdef PNG_pHYs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
+
+@@ -185,6 +196,9 @@
+ info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
+ return (info_ptr->x_pixels_per_unit);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+@@ -192,10 +206,12 @@
+
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+ float PNGAPI
+-png_get_pixel_aspect_ratio(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
++ info_ptr)
+ {
+ #ifdef PNG_READ_pHYs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
+
+@@ -203,6 +219,9 @@
+ return ((float)((float)info_ptr->y_pixels_per_unit
+ /(float)info_ptr->x_pixels_per_unit));
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return ((float)0.0);
+@@ -211,14 +230,15 @@
+
+ #ifdef PNG_FIXED_POINT_SUPPORTED
+ png_fixed_point PNGAPI
+-png_get_pixel_aspect_ratio_fixed(png_const_structp png_ptr,
+- png_const_infop info_ptr)
++png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
++ png_const_inforp info_ptr)
+ {
+ #ifdef PNG_READ_pHYs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
+- && info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0
+- && info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX
+- && info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0 &&
++ info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
++ info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
++ info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
+ {
+ png_fixed_point res;
+
+@@ -228,9 +248,12 @@
+ * range of 0..2^31-1; otherwise the cast might overflow.
+ */
+ if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
+- (png_int_32)info_ptr->x_pixels_per_unit))
++ (png_int_32)info_ptr->x_pixels_per_unit) != 0)
+ return res;
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return 0;
+@@ -238,64 +261,80 @@
+ #endif
+
+ png_int_32 PNGAPI
+-png_get_x_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #ifdef PNG_oFFs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_oFFs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
+
+ if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
+ return (info_ptr->x_offset);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+ }
+
+ png_int_32 PNGAPI
+-png_get_y_offset_microns(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #ifdef PNG_oFFs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_oFFs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
+
+ if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
+ return (info_ptr->y_offset);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+ }
+
+ png_int_32 PNGAPI
+-png_get_x_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #ifdef PNG_oFFs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_oFFs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
+
+ if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
+ return (info_ptr->x_offset);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+ }
+
+ png_int_32 PNGAPI
+-png_get_y_offset_pixels(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #ifdef PNG_oFFs_SUPPORTED
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_oFFs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
+
+ if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
+ return (info_ptr->y_offset);
+ }
++#else
++ PNG_UNUSED(png_ptr)
++ PNG_UNUSED(info_ptr)
+ #endif
+
+ return (0);
+@@ -326,7 +365,7 @@
+ */
+ png_fixed_point result;
+ if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
+- 5000))
++ 5000) != 0)
+ return result;
+
+ /* Overflow. */
+@@ -335,26 +374,26 @@
+ }
+
+ png_uint_32 PNGAPI
+-png_get_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
+ }
+
+ png_uint_32 PNGAPI
+-png_get_x_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
+ }
+
+ png_uint_32 PNGAPI
+-png_get_y_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
+ }
+
+ #ifdef PNG_FIXED_POINT_SUPPORTED
+ static png_fixed_point
+-png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns)
++png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
+ {
+ /* Convert from metres * 1,000,000 to inches * 100,000, meters to
+ * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
+@@ -365,8 +404,8 @@
+ }
+
+ png_fixed_point PNGAPI
+-png_get_x_offset_inches_fixed(png_structp png_ptr,
+- png_const_infop info_ptr)
++png_get_x_offset_inches_fixed(png_const_structrp png_ptr,
++ png_const_inforp info_ptr)
+ {
+ return png_fixed_inches_from_microns(png_ptr,
+ png_get_x_offset_microns(png_ptr, info_ptr));
+@@ -375,8 +414,8 @@
+
+ #ifdef PNG_FIXED_POINT_SUPPORTED
+ png_fixed_point PNGAPI
+-png_get_y_offset_inches_fixed(png_structp png_ptr,
+- png_const_infop info_ptr)
++png_get_y_offset_inches_fixed(png_const_structrp png_ptr,
++ png_const_inforp info_ptr)
+ {
+ return png_fixed_inches_from_microns(png_ptr,
+ png_get_y_offset_microns(png_ptr, info_ptr));
+@@ -385,7 +424,7 @@
+
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+ float PNGAPI
+-png_get_x_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_x_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ /* To avoid the overflow do the conversion directly in floating
+ * point.
+@@ -396,7 +435,7 @@
+
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+ float PNGAPI
+-png_get_y_offset_inches(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_y_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ /* To avoid the overflow do the conversion directly in floating
+ * point.
+@@ -407,12 +446,13 @@
+
+ #ifdef PNG_pHYs_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_pHYs_dpi(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
+ {
+ png_uint_32 retval = 0;
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "pHYs");
+
+@@ -443,15 +483,16 @@
+
+ return (retval);
+ }
+-#endif /* PNG_pHYs_SUPPORTED */
+-#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
++#endif /* pHYs */
++#endif /* INCH_CONVERSIONS */
+
+ /* png_get_channels really belongs in here, too, but it's been around longer */
+
+-#endif /* PNG_EASY_ACCESS_SUPPORTED */
++#endif /* EASY_ACCESS */
++
+
+ png_byte PNGAPI
+-png_get_channels(png_const_structp png_ptr, png_const_infop info_ptr)
++png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return(info_ptr->channels);
+@@ -459,22 +500,25 @@
+ return (0);
+ }
+
++#ifdef PNG_READ_SUPPORTED
+ png_const_bytep PNGAPI
+-png_get_signature(png_const_structp png_ptr, png_infop info_ptr)
++png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ if (png_ptr != NULL && info_ptr != NULL)
+ return(info_ptr->signature);
+
+ return (NULL);
+ }
++#endif
+
+ #ifdef PNG_bKGD_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr,
++png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_color_16p *background)
+ {
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
+- && background != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_bKGD) != 0 &&
++ background != NULL)
+ {
+ png_debug1(1, "in %s retrieval function", "bKGD");
+
+@@ -487,32 +531,95 @@
+ #endif
+
+ #ifdef PNG_cHRM_SUPPORTED
++/* The XYZ APIs were added in 1.5.5 to take advantage of the code added at the
++ * same time to correct the rgb grayscale coefficient defaults obtained from the
++ * cHRM chunk in 1.5.4
++ */
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_cHRM(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ double *white_x, double *white_y, double *red_x, double *red_y,
+ double *green_x, double *green_y, double *blue_x, double *blue_y)
+ {
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
++ /* Quiet API change: this code used to only return the end points if a cHRM
++ * chunk was present, but the end points can also come from iCCP or sRGB
++ * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
++ * the png_set_ APIs merely check that set end points are mutually
++ * consistent.
++ */
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "cHRM");
+
+ if (white_x != NULL)
+- *white_x = png_float(png_ptr, info_ptr->x_white, "cHRM white X");
++ *white_x = png_float(png_ptr,
++ info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
+ if (white_y != NULL)
+- *white_y = png_float(png_ptr, info_ptr->y_white, "cHRM white Y");
++ *white_y = png_float(png_ptr,
++ info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
+ if (red_x != NULL)
+- *red_x = png_float(png_ptr, info_ptr->x_red, "cHRM red X");
++ *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
++ "cHRM red X");
+ if (red_y != NULL)
+- *red_y = png_float(png_ptr, info_ptr->y_red, "cHRM red Y");
++ *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
++ "cHRM red Y");
+ if (green_x != NULL)
+- *green_x = png_float(png_ptr, info_ptr->x_green, "cHRM green X");
++ *green_x = png_float(png_ptr,
++ info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
+ if (green_y != NULL)
+- *green_y = png_float(png_ptr, info_ptr->y_green, "cHRM green Y");
++ *green_y = png_float(png_ptr,
++ info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
+ if (blue_x != NULL)
+- *blue_x = png_float(png_ptr, info_ptr->x_blue, "cHRM blue X");
++ *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
++ "cHRM blue X");
+ if (blue_y != NULL)
+- *blue_y = png_float(png_ptr, info_ptr->y_blue, "cHRM blue Y");
++ *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
++ "cHRM blue Y");
++ return (PNG_INFO_cHRM);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
++ double *red_X, double *red_Y, double *red_Z, double *green_X,
++ double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
++ double *blue_Z)
++{
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
++ {
++ png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
++
++ if (red_X != NULL)
++ *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
++ "cHRM red X");
++ if (red_Y != NULL)
++ *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
++ "cHRM red Y");
++ if (red_Z != NULL)
++ *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
++ "cHRM red Z");
++ if (green_X != NULL)
++ *green_X = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
++ if (green_Y != NULL)
++ *green_Y = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
++ if (green_Z != NULL)
++ *green_Z = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
++ if (blue_X != NULL)
++ *blue_X = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
++ if (blue_Y != NULL)
++ *blue_Y = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
++ if (blue_Z != NULL)
++ *blue_Z = png_float(png_ptr,
++ info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
+ return (PNG_INFO_cHRM);
+ }
+
+@@ -522,31 +629,69 @@
+
+ # ifdef PNG_FIXED_POINT_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_cHRM_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
++ png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
++ png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
++ png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
++ png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
++ png_fixed_point *int_blue_Z)
++{
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
++ {
++ png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
++
++ if (int_red_X != NULL)
++ *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
++ if (int_red_Y != NULL)
++ *int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y;
++ if (int_red_Z != NULL)
++ *int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z;
++ if (int_green_X != NULL)
++ *int_green_X = info_ptr->colorspace.end_points_XYZ.green_X;
++ if (int_green_Y != NULL)
++ *int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y;
++ if (int_green_Z != NULL)
++ *int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z;
++ if (int_blue_X != NULL)
++ *int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X;
++ if (int_blue_Y != NULL)
++ *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
++ if (int_blue_Z != NULL)
++ *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
++ return (PNG_INFO_cHRM);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
+ png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
+ png_fixed_point *blue_x, png_fixed_point *blue_y)
+ {
+ png_debug1(1, "in %s retrieval function", "cHRM");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+ {
+ if (white_x != NULL)
+- *white_x = info_ptr->x_white;
++ *white_x = info_ptr->colorspace.end_points_xy.whitex;
+ if (white_y != NULL)
+- *white_y = info_ptr->y_white;
++ *white_y = info_ptr->colorspace.end_points_xy.whitey;
+ if (red_x != NULL)
+- *red_x = info_ptr->x_red;
++ *red_x = info_ptr->colorspace.end_points_xy.redx;
+ if (red_y != NULL)
+- *red_y = info_ptr->y_red;
++ *red_y = info_ptr->colorspace.end_points_xy.redy;
+ if (green_x != NULL)
+- *green_x = info_ptr->x_green;
++ *green_x = info_ptr->colorspace.end_points_xy.greenx;
+ if (green_y != NULL)
+- *green_y = info_ptr->y_green;
++ *green_y = info_ptr->colorspace.end_points_xy.greeny;
+ if (blue_x != NULL)
+- *blue_x = info_ptr->x_blue;
++ *blue_x = info_ptr->colorspace.end_points_xy.bluex;
+ if (blue_y != NULL)
+- *blue_y = info_ptr->y_blue;
++ *blue_y = info_ptr->colorspace.end_points_xy.bluey;
+ return (PNG_INFO_cHRM);
+ }
+
+@@ -556,49 +701,57 @@
+ #endif
+
+ #ifdef PNG_gAMA_SUPPORTED
+-png_uint_32 PNGFAPI
+-png_get_gAMA_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
++# ifdef PNG_FIXED_POINT_SUPPORTED
++png_uint_32 PNGAPI
++png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_fixed_point *file_gamma)
+ {
+ png_debug1(1, "in %s retrieval function", "gAMA");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
+- && file_gamma != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
++ file_gamma != NULL)
+ {
+- *file_gamma = info_ptr->gamma;
++ *file_gamma = info_ptr->colorspace.gamma;
+ return (PNG_INFO_gAMA);
+ }
+
+ return (0);
+ }
++# endif
++
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_gAMA(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ double *file_gamma)
+ {
+- png_fixed_point igamma;
+- png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma);
++ png_debug1(1, "in %s retrieval function", "gAMA(float)");
+
+- if (ok)
+- *file_gamma = png_float(png_ptr, igamma, "png_get_gAMA");
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
++ file_gamma != NULL)
++ {
++ *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
++ "png_get_gAMA");
++ return (PNG_INFO_gAMA);
++ }
+
+- return ok;
++ return (0);
+ }
+-
+ # endif
+ #endif
+
+ #ifdef PNG_sRGB_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_sRGB(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ int *file_srgb_intent)
+ {
+ png_debug1(1, "in %s retrieval function", "sRGB");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
+- && file_srgb_intent != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
+ {
+- *file_srgb_intent = (int)info_ptr->srgb_intent;
++ *file_srgb_intent = info_ptr->colorspace.rendering_intent;
+ return (PNG_INFO_sRGB);
+ }
+
+@@ -608,22 +761,24 @@
+
+ #ifdef PNG_iCCP_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_iCCP(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_charpp name, int *compression_type,
+ png_bytepp profile, png_uint_32 *proflen)
+ {
+ png_debug1(1, "in %s retrieval function", "iCCP");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
+- && name != NULL && profile != NULL && proflen != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_iCCP) != 0 &&
++ name != NULL && compression_type != NULL && profile != NULL &&
++ proflen != NULL)
+ {
+ *name = info_ptr->iccp_name;
+ *profile = info_ptr->iccp_profile;
+- /* Compression_type is a dummy so the API won't have to change
+- * if we introduce multiple compression types later.
++ *proflen = png_get_uint_32(info_ptr->iccp_profile);
++ /* This is somewhat irrelevant since the profile data returned has
++ * actually been uncompressed.
+ */
+- *proflen = (int)info_ptr->iccp_proflen;
+- *compression_type = (int)info_ptr->iccp_compression;
++ *compression_type = PNG_COMPRESSION_TYPE_BASE;
+ return (PNG_INFO_iCCP);
+ }
+
+@@ -632,14 +787,14 @@
+ #endif
+
+ #ifdef PNG_sPLT_SUPPORTED
+-png_uint_32 PNGAPI
+-png_get_sPLT(png_const_structp png_ptr, png_const_infop info_ptr,
++int PNGAPI
++png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_sPLT_tpp spalettes)
+ {
+ if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
+ {
+ *spalettes = info_ptr->splt_palettes;
+- return ((png_uint_32)info_ptr->splt_palettes_num);
++ return info_ptr->splt_palettes_num;
+ }
+
+ return (0);
+@@ -648,13 +803,13 @@
+
+ #ifdef PNG_hIST_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_uint_16p *hist)
+ {
+ png_debug1(1, "in %s retrieval function", "hIST");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
+- && hist != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
+ {
+ *hist = info_ptr->hist;
+ return (PNG_INFO_hIST);
+@@ -665,11 +820,10 @@
+ #endif
+
+ png_uint_32 PNGAPI
+-png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
++png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_uint_32 *width, png_uint_32 *height, int *bit_depth,
+ int *color_type, int *interlace_type, int *compression_type,
+ int *filter_type)
+-
+ {
+ png_debug1(1, "in %s retrieval function", "IHDR");
+
+@@ -696,7 +850,7 @@
+ * application has ignored our advice not to mess with the members
+ * of info_ptr directly.
+ */
+- png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
++ png_check_IHDR(png_ptr, info_ptr->width, info_ptr->height,
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
+ info_ptr->compression_type, info_ptr->filter_type);
+
+@@ -705,13 +859,14 @@
+
+ #ifdef PNG_oFFs_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_oFFs(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
+ {
+ png_debug1(1, "in %s retrieval function", "oFFs");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
+- && offset_x != NULL && offset_y != NULL && unit_type != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_oFFs) != 0 &&
++ offset_x != NULL && offset_y != NULL && unit_type != NULL)
+ {
+ *offset_x = info_ptr->x_offset;
+ *offset_y = info_ptr->y_offset;
+@@ -725,14 +880,15 @@
+
+ #ifdef PNG_pCAL_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
+ png_charp *units, png_charpp *params)
+ {
+ png_debug1(1, "in %s retrieval function", "pCAL");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
+- && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_pCAL) != 0 &&
++ purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
+ nparams != NULL && units != NULL && params != NULL)
+ {
+ *purpose = info_ptr->pcal_purpose;
+@@ -751,16 +907,20 @@
+
+ #ifdef PNG_sCAL_SUPPORTED
+ # ifdef PNG_FIXED_POINT_SUPPORTED
+-# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
++# if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
++ defined(PNG_FLOATING_POINT_SUPPORTED)
+ png_uint_32 PNGAPI
+-png_get_sCAL_fixed(png_structp png_ptr, png_const_infop info_ptr,
++png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ int *unit, png_fixed_point *width, png_fixed_point *height)
+ {
+ if (png_ptr != NULL && info_ptr != NULL &&
+- (info_ptr->valid & PNG_INFO_sCAL))
++ (info_ptr->valid & PNG_INFO_sCAL) != 0)
+ {
+ *unit = info_ptr->scal_unit;
+- /*TODO: make this work without FP support */
++ /*TODO: make this work without FP support; the API is currently eliminated
++ * if neither floating point APIs nor internal floating point arithmetic
++ * are enabled.
++ */
+ *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
+ *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
+ "sCAL height");
+@@ -773,11 +933,11 @@
+ # endif /* FIXED_POINT */
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_sCAL(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ int *unit, double *width, double *height)
+ {
+ if (png_ptr != NULL && info_ptr != NULL &&
+- (info_ptr->valid & PNG_INFO_sCAL))
++ (info_ptr->valid & PNG_INFO_sCAL) != 0)
+ {
+ *unit = info_ptr->scal_unit;
+ *width = atof(info_ptr->scal_s_width);
+@@ -789,11 +949,11 @@
+ }
+ # endif /* FLOATING POINT */
+ png_uint_32 PNGAPI
+-png_get_sCAL_s(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ int *unit, png_charpp width, png_charpp height)
+ {
+ if (png_ptr != NULL && info_ptr != NULL &&
+- (info_ptr->valid & PNG_INFO_sCAL))
++ (info_ptr->valid & PNG_INFO_sCAL) != 0)
+ {
+ *unit = info_ptr->scal_unit;
+ *width = info_ptr->scal_s_width;
+@@ -807,7 +967,7 @@
+
+ #ifdef PNG_pHYs_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_pHYs(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
+ png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
+ {
+ png_uint_32 retval = 0;
+@@ -815,7 +975,7 @@
+ png_debug1(1, "in %s retrieval function", "pHYs");
+
+ if (png_ptr != NULL && info_ptr != NULL &&
+- (info_ptr->valid & PNG_INFO_pHYs))
++ (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+ if (res_x != NULL)
+ {
+@@ -841,13 +1001,13 @@
+ #endif /* pHYs */
+
+ png_uint_32 PNGAPI
+-png_get_PLTE(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_colorp *palette, int *num_palette)
+ {
+ png_debug1(1, "in %s retrieval function", "PLTE");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
+- && palette != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
+ {
+ *palette = info_ptr->palette;
+ *num_palette = info_ptr->num_palette;
+@@ -860,13 +1020,13 @@
+
+ #ifdef PNG_sBIT_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_sBIT(png_const_structp png_ptr, png_infop info_ptr,
++png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_color_8p *sig_bit)
+ {
+ png_debug1(1, "in %s retrieval function", "sBIT");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
+- && sig_bit != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
+ {
+ *sig_bit = &(info_ptr->sig_bit);
+ return (PNG_INFO_sBIT);
+@@ -877,15 +1037,14 @@
+ #endif
+
+ #ifdef PNG_TEXT_SUPPORTED
+-png_uint_32 PNGAPI
+-png_get_text(png_const_structp png_ptr, png_const_infop info_ptr,
++int PNGAPI
++png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_textp *text_ptr, int *num_text)
+ {
+ if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
+ {
+- png_debug1(1, "in %s retrieval function",
+- (png_ptr->chunk_name[0] == '\0' ? "text" :
+- (png_const_charp)png_ptr->chunk_name));
++ png_debug1(1, "in 0x%lx retrieval function",
++ (unsigned long)png_ptr->chunk_name);
+
+ if (text_ptr != NULL)
+ *text_ptr = info_ptr->text;
+@@ -893,7 +1052,7 @@
+ if (num_text != NULL)
+ *num_text = info_ptr->num_text;
+
+- return ((png_uint_32)info_ptr->num_text);
++ return info_ptr->num_text;
+ }
+
+ if (num_text != NULL)
+@@ -905,12 +1064,13 @@
+
+ #ifdef PNG_tIME_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_tIME(png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
++png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_timep *mod_time)
+ {
+ png_debug1(1, "in %s retrieval function", "tIME");
+
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
+- && mod_time != NULL)
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
+ {
+ *mod_time = &(info_ptr->mod_time);
+ return (PNG_INFO_tIME);
+@@ -922,11 +1082,12 @@
+
+ #ifdef PNG_tRNS_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_tRNS(png_const_structp png_ptr, png_infop info_ptr,
++png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
+ {
+ png_uint_32 retval = 0;
+- if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_tRNS) != 0)
+ {
+ png_debug1(1, "in %s retrieval function", "tRNS");
+
+@@ -965,9 +1126,9 @@
+ }
+ #endif
+
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+ int PNGAPI
+-png_get_unknown_chunks(png_const_structp png_ptr, png_const_infop info_ptr,
++png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_unknown_chunkpp unknowns)
+ {
+ if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
+@@ -982,7 +1143,7 @@
+
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ png_byte PNGAPI
+-png_get_rgb_to_gray_status (png_const_structp png_ptr)
++png_get_rgb_to_gray_status (png_const_structrp png_ptr)
+ {
+ return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
+ }
+@@ -990,71 +1151,91 @@
+
+ #ifdef PNG_USER_CHUNKS_SUPPORTED
+ png_voidp PNGAPI
+-png_get_user_chunk_ptr(png_const_structp png_ptr)
++png_get_user_chunk_ptr(png_const_structrp png_ptr)
+ {
+ return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
+ }
+ #endif
+
+ png_size_t PNGAPI
+-png_get_compression_buffer_size(png_const_structp png_ptr)
++png_get_compression_buffer_size(png_const_structrp png_ptr)
+ {
+- return (png_ptr ? png_ptr->zbuf_size : 0L);
++ if (png_ptr == NULL)
++ return 0;
++
++# ifdef PNG_WRITE_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
++# endif
++ {
++# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++ return png_ptr->IDAT_read_size;
++# else
++ return PNG_IDAT_READ_SIZE;
++# endif
++ }
++
++# ifdef PNG_WRITE_SUPPORTED
++ else
++ return png_ptr->zbuffer_size;
++# endif
+ }
+
+-
+ #ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ /* These functions were added to libpng 1.2.6 and were enabled
+ * by default in libpng-1.4.0 */
+ png_uint_32 PNGAPI
+-png_get_user_width_max (png_const_structp png_ptr)
++png_get_user_width_max (png_const_structrp png_ptr)
+ {
+ return (png_ptr ? png_ptr->user_width_max : 0);
+ }
+
+ png_uint_32 PNGAPI
+-png_get_user_height_max (png_const_structp png_ptr)
++png_get_user_height_max (png_const_structrp png_ptr)
+ {
+ return (png_ptr ? png_ptr->user_height_max : 0);
+ }
+
+ /* This function was added to libpng 1.4.0 */
+ png_uint_32 PNGAPI
+-png_get_chunk_cache_max (png_const_structp png_ptr)
++png_get_chunk_cache_max (png_const_structrp png_ptr)
+ {
+ return (png_ptr ? png_ptr->user_chunk_cache_max : 0);
+ }
+
+ /* This function was added to libpng 1.4.1 */
+ png_alloc_size_t PNGAPI
+-png_get_chunk_malloc_max (png_const_structp png_ptr)
++png_get_chunk_malloc_max (png_const_structrp png_ptr)
+ {
+ return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
+ }
+-#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
++#endif /* SET_USER_LIMITS */
+
+ /* These functions were added to libpng 1.4.0 */
+ #ifdef PNG_IO_STATE_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_io_state (png_structp png_ptr)
++png_get_io_state (png_const_structrp png_ptr)
+ {
+ return png_ptr->io_state;
+ }
+
+ png_uint_32 PNGAPI
+-png_get_io_chunk_type (png_const_structp png_ptr)
+-{
+- return ((png_ptr->chunk_name[0] << 24) +
+- (png_ptr->chunk_name[1] << 16) +
+- (png_ptr->chunk_name[2] << 8) +
+- (png_ptr->chunk_name[3]));
+-}
+-
+-png_const_bytep PNGAPI
+-png_get_io_chunk_name (png_structp png_ptr)
++png_get_io_chunk_type (png_const_structrp png_ptr)
+ {
+ return png_ptr->chunk_name;
+ }
+-#endif /* ?PNG_IO_STATE_SUPPORTED */
++#endif /* IO_STATE */
+
+-#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
++#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
++# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
++int PNGAPI
++png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
++{
++ if (png_ptr != NULL && info_ptr != NULL)
++ return png_ptr->num_palette_max;
++
++ return (-1);
++}
++# endif
++#endif
++
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pnginfo.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pnginfo.h Fri Apr 10 09:21:28 2015 -0700
+@@ -29,11 +29,11 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+- * Last changed in libpng 1.5.0 [January 6, 2011]
++ * Last changed in libpng 1.6.1 [March 28, 2013]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+@@ -83,7 +83,7 @@
+
+ struct png_info_def
+ {
+- /* the following are necessary for every PNG file */
++ /* The following are necessary for every PNG file */
+ png_uint_32 width; /* width of image in pixels (from IHDR) */
+ png_uint_32 height; /* height of image in pixels (from IHDR) */
+ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
+@@ -98,11 +98,17 @@
+ png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
+ png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+
+- /* The following is informational only on read, and not used on writes. */
++ /* The following are set by png_set_IHDR, called from the application on
++ * write, but the are never actually used by the write code.
++ */
+ png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
+ png_byte pixel_depth; /* number of bits per pixel */
+ png_byte spare_byte; /* to align the data, and for future use */
++
++#ifdef PNG_READ_SUPPORTED
++ /* This is never set during write */
+ png_byte signature[8]; /* magic bytes read by libpng from start of file */
++#endif
+
+ /* The rest of the data is optional. If you are reading, check the
+ * valid field to see if the information in these are valid. If you
+@@ -110,18 +116,25 @@
+ * and initialize the appropriate fields below.
+ */
+
+-#if defined(PNG_gAMA_SUPPORTED)
+- /* The gAMA chunk describes the gamma characteristics of the system
+- * on which the image was created, normally in the range [1.0, 2.5].
+- * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
++#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
++ /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
++ * defined. When COLORSPACE is switched on all the colorspace-defining
++ * chunks should be enabled, when GAMMA is switched on all the gamma-defining
++ * chunks should be enabled. If this is not done it becomes possible to read
++ * inconsistent PNG files and assign a probably incorrect interpretation to
++ * the information. (In other words, by carefully choosing which chunks to
++ * recognize the system configuration can select an interpretation for PNG
++ * files containing ambiguous data and this will result in inconsistent
++ * behavior between different libpng builds!)
+ */
+- png_fixed_point gamma;
++ png_colorspace colorspace;
+ #endif
+
+-#ifdef PNG_sRGB_SUPPORTED
+- /* GR-P, 0.96a */
+- /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
+- png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
++#ifdef PNG_iCCP_SUPPORTED
++ /* iCCP chunk data. */
++ png_charp iccp_name; /* profile name */
++ png_bytep iccp_profile; /* International Color Consortium profile data */
++ png_uint_32 iccp_proflen; /* ICC profile data length */
+ #endif
+
+ #ifdef PNG_TEXT_SUPPORTED
+@@ -136,7 +149,7 @@
+ int num_text; /* number of comments read or comments to write */
+ int max_text; /* current size of text array */
+ png_textp text; /* array of comments read or comments to write */
+-#endif /* PNG_TEXT_SUPPORTED */
++#endif /* TEXT */
+
+ #ifdef PNG_tIME_SUPPORTED
+ /* The tIME chunk holds the last time the displayed image data was
+@@ -211,23 +224,6 @@
+ png_uint_16p hist;
+ #endif
+
+-#ifdef PNG_cHRM_SUPPORTED
+- /* The cHRM chunk describes the CIE color characteristics of the monitor
+- * on which the PNG was created. This data allows the viewer to do gamut
+- * mapping of the input image to ensure that the viewer sees the same
+- * colors in the image as the creator. Values are in the range
+- * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
+- */
+- png_fixed_point x_white;
+- png_fixed_point y_white;
+- png_fixed_point x_red;
+- png_fixed_point y_red;
+- png_fixed_point x_green;
+- png_fixed_point y_green;
+- png_fixed_point x_blue;
+- png_fixed_point y_blue;
+-#endif
+-
+ #ifdef PNG_pCAL_SUPPORTED
+ /* The pCAL chunk describes a transformation between the stored pixel
+ * values and original physical data values used to create the image.
+@@ -252,25 +248,20 @@
+ /* New members added in libpng-1.0.6 */
+ png_uint_32 free_me; /* flags items libpng is responsible for freeing */
+
+-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+- defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+ /* Storage for unknown chunks that the library doesn't recognize. */
+ png_unknown_chunkp unknown_chunks;
+- int unknown_chunks_num;
+-#endif
+
+-#ifdef PNG_iCCP_SUPPORTED
+- /* iCCP chunk data. */
+- png_charp iccp_name; /* profile name */
+- png_bytep iccp_profile; /* International Color Consortium profile data */
+- png_uint_32 iccp_proflen; /* ICC profile data length */
+- png_byte iccp_compression; /* Always zero */
++ /* The type of this field is limited by the type of
++ * png_struct::user_chunk_cache_max, else overflow can occur.
++ */
++ int unknown_chunks_num;
+ #endif
+
+ #ifdef PNG_sPLT_SUPPORTED
+ /* Data on sPLT chunks (there may be more than one). */
+ png_sPLT_tp splt_palettes;
+- png_uint_32 splt_palettes_num;
++ int splt_palettes_num; /* Match type returned by png_get API */
+ #endif
+
+ #ifdef PNG_sCAL_SUPPORTED
+--- ./jdk/src/share/native/sun/awt/libpng/pnglibconf.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pnglibconf.h Fri Apr 10 09:21:28 2015 -0700
+@@ -34,69 +34,47 @@
+ * file and, per its terms, should not be removed:
+ */
+
+-/* libpng version 1.5.4 - last changed on June 22, 2011 */
++/* libpng version 1.6.16,December 22, 2014 */
+
+-/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
++/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
+
+ /* This code is released under the libpng license. */
+ /* For conditions of distribution and use, see the disclaimer */
+ /* and license in png.h */
+
+ /* pnglibconf.h */
++/* Machine generated file: DO NOT EDIT */
+ /* Derived from: scripts/pnglibconf.dfa */
+-/* If you edit this file by hand you must obey the rules expressed in */
+-/* pnglibconf.dfa with respect to the dependencies between the following */
+-/* symbols. It is much better to generate a new file using */
+-/* scripts/libpngconf.mak */
+-
+ #ifndef PNGLCONF_H
+ #define PNGLCONF_H
+-/* settings */
+-#define PNG_API_RULE 0
+-#define PNG_CALLOC_SUPPORTED
+-#define PNG_COST_SHIFT 3
+-#define PNG_DEFAULT_READ_MACROS 1
+-#define PNG_GAMMA_THRESHOLD_FIXED 5000
+-#define PNG_MAX_GAMMA_8 11
+-#define PNG_QUANTIZE_BLUE_BITS 5
+-#define PNG_QUANTIZE_GREEN_BITS 5
+-#define PNG_QUANTIZE_RED_BITS 5
+-#define PNG_sCAL_PRECISION 5
+-#define PNG_USER_CHUNK_CACHE_MAX 0
+-#define PNG_USER_CHUNK_MALLOC_MAX 0
+-#define PNG_USER_HEIGHT_MAX 1000000L
+-#define PNG_USER_WIDTH_MAX 1000000L
+-#define PNG_WEIGHT_SHIFT 8
+-#define PNG_ZBUF_SIZE 8192
+-/* end of settings */
+ /* options */
+ #define PNG_16BIT_SUPPORTED
+-#define PNG_ALIGN_MEMORY_SUPPORTED
++#define PNG_ALIGNED_MEMORY_SUPPORTED
++/*#undef PNG_ARM_NEON_API_SUPPORTED*/
++/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
+ #define PNG_BENIGN_ERRORS_SUPPORTED
+-#define PNG_bKGD_SUPPORTED
++#define PNG_BENIGN_READ_ERRORS_SUPPORTED
++/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
+ #define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
+-#define PNG_CHECK_cHRM_SUPPORTED
+-#define PNG_cHRM_SUPPORTED
++#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
++#define PNG_COLORSPACE_SUPPORTED
+ #define PNG_CONSOLE_IO_SUPPORTED
+-#define PNG_CONVERT_tIME_SUPPORTED
++/*#undef PNG_CONVERT_tIME_SUPPORTED*/
+ #define PNG_EASY_ACCESS_SUPPORTED
+ /*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
+ #define PNG_ERROR_TEXT_SUPPORTED
+ #define PNG_FIXED_POINT_SUPPORTED
+ #define PNG_FLOATING_ARITHMETIC_SUPPORTED
+ #define PNG_FLOATING_POINT_SUPPORTED
+-#define PNG_gAMA_SUPPORTED
++#define PNG_FORMAT_AFIRST_SUPPORTED
++#define PNG_FORMAT_BGR_SUPPORTED
++#define PNG_GAMMA_SUPPORTED
++#define PNG_GET_PALETTE_MAX_SUPPORTED
+ #define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+-#define PNG_hIST_SUPPORTED
+-#define PNG_iCCP_SUPPORTED
+ #define PNG_INCH_CONVERSIONS_SUPPORTED
+ #define PNG_INFO_IMAGE_SUPPORTED
+ #define PNG_IO_STATE_SUPPORTED
+-#define PNG_iTXt_SUPPORTED
+ #define PNG_MNG_FEATURES_SUPPORTED
+-#define PNG_oFFs_SUPPORTED
+-#define PNG_pCAL_SUPPORTED
+-#define PNG_pHYs_SUPPORTED
+ #define PNG_POINTER_INDEXING_SUPPORTED
+ #define PNG_PROGRESSIVE_READ_SUPPORTED
+ #define PNG_READ_16BIT_SUPPORTED
+@@ -104,67 +82,73 @@
+ #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
+ #define PNG_READ_BACKGROUND_SUPPORTED
+ #define PNG_READ_BGR_SUPPORTED
+-#define PNG_READ_bKGD_SUPPORTED
+-#define PNG_READ_cHRM_SUPPORTED
++#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
+ #define PNG_READ_COMPOSITE_NODIV_SUPPORTED
+ #define PNG_READ_COMPRESSED_TEXT_SUPPORTED
+ #define PNG_READ_EXPAND_16_SUPPORTED
+ #define PNG_READ_EXPAND_SUPPORTED
+ #define PNG_READ_FILLER_SUPPORTED
+-#define PNG_READ_gAMA_SUPPORTED
+ #define PNG_READ_GAMMA_SUPPORTED
++#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
+ #define PNG_READ_GRAY_TO_RGB_SUPPORTED
+-#define PNG_READ_hIST_SUPPORTED
+-#define PNG_READ_iCCP_SUPPORTED
+ #define PNG_READ_INTERLACING_SUPPORTED
+ #define PNG_READ_INT_FUNCTIONS_SUPPORTED
+ #define PNG_READ_INVERT_ALPHA_SUPPORTED
+ #define PNG_READ_INVERT_SUPPORTED
+-#define PNG_READ_iTXt_SUPPORTED
+-#define PNG_READ_oFFs_SUPPORTED
+ #define PNG_READ_OPT_PLTE_SUPPORTED
++#define PNG_READ_PACKSWAP_SUPPORTED
+ #define PNG_READ_PACK_SUPPORTED
+-#define PNG_READ_PACKSWAP_SUPPORTED
+-#define PNG_READ_pCAL_SUPPORTED
+-#define PNG_READ_pHYs_SUPPORTED
+ #define PNG_READ_QUANTIZE_SUPPORTED
+ #define PNG_READ_RGB_TO_GRAY_SUPPORTED
+-#define PNG_READ_sBIT_SUPPORTED
+ #define PNG_READ_SCALE_16_TO_8_SUPPORTED
+-#define PNG_READ_sCAL_SUPPORTED
+ #define PNG_READ_SHIFT_SUPPORTED
+-#define PNG_READ_sPLT_SUPPORTED
+-#define PNG_READ_sRGB_SUPPORTED
+ #define PNG_READ_STRIP_16_TO_8_SUPPORTED
+ #define PNG_READ_STRIP_ALPHA_SUPPORTED
+ #define PNG_READ_SUPPORTED
+ #define PNG_READ_SWAP_ALPHA_SUPPORTED
+ #define PNG_READ_SWAP_SUPPORTED
+-#define PNG_READ_tEXt_SUPPORTED
+ #define PNG_READ_TEXT_SUPPORTED
+-#define PNG_READ_tIME_SUPPORTED
+ #define PNG_READ_TRANSFORMS_SUPPORTED
+-#define PNG_READ_tRNS_SUPPORTED
+ #define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+ #define PNG_READ_USER_CHUNKS_SUPPORTED
+ #define PNG_READ_USER_TRANSFORM_SUPPORTED
++#define PNG_READ_bKGD_SUPPORTED
++#define PNG_READ_cHRM_SUPPORTED
++#define PNG_READ_gAMA_SUPPORTED
++#define PNG_READ_hIST_SUPPORTED
++#define PNG_READ_iCCP_SUPPORTED
++#define PNG_READ_iTXt_SUPPORTED
++#define PNG_READ_oFFs_SUPPORTED
++#define PNG_READ_pCAL_SUPPORTED
++#define PNG_READ_pHYs_SUPPORTED
++#define PNG_READ_sBIT_SUPPORTED
++#define PNG_READ_sCAL_SUPPORTED
++#define PNG_READ_sPLT_SUPPORTED
++#define PNG_READ_sRGB_SUPPORTED
++#define PNG_READ_tEXt_SUPPORTED
++#define PNG_READ_tIME_SUPPORTED
++#define PNG_READ_tRNS_SUPPORTED
+ #define PNG_READ_zTXt_SUPPORTED
+-#define PNG_SAVE_INT_32_SUPPORTED
+-#define PNG_sBIT_SUPPORTED
+-#define PNG_sCAL_SUPPORTED
++/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
++/*#undef PNG_SAVE_INT_32_SUPPORTED*/
++#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
+ #define PNG_SEQUENTIAL_READ_SUPPORTED
++#define PNG_SETJMP_SUPPORTED
+ #define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
+ #define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
+-#define PNG_SETJMP_SUPPORTED
++#define PNG_SET_OPTION_SUPPORTED
++#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
+ #define PNG_SET_USER_LIMITS_SUPPORTED
+-#define PNG_sPLT_SUPPORTED
+-#define PNG_sRGB_SUPPORTED
++#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
++#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
++#define PNG_SIMPLIFIED_READ_SUPPORTED
++/*#undef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED*/
++/*#undef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED*/
++/*#undef PNG_SIMPLIFIED_WRITE_SUPPORTED*/
+ #define PNG_STDIO_SUPPORTED
+-#define PNG_tEXt_SUPPORTED
++#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+ #define PNG_TEXT_SUPPORTED
+ #define PNG_TIME_RFC1123_SUPPORTED
+-#define PNG_tIME_SUPPORTED
+-#define PNG_tRNS_SUPPORTED
+ #define PNG_UNKNOWN_CHUNKS_SUPPORTED
+ #define PNG_USER_CHUNKS_SUPPORTED
+ #define PNG_USER_LIMITS_SUPPORTED
+@@ -172,6 +156,91 @@
+ #define PNG_USER_TRANSFORM_INFO_SUPPORTED
+ #define PNG_USER_TRANSFORM_PTR_SUPPORTED
+ #define PNG_WARNINGS_SUPPORTED
++/*#undef PNG_WRITE_16BIT_SUPPORTED*/
++/*#undef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED*/
++/*#undef PNG_WRITE_BGR_SUPPORTED*/
++/*#undef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED*/
++/*#undef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED*/
++/*#undef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED*/
++/*#undef PNG_WRITE_FILLER_SUPPORTED*/
++/*#undef PNG_WRITE_FILTER_SUPPORTED*/
++/*#undef PNG_WRITE_FLUSH_SUPPORTED*/
++/*#undef PNG_WRITE_GET_PALETTE_MAX_SUPPORTED*/
++/*#undef PNG_WRITE_INTERLACING_SUPPORTED*/
++/*#undef PNG_WRITE_INT_FUNCTIONS_SUPPORTED*/
++/*#undef PNG_WRITE_INVERT_ALPHA_SUPPORTED*/
++/*#undef PNG_WRITE_INVERT_SUPPORTED*/
++/*#undef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED*/
++/*#undef PNG_WRITE_PACKSWAP_SUPPORTED*/
++/*#undef PNG_WRITE_PACK_SUPPORTED*/
++/*#undef PNG_WRITE_SHIFT_SUPPORTED*/
++/*#undef PNG_WRITE_SUPPORTED*/
++/*#undef PNG_WRITE_SWAP_ALPHA_SUPPORTED*/
++/*#undef PNG_WRITE_SWAP_SUPPORTED*/
++/*#undef PNG_WRITE_TEXT_SUPPORTED*/
++/*#undef PNG_WRITE_TRANSFORMS_SUPPORTED*/
++/*#undef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED*/
++/*#undef PNG_WRITE_USER_TRANSFORM_SUPPORTED*/
++/*#undef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED*/
++/*#undef PNG_WRITE_bKGD_SUPPORTED*/
++/*#undef PNG_WRITE_cHRM_SUPPORTED*/
++/*#undef PNG_WRITE_gAMA_SUPPORTED*/
++/*#undef PNG_WRITE_hIST_SUPPORTED*/
++/*#undef PNG_WRITE_iCCP_SUPPORTED*/
++/*#undef PNG_WRITE_iTXt_SUPPORTED*/
++/*#undef PNG_WRITE_oFFs_SUPPORTED*/
++/*#undef PNG_WRITE_pCAL_SUPPORTED*/
++/*#undef PNG_WRITE_pHYs_SUPPORTED*/
++/*#undef PNG_WRITE_sBIT_SUPPORTED*/
++/*#undef PNG_WRITE_sCAL_SUPPORTED*/
++/*#undef PNG_WRITE_sPLT_SUPPORTED*/
++/*#undef PNG_WRITE_sRGB_SUPPORTED*/
++/*#undef PNG_WRITE_tEXt_SUPPORTED*/
++/*#undef PNG_WRITE_tIME_SUPPORTED*/
++/*#undef PNG_WRITE_tRNS_SUPPORTED*/
++/*#undef PNG_WRITE_zTXt_SUPPORTED*/
++#define PNG_bKGD_SUPPORTED
++#define PNG_cHRM_SUPPORTED
++#define PNG_gAMA_SUPPORTED
++#define PNG_hIST_SUPPORTED
++#define PNG_iCCP_SUPPORTED
++#define PNG_iTXt_SUPPORTED
++#define PNG_oFFs_SUPPORTED
++#define PNG_pCAL_SUPPORTED
++#define PNG_pHYs_SUPPORTED
++#define PNG_sBIT_SUPPORTED
++#define PNG_sCAL_SUPPORTED
++#define PNG_sPLT_SUPPORTED
++#define PNG_sRGB_SUPPORTED
++#define PNG_tEXt_SUPPORTED
++#define PNG_tIME_SUPPORTED
++#define PNG_tRNS_SUPPORTED
+ #define PNG_zTXt_SUPPORTED
+ /* end of options */
++/* settings */
++#define PNG_API_RULE 0
++#define PNG_COST_SHIFT 3
++#define PNG_DEFAULT_READ_MACROS 1
++#define PNG_GAMMA_THRESHOLD_FIXED 5000
++#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
++#define PNG_INFLATE_BUF_SIZE 1024
++#define PNG_MAX_GAMMA_8 11
++#define PNG_QUANTIZE_BLUE_BITS 5
++#define PNG_QUANTIZE_GREEN_BITS 5
++#define PNG_QUANTIZE_RED_BITS 5
++#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
++#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
++#define PNG_USER_CHUNK_CACHE_MAX 0
++#define PNG_USER_CHUNK_MALLOC_MAX 0
++#define PNG_USER_HEIGHT_MAX 1000000
++#define PNG_USER_WIDTH_MAX 1000000
++#define PNG_WEIGHT_SHIFT 8
++#define PNG_ZBUF_SIZE 8192
++#define PNG_ZLIB_VERNUM 0
++#define PNG_Z_DEFAULT_COMPRESSION (-1)
++#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
++#define PNG_Z_DEFAULT_STRATEGY 1
++#define PNG_sCAL_PRECISION 5
++#define PNG_sRGB_PROFILE_CHECKS 2
++/* end of settings */
+ #endif /* PNGLCONF_H */
+--- ./jdk/src/share/native/sun/awt/libpng/pngmem.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngmem.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -48,457 +48,23 @@
+ #include "pngpriv.h"
+
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
++/* Free a png_struct */
++void /* PRIVATE */
++png_destroy_png_struct(png_structrp png_ptr)
++{
++ if (png_ptr != NULL)
++ {
++ /* png_free might call png_error and may certainly call
++ * png_get_mem_ptr, so fake a temporary png_struct to support this.
++ */
++ png_struct dummy_struct = *png_ptr;
++ memset(png_ptr, 0, (sizeof *png_ptr));
++ png_free(&dummy_struct, png_ptr);
+
+-/* Borland DOS special memory handler */
+-#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
+-/* If you change this, be sure to change the one in png.h also */
+-
+-/* Allocate memory for a png_struct. The malloc and memset can be replaced
+- by a single call to calloc() if this is thought to improve performance. */
+-PNG_FUNCTION(png_voidp /* PRIVATE */,
+-png_create_struct,(int type),PNG_ALLOCATED)
+-{
+-# ifdef PNG_USER_MEM_SUPPORTED
+- return (png_create_struct_2(type, NULL, NULL));
+-}
+-
+-/* Alternate version of png_create_struct, for use with user-defined malloc. */
+-PNG_FUNCTION(png_voidp /* PRIVATE */,
+-png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
+- PNG_ALLOCATED)
+-{
+-# endif /* PNG_USER_MEM_SUPPORTED */
+- png_size_t size;
+- png_voidp struct_ptr;
+-
+- if (type == PNG_STRUCT_INFO)
+- size = png_sizeof(png_info);
+-
+- else if (type == PNG_STRUCT_PNG)
+- size = png_sizeof(png_struct);
+-
+- else
+- return (png_get_copyright(NULL));
+-
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (malloc_fn != NULL)
+- {
+- png_struct dummy_struct;
+- png_structp png_ptr = &dummy_struct;
+- png_ptr->mem_ptr=mem_ptr;
+- struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
+- }
+-
+- else
+-# endif /* PNG_USER_MEM_SUPPORTED */
+- struct_ptr = (png_voidp)farmalloc(size);
+- if (struct_ptr != NULL)
+- png_memset(struct_ptr, 0, size);
+-
+- return (struct_ptr);
+-}
+-
+-/* Free memory allocated by a png_create_struct() call */
+-void /* PRIVATE */
+-png_destroy_struct(png_voidp struct_ptr)
+-{
+-# ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2(struct_ptr, NULL, NULL);
+-}
+-
+-/* Free memory allocated by a png_create_struct() call */
+-void /* PRIVATE */
+-png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
+- png_voidp mem_ptr)
+-{
+-# endif
+- if (struct_ptr != NULL)
+- {
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (free_fn != NULL)
+- {
+- png_struct dummy_struct;
+- png_structp png_ptr = &dummy_struct;
+- png_ptr->mem_ptr=mem_ptr;
+- (*(free_fn))(png_ptr, struct_ptr);
+- return;
+- }
+-
+-# endif /* PNG_USER_MEM_SUPPORTED */
+- farfree (struct_ptr);
+- }
+-}
+-
+-/* Allocate memory. For reasonable files, size should never exceed
+- * 64K. However, zlib may allocate more then 64K if you don't tell
+- * it not to. See zconf.h and png.h for more information. zlib does
+- * need to allocate exactly 64K, so whatever you call here must
+- * have the ability to do that.
+- *
+- * Borland seems to have a problem in DOS mode for exactly 64K.
+- * It gives you a segment with an offset of 8 (perhaps to store its
+- * memory stuff). zlib doesn't like this at all, so we have to
+- * detect and deal with it. This code should not be needed in
+- * Windows or OS/2 modes, and only in 16 bit mode. This code has
+- * been updated by Alexander Lehmann for version 0.89 to waste less
+- * memory.
+- *
+- * Note that we can't use png_size_t for the "size" declaration,
+- * since on some systems a png_size_t is a 16-bit quantity, and as a
+- * result, we would be truncating potentially larger memory requests
+- * (which should cause a fatal error) and introducing major problems.
+- */
+-PNG_FUNCTION(png_voidp,PNGAPI
+-png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+-{
+- png_voidp ret;
+-
+- ret = (png_malloc(png_ptr, size));
+-
+- if (ret != NULL)
+- png_memset(ret,0,(png_size_t)size);
+-
+- return (ret);
+-}
+-
+-PNG_FUNCTION(png_voidp,PNGAPI
+-png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+-{
+- png_voidp ret;
+-
+- if (png_ptr == NULL || size == 0)
+- return (NULL);
+-
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (png_ptr->malloc_fn != NULL)
+- ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
+-
+- else
+- ret = (png_malloc_default(png_ptr, size));
+-
+- if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out of memory");
+-
+- return (ret);
+-}
+-
+-PNG_FUNCTION(png_voidp,PNGAPI
+-png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+-{
+- png_voidp ret;
+-# endif /* PNG_USER_MEM_SUPPORTED */
+-
+- if (png_ptr == NULL || size == 0)
+- return (NULL);
+-
+-# ifdef PNG_MAX_MALLOC_64K
+- if (size > (png_uint_32)65536L)
+- {
+- png_warning(png_ptr, "Cannot Allocate > 64K");
+- ret = NULL;
+- }
+-
+- else
+-# endif
+-
+- if (size != (size_t)size)
+- ret = NULL;
+-
+- else if (size == (png_uint_32)65536L)
+- {
+- if (png_ptr->offset_table == NULL)
+- {
+- /* Try to see if we need to do any of this fancy stuff */
+- ret = farmalloc(size);
+- if (ret == NULL || ((png_size_t)ret & 0xffff))
+- {
+- int num_blocks;
+- png_uint_32 total_size;
+- png_bytep table;
+- int i, mem_level, window_bits;
+- png_byte huge * hptr;
+- int window_bits
+-
+- if (ret != NULL)
+- {
+- farfree(ret);
+- ret = NULL;
+- }
+-
+- window_bits =
+- png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
+- png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
+-
+- if (window_bits > 14)
+- num_blocks = (int)(1 << (window_bits - 14));
+-
+- else
+- num_blocks = 1;
+-
+- mem_level =
+- png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
+- png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
+-
+- if (mem_level >= 7)
+- num_blocks += (int)(1 << (mem_level - 7));
+-
+- else
+- num_blocks++;
+-
+- total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
+-
+- table = farmalloc(total_size);
+-
+- if (table == NULL)
+- {
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
+-
+- else
+- png_warning(png_ptr, "Out Of Memory");
+-# endif
+- return (NULL);
+- }
+-
+- if ((png_size_t)table & 0xfff0)
+- {
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr,
+- "Farmalloc didn't return normalized pointer");
+-
+- else
+- png_warning(png_ptr,
+- "Farmalloc didn't return normalized pointer");
+-# endif
+- return (NULL);
+- }
+-
+- png_ptr->offset_table = table;
+- png_ptr->offset_table_ptr = farmalloc(num_blocks *
+- png_sizeof(png_bytep));
+-
+- if (png_ptr->offset_table_ptr == NULL)
+- {
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
+-
+- else
+- png_warning(png_ptr, "Out Of memory");
+-# endif
+- return (NULL);
+- }
+-
+- hptr = (png_byte huge *)table;
+- if ((png_size_t)hptr & 0xf)
+- {
+- hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
+- hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
+- }
+-
+- for (i = 0; i < num_blocks; i++)
+- {
+- png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
+- hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
+- }
+-
+- png_ptr->offset_table_number = num_blocks;
+- png_ptr->offset_table_count = 0;
+- png_ptr->offset_table_count_free = 0;
+- }
+- }
+-
+- if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
+- {
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */
+-
+- else
+- png_warning(png_ptr, "Out of Memory");
+-# endif
+- return (NULL);
+- }
+-
+- ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
+- }
+-
+- else
+- ret = farmalloc(size);
+-
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if (ret == NULL)
+- {
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
+-
+- else
+- png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
+- }
+-# endif
+-
+- return (ret);
+-}
+-
+-/* Free a pointer allocated by png_malloc(). In the default
+- * configuration, png_ptr is not used, but is passed in case it
+- * is needed. If ptr is NULL, return without taking any action.
+- */
+-void PNGAPI
+-png_free(png_structp png_ptr, png_voidp ptr)
+-{
+- if (png_ptr == NULL || ptr == NULL)
+- return;
+-
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (png_ptr->free_fn != NULL)
+- {
+- (*(png_ptr->free_fn))(png_ptr, ptr);
+- return;
+- }
+-
+- else
+- png_free_default(png_ptr, ptr);
+-}
+-
+-void PNGAPI
+-png_free_default(png_structp png_ptr, png_voidp ptr)
+-{
+-# endif /* PNG_USER_MEM_SUPPORTED */
+-
+- if (png_ptr == NULL || ptr == NULL)
+- return;
+-
+- if (png_ptr->offset_table != NULL)
+- {
+- int i;
+-
+- for (i = 0; i < png_ptr->offset_table_count; i++)
+- {
+- if (ptr == png_ptr->offset_table_ptr[i])
+- {
+- ptr = NULL;
+- png_ptr->offset_table_count_free++;
+- break;
+- }
+- }
+- if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
+- {
+- farfree(png_ptr->offset_table);
+- farfree(png_ptr->offset_table_ptr);
+- png_ptr->offset_table = NULL;
+- png_ptr->offset_table_ptr = NULL;
+- }
+- }
+-
+- if (ptr != NULL)
+- farfree(ptr);
+-}
+-
+-#else /* Not the Borland DOS special memory handler */
+-
+-/* Allocate memory for a png_struct or a png_info. The malloc and
+- memset can be replaced by a single call to calloc() if this is thought
+- to improve performance noticably. */
+-PNG_FUNCTION(png_voidp /* PRIVATE */,
+-png_create_struct,(int type),PNG_ALLOCATED)
+-{
+-# ifdef PNG_USER_MEM_SUPPORTED
+- return (png_create_struct_2(type, NULL, NULL));
+-}
+-
+-/* Allocate memory for a png_struct or a png_info. The malloc and
+- memset can be replaced by a single call to calloc() if this is thought
+- to improve performance noticably. */
+-PNG_FUNCTION(png_voidp /* PRIVATE */,
+-png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
+- PNG_ALLOCATED)
+-{
+-# endif /* PNG_USER_MEM_SUPPORTED */
+- png_size_t size;
+- png_voidp struct_ptr;
+-
+- if (type == PNG_STRUCT_INFO)
+- size = png_sizeof(png_info);
+-
+- else if (type == PNG_STRUCT_PNG)
+- size = png_sizeof(png_struct);
+-
+- else
+- return (NULL);
+-
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (malloc_fn != NULL)
+- {
+- png_struct dummy_struct;
+- png_structp png_ptr = &dummy_struct;
+- png_ptr->mem_ptr=mem_ptr;
+- struct_ptr = (*(malloc_fn))(png_ptr, size);
+-
+- if (struct_ptr != NULL)
+- png_memset(struct_ptr, 0, size);
+-
+- return (struct_ptr);
+- }
+-# endif /* PNG_USER_MEM_SUPPORTED */
+-
+-# if defined(__TURBOC__) && !defined(__FLAT__)
+- struct_ptr = (png_voidp)farmalloc(size);
+-# else
+-# if defined(_MSC_VER) && defined(MAXSEG_64K)
+- struct_ptr = (png_voidp)halloc(size, 1);
+-# else
+- struct_ptr = (png_voidp)malloc(size);
+-# endif
+-# endif
+-
+- if (struct_ptr != NULL)
+- png_memset(struct_ptr, 0, size);
+-
+- return (struct_ptr);
+-}
+-
+-
+-/* Free memory allocated by a png_create_struct() call */
+-void /* PRIVATE */
+-png_destroy_struct(png_voidp struct_ptr)
+-{
+-# ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2(struct_ptr, NULL, NULL);
+-}
+-
+-/* Free memory allocated by a png_create_struct() call */
+-void /* PRIVATE */
+-png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
+- png_voidp mem_ptr)
+-{
+-# endif /* PNG_USER_MEM_SUPPORTED */
+- if (struct_ptr != NULL)
+- {
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (free_fn != NULL)
+- {
+- png_struct dummy_struct;
+- png_structp png_ptr = &dummy_struct;
+- png_ptr->mem_ptr=mem_ptr;
+- (*(free_fn))(png_ptr, struct_ptr);
+- return;
+- }
+-# endif /* PNG_USER_MEM_SUPPORTED */
+-# if defined(__TURBOC__) && !defined(__FLAT__)
+- farfree(struct_ptr);
+-
+-# else
+-# if defined(_MSC_VER) && defined(MAXSEG_64K)
+- hfree(struct_ptr);
+-
+-# else
+- free(struct_ptr);
+-
+-# endif
+-# endif
++# ifdef PNG_SETJMP_SUPPORTED
++ /* We may have a jmp_buf left to deallocate. */
++ png_free_jmpbuf(&dummy_struct);
++# endif
+ }
+ }
+
+@@ -508,167 +74,215 @@
+ * need to allocate exactly 64K, so whatever you call here must
+ * have the ability to do that.
+ */
+-
+ PNG_FUNCTION(png_voidp,PNGAPI
+-png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
++png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+ {
+ png_voidp ret;
+
+- ret = (png_malloc(png_ptr, size));
++ ret = png_malloc(png_ptr, size);
+
+ if (ret != NULL)
+- png_memset(ret,0,(png_size_t)size);
++ memset(ret, 0, size);
+
+- return (ret);
++ return ret;
+ }
+
++/* png_malloc_base, an internal function added at libpng 1.6.0, does the work of
++ * allocating memory, taking into account limits and PNG_USER_MEM_SUPPORTED.
++ * Checking and error handling must happen outside this routine; it returns NULL
++ * if the allocation cannot be done (for any reason.)
++ */
++PNG_FUNCTION(png_voidp /* PRIVATE */,
++png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
++ PNG_ALLOCATED)
++{
++ /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
++ * allocators have also been removed in 1.6.0, so any 16-bit system now has
++ * to implement a user memory handler. This checks to be sure it isn't
++ * called with big numbers.
++ */
++#ifndef PNG_USER_MEM_SUPPORTED
++ PNG_UNUSED(png_ptr)
++#endif
++
++ if (size > 0 && size <= PNG_SIZE_MAX
++# ifdef PNG_MAX_MALLOC_64K
++ && size <= 65536U
++# endif
++ )
++ {
++#ifdef PNG_USER_MEM_SUPPORTED
++ if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
++ return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
++
++ else
++#endif
++ return malloc((size_t)size); /* checked for truncation above */
++ }
++
++ else
++ return NULL;
++}
++
++#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
++ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
++/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
++ * that arises because of the checks in png_realloc_array that are repeated in
++ * png_malloc_array.
++ */
++static png_voidp
++png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
++ size_t element_size)
++{
++ png_alloc_size_t req = nelements; /* known to be > 0 */
++
++ if (req <= PNG_SIZE_MAX/element_size)
++ return png_malloc_base(png_ptr, req * element_size);
++
++ /* The failure case when the request is too large */
++ return NULL;
++}
++
++PNG_FUNCTION(png_voidp /* PRIVATE */,
++png_malloc_array,(png_const_structrp png_ptr, int nelements,
++ size_t element_size),PNG_ALLOCATED)
++{
++ if (nelements <= 0 || element_size == 0)
++ png_error(png_ptr, "internal error: array alloc");
++
++ return png_malloc_array_checked(png_ptr, nelements, element_size);
++}
++
++PNG_FUNCTION(png_voidp /* PRIVATE */,
++png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
++ int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
++{
++ /* These are internal errors: */
++ if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
++ (old_array == NULL && old_elements > 0))
++ png_error(png_ptr, "internal error: array realloc");
++
++ /* Check for overflow on the elements count (so the caller does not have to
++ * check.)
++ */
++ if (add_elements <= INT_MAX - old_elements)
++ {
++ png_voidp new_array = png_malloc_array_checked(png_ptr,
++ old_elements+add_elements, element_size);
++
++ if (new_array != NULL)
++ {
++ /* Because png_malloc_array worked the size calculations below cannot
++ * overflow.
++ */
++ if (old_elements > 0)
++ memcpy(new_array, old_array, element_size*(unsigned)old_elements);
++
++ memset((char*)new_array + element_size*(unsigned)old_elements, 0,
++ element_size*(unsigned)add_elements);
++
++ return new_array;
++ }
++ }
++
++ return NULL; /* error */
++}
++#endif /* TEXT || sPLT || STORE_UNKNOWN_CHUNKS */
++
++/* Various functions that have different error handling are derived from this.
++ * png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
++ * function png_malloc_default is also provided.
++ */
+ PNG_FUNCTION(png_voidp,PNGAPI
+-png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
++png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+ {
+ png_voidp ret;
+
+-# ifdef PNG_USER_MEM_SUPPORTED
+- if (png_ptr == NULL || size == 0)
+- return (NULL);
++ if (png_ptr == NULL)
++ return NULL;
+
+- if (png_ptr->malloc_fn != NULL)
+- ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
++ ret = png_malloc_base(png_ptr, size);
+
+- else
+- ret = (png_malloc_default(png_ptr, size));
++ if (ret == NULL)
++ png_error(png_ptr, "Out of memory"); /* 'm' means png_malloc */
+
+- if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out of Memory");
+-
+- return (ret);
++ return ret;
+ }
+
++#ifdef PNG_USER_MEM_SUPPORTED
+ PNG_FUNCTION(png_voidp,PNGAPI
+-png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
++png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
++ PNG_ALLOCATED PNG_DEPRECATED)
+ {
+ png_voidp ret;
+-# endif /* PNG_USER_MEM_SUPPORTED */
+
+- if (png_ptr == NULL || size == 0)
+- return (NULL);
++ if (png_ptr == NULL)
++ return NULL;
+
+-# ifdef PNG_MAX_MALLOC_64K
+- if (size > (png_uint_32)65536L)
++ /* Passing 'NULL' here bypasses the application provided memory handler. */
++ ret = png_malloc_base(NULL/*use malloc*/, size);
++
++ if (ret == NULL)
++ png_error(png_ptr, "Out of Memory"); /* 'M' means png_malloc_default */
++
++ return ret;
++}
++#endif /* USER_MEM */
++
++/* This function was added at libpng version 1.2.3. The png_malloc_warn()
++ * function will issue a png_warning and return NULL instead of issuing a
++ * png_error, if it fails to allocate the requested memory.
++ */
++PNG_FUNCTION(png_voidp,PNGAPI
++png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
++ PNG_ALLOCATED)
++{
++ if (png_ptr != NULL)
+ {
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Cannot Allocate > 64K");
++ png_voidp ret = png_malloc_base(png_ptr, size);
+
+- else
+-# endif
+- return NULL;
++ if (ret != NULL)
++ return ret;
++
++ png_warning(png_ptr, "Out of memory");
+ }
+-# endif
+
+- /* Check for overflow */
+-# if defined(__TURBOC__) && !defined(__FLAT__)
+-
+- if (size != (unsigned long)size)
+- ret = NULL;
+-
+- else
+- ret = farmalloc(size);
+-
+-# else
+-# if defined(_MSC_VER) && defined(MAXSEG_64K)
+- if (size != (unsigned long)size)
+- ret = NULL;
+-
+- else
+- ret = halloc(size, 1);
+-
+-# else
+- if (size != (size_t)size)
+- ret = NULL;
+-
+- else
+- ret = malloc((size_t)size);
+-# endif
+-# endif
+-
+-# ifndef PNG_USER_MEM_SUPPORTED
+- if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
+- png_error(png_ptr, "Out of Memory");
+-# endif
+-
+- return (ret);
++ return NULL;
+ }
+
+ /* Free a pointer allocated by png_malloc(). If ptr is NULL, return
+ * without taking any action.
+ */
+ void PNGAPI
+-png_free(png_structp png_ptr, png_voidp ptr)
++png_free(png_const_structrp png_ptr, png_voidp ptr)
+ {
+ if (png_ptr == NULL || ptr == NULL)
+ return;
+
+-# ifdef PNG_USER_MEM_SUPPORTED
++#ifdef PNG_USER_MEM_SUPPORTED
+ if (png_ptr->free_fn != NULL)
+- {
+- (*(png_ptr->free_fn))(png_ptr, ptr);
+- return;
+- }
++ png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
+
+ else
+ png_free_default(png_ptr, ptr);
+ }
+
+-void PNGAPI
+-png_free_default(png_structp png_ptr, png_voidp ptr)
++PNG_FUNCTION(void,PNGAPI
++png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
+ {
+ if (png_ptr == NULL || ptr == NULL)
+ return;
++#endif /* USER_MEM */
+
+-# endif /* PNG_USER_MEM_SUPPORTED */
+-
+-# if defined(__TURBOC__) && !defined(__FLAT__)
+- farfree(ptr);
+-
+-# else
+-# if defined(_MSC_VER) && defined(MAXSEG_64K)
+- hfree(ptr);
+-
+-# else
+ free(ptr);
+-
+-# endif
+-# endif
+ }
+-#endif /* Not Borland DOS special memory handler */
+-
+-/* This function was added at libpng version 1.2.3. The png_malloc_warn()
+- * function will set up png_malloc() to issue a png_warning and return NULL
+- * instead of issuing a png_error, if it fails to allocate the requested
+- * memory.
+- */
+-PNG_FUNCTION(png_voidp,PNGAPI
+-png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
+-{
+- png_voidp ptr;
+- png_uint_32 save_flags;
+- if (png_ptr == NULL)
+- return (NULL);
+-
+- save_flags = png_ptr->flags;
+- png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
+- ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
+- png_ptr->flags=save_flags;
+- return(ptr);
+-}
+-
+
+ #ifdef PNG_USER_MEM_SUPPORTED
+ /* This function is called when the application wants to use another method
+ * of allocating and freeing memory.
+ */
+ void PNGAPI
+-png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
++png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr
+ malloc_fn, png_free_ptr free_fn)
+ {
+ if (png_ptr != NULL)
+@@ -684,12 +298,12 @@
+ * pointer before png_write_destroy and png_read_destroy are called.
+ */
+ png_voidp PNGAPI
+-png_get_mem_ptr(png_const_structp png_ptr)
++png_get_mem_ptr(png_const_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+- return (NULL);
++ return NULL;
+
+- return ((png_voidp)png_ptr->mem_ptr);
++ return png_ptr->mem_ptr;
+ }
+-#endif /* PNG_USER_MEM_SUPPORTED */
+-#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
++#endif /* USER_MEM */
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngpread.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngpread.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.2 [March 31, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -54,8 +54,15 @@
+ #define PNG_READ_iTXt_MODE 7
+ #define PNG_ERROR_MODE 8
+
++#define PNG_PUSH_SAVE_BUFFER_IF_FULL \
++if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
++ { png_push_save_buffer(png_ptr); return; }
++#define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \
++if (png_ptr->buffer_size < N) \
++ { png_push_save_buffer(png_ptr); return; }
++
+ void PNGAPI
+-png_process_data(png_structp png_ptr, png_infop info_ptr,
++png_process_data(png_structrp png_ptr, png_inforp info_ptr,
+ png_bytep buffer, png_size_t buffer_size)
+ {
+ if (png_ptr == NULL || info_ptr == NULL)
+@@ -70,14 +77,14 @@
+ }
+
+ png_size_t PNGAPI
+-png_process_data_pause(png_structp png_ptr, int save)
++png_process_data_pause(png_structrp png_ptr, int save)
+ {
+ if (png_ptr != NULL)
+ {
+- /* It's easiest for the caller if we do the save, then the caller doesn't
++ /* It's easiest for the caller if we do the save; then the caller doesn't
+ * have to supply the same data again:
+ */
+- if (save)
++ if (save != 0)
+ png_push_save_buffer(png_ptr);
+ else
+ {
+@@ -97,7 +104,7 @@
+ }
+
+ png_uint_32 PNGAPI
+-png_process_data_skip(png_structp png_ptr)
++png_process_data_skip(png_structrp png_ptr)
+ {
+ png_uint_32 remaining = 0;
+
+@@ -131,7 +138,7 @@
+ * doing before we ran out of data...
+ */
+ void /* PRIVATE */
+-png_process_some_data(png_structp png_ptr, png_infop info_ptr)
++png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ if (png_ptr == NULL)
+ return;
+@@ -156,30 +163,6 @@
+ break;
+ }
+
+-#ifdef PNG_READ_tEXt_SUPPORTED
+- case PNG_READ_tEXt_MODE:
+- {
+- png_push_read_tEXt(png_ptr, info_ptr);
+- break;
+- }
+-
+-#endif
+-#ifdef PNG_READ_zTXt_SUPPORTED
+- case PNG_READ_zTXt_MODE:
+- {
+- png_push_read_zTXt(png_ptr, info_ptr);
+- break;
+- }
+-
+-#endif
+-#ifdef PNG_READ_iTXt_SUPPORTED
+- case PNG_READ_iTXt_MODE:
+- {
+- png_push_read_iTXt(png_ptr, info_ptr);
+- break;
+- }
+-
+-#endif
+ case PNG_SKIP_MODE:
+ {
+ png_push_crc_finish(png_ptr);
+@@ -201,9 +184,9 @@
+ * routine.
+ */
+ void /* PRIVATE */
+-png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
++png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
+ {
+- png_size_t num_checked = png_ptr->sig_bytes,
++ png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
+ num_to_check = 8 - num_checked;
+
+ if (png_ptr->buffer_size < num_to_check)
+@@ -234,114 +217,75 @@
+ }
+
+ void /* PRIVATE */
+-png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
++png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
+ {
+- PNG_IHDR;
+- PNG_IDAT;
+- PNG_IEND;
+- PNG_PLTE;
+-#ifdef PNG_READ_bKGD_SUPPORTED
+- PNG_bKGD;
+-#endif
+-#ifdef PNG_READ_cHRM_SUPPORTED
+- PNG_cHRM;
+-#endif
+-#ifdef PNG_READ_gAMA_SUPPORTED
+- PNG_gAMA;
+-#endif
+-#ifdef PNG_READ_hIST_SUPPORTED
+- PNG_hIST;
+-#endif
+-#ifdef PNG_READ_iCCP_SUPPORTED
+- PNG_iCCP;
+-#endif
+-#ifdef PNG_READ_iTXt_SUPPORTED
+- PNG_iTXt;
+-#endif
+-#ifdef PNG_READ_oFFs_SUPPORTED
+- PNG_oFFs;
+-#endif
+-#ifdef PNG_READ_pCAL_SUPPORTED
+- PNG_pCAL;
+-#endif
+-#ifdef PNG_READ_pHYs_SUPPORTED
+- PNG_pHYs;
+-#endif
+-#ifdef PNG_READ_sBIT_SUPPORTED
+- PNG_sBIT;
+-#endif
+-#ifdef PNG_READ_sCAL_SUPPORTED
+- PNG_sCAL;
+-#endif
+-#ifdef PNG_READ_sRGB_SUPPORTED
+- PNG_sRGB;
+-#endif
+-#ifdef PNG_READ_sPLT_SUPPORTED
+- PNG_sPLT;
+-#endif
+-#ifdef PNG_READ_tEXt_SUPPORTED
+- PNG_tEXt;
+-#endif
+-#ifdef PNG_READ_tIME_SUPPORTED
+- PNG_tIME;
+-#endif
+-#ifdef PNG_READ_tRNS_SUPPORTED
+- PNG_tRNS;
+-#endif
+-#ifdef PNG_READ_zTXt_SUPPORTED
+- PNG_zTXt;
++ png_uint_32 chunk_name;
++#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++ int keep; /* unknown handling method */
+ #endif
+
+- /* First we make sure we have enough data for the 4 byte chunk name
+- * and the 4 byte chunk length before proceeding with decoding the
++ /* First we make sure we have enough data for the 4-byte chunk name
++ * and the 4-byte chunk length before proceeding with decoding the
+ * chunk data. To fully decode each of these chunks, we also make
+- * sure we have enough data in the buffer for the 4 byte CRC at the
++ * sure we have enough data in the buffer for the 4-byte CRC at the
+ * end of every chunk (except IDAT, which is handled separately).
+ */
+- if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
++ if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
+ {
+ png_byte chunk_length[4];
++ png_byte chunk_tag[4];
+
+- if (png_ptr->buffer_size < 8)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_LT(8)
+ png_push_fill_buffer(png_ptr, chunk_length, 4);
+ png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
+ png_reset_crc(png_ptr);
+- png_crc_read(png_ptr, png_ptr->chunk_name, 4);
++ png_crc_read(png_ptr, chunk_tag, 4);
++ png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
+ png_check_chunk_name(png_ptr, png_ptr->chunk_name);
+ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+ }
+
+- if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+- if (png_ptr->mode & PNG_AFTER_IDAT)
++ chunk_name = png_ptr->chunk_name;
++
++ if (chunk_name == png_IDAT)
++ {
++ if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
+
+- if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
++ /* If we reach an IDAT chunk, this means we have read all of the
++ * header chunks, and we can start reading the image (or if this
++ * is called after the image has been read - we have an error).
++ */
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_error(png_ptr, "Missing IHDR before IDAT");
++
++ else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
++ (png_ptr->mode & PNG_HAVE_PLTE) == 0)
++ png_error(png_ptr, "Missing PLTE before IDAT");
++
++ png_ptr->mode |= PNG_HAVE_IDAT;
++ png_ptr->process_mode = PNG_READ_IDAT_MODE;
++
++ if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
++ if (png_ptr->push_length == 0)
++ return;
++
++ if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
++ png_benign_error(png_ptr, "Too many IDATs found");
++ }
++
++ if (chunk_name == png_IHDR)
+ {
+ if (png_ptr->push_length != 13)
+ png_error(png_ptr, "Invalid IHDR length");
+
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+- else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
++ else if (chunk_name == png_IEND)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
+
+ png_ptr->process_mode = PNG_READ_DONE_MODE;
+@@ -349,70 +293,25 @@
+ }
+
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name))
++ else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
++ png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep);
+
+- if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+- png_ptr->mode |= PNG_HAVE_IDAT;
++ if (chunk_name == png_PLTE)
++ png_ptr->mode |= PNG_HAVE_PLTE;
++ }
++#endif
+
+- png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
+-
+- if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
+- png_ptr->mode |= PNG_HAVE_PLTE;
+-
+- else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+- {
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before IDAT");
+-
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+- !(png_ptr->mode & PNG_HAVE_PLTE))
+- png_error(png_ptr, "Missing PLTE before IDAT");
+- }
+- }
+-
+-#endif
+- else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
++ else if (chunk_name == png_PLTE)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+- else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
++ else if (chunk_name == png_IDAT)
+ {
+- /* If we reach an IDAT chunk, this means we have read all of the
+- * header chunks, and we can start reading the image (or if this
+- * is called after the image has been read - we have an error).
+- */
+-
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before IDAT");
+-
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+- !(png_ptr->mode & PNG_HAVE_PLTE))
+- png_error(png_ptr, "Missing PLTE before IDAT");
+-
+- if (png_ptr->mode & PNG_HAVE_IDAT)
+- {
+- if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
+- if (png_ptr->push_length == 0)
+- return;
+-
+- if (png_ptr->mode & PNG_AFTER_IDAT)
+- png_benign_error(png_ptr, "Too many IDATs found");
+- }
+-
+ png_ptr->idat_size = png_ptr->push_length;
+- png_ptr->mode |= PNG_HAVE_IDAT;
+ png_ptr->process_mode = PNG_READ_IDAT_MODE;
+ png_push_have_info(png_ptr, info_ptr);
+ png_ptr->zstream.avail_out =
+@@ -423,250 +322,162 @@
+ }
+
+ #ifdef PNG_READ_gAMA_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4))
++ else if (png_ptr->chunk_name == png_gAMA)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_sBIT_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4))
++ else if (png_ptr->chunk_name == png_sBIT)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_cHRM_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4))
++ else if (png_ptr->chunk_name == png_cHRM)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_sRGB_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4))
++ else if (chunk_name == png_sRGB)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_iCCP_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4))
++ else if (png_ptr->chunk_name == png_iCCP)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_sPLT_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4))
++ else if (chunk_name == png_sPLT)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_tRNS_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4))
++ else if (chunk_name == png_tRNS)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_bKGD_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4))
++ else if (chunk_name == png_bKGD)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_hIST_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4))
++ else if (chunk_name == png_hIST)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_pHYs_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4))
++ else if (chunk_name == png_pHYs)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_oFFs_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4))
++ else if (chunk_name == png_oFFs)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
+ }
+ #endif
+
+ #ifdef PNG_READ_pCAL_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4))
++ else if (chunk_name == png_pCAL)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_sCAL_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4))
++ else if (chunk_name == png_sCAL)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_tIME_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4))
++ else if (chunk_name == png_tIME)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
+ png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_tEXt_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
++ else if (chunk_name == png_tEXt)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
+- png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
++ png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_zTXt_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
++ else if (chunk_name == png_zTXt)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
+- png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
++ png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+ #endif
+ #ifdef PNG_READ_iTXt_SUPPORTED
+- else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
++ else if (chunk_name == png_iTXt)
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
++ png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
++ }
++#endif
+
+- png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
+- }
+-
+-#endif
+ else
+ {
+- if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+- png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
++ PNG_PUSH_SAVE_BUFFER_IF_FULL
++ png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
++ PNG_HANDLE_CHUNK_AS_DEFAULT);
+ }
+
+ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
+ }
+
+ void /* PRIVATE */
+-png_push_crc_skip(png_structp png_ptr, png_uint_32 skip)
++png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
+ {
+ png_ptr->process_mode = PNG_SKIP_MODE;
+ png_ptr->skip_length = skip;
+ }
+
+ void /* PRIVATE */
+-png_push_crc_finish(png_structp png_ptr)
++png_push_crc_finish(png_structrp png_ptr)
+ {
+- if (png_ptr->skip_length && png_ptr->save_buffer_size)
++ if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
+ {
+ png_size_t save_size = png_ptr->save_buffer_size;
+ png_uint_32 skip_length = png_ptr->skip_length;
+@@ -690,7 +501,7 @@
+ png_ptr->save_buffer_size -= save_size;
+ png_ptr->save_buffer_ptr += save_size;
+ }
+- if (png_ptr->skip_length && png_ptr->current_buffer_size)
++ if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
+ {
+ png_size_t save_size = png_ptr->current_buffer_size;
+ png_uint_32 skip_length = png_ptr->skip_length;
+@@ -711,14 +522,9 @@
+ png_ptr->current_buffer_size -= save_size;
+ png_ptr->current_buffer_ptr += save_size;
+ }
+- if (!png_ptr->skip_length)
++ if (png_ptr->skip_length == 0)
+ {
+- if (png_ptr->buffer_size < 4)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_LT(4)
+ png_crc_finish(png_ptr, 0);
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+ }
+@@ -733,7 +539,7 @@
+ return;
+
+ ptr = buffer;
+- if (png_ptr->save_buffer_size)
++ if (png_ptr->save_buffer_size != 0)
+ {
+ png_size_t save_size;
+
+@@ -743,14 +549,14 @@
+ else
+ save_size = png_ptr->save_buffer_size;
+
+- png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size);
++ memcpy(ptr, png_ptr->save_buffer_ptr, save_size);
+ length -= save_size;
+ ptr += save_size;
+ png_ptr->buffer_size -= save_size;
+ png_ptr->save_buffer_size -= save_size;
+ png_ptr->save_buffer_ptr += save_size;
+ }
+- if (length && png_ptr->current_buffer_size)
++ if (length != 0 && png_ptr->current_buffer_size != 0)
+ {
+ png_size_t save_size;
+
+@@ -760,7 +566,7 @@
+ else
+ save_size = png_ptr->current_buffer_size;
+
+- png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size);
++ memcpy(ptr, png_ptr->current_buffer_ptr, save_size);
+ png_ptr->buffer_size -= save_size;
+ png_ptr->current_buffer_size -= save_size;
+ png_ptr->current_buffer_ptr += save_size;
+@@ -768,9 +574,9 @@
+ }
+
+ void /* PRIVATE */
+-png_push_save_buffer(png_structp png_ptr)
++png_push_save_buffer(png_structrp png_ptr)
+ {
+- if (png_ptr->save_buffer_size)
++ if (png_ptr->save_buffer_size != 0)
+ {
+ if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
+ {
+@@ -806,16 +612,18 @@
+ if (png_ptr->save_buffer == NULL)
+ {
+ png_free(png_ptr, old_buffer);
++ old_buffer = NULL;
+ png_error(png_ptr, "Insufficient memory for save_buffer");
+ }
+
+- png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
++ memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
+ png_free(png_ptr, old_buffer);
++ old_buffer = NULL;
+ png_ptr->save_buffer_max = new_max;
+ }
+ if (png_ptr->current_buffer_size)
+ {
+- png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
++ memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
+ png_ptr->current_buffer_ptr, png_ptr->current_buffer_size);
+ png_ptr->save_buffer_size += png_ptr->current_buffer_size;
+ png_ptr->current_buffer_size = 0;
+@@ -825,7 +633,7 @@
+ }
+
+ void /* PRIVATE */
+-png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
++png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
+ png_size_t buffer_length)
+ {
+ png_ptr->current_buffer = buffer;
+@@ -835,30 +643,27 @@
+ }
+
+ void /* PRIVATE */
+-png_push_read_IDAT(png_structp png_ptr)
++png_push_read_IDAT(png_structrp png_ptr)
+ {
+- PNG_IDAT;
+- if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
++ if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
+ {
+ png_byte chunk_length[4];
++ png_byte chunk_tag[4];
+
+- if (png_ptr->buffer_size < 8)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ /* TODO: this code can be commoned up with the same code in push_read */
++ PNG_PUSH_SAVE_BUFFER_IF_LT(8)
+ png_push_fill_buffer(png_ptr, chunk_length, 4);
+ png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
+ png_reset_crc(png_ptr);
+- png_crc_read(png_ptr, png_ptr->chunk_name, 4);
++ png_crc_read(png_ptr, chunk_tag, 4);
++ png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
+ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+
+- if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
++ if (png_ptr->chunk_name != png_IDAT)
+ {
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
+ png_error(png_ptr, "Not enough compressed data");
+
+ return;
+@@ -866,7 +671,8 @@
+
+ png_ptr->idat_size = png_ptr->push_length;
+ }
+- if (png_ptr->idat_size && png_ptr->save_buffer_size)
++
++ if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
+ {
+ png_size_t save_size = png_ptr->save_buffer_size;
+ png_uint_32 idat_size = png_ptr->idat_size;
+@@ -893,7 +699,7 @@
+ png_ptr->save_buffer_ptr += save_size;
+ }
+
+- if (png_ptr->idat_size && png_ptr->current_buffer_size)
++ if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
+ {
+ png_size_t save_size = png_ptr->current_buffer_size;
+ png_uint_32 idat_size = png_ptr->idat_size;
+@@ -918,22 +724,18 @@
+ png_ptr->current_buffer_size -= save_size;
+ png_ptr->current_buffer_ptr += save_size;
+ }
+- if (!png_ptr->idat_size)
++ if (png_ptr->idat_size == 0)
+ {
+- if (png_ptr->buffer_size < 4)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
++ PNG_PUSH_SAVE_BUFFER_IF_LT(4)
+ png_crc_finish(png_ptr, 0);
+ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
+ png_ptr->mode |= PNG_AFTER_IDAT;
++ png_ptr->zowner = 0;
+ }
+ }
+
+ void /* PRIVATE */
+-png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
++png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
+ png_size_t buffer_length)
+ {
+ /* The caller checks for a non-zero buffer length. */
+@@ -945,13 +747,14 @@
+ * handle the uncompressed results.
+ */
+ png_ptr->zstream.next_in = buffer;
++ /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */
+ png_ptr->zstream.avail_in = (uInt)buffer_length;
+
+ /* Keep going until the decompressed data is all processed
+ * or the stream marked as finished.
+ */
+ while (png_ptr->zstream.avail_in > 0 &&
+- !(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
++ !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+ {
+ int ret;
+
+@@ -962,9 +765,9 @@
+ */
+ if (!(png_ptr->zstream.avail_out > 0))
+ {
+- png_ptr->zstream.avail_out =
+- (uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
+- png_ptr->iwidth) + 1;
++ /* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */
++ png_ptr->zstream.avail_out = (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
++ png_ptr->iwidth) + 1);
+
+ png_ptr->zstream.next_out = png_ptr->row_buf;
+ }
+@@ -982,7 +785,8 @@
+ if (ret != Z_OK && ret != Z_STREAM_END)
+ {
+ /* Terminate the decompression. */
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++ png_ptr->zowner = 0;
+
+ /* This may be a truncated stream (missing or
+ * damaged end code). Treat that as a warning.
+@@ -1010,7 +814,8 @@
+ {
+ /* Extra data. */
+ png_warning(png_ptr, "Extra compressed data in IDAT");
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++ png_ptr->zowner = 0;
+
+ /* Do no more processing; skip the unprocessed
+ * input check below.
+@@ -1025,7 +830,7 @@
+
+ /* And check for the end of the stream. */
+ if (ret == Z_STREAM_END)
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
+ }
+
+ /* All the data should have been processed, if anything
+@@ -1037,41 +842,62 @@
+ }
+
+ void /* PRIVATE */
+-png_push_process_row(png_structp png_ptr)
++png_push_process_row(png_structrp png_ptr)
+ {
+- png_ptr->row_info.color_type = png_ptr->color_type;
+- png_ptr->row_info.width = png_ptr->iwidth;
+- png_ptr->row_info.channels = png_ptr->channels;
+- png_ptr->row_info.bit_depth = png_ptr->bit_depth;
+- png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
++ /* 1.5.6: row_info moved out of png_struct to a local here. */
++ png_row_info row_info;
+
+- png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+- png_ptr->row_info.width);
++ row_info.width = png_ptr->iwidth; /* NOTE: width of current interlaced row */
++ row_info.color_type = png_ptr->color_type;
++ row_info.bit_depth = png_ptr->bit_depth;
++ row_info.channels = png_ptr->channels;
++ row_info.pixel_depth = png_ptr->pixel_depth;
++ row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
+
+- png_read_filter_row(png_ptr, &(png_ptr->row_info),
+- png_ptr->row_buf + 1, png_ptr->prev_row + 1,
+- (int)(png_ptr->row_buf[0]));
++ if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
++ {
++ if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST)
++ png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1,
++ png_ptr->prev_row + 1, png_ptr->row_buf[0]);
++ else
++ png_error(png_ptr, "bad adaptive filter value");
++ }
+
+- png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
++ /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before
++ * 1.5.6, while the buffer really is this big in current versions of libpng
++ * it may not be in the future, so this was changed just to copy the
++ * interlaced row count:
++ */
++ memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
+
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+- if (png_ptr->transformations)
+- png_do_read_transformations(png_ptr);
++ if (png_ptr->transformations != 0)
++ png_do_read_transformations(png_ptr, &row_info);
+ #endif
+
++ /* The transformed pixel depth should match the depth now in row_info. */
++ if (png_ptr->transformed_pixel_depth == 0)
++ {
++ png_ptr->transformed_pixel_depth = row_info.pixel_depth;
++ if (row_info.pixel_depth > png_ptr->maximum_pixel_depth)
++ png_error(png_ptr, "progressive row overflow");
++ }
++
++ else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth)
++ png_error(png_ptr, "internal progressive row size calculation error");
++
++
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+- /* Blow up interlaced rows to full size */
+- if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
++ /* Expand interlaced rows to full size */
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+ if (png_ptr->pass < 6)
+-/* old interface (pre-1.0.9):
+- png_do_read_interlace(&(png_ptr->row_info),
+- png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
+- */
+- png_do_read_interlace(png_ptr);
++ png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
++ png_ptr->transformations);
+
+- switch (png_ptr->pass)
+- {
++ switch (png_ptr->pass)
++ {
+ case 0:
+ {
+ int i;
+@@ -1238,7 +1064,6 @@
+ }
+ }
+ else
+-#endif
+ {
+ png_push_have_row(png_ptr, png_ptr->row_buf + 1);
+ png_read_push_finish_row(png_ptr);
+@@ -1246,36 +1071,36 @@
+ }
+
+ void /* PRIVATE */
+-png_read_push_finish_row(png_structp png_ptr)
++png_read_push_finish_row(png_structrp png_ptr)
+ {
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- PNG_CONST int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- PNG_CONST int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
+- PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
++ static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
+- PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
++ static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
+
+ /* Height of interlace block. This is not currently used - if you need
+ * it, uncomment it here and in png.h
+- PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
+ */
++#endif
+
+ png_ptr->row_number++;
+ if (png_ptr->row_number < png_ptr->num_rows)
+ return;
+
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
+- if (png_ptr->interlaced)
++ if (png_ptr->interlaced != 0)
+ {
+ png_ptr->row_number = 0;
+- png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
+
+ do
+ {
+@@ -1296,7 +1121,7 @@
+ png_pass_start[png_ptr->pass]) /
+ png_pass_inc[png_ptr->pass];
+
+- if (png_ptr->transformations & PNG_INTERLACE)
++ if ((png_ptr->transformations & PNG_INTERLACE) != 0)
+ break;
+
+ png_ptr->num_rows = (png_ptr->height +
+@@ -1306,538 +1131,24 @@
+
+ } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
+ }
+-#endif /* PNG_READ_INTERLACING_SUPPORTED */
+-}
+-
+-#ifdef PNG_READ_tEXt_SUPPORTED
+-void /* PRIVATE */
+-png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
+- length)
+-{
+- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
+- {
+- PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
+- png_error(png_ptr, "Out of place tEXt");
+- /* NOT REACHED */
+- }
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- png_ptr->skip_length = 0; /* This may not be necessary */
+-
+- if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
+- {
+- png_warning(png_ptr, "tEXt chunk too large to fit in memory");
+- png_ptr->skip_length = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
+- }
+-#endif
+-
+- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
+- (png_size_t)(length + 1));
+- png_ptr->current_text[length] = '\0';
+- png_ptr->current_text_ptr = png_ptr->current_text;
+- png_ptr->current_text_size = (png_size_t)length;
+- png_ptr->current_text_left = (png_size_t)length;
+- png_ptr->process_mode = PNG_READ_tEXt_MODE;
+ }
+
+ void /* PRIVATE */
+-png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
+-{
+- if (png_ptr->buffer_size && png_ptr->current_text_left)
+- {
+- png_size_t text_size;
+-
+- if (png_ptr->buffer_size < png_ptr->current_text_left)
+- text_size = png_ptr->buffer_size;
+-
+- else
+- text_size = png_ptr->current_text_left;
+-
+- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
+- png_ptr->current_text_left -= text_size;
+- png_ptr->current_text_ptr += text_size;
+- }
+- if (!(png_ptr->current_text_left))
+- {
+- png_textp text_ptr;
+- png_charp text;
+- png_charp key;
+- int ret;
+-
+- if (png_ptr->buffer_size < 4)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
+- png_push_crc_finish(png_ptr);
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- if (png_ptr->skip_length)
+- return;
+-#endif
+-
+- key = png_ptr->current_text;
+-
+- for (text = key; *text; text++)
+- /* Empty loop */ ;
+-
+- if (text < key + png_ptr->current_text_size)
+- text++;
+-
+- text_ptr = (png_textp)png_malloc(png_ptr, png_sizeof(png_text));
+- text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
+- text_ptr->key = key;
+- text_ptr->itxt_length = 0;
+- text_ptr->lang = NULL;
+- text_ptr->lang_key = NULL;
+- text_ptr->text = text;
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_free(png_ptr, key);
+- png_free(png_ptr, text_ptr);
+- png_ptr->current_text = NULL;
+-
+- if (ret)
+- png_warning(png_ptr, "Insufficient memory to store text chunk");
+- }
+-}
+-#endif
+-
+-#ifdef PNG_READ_zTXt_SUPPORTED
+-void /* PRIVATE */
+-png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
+- length)
+-{
+- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
+- {
+- PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
+- png_error(png_ptr, "Out of place zTXt");
+- /* NOT REACHED */
+- }
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- /* We can't handle zTXt chunks > 64K, since we don't have enough space
+- * to be able to store the uncompressed data. Actually, the threshold
+- * is probably around 32K, but it isn't as definite as 64K is.
+- */
+- if (length > (png_uint_32)65535L)
+- {
+- png_warning(png_ptr, "zTXt chunk too large to fit in memory");
+- png_push_crc_skip(png_ptr, length);
+- return;
+- }
+-#endif
+-
+- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
+- (png_size_t)(length + 1));
+- png_ptr->current_text[length] = '\0';
+- png_ptr->current_text_ptr = png_ptr->current_text;
+- png_ptr->current_text_size = (png_size_t)length;
+- png_ptr->current_text_left = (png_size_t)length;
+- png_ptr->process_mode = PNG_READ_zTXt_MODE;
+-}
+-
+-void /* PRIVATE */
+-png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
+-{
+- if (png_ptr->buffer_size && png_ptr->current_text_left)
+- {
+- png_size_t text_size;
+-
+- if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left)
+- text_size = png_ptr->buffer_size;
+-
+- else
+- text_size = png_ptr->current_text_left;
+-
+- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
+- png_ptr->current_text_left -= text_size;
+- png_ptr->current_text_ptr += text_size;
+- }
+- if (!(png_ptr->current_text_left))
+- {
+- png_textp text_ptr;
+- png_charp text;
+- png_charp key;
+- int ret;
+- png_size_t text_size, key_size;
+-
+- if (png_ptr->buffer_size < 4)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
+- png_push_crc_finish(png_ptr);
+-
+- key = png_ptr->current_text;
+-
+- for (text = key; *text; text++)
+- /* Empty loop */ ;
+-
+- /* zTXt can't have zero text */
+- if (text >= key + png_ptr->current_text_size)
+- {
+- png_ptr->current_text = NULL;
+- png_free(png_ptr, key);
+- return;
+- }
+-
+- text++;
+-
+- if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */
+- {
+- png_ptr->current_text = NULL;
+- png_free(png_ptr, key);
+- return;
+- }
+-
+- text++;
+-
+- png_ptr->zstream.next_in = (png_bytep)text;
+- png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
+- (text - key));
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+-
+- key_size = text - key;
+- text_size = 0;
+- text = NULL;
+- ret = Z_STREAM_END;
+-
+- while (png_ptr->zstream.avail_in)
+- {
+- ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
+- if (ret != Z_OK && ret != Z_STREAM_END)
+- {
+- inflateReset(&png_ptr->zstream);
+- png_ptr->zstream.avail_in = 0;
+- png_ptr->current_text = NULL;
+- png_free(png_ptr, key);
+- png_free(png_ptr, text);
+- return;
+- }
+-
+- if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END)
+- {
+- if (text == NULL)
+- {
+- text = (png_charp)png_malloc(png_ptr,
+- (png_ptr->zbuf_size
+- - png_ptr->zstream.avail_out + key_size + 1));
+-
+- png_memcpy(text + key_size, png_ptr->zbuf,
+- png_ptr->zbuf_size - png_ptr->zstream.avail_out);
+-
+- png_memcpy(text, key, key_size);
+-
+- text_size = key_size + png_ptr->zbuf_size -
+- png_ptr->zstream.avail_out;
+-
+- *(text + text_size) = '\0';
+- }
+-
+- else
+- {
+- png_charp tmp;
+-
+- tmp = text;
+- text = (png_charp)png_malloc(png_ptr, text_size +
+- (png_ptr->zbuf_size
+- - png_ptr->zstream.avail_out + 1));
+-
+- png_memcpy(text, tmp, text_size);
+- png_free(png_ptr, tmp);
+-
+- png_memcpy(text + text_size, png_ptr->zbuf,
+- png_ptr->zbuf_size - png_ptr->zstream.avail_out);
+-
+- text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
+- *(text + text_size) = '\0';
+- }
+-
+- if (ret != Z_STREAM_END)
+- {
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+- }
+- }
+- else
+- {
+- break;
+- }
+-
+- if (ret == Z_STREAM_END)
+- break;
+- }
+-
+- inflateReset(&png_ptr->zstream);
+- png_ptr->zstream.avail_in = 0;
+-
+- if (ret != Z_STREAM_END)
+- {
+- png_ptr->current_text = NULL;
+- png_free(png_ptr, key);
+- png_free(png_ptr, text);
+- return;
+- }
+-
+- png_ptr->current_text = NULL;
+- png_free(png_ptr, key);
+- key = text;
+- text += key_size;
+-
+- text_ptr = (png_textp)png_malloc(png_ptr,
+- png_sizeof(png_text));
+- text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
+- text_ptr->key = key;
+- text_ptr->itxt_length = 0;
+- text_ptr->lang = NULL;
+- text_ptr->lang_key = NULL;
+- text_ptr->text = text;
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_free(png_ptr, key);
+- png_free(png_ptr, text_ptr);
+-
+- if (ret)
+- png_warning(png_ptr, "Insufficient memory to store text chunk");
+- }
+-}
+-#endif
+-
+-#ifdef PNG_READ_iTXt_SUPPORTED
+-void /* PRIVATE */
+-png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
+- length)
+-{
+- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
+- {
+- PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
+- png_error(png_ptr, "Out of place iTXt");
+- /* NOT REACHED */
+- }
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- png_ptr->skip_length = 0; /* This may not be necessary */
+-
+- if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
+- {
+- png_warning(png_ptr, "iTXt chunk too large to fit in memory");
+- png_ptr->skip_length = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
+- }
+-#endif
+-
+- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
+- (png_size_t)(length + 1));
+- png_ptr->current_text[length] = '\0';
+- png_ptr->current_text_ptr = png_ptr->current_text;
+- png_ptr->current_text_size = (png_size_t)length;
+- png_ptr->current_text_left = (png_size_t)length;
+- png_ptr->process_mode = PNG_READ_iTXt_MODE;
+-}
+-
+-void /* PRIVATE */
+-png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
+-{
+-
+- if (png_ptr->buffer_size && png_ptr->current_text_left)
+- {
+- png_size_t text_size;
+-
+- if (png_ptr->buffer_size < png_ptr->current_text_left)
+- text_size = png_ptr->buffer_size;
+-
+- else
+- text_size = png_ptr->current_text_left;
+-
+- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
+- png_ptr->current_text_left -= text_size;
+- png_ptr->current_text_ptr += text_size;
+- }
+-
+- if (!(png_ptr->current_text_left))
+- {
+- png_textp text_ptr;
+- png_charp key;
+- int comp_flag;
+- png_charp lang;
+- png_charp lang_key;
+- png_charp text;
+- int ret;
+-
+- if (png_ptr->buffer_size < 4)
+- {
+- png_push_save_buffer(png_ptr);
+- return;
+- }
+-
+- png_push_crc_finish(png_ptr);
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- if (png_ptr->skip_length)
+- return;
+-#endif
+-
+- key = png_ptr->current_text;
+-
+- for (lang = key; *lang; lang++)
+- /* Empty loop */ ;
+-
+- if (lang < key + png_ptr->current_text_size - 3)
+- lang++;
+-
+- comp_flag = *lang++;
+- lang++; /* Skip comp_type, always zero */
+-
+- for (lang_key = lang; *lang_key; lang_key++)
+- /* Empty loop */ ;
+-
+- lang_key++; /* Skip NUL separator */
+-
+- text=lang_key;
+-
+- if (lang_key < key + png_ptr->current_text_size - 1)
+- {
+- for (; *text; text++)
+- /* Empty loop */ ;
+- }
+-
+- if (text < key + png_ptr->current_text_size)
+- text++;
+-
+- text_ptr = (png_textp)png_malloc(png_ptr,
+- png_sizeof(png_text));
+-
+- text_ptr->compression = comp_flag + 2;
+- text_ptr->key = key;
+- text_ptr->lang = lang;
+- text_ptr->lang_key = lang_key;
+- text_ptr->text = text;
+- text_ptr->text_length = 0;
+- text_ptr->itxt_length = png_strlen(text);
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_ptr->current_text = NULL;
+-
+- png_free(png_ptr, text_ptr);
+- if (ret)
+- png_warning(png_ptr, "Insufficient memory to store iTXt chunk");
+- }
+-}
+-#endif
+-
+-/* This function is called when we haven't found a handler for this
+- * chunk. If there isn't a problem with the chunk itself (ie a bad chunk
+- * name or a critical chunk), the chunk is (currently) silently ignored.
+- */
+-void /* PRIVATE */
+-png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
+- length)
+-{
+- png_uint_32 skip = 0;
+-
+- if (!(png_ptr->chunk_name[0] & 0x20))
+- {
+-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+- if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
+- PNG_HANDLE_CHUNK_ALWAYS
+-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+- && png_ptr->read_user_chunk_fn == NULL
+-#endif
+- )
+-#endif
+- png_chunk_error(png_ptr, "unknown critical chunk");
+-
+- PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
+- }
+-
+-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+- if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
+- {
+-#ifdef PNG_MAX_MALLOC_64K
+- if (length > (png_uint_32)65535L)
+- {
+- png_warning(png_ptr, "unknown chunk too large to fit in memory");
+- skip = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
+- }
+-#endif
+- png_memcpy((png_charp)png_ptr->unknown_chunk.name,
+- (png_charp)png_ptr->chunk_name,
+- png_sizeof(png_ptr->unknown_chunk.name));
+- png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
+- = '\0';
+-
+- png_ptr->unknown_chunk.size = (png_size_t)length;
+-
+- if (length == 0)
+- png_ptr->unknown_chunk.data = NULL;
+-
+- else
+- {
+- png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
+- (png_size_t)length);
+- png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+- }
+-
+-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+- if (png_ptr->read_user_chunk_fn != NULL)
+- {
+- /* Callback to user unknown chunk handler */
+- int ret;
+- ret = (*(png_ptr->read_user_chunk_fn))
+- (png_ptr, &png_ptr->unknown_chunk);
+-
+- if (ret < 0)
+- png_chunk_error(png_ptr, "error in user chunk");
+-
+- if (ret == 0)
+- {
+- if (!(png_ptr->chunk_name[0] & 0x20))
+- if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
+- PNG_HANDLE_CHUNK_ALWAYS)
+- png_chunk_error(png_ptr, "unknown critical chunk");
+- png_set_unknown_chunks(png_ptr, info_ptr,
+- &png_ptr->unknown_chunk, 1);
+- }
+- }
+-
+- else
+-#endif
+- png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
+- png_free(png_ptr, png_ptr->unknown_chunk.data);
+- png_ptr->unknown_chunk.data = NULL;
+- }
+-
+- else
+-#endif
+- skip=length;
+- png_push_crc_skip(png_ptr, skip);
+-}
+-
+-void /* PRIVATE */
+-png_push_have_info(png_structp png_ptr, png_infop info_ptr)
++png_push_have_info(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ if (png_ptr->info_fn != NULL)
+ (*(png_ptr->info_fn))(png_ptr, info_ptr);
+ }
+
+ void /* PRIVATE */
+-png_push_have_end(png_structp png_ptr, png_infop info_ptr)
++png_push_have_end(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ if (png_ptr->end_fn != NULL)
+ (*(png_ptr->end_fn))(png_ptr, info_ptr);
+ }
+
+ void /* PRIVATE */
+-png_push_have_row(png_structp png_ptr, png_bytep row)
++png_push_have_row(png_structrp png_ptr, png_bytep row)
+ {
+ if (png_ptr->row_fn != NULL)
+ (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
+@@ -1845,21 +1156,22 @@
+ }
+
+ void PNGAPI
+-png_progressive_combine_row (png_structp png_ptr, png_bytep old_row,
++png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
+ png_const_bytep new_row)
+ {
+- PNG_CONST int FARDATA png_pass_dsp_mask[7] =
+- {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
+-
+ if (png_ptr == NULL)
+ return;
+
+- if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
+- png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
++ /* new_row is a flag here - if it is NULL then the app callback was called
++ * from an empty row (see the calls to png_struct::row_fn below), otherwise
++ * it must be png_ptr->row_buf+1
++ */
++ if (new_row != NULL)
++ png_combine_row(png_ptr, old_row, 1/*blocky display*/);
+ }
+
+ void PNGAPI
+-png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
++png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
+ png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
+ png_progressive_end_ptr end_fn)
+ {
+@@ -1874,11 +1186,11 @@
+ }
+
+ png_voidp PNGAPI
+-png_get_progressive_ptr(png_const_structp png_ptr)
++png_get_progressive_ptr(png_const_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+ return (NULL);
+
+ return png_ptr->io_ptr;
+ }
+-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PROGRESSIVE_READ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngpriv.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngpriv.h Fri Apr 10 09:21:28 2015 -0700
+@@ -30,11 +30,11 @@
+ * file and, per its terms, should not be removed:
+ *
+ * For conditions of distribution and use, see copyright notice in png.h
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
++ * Last changed in libpng 1.6.10 [March 6, 1014]]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+@@ -42,7 +42,7 @@
+ */
+
+ /* The symbols declared in this file (including the functions declared
+- * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public
++ * as extern) are PRIVATE. They are not part of the libpng public
+ * interface, and are not recommended for use by regular applications.
+ * Some of them may become public in the future; others may stay private,
+ * change in an incompatible way, or even disappear.
+@@ -67,12 +67,44 @@
+ */
+ #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+
+-/* This is required for the definition of abort(), used as a last ditch
+- * error handler when all else fails.
++#ifndef PNG_VERSION_INFO_ONLY
++/* Standard library headers not required by png.h: */
++# include <stdlib.h>
++# include <string.h>
++#endif
++
++#define PNGLIB_BUILD /*libpng is being built, not used*/
++
++/* If HAVE_CONFIG_H is defined during the build then the build system must
++ * provide an appropriate "config.h" file on the include path. The header file
++ * must provide definitions as required below (search for "HAVE_CONFIG_H");
++ * see configure.ac for more details of the requirements. The macro
++ * "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
++ * 'configure'; define this macro to prevent the configure build including the
++ * configure generated config.h. Libpng is expected to compile without *any*
++ * special build system support on a reasonably ANSI-C compliant system.
+ */
+-#include <stdlib.h>
++#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
++# include <config.h>
+
+-#define PNGLIB_BUILD
++ /* Pick up the definition of 'restrict' from config.h if it was read: */
++# define PNG_RESTRICT restrict
++#endif
++
++/* To support symbol prefixing it is necessary to know *before* including png.h
++ * whether the fixed point (and maybe other) APIs are exported, because if they
++ * are not internal definitions may be required. This is handled below just
++ * before png.h is included, but load the configuration now if it is available.
++ */
++#ifndef PNGLCONF_H
++# include "pnglibconf.h"
++#endif
++
++/* Local renames may change non-exported API functions from png.h */
++#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
++# include "pngprefix.h"
++#endif
++
+ #ifdef PNG_USER_CONFIG
+ # include "pngusr.h"
+ /* These should have been defined in pngusr.h */
+@@ -83,25 +115,253 @@
+ # define PNG_USER_DLLFNAME_POSTFIX "Cb"
+ # endif
+ #endif
++
++/* Compile time options.
++ * =====================
++ * In a multi-arch build the compiler may compile the code several times for the
++ * same object module, producing different binaries for different architectures.
++ * When this happens configure-time setting of the target host options cannot be
++ * done and this interferes with the handling of the ARM NEON optimizations, and
++ * possibly other similar optimizations. Put additional tests here; in general
++ * this is needed when the same option can be changed at both compile time and
++ * run time depending on the target OS (i.e. iOS vs Android.)
++ *
++ * NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
++ * this is not possible with certain compilers (Oracle SUN OS CC), as a result
++ * it is necessary to ensure that all extern functions that *might* be used
++ * regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__
++ * below is one example of this behavior because it is controlled by the
++ * presence or not of -mfpu=neon on the GCC command line, it is possible to do
++ * this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
++ * do this.
++ */
++#ifndef PNG_ARM_NEON_OPT
++ /* ARM NEON optimizations are being controlled by the compiler settings,
++ * typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
++ * with GCC) then the compiler will define __ARM_NEON__ and we can rely
++ * unconditionally on NEON instructions not crashing, otherwise we must
++ * disable use of NEON instructions.
++ *
++ * NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
++ * can only be turned on automatically if that is supported too. If
++ * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
++ * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
++ * off.
++ *
++ * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
++ * check both variants.
++ */
++# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
++ defined(PNG_ALIGNED_MEMORY_SUPPORTED)
++# define PNG_ARM_NEON_OPT 2
++# else
++# define PNG_ARM_NEON_OPT 0
++# endif
++#endif
++
++#if PNG_ARM_NEON_OPT > 0
++ /* NEON optimizations are to be at least considered by libpng, so enable the
++ * callbacks to do this.
++ */
++# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
++
++ /* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
++ * if possible - if __ARM_NEON__ is set and the compiler version is not known
++ * to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
++ * be:
++ *
++ * 1 The intrinsics code (the default with __ARM_NEON__)
++ * 2 The hand coded assembler (the default without __ARM_NEON__)
++ *
++ * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
++ * this is *NOT* supported and may cease to work even after a minor revision
++ * to libpng. It *is* valid to do this for testing purposes, e.g. speed
++ * testing or a new compiler, but the results should be communicated to the
++ * libpng implementation list for incorporation in the next minor release.
++ */
++# ifndef PNG_ARM_NEON_IMPLEMENTATION
++# if defined(__ARM_NEON__) || defined(__ARM_NEON)
++# if defined(__clang__)
++ /* At present it is unknown by the libpng developers which versions
++ * of clang support the intrinsics, however some or perhaps all
++ * versions do not work with the assembler so this may be
++ * irrelevant, so just use the default (do nothing here.)
++ */
++# elif defined(__GNUC__)
++ /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
++ * work, so if this *is* GCC, or G++, look for a version >4.5
++ */
++# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
++# define PNG_ARM_NEON_IMPLEMENTATION 2
++# endif /* no GNUC support */
++# endif /* __GNUC__ */
++# else /* !defined __ARM_NEON__ */
++ /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
++ */
++# define PNG_ARM_NEON_IMPLEMENTATION 2
++# endif /* __ARM_NEON__ */
++# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
++
++# ifndef PNG_ARM_NEON_IMPLEMENTATION
++ /* Use the intrinsics code by default. */
++# define PNG_ARM_NEON_IMPLEMENTATION 1
++# endif
++#endif /* PNG_ARM_NEON_OPT > 0 */
++
++/* Is this a build of a DLL where compilation of the object modules requires
++ * different preprocessor settings to those required for a simple library? If
++ * so PNG_BUILD_DLL must be set.
++ *
++ * If libpng is used inside a DLL but that DLL does not export the libpng APIs
++ * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
++ * static library of libpng then link the DLL against that.
++ */
++#ifndef PNG_BUILD_DLL
++# ifdef DLL_EXPORT
++ /* This is set by libtool when files are compiled for a DLL; libtool
++ * always compiles twice, even on systems where it isn't necessary. Set
++ * PNG_BUILD_DLL in case it is necessary:
++ */
++# define PNG_BUILD_DLL
++# else
++# ifdef _WINDLL
++ /* This is set by the Microsoft Visual Studio IDE in projects that
++ * build a DLL. It can't easily be removed from those projects (it
++ * isn't visible in the Visual Studio UI) so it is a fairly reliable
++ * indication that PNG_IMPEXP needs to be set to the DLL export
++ * attributes.
++ */
++# define PNG_BUILD_DLL
++# else
++# ifdef __DLL__
++ /* This is set by the Borland C system when compiling for a DLL
++ * (as above.)
++ */
++# define PNG_BUILD_DLL
++# else
++ /* Add additional compiler cases here. */
++# endif
++# endif
++# endif
++#endif /* Setting PNG_BUILD_DLL if required */
++
++/* See pngconf.h for more details: the builder of the library may set this on
++ * the command line to the right thing for the specific compilation system or it
++ * may be automagically set above (at present we know of no system where it does
++ * need to be set on the command line.)
++ *
++ * PNG_IMPEXP must be set here when building the library to prevent pngconf.h
++ * setting it to the "import" setting for a DLL build.
++ */
++#ifndef PNG_IMPEXP
++# ifdef PNG_BUILD_DLL
++# define PNG_IMPEXP PNG_DLL_EXPORT
++# else
++ /* Not building a DLL, or the DLL doesn't require specific export
++ * definitions.
++ */
++# define PNG_IMPEXP
++# endif
++#endif
++
++/* No warnings for private or deprecated functions in the build: */
++#ifndef PNG_DEPRECATED
++# define PNG_DEPRECATED
++#endif
++#ifndef PNG_PRIVATE
++# define PNG_PRIVATE
++#endif
++
++/* Symbol preprocessing support.
++ *
++ * To enable listing global, but internal, symbols the following macros should
++ * always be used to declare an extern data or function object in this file.
++ */
++#ifndef PNG_INTERNAL_DATA
++# define PNG_INTERNAL_DATA(type, name, array) extern type name array
++#endif
++
++#ifndef PNG_INTERNAL_FUNCTION
++# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
++ extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
++#endif
++
++#ifndef PNG_INTERNAL_CALLBACK
++# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
++ extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
++#endif
++
++/* If floating or fixed point APIs are disabled they may still be compiled
++ * internally. To handle this make sure they are declared as the appropriate
++ * internal extern function (otherwise the symbol prefixing stuff won't work and
++ * the functions will be used without definitions.)
++ *
++ * NOTE: although all the API functions are declared here they are not all
++ * actually built! Because the declarations are still made it is necessary to
++ * fake out types that they depend on.
++ */
++#ifndef PNG_FP_EXPORT
++# ifndef PNG_FLOATING_POINT_SUPPORTED
++# define PNG_FP_EXPORT(ordinal, type, name, args)\
++ PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
++# ifndef PNG_VERSION_INFO_ONLY
++ typedef struct png_incomplete png_double;
++ typedef png_double* png_doublep;
++ typedef const png_double* png_const_doublep;
++ typedef png_double** png_doublepp;
++# endif
++# endif
++#endif
++#ifndef PNG_FIXED_EXPORT
++# ifndef PNG_FIXED_POINT_SUPPORTED
++# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
++ PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
++# endif
++#endif
++
+ #include "png.h"
+-#include "pnginfo.h"
+-#include "pngstruct.h"
+
+-/* This is used for 16 bit gamma tables - only the top level pointers are const,
+- * this could be changed:
++/* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
++#ifndef PNG_DLL_EXPORT
++# define PNG_DLL_EXPORT
++#endif
++
++/* SECURITY and SAFETY:
++ *
++ * By default libpng is built without any internal limits on image size,
++ * individual heap (png_malloc) allocations or the total amount of memory used.
++ * If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used
++ * (unless individually overridden). These limits are believed to be fairly
++ * safe, but builders of secure systems should verify the values against the
++ * real system capabilities.
+ */
+-typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
+-
+-/* Added at libpng-1.2.9 */
+-/* Moved to pngpriv.h at libpng-1.5.0 */
+-
+-/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
+- * script. We may need it here to get the correct configuration on things
+- * like limits.
+- */
+-#ifdef PNG_CONFIGURE_LIBPNG
+-# ifdef HAVE_CONFIG_H
+-# include "config.h"
++#ifdef PNG_SAFE_LIMITS_SUPPORTED
++ /* 'safe' limits */
++# ifndef PNG_USER_WIDTH_MAX
++# define PNG_USER_WIDTH_MAX 1000000
++# endif
++# ifndef PNG_USER_HEIGHT_MAX
++# define PNG_USER_HEIGHT_MAX 1000000
++# endif
++# ifndef PNG_USER_CHUNK_CACHE_MAX
++# define PNG_USER_CHUNK_CACHE_MAX 128
++# endif
++# ifndef PNG_USER_CHUNK_MALLOC_MAX
++# define PNG_USER_CHUNK_MALLOC_MAX 8000000
++# endif
++#else
++ /* values for no limits */
++# ifndef PNG_USER_WIDTH_MAX
++# define PNG_USER_WIDTH_MAX 0x7fffffff
++# endif
++# ifndef PNG_USER_HEIGHT_MAX
++# define PNG_USER_HEIGHT_MAX 0x7fffffff
++# endif
++# ifndef PNG_USER_CHUNK_CACHE_MAX
++# define PNG_USER_CHUNK_CACHE_MAX 0
++# endif
++# ifndef PNG_USER_CHUNK_MALLOC_MAX
++# define PNG_USER_CHUNK_MALLOC_MAX 0
+ # endif
+ #endif
+
+@@ -143,13 +403,6 @@
+ # define PNG_ZBUF_SIZE 65536L
+ #endif
+
+-/* PNG_STATIC is used to mark internal file scope functions if they need to be
+- * accessed for implementation tests (see the code in tests/?*).
+- */
+-#ifndef PNG_STATIC
+-# define PNG_STATIC static
+-#endif
+-
+ /* If warnings or errors are turned off the code is disabled or redirected here.
+ * From 1.5.4 functions have been added to allow very limited formatting of
+ * error and warning messages - this code will also be disabled here.
+@@ -157,8 +410,6 @@
+ #ifdef PNG_WARNINGS_SUPPORTED
+ # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
+ #else
+-# define png_warning(s1,s2) ((void)(s1))
+-# define png_chunk_warning(s1,s2) ((void)(s1))
+ # define png_warning_parameter(p,number,string) ((void)0)
+ # define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
+ # define png_warning_parameter_signed(p,number,format,value) ((void)0)
+@@ -166,21 +417,27 @@
+ # define PNG_WARNING_PARAMETERS(p)
+ #endif
+ #ifndef PNG_ERROR_TEXT_SUPPORTED
+-# define png_error(s1,s2) png_err(s1)
+-# define png_chunk_error(s1,s2) png_err(s1)
+ # define png_fixed_error(s1,s2) png_err(s1)
+ #endif
+
+-#ifndef PNG_EXTERN
+-/* The functions exported by PNG_EXTERN are internal functions, which
+- * aren't usually used outside the library (as far as I know), so it is
+- * debatable if they should be exported at all. In the future, when it
+- * is possible to have run-time registry of chunk-handling functions,
+- * some of these might be made available again.
+-# define PNG_EXTERN extern
++/* C allows up-casts from (void*) to any pointer and (const void*) to any
++ * pointer to a const object. C++ regards this as a type error and requires an
++ * explicit, static, cast and provides the static_cast<> rune to ensure that
++ * const is not cast away.
+ */
+-# define PNG_EXTERN
+-#endif
++#ifdef __cplusplus
++# define png_voidcast(type, value) static_cast<type>(value)
++# define png_constcast(type, value) const_cast<type>(value)
++# define png_aligncast(type, value) \
++ static_cast<type>(static_cast<void*>(value))
++# define png_aligncastconst(type, value) \
++ static_cast<type>(static_cast<const void*>(value))
++#else
++# define png_voidcast(type, value) (value)
++# define png_constcast(type, value) ((type)(value))
++# define png_aligncast(type, value) ((void*)(value))
++# define png_aligncastconst(type, value) ((const void*)(value))
++#endif /* __cplusplus */
+
+ /* Some fixed point APIs are still required even if not exported because
+ * they get used by the corresponding floating point APIs. This magic
+@@ -192,6 +449,7 @@
+ # define PNGFAPI /* PRIVATE */
+ #endif
+
++#ifndef PNG_VERSION_INFO_ONLY
+ /* Other defines specific to compilers can go here. Try to keep
+ * them inside an appropriate ifdef/endif pair for portability.
+ */
+@@ -236,6 +494,7 @@
+ defined(_WIN32) || defined(__WIN32__)
+ # include <windows.h> /* defines _WINDOWS_ macro */
+ #endif
++#endif /* PNG_VERSION_INFO_ONLY */
+
+ /* Moved here around 1.5.0beta36 from pngconf.h */
+ /* Users may want to use these so they are not private. Any library
+@@ -251,33 +510,51 @@
+ # endif
+ #endif
+
+-#ifdef USE_FAR_KEYWORD
+-/* Use this to make far-to-near assignments */
+-# define CHECK 1
+-# define NOCHECK 0
+-# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
+-# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
+-# define png_strlen _fstrlen
+-# define png_memcmp _fmemcmp /* SJT: added */
+-# define png_memcpy _fmemcpy
+-# define png_memset _fmemset
++/* These macros may need to be architecture dependent. */
++#define PNG_ALIGN_NONE 0 /* do not use data alignment */
++#define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */
++#ifdef offsetof
++# define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */
+ #else
+-# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
+-# define CVT_PTR(ptr) (ptr)
+-# define CVT_PTR_NOCHECK(ptr) (ptr)
+-# define png_strlen lstrlenA
+-# define png_memcmp memcmp
+-# define png_memcpy CopyMemory
+-# define png_memset memset
++# define PNG_ALIGN_OFFSET -1 /* prevent the use of this */
++#endif
++#define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */
++
++#ifndef PNG_ALIGN_TYPE
++ /* Default to using aligned access optimizations and requiring alignment to a
++ * multiple of the data type size. Override in a compiler specific fashion
++ * if necessary by inserting tests here:
++ */
++# define PNG_ALIGN_TYPE PNG_ALIGN_SIZE
++#endif
++
++#if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE
++ /* This is used because in some compiler implementations non-aligned
++ * structure members are supported, so the offsetof approach below fails.
++ * Set PNG_ALIGN_SIZE=0 for compiler combinations where unaligned access
++ * is good for performance. Do not do this unless you have tested the result
++ * and understand it.
++ */
++# define png_alignof(type) (sizeof (type))
++#else
++# if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET
++# define png_alignof(type) offsetof(struct{char c; type t;}, t)
+ # else
+-# define CVT_PTR(ptr) (ptr)
+-# define CVT_PTR_NOCHECK(ptr) (ptr)
+-# define png_strlen strlen
+-# define png_memcmp memcmp /* SJT: added */
+-# define png_memcpy memcpy
+-# define png_memset memset
++# if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS
++# define png_alignof(type) (1)
++# endif
++ /* Else leave png_alignof undefined to prevent use thereof */
+ # endif
+ #endif
++
++/* This implicitly assumes alignment is always to a power of 2. */
++#ifdef png_alignof
++# define png_isaligned(ptr, type)\
++ ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0)
++#else
++# define png_isaligned(ptr, type) 0
++#endif
++
+ /* End of memory model/platform independent support */
+ /* End of 1.5.0beta36 move from pngconf.h */
+
+@@ -295,15 +572,17 @@
+ #define PNG_HAVE_IDAT 0x04
+ /* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */
+ #define PNG_HAVE_IEND 0x10
+-#define PNG_HAVE_gAMA 0x20
+-#define PNG_HAVE_cHRM 0x40
+-#define PNG_HAVE_sRGB 0x80
++ /* 0x20 (unused) */
++ /* 0x40 (unused) */
++ /* 0x80 (unused) */
+ #define PNG_HAVE_CHUNK_HEADER 0x100
+ #define PNG_WROTE_tIME 0x200
+ #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
+ #define PNG_BACKGROUND_IS_GRAY 0x800
+ #define PNG_HAVE_PNG_SIGNATURE 0x1000
+ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
++ /* 0x4000 (unused) */
++#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
+
+ /* Flags for the transformations the PNG library does on the image data */
+ #define PNG_BGR 0x0001
+@@ -321,24 +600,23 @@
+ #define PNG_EXPAND 0x1000
+ #define PNG_GAMMA 0x2000
+ #define PNG_GRAY_TO_RGB 0x4000
+-#define PNG_FILLER 0x8000L
+-#define PNG_PACKSWAP 0x10000L
+-#define PNG_SWAP_ALPHA 0x20000L
+-#define PNG_STRIP_ALPHA 0x40000L
+-#define PNG_INVERT_ALPHA 0x80000L
+-#define PNG_USER_TRANSFORM 0x100000L
+-#define PNG_RGB_TO_GRAY_ERR 0x200000L
+-#define PNG_RGB_TO_GRAY_WARN 0x400000L
+-#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
+-#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.4 */
+-#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
+-#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
+-#define PNG_SCALE_16_TO_8 0x4000000L /* Added to libpng-1.5.4 */
+- /* 0x8000000L unused */
+- /* 0x10000000L unused */
+- /* 0x20000000L unused */
+- /* 0x40000000L unused */
+-
++#define PNG_FILLER 0x8000
++#define PNG_PACKSWAP 0x10000
++#define PNG_SWAP_ALPHA 0x20000
++#define PNG_STRIP_ALPHA 0x40000
++#define PNG_INVERT_ALPHA 0x80000
++#define PNG_USER_TRANSFORM 0x100000
++#define PNG_RGB_TO_GRAY_ERR 0x200000
++#define PNG_RGB_TO_GRAY_WARN 0x400000
++#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
++#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
++#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
++#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
++#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
++ /* 0x8000000 unused */
++ /* 0x10000000 unused */
++ /* 0x20000000 unused */
++ /* 0x40000000 unused */
+ /* Flags for png_create_struct */
+ #define PNG_STRUCT_PNG 0x0001
+ #define PNG_STRUCT_INFO 0x0002
+@@ -349,36 +627,36 @@
+
+ /* Flags for the png_ptr->flags rather than declaring a byte for each one */
+ #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
+-#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
+-#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
+-#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
+-#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
+-#define PNG_FLAG_ZLIB_FINISHED 0x0020
++#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
++ /* 0x0004 unused */
++#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */
++ /* 0x0010 unused */
++ /* 0x0020 unused */
+ #define PNG_FLAG_ROW_INIT 0x0040
+ #define PNG_FLAG_FILLER_AFTER 0x0080
+ #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
+ #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
+ #define PNG_FLAG_CRC_CRITICAL_USE 0x0400
+ #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
+-#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
+-#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
+-#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
+-#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
+-#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
+-#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
+-#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
+-#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
+-#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
+- /* 0x200000L unused */
+- /* 0x400000L unused */
+-#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
+-#define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000L /* 5 lines added */
+-#define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000L /* to libpng-1.5.4 */
+-#define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000L
+-#define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000L
+-#define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000L
+- /* 0x20000000L unused */
+- /* 0x40000000L unused */
++#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
++#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
++#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
++/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */
++/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */
++#define PNG_FLAG_LIBRARY_MISMATCH 0x20000
++#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000
++#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000
++#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */
++#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */
++#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */
++ /* 0x800000 unused */
++ /* 0x1000000 unused */
++ /* 0x2000000 unused */
++ /* 0x4000000 unused */
++ /* 0x8000000 unused */
++ /* 0x10000000 unused */
++ /* 0x20000000 unused */
++ /* 0x40000000 unused */
+
+ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
+ PNG_FLAG_CRC_ANCILLARY_NOWARN)
+@@ -389,24 +667,23 @@
+ #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
+ PNG_FLAG_CRC_CRITICAL_MASK)
+
+-/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
+- * can handle at once. This type need be no larger than 16 bits (so maximum of
+- * 65535), this define allows us to discover how big it is, but limited by the
+- * maximuum for png_size_t. The value can be overriden in a library build
+- * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
+- * lower value (e.g. 255 works). A lower value may help memory usage (slightly)
+- * and may even improve performance on some systems (and degrade it on others.)
+- */
+-#ifndef ZLIB_IO_MAX
+-# define ZLIB_IO_MAX ((uInt)-1)
+-#endif
+-
+ /* Save typing and make code easier to understand */
+
+ #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
+ abs((int)((c1).green) - (int)((c2).green)) + \
+ abs((int)((c1).blue) - (int)((c2).blue)))
+
++/* Added to libpng-1.6.0: scale a 16-bit value in the range 0..65535 to 0..255
++ * by dividing by 257 *with rounding*. This macro is exact for the given range.
++ * See the discourse in pngrtran.c png_do_scale_16_to_8. The values in the
++ * macro were established by experiment (modifying the added value). The macro
++ * has a second variant that takes a value already scaled by 255 and divides by
++ * 65535 - this has a maximum error of .502. Over the range 0..65535*65535 it
++ * only gives off-by-one errors and only for 0.5% (1 in 200) of the values.
++ */
++#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
++#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
++
+ /* Added to libpng-1.2.6 JB */
+ #define PNG_ROWBYTES(pixel_bits, width) \
+ ((pixel_bits) >= 8 ? \
+@@ -454,151 +731,314 @@
+ #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
+ #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
+ ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
+-#else
+-PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
+- png_const_charp text));
+ #endif
++/* else the corresponding function is defined below, inside the scope of the
++ * cplusplus test.
++ */
+ #endif
+
+-/* Constant strings for known chunk types. If you need to add a chunk,
+- * define the name here, and add an invocation of the macro wherever it's
+- * needed.
++/* Constants for known chunk types. If you need to add a chunk, define the name
++ * here. For historical reasons these constants have the form png_<name>; i.e.
++ * the prefix is lower case. Please use decimal values as the parameters to
++ * match the ISO PNG specification and to avoid relying on the C locale
++ * interpretation of character values.
++ *
++ * Prior to 1.5.6 these constants were strings, as of 1.5.6 png_uint_32 values
++ * are computed and a new macro (PNG_STRING_FROM_CHUNK) added to allow a string
++ * to be generated if required.
++ *
++ * PNG_32b correctly produces a value shifted by up to 24 bits, even on
++ * architectures where (int) is only 16 bits.
+ */
+-#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
+-#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
+-#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
+-#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
+-#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
+-#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
+-#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
+-#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
+-#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
+-#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
+-#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
+-#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
+-#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
+-#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
+-#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
+-#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
+-#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
+-#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}
+-#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
+-#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
+-#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
+-#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
++#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
++#define PNG_U32(b1,b2,b3,b4) \
++ (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
++
++/* Constants for known chunk types.
++ *
++ * MAINTAINERS: If you need to add a chunk, define the name here.
++ * For historical reasons these constants have the form png_<name>; i.e.
++ * the prefix is lower case. Please use decimal values as the parameters to
++ * match the ISO PNG specification and to avoid relying on the C locale
++ * interpretation of character values. Please keep the list sorted.
++ *
++ * Notice that PNG_U32 is used to define a 32-bit value for the 4 byte chunk
++ * type. In fact the specification does not express chunk types this way,
++ * however using a 32-bit value means that the chunk type can be read from the
++ * stream using exactly the same code as used for a 32-bit unsigned value and
++ * can be examined far more efficiently (using one arithmetic compare).
++ *
++ * Prior to 1.5.6 the chunk type constants were expressed as C strings. The
++ * libpng API still uses strings for 'unknown' chunks and a macro,
++ * PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
++ * that for portable code numeric values must still be used; the string "IHDR"
++ * is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
++ *
++ * In 1.7.0 the definitions will be made public in png.h to avoid having to
++ * duplicate the same definitions in application code.
++ */
++#define png_IDAT PNG_U32( 73, 68, 65, 84)
++#define png_IEND PNG_U32( 73, 69, 78, 68)
++#define png_IHDR PNG_U32( 73, 72, 68, 82)
++#define png_PLTE PNG_U32( 80, 76, 84, 69)
++#define png_bKGD PNG_U32( 98, 75, 71, 68)
++#define png_cHRM PNG_U32( 99, 72, 82, 77)
++#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
++#define png_gAMA PNG_U32(103, 65, 77, 65)
++#define png_gIFg PNG_U32(103, 73, 70, 103)
++#define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
++#define png_gIFx PNG_U32(103, 73, 70, 120)
++#define png_hIST PNG_U32(104, 73, 83, 84)
++#define png_iCCP PNG_U32(105, 67, 67, 80)
++#define png_iTXt PNG_U32(105, 84, 88, 116)
++#define png_oFFs PNG_U32(111, 70, 70, 115)
++#define png_pCAL PNG_U32(112, 67, 65, 76)
++#define png_pHYs PNG_U32(112, 72, 89, 115)
++#define png_sBIT PNG_U32(115, 66, 73, 84)
++#define png_sCAL PNG_U32(115, 67, 65, 76)
++#define png_sPLT PNG_U32(115, 80, 76, 84)
++#define png_sRGB PNG_U32(115, 82, 71, 66)
++#define png_sTER PNG_U32(115, 84, 69, 82)
++#define png_tEXt PNG_U32(116, 69, 88, 116)
++#define png_tIME PNG_U32(116, 73, 77, 69)
++#define png_tRNS PNG_U32(116, 82, 78, 83)
++#define png_zTXt PNG_U32(122, 84, 88, 116)
++
++/* The following will work on (signed char*) strings, whereas the get_uint_32
++ * macro will fail on top-bit-set values because of the sign extension.
++ */
++#define PNG_CHUNK_FROM_STRING(s)\
++ PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
++
++/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
++ * signed and the argument is a (char[]) This macro will fail miserably on
++ * systems where (char) is more than 8 bits.
++ */
++#define PNG_STRING_FROM_CHUNK(s,c)\
++ (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\
++ ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c)))
++
++/* Do the same but terminate with a null character. */
++#define PNG_CSTRING_FROM_CHUNK(s,c)\
++ (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0)
++
++/* Test on flag values as defined in the spec (section 5.4): */
++#define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29))
++#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
++#define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
++#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
++#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
+
+ /* Gamma values (new at libpng-1.5.4): */
+ #define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */
+ #define PNG_GAMMA_MAC_INVERSE 65909
+ #define PNG_GAMMA_sRGB_INVERSE 45455
+
++/* Almost everything below is C specific; the #defines above can be used in
++ * non-C code (so long as it is C-preprocessed) the rest of this stuff cannot.
++ */
++#ifndef PNG_VERSION_INFO_ONLY
++
++#include "pngstruct.h"
++#include "pnginfo.h"
++
++/* Validate the include paths - the include path used to generate pnglibconf.h
++ * must match that used in the build, or we must be using pnglibconf.h.prebuilt:
++ */
++#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
++# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
++ "-I (include path) error: see the notes in pngpriv.h"
++ /* This means that when pnglibconf.h was built the copy of zlib.h that it
++ * used is not the same as the one being used here. Because the build of
++ * libpng makes decisions to use inflateInit2 and inflateReset2 based on the
++ * zlib version number and because this affects handling of certain broken
++ * PNG files the -I directives must match.
++ *
++ * The most likely explanation is that you passed a -I in CFLAGS. This will
++ * not work; all the preprocessor directories and in particular all the -I
++ * directives must be in CPPFLAGS.
++ */
++#endif
++
++/* This is used for 16 bit gamma tables -- only the top level pointers are
++ * const; this could be changed:
++ */
++typedef const png_uint_16p * png_const_uint_16pp;
++
++/* Added to libpng-1.5.7: sRGB conversion tables */
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
++PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
++ /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
++ * 0..65535. This table gives the closest 16-bit answers (no errors).
++ */
++#endif
++
++PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
++PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
++
++#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
++ ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
++ /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
++ * encoded value with maximum error 0.646365. Note that the input is not a
++ * 16-bit value; it has been multiplied by 255! */
++#endif /* SIMPLIFIED_READ/WRITE */
++
+
+ /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
+ #ifdef __cplusplus
+ extern "C" {
+ #endif /* __cplusplus */
+
+-/* These functions are used internally in the code. They generally
+- * shouldn't be used unless you are writing code to add or replace some
+- * functionality in libpng. More information about most functions can
+- * be found in the files where the functions are located.
++/* Internal functions; these are not exported from a DLL however because they
++ * are used within several of the C source files they have to be C extern.
++ *
++ * All of these functions must be declared with PNG_INTERNAL_FUNCTION.
+ */
+
++/* Zlib support */
++#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
++PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret),
++ PNG_EMPTY);
++ /* Used by the zlib handling functions to ensure that z_stream::msg is always
++ * set before they return.
++ */
++
++#ifdef PNG_WRITE_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
++ png_compression_bufferp *list),PNG_EMPTY);
++ /* Free the buffer list used by the compressed write code. */
++#endif
++
++#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
++ !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
++ (defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
++ defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
++ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
++ (defined(PNG_sCAL_SUPPORTED) && \
++ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
++PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr,
++ double fp, png_const_charp text),PNG_EMPTY);
++#endif
++
+ /* Check the user version string for compatibility, returns false if the version
+ * numbers aren't compatible.
+ */
+-PNG_EXTERN int png_user_version_check(png_structp png_ptr,
+- png_const_charp user_png_ver);
++PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
++ png_const_charp user_png_ver),PNG_EMPTY);
+
+-/* Allocate memory for an internal libpng struct */
+-PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct,PNGARG((int type)),
++/* Internal base allocator - no messages, NULL on failure to allocate. This
++ * does, however, call the application provided allocator and that could call
++ * png_error (although that would be a bug in the application implementation.)
++ */
++PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
++ png_alloc_size_t size),PNG_ALLOCATED);
++
++#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
++ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
++/* Internal array allocator, outputs no error or warning messages on failure,
++ * just returns NULL.
++ */
++PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr,
++ int nelements, size_t element_size),PNG_ALLOCATED);
++
++/* The same but an existing array is extended by add_elements. This function
++ * also memsets the new elements to 0 and copies the old elements. The old
++ * array is not freed or altered.
++ */
++PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr,
++ png_const_voidp array, int old_elements, int add_elements,
++ size_t element_size),PNG_ALLOCATED);
++#endif /* text, sPLT or unknown chunks */
++
++/* Magic to create a struct when there is no struct to call the user supplied
++ * memory allocators. Because error handling has not been set up the memory
++ * handlers can't safely call png_error, but this is an obscure and undocumented
++ * restriction so libpng has to assume that the 'free' handler, at least, might
++ * call png_error.
++ */
++PNG_INTERNAL_FUNCTION(png_structp,png_create_png_struct,
++ (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
++ png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn,
++ png_free_ptr free_fn),PNG_ALLOCATED);
++
++/* Free memory from internal libpng struct */
++PNG_INTERNAL_FUNCTION(void,png_destroy_png_struct,(png_structrp png_ptr),
++ PNG_EMPTY);
++
++/* Free an allocated jmp_buf (always succeeds) */
++PNG_INTERNAL_FUNCTION(void,png_free_jmpbuf,(png_structrp png_ptr),PNG_EMPTY);
++
++/* Function to allocate memory for zlib. PNGAPI is disallowed. */
++PNG_INTERNAL_FUNCTION(voidpf,png_zalloc,(voidpf png_ptr, uInt items, uInt size),
+ PNG_ALLOCATED);
+
+-/* Free memory from internal libpng struct */
+-PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
+-
+-PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2,
+- PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)),
+- PNG_ALLOCATED);
+-PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
+- png_free_ptr free_fn, png_voidp mem_ptr));
+-
+-/* Free any memory that info_ptr points to and reset struct. */
+-PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-
+-/* Function to allocate memory for zlib. PNGAPI is disallowed. */
+-PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items,
+- uInt size)),PNG_ALLOCATED);
+-
+ /* Function to free memory for zlib. PNGAPI is disallowed. */
+-PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
++PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
+
+ /* Next four functions are used internally as callbacks. PNGCBAPI is required
+ * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to
+ * PNGCBAPI at 1.5.0
+ */
+
+-PNG_EXTERN void PNGCBAPI png_default_read_data PNGARG((png_structp png_ptr,
+- png_bytep data, png_size_t length));
++PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
++ png_bytep data, png_size_t length),PNG_EMPTY);
+
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+-PNG_EXTERN void PNGCBAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
+- png_bytep buffer, png_size_t length));
++PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
++ png_bytep buffer, png_size_t length),PNG_EMPTY);
+ #endif
+
+-PNG_EXTERN void PNGCBAPI png_default_write_data PNGARG((png_structp png_ptr,
+- png_bytep data, png_size_t length));
++PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
++ png_bytep data, png_size_t length),PNG_EMPTY);
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ # ifdef PNG_STDIO_SUPPORTED
+-PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_flush,(png_structp png_ptr),
++ PNG_EMPTY);
+ # endif
+ #endif
+
+ /* Reset the CRC variable */
+-PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
+
+ /* Write the "data" buffer to whatever output you are using */
+-PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr,
+- png_const_bytep data, png_size_t length));
++PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
++ png_const_bytep data, png_size_t length),PNG_EMPTY);
+
+ /* Read and check the PNG file signature */
+-PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
+
+ /* Read the chunk header (length + type name) */
+-PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
++ PNG_EMPTY);
+
+ /* Read data from whatever input you are using into the "data" buffer */
+-PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
+- png_size_t length));
++PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
++ png_size_t length),PNG_EMPTY);
+
+ /* Read bytes into buf, and update png_ptr->crc */
+-PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
+- png_size_t length));
+-
+-/* Decompress data in a chunk that uses compression */
+-#if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED)
+-PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
+- int comp_type, png_size_t chunklength, png_size_t prefix_length,
+- png_size_t *data_length));
+-#endif
++PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
++ png_uint_32 length),PNG_EMPTY);
+
+ /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
+-PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
++PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr,
++ png_uint_32 skip),PNG_EMPTY);
+
+ /* Read the CRC from the file and compare it to the libpng calculated CRC */
+-PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
+
+ /* Calculate the CRC over a section of data. Note that we are only
+ * passing a maximum of 64K on systems that have this as a memory limit,
+ * since this is the maximum buffer size we can specify.
+ */
+-PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr,
+- png_const_bytep ptr, png_size_t length));
++PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
++ png_const_bytep ptr, png_size_t length),PNG_EMPTY);
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+-PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
+ #endif
+
+ /* Write various chunks */
+@@ -606,317 +1046,256 @@
+ /* Write the IHDR chunk, and update the png_struct with the necessary
+ * information.
+ */
+-PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
+- png_uint_32 height,
+- int bit_depth, int color_type, int compression_method, int filter_method,
+- int interlace_method));
++PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr,
++ png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
++ int compression_method, int filter_method, int interlace_method),PNG_EMPTY);
+
+-PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr,
+- png_const_colorp palette, png_uint_32 num_pal));
++PNG_INTERNAL_FUNCTION(void,png_write_PLTE,(png_structrp png_ptr,
++ png_const_colorp palette, png_uint_32 num_pal),PNG_EMPTY);
+
+-PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
+- png_size_t length));
++PNG_INTERNAL_FUNCTION(void,png_compress_IDAT,(png_structrp png_ptr,
++ png_const_bytep row_data, png_alloc_size_t row_data_length, int flush),
++ PNG_EMPTY);
+
+-PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY);
+
+ #ifdef PNG_WRITE_gAMA_SUPPORTED
+-# ifdef PNG_FLOATING_POINT_SUPPORTED
+-PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
+-# endif
+-# ifdef PNG_FIXED_POINT_SUPPORTED
+-PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
+- png_fixed_point file_gamma));
+-# endif
++PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr,
++ png_fixed_point file_gamma),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_sBIT_SUPPORTED
+-PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr,
+- png_const_color_8p sbit, int color_type));
++PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
++ png_const_color_8p sbit, int color_type),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_cHRM_SUPPORTED
+-# ifdef PNG_FLOATING_POINT_SUPPORTED
+-PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
+- double white_x, double white_y,
+- double red_x, double red_y, double green_x, double green_y,
+- double blue_x, double blue_y));
+-# endif
+-PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
+- png_fixed_point int_white_x, png_fixed_point int_white_y,
+- png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+- int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+- png_fixed_point int_blue_y));
++PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
++ const png_xy *xy), PNG_EMPTY);
++ /* The xy value must have been previously validated */
+ #endif
+
+ #ifdef PNG_WRITE_sRGB_SUPPORTED
+-PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
+- int intent));
++PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
++ int intent),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_iCCP_SUPPORTED
+-PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
+- png_const_charp name, int compression_type,
+- png_const_charp profile, int proflen));
+- /* Note to maintainer: profile should be png_bytep */
++PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
++ png_const_charp name, png_const_bytep profile), PNG_EMPTY);
++ /* The profile must have been previously validated for correctness, the
++ * length comes from the first four bytes. Only the base, deflate,
++ * compression is supported.
++ */
+ #endif
+
+ #ifdef PNG_WRITE_sPLT_SUPPORTED
+-PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
+- png_const_sPLT_tp palette));
++PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr,
++ png_const_sPLT_tp palette),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_tRNS_SUPPORTED
+-PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr,
+ png_const_bytep trans, png_const_color_16p values, int number,
+- int color_type));
++ int color_type),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_bKGD_SUPPORTED
+-PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
+- png_const_color_16p values, int color_type));
++PNG_INTERNAL_FUNCTION(void,png_write_bKGD,(png_structrp png_ptr,
++ png_const_color_16p values, int color_type),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_hIST_SUPPORTED
+-PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr,
+- png_const_uint_16p hist, int num_hist));
++PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
++ png_const_uint_16p hist, int num_hist),PNG_EMPTY);
+ #endif
+
+ /* Chunks that have keywords */
+-#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
+- defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
+-PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
+- png_const_charp key, png_charpp new_key));
+-#endif
+-
+ #ifdef PNG_WRITE_tEXt_SUPPORTED
+-PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key,
+- png_const_charp text, png_size_t text_len));
++PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
++ png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
+-PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_const_charp key,
+- png_const_charp text, png_size_t text_len, int compression));
++PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
++ key, png_const_charp text, int compression),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_iTXt_SUPPORTED
+-PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr,
+ int compression, png_const_charp key, png_const_charp lang,
+- png_const_charp lang_key, png_const_charp text));
++ png_const_charp lang_key, png_const_charp text),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
+-PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_const_textp text_ptr, int num_text));
++PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_textp text_ptr, int num_text),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_oFFs_SUPPORTED
+-PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
+- png_int_32 x_offset, png_int_32 y_offset, int unit_type));
++PNG_INTERNAL_FUNCTION(void,png_write_oFFs,(png_structrp png_ptr,
++ png_int_32 x_offset, png_int_32 y_offset, int unit_type),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_pCAL_SUPPORTED
+-PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
+- png_int_32 X0, png_int_32 X1, int type, int nparams,
+- png_const_charp units, png_charpp params));
++PNG_INTERNAL_FUNCTION(void,png_write_pCAL,(png_structrp png_ptr,
++ png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
++ png_const_charp units, png_charpp params),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_pHYs_SUPPORTED
+-PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_write_pHYs,(png_structrp png_ptr,
+ png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
+- int unit_type));
++ int unit_type),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_tIME_SUPPORTED
+-PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
+- png_const_timep mod_time));
++PNG_INTERNAL_FUNCTION(void,png_write_tIME,(png_structrp png_ptr,
++ png_const_timep mod_time),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_WRITE_sCAL_SUPPORTED
+-PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
+- int unit, png_const_charp width, png_const_charp height));
++PNG_INTERNAL_FUNCTION(void,png_write_sCAL_s,(png_structrp png_ptr,
++ int unit, png_const_charp width, png_const_charp height),PNG_EMPTY);
+ #endif
+
+ /* Called when finished processing a row of data */
+-PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_write_finish_row,(png_structrp png_ptr),
++ PNG_EMPTY);
+
+ /* Internal use only. Called before first row of data */
+-PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr),
++ PNG_EMPTY);
+
+-/* Combine a row of data, dealing with alpha, etc. if requested */
+-PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
+- int mask));
++/* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an
++ * array of png_ptr->width pixels. If the image is not interlaced or this
++ * is the final pass this just does a memcpy, otherwise the "display" flag
++ * is used to determine whether to copy pixels that are not in the current pass.
++ *
++ * Because 'png_do_read_interlace' (below) replicates pixels this allows this
++ * function to achieve the documented 'blocky' appearance during interlaced read
++ * if display is 1 and the 'sparkle' appearance, where existing pixels in 'row'
++ * are not changed if they are not in the current pass, when display is 0.
++ *
++ * 'display' must be 0 or 1, otherwise the memcpy will be done regardless.
++ *
++ * The API always reads from the png_struct row buffer and always assumes that
++ * it is full width (png_do_read_interlace has already been called.)
++ *
++ * This function is only ever used to write to row buffers provided by the
++ * caller of the relevant libpng API and the row must have already been
++ * transformed by the read transformations.
++ *
++ * The PNG_USE_COMPILE_TIME_MASKS option causes generation of pre-computed
++ * bitmasks for use within the code, otherwise runtime generated masks are used.
++ * The default is compile time masks.
++ */
++#ifndef PNG_USE_COMPILE_TIME_MASKS
++# define PNG_USE_COMPILE_TIME_MASKS 1
++#endif
++PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr,
++ png_bytep row, int display),PNG_EMPTY);
+
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+-/* Expand an interlaced row */
+-/* OLD pre-1.0.9 interface:
+-PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
+- png_bytep row, int pass, png_uint_32 transformations));
++/* Expand an interlaced row: the 'row_info' describes the pass data that has
++ * been read in and must correspond to the pixels in 'row', the pixels are
++ * expanded (moved apart) in 'row' to match the final layout, when doing this
++ * the pixels are *replicated* to the intervening space. This is essential for
++ * the correct operation of png_combine_row, above.
+ */
+-PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_do_read_interlace,(png_row_infop row_info,
++ png_bytep row, int pass, png_uint_32 transformations),PNG_EMPTY);
+ #endif
+
+ /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* Grab pixels out of a row for an interlaced pass */
+-PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
+- png_bytep row, int pass));
++PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info,
++ png_bytep row, int pass),PNG_EMPTY);
+ #endif
+
+-/* Unfilter a row */
+-PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
+- png_row_infop row_info, png_bytep row, png_const_bytep prev_row,
+- int filter));
++/* Unfilter a row: check the filter value before calling this, there is no point
++ * calling it for PNG_FILTER_VALUE_NONE.
++ */
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
++
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
++ png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+
+ /* Choose the best filter to use and filter the row data */
+-PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
+- png_row_infop row_info));
++PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
++ png_row_infop row_info),PNG_EMPTY);
+
+-/* Finish a row while reading, dealing with interlacing passes, etc. */
+-PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
++#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
++ png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
++ /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
++ * is NULL the function checks, instead, for the end of the stream. In this
++ * case a benign error will be issued if the stream end is not found or if
++ * extra data has to be consumed.
++ */
++PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
++ PNG_EMPTY);
++ /* This cleans up when the IDAT LZ stream does not end when the last image
++ * byte is read; there is still some pending input.
++ */
++
++PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
++ PNG_EMPTY);
++ /* Finish a row while reading, dealing with interlacing passes, etc. */
++#endif /* SEQUENTIAL_READ */
+
+ /* Initialize the row buffers, etc. */
+-PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
+
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+ /* Optional call to update the users info structure */
+-PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
+ #endif
+
+-/* These are the functions that do the transformations */
+-#ifdef PNG_READ_FILLER_SUPPORTED
+-PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
+- png_bytep row, png_uint_32 filler, png_uint_32 flags));
+-#endif
+-
+-#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+-PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+-PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+-PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+-PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
++/* Shared transform functions, defined in pngtran.c */
+ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
+ defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+-PNG_EXTERN void png_do_strip_channel PNGARG((png_row_infop row_info,
+- png_bytep row, int at_start));
++PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
++ png_bytep row, int at_start),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_16BIT_SUPPORTED
+ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
+-PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info,
+- png_bytep row));
++PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info,
++ png_bytep row),PNG_EMPTY);
+ #endif
+ #endif
+
+ #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
+ defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+-PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+-PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr,
+- png_row_infop row_info, png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+-PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_PACK_SUPPORTED
+-PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_SHIFT_SUPPORTED
+-PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info,
+- png_bytep row, png_const_color_8p sig_bits));
++PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
++ png_bytep row),PNG_EMPTY);
+ #endif
+
+ #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
+-PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+-PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+-PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_READ_QUANTIZE_SUPPORTED
+-PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
+- png_bytep row, png_const_bytep palette_lookup,
+- png_const_bytep quantize_lookup));
+-
+-# ifdef PNG_CORRECT_PALETTE_SUPPORTED
+-PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
+- png_colorp palette, int num_palette));
+-# endif
++PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
++ png_bytep row),PNG_EMPTY);
+ #endif
+
+ #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
+-PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info,
+- png_bytep row));
+-#endif
+-
+-#ifdef PNG_WRITE_PACK_SUPPORTED
+-PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
+- png_bytep row, png_uint_32 bit_depth));
+-#endif
+-
+-#ifdef PNG_WRITE_SHIFT_SUPPORTED
+-PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info,
+- png_bytep row, png_const_color_8p bit_depth));
+-#endif
+-
+-#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+- defined(PNG_READ_ALPHA_MODE_SUPPORTED)
+-PNG_EXTERN void png_do_compose PNGARG((png_row_infop row_info,
+- png_bytep row, png_structp png_ptr));
+-#endif
+-
+-#ifdef PNG_READ_GAMMA_SUPPORTED
+-PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info,
+- png_bytep row, png_structp png_ptr));
+-#endif
+-
+-#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+-PNG_EXTERN void png_do_encode_alpha PNGARG((png_row_infop row_info,
+- png_bytep row, png_structp png_ptr));
+-#endif
+-
+-#ifdef PNG_READ_EXPAND_SUPPORTED
+-PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
+- png_bytep row, png_const_colorp palette, png_const_bytep trans,
+- int num_trans));
+-PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
+- png_bytep row, png_const_color_16p trans_color));
+-#endif
+-
+-#ifdef PNG_READ_EXPAND_16_SUPPORTED
+-PNG_EXTERN void png_do_expand_16 PNGARG((png_row_infop row_info,
+- png_bytep row));
++PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
++ png_bytep row),PNG_EMPTY);
+ #endif
+
+ /* The following decodes the appropriate chunks, and does error correction,
+@@ -924,208 +1303,283 @@
+ */
+
+ /* Decode the IHDR chunk */
+-PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
+-PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
+-PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+
+ #ifdef PNG_READ_bKGD_SUPPORTED
+-PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_bKGD,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_cHRM_SUPPORTED
+-PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_gAMA_SUPPORTED
+-PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_hIST_SUPPORTED
+-PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_iCCP_SUPPORTED
+-PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
+-#endif /* PNG_READ_iCCP_SUPPORTED */
++PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++#endif /* READ_iCCP */
+
+ #ifdef PNG_READ_iTXt_SUPPORTED
+-PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_oFFs_SUPPORTED
+-PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_pCAL_SUPPORTED
+-PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_pCAL,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_pHYs_SUPPORTED
+-PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_pHYs,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_sBIT_SUPPORTED
+-PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_sBIT,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_sCAL_SUPPORTED
+-PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_sPLT_SUPPORTED
+-PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
+-#endif /* PNG_READ_sPLT_SUPPORTED */
++PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++#endif /* READ_sPLT */
+
+ #ifdef PNG_READ_sRGB_SUPPORTED
+-PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_tEXt_SUPPORTED
+-PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_tIME_SUPPORTED
+-PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_tRNS_SUPPORTED
+-PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_zTXt_SUPPORTED
+-PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+- png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+ #endif
+
+-PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_uint_32 length));
++PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
++ png_uint_32 chunk_name),PNG_EMPTY);
+
+-PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
+- png_const_bytep chunk_name));
++PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
++ /* This is the function that gets called for unknown chunks. The 'keep'
++ * argument is either non-zero for a known chunk that has been set to be
++ * handled as unknown or zero for an unknown chunk. By default the function
++ * just skips the chunk or errors out if it is critical.
++ */
++
++#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
++ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
++PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
++ (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
++ /* Exactly as the API png_handle_as_unknown() except that the argument is a
++ * 32-bit chunk name, not a string.
++ */
++#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
+
+ /* Handle the transformations for reading and writing */
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+-PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr,
++ png_row_infop row_info),PNG_EMPTY);
+ #endif
+ #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
+-PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr,
++ png_row_infop row_info),PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+-PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr),
++ PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+-PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
+-PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
+- png_uint_32 length));
+-PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
+-PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
+-PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
+- png_bytep buffer, png_size_t buffer_length));
+-PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
+-PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
+- png_bytep buffer, png_size_t buffer_length));
+-PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
+-PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_uint_32 length));
+-PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
+-PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
+-PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
++PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr),
++ PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
++ PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
++ png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
++ png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
++ PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_have_row,(png_structrp png_ptr,
++ png_bytep row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_end,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_push_finish_row,(png_structrp png_ptr),
++ PNG_EMPTY);
+ # ifdef PNG_READ_tEXt_SUPPORTED
+-PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_uint_32 length));
+-PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_push_handle_tEXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_tEXt,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
+ # endif
+ # ifdef PNG_READ_zTXt_SUPPORTED
+-PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_uint_32 length));
+-PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_push_handle_zTXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_zTXt,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
+ # endif
+ # ifdef PNG_READ_iTXt_SUPPORTED
+-PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_uint_32 length));
+-PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
+- png_infop info_ptr));
++PNG_INTERNAL_FUNCTION(void,png_push_handle_iTXt,(png_structrp png_ptr,
++ png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
++ png_inforp info_ptr),PNG_EMPTY);
+ # endif
+
+-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PROGRESSIVE_READ */
+
+-#ifdef PNG_MNG_FEATURES_SUPPORTED
+-PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
+- png_bytep row));
+-PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
+- png_bytep row));
++/* Added at libpng version 1.6.0 */
++#ifdef PNG_GAMMA_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY);
++ /* Set the colorspace gamma with a value provided by the application or by
++ * the gAMA chunk on read. The value will override anything set by an ICC
++ * profile.
++ */
++
++PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
++ png_inforp info_ptr), PNG_EMPTY);
++ /* Synchronize the info 'valid' flags with the colorspace */
++
++PNG_INTERNAL_FUNCTION(void,png_colorspace_sync,(png_const_structrp png_ptr,
++ png_inforp info_ptr), PNG_EMPTY);
++ /* Copy the png_struct colorspace to the info_struct and call the above to
++ * synchronize the flags. Checks for NULL info_ptr and does nothing.
++ */
+ #endif
+
+ /* Added at libpng version 1.4.0 */
+-#ifdef PNG_CHECK_cHRM_SUPPORTED
+-PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
+- png_fixed_point int_white_x, png_fixed_point int_white_y,
+- png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+- int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+- png_fixed_point int_blue_y));
++#ifdef PNG_COLORSPACE_SUPPORTED
++/* These internal functions are for maintaining the colorspace structure within
++ * a png_info or png_struct (or, indeed, both).
++ */
++PNG_INTERNAL_FUNCTION(int,png_colorspace_set_chromaticities,
++ (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_xy *xy,
++ int preferred), PNG_EMPTY);
++
++PNG_INTERNAL_FUNCTION(int,png_colorspace_set_endpoints,
++ (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_XYZ *XYZ,
++ int preferred), PNG_EMPTY);
++
++#ifdef PNG_sRGB_SUPPORTED
++PNG_INTERNAL_FUNCTION(int,png_colorspace_set_sRGB,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, int intent), PNG_EMPTY);
++ /* This does set the colorspace gAMA and cHRM values too, but doesn't set the
++ * flags to write them, if it returns false there was a problem and an error
++ * message has already been output (but the colorspace may still need to be
++ * synced to record the invalid flag).
++ */
++#endif /* sRGB */
++
++#ifdef PNG_iCCP_SUPPORTED
++PNG_INTERNAL_FUNCTION(int,png_colorspace_set_ICC,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_const_charp name,
++ png_uint_32 profile_length, png_const_bytep profile, int color_type),
++ PNG_EMPTY);
++ /* The 'name' is used for information only */
++
++/* Routines for checking parts of an ICC profile. */
++PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_const_charp name,
++ png_uint_32 profile_length), PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_const_charp name,
++ png_uint_32 profile_length,
++ png_const_bytep profile /* first 132 bytes only */, int color_type),
++ PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr,
++ png_colorspacerp colorspace, png_const_charp name,
++ png_uint_32 profile_length,
++ png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY);
++#ifdef PNG_sRGB_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_icc_set_sRGB,(
++ png_const_structrp png_ptr, png_colorspacerp colorspace,
++ png_const_bytep profile, uLong adler), PNG_EMPTY);
++ /* 'adler' is the Adler32 checksum of the uncompressed profile data. It may
++ * be zero to indicate that it is not available. It is used, if provided,
++ * as a fast check on the profile when checking to see if it is sRGB.
++ */
++#endif
++#endif /* iCCP */
++
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_colorspace_set_rgb_coefficients,
++ (png_structrp png_ptr), PNG_EMPTY);
++ /* Set the rgb_to_gray coefficients from the colorspace Y values */
++#endif /* READ_RGB_TO_GRAY */
++#endif /* COLORSPACE */
++
++/* Added at libpng version 1.4.0 */
++PNG_INTERNAL_FUNCTION(void,png_check_IHDR,(png_const_structrp png_ptr,
++ png_uint_32 width, png_uint_32 height, int bit_depth,
++ int color_type, int interlace_type, int compression_type,
++ int filter_type),PNG_EMPTY);
++
++/* Added at libpng version 1.5.10 */
++#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
++ defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
++PNG_INTERNAL_FUNCTION(void,png_do_check_palette_indexes,
++ (png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY);
+ #endif
+
+-#ifdef PNG_CHECK_cHRM_SUPPORTED
+-/* Added at libpng version 1.2.34 and 1.4.0 */
+-/* Currently only used by png_check_cHRM_fixed */
+-PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
+- unsigned long *hi_product, unsigned long *lo_product));
+-#endif
+-
+-/* Added at libpng version 1.4.0 */
+-PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
+- png_uint_32 width, png_uint_32 height, int bit_depth,
+- int color_type, int interlace_type, int compression_type,
+- int filter_type));
+-
+-/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
+-PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr,
+- png_infop info_ptr, png_infop end_info_ptr));
+-
+-/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
+-PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
+-
+-#ifdef USE_FAR_KEYWORD /* memory model conversion function */
+-PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr,
+- int check));
+-#endif /* USE_FAR_KEYWORD */
+-
+ #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
+-PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr,
++PNG_INTERNAL_FUNCTION(void,png_fixed_error,(png_const_structrp png_ptr,
+ png_const_charp name),PNG_NORETURN);
+ #endif
+
+@@ -1133,8 +1587,8 @@
+ * the end. Always leaves the buffer nul terminated. Never errors out (and
+ * there is no error code.)
+ */
+-PNG_EXTERN size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos,
+- png_const_charp string);
++PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize,
++ size_t pos, png_const_charp string),PNG_EMPTY);
+
+ /* Various internal functions to handle formatted warning messages, currently
+ * only implemented for warnings.
+@@ -1145,8 +1599,8 @@
+ * Returns the pointer to the start of the formatted string. This utility only
+ * does unsigned values.
+ */
+-PNG_EXTERN png_charp png_format_number(png_const_charp start, png_charp end,
+- int format, png_alloc_size_t number);
++PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start,
++ png_charp end, int format, png_alloc_size_t number),PNG_EMPTY);
+
+ /* Convenience macro that takes an array: */
+ #define PNG_FORMAT_NUMBER(buffer,format,number) \
+@@ -1170,7 +1624,7 @@
+ #ifdef PNG_WARNINGS_SUPPORTED
+ /* New defines and members adding in libpng-1.5.4 */
+ # define PNG_WARNING_PARAMETER_SIZE 32
+-# define PNG_WARNING_PARAMETER_COUNT 8
++# define PNG_WARNING_PARAMETER_COUNT 8 /* Maximum 9; see pngerror.c */
+
+ /* An l-value of this type has to be passed to the APIs below to cache the
+ * values of the parameters to a formatted warning message.
+@@ -1178,48 +1632,97 @@
+ typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][
+ PNG_WARNING_PARAMETER_SIZE];
+
+-PNG_EXTERN void png_warning_parameter(png_warning_parameters p, int number,
+- png_const_charp string);
+- /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters,
+- * including the trailing '\0'.
+- */
+-PNG_EXTERN void png_warning_parameter_unsigned(png_warning_parameters p,
+- int number, int format, png_alloc_size_t value);
+- /* Use png_alloc_size_t because it is an unsigned type as big as any we
+- * need to output. Use the following for a signed value.
+- */
+-PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p,
+- int number, int format, png_int_32 value);
++PNG_INTERNAL_FUNCTION(void,png_warning_parameter,(png_warning_parameters p,
++ int number, png_const_charp string),PNG_EMPTY);
++ /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters,
++ * including the trailing '\0'.
++ */
++PNG_INTERNAL_FUNCTION(void,png_warning_parameter_unsigned,
++ (png_warning_parameters p, int number, int format, png_alloc_size_t value),
++ PNG_EMPTY);
++ /* Use png_alloc_size_t because it is an unsigned type as big as any we
++ * need to output. Use the following for a signed value.
++ */
++PNG_INTERNAL_FUNCTION(void,png_warning_parameter_signed,
++ (png_warning_parameters p, int number, int format, png_int_32 value),
++ PNG_EMPTY);
+
+-PNG_EXTERN void png_formatted_warning(png_structp png_ptr,
+- png_warning_parameters p, png_const_charp message);
+- /* 'message' follows the X/Open approach of using @1, @2 to insert
+- * parameters previously supplied using the above functions. Errors in
+- * specifying the paramters will simple result in garbage substitutions.
+- */
++PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr,
++ png_warning_parameters p, png_const_charp message),PNG_EMPTY);
++ /* 'message' follows the X/Open approach of using @1, @2 to insert
++ * parameters previously supplied using the above functions. Errors in
++ * specifying the parameters will simply result in garbage substitutions.
++ */
+ #endif
+
++#ifdef PNG_BENIGN_ERRORS_SUPPORTED
++/* Application errors (new in 1.6); use these functions (declared below) for
++ * errors in the parameters or order of API function calls on read. The
++ * 'warning' should be used for an error that can be handled completely; the
++ * 'error' for one which can be handled safely but which may lose application
++ * information or settings.
++ *
++ * By default these both result in a png_error call prior to release, while in a
++ * released version the 'warning' is just a warning. However if the application
++ * explicitly disables benign errors (explicitly permitting the code to lose
++ * information) they both turn into warnings.
++ *
++ * If benign errors aren't supported they end up as the corresponding base call
++ * (png_warning or png_error.)
++ */
++PNG_INTERNAL_FUNCTION(void,png_app_warning,(png_const_structrp png_ptr,
++ png_const_charp message),PNG_EMPTY);
++ /* The application provided invalid parameters to an API function or called
++ * an API function at the wrong time, libpng can completely recover.
++ */
++
++PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr,
++ png_const_charp message),PNG_EMPTY);
++ /* As above but libpng will ignore the call, or attempt some other partial
++ * recovery from the error.
++ */
++#else
++# define png_app_warning(pp,s) png_warning(pp,s)
++# define png_app_error(pp,s) png_error(pp,s)
++#endif
++
++PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
++ png_const_charp message, int error),PNG_EMPTY);
++ /* Report a recoverable issue in chunk data. On read this is used to report
++ * a problem found while reading a particular chunk and the
++ * png_chunk_benign_error or png_chunk_warning function is used as
++ * appropriate. On write this is used to report an error that comes from
++ * data set via an application call to a png_set_ API and png_app_error or
++ * png_app_warning is used as appropriate.
++ *
++ * The 'error' parameter must have one of the following values:
++ */
++#define PNG_CHUNK_WARNING 0 /* never an error */
++#define PNG_CHUNK_WRITE_ERROR 1 /* an error only on write */
++#define PNG_CHUNK_ERROR 2 /* always an error */
++
+ /* ASCII to FP interfaces, currently only implemented if sCAL
+ * support is required.
+ */
+-#if defined(PNG_READ_sCAL_SUPPORTED)
++#if defined(PNG_sCAL_SUPPORTED)
+ /* MAX_DIGITS is actually the maximum number of characters in an sCAL
+ * width or height, derived from the precision (number of significant
+- * digits - a build time settable option) and assumpitions about the
++ * digits - a build time settable option) and assumptions about the
+ * maximum ridiculous exponent.
+ */
+ #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/)
+
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+-PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii,
+- png_size_t size, double fp, unsigned int precision));
++PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
++ png_charp ascii, png_size_t size, double fp, unsigned int precision),
++ PNG_EMPTY);
+ #endif /* FLOATING_POINT */
+
+ #ifdef PNG_FIXED_POINT_SUPPORTED
+-PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr,
+- png_charp ascii, png_size_t size, png_fixed_point fp));
++PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
++ png_charp ascii, png_size_t size, png_fixed_point fp),PNG_EMPTY);
+ #endif /* FIXED_POINT */
+-#endif /* READ_sCAL */
++#endif /* sCAL */
+
+ #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
+ /* An internal API to validate the format of a floating point number.
+@@ -1243,7 +1746,7 @@
+ * NOTE: The dangling E problem.
+ * There is a PNG valid floating point number in the following:
+ *
+- * PNG floating point numb1.ers are not greedy.
++ * PNG floating point numbers are not greedy.
+ *
+ * Working this out requires *TWO* character lookahead (because of the
+ * sign), the parser does not do this - it will fail at the 'r' - this
+@@ -1294,14 +1797,14 @@
+ #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
+ #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK)
+
+-/* The actual parser. This can be called repeatedly, it updates
++/* The actual parser. This can be called repeatedly. It updates
+ * the index into the string and the state variable (which must
+- * be initialzed to 0). It returns a result code, as above. There
++ * be initialized to 0). It returns a result code, as above. There
+ * is no point calling the parser any more if it fails to advance to
+ * the end of the string - it is stuck on an invalid character (or
+ * terminated by '\0').
+ *
+- * Note that the pointer will consume an E or even an E+ then leave
++ * Note that the pointer will consume an E or even an E+ and then leave
+ * a 'maybe' state even though a preceding integer.fraction is valid.
+ * The PNG_FP_WAS_VALID flag indicates that a preceding substring was
+ * a valid number. It's possible to recover from this by calling
+@@ -1309,8 +1812,8 @@
+ * that omits the last character (i.e. set the size to the index of
+ * the problem character.) This has not been tested within libpng.
+ */
+-PNG_EXTERN int png_check_fp_number PNGARG((png_const_charp string,
+- png_size_t size, int *statep, png_size_tp whereami));
++PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
++ png_size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
+
+ /* This is the same but it checks a complete string and returns true
+ * only if it just contains a floating point number. As of 1.5.4 this
+@@ -1318,11 +1821,11 @@
+ * it was valid (otherwise it returns 0.) This can be used for testing
+ * for negative or zero values using the sticky flag.
+ */
+-PNG_EXTERN int png_check_fp_string PNGARG((png_const_charp string,
+- png_size_t size));
++PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
++ png_size_t size),PNG_EMPTY);
+ #endif /* pCAL || sCAL */
+
+-#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
++#if defined(PNG_GAMMA_SUPPORTED) ||\
+ defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
+ /* Added at libpng version 1.5.0 */
+ /* This is a utility to provide a*times/div (rounded) and indicate
+@@ -1330,29 +1833,37 @@
+ * for overflow, true (1) if no overflow, in which case *res
+ * holds the result.
+ */
+-PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a,
+- png_int_32 multiplied_by, png_int_32 divided_by));
++PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a,
++ png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY);
+ #endif
+
+ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
+ /* Same deal, but issue a warning on overflow and return 0. */
+-PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr,
+- png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by));
++PNG_INTERNAL_FUNCTION(png_fixed_point,png_muldiv_warn,
++ (png_const_structrp png_ptr, png_fixed_point a, png_int_32 multiplied_by,
++ png_int_32 divided_by),PNG_EMPTY);
+ #endif
+
+-#ifdef PNG_READ_GAMMA_SUPPORTED
++#ifdef PNG_GAMMA_SUPPORTED
+ /* Calculate a reciprocal - used for gamma values. This returns
+- * 0 if the argument is 0 in order to maintain an undefined value,
++ * 0 if the argument is 0 in order to maintain an undefined value;
+ * there are no warnings.
+ */
+-PNG_EXTERN png_fixed_point png_reciprocal PNGARG((png_fixed_point a));
++PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
++ PNG_EMPTY);
+
++#ifdef PNG_READ_GAMMA_SUPPORTED
+ /* The same but gives a reciprocal of the product of two fixed point
+ * values. Accuracy is suitable for gamma calculations but this is
+- * not exact - use png_muldiv for that.
++ * not exact - use png_muldiv for that. Only required at present on read.
+ */
+-PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a,
+- png_fixed_point b));
++PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
++ png_fixed_point b),PNG_EMPTY);
++#endif
++
++/* Return true if the gamma value is significantly different from 1.0 */
++PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
++ PNG_EMPTY);
+ #endif
+
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+@@ -1363,19 +1874,93 @@
+ * While the input is an 'unsigned' value it must actually be the
+ * correct bit value - 0..255 or 0..65535 as required.
+ */
+-PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr,
+- unsigned int value, png_fixed_point gamma_value));
+-PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value));
+-PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value,
+- png_fixed_point gamma_value));
+-PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value,
+- png_fixed_point gamma_value));
+-PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
+- int bit_depth));
++PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_correct,(png_structrp png_ptr,
++ unsigned int value, png_fixed_point gamma_value),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_16bit_correct,(unsigned int value,
++ png_fixed_point gamma_value),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(png_byte,png_gamma_8bit_correct,(unsigned int value,
++ png_fixed_point gamma_value),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_destroy_gamma_table,(png_structrp png_ptr),
++ PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
++ int bit_depth),PNG_EMPTY);
+ #endif
+
+-/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
++/* SIMPLIFIED READ/WRITE SUPPORT */
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
++ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
++/* The internal structure that png_image::opaque points to. */
++typedef struct png_control
++{
++ png_structp png_ptr;
++ png_infop info_ptr;
++ png_voidp error_buf; /* Always a jmp_buf at present. */
+
++ png_const_bytep memory; /* Memory buffer. */
++ png_size_t size; /* Size of the memory buffer. */
++
++ unsigned int for_write :1; /* Otherwise it is a read structure */
++ unsigned int owned_file :1; /* We own the file in io_ptr */
++} png_control;
++
++/* Return the pointer to the jmp_buf from a png_control: necessary because C
++ * does not reveal the type of the elements of jmp_buf.
++ */
++#ifdef __cplusplus
++# define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0])
++#else
++# define png_control_jmp_buf(pc) ((pc)->error_buf)
++#endif
++
++/* Utility to safely execute a piece of libpng code catching and logging any
++ * errors that might occur. Returns true on success, false on failure (either
++ * of the function or as a result of a png_error.)
++ */
++PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
++ png_const_charp error_message),PNG_NORETURN);
++
++#ifdef PNG_WARNINGS_SUPPORTED
++PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
++ png_const_charp warning_message),PNG_EMPTY);
++#else
++# define png_safe_warning 0/*dummy argument*/
++#endif
++
++PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image,
++ int (*function)(png_voidp), png_voidp arg),PNG_EMPTY);
++
++/* Utility to log an error; this also cleans up the png_image; the function
++ * always returns 0 (false).
++ */
++PNG_INTERNAL_FUNCTION(int,png_image_error,(png_imagep image,
++ png_const_charp error_message),PNG_EMPTY);
++
++#ifndef PNG_SIMPLIFIED_READ_SUPPORTED
++/* png_image_free is used by the write code but not exported */
++PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
++#endif /* !SIMPLIFIED_READ */
++
++#endif /* SIMPLIFIED READ/WRITE */
++
++/* These are initialization functions for hardware specific PNG filter
++ * optimizations; list these here then select the appropriate one at compile
++ * time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined
++ * the generic code is used.
++ */
++#ifdef PNG_FILTER_OPTIMIZATIONS
++PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
++ unsigned int bpp), PNG_EMPTY);
++ /* Just declare the optimization that will be used */
++#else
++ /* List *all* the possible optimizations here - this branch is required if
++ * the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
++ * CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
++ */
++PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
++ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
++#endif
++
++/* Maintainer: Put new private prototypes here ^ */
+
+ #include "pngdebug.h"
+
+@@ -1383,4 +1968,5 @@
+ }
+ #endif
+
++#endif /* PNG_VERSION_INFO_ONLY */
+ #endif /* PNGPRIV_H */
+--- ./jdk/src/share/native/sun/awt/libpng/pngread.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngread.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -43,6 +43,9 @@
+ */
+
+ #include "pngpriv.h"
++#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
++# include <errno.h>
++#endif
+
+ #ifdef PNG_READ_SUPPORTED
+
+@@ -51,10 +54,12 @@
+ png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
+ png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
+ {
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
+- warn_fn, NULL, NULL, NULL));
++#ifndef PNG_USER_MEM_SUPPORTED
++ png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
++ error_fn, warn_fn, NULL, NULL, NULL);
++#else
++ return png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
++ warn_fn, NULL, NULL, NULL);
+ }
+
+ /* Alternate create PNG structure for reading, and allocate any memory
+@@ -65,134 +70,40 @@
+ png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
+ {
+-#endif /* PNG_USER_MEM_SUPPORTED */
+-
+-#ifdef PNG_SETJMP_SUPPORTED
+- volatile
+-#endif
+- png_structp png_ptr;
+- volatile int png_cleanup_needed = 0;
+-
+-#ifdef PNG_SETJMP_SUPPORTED
+-#ifdef USE_FAR_KEYWORD
+- jmp_buf tmp_jmpbuf;
+-#endif
+-#endif
+-
+- png_debug(1, "in png_create_read_struct");
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
+- malloc_fn, mem_ptr);
+-#else
+- png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
+-#endif
+- if (png_ptr == NULL)
+- return (NULL);
+-
+- /* Added at libpng-1.2.6 */
+-#ifdef PNG_USER_LIMITS_SUPPORTED
+- png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+- png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
+-
+-# ifdef PNG_USER_CHUNK_CACHE_MAX
+- /* Added at libpng-1.2.43 and 1.4.0 */
+- png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
+-# endif
+-
+-# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
+- /* Added at libpng-1.2.43 and 1.4.1 */
+- png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
+-# endif
+-#endif
+-
+-#ifdef PNG_SETJMP_SUPPORTED
+-/* Applications that neglect to set up their own setjmp() and then
+- encounter a png_error() will longjmp here. Since the jmpbuf is
+- then meaningless we abort instead of returning. */
+-#ifdef USE_FAR_KEYWORD
+- if (setjmp(tmp_jmpbuf))
+-#else
+- if (setjmp(png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */
+-#endif
+- PNG_ABORT();
+-#ifdef USE_FAR_KEYWORD
+- png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
+-#endif
+-#endif /* PNG_SETJMP_SUPPORTED */
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
+-#endif
+-
+- png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
+-
+- /* Call the general version checker (shared with read and write code): */
+- if (!png_user_version_check(png_ptr, user_png_ver))
+- png_cleanup_needed = 1;
+-
+- if (!png_cleanup_needed)
++ png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
++ error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
++#endif /* USER_MEM */
++
++ if (png_ptr != NULL)
+ {
+- /* Initialize zbuf - compression buffer */
+- png_ptr->zbuf_size = PNG_ZBUF_SIZE;
+- png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, png_ptr->zbuf_size);
+-
+- if (png_ptr->zbuf == NULL)
+- png_cleanup_needed = 1;
++ png_ptr->mode = PNG_IS_READ_STRUCT;
++
++ /* Added in libpng-1.6.0; this can be used to detect a read structure if
++ * required (it will be zero in a write structure.)
++ */
++# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++ png_ptr->IDAT_read_size = PNG_IDAT_READ_SIZE;
++# endif
++
++# ifdef PNG_BENIGN_READ_ERRORS_SUPPORTED
++ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
++
++ /* In stable builds only warn if an application error can be completely
++ * handled.
++ */
++# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++ png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
++# endif
++# endif
++
++ /* TODO: delay this, it can be done in png_init_io (if the app doesn't
++ * do it itself) avoiding setting the default function if it is not
++ * required.
++ */
++ png_set_read_fn(png_ptr, NULL, NULL);
+ }
+
+- png_ptr->zstream.zalloc = png_zalloc;
+- png_ptr->zstream.zfree = png_zfree;
+- png_ptr->zstream.opaque = (voidpf)png_ptr;
+-
+- if (!png_cleanup_needed)
+- {
+- switch (inflateInit(&png_ptr->zstream))
+- {
+- case Z_OK:
+- break; /* Do nothing */
+-
+- case Z_MEM_ERROR:
+- png_warning(png_ptr, "zlib memory error");
+- png_cleanup_needed = 1;
+- break;
+-
+- case Z_STREAM_ERROR:
+- png_warning(png_ptr, "zlib stream error");
+- png_cleanup_needed = 1;
+- break;
+-
+- case Z_VERSION_ERROR:
+- png_warning(png_ptr, "zlib version error");
+- png_cleanup_needed = 1;
+- break;
+-
+- default: png_warning(png_ptr, "Unknown zlib error");
+- png_cleanup_needed = 1;
+- }
+- }
+-
+- if (png_cleanup_needed)
+- {
+- /* Clean up PNG structure and deallocate any memory. */
+- png_free(png_ptr, png_ptr->zbuf);
+- png_ptr->zbuf = NULL;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)png_ptr,
+- (png_free_ptr)free_fn, (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)png_ptr);
+-#endif
+- return (NULL);
+- }
+-
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+-
+- png_set_read_fn(png_ptr, NULL, NULL);
+-
+-
+- return (png_ptr);
++ return png_ptr;
+ }
+
+
+@@ -206,8 +117,12 @@
+ * read if it is determined that this isn't a valid PNG file.
+ */
+ void PNGAPI
+-png_read_info(png_structp png_ptr, png_infop info_ptr)
++png_read_info(png_structrp png_ptr, png_inforp info_ptr)
+ {
++#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++ int keep;
++#endif
++
+ png_debug(1, "in png_read_info");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+@@ -218,231 +133,179 @@
+
+ for (;;)
+ {
+- PNG_IHDR;
+- PNG_IDAT;
+- PNG_IEND;
+- PNG_PLTE;
+-#ifdef PNG_READ_bKGD_SUPPORTED
+- PNG_bKGD;
+-#endif
+-#ifdef PNG_READ_cHRM_SUPPORTED
+- PNG_cHRM;
+-#endif
+-#ifdef PNG_READ_gAMA_SUPPORTED
+- PNG_gAMA;
+-#endif
+-#ifdef PNG_READ_hIST_SUPPORTED
+- PNG_hIST;
+-#endif
+-#ifdef PNG_READ_iCCP_SUPPORTED
+- PNG_iCCP;
+-#endif
+-#ifdef PNG_READ_iTXt_SUPPORTED
+- PNG_iTXt;
+-#endif
+-#ifdef PNG_READ_oFFs_SUPPORTED
+- PNG_oFFs;
+-#endif
+-#ifdef PNG_READ_pCAL_SUPPORTED
+- PNG_pCAL;
+-#endif
+-#ifdef PNG_READ_pHYs_SUPPORTED
+- PNG_pHYs;
+-#endif
+-#ifdef PNG_READ_sBIT_SUPPORTED
+- PNG_sBIT;
+-#endif
+-#ifdef PNG_READ_sCAL_SUPPORTED
+- PNG_sCAL;
+-#endif
+-#ifdef PNG_READ_sPLT_SUPPORTED
+- PNG_sPLT;
+-#endif
+-#ifdef PNG_READ_sRGB_SUPPORTED
+- PNG_sRGB;
+-#endif
+-#ifdef PNG_READ_tEXt_SUPPORTED
+- PNG_tEXt;
+-#endif
+-#ifdef PNG_READ_tIME_SUPPORTED
+- PNG_tIME;
+-#endif
+-#ifdef PNG_READ_tRNS_SUPPORTED
+- PNG_tRNS;
+-#endif
+-#ifdef PNG_READ_zTXt_SUPPORTED
+- PNG_zTXt;
+-#endif
+ png_uint_32 length = png_read_chunk_header(png_ptr);
+- PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
++ png_uint_32 chunk_name = png_ptr->chunk_name;
++
++ /* IDAT logic needs to happen here to simplify getting the two flags
++ * right.
++ */
++ if (chunk_name == png_IDAT)
++ {
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "Missing IHDR before IDAT");
++
++ else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
++ (png_ptr->mode & PNG_HAVE_PLTE) == 0)
++ png_chunk_error(png_ptr, "Missing PLTE before IDAT");
++
++ else if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
++ png_chunk_benign_error(png_ptr, "Too many IDATs found");
++
++ png_ptr->mode |= PNG_HAVE_IDAT;
++ }
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
++ png_ptr->mode |= PNG_AFTER_IDAT;
+
+ /* This should be a binary subdivision search or a hash for
+ * matching the chunk name rather than a linear search.
+ */
+- if (!png_memcmp(chunk_name, png_IDAT, 4))
+- if (png_ptr->mode & PNG_AFTER_IDAT)
+- png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
+-
+- if (!png_memcmp(chunk_name, png_IHDR, 4))
++ if (chunk_name == png_IHDR)
+ png_handle_IHDR(png_ptr, info_ptr, length);
+
+- else if (!png_memcmp(chunk_name, png_IEND, 4))
++ else if (chunk_name == png_IEND)
+ png_handle_IEND(png_ptr, info_ptr, length);
+
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- else if (png_handle_as_unknown(png_ptr, chunk_name))
++ else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
+ {
+- if (!png_memcmp(chunk_name, png_IDAT, 4))
+- png_ptr->mode |= PNG_HAVE_IDAT;
+-
+- png_handle_unknown(png_ptr, info_ptr, length);
+-
+- if (!png_memcmp(chunk_name, png_PLTE, 4))
++ png_handle_unknown(png_ptr, info_ptr, length, keep);
++
++ if (chunk_name == png_PLTE)
+ png_ptr->mode |= PNG_HAVE_PLTE;
+
+- else if (!png_memcmp(chunk_name, png_IDAT, 4))
++ else if (chunk_name == png_IDAT)
+ {
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before IDAT");
+-
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+- !(png_ptr->mode & PNG_HAVE_PLTE))
+- png_error(png_ptr, "Missing PLTE before IDAT");
+-
++ png_ptr->idat_size = 0; /* It has been consumed */
+ break;
+ }
+ }
+ #endif
+- else if (!png_memcmp(chunk_name, png_PLTE, 4))
++ else if (chunk_name == png_PLTE)
+ png_handle_PLTE(png_ptr, info_ptr, length);
+
+- else if (!png_memcmp(chunk_name, png_IDAT, 4))
++ else if (chunk_name == png_IDAT)
+ {
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before IDAT");
+-
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+- !(png_ptr->mode & PNG_HAVE_PLTE))
+- png_error(png_ptr, "Missing PLTE before IDAT");
+-
+ png_ptr->idat_size = length;
+- png_ptr->mode |= PNG_HAVE_IDAT;
+ break;
+ }
+
+ #ifdef PNG_READ_bKGD_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_bKGD, 4))
++ else if (chunk_name == png_bKGD)
+ png_handle_bKGD(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_cHRM_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_cHRM, 4))
++ else if (chunk_name == png_cHRM)
+ png_handle_cHRM(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_gAMA_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_gAMA, 4))
++ else if (chunk_name == png_gAMA)
+ png_handle_gAMA(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_hIST_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_hIST, 4))
++ else if (chunk_name == png_hIST)
+ png_handle_hIST(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_oFFs_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_oFFs, 4))
++ else if (chunk_name == png_oFFs)
+ png_handle_oFFs(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_pCAL_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_pCAL, 4))
++ else if (chunk_name == png_pCAL)
+ png_handle_pCAL(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sCAL_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sCAL, 4))
++ else if (chunk_name == png_sCAL)
+ png_handle_sCAL(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_pHYs_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_pHYs, 4))
++ else if (chunk_name == png_pHYs)
+ png_handle_pHYs(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sBIT_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sBIT, 4))
++ else if (chunk_name == png_sBIT)
+ png_handle_sBIT(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sRGB_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sRGB, 4))
++ else if (chunk_name == png_sRGB)
+ png_handle_sRGB(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_iCCP_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_iCCP, 4))
++ else if (chunk_name == png_iCCP)
+ png_handle_iCCP(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sPLT_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sPLT, 4))
++ else if (chunk_name == png_sPLT)
+ png_handle_sPLT(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tEXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tEXt, 4))
++ else if (chunk_name == png_tEXt)
+ png_handle_tEXt(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tIME_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tIME, 4))
++ else if (chunk_name == png_tIME)
+ png_handle_tIME(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tRNS_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tRNS, 4))
++ else if (chunk_name == png_tRNS)
+ png_handle_tRNS(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_zTXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_zTXt, 4))
++ else if (chunk_name == png_zTXt)
+ png_handle_zTXt(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_iTXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_iTXt, 4))
++ else if (chunk_name == png_iTXt)
+ png_handle_iTXt(png_ptr, info_ptr, length);
+ #endif
+
+ else
+- png_handle_unknown(png_ptr, info_ptr, length);
++ png_handle_unknown(png_ptr, info_ptr, length,
++ PNG_HANDLE_CHUNK_AS_DEFAULT);
+ }
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
+
+ /* Optional call to update the users info_ptr structure */
+ void PNGAPI
+-png_read_update_info(png_structp png_ptr, png_infop info_ptr)
++png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ png_debug(1, "in png_read_update_info");
+
+- if (png_ptr == NULL)
+- return;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
+- png_read_start_row(png_ptr);
+-
+- else
+- png_warning(png_ptr,
+- "Ignoring extra png_read_update_info() call;"
+- " row buffer not reallocated");
+-
+-#ifdef PNG_READ_TRANSFORMS_SUPPORTED
+- png_read_transform_info(png_ptr, info_ptr);
+-#else
+- PNG_UNUSED(info_ptr)
+-#endif
++ if (png_ptr != NULL)
++ {
++ if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
++ {
++ png_read_start_row(png_ptr);
++
++# ifdef PNG_READ_TRANSFORMS_SUPPORTED
++ png_read_transform_info(png_ptr, info_ptr);
++# else
++ PNG_UNUSED(info_ptr)
++# endif
++ }
++
++ /* New in 1.6.0 this avoids the bug of doing the initializations twice */
++ else
++ png_app_error(png_ptr,
++ "png_read_update_info/png_start_read_image: duplicate call");
++ }
+ }
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+@@ -452,86 +315,166 @@
+ * If the user doesn't call this, we will do it ourselves.
+ */
+ void PNGAPI
+-png_start_read_image(png_structp png_ptr)
++png_start_read_image(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_start_read_image");
+
++ if (png_ptr != NULL)
++ {
++ if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
++ png_read_start_row(png_ptr);
++
++ /* New in 1.6.0 this avoids the bug of doing the initializations twice */
++ else
++ png_app_error(png_ptr,
++ "png_start_read_image/png_read_update_info: duplicate call");
++ }
++}
++#endif /* SEQUENTIAL_READ */
++
++#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++#ifdef PNG_MNG_FEATURES_SUPPORTED
++/* Undoes intrapixel differencing,
++ * NOTE: this is apparently only supported in the 'sequential' reader.
++ */
++static void
++png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
++{
++ png_debug(1, "in png_do_read_intrapixel");
++
++ if (
++ (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
++ {
++ int bytes_per_pixel;
++ png_uint_32 row_width = row_info->width;
++
++ if (row_info->bit_depth == 8)
++ {
++ png_bytep rp;
++ png_uint_32 i;
++
++ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
++ bytes_per_pixel = 3;
++
++ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ bytes_per_pixel = 4;
++
++ else
++ return;
++
++ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
++ {
++ *(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
++ *(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
++ }
++ }
++ else if (row_info->bit_depth == 16)
++ {
++ png_bytep rp;
++ png_uint_32 i;
++
++ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
++ bytes_per_pixel = 6;
++
++ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ bytes_per_pixel = 8;
++
++ else
++ return;
++
++ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
++ {
++ png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
++ png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
++ png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
++ png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
++ png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
++ *(rp ) = (png_byte)((red >> 8) & 0xff);
++ *(rp + 1) = (png_byte)(red & 0xff);
++ *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
++ *(rp + 5) = (png_byte)(blue & 0xff);
++ }
++ }
++ }
++}
++#endif /* MNG_FEATURES */
++
++void PNGAPI
++png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
++{
++ png_row_info row_info;
++
+ if (png_ptr == NULL)
+ return;
+
+- if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
+- png_read_start_row(png_ptr);
+- else
+- png_warning(png_ptr,
+- "Ignoring extra png_start_read_image() call;"
+- " row buffer not reallocated");
+-}
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+-
+-#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+-void PNGAPI
+-png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
+-{
+- PNG_IDAT;
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
+- PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
+- 0xff};
+- PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
+-#endif
+- int ret;
+-
+- if (png_ptr == NULL)
+- return;
+-
+ png_debug2(1, "in png_read_row (row %lu, pass %d)",
+ (unsigned long)png_ptr->row_number, png_ptr->pass);
+
+- if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
++ /* png_read_start_row sets the information (in particular iwidth) for this
++ * interlace pass.
++ */
++ if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
+ png_read_start_row(png_ptr);
+
++ /* 1.5.6: row_info moved out of png_struct to a local here. */
++ row_info.width = png_ptr->iwidth; /* NOTE: width of current interlaced row */
++ row_info.color_type = png_ptr->color_type;
++ row_info.bit_depth = png_ptr->bit_depth;
++ row_info.channels = png_ptr->channels;
++ row_info.pixel_depth = png_ptr->pixel_depth;
++ row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
++
++#ifdef PNG_WARNINGS_SUPPORTED
+ if (png_ptr->row_number == 0 && png_ptr->pass == 0)
+ {
+ /* Check for transforms that have been set but were defined out */
+ #if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED)
+- if (png_ptr->transformations & PNG_INVERT_MONO)
++ if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
+ png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED)
+- if (png_ptr->transformations & PNG_FILLER)
++ if ((png_ptr->transformations & PNG_FILLER) != 0)
+ png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
+ !defined(PNG_READ_PACKSWAP_SUPPORTED)
+- if (png_ptr->transformations & PNG_PACKSWAP)
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+ png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED)
+- if (png_ptr->transformations & PNG_PACK)
++ if ((png_ptr->transformations & PNG_PACK) != 0)
+ png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED)
+- if (png_ptr->transformations & PNG_SHIFT)
++ if ((png_ptr->transformations & PNG_SHIFT) != 0)
+ png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED)
+- if (png_ptr->transformations & PNG_BGR)
++ if ((png_ptr->transformations & PNG_BGR) != 0)
+ png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined");
+ #endif
+
+ #if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED)
+- if (png_ptr->transformations & PNG_SWAP_BYTES)
++ if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
+ png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined");
+ #endif
+ }
++#endif /* WARNINGS */
+
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+- /* If interlaced and we do not need a new row, combine row and return */
+- if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
++ /* If interlaced and we do not need a new row, combine row and return.
++ * Notice that the pixels we have from previous rows have been transformed
++ * already; we can only combine like with like (transformed or
++ * untransformed) and, because of the libpng API for interlaced images, this
++ * means we must transform before de-interlacing.
++ */
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+ switch (png_ptr->pass)
+ {
+@@ -539,8 +482,7 @@
+ if (png_ptr->row_number & 0x07)
+ {
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+ png_read_finish_row(png_ptr);
+ return;
+ }
+@@ -550,8 +492,7 @@
+ if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
+ {
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ png_read_finish_row(png_ptr);
+ return;
+@@ -562,8 +503,7 @@
+ if ((png_ptr->row_number & 0x07) != 4)
+ {
+ if (dsp_row != NULL && (png_ptr->row_number & 4))
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ png_read_finish_row(png_ptr);
+ return;
+@@ -574,8 +514,7 @@
+ if ((png_ptr->row_number & 3) || png_ptr->width < 3)
+ {
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ png_read_finish_row(png_ptr);
+ return;
+@@ -586,19 +525,18 @@
+ if ((png_ptr->row_number & 3) != 2)
+ {
+ if (dsp_row != NULL && (png_ptr->row_number & 2))
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ png_read_finish_row(png_ptr);
+ return;
+ }
+ break;
++
+ case 5:
+ if ((png_ptr->row_number & 1) || png_ptr->width < 2)
+ {
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row,
+- png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ png_read_finish_row(png_ptr);
+ return;
+@@ -607,7 +545,7 @@
+
+ default:
+ case 6:
+- if (!(png_ptr->row_number & 1))
++ if ((png_ptr->row_number & 1) == 0)
+ {
+ png_read_finish_row(png_ptr);
+ return;
+@@ -617,117 +555,85 @@
+ }
+ #endif
+
+- if (!(png_ptr->mode & PNG_HAVE_IDAT))
++ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
+ png_error(png_ptr, "Invalid attempt to read row data");
+
+- png_ptr->zstream.next_out = png_ptr->row_buf;
+- png_ptr->zstream.avail_out =
+- (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
+- png_ptr->iwidth) + 1);
+-
+- do
++ /* Fill the row with IDAT data: */
++ png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1);
++
++ if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
+ {
+- if (!(png_ptr->zstream.avail_in))
+- {
+- while (!png_ptr->idat_size)
+- {
+- png_crc_finish(png_ptr, 0);
+-
+- png_ptr->idat_size = png_read_chunk_header(png_ptr);
+- if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+- png_error(png_ptr, "Not enough image data");
+- }
+- png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size;
+- png_ptr->zstream.next_in = png_ptr->zbuf;
+- if (png_ptr->zbuf_size > png_ptr->idat_size)
+- png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size;
+- png_crc_read(png_ptr, png_ptr->zbuf,
+- (png_size_t)png_ptr->zstream.avail_in);
+- png_ptr->idat_size -= png_ptr->zstream.avail_in;
+- }
+-
+- ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
+-
+- if (ret == Z_STREAM_END)
+- {
+- if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in ||
+- png_ptr->idat_size)
+- png_benign_error(png_ptr, "Extra compressed data");
+- png_ptr->mode |= PNG_AFTER_IDAT;
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
+- break;
+- }
+-
+- if (ret != Z_OK)
+- png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
+- "Decompression error");
+-
+- } while (png_ptr->zstream.avail_out);
+-
+- png_ptr->row_info.color_type = png_ptr->color_type;
+- png_ptr->row_info.width = png_ptr->iwidth;
+- png_ptr->row_info.channels = png_ptr->channels;
+- png_ptr->row_info.bit_depth = png_ptr->bit_depth;
+- png_ptr->row_info.pixel_depth = png_ptr->pixel_depth;
+- png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+- png_ptr->row_info.width);
+-
+- if (png_ptr->row_buf[0])
+- png_read_filter_row(png_ptr, &(png_ptr->row_info),
+- png_ptr->row_buf + 1, png_ptr->prev_row + 1,
+- (int)(png_ptr->row_buf[0]));
+-
+- png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
++ if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST)
++ png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1,
++ png_ptr->prev_row + 1, png_ptr->row_buf[0]);
++ else
++ png_error(png_ptr, "bad adaptive filter value");
++ }
++
++ /* libpng 1.5.6: the following line was copying png_ptr->rowbytes before
++ * 1.5.6, while the buffer really is this big in current versions of libpng
++ * it may not be in the future, so this was changed just to copy the
++ * interlaced count:
++ */
++ memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
+
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
++ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
+ (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
+ {
+ /* Intrapixel differencing */
+- png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
++ png_do_read_intrapixel(&row_info, png_ptr->row_buf + 1);
+ }
+ #endif
+
+-
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+ if (png_ptr->transformations)
+- png_do_read_transformations(png_ptr);
++ png_do_read_transformations(png_ptr, &row_info);
+ #endif
+
++ /* The transformed pixel depth should match the depth now in row_info. */
++ if (png_ptr->transformed_pixel_depth == 0)
++ {
++ png_ptr->transformed_pixel_depth = row_info.pixel_depth;
++ if (row_info.pixel_depth > png_ptr->maximum_pixel_depth)
++ png_error(png_ptr, "sequential row overflow");
++ }
++
++ else if (png_ptr->transformed_pixel_depth != row_info.pixel_depth)
++ png_error(png_ptr, "internal sequential row size calculation error");
++
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+- /* Blow up interlaced rows to full size */
+- if (png_ptr->interlaced &&
+- (png_ptr->transformations & PNG_INTERLACE))
++ /* Expand interlaced rows to full size */
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+ if (png_ptr->pass < 6)
+- /* Old interface (pre-1.0.9):
+- * png_do_read_interlace(&(png_ptr->row_info),
+- * png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
+- */
+- png_do_read_interlace(png_ptr);
++ png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
++ png_ptr->transformations);
+
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row, png_pass_dsp_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, dsp_row, 1/*display*/);
+
+ if (row != NULL)
+- png_combine_row(png_ptr, row, png_pass_mask[png_ptr->pass]);
++ png_combine_row(png_ptr, row, 0/*row*/);
+ }
+
+ else
+ #endif
+ {
+ if (row != NULL)
+- png_combine_row(png_ptr, row, 0xff);
++ png_combine_row(png_ptr, row, -1/*ignored*/);
+
+ if (dsp_row != NULL)
+- png_combine_row(png_ptr, dsp_row, 0xff);
++ png_combine_row(png_ptr, dsp_row, -1/*ignored*/);
+ }
+ png_read_finish_row(png_ptr);
+
+ if (png_ptr->read_row_fn != NULL)
+ (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
++
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read one or more rows of image data. If the image is interlaced,
+@@ -755,7 +661,7 @@
+ */
+
+ void PNGAPI
+-png_read_rows(png_structp png_ptr, png_bytepp row,
++png_read_rows(png_structrp png_ptr, png_bytepp row,
+ png_bytepp display_row, png_uint_32 num_rows)
+ {
+ png_uint_32 i;
+@@ -794,7 +700,7 @@
+ dp++;
+ }
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read the entire image. If the image has an alpha channel or a tRNS
+@@ -810,7 +716,7 @@
+ * [*] png_handle_alpha() does not exist yet, as of this version of libpng
+ */
+ void PNGAPI
+-png_read_image(png_structp png_ptr, png_bytepp image)
++png_read_image(png_structrp png_ptr, png_bytepp image)
+ {
+ png_uint_32 i, image_height;
+ int pass, j;
+@@ -822,7 +728,7 @@
+ return;
+
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+- if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
++ if ((png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
+ {
+ pass = png_set_interlace_handling(png_ptr);
+ /* And make sure transforms are initialized. */
+@@ -830,7 +736,8 @@
+ }
+ else
+ {
+- if (png_ptr->interlaced && !(png_ptr->transformations & PNG_INTERLACE))
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) == 0)
+ {
+ /* Caller called png_start_read_image or png_read_update_info without
+ * first turning on the PNG_INTERLACE transform. We can fix this here,
+@@ -867,7 +774,7 @@
+ }
+ }
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ /* Read the end of the PNG file. Will not read past the end of the
+@@ -875,416 +782,261 @@
+ * or time information at the end of the file, if info is not NULL.
+ */
+ void PNGAPI
+-png_read_end(png_structp png_ptr, png_infop info_ptr)
++png_read_end(png_structrp png_ptr, png_inforp info_ptr)
+ {
++#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++ int keep;
++#endif
++
+ png_debug(1, "in png_read_end");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
++ /* If png_read_end is called in the middle of reading the rows there may
++ * still be pending IDAT data and an owned zstream. Deal with this here.
++ */
++#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++ if (png_chunk_unknown_handling(png_ptr, png_IDAT) == 0)
++#endif
++ png_read_finish_IDAT(png_ptr);
++
++#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ /* Report invalid palette index; added at libng-1.5.10 */
++ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
++ png_ptr->num_palette_max > png_ptr->num_palette)
++ png_benign_error(png_ptr, "Read palette index exceeding num_palette");
++#endif
+
+ do
+ {
+- PNG_IHDR;
+- PNG_IDAT;
+- PNG_IEND;
+- PNG_PLTE;
+-#ifdef PNG_READ_bKGD_SUPPORTED
+- PNG_bKGD;
+-#endif
+-#ifdef PNG_READ_cHRM_SUPPORTED
+- PNG_cHRM;
+-#endif
+-#ifdef PNG_READ_gAMA_SUPPORTED
+- PNG_gAMA;
+-#endif
+-#ifdef PNG_READ_hIST_SUPPORTED
+- PNG_hIST;
+-#endif
+-#ifdef PNG_READ_iCCP_SUPPORTED
+- PNG_iCCP;
+-#endif
+-#ifdef PNG_READ_iTXt_SUPPORTED
+- PNG_iTXt;
+-#endif
+-#ifdef PNG_READ_oFFs_SUPPORTED
+- PNG_oFFs;
+-#endif
+-#ifdef PNG_READ_pCAL_SUPPORTED
+- PNG_pCAL;
+-#endif
+-#ifdef PNG_READ_pHYs_SUPPORTED
+- PNG_pHYs;
+-#endif
+-#ifdef PNG_READ_sBIT_SUPPORTED
+- PNG_sBIT;
+-#endif
+-#ifdef PNG_READ_sCAL_SUPPORTED
+- PNG_sCAL;
+-#endif
+-#ifdef PNG_READ_sPLT_SUPPORTED
+- PNG_sPLT;
+-#endif
+-#ifdef PNG_READ_sRGB_SUPPORTED
+- PNG_sRGB;
+-#endif
+-#ifdef PNG_READ_tEXt_SUPPORTED
+- PNG_tEXt;
+-#endif
+-#ifdef PNG_READ_tIME_SUPPORTED
+- PNG_tIME;
+-#endif
+-#ifdef PNG_READ_tRNS_SUPPORTED
+- PNG_tRNS;
+-#endif
+-#ifdef PNG_READ_zTXt_SUPPORTED
+- PNG_zTXt;
+-#endif
+ png_uint_32 length = png_read_chunk_header(png_ptr);
+- PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
+-
+- if (!png_memcmp(chunk_name, png_IHDR, 4))
++ png_uint_32 chunk_name = png_ptr->chunk_name;
++
++ if (chunk_name == png_IEND)
++ png_handle_IEND(png_ptr, info_ptr, length);
++
++ else if (chunk_name == png_IHDR)
+ png_handle_IHDR(png_ptr, info_ptr, length);
+
+- else if (!png_memcmp(chunk_name, png_IEND, 4))
+- png_handle_IEND(png_ptr, info_ptr, length);
++ else if (info_ptr == NULL)
++ png_crc_finish(png_ptr, length);
+
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- else if (png_handle_as_unknown(png_ptr, chunk_name))
++ else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
+ {
+- if (!png_memcmp(chunk_name, png_IDAT, 4))
++ if (chunk_name == png_IDAT)
+ {
+- if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
++ if ((length > 0) ||
++ (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+ png_benign_error(png_ptr, "Too many IDATs found");
+ }
+- png_handle_unknown(png_ptr, info_ptr, length);
+- if (!png_memcmp(chunk_name, png_PLTE, 4))
++ png_handle_unknown(png_ptr, info_ptr, length, keep);
++ if (chunk_name == png_PLTE)
+ png_ptr->mode |= PNG_HAVE_PLTE;
+ }
+ #endif
+
+- else if (!png_memcmp(chunk_name, png_IDAT, 4))
++ else if (chunk_name == png_IDAT)
+ {
+ /* Zero length IDATs are legal after the last IDAT has been
+ * read, but not after other chunks have been read.
+ */
+- if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
++ if ((length > 0) ||
++ (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+ png_benign_error(png_ptr, "Too many IDATs found");
+
+ png_crc_finish(png_ptr, length);
+ }
+- else if (!png_memcmp(chunk_name, png_PLTE, 4))
++ else if (chunk_name == png_PLTE)
+ png_handle_PLTE(png_ptr, info_ptr, length);
+
+ #ifdef PNG_READ_bKGD_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_bKGD, 4))
++ else if (chunk_name == png_bKGD)
+ png_handle_bKGD(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_cHRM_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_cHRM, 4))
++ else if (chunk_name == png_cHRM)
+ png_handle_cHRM(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_gAMA_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_gAMA, 4))
++ else if (chunk_name == png_gAMA)
+ png_handle_gAMA(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_hIST_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_hIST, 4))
++ else if (chunk_name == png_hIST)
+ png_handle_hIST(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_oFFs_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_oFFs, 4))
++ else if (chunk_name == png_oFFs)
+ png_handle_oFFs(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_pCAL_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_pCAL, 4))
++ else if (chunk_name == png_pCAL)
+ png_handle_pCAL(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sCAL_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sCAL, 4))
++ else if (chunk_name == png_sCAL)
+ png_handle_sCAL(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_pHYs_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_pHYs, 4))
++ else if (chunk_name == png_pHYs)
+ png_handle_pHYs(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sBIT_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sBIT, 4))
++ else if (chunk_name == png_sBIT)
+ png_handle_sBIT(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sRGB_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sRGB, 4))
++ else if (chunk_name == png_sRGB)
+ png_handle_sRGB(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_iCCP_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_iCCP, 4))
++ else if (chunk_name == png_iCCP)
+ png_handle_iCCP(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_sPLT_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_sPLT, 4))
++ else if (chunk_name == png_sPLT)
+ png_handle_sPLT(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tEXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tEXt, 4))
++ else if (chunk_name == png_tEXt)
+ png_handle_tEXt(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tIME_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tIME, 4))
++ else if (chunk_name == png_tIME)
+ png_handle_tIME(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_tRNS_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_tRNS, 4))
++ else if (chunk_name == png_tRNS)
+ png_handle_tRNS(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_zTXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_zTXt, 4))
++ else if (chunk_name == png_zTXt)
+ png_handle_zTXt(png_ptr, info_ptr, length);
+ #endif
+
+ #ifdef PNG_READ_iTXt_SUPPORTED
+- else if (!png_memcmp(chunk_name, png_iTXt, 4))
++ else if (chunk_name == png_iTXt)
+ png_handle_iTXt(png_ptr, info_ptr, length);
+ #endif
+
+ else
+- png_handle_unknown(png_ptr, info_ptr, length);
+- } while (!(png_ptr->mode & PNG_HAVE_IEND));
++ png_handle_unknown(png_ptr, info_ptr, length,
++ PNG_HANDLE_CHUNK_AS_DEFAULT);
++ } while ((png_ptr->mode & PNG_HAVE_IEND) == 0);
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
++
++/* Free all memory used in the read struct */
++static void
++png_read_destroy(png_structrp png_ptr)
++{
++ png_debug(1, "in png_read_destroy");
++
++#ifdef PNG_READ_GAMMA_SUPPORTED
++ png_destroy_gamma_table(png_ptr);
++#endif
++
++ png_free(png_ptr, png_ptr->big_row_buf);
++ png_ptr->big_row_buf = NULL;
++ png_free(png_ptr, png_ptr->big_prev_row);
++ png_ptr->big_prev_row = NULL;
++ png_free(png_ptr, png_ptr->read_buffer);
++ png_ptr->read_buffer = NULL;
++
++#ifdef PNG_READ_QUANTIZE_SUPPORTED
++ png_free(png_ptr, png_ptr->palette_lookup);
++ png_ptr->palette_lookup = NULL;
++ png_free(png_ptr, png_ptr->quantize_index);
++ png_ptr->quantize_index = NULL;
++#endif
++
++ if ((png_ptr->free_me & PNG_FREE_PLTE) != 0)
++ {
++ png_zfree(png_ptr, png_ptr->palette);
++ png_ptr->palette = NULL;
++ }
++ png_ptr->free_me &= ~PNG_FREE_PLTE;
++
++#if defined(PNG_tRNS_SUPPORTED) || \
++ defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
++ if ((png_ptr->free_me & PNG_FREE_TRNS) != 0)
++ {
++ png_free(png_ptr, png_ptr->trans_alpha);
++ png_ptr->trans_alpha = NULL;
++ }
++ png_ptr->free_me &= ~PNG_FREE_TRNS;
++#endif
++
++ inflateEnd(&png_ptr->zstream);
++
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++ png_free(png_ptr, png_ptr->save_buffer);
++ png_ptr->save_buffer = NULL;
++#endif
++
++#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
++ defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
++ png_free(png_ptr, png_ptr->unknown_chunk.data);
++ png_ptr->unknown_chunk.data = NULL;
++#endif
++
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ png_free(png_ptr, png_ptr->chunk_list);
++ png_ptr->chunk_list = NULL;
++#endif
++
++ /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
++ * callbacks are still set at this point. They are required to complete the
++ * destruction of the png_struct itself.
++ */
++}
+
+ /* Free all memory used by the read */
+ void PNGAPI
+ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
+ png_infopp end_info_ptr_ptr)
+ {
+- png_structp png_ptr = NULL;
+- png_infop info_ptr = NULL, end_info_ptr = NULL;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_free_ptr free_fn = NULL;
+- png_voidp mem_ptr = NULL;
+-#endif
++ png_structrp png_ptr = NULL;
+
+ png_debug(1, "in png_destroy_read_struct");
+
+ if (png_ptr_ptr != NULL)
+ png_ptr = *png_ptr_ptr;
++
+ if (png_ptr == NULL)
+ return;
+
+-#ifdef PNG_USER_MEM_SUPPORTED
+- free_fn = png_ptr->free_fn;
+- mem_ptr = png_ptr->mem_ptr;
+-#endif
+-
+- if (info_ptr_ptr != NULL)
+- info_ptr = *info_ptr_ptr;
+-
+- if (end_info_ptr_ptr != NULL)
+- end_info_ptr = *end_info_ptr_ptr;
+-
+- png_read_destroy(png_ptr, info_ptr, end_info_ptr);
+-
+- if (info_ptr != NULL)
+- {
+-#ifdef PNG_TEXT_SUPPORTED
+- png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
+-#endif
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
+- (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)info_ptr);
+-#endif
+- *info_ptr_ptr = NULL;
+- }
+-
+- if (end_info_ptr != NULL)
+- {
+-#ifdef PNG_READ_TEXT_SUPPORTED
+- png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
+-#endif
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn,
+- (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)end_info_ptr);
+-#endif
+- *end_info_ptr_ptr = NULL;
+- }
+-
+- if (png_ptr != NULL)
+- {
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
+- (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)png_ptr);
+-#endif
+- *png_ptr_ptr = NULL;
+- }
++ /* libpng 1.6.0: use the API to destroy info structs to ensure consistent
++ * behavior. Prior to 1.6.0 libpng did extra 'info' destruction in this API.
++ * The extra was, apparently, unnecessary yet this hides memory leak bugs.
++ */
++ png_destroy_info_struct(png_ptr, end_info_ptr_ptr);
++ png_destroy_info_struct(png_ptr, info_ptr_ptr);
++
++ *png_ptr_ptr = NULL;
++ png_read_destroy(png_ptr);
++ png_destroy_png_struct(png_ptr);
+ }
+
+-/* Free all memory used by the read (old method) */
+-void /* PRIVATE */
+-png_read_destroy(png_structp png_ptr, png_infop info_ptr,
+- png_infop end_info_ptr)
+-{
+-#ifdef PNG_SETJMP_SUPPORTED
+- jmp_buf tmp_jmp;
+-#endif
+- png_error_ptr error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- png_error_ptr warning_fn;
+-#endif
+- png_voidp error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_free_ptr free_fn;
+-#endif
+-
+- png_debug(1, "in png_read_destroy");
+-
+- if (info_ptr != NULL)
+- png_info_destroy(png_ptr, info_ptr);
+-
+- if (end_info_ptr != NULL)
+- png_info_destroy(png_ptr, end_info_ptr);
+-
+- png_free(png_ptr, png_ptr->zbuf);
+- png_free(png_ptr, png_ptr->big_row_buf);
+- png_free(png_ptr, png_ptr->prev_row);
+- png_free(png_ptr, png_ptr->chunkdata);
+-
+-#ifdef PNG_READ_QUANTIZE_SUPPORTED
+- png_free(png_ptr, png_ptr->palette_lookup);
+- png_free(png_ptr, png_ptr->quantize_index);
+-#endif
+-
+-#ifdef PNG_READ_GAMMA_SUPPORTED
+- png_free(png_ptr, png_ptr->gamma_table);
+-#endif
+-
+-#ifdef PNG_READ_BACKGROUND_SUPPORTED
+- png_free(png_ptr, png_ptr->gamma_from_1);
+- png_free(png_ptr, png_ptr->gamma_to_1);
+-#endif
+-
+- if (png_ptr->free_me & PNG_FREE_PLTE)
+- png_zfree(png_ptr, png_ptr->palette);
+- png_ptr->free_me &= ~PNG_FREE_PLTE;
+-
+-#if defined(PNG_tRNS_SUPPORTED) || \
+- defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+- if (png_ptr->free_me & PNG_FREE_TRNS)
+- png_free(png_ptr, png_ptr->trans_alpha);
+- png_ptr->free_me &= ~PNG_FREE_TRNS;
+-#endif
+-
+-#ifdef PNG_READ_hIST_SUPPORTED
+- if (png_ptr->free_me & PNG_FREE_HIST)
+- png_free(png_ptr, png_ptr->hist);
+- png_ptr->free_me &= ~PNG_FREE_HIST;
+-#endif
+-
+-#ifdef PNG_READ_GAMMA_SUPPORTED
+- if (png_ptr->gamma_16_table != NULL)
+- {
+- int i;
+- int istop = (1 << (8 - png_ptr->gamma_shift));
+- for (i = 0; i < istop; i++)
+- {
+- png_free(png_ptr, png_ptr->gamma_16_table[i]);
+- }
+- png_free(png_ptr, png_ptr->gamma_16_table);
+- }
+-
+-#ifdef PNG_READ_BACKGROUND_SUPPORTED
+- if (png_ptr->gamma_16_from_1 != NULL)
+- {
+- int i;
+- int istop = (1 << (8 - png_ptr->gamma_shift));
+- for (i = 0; i < istop; i++)
+- {
+- png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
+- }
+- png_free(png_ptr, png_ptr->gamma_16_from_1);
+- }
+- if (png_ptr->gamma_16_to_1 != NULL)
+- {
+- int i;
+- int istop = (1 << (8 - png_ptr->gamma_shift));
+- for (i = 0; i < istop; i++)
+- {
+- png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
+- }
+- png_free(png_ptr, png_ptr->gamma_16_to_1);
+- }
+-#endif
+-#endif
+-
+- inflateEnd(&png_ptr->zstream);
+-
+-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+- png_free(png_ptr, png_ptr->save_buffer);
+-#endif
+-
+-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+-#ifdef PNG_TEXT_SUPPORTED
+- png_free(png_ptr, png_ptr->current_text);
+-#endif /* PNG_TEXT_SUPPORTED */
+-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+-
+- /* Save the important info out of the png_struct, in case it is
+- * being used again.
+- */
+-#ifdef PNG_SETJMP_SUPPORTED
+- png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
+-#endif
+-
+- error_fn = png_ptr->error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- warning_fn = png_ptr->warning_fn;
+-#endif
+- error_ptr = png_ptr->error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- free_fn = png_ptr->free_fn;
+-#endif
+-
+- png_memset(png_ptr, 0, png_sizeof(png_struct));
+-
+- png_ptr->error_fn = error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- png_ptr->warning_fn = warning_fn;
+-#endif
+- png_ptr->error_ptr = error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_ptr->free_fn = free_fn;
+-#endif
+-
+-#ifdef PNG_SETJMP_SUPPORTED
+- png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf));
+-#endif
+-
+-}
+-
+ void PNGAPI
+-png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
++png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn)
+ {
+ if (png_ptr == NULL)
+ return;
+@@ -1296,12 +1048,10 @@
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ void PNGAPI
+-png_read_png(png_structp png_ptr, png_infop info_ptr,
++png_read_png(png_structrp png_ptr, png_inforp info_ptr,
+ int transforms,
+ voidp params)
+ {
+- int row;
+-
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+@@ -1309,130 +1059,153 @@
+ * PNG file before the first IDAT (image data chunk).
+ */
+ png_read_info(png_ptr, info_ptr);
+- if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
++ if (info_ptr->height > PNG_UINT_32_MAX/(sizeof (png_bytep)))
+ png_error(png_ptr, "Image is too high to process with png_read_png()");
+
+ /* -------------- image transformations start here ------------------- */
+-
+-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
++ /* libpng 1.6.10: add code to cause a png_app_error if a selected TRANSFORM
++ * is not implemented. This will only happen in de-configured (non-default)
++ * libpng builds. The results can be unexpected - png_read_png may return
++ * short or mal-formed rows because the transform is skipped.
++ */
++
+ /* Tell libpng to strip 16-bit/color files down to 8 bits per color.
+ */
+- if (transforms & PNG_TRANSFORM_SCALE_16)
+- {
++ if ((transforms & PNG_TRANSFORM_SCALE_16) != 0)
+ /* Added at libpng-1.5.4. "strip_16" produces the same result that it
+ * did in earlier versions, while "scale_16" is now more accurate.
+ */
++#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ png_set_scale_16(png_ptr);
+- }
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SCALE_16 not supported");
+ #endif
+
+-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+ /* If both SCALE and STRIP are required pngrtran will effectively cancel the
+ * latter by doing SCALE first. This is ok and allows apps not to check for
+ * which is supported to get the right answer.
+ */
+- if (transforms & PNG_TRANSFORM_STRIP_16)
++ if ((transforms & PNG_TRANSFORM_STRIP_16) != 0)
++#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+ png_set_strip_16(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_16 not supported");
+ #endif
+
+-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+ /* Strip alpha bytes from the input data without combining with
+ * the background (not recommended).
+ */
+- if (transforms & PNG_TRANSFORM_STRIP_ALPHA)
++ if ((transforms & PNG_TRANSFORM_STRIP_ALPHA) != 0)
++#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+ png_set_strip_alpha(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_ALPHA not supported");
+ #endif
+
+-#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED)
+ /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single
+ * byte into separate bytes (useful for paletted and grayscale images).
+ */
+- if (transforms & PNG_TRANSFORM_PACKING)
++ if ((transforms & PNG_TRANSFORM_PACKING) != 0)
++#ifdef PNG_READ_PACK_SUPPORTED
+ png_set_packing(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_PACKING not supported");
+ #endif
+
+-#ifdef PNG_READ_PACKSWAP_SUPPORTED
+ /* Change the order of packed pixels to least significant bit first
+ * (not useful if you are using png_set_packing).
+ */
+- if (transforms & PNG_TRANSFORM_PACKSWAP)
++ if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
++#ifdef PNG_READ_PACKSWAP_SUPPORTED
+ png_set_packswap(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_PACKSWAP not supported");
+ #endif
+
+-#ifdef PNG_READ_EXPAND_SUPPORTED
+ /* Expand paletted colors into true RGB triplets
+ * Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel
+ * Expand paletted or RGB images with transparency to full alpha
+ * channels so the data will be available as RGBA quartets.
+ */
+- if (transforms & PNG_TRANSFORM_EXPAND)
+- if ((png_ptr->bit_depth < 8) ||
+- (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
+- (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
+- png_set_expand(png_ptr);
++ if ((transforms & PNG_TRANSFORM_EXPAND) != 0)
++#ifdef PNG_READ_EXPAND_SUPPORTED
++ png_set_expand(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND not supported");
+ #endif
+
+ /* We don't handle background color or gamma transformation or quantizing.
+ */
+
+-#ifdef PNG_READ_INVERT_SUPPORTED
+ /* Invert monochrome files to have 0 as white and 1 as black
+ */
+- if (transforms & PNG_TRANSFORM_INVERT_MONO)
++ if ((transforms & PNG_TRANSFORM_INVERT_MONO) != 0)
++#ifdef PNG_READ_INVERT_SUPPORTED
+ png_set_invert_mono(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_MONO not supported");
+ #endif
+
+-#ifdef PNG_READ_SHIFT_SUPPORTED
+ /* If you want to shift the pixel values from the range [0,255] or
+ * [0,65535] to the original [0,7] or [0,31], or whatever range the
+ * colors were originally in:
+ */
+- if ((transforms & PNG_TRANSFORM_SHIFT)
+- && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
+- {
+- png_color_8p sig_bit;
+-
+- png_get_sBIT(png_ptr, info_ptr, &sig_bit);
+- png_set_shift(png_ptr, sig_bit);
+- }
++ if ((transforms & PNG_TRANSFORM_SHIFT) != 0)
++#ifdef PNG_READ_SHIFT_SUPPORTED
++ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
++ png_set_shift(png_ptr, &info_ptr->sig_bit);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SHIFT not supported");
+ #endif
+
++ /* Flip the RGB pixels to BGR (or RGBA to BGRA) */
++ if ((transforms & PNG_TRANSFORM_BGR) != 0)
+ #ifdef PNG_READ_BGR_SUPPORTED
+- /* Flip the RGB pixels to BGR (or RGBA to BGRA) */
+- if (transforms & PNG_TRANSFORM_BGR)
+ png_set_bgr(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_BGR not supported");
+ #endif
+
++ /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
++ if ((transforms & PNG_TRANSFORM_SWAP_ALPHA) != 0)
+ #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+- /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
+- if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
+ png_set_swap_alpha(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ALPHA not supported");
+ #endif
+
++ /* Swap bytes of 16-bit files to least significant byte first */
++ if ((transforms & PNG_TRANSFORM_SWAP_ENDIAN) != 0)
+ #ifdef PNG_READ_SWAP_SUPPORTED
+- /* Swap bytes of 16-bit files to least significant byte first */
+- if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
+ png_set_swap(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
+ #endif
+
+ /* Added at libpng-1.2.41 */
++ /* Invert the alpha channel from opacity to transparency */
++ if ((transforms & PNG_TRANSFORM_INVERT_ALPHA) != 0)
+ #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+- /* Invert the alpha channel from opacity to transparency */
+- if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_ALPHA not supported");
+ #endif
+
+ /* Added at libpng-1.2.41 */
++ /* Expand grayscale image to RGB */
++ if ((transforms & PNG_TRANSFORM_GRAY_TO_RGB) != 0)
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+- /* Expand grayscale image to RGB */
+- if (transforms & PNG_TRANSFORM_GRAY_TO_RGB)
+ png_set_gray_to_rgb(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_GRAY_TO_RGB not supported");
+ #endif
+
+ /* Added at libpng-1.5.4 */
++ if ((transforms & PNG_TRANSFORM_EXPAND_16) != 0)
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+- if (transforms & PNG_TRANSFORM_EXPAND_16)
+ png_set_expand_16(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_EXPAND_16 not supported");
+ #endif
+
+ /* We don't handle adding filler bytes */
+@@ -1455,16 +1228,17 @@
+ {
+ png_uint_32 iptr;
+
+- info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
+- info_ptr->height * png_sizeof(png_bytep));
++ info_ptr->row_pointers = png_voidcast(png_bytepp, png_malloc(png_ptr,
++ info_ptr->height * (sizeof (png_bytep))));
++
+ for (iptr=0; iptr<info_ptr->height; iptr++)
+ info_ptr->row_pointers[iptr] = NULL;
+
+ info_ptr->free_me |= PNG_FREE_ROWS;
+
+- for (row = 0; row < (int)info_ptr->height; row++)
+- info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
+- png_get_rowbytes(png_ptr, info_ptr));
++ for (iptr = 0; iptr < info_ptr->height; iptr++)
++ info_ptr->row_pointers[iptr] = png_voidcast(png_bytep,
++ png_malloc(png_ptr, info_ptr->rowbytes));
+ }
+
+ png_read_image(png_ptr, info_ptr->row_pointers);
+@@ -1473,10 +1247,2903 @@
+ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
+ png_read_end(png_ptr, info_ptr);
+
+- PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
+-
+ }
+-#endif /* PNG_INFO_IMAGE_SUPPORTED */
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* INFO_IMAGE */
++#endif /* SEQUENTIAL_READ */
++
++#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
++/* SIMPLIFIED READ
++ *
++ * This code currently relies on the sequential reader, though it could easily
++ * be made to work with the progressive one.
++ */
++/* Arguments to png_image_finish_read: */
++
++/* Encoding of PNG data (used by the color-map code) */
++# define P_NOTSET 0 /* File encoding not yet known */
++# define P_sRGB 1 /* 8-bit encoded to sRGB gamma */
++# define P_LINEAR 2 /* 16-bit linear: not encoded, NOT pre-multiplied! */
++# define P_FILE 3 /* 8-bit encoded to file gamma, not sRGB or linear */
++# define P_LINEAR8 4 /* 8-bit linear: only from a file value */
++
++/* Color-map processing: after libpng has run on the PNG image further
++ * processing may be needed to convert the data to color-map indices.
++ */
++#define PNG_CMAP_NONE 0
++#define PNG_CMAP_GA 1 /* Process GA data to a color-map with alpha */
++#define PNG_CMAP_TRANS 2 /* Process GA data to a background index */
++#define PNG_CMAP_RGB 3 /* Process RGB data */
++#define PNG_CMAP_RGB_ALPHA 4 /* Process RGBA data */
++
++/* The following document where the background is for each processing case. */
++#define PNG_CMAP_NONE_BACKGROUND 256
++#define PNG_CMAP_GA_BACKGROUND 231
++#define PNG_CMAP_TRANS_BACKGROUND 254
++#define PNG_CMAP_RGB_BACKGROUND 256
++#define PNG_CMAP_RGB_ALPHA_BACKGROUND 216
++
++typedef struct
++{
++ /* Arguments: */
++ png_imagep image;
++ png_voidp buffer;
++ png_int_32 row_stride;
++ png_voidp colormap;
++ png_const_colorp background;
++ /* Local variables: */
++ png_voidp local_row;
++ png_voidp first_row;
++ ptrdiff_t row_bytes; /* step between rows */
++ int file_encoding; /* E_ values above */
++ png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */
++ int colormap_processing; /* PNG_CMAP_ values above */
++} png_image_read_control;
++
++/* Do all the *safe* initialization - 'safe' means that png_error won't be
++ * called, so setting up the jmp_buf is not required. This means that anything
++ * called from here must *not* call png_malloc - it has to call png_malloc_warn
++ * instead so that control is returned safely back to this routine.
++ */
++static int
++png_image_read_init(png_imagep image)
++{
++ if (image->opaque == NULL)
++ {
++ png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, image,
++ png_safe_error, png_safe_warning);
++
++ /* And set the rest of the structure to NULL to ensure that the various
++ * fields are consistent.
++ */
++ memset(image, 0, (sizeof *image));
++ image->version = PNG_IMAGE_VERSION;
++
++ if (png_ptr != NULL)
++ {
++ png_infop info_ptr = png_create_info_struct(png_ptr);
++
++ if (info_ptr != NULL)
++ {
++ png_controlp control = png_voidcast(png_controlp,
++ png_malloc_warn(png_ptr, (sizeof *control)));
++
++ if (control != NULL)
++ {
++ memset(control, 0, (sizeof *control));
++
++ control->png_ptr = png_ptr;
++ control->info_ptr = info_ptr;
++ control->for_write = 0;
++
++ image->opaque = control;
++ return 1;
++ }
++
++ /* Error clean up */
++ png_destroy_info_struct(png_ptr, &info_ptr);
++ }
++
++ png_destroy_read_struct(&png_ptr, NULL, NULL);
++ }
++
++ return png_image_error(image, "png_image_read: out of memory");
++ }
++
++ return png_image_error(image, "png_image_read: opaque pointer not NULL");
++}
++
++/* Utility to find the base format of a PNG file from a png_struct. */
++static png_uint_32
++png_image_format(png_structrp png_ptr)
++{
++ png_uint_32 format = 0;
++
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
++ format |= PNG_FORMAT_FLAG_COLOR;
++
++ if ((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
++ format |= PNG_FORMAT_FLAG_ALPHA;
++
++ /* Use png_ptr here, not info_ptr, because by examination png_handle_tRNS
++ * sets the png_struct fields; that's all we are interested in here. The
++ * precise interaction with an app call to png_set_tRNS and PNG file reading
++ * is unclear.
++ */
++ else if (png_ptr->num_trans > 0)
++ format |= PNG_FORMAT_FLAG_ALPHA;
++
++ if (png_ptr->bit_depth == 16)
++ format |= PNG_FORMAT_FLAG_LINEAR;
++
++ if ((png_ptr->color_type & PNG_COLOR_MASK_PALETTE) != 0)
++ format |= PNG_FORMAT_FLAG_COLORMAP;
++
++ return format;
++}
++
++/* Is the given gamma significantly different from sRGB? The test is the same
++ * one used in pngrtran.c when deciding whether to do gamma correction. The
++ * arithmetic optimizes the division by using the fact that the inverse of the
++ * file sRGB gamma is 2.2
++ */
++static int
++png_gamma_not_sRGB(png_fixed_point g)
++{
++ if (g < PNG_FP_1)
++ {
++ /* An uninitialized gamma is assumed to be sRGB for the simplified API. */
++ if (g == 0)
++ return 0;
++
++ return png_gamma_significant((g * 11 + 2)/5 /* i.e. *2.2, rounded */);
++ }
++
++ return 1;
++}
++
++/* Do the main body of a 'png_image_begin_read' function; read the PNG file
++ * header and fill in all the information. This is executed in a safe context,
++ * unlike the init routine above.
++ */
++static int
++png_image_read_header(png_voidp argument)
++{
++ png_imagep image = png_voidcast(png_imagep, argument);
++ png_structrp png_ptr = image->opaque->png_ptr;
++ png_inforp info_ptr = image->opaque->info_ptr;
++
++ png_set_benign_errors(png_ptr, 1/*warn*/);
++ png_read_info(png_ptr, info_ptr);
++
++ /* Do this the fast way; just read directly out of png_struct. */
++ image->width = png_ptr->width;
++ image->height = png_ptr->height;
++
++ {
++ png_uint_32 format = png_image_format(png_ptr);
++
++ image->format = format;
++
++#ifdef PNG_COLORSPACE_SUPPORTED
++ /* Does the colorspace match sRGB? If there is no color endpoint
++ * (colorant) information assume yes, otherwise require the
++ * 'ENDPOINTS_MATCHP_sRGB' colorspace flag to have been set. If the
++ * colorspace has been determined to be invalid ignore it.
++ */
++ if ((format & PNG_FORMAT_FLAG_COLOR) != 0 && ((png_ptr->colorspace.flags
++ & (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB|
++ PNG_COLORSPACE_INVALID)) == PNG_COLORSPACE_HAVE_ENDPOINTS))
++ image->flags |= PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB;
++#endif
++ }
++
++ /* We need the maximum number of entries regardless of the format the
++ * application sets here.
++ */
++ {
++ png_uint_32 cmap_entries;
++
++ switch (png_ptr->color_type)
++ {
++ case PNG_COLOR_TYPE_GRAY:
++ cmap_entries = 1U << png_ptr->bit_depth;
++ break;
++
++ case PNG_COLOR_TYPE_PALETTE:
++ cmap_entries = png_ptr->num_palette;
++ break;
++
++ default:
++ cmap_entries = 256;
++ break;
++ }
++
++ if (cmap_entries > 256)
++ cmap_entries = 256;
++
++ image->colormap_entries = cmap_entries;
++ }
++
++ return 1;
++}
++
++#ifdef PNG_STDIO_SUPPORTED
++int PNGAPI
++png_image_begin_read_from_stdio(png_imagep image, FILE* file)
++{
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ if (file != NULL)
++ {
++ if (png_image_read_init(image) != 0)
++ {
++ /* This is slightly evil, but png_init_io doesn't do anything other
++ * than this and we haven't changed the standard IO functions so
++ * this saves a 'safe' function.
++ */
++ image->opaque->png_ptr->io_ptr = file;
++ return png_safe_execute(image, png_image_read_header, image);
++ }
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_begin_read_from_stdio: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_begin_read_from_stdio: incorrect PNG_IMAGE_VERSION");
++
++ return 0;
++}
++
++int PNGAPI
++png_image_begin_read_from_file(png_imagep image, const char *file_name)
++{
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ if (file_name != NULL)
++ {
++ FILE *fp = fopen(file_name, "rb");
++
++ if (fp != NULL)
++ {
++ if (png_image_read_init(image) != 0)
++ {
++ image->opaque->png_ptr->io_ptr = fp;
++ image->opaque->owned_file = 1;
++ return png_safe_execute(image, png_image_read_header, image);
++ }
++
++ /* Clean up: just the opened file. */
++ (void)fclose(fp);
++ }
++
++ else
++ return png_image_error(image, strerror(errno));
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_begin_read_from_file: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION");
++
++ return 0;
++}
++#endif /* STDIO */
++
++static void PNGCBAPI
++png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
++{
++ if (png_ptr != NULL)
++ {
++ png_imagep image = png_voidcast(png_imagep, png_ptr->io_ptr);
++ if (image != NULL)
++ {
++ png_controlp cp = image->opaque;
++ if (cp != NULL)
++ {
++ png_const_bytep memory = cp->memory;
++ png_size_t size = cp->size;
++
++ if (memory != NULL && size >= need)
++ {
++ memcpy(out, memory, need);
++ cp->memory = memory + need;
++ cp->size = size - need;
++ return;
++ }
++
++ png_error(png_ptr, "read beyond end of data");
++ }
++ }
++
++ png_error(png_ptr, "invalid memory read");
++ }
++}
++
++int PNGAPI png_image_begin_read_from_memory(png_imagep image,
++ png_const_voidp memory, png_size_t size)
++{
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ if (memory != NULL && size > 0)
++ {
++ if (png_image_read_init(image) != 0)
++ {
++ /* Now set the IO functions to read from the memory buffer and
++ * store it into io_ptr. Again do this in-place to avoid calling a
++ * libpng function that requires error handling.
++ */
++ image->opaque->memory = png_voidcast(png_const_bytep, memory);
++ image->opaque->size = size;
++ image->opaque->png_ptr->io_ptr = image;
++ image->opaque->png_ptr->read_data_fn = png_image_memory_read;
++
++ return png_safe_execute(image, png_image_read_header, image);
++ }
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_begin_read_from_memory: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_begin_read_from_memory: incorrect PNG_IMAGE_VERSION");
++
++ return 0;
++}
++
++/* Utility function to skip chunks that are not used by the simplified image
++ * read functions and an appropriate macro to call it.
++ */
++#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++static void
++png_image_skip_unused_chunks(png_structrp png_ptr)
++{
++ /* Prepare the reader to ignore all recognized chunks whose data will not
++ * be used, i.e., all chunks recognized by libpng except for those
++ * involved in basic image reading:
++ *
++ * IHDR, PLTE, IDAT, IEND
++ *
++ * Or image data handling:
++ *
++ * tRNS, bKGD, gAMA, cHRM, sRGB, [iCCP] and sBIT.
++ *
++ * This provides a small performance improvement and eliminates any
++ * potential vulnerability to security problems in the unused chunks.
++ *
++ * At present the iCCP chunk data isn't used, so iCCP chunk can be ignored
++ * too. This allows the simplified API to be compiled without iCCP support,
++ * however if the support is there the chunk is still checked to detect
++ * errors (which are unfortunately quite common.)
++ */
++ {
++ static PNG_CONST png_byte chunks_to_process[] = {
++ 98, 75, 71, 68, '\0', /* bKGD */
++ 99, 72, 82, 77, '\0', /* cHRM */
++ 103, 65, 77, 65, '\0', /* gAMA */
++# ifdef PNG_READ_iCCP_SUPPORTED
++ 105, 67, 67, 80, '\0', /* iCCP */
++# endif
++ 115, 66, 73, 84, '\0', /* sBIT */
++ 115, 82, 71, 66, '\0', /* sRGB */
++ };
++
++ /* Ignore unknown chunks and all other chunks except for the
++ * IHDR, PLTE, tRNS, IDAT, and IEND chunks.
++ */
++ png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_NEVER,
++ NULL, -1);
++
++ /* But do not ignore image data handling chunks */
++ png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_AS_DEFAULT,
++ chunks_to_process, (int)/*SAFE*/(sizeof chunks_to_process)/5);
++ }
++}
++
++# define PNG_SKIP_CHUNKS(p) png_image_skip_unused_chunks(p)
++#else
++# define PNG_SKIP_CHUNKS(p) ((void)0)
++#endif /* HANDLE_AS_UNKNOWN */
++
++/* The following macro gives the exact rounded answer for all values in the
++ * range 0..255 (it actually divides by 51.2, but the rounding still generates
++ * the correct numbers 0..5
++ */
++#define PNG_DIV51(v8) (((v8) * 5 + 130) >> 8)
++
++/* Utility functions to make particular color-maps */
++static void
++set_file_encoding(png_image_read_control *display)
++{
++ png_fixed_point g = display->image->opaque->png_ptr->colorspace.gamma;
++ if (png_gamma_significant(g) != 0)
++ {
++ if (png_gamma_not_sRGB(g) != 0)
++ {
++ display->file_encoding = P_FILE;
++ display->gamma_to_linear = png_reciprocal(g);
++ }
++
++ else
++ display->file_encoding = P_sRGB;
++ }
++
++ else
++ display->file_encoding = P_LINEAR8;
++}
++
++static unsigned int
++decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
++{
++ if (encoding == P_FILE) /* double check */
++ encoding = display->file_encoding;
++
++ if (encoding == P_NOTSET) /* must be the file encoding */
++ {
++ set_file_encoding(display);
++ encoding = display->file_encoding;
++ }
++
++ switch (encoding)
++ {
++ case P_FILE:
++ value = png_gamma_16bit_correct(value*257, display->gamma_to_linear);
++ break;
++
++ case P_sRGB:
++ value = png_sRGB_table[value];
++ break;
++
++ case P_LINEAR:
++ break;
++
++ case P_LINEAR8:
++ value *= 257;
++ break;
++
++ default:
++ png_error(display->image->opaque->png_ptr,
++ "unexpected encoding (internal error)");
++ break;
++ }
++
++ return value;
++}
++
++static png_uint_32
++png_colormap_compose(png_image_read_control *display,
++ png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha,
++ png_uint_32 background, int encoding)
++{
++ /* The file value is composed on the background, the background has the given
++ * encoding and so does the result, the file is encoded with P_FILE and the
++ * file and alpha are 8-bit values. The (output) encoding will always be
++ * P_LINEAR or P_sRGB.
++ */
++ png_uint_32 f = decode_gamma(display, foreground, foreground_encoding);
++ png_uint_32 b = decode_gamma(display, background, encoding);
++
++ /* The alpha is always an 8-bit value (it comes from the palette), the value
++ * scaled by 255 is what PNG_sRGB_FROM_LINEAR requires.
++ */
++ f = f * alpha + b * (255-alpha);
++
++ if (encoding == P_LINEAR)
++ {
++ /* Scale to 65535; divide by 255, approximately (in fact this is extremely
++ * accurate, it divides by 255.00000005937181414556, with no overflow.)
++ */
++ f *= 257; /* Now scaled by 65535 */
++ f += f >> 16;
++ f = (f+32768) >> 16;
++ }
++
++ else /* P_sRGB */
++ f = PNG_sRGB_FROM_LINEAR(f);
++
++ return f;
++}
++
++/* NOTE: P_LINEAR values to this routine must be 16-bit, but P_FILE values must
++ * be 8-bit.
++ */
++static void
++png_create_colormap_entry(png_image_read_control *display,
++ png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue,
++ png_uint_32 alpha, int encoding)
++{
++ png_imagep image = display->image;
++ const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
++ P_LINEAR : P_sRGB;
++ const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
++ (red != green || green != blue);
++
++ if (ip > 255)
++ png_error(image->opaque->png_ptr, "color-map index out of range");
++
++ /* Update the cache with whether the file gamma is significantly different
++ * from sRGB.
++ */
++ if (encoding == P_FILE)
++ {
++ if (display->file_encoding == P_NOTSET)
++ set_file_encoding(display);
++
++ /* Note that the cached value may be P_FILE too, but if it is then the
++ * gamma_to_linear member has been set.
++ */
++ encoding = display->file_encoding;
++ }
++
++ if (encoding == P_FILE)
++ {
++ png_fixed_point g = display->gamma_to_linear;
++
++ red = png_gamma_16bit_correct(red*257, g);
++ green = png_gamma_16bit_correct(green*257, g);
++ blue = png_gamma_16bit_correct(blue*257, g);
++
++ if (convert_to_Y != 0 || output_encoding == P_LINEAR)
++ {
++ alpha *= 257;
++ encoding = P_LINEAR;
++ }
++
++ else
++ {
++ red = PNG_sRGB_FROM_LINEAR(red * 255);
++ green = PNG_sRGB_FROM_LINEAR(green * 255);
++ blue = PNG_sRGB_FROM_LINEAR(blue * 255);
++ encoding = P_sRGB;
++ }
++ }
++
++ else if (encoding == P_LINEAR8)
++ {
++ /* This encoding occurs quite frequently in test cases because PngSuite
++ * includes a gAMA 1.0 chunk with most images.
++ */
++ red *= 257;
++ green *= 257;
++ blue *= 257;
++ alpha *= 257;
++ encoding = P_LINEAR;
++ }
++
++ else if (encoding == P_sRGB &&
++ (convert_to_Y != 0 || output_encoding == P_LINEAR))
++ {
++ /* The values are 8-bit sRGB values, but must be converted to 16-bit
++ * linear.
++ */
++ red = png_sRGB_table[red];
++ green = png_sRGB_table[green];
++ blue = png_sRGB_table[blue];
++ alpha *= 257;
++ encoding = P_LINEAR;
++ }
++
++ /* This is set if the color isn't gray but the output is. */
++ if (encoding == P_LINEAR)
++ {
++ if (convert_to_Y != 0)
++ {
++ /* NOTE: these values are copied from png_do_rgb_to_gray */
++ png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
++ (png_uint_32)2366 * blue;
++
++ if (output_encoding == P_LINEAR)
++ y = (y + 16384) >> 15;
++
++ else
++ {
++ /* y is scaled by 32768, we need it scaled by 255: */
++ y = (y + 128) >> 8;
++ y *= 255;
++ y = PNG_sRGB_FROM_LINEAR((y + 64) >> 7);
++ encoding = P_sRGB;
++ }
++
++ blue = red = green = y;
++ }
++
++ else if (output_encoding == P_sRGB)
++ {
++ red = PNG_sRGB_FROM_LINEAR(red * 255);
++ green = PNG_sRGB_FROM_LINEAR(green * 255);
++ blue = PNG_sRGB_FROM_LINEAR(blue * 255);
++ alpha = PNG_DIV257(alpha);
++ encoding = P_sRGB;
++ }
++ }
++
++ if (encoding != output_encoding)
++ png_error(image->opaque->png_ptr, "bad encoding (internal error)");
++
++ /* Store the value. */
++ {
++# ifdef PNG_FORMAT_AFIRST_SUPPORTED
++ const int afirst = (image->format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
++ (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
++# else
++# define afirst 0
++# endif
++# ifdef PNG_FORMAT_BGR_SUPPORTED
++ const int bgr = (image->format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
++# else
++# define bgr 0
++# endif
++
++ if (output_encoding == P_LINEAR)
++ {
++ png_uint_16p entry = png_voidcast(png_uint_16p, display->colormap);
++
++ entry += ip * PNG_IMAGE_SAMPLE_CHANNELS(image->format);
++
++ /* The linear 16-bit values must be pre-multiplied by the alpha channel
++ * value, if less than 65535 (this is, effectively, composite on black
++ * if the alpha channel is removed.)
++ */
++ switch (PNG_IMAGE_SAMPLE_CHANNELS(image->format))
++ {
++ case 4:
++ entry[afirst ? 0 : 3] = (png_uint_16)alpha;
++ /* FALL THROUGH */
++
++ case 3:
++ if (alpha < 65535)
++ {
++ if (alpha > 0)
++ {
++ blue = (blue * alpha + 32767U)/65535U;
++ green = (green * alpha + 32767U)/65535U;
++ red = (red * alpha + 32767U)/65535U;
++ }
++
++ else
++ red = green = blue = 0;
++ }
++ entry[afirst + (2 ^ bgr)] = (png_uint_16)blue;
++ entry[afirst + 1] = (png_uint_16)green;
++ entry[afirst + bgr] = (png_uint_16)red;
++ break;
++
++ case 2:
++ entry[1 ^ afirst] = (png_uint_16)alpha;
++ /* FALL THROUGH */
++
++ case 1:
++ if (alpha < 65535)
++ {
++ if (alpha > 0)
++ green = (green * alpha + 32767U)/65535U;
++
++ else
++ green = 0;
++ }
++ entry[afirst] = (png_uint_16)green;
++ break;
++
++ default:
++ break;
++ }
++ }
++
++ else /* output encoding is P_sRGB */
++ {
++ png_bytep entry = png_voidcast(png_bytep, display->colormap);
++
++ entry += ip * PNG_IMAGE_SAMPLE_CHANNELS(image->format);
++
++ switch (PNG_IMAGE_SAMPLE_CHANNELS(image->format))
++ {
++ case 4:
++ entry[afirst ? 0 : 3] = (png_byte)alpha;
++ case 3:
++ entry[afirst + (2 ^ bgr)] = (png_byte)blue;
++ entry[afirst + 1] = (png_byte)green;
++ entry[afirst + bgr] = (png_byte)red;
++ break;
++
++ case 2:
++ entry[1 ^ afirst] = (png_byte)alpha;
++ case 1:
++ entry[afirst] = (png_byte)green;
++ break;
++
++ default:
++ break;
++ }
++ }
++
++# ifdef afirst
++# undef afirst
++# endif
++# ifdef bgr
++# undef bgr
++# endif
++ }
++}
++
++static int
++make_gray_file_colormap(png_image_read_control *display)
++{
++ unsigned int i;
++
++ for (i=0; i<256; ++i)
++ png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
++
++ return i;
++}
++
++static int
++make_gray_colormap(png_image_read_control *display)
++{
++ unsigned int i;
++
++ for (i=0; i<256; ++i)
++ png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
++
++ return i;
++}
++#define PNG_GRAY_COLORMAP_ENTRIES 256
++
++static int
++make_ga_colormap(png_image_read_control *display)
++{
++ unsigned int i, a;
++
++ /* Alpha is retained, the output will be a color-map with entries
++ * selected by six levels of alpha. One transparent entry, 6 gray
++ * levels for all the intermediate alpha values, leaving 230 entries
++ * for the opaque grays. The color-map entries are the six values
++ * [0..5]*51, the GA processing uses PNG_DIV51(value) to find the
++ * relevant entry.
++ *
++ * if (alpha > 229) // opaque
++ * {
++ * // The 231 entries are selected to make the math below work:
++ * base = 0;
++ * entry = (231 * gray + 128) >> 8;
++ * }
++ * else if (alpha < 26) // transparent
++ * {
++ * base = 231;
++ * entry = 0;
++ * }
++ * else // partially opaque
++ * {
++ * base = 226 + 6 * PNG_DIV51(alpha);
++ * entry = PNG_DIV51(gray);
++ * }
++ */
++ i = 0;
++ while (i < 231)
++ {
++ unsigned int gray = (i * 256 + 115) / 231;
++ png_create_colormap_entry(display, i++, gray, gray, gray, 255, P_sRGB);
++ }
++
++ /* 255 is used here for the component values for consistency with the code
++ * that undoes premultiplication in pngwrite.c.
++ */
++ png_create_colormap_entry(display, i++, 255, 255, 255, 0, P_sRGB);
++
++ for (a=1; a<5; ++a)
++ {
++ unsigned int g;
++
++ for (g=0; g<6; ++g)
++ png_create_colormap_entry(display, i++, g*51, g*51, g*51, a*51,
++ P_sRGB);
++ }
++
++ return i;
++}
++
++#define PNG_GA_COLORMAP_ENTRIES 256
++
++static int
++make_rgb_colormap(png_image_read_control *display)
++{
++ unsigned int i, r;
++
++ /* Build a 6x6x6 opaque RGB cube */
++ for (i=r=0; r<6; ++r)
++ {
++ unsigned int g;
++
++ for (g=0; g<6; ++g)
++ {
++ unsigned int b;
++
++ for (b=0; b<6; ++b)
++ png_create_colormap_entry(display, i++, r*51, g*51, b*51, 255,
++ P_sRGB);
++ }
++ }
++
++ return i;
++}
++
++#define PNG_RGB_COLORMAP_ENTRIES 216
++
++/* Return a palette index to the above palette given three 8-bit sRGB values. */
++#define PNG_RGB_INDEX(r,g,b) \
++ ((png_byte)(6 * (6 * PNG_DIV51(r) + PNG_DIV51(g)) + PNG_DIV51(b)))
++
++static int
++png_image_read_colormap(png_voidp argument)
++{
++ png_image_read_control *display =
++ png_voidcast(png_image_read_control*, argument);
++ const png_imagep image = display->image;
++
++ const png_structrp png_ptr = image->opaque->png_ptr;
++ const png_uint_32 output_format = image->format;
++ const int output_encoding = (output_format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
++ P_LINEAR : P_sRGB;
++
++ unsigned int cmap_entries;
++ unsigned int output_processing; /* Output processing option */
++ unsigned int data_encoding = P_NOTSET; /* Encoding libpng must produce */
++
++ /* Background information; the background color and the index of this color
++ * in the color-map if it exists (else 256).
++ */
++ unsigned int background_index = 256;
++ png_uint_32 back_r, back_g, back_b;
++
++ /* Flags to accumulate things that need to be done to the input. */
++ int expand_tRNS = 0;
++
++ /* Exclude the NYI feature of compositing onto a color-mapped buffer; it is
++ * very difficult to do, the results look awful, and it is difficult to see
++ * what possible use it is because the application can't control the
++ * color-map.
++ */
++ if (((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0 ||
++ png_ptr->num_trans > 0) /* alpha in input */ &&
++ ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0) /* no alpha in output */)
++ {
++ if (output_encoding == P_LINEAR) /* compose on black */
++ back_b = back_g = back_r = 0;
++
++ else if (display->background == NULL /* no way to remove it */)
++ png_error(png_ptr,
++ "a background color must be supplied to remove alpha/transparency");
++
++ /* Get a copy of the background color (this avoids repeating the checks
++ * below.) The encoding is 8-bit sRGB or 16-bit linear, depending on the
++ * output format.
++ */
++ else
++ {
++ back_g = display->background->green;
++ if ((output_format & PNG_FORMAT_FLAG_COLOR) != 0)
++ {
++ back_r = display->background->red;
++ back_b = display->background->blue;
++ }
++ else
++ back_b = back_r = back_g;
++ }
++ }
++
++ else if (output_encoding == P_LINEAR)
++ back_b = back_r = back_g = 65535;
++
++ else
++ back_b = back_r = back_g = 255;
++
++ /* Default the input file gamma if required - this is necessary because
++ * libpng assumes that if no gamma information is present the data is in the
++ * output format, but the simplified API deduces the gamma from the input
++ * format.
++ */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) == 0)
++ {
++ /* Do this directly, not using the png_colorspace functions, to ensure
++ * that it happens even if the colorspace is invalid (though probably if
++ * it is the setting will be ignored) Note that the same thing can be
++ * achieved at the application interface with png_set_gAMA.
++ */
++ if (png_ptr->bit_depth == 16 &&
++ (image->flags & PNG_IMAGE_FLAG_16BIT_sRGB) == 0)
++ png_ptr->colorspace.gamma = PNG_GAMMA_LINEAR;
++
++ else
++ png_ptr->colorspace.gamma = PNG_GAMMA_sRGB_INVERSE;
++
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
++ }
++
++ /* Decide what to do based on the PNG color type of the input data. The
++ * utility function png_create_colormap_entry deals with most aspects of the
++ * output transformations; this code works out how to produce bytes of
++ * color-map entries from the original format.
++ */
++ switch (png_ptr->color_type)
++ {
++ case PNG_COLOR_TYPE_GRAY:
++ if (png_ptr->bit_depth <= 8)
++ {
++ /* There at most 256 colors in the output, regardless of
++ * transparency.
++ */
++ unsigned int step, i, val, trans = 256/*ignore*/, back_alpha = 0;
++
++ cmap_entries = 1U << png_ptr->bit_depth;
++ if (cmap_entries > image->colormap_entries)
++ png_error(png_ptr, "gray[8] color-map: too few entries");
++
++ step = 255 / (cmap_entries - 1);
++ output_processing = PNG_CMAP_NONE;
++
++ /* If there is a tRNS chunk then this either selects a transparent
++ * value or, if the output has no alpha, the background color.
++ */
++ if (png_ptr->num_trans > 0)
++ {
++ trans = png_ptr->trans_color.gray;
++
++ if ((output_format & PNG_FORMAT_FLAG_ALPHA) == 0)
++ back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
++ }
++
++ /* png_create_colormap_entry just takes an RGBA and writes the
++ * corresponding color-map entry using the format from 'image',
++ * including the required conversion to sRGB or linear as
++ * appropriate. The input values are always either sRGB (if the
++ * gamma correction flag is 0) or 0..255 scaled file encoded values
++ * (if the function must gamma correct them).
++ */
++ for (i=val=0; i<cmap_entries; ++i, val += step)
++ {
++ /* 'i' is a file value. While this will result in duplicated
++ * entries for 8-bit non-sRGB encoded files it is necessary to
++ * have non-gamma corrected values to do tRNS handling.
++ */
++ if (i != trans)
++ png_create_colormap_entry(display, i, val, val, val, 255,
++ P_FILE/*8-bit with file gamma*/);
++
++ /* Else this entry is transparent. The colors don't matter if
++ * there is an alpha channel (back_alpha == 0), but it does no
++ * harm to pass them in; the values are not set above so this
++ * passes in white.
++ *
++ * NOTE: this preserves the full precision of the application
++ * supplied background color when it is used.
++ */
++ else
++ png_create_colormap_entry(display, i, back_r, back_g, back_b,
++ back_alpha, output_encoding);
++ }
++
++ /* We need libpng to preserve the original encoding. */
++ data_encoding = P_FILE;
++
++ /* The rows from libpng, while technically gray values, are now also
++ * color-map indices; however, they may need to be expanded to 1
++ * byte per pixel. This is what png_set_packing does (i.e., it
++ * unpacks the bit values into bytes.)
++ */
++ if (png_ptr->bit_depth < 8)
++ png_set_packing(png_ptr);
++ }
++
++ else /* bit depth is 16 */
++ {
++ /* The 16-bit input values can be converted directly to 8-bit gamma
++ * encoded values; however, if a tRNS chunk is present 257 color-map
++ * entries are required. This means that the extra entry requires
++ * special processing; add an alpha channel, sacrifice gray level
++ * 254 and convert transparent (alpha==0) entries to that.
++ *
++ * Use libpng to chop the data to 8 bits. Convert it to sRGB at the
++ * same time to minimize quality loss. If a tRNS chunk is present
++ * this means libpng must handle it too; otherwise it is impossible
++ * to do the exact match on the 16-bit value.
++ *
++ * If the output has no alpha channel *and* the background color is
++ * gray then it is possible to let libpng handle the substitution by
++ * ensuring that the corresponding gray level matches the background
++ * color exactly.
++ */
++ data_encoding = P_sRGB;
++
++ if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "gray[16] color-map: too few entries");
++
++ cmap_entries = make_gray_colormap(display);
++
++ if (png_ptr->num_trans > 0)
++ {
++ unsigned int back_alpha;
++
++ if ((output_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ back_alpha = 0;
++
++ else
++ {
++ if (back_r == back_g && back_g == back_b)
++ {
++ /* Background is gray; no special processing will be
++ * required.
++ */
++ png_color_16 c;
++ png_uint_32 gray = back_g;
++
++ if (output_encoding == P_LINEAR)
++ {
++ gray = PNG_sRGB_FROM_LINEAR(gray * 255);
++
++ /* And make sure the corresponding palette entry
++ * matches.
++ */
++ png_create_colormap_entry(display, gray, back_g, back_g,
++ back_g, 65535, P_LINEAR);
++ }
++
++ /* The background passed to libpng, however, must be the
++ * sRGB value.
++ */
++ c.index = 0; /*unused*/
++ c.gray = c.red = c.green = c.blue = (png_uint_16)gray;
++
++ /* NOTE: does this work without expanding tRNS to alpha?
++ * It should be the color->gray case below apparently
++ * doesn't.
++ */
++ png_set_background_fixed(png_ptr, &c,
++ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
++ 0/*gamma: not used*/);
++
++ output_processing = PNG_CMAP_NONE;
++ break;
++ }
++
++ back_alpha = output_encoding == P_LINEAR ? 65535 : 255;
++ }
++
++ /* output_processing means that the libpng-processed row will be
++ * 8-bit GA and it has to be processing to single byte color-map
++ * values. Entry 254 is replaced by either a completely
++ * transparent entry or by the background color at full
++ * precision (and the background color is not a simple gray
++ * level in this case.)
++ */
++ expand_tRNS = 1;
++ output_processing = PNG_CMAP_TRANS;
++ background_index = 254;
++
++ /* And set (overwrite) color-map entry 254 to the actual
++ * background color at full precision.
++ */
++ png_create_colormap_entry(display, 254, back_r, back_g, back_b,
++ back_alpha, output_encoding);
++ }
++
++ else
++ output_processing = PNG_CMAP_NONE;
++ }
++ break;
++
++ case PNG_COLOR_TYPE_GRAY_ALPHA:
++ /* 8-bit or 16-bit PNG with two channels - gray and alpha. A minimum
++ * of 65536 combinations. If, however, the alpha channel is to be
++ * removed there are only 256 possibilities if the background is gray.
++ * (Otherwise there is a subset of the 65536 possibilities defined by
++ * the triangle between black, white and the background color.)
++ *
++ * Reduce 16-bit files to 8-bit and sRGB encode the result. No need to
++ * worry about tRNS matching - tRNS is ignored if there is an alpha
++ * channel.
++ */
++ data_encoding = P_sRGB;
++
++ if ((output_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "gray+alpha color-map: too few entries");
++
++ cmap_entries = make_ga_colormap(display);
++
++ background_index = PNG_CMAP_GA_BACKGROUND;
++ output_processing = PNG_CMAP_GA;
++ }
++
++ else /* alpha is removed */
++ {
++ /* Alpha must be removed as the PNG data is processed when the
++ * background is a color because the G and A channels are
++ * independent and the vector addition (non-parallel vectors) is a
++ * 2-D problem.
++ *
++ * This can be reduced to the same algorithm as above by making a
++ * colormap containing gray levels (for the opaque grays), a
++ * background entry (for a transparent pixel) and a set of four six
++ * level color values, one set for each intermediate alpha value.
++ * See the comments in make_ga_colormap for how this works in the
++ * per-pixel processing.
++ *
++ * If the background is gray, however, we only need a 256 entry gray
++ * level color map. It is sufficient to make the entry generated
++ * for the background color be exactly the color specified.
++ */
++ if ((output_format & PNG_FORMAT_FLAG_COLOR) == 0 ||
++ (back_r == back_g && back_g == back_b))
++ {
++ /* Background is gray; no special processing will be required. */
++ png_color_16 c;
++ png_uint_32 gray = back_g;
++
++ if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "gray-alpha color-map: too few entries");
++
++ cmap_entries = make_gray_colormap(display);
++
++ if (output_encoding == P_LINEAR)
++ {
++ gray = PNG_sRGB_FROM_LINEAR(gray * 255);
++
++ /* And make sure the corresponding palette entry matches. */
++ png_create_colormap_entry(display, gray, back_g, back_g,
++ back_g, 65535, P_LINEAR);
++ }
++
++ /* The background passed to libpng, however, must be the sRGB
++ * value.
++ */
++ c.index = 0; /*unused*/
++ c.gray = c.red = c.green = c.blue = (png_uint_16)gray;
++
++ png_set_background_fixed(png_ptr, &c,
++ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
++ 0/*gamma: not used*/);
++
++ output_processing = PNG_CMAP_NONE;
++ }
++
++ else
++ {
++ png_uint_32 i, a;
++
++ /* This is the same as png_make_ga_colormap, above, except that
++ * the entries are all opaque.
++ */
++ if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "ga-alpha color-map: too few entries");
++
++ i = 0;
++ while (i < 231)
++ {
++ png_uint_32 gray = (i * 256 + 115) / 231;
++ png_create_colormap_entry(display, i++, gray, gray, gray,
++ 255, P_sRGB);
++ }
++
++ /* NOTE: this preserves the full precision of the application
++ * background color.
++ */
++ background_index = i;
++ png_create_colormap_entry(display, i++, back_r, back_g, back_b,
++ output_encoding == P_LINEAR ? 65535U : 255U, output_encoding);
++
++ /* For non-opaque input composite on the sRGB background - this
++ * requires inverting the encoding for each component. The input
++ * is still converted to the sRGB encoding because this is a
++ * reasonable approximate to the logarithmic curve of human
++ * visual sensitivity, at least over the narrow range which PNG
++ * represents. Consequently 'G' is always sRGB encoded, while
++ * 'A' is linear. We need the linear background colors.
++ */
++ if (output_encoding == P_sRGB) /* else already linear */
++ {
++ /* This may produce a value not exactly matching the
++ * background, but that's ok because these numbers are only
++ * used when alpha != 0
++ */
++ back_r = png_sRGB_table[back_r];
++ back_g = png_sRGB_table[back_g];
++ back_b = png_sRGB_table[back_b];
++ }
++
++ for (a=1; a<5; ++a)
++ {
++ unsigned int g;
++
++ /* PNG_sRGB_FROM_LINEAR expects a 16-bit linear value scaled
++ * by an 8-bit alpha value (0..255).
++ */
++ png_uint_32 alpha = 51 * a;
++ png_uint_32 back_rx = (255-alpha) * back_r;
++ png_uint_32 back_gx = (255-alpha) * back_g;
++ png_uint_32 back_bx = (255-alpha) * back_b;
++
++ for (g=0; g<6; ++g)
++ {
++ png_uint_32 gray = png_sRGB_table[g*51] * alpha;
++
++ png_create_colormap_entry(display, i++,
++ PNG_sRGB_FROM_LINEAR(gray + back_rx),
++ PNG_sRGB_FROM_LINEAR(gray + back_gx),
++ PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, P_sRGB);
++ }
++ }
++
++ cmap_entries = i;
++ output_processing = PNG_CMAP_GA;
++ }
++ }
++ break;
++
++ case PNG_COLOR_TYPE_RGB:
++ case PNG_COLOR_TYPE_RGB_ALPHA:
++ /* Exclude the case where the output is gray; we can always handle this
++ * with the cases above.
++ */
++ if ((output_format & PNG_FORMAT_FLAG_COLOR) == 0)
++ {
++ /* The color-map will be grayscale, so we may as well convert the
++ * input RGB values to a simple grayscale and use the grayscale
++ * code above.
++ *
++ * NOTE: calling this apparently damages the recognition of the
++ * transparent color in background color handling; call
++ * png_set_tRNS_to_alpha before png_set_background_fixed.
++ */
++ png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE, -1,
++ -1);
++ data_encoding = P_sRGB;
++
++ /* The output will now be one or two 8-bit gray or gray+alpha
++ * channels. The more complex case arises when the input has alpha.
++ */
++ if ((png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ png_ptr->num_trans > 0) &&
++ (output_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ /* Both input and output have an alpha channel, so no background
++ * processing is required; just map the GA bytes to the right
++ * color-map entry.
++ */
++ expand_tRNS = 1;
++
++ if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "rgb[ga] color-map: too few entries");
++
++ cmap_entries = make_ga_colormap(display);
++ background_index = PNG_CMAP_GA_BACKGROUND;
++ output_processing = PNG_CMAP_GA;
++ }
++
++ else
++ {
++ /* Either the input or the output has no alpha channel, so there
++ * will be no non-opaque pixels in the color-map; it will just be
++ * grayscale.
++ */
++ if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "rgb[gray] color-map: too few entries");
++
++ /* Ideally this code would use libpng to do the gamma correction,
++ * but if an input alpha channel is to be removed we will hit the
++ * libpng bug in gamma+compose+rgb-to-gray (the double gamma
++ * correction bug). Fix this by dropping the gamma correction in
++ * this case and doing it in the palette; this will result in
++ * duplicate palette entries, but that's better than the
++ * alternative of double gamma correction.
++ */
++ if ((png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ png_ptr->num_trans > 0) &&
++ png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
++ {
++ cmap_entries = make_gray_file_colormap(display);
++ data_encoding = P_FILE;
++ }
++
++ else
++ cmap_entries = make_gray_colormap(display);
++
++ /* But if the input has alpha or transparency it must be removed
++ */
++ if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ png_ptr->num_trans > 0)
++ {
++ png_color_16 c;
++ png_uint_32 gray = back_g;
++
++ /* We need to ensure that the application background exists in
++ * the colormap and that completely transparent pixels map to
++ * it. Achieve this simply by ensuring that the entry
++ * selected for the background really is the background color.
++ */
++ if (data_encoding == P_FILE) /* from the fixup above */
++ {
++ /* The app supplied a gray which is in output_encoding, we
++ * need to convert it to a value of the input (P_FILE)
++ * encoding then set this palette entry to the required
++ * output encoding.
++ */
++ if (output_encoding == P_sRGB)
++ gray = png_sRGB_table[gray]; /* now P_LINEAR */
++
++ gray = PNG_DIV257(png_gamma_16bit_correct(gray,
++ png_ptr->colorspace.gamma)); /* now P_FILE */
++
++ /* And make sure the corresponding palette entry contains
++ * exactly the required sRGB value.
++ */
++ png_create_colormap_entry(display, gray, back_g, back_g,
++ back_g, 0/*unused*/, output_encoding);
++ }
++
++ else if (output_encoding == P_LINEAR)
++ {
++ gray = PNG_sRGB_FROM_LINEAR(gray * 255);
++
++ /* And make sure the corresponding palette entry matches.
++ */
++ png_create_colormap_entry(display, gray, back_g, back_g,
++ back_g, 0/*unused*/, P_LINEAR);
++ }
++
++ /* The background passed to libpng, however, must be the
++ * output (normally sRGB) value.
++ */
++ c.index = 0; /*unused*/
++ c.gray = c.red = c.green = c.blue = (png_uint_16)gray;
++
++ /* NOTE: the following is apparently a bug in libpng. Without
++ * it the transparent color recognition in
++ * png_set_background_fixed seems to go wrong.
++ */
++ expand_tRNS = 1;
++ png_set_background_fixed(png_ptr, &c,
++ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
++ 0/*gamma: not used*/);
++ }
++
++ output_processing = PNG_CMAP_NONE;
++ }
++ }
++
++ else /* output is color */
++ {
++ /* We could use png_quantize here so long as there is no transparent
++ * color or alpha; png_quantize ignores alpha. Easier overall just
++ * to do it once and using PNG_DIV51 on the 6x6x6 reduced RGB cube.
++ * Consequently we always want libpng to produce sRGB data.
++ */
++ data_encoding = P_sRGB;
++
++ /* Is there any transparency or alpha? */
++ if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ png_ptr->num_trans > 0)
++ {
++ /* Is there alpha in the output too? If so all four channels are
++ * processed into a special RGB cube with alpha support.
++ */
++ if ((output_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ png_uint_32 r;
++
++ if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
++ png_error(png_ptr, "rgb+alpha color-map: too few entries");
++
++ cmap_entries = make_rgb_colormap(display);
++
++ /* Add a transparent entry. */
++ png_create_colormap_entry(display, cmap_entries, 255, 255,
++ 255, 0, P_sRGB);
++
++ /* This is stored as the background index for the processing
++ * algorithm.
++ */
++ background_index = cmap_entries++;
++
++ /* Add 27 r,g,b entries each with alpha 0.5. */
++ for (r=0; r<256; r = (r << 1) | 0x7f)
++ {
++ png_uint_32 g;
++
++ for (g=0; g<256; g = (g << 1) | 0x7f)
++ {
++ png_uint_32 b;
++
++ /* This generates components with the values 0, 127 and
++ * 255
++ */
++ for (b=0; b<256; b = (b << 1) | 0x7f)
++ png_create_colormap_entry(display, cmap_entries++,
++ r, g, b, 128, P_sRGB);
++ }
++ }
++
++ expand_tRNS = 1;
++ output_processing = PNG_CMAP_RGB_ALPHA;
++ }
++
++ else
++ {
++ /* Alpha/transparency must be removed. The background must
++ * exist in the color map (achieved by setting adding it after
++ * the 666 color-map). If the standard processing code will
++ * pick up this entry automatically that's all that is
++ * required; libpng can be called to do the background
++ * processing.
++ */
++ unsigned int sample_size =
++ PNG_IMAGE_SAMPLE_SIZE(output_format);
++ png_uint_32 r, g, b; /* sRGB background */
++
++ if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
++ png_error(png_ptr, "rgb-alpha color-map: too few entries");
++
++ cmap_entries = make_rgb_colormap(display);
++
++ png_create_colormap_entry(display, cmap_entries, back_r,
++ back_g, back_b, 0/*unused*/, output_encoding);
++
++ if (output_encoding == P_LINEAR)
++ {
++ r = PNG_sRGB_FROM_LINEAR(back_r * 255);
++ g = PNG_sRGB_FROM_LINEAR(back_g * 255);
++ b = PNG_sRGB_FROM_LINEAR(back_b * 255);
++ }
++
++ else
++ {
++ r = back_r;
++ g = back_g;
++ b = back_g;
++ }
++
++ /* Compare the newly-created color-map entry with the one the
++ * PNG_CMAP_RGB algorithm will use. If the two entries don't
++ * match, add the new one and set this as the background
++ * index.
++ */
++ if (memcmp((png_const_bytep)display->colormap +
++ sample_size * cmap_entries,
++ (png_const_bytep)display->colormap +
++ sample_size * PNG_RGB_INDEX(r,g,b),
++ sample_size) != 0)
++ {
++ /* The background color must be added. */
++ background_index = cmap_entries++;
++
++ /* Add 27 r,g,b entries each with created by composing with
++ * the background at alpha 0.5.
++ */
++ for (r=0; r<256; r = (r << 1) | 0x7f)
++ {
++ for (g=0; g<256; g = (g << 1) | 0x7f)
++ {
++ /* This generates components with the values 0, 127
++ * and 255
++ */
++ for (b=0; b<256; b = (b << 1) | 0x7f)
++ png_create_colormap_entry(display, cmap_entries++,
++ png_colormap_compose(display, r, P_sRGB, 128,
++ back_r, output_encoding),
++ png_colormap_compose(display, g, P_sRGB, 128,
++ back_g, output_encoding),
++ png_colormap_compose(display, b, P_sRGB, 128,
++ back_b, output_encoding),
++ 0/*unused*/, output_encoding);
++ }
++ }
++
++ expand_tRNS = 1;
++ output_processing = PNG_CMAP_RGB_ALPHA;
++ }
++
++ else /* background color is in the standard color-map */
++ {
++ png_color_16 c;
++
++ c.index = 0; /*unused*/
++ c.red = (png_uint_16)back_r;
++ c.gray = c.green = (png_uint_16)back_g;
++ c.blue = (png_uint_16)back_b;
++
++ png_set_background_fixed(png_ptr, &c,
++ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
++ 0/*gamma: not used*/);
++
++ output_processing = PNG_CMAP_RGB;
++ }
++ }
++ }
++
++ else /* no alpha or transparency in the input */
++ {
++ /* Alpha in the output is irrelevant, simply map the opaque input
++ * pixels to the 6x6x6 color-map.
++ */
++ if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries)
++ png_error(png_ptr, "rgb color-map: too few entries");
++
++ cmap_entries = make_rgb_colormap(display);
++ output_processing = PNG_CMAP_RGB;
++ }
++ }
++ break;
++
++ case PNG_COLOR_TYPE_PALETTE:
++ /* It's already got a color-map. It may be necessary to eliminate the
++ * tRNS entries though.
++ */
++ {
++ unsigned int num_trans = png_ptr->num_trans;
++ png_const_bytep trans = num_trans > 0 ? png_ptr->trans_alpha : NULL;
++ png_const_colorp colormap = png_ptr->palette;
++ const int do_background = trans != NULL &&
++ (output_format & PNG_FORMAT_FLAG_ALPHA) == 0;
++ unsigned int i;
++
++ /* Just in case: */
++ if (trans == NULL)
++ num_trans = 0;
++
++ output_processing = PNG_CMAP_NONE;
++ data_encoding = P_FILE; /* Don't change from color-map indices */
++ cmap_entries = png_ptr->num_palette;
++ if (cmap_entries > 256)
++ cmap_entries = 256;
++
++ if (cmap_entries > image->colormap_entries)
++ png_error(png_ptr, "palette color-map: too few entries");
++
++ for (i=0; i < cmap_entries; ++i)
++ {
++ if (do_background != 0 && i < num_trans && trans[i] < 255)
++ {
++ if (trans[i] == 0)
++ png_create_colormap_entry(display, i, back_r, back_g,
++ back_b, 0, output_encoding);
++
++ else
++ {
++ /* Must compose the PNG file color in the color-map entry
++ * on the sRGB color in 'back'.
++ */
++ png_create_colormap_entry(display, i,
++ png_colormap_compose(display, colormap[i].red, P_FILE,
++ trans[i], back_r, output_encoding),
++ png_colormap_compose(display, colormap[i].green, P_FILE,
++ trans[i], back_g, output_encoding),
++ png_colormap_compose(display, colormap[i].blue, P_FILE,
++ trans[i], back_b, output_encoding),
++ output_encoding == P_LINEAR ? trans[i] * 257U :
++ trans[i],
++ output_encoding);
++ }
++ }
++
++ else
++ png_create_colormap_entry(display, i, colormap[i].red,
++ colormap[i].green, colormap[i].blue,
++ i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
++ }
++
++ /* The PNG data may have indices packed in fewer than 8 bits, it
++ * must be expanded if so.
++ */
++ if (png_ptr->bit_depth < 8)
++ png_set_packing(png_ptr);
++ }
++ break;
++
++ default:
++ png_error(png_ptr, "invalid PNG color type");
++ /*NOT REACHED*/
++ break;
++ }
++
++ /* Now deal with the output processing */
++ if (expand_tRNS != 0 && png_ptr->num_trans > 0 &&
++ (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) == 0)
++ png_set_tRNS_to_alpha(png_ptr);
++
++ switch (data_encoding)
++ {
++ default:
++ png_error(png_ptr, "bad data option (internal error)");
++ break;
++
++ case P_sRGB:
++ /* Change to 8-bit sRGB */
++ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
++ /* FALL THROUGH */
++
++ case P_FILE:
++ if (png_ptr->bit_depth > 8)
++ png_set_scale_16(png_ptr);
++ break;
++ }
++
++ if (cmap_entries > 256 || cmap_entries > image->colormap_entries)
++ png_error(png_ptr, "color map overflow (BAD internal error)");
++
++ image->colormap_entries = cmap_entries;
++
++ /* Double check using the recorded background index */
++ switch (output_processing)
++ {
++ case PNG_CMAP_NONE:
++ if (background_index != PNG_CMAP_NONE_BACKGROUND)
++ goto bad_background;
++ break;
++
++ case PNG_CMAP_GA:
++ if (background_index != PNG_CMAP_GA_BACKGROUND)
++ goto bad_background;
++ break;
++
++ case PNG_CMAP_TRANS:
++ if (background_index >= cmap_entries ||
++ background_index != PNG_CMAP_TRANS_BACKGROUND)
++ goto bad_background;
++ break;
++
++ case PNG_CMAP_RGB:
++ if (background_index != PNG_CMAP_RGB_BACKGROUND)
++ goto bad_background;
++ break;
++
++ case PNG_CMAP_RGB_ALPHA:
++ if (background_index != PNG_CMAP_RGB_ALPHA_BACKGROUND)
++ goto bad_background;
++ break;
++
++ default:
++ png_error(png_ptr, "bad processing option (internal error)");
++
++ bad_background:
++ png_error(png_ptr, "bad background index (internal error)");
++ }
++
++ display->colormap_processing = output_processing;
++
++ return 1/*ok*/;
++}
++
++/* The final part of the color-map read called from png_image_finish_read. */
++static int
++png_image_read_and_map(png_voidp argument)
++{
++ png_image_read_control *display = png_voidcast(png_image_read_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++ int passes;
++
++ /* Called when the libpng data must be transformed into the color-mapped
++ * form. There is a local row buffer in display->local and this routine must
++ * do the interlace handling.
++ */
++ switch (png_ptr->interlaced)
++ {
++ case PNG_INTERLACE_NONE:
++ passes = 1;
++ break;
++
++ case PNG_INTERLACE_ADAM7:
++ passes = PNG_INTERLACE_ADAM7_PASSES;
++ break;
++
++ default:
++ png_error(png_ptr, "unknown interlace type");
++ }
++
++ {
++ png_uint_32 height = image->height;
++ png_uint_32 width = image->width;
++ int proc = display->colormap_processing;
++ png_bytep first_row = png_voidcast(png_bytep, display->first_row);
++ ptrdiff_t step_row = display->row_bytes;
++ int pass;
++
++ for (pass = 0; pass < passes; ++pass)
++ {
++ unsigned int startx, stepx, stepy;
++ png_uint_32 y;
++
++ if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
++ {
++ /* The row may be empty for a short image: */
++ if (PNG_PASS_COLS(width, pass) == 0)
++ continue;
++
++ startx = PNG_PASS_START_COL(pass);
++ stepx = PNG_PASS_COL_OFFSET(pass);
++ y = PNG_PASS_START_ROW(pass);
++ stepy = PNG_PASS_ROW_OFFSET(pass);
++ }
++
++ else
++ {
++ y = 0;
++ startx = 0;
++ stepx = stepy = 1;
++ }
++
++ for (; y<height; y += stepy)
++ {
++ png_bytep inrow = png_voidcast(png_bytep, display->local_row);
++ png_bytep outrow = first_row + y * step_row;
++ png_const_bytep end_row = outrow + width;
++
++ /* Read read the libpng data into the temporary buffer. */
++ png_read_row(png_ptr, inrow, NULL);
++
++ /* Now process the row according to the processing option, note
++ * that the caller verifies that the format of the libpng output
++ * data is as required.
++ */
++ outrow += startx;
++ switch (proc)
++ {
++ case PNG_CMAP_GA:
++ for (; outrow < end_row; outrow += stepx)
++ {
++ /* The data is always in the PNG order */
++ unsigned int gray = *inrow++;
++ unsigned int alpha = *inrow++;
++ unsigned int entry;
++
++ /* NOTE: this code is copied as a comment in
++ * make_ga_colormap above. Please update the
++ * comment if you change this code!
++ */
++ if (alpha > 229) /* opaque */
++ {
++ entry = (231 * gray + 128) >> 8;
++ }
++ else if (alpha < 26) /* transparent */
++ {
++ entry = 231;
++ }
++ else /* partially opaque */
++ {
++ entry = 226 + 6 * PNG_DIV51(alpha) + PNG_DIV51(gray);
++ }
++
++ *outrow = (png_byte)entry;
++ }
++ break;
++
++ case PNG_CMAP_TRANS:
++ for (; outrow < end_row; outrow += stepx)
++ {
++ png_byte gray = *inrow++;
++ png_byte alpha = *inrow++;
++
++ if (alpha == 0)
++ *outrow = PNG_CMAP_TRANS_BACKGROUND;
++
++ else if (gray != PNG_CMAP_TRANS_BACKGROUND)
++ *outrow = gray;
++
++ else
++ *outrow = (png_byte)(PNG_CMAP_TRANS_BACKGROUND+1);
++ }
++ break;
++
++ case PNG_CMAP_RGB:
++ for (; outrow < end_row; outrow += stepx)
++ {
++ *outrow = PNG_RGB_INDEX(inrow[0], inrow[1], inrow[2]);
++ inrow += 3;
++ }
++ break;
++
++ case PNG_CMAP_RGB_ALPHA:
++ for (; outrow < end_row; outrow += stepx)
++ {
++ unsigned int alpha = inrow[3];
++
++ /* Because the alpha entries only hold alpha==0.5 values
++ * split the processing at alpha==0.25 (64) and 0.75
++ * (196).
++ */
++
++ if (alpha >= 196)
++ *outrow = PNG_RGB_INDEX(inrow[0], inrow[1],
++ inrow[2]);
++
++ else if (alpha < 64)
++ *outrow = PNG_CMAP_RGB_ALPHA_BACKGROUND;
++
++ else
++ {
++ /* Likewise there are three entries for each of r, g
++ * and b. We could select the entry by popcount on
++ * the top two bits on those architectures that
++ * support it, this is what the code below does,
++ * crudely.
++ */
++ unsigned int back_i = PNG_CMAP_RGB_ALPHA_BACKGROUND+1;
++
++ /* Here are how the values map:
++ *
++ * 0x00 .. 0x3f -> 0
++ * 0x40 .. 0xbf -> 1
++ * 0xc0 .. 0xff -> 2
++ *
++ * So, as above with the explicit alpha checks, the
++ * breakpoints are at 64 and 196.
++ */
++ if (inrow[0] & 0x80) back_i += 9; /* red */
++ if (inrow[0] & 0x40) back_i += 9;
++ if (inrow[0] & 0x80) back_i += 3; /* green */
++ if (inrow[0] & 0x40) back_i += 3;
++ if (inrow[0] & 0x80) back_i += 1; /* blue */
++ if (inrow[0] & 0x40) back_i += 1;
++
++ *outrow = (png_byte)back_i;
++ }
++
++ inrow += 4;
++ }
++ break;
++
++ default:
++ break;
++ }
++ }
++ }
++ }
++
++ return 1;
++}
++
++static int
++png_image_read_colormapped(png_voidp argument)
++{
++ png_image_read_control *display = png_voidcast(png_image_read_control*,
++ argument);
++ png_imagep image = display->image;
++ png_controlp control = image->opaque;
++ png_structrp png_ptr = control->png_ptr;
++ png_inforp info_ptr = control->info_ptr;
++
++ int passes = 0; /* As a flag */
++
++ PNG_SKIP_CHUNKS(png_ptr);
++
++ /* Update the 'info' structure and make sure the result is as required; first
++ * make sure to turn on the interlace handling if it will be required
++ * (because it can't be turned on *after* the call to png_read_update_info!)
++ */
++ if (display->colormap_processing == PNG_CMAP_NONE)
++ passes = png_set_interlace_handling(png_ptr);
++
++ png_read_update_info(png_ptr, info_ptr);
++
++ /* The expected output can be deduced from the colormap_processing option. */
++ switch (display->colormap_processing)
++ {
++ case PNG_CMAP_NONE:
++ /* Output must be one channel and one byte per pixel, the output
++ * encoding can be anything.
++ */
++ if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
++ info_ptr->color_type == PNG_COLOR_TYPE_GRAY) &&
++ info_ptr->bit_depth == 8)
++ break;
++
++ goto bad_output;
++
++ case PNG_CMAP_TRANS:
++ case PNG_CMAP_GA:
++ /* Output must be two channels and the 'G' one must be sRGB, the latter
++ * can be checked with an exact number because it should have been set
++ * to this number above!
++ */
++ if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
++ info_ptr->bit_depth == 8 &&
++ png_ptr->screen_gamma == PNG_GAMMA_sRGB &&
++ image->colormap_entries == 256)
++ break;
++
++ goto bad_output;
++
++ case PNG_CMAP_RGB:
++ /* Output must be 8-bit sRGB encoded RGB */
++ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
++ info_ptr->bit_depth == 8 &&
++ png_ptr->screen_gamma == PNG_GAMMA_sRGB &&
++ image->colormap_entries == 216)
++ break;
++
++ goto bad_output;
++
++ case PNG_CMAP_RGB_ALPHA:
++ /* Output must be 8-bit sRGB encoded RGBA */
++ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
++ info_ptr->bit_depth == 8 &&
++ png_ptr->screen_gamma == PNG_GAMMA_sRGB &&
++ image->colormap_entries == 244 /* 216 + 1 + 27 */)
++ break;
++
++ /* goto bad_output; */
++ /* FALL THROUGH */
++
++ default:
++ bad_output:
++ png_error(png_ptr, "bad color-map processing (internal error)");
++ }
++
++ /* Now read the rows. Do this here if it is possible to read directly into
++ * the output buffer, otherwise allocate a local row buffer of the maximum
++ * size libpng requires and call the relevant processing routine safely.
++ */
++ {
++ png_voidp first_row = display->buffer;
++ ptrdiff_t row_bytes = display->row_stride;
++
++ /* The following expression is designed to work correctly whether it gives
++ * a signed or an unsigned result.
++ */
++ if (row_bytes < 0)
++ {
++ char *ptr = png_voidcast(char*, first_row);
++ ptr += (image->height-1) * (-row_bytes);
++ first_row = png_voidcast(png_voidp, ptr);
++ }
++
++ display->first_row = first_row;
++ display->row_bytes = row_bytes;
++ }
++
++ if (passes == 0)
++ {
++ int result;
++ png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
++
++ display->local_row = row;
++ result = png_safe_execute(image, png_image_read_and_map, display);
++ display->local_row = NULL;
++ png_free(png_ptr, row);
++
++ return result;
++ }
++
++ else
++ {
++ png_alloc_size_t row_bytes = display->row_bytes;
++
++ while (--passes >= 0)
++ {
++ png_uint_32 y = image->height;
++ png_bytep row = png_voidcast(png_bytep, display->first_row);
++
++ while (y-- > 0)
++ {
++ png_read_row(png_ptr, row, NULL);
++ row += row_bytes;
++ }
++ }
++
++ return 1;
++ }
++}
++
++/* Just the row reading part of png_image_read. */
++static int
++png_image_read_composite(png_voidp argument)
++{
++ png_image_read_control *display = png_voidcast(png_image_read_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++ int passes;
++
++ switch (png_ptr->interlaced)
++ {
++ case PNG_INTERLACE_NONE:
++ passes = 1;
++ break;
++
++ case PNG_INTERLACE_ADAM7:
++ passes = PNG_INTERLACE_ADAM7_PASSES;
++ break;
++
++ default:
++ png_error(png_ptr, "unknown interlace type");
++ }
++
++ {
++ png_uint_32 height = image->height;
++ png_uint_32 width = image->width;
++ ptrdiff_t step_row = display->row_bytes;
++ unsigned int channels =
++ (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
++ int pass;
++
++ for (pass = 0; pass < passes; ++pass)
++ {
++ unsigned int startx, stepx, stepy;
++ png_uint_32 y;
++
++ if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
++ {
++ /* The row may be empty for a short image: */
++ if (PNG_PASS_COLS(width, pass) == 0)
++ continue;
++
++ startx = PNG_PASS_START_COL(pass) * channels;
++ stepx = PNG_PASS_COL_OFFSET(pass) * channels;
++ y = PNG_PASS_START_ROW(pass);
++ stepy = PNG_PASS_ROW_OFFSET(pass);
++ }
++
++ else
++ {
++ y = 0;
++ startx = 0;
++ stepx = channels;
++ stepy = 1;
++ }
++
++ for (; y<height; y += stepy)
++ {
++ png_bytep inrow = png_voidcast(png_bytep, display->local_row);
++ png_bytep outrow;
++ png_const_bytep end_row;
++
++ /* Read the row, which is packed: */
++ png_read_row(png_ptr, inrow, NULL);
++
++ outrow = png_voidcast(png_bytep, display->first_row);
++ outrow += y * step_row;
++ end_row = outrow + width * channels;
++
++ /* Now do the composition on each pixel in this row. */
++ outrow += startx;
++ for (; outrow < end_row; outrow += stepx)
++ {
++ png_byte alpha = inrow[channels];
++
++ if (alpha > 0) /* else no change to the output */
++ {
++ unsigned int c;
++
++ for (c=0; c<channels; ++c)
++ {
++ png_uint_32 component = inrow[c];
++
++ if (alpha < 255) /* else just use component */
++ {
++ /* This is PNG_OPTIMIZED_ALPHA, the component value
++ * is a linear 8-bit value. Combine this with the
++ * current outrow[c] value which is sRGB encoded.
++ * Arithmetic here is 16-bits to preserve the output
++ * values correctly.
++ */
++ component *= 257*255; /* =65535 */
++ component += (255-alpha)*png_sRGB_table[outrow[c]];
++
++ /* So 'component' is scaled by 255*65535 and is
++ * therefore appropriate for the sRGB to linear
++ * conversion table.
++ */
++ component = PNG_sRGB_FROM_LINEAR(component);
++ }
++
++ outrow[c] = (png_byte)component;
++ }
++ }
++
++ inrow += channels+1; /* components and alpha channel */
++ }
++ }
++ }
++ }
++
++ return 1;
++}
++
++/* The do_local_background case; called when all the following transforms are to
++ * be done:
++ *
++ * PNG_RGB_TO_GRAY
++ * PNG_COMPOSITE
++ * PNG_GAMMA
++ *
++ * This is a work-around for the fact that both the PNG_RGB_TO_GRAY and
++ * PNG_COMPOSITE code performs gamma correction, so we get double gamma
++ * correction. The fix-up is to prevent the PNG_COMPOSITE operation from
++ * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
++ * row and handles the removal or pre-multiplication of the alpha channel.
++ */
++static int
++png_image_read_background(png_voidp argument)
++{
++ png_image_read_control *display = png_voidcast(png_image_read_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++ png_inforp info_ptr = image->opaque->info_ptr;
++ png_uint_32 height = image->height;
++ png_uint_32 width = image->width;
++ int pass, passes;
++
++ /* Double check the convoluted logic below. We expect to get here with
++ * libpng doing rgb to gray and gamma correction but background processing
++ * left to the png_image_read_background function. The rows libpng produce
++ * might be 8 or 16-bit but should always have two channels; gray plus alpha.
++ */
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == 0)
++ png_error(png_ptr, "lost rgb to gray");
++
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0)
++ png_error(png_ptr, "unexpected compose");
++
++ if (png_get_channels(png_ptr, info_ptr) != 2)
++ png_error(png_ptr, "lost/gained channels");
++
++ /* Expect the 8-bit case to always remove the alpha channel */
++ if ((image->format & PNG_FORMAT_FLAG_LINEAR) == 0 &&
++ (image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ png_error(png_ptr, "unexpected 8-bit transformation");
++
++ switch (png_ptr->interlaced)
++ {
++ case PNG_INTERLACE_NONE:
++ passes = 1;
++ break;
++
++ case PNG_INTERLACE_ADAM7:
++ passes = PNG_INTERLACE_ADAM7_PASSES;
++ break;
++
++ default:
++ png_error(png_ptr, "unknown interlace type");
++ }
++
++ /* Use direct access to info_ptr here because otherwise the simplified API
++ * would require PNG_EASY_ACCESS_SUPPORTED (just for this.) Note this is
++ * checking the value after libpng expansions, not the original value in the
++ * PNG.
++ */
++ switch (info_ptr->bit_depth)
++ {
++ default:
++ png_error(png_ptr, "unexpected bit depth");
++ break;
++
++ case 8:
++ /* 8-bit sRGB gray values with an alpha channel; the alpha channel is
++ * to be removed by composing on a background: either the row if
++ * display->background is NULL or display->background->green if not.
++ * Unlike the code above ALPHA_OPTIMIZED has *not* been done.
++ */
++ {
++ png_bytep first_row = png_voidcast(png_bytep, display->first_row);
++ ptrdiff_t step_row = display->row_bytes;
++
++ for (pass = 0; pass < passes; ++pass)
++ {
++ png_bytep row = png_voidcast(png_bytep,
++ display->first_row);
++ unsigned int startx, stepx, stepy;
++ png_uint_32 y;
++
++ if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
++ {
++ /* The row may be empty for a short image: */
++ if (PNG_PASS_COLS(width, pass) == 0)
++ continue;
++
++ startx = PNG_PASS_START_COL(pass);
++ stepx = PNG_PASS_COL_OFFSET(pass);
++ y = PNG_PASS_START_ROW(pass);
++ stepy = PNG_PASS_ROW_OFFSET(pass);
++ }
++
++ else
++ {
++ y = 0;
++ startx = 0;
++ stepx = stepy = 1;
++ }
++
++ if (display->background == NULL)
++ {
++ for (; y<height; y += stepy)
++ {
++ png_bytep inrow = png_voidcast(png_bytep,
++ display->local_row);
++ png_bytep outrow = first_row + y * step_row;
++ png_const_bytep end_row = outrow + width;
++
++ /* Read the row, which is packed: */
++ png_read_row(png_ptr, inrow, NULL);
++
++ /* Now do the composition on each pixel in this row. */
++ outrow += startx;
++ for (; outrow < end_row; outrow += stepx)
++ {
++ png_byte alpha = inrow[1];
++
++ if (alpha > 0) /* else no change to the output */
++ {
++ png_uint_32 component = inrow[0];
++
++ if (alpha < 255) /* else just use component */
++ {
++ /* Since PNG_OPTIMIZED_ALPHA was not set it is
++ * necessary to invert the sRGB transfer
++ * function and multiply the alpha out.
++ */
++ component = png_sRGB_table[component] * alpha;
++ component += png_sRGB_table[outrow[0]] *
++ (255-alpha);
++ component = PNG_sRGB_FROM_LINEAR(component);
++ }
++
++ outrow[0] = (png_byte)component;
++ }
++
++ inrow += 2; /* gray and alpha channel */
++ }
++ }
++ }
++
++ else /* constant background value */
++ {
++ png_byte background8 = display->background->green;
++ png_uint_16 background = png_sRGB_table[background8];
++
++ for (; y<height; y += stepy)
++ {
++ png_bytep inrow = png_voidcast(png_bytep,
++ display->local_row);
++ png_bytep outrow = first_row + y * step_row;
++ png_const_bytep end_row = outrow + width;
++
++ /* Read the row, which is packed: */
++ png_read_row(png_ptr, inrow, NULL);
++
++ /* Now do the composition on each pixel in this row. */
++ outrow += startx;
++ for (; outrow < end_row; outrow += stepx)
++ {
++ png_byte alpha = inrow[1];
++
++ if (alpha > 0) /* else use background */
++ {
++ png_uint_32 component = inrow[0];
++
++ if (alpha < 255) /* else just use component */
++ {
++ component = png_sRGB_table[component] * alpha;
++ component += background * (255-alpha);
++ component = PNG_sRGB_FROM_LINEAR(component);
++ }
++
++ outrow[0] = (png_byte)component;
++ }
++
++ else
++ outrow[0] = background8;
++
++ inrow += 2; /* gray and alpha channel */
++ }
++
++ row += display->row_bytes;
++ }
++ }
++ }
++ }
++ break;
++
++ case 16:
++ /* 16-bit linear with pre-multiplied alpha; the pre-multiplication must
++ * still be done and, maybe, the alpha channel removed. This code also
++ * handles the alpha-first option.
++ */
++ {
++ png_uint_16p first_row = png_voidcast(png_uint_16p,
++ display->first_row);
++ /* The division by two is safe because the caller passed in a
++ * stride which was multiplied by 2 (below) to get row_bytes.
++ */
++ ptrdiff_t step_row = display->row_bytes / 2;
++ int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
++ unsigned int outchannels = 1+preserve_alpha;
++ int swap_alpha = 0;
++
++# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
++ if (preserve_alpha != 0 &&
++ (image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ swap_alpha = 1;
++# endif
++
++ for (pass = 0; pass < passes; ++pass)
++ {
++ unsigned int startx, stepx, stepy;
++ png_uint_32 y;
++
++ /* The 'x' start and step are adjusted to output components here.
++ */
++ if (png_ptr->interlaced == PNG_INTERLACE_ADAM7)
++ {
++ /* The row may be empty for a short image: */
++ if (PNG_PASS_COLS(width, pass) == 0)
++ continue;
++
++ startx = PNG_PASS_START_COL(pass) * outchannels;
++ stepx = PNG_PASS_COL_OFFSET(pass) * outchannels;
++ y = PNG_PASS_START_ROW(pass);
++ stepy = PNG_PASS_ROW_OFFSET(pass);
++ }
++
++ else
++ {
++ y = 0;
++ startx = 0;
++ stepx = outchannels;
++ stepy = 1;
++ }
++
++ for (; y<height; y += stepy)
++ {
++ png_const_uint_16p inrow;
++ png_uint_16p outrow = first_row + y*step_row;
++ png_uint_16p end_row = outrow + width * outchannels;
++
++ /* Read the row, which is packed: */
++ png_read_row(png_ptr, png_voidcast(png_bytep,
++ display->local_row), NULL);
++ inrow = png_voidcast(png_const_uint_16p, display->local_row);
++
++ /* Now do the pre-multiplication on each pixel in this row.
++ */
++ outrow += startx;
++ for (; outrow < end_row; outrow += stepx)
++ {
++ png_uint_32 component = inrow[0];
++ png_uint_16 alpha = inrow[1];
++
++ if (alpha > 0) /* else 0 */
++ {
++ if (alpha < 65535) /* else just use component */
++ {
++ component *= alpha;
++ component += 32767;
++ component /= 65535;
++ }
++ }
++
++ else
++ component = 0;
++
++ outrow[swap_alpha] = (png_uint_16)component;
++ if (preserve_alpha != 0)
++ outrow[1 ^ swap_alpha] = alpha;
++
++ inrow += 2; /* components and alpha channel */
++ }
++ }
++ }
++ }
++ break;
++ }
++
++ return 1;
++}
++
++/* The guts of png_image_finish_read as a png_safe_execute callback. */
++static int
++png_image_read_direct(png_voidp argument)
++{
++ png_image_read_control *display = png_voidcast(png_image_read_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++ png_inforp info_ptr = image->opaque->info_ptr;
++
++ png_uint_32 format = image->format;
++ int linear = (format & PNG_FORMAT_FLAG_LINEAR) != 0;
++ int do_local_compose = 0;
++ int do_local_background = 0; /* to avoid double gamma correction bug */
++ int passes = 0;
++
++ /* Add transforms to ensure the correct output format is produced then check
++ * that the required implementation support is there. Always expand; always
++ * need 8 bits minimum, no palette and expanded tRNS.
++ */
++ png_set_expand(png_ptr);
++
++ /* Now check the format to see if it was modified. */
++ {
++ png_uint_32 base_format = png_image_format(png_ptr) &
++ ~PNG_FORMAT_FLAG_COLORMAP /* removed by png_set_expand */;
++ png_uint_32 change = format ^ base_format;
++ png_fixed_point output_gamma;
++ int mode; /* alpha mode */
++
++ /* Do this first so that we have a record if rgb to gray is happening. */
++ if ((change & PNG_FORMAT_FLAG_COLOR) != 0)
++ {
++ /* gray<->color transformation required. */
++ if ((format & PNG_FORMAT_FLAG_COLOR) != 0)
++ png_set_gray_to_rgb(png_ptr);
++
++ else
++ {
++ /* libpng can't do both rgb to gray and
++ * background/pre-multiplication if there is also significant gamma
++ * correction, because both operations require linear colors and
++ * the code only supports one transform doing the gamma correction.
++ * Handle this by doing the pre-multiplication or background
++ * operation in this code, if necessary.
++ *
++ * TODO: fix this by rewriting pngrtran.c (!)
++ *
++ * For the moment (given that fixing this in pngrtran.c is an
++ * enormous change) 'do_local_background' is used to indicate that
++ * the problem exists.
++ */
++ if ((base_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ do_local_background = 1/*maybe*/;
++
++ png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE,
++ PNG_RGB_TO_GRAY_DEFAULT, PNG_RGB_TO_GRAY_DEFAULT);
++ }
++
++ change &= ~PNG_FORMAT_FLAG_COLOR;
++ }
++
++ /* Set the gamma appropriately, linear for 16-bit input, sRGB otherwise.
++ */
++ {
++ png_fixed_point input_gamma_default;
++
++ if ((base_format & PNG_FORMAT_FLAG_LINEAR) != 0 &&
++ (image->flags & PNG_IMAGE_FLAG_16BIT_sRGB) == 0)
++ input_gamma_default = PNG_GAMMA_LINEAR;
++ else
++ input_gamma_default = PNG_DEFAULT_sRGB;
++
++ /* Call png_set_alpha_mode to set the default for the input gamma; the
++ * output gamma is set by a second call below.
++ */
++ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
++ }
++
++ if (linear != 0)
++ {
++ /* If there *is* an alpha channel in the input it must be multiplied
++ * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
++ */
++ if ((base_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ mode = PNG_ALPHA_STANDARD; /* associated alpha */
++
++ else
++ mode = PNG_ALPHA_PNG;
++
++ output_gamma = PNG_GAMMA_LINEAR;
++ }
++
++ else
++ {
++ mode = PNG_ALPHA_PNG;
++ output_gamma = PNG_DEFAULT_sRGB;
++ }
++
++ /* If 'do_local_background' is set check for the presence of gamma
++ * correction; this is part of the work-round for the libpng bug
++ * described above.
++ *
++ * TODO: fix libpng and remove this.
++ */
++ if (do_local_background != 0)
++ {
++ png_fixed_point gtest;
++
++ /* This is 'png_gamma_threshold' from pngrtran.c; the test used for
++ * gamma correction, the screen gamma hasn't been set on png_struct
++ * yet; it's set below. png_struct::gamma, however, is set to the
++ * final value.
++ */
++ if (png_muldiv(&gtest, output_gamma, png_ptr->colorspace.gamma,
++ PNG_FP_1) != 0 && png_gamma_significant(gtest) == 0)
++ do_local_background = 0;
++
++ else if (mode == PNG_ALPHA_STANDARD)
++ {
++ do_local_background = 2/*required*/;
++ mode = PNG_ALPHA_PNG; /* prevent libpng doing it */
++ }
++
++ /* else leave as 1 for the checks below */
++ }
++
++ /* If the bit-depth changes then handle that here. */
++ if ((change & PNG_FORMAT_FLAG_LINEAR) != 0)
++ {
++ if (linear != 0 /*16-bit output*/)
++ png_set_expand_16(png_ptr);
++
++ else /* 8-bit output */
++ png_set_scale_16(png_ptr);
++
++ change &= ~PNG_FORMAT_FLAG_LINEAR;
++ }
++
++ /* Now the background/alpha channel changes. */
++ if ((change & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ /* Removing an alpha channel requires composition for the 8-bit
++ * formats; for the 16-bit it is already done, above, by the
++ * pre-multiplication and the channel just needs to be stripped.
++ */
++ if ((base_format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ /* If RGB->gray is happening the alpha channel must be left and the
++ * operation completed locally.
++ *
++ * TODO: fix libpng and remove this.
++ */
++ if (do_local_background != 0)
++ do_local_background = 2/*required*/;
++
++ /* 16-bit output: just remove the channel */
++ else if (linear != 0) /* compose on black (well, pre-multiply) */
++ png_set_strip_alpha(png_ptr);
++
++ /* 8-bit output: do an appropriate compose */
++ else if (display->background != NULL)
++ {
++ png_color_16 c;
++
++ c.index = 0; /*unused*/
++ c.red = display->background->red;
++ c.green = display->background->green;
++ c.blue = display->background->blue;
++ c.gray = display->background->green;
++
++ /* This is always an 8-bit sRGB value, using the 'green' channel
++ * for gray is much better than calculating the luminance here;
++ * we can get off-by-one errors in that calculation relative to
++ * the app expectations and that will show up in transparent
++ * pixels.
++ */
++ png_set_background_fixed(png_ptr, &c,
++ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
++ 0/*gamma: not used*/);
++ }
++
++ else /* compose on row: implemented below. */
++ {
++ do_local_compose = 1;
++ /* This leaves the alpha channel in the output, so it has to be
++ * removed by the code below. Set the encoding to the 'OPTIMIZE'
++ * one so the code only has to hack on the pixels that require
++ * composition.
++ */
++ mode = PNG_ALPHA_OPTIMIZED;
++ }
++ }
++
++ else /* output needs an alpha channel */
++ {
++ /* This is tricky because it happens before the swap operation has
++ * been accomplished; however, the swap does *not* swap the added
++ * alpha channel (weird API), so it must be added in the correct
++ * place.
++ */
++ png_uint_32 filler; /* opaque filler */
++ int where;
++
++ if (linear != 0)
++ filler = 65535;
++
++ else
++ filler = 255;
++
++# ifdef PNG_FORMAT_AFIRST_SUPPORTED
++ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ {
++ where = PNG_FILLER_BEFORE;
++ change &= ~PNG_FORMAT_FLAG_AFIRST;
++ }
++
++ else
++# endif
++ where = PNG_FILLER_AFTER;
++
++ png_set_add_alpha(png_ptr, filler, where);
++ }
++
++ /* This stops the (irrelevant) call to swap_alpha below. */
++ change &= ~PNG_FORMAT_FLAG_ALPHA;
++ }
++
++ /* Now set the alpha mode correctly; this is always done, even if there is
++ * no alpha channel in either the input or the output because it correctly
++ * sets the output gamma.
++ */
++ png_set_alpha_mode_fixed(png_ptr, mode, output_gamma);
++
++# ifdef PNG_FORMAT_BGR_SUPPORTED
++ if ((change & PNG_FORMAT_FLAG_BGR) != 0)
++ {
++ /* Check only the output format; PNG is never BGR; don't do this if
++ * the output is gray, but fix up the 'format' value in that case.
++ */
++ if ((format & PNG_FORMAT_FLAG_COLOR) != 0)
++ png_set_bgr(png_ptr);
++
++ else
++ format &= ~PNG_FORMAT_FLAG_BGR;
++
++ change &= ~PNG_FORMAT_FLAG_BGR;
++ }
++# endif
++
++# ifdef PNG_FORMAT_AFIRST_SUPPORTED
++ if ((change & PNG_FORMAT_FLAG_AFIRST) != 0)
++ {
++ /* Only relevant if there is an alpha channel - it's particularly
++ * important to handle this correctly because do_local_compose may
++ * be set above and then libpng will keep the alpha channel for this
++ * code to remove.
++ */
++ if ((format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ /* Disable this if doing a local background,
++ * TODO: remove this when local background is no longer required.
++ */
++ if (do_local_background != 2)
++ png_set_swap_alpha(png_ptr);
++ }
++
++ else
++ format &= ~PNG_FORMAT_FLAG_AFIRST;
++
++ change &= ~PNG_FORMAT_FLAG_AFIRST;
++ }
++# endif
++
++ /* If the *output* is 16-bit then we need to check for a byte-swap on this
++ * architecture.
++ */
++ if (linear != 0)
++ {
++ PNG_CONST png_uint_16 le = 0x0001;
++
++ if ((*(png_const_bytep) & le) != 0)
++ png_set_swap(png_ptr);
++ }
++
++ /* If change is not now 0 some transformation is missing - error out. */
++ if (change != 0)
++ png_error(png_ptr, "png_read_image: unsupported transformation");
++ }
++
++ PNG_SKIP_CHUNKS(png_ptr);
++
++ /* Update the 'info' structure and make sure the result is as required; first
++ * make sure to turn on the interlace handling if it will be required
++ * (because it can't be turned on *after* the call to png_read_update_info!)
++ *
++ * TODO: remove the do_local_background fixup below.
++ */
++ if (do_local_compose == 0 && do_local_background != 2)
++ passes = png_set_interlace_handling(png_ptr);
++
++ png_read_update_info(png_ptr, info_ptr);
++
++ {
++ png_uint_32 info_format = 0;
++
++ if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
++ info_format |= PNG_FORMAT_FLAG_COLOR;
++
++ if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
++ {
++ /* do_local_compose removes this channel below. */
++ if (do_local_compose == 0)
++ {
++ /* do_local_background does the same if required. */
++ if (do_local_background != 2 ||
++ (format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ info_format |= PNG_FORMAT_FLAG_ALPHA;
++ }
++ }
++
++ else if (do_local_compose != 0) /* internal error */
++ png_error(png_ptr, "png_image_read: alpha channel lost");
++
++ if (info_ptr->bit_depth == 16)
++ info_format |= PNG_FORMAT_FLAG_LINEAR;
++
++# ifdef PNG_FORMAT_BGR_SUPPORTED
++ if ((png_ptr->transformations & PNG_BGR) != 0)
++ info_format |= PNG_FORMAT_FLAG_BGR;
++# endif
++
++# ifdef PNG_FORMAT_AFIRST_SUPPORTED
++ if (do_local_background == 2)
++ {
++ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ info_format |= PNG_FORMAT_FLAG_AFIRST;
++ }
++
++ if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0 ||
++ ((png_ptr->transformations & PNG_ADD_ALPHA) != 0 &&
++ (png_ptr->flags & PNG_FLAG_FILLER_AFTER) == 0))
++ {
++ if (do_local_background == 2)
++ png_error(png_ptr, "unexpected alpha swap transformation");
++
++ info_format |= PNG_FORMAT_FLAG_AFIRST;
++ }
++# endif
++
++ /* This is actually an internal error. */
++ if (info_format != format)
++ png_error(png_ptr, "png_read_image: invalid transformations");
++ }
++
++ /* Now read the rows. If do_local_compose is set then it is necessary to use
++ * a local row buffer. The output will be GA, RGBA or BGRA and must be
++ * converted to G, RGB or BGR as appropriate. The 'local_row' member of the
++ * display acts as a flag.
++ */
++ {
++ png_voidp first_row = display->buffer;
++ ptrdiff_t row_bytes = display->row_stride;
++
++ if (linear != 0)
++ row_bytes *= 2;
++
++ /* The following expression is designed to work correctly whether it gives
++ * a signed or an unsigned result.
++ */
++ if (row_bytes < 0)
++ {
++ char *ptr = png_voidcast(char*, first_row);
++ ptr += (image->height-1) * (-row_bytes);
++ first_row = png_voidcast(png_voidp, ptr);
++ }
++
++ display->first_row = first_row;
++ display->row_bytes = row_bytes;
++ }
++
++ if (do_local_compose != 0)
++ {
++ int result;
++ png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
++
++ display->local_row = row;
++ result = png_safe_execute(image, png_image_read_composite, display);
++ display->local_row = NULL;
++ png_free(png_ptr, row);
++
++ return result;
++ }
++
++ else if (do_local_background == 2)
++ {
++ int result;
++ png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));
++
++ display->local_row = row;
++ result = png_safe_execute(image, png_image_read_background, display);
++ display->local_row = NULL;
++ png_free(png_ptr, row);
++
++ return result;
++ }
++
++ else
++ {
++ png_alloc_size_t row_bytes = display->row_bytes;
++
++ while (--passes >= 0)
++ {
++ png_uint_32 y = image->height;
++ png_bytep row = png_voidcast(png_bytep, display->first_row);
++
++ while (y-- > 0)
++ {
++ png_read_row(png_ptr, row, NULL);
++ row += row_bytes;
++ }
++ }
++
++ return 1;
++ }
++}
++
++int PNGAPI
++png_image_finish_read(png_imagep image, png_const_colorp background,
++ void *buffer, png_int_32 row_stride, void *colormap)
++{
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ png_uint_32 check;
++
++ if (row_stride == 0)
++ row_stride = PNG_IMAGE_ROW_STRIDE(*image);
++
++ if (row_stride < 0)
++ check = -row_stride;
++
++ else
++ check = row_stride;
++
++ if (image->opaque != NULL && buffer != NULL &&
++ check >= PNG_IMAGE_ROW_STRIDE(*image))
++ {
++ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
++ (image->colormap_entries > 0 && colormap != NULL))
++ {
++ int result;
++ png_image_read_control display;
++
++ memset(&display, 0, (sizeof display));
++ display.image = image;
++ display.buffer = buffer;
++ display.row_stride = row_stride;
++ display.colormap = colormap;
++ display.background = background;
++ display.local_row = NULL;
++
++ /* Choose the correct 'end' routine; for the color-map case all the
++ * setup has already been done.
++ */
++ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
++ result =
++ png_safe_execute(image, png_image_read_colormap, &display) &&
++ png_safe_execute(image, png_image_read_colormapped, &display);
++
++ else
++ result =
++ png_safe_execute(image, png_image_read_direct, &display);
++
++ png_image_free(image);
++ return result;
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_finish_read[color-map]: no color-map");
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_finish_read: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_finish_read: damaged PNG_IMAGE_VERSION");
++
++ return 0;
++}
++
++#endif /* SIMPLIFIED_READ */
++#endif /* READ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngrio.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngrio.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.0 [January 6, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -57,7 +57,7 @@
+ * to read more then 64K on a 16 bit machine.
+ */
+ void /* PRIVATE */
+-png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
++png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
+ {
+ png_debug1(4, "reading %d bytes", (int)length);
+
+@@ -74,7 +74,6 @@
+ * read_data function and use it at run time with png_set_read_fn(), rather
+ * than changing the library.
+ */
+-# ifndef USE_FAR_KEYWORD
+ void PNGCBAPI
+ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+@@ -86,68 +85,11 @@
+ /* fread() returns 0 on error, so it is OK to store this in a png_size_t
+ * instead of an int, which is what fread() actually returns.
+ */
+- check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
++ check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
+
+ if (check != length)
+ png_error(png_ptr, "Read Error");
+ }
+-# else
+-/* This is the model-independent version. Since the standard I/O library
+- can't handle far buffers in the medium and small models, we have to copy
+- the data.
+-*/
+-
+-#define NEAR_BUF_SIZE 1024
+-#define MIN(a,b) (a <= b ? a : b)
+-
+-static void PNGCBAPI
+-png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+-{
+- png_size_t check;
+- png_byte *n_data;
+- png_FILE_p io_ptr;
+-
+- if (png_ptr == NULL)
+- return;
+-
+- /* Check if data really is near. If so, use usual code. */
+- n_data = (png_byte *)CVT_PTR_NOCHECK(data);
+- io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
+-
+- if ((png_bytep)n_data == data)
+- {
+- check = fread(n_data, 1, length, io_ptr);
+- }
+-
+- else
+- {
+- png_byte buf[NEAR_BUF_SIZE];
+- png_size_t read, remaining, err;
+- check = 0;
+- remaining = length;
+-
+- do
+- {
+- read = MIN(NEAR_BUF_SIZE, remaining);
+- err = fread(buf, 1, read, io_ptr);
+- png_memcpy(data, buf, read); /* copy far buffer to near buffer */
+-
+- if (err != read)
+- break;
+-
+- else
+- check += err;
+-
+- data += read;
+- remaining -= read;
+- }
+- while (remaining != 0);
+- }
+-
+- if ((png_uint_32)check != (png_uint_32)length)
+- png_error(png_ptr, "read Error");
+-}
+-# endif
+ #endif
+
+ /* This function allows the application to supply a new input function
+@@ -170,7 +112,7 @@
+ * be used.
+ */
+ void PNGAPI
+-png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
++png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
+ png_rw_ptr read_data_fn)
+ {
+ if (png_ptr == NULL)
+@@ -188,6 +130,7 @@
+ png_ptr->read_data_fn = read_data_fn;
+ #endif
+
++#ifdef PNG_WRITE_SUPPORTED
+ /* It is an error to write to a read device */
+ if (png_ptr->write_data_fn != NULL)
+ {
+@@ -196,9 +139,10 @@
+ "Can't set both read_data_fn and write_data_fn in the"
+ " same structure");
+ }
++#endif
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ png_ptr->output_flush_fn = NULL;
+ #endif
+ }
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* READ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngrtran.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngrtran.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -50,7 +50,7 @@
+
+ /* Set the action on getting a CRC error for an ancillary or critical chunk. */
+ void PNGAPI
+-png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
++png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
+ {
+ png_debug(1, "in png_set_crc_action");
+
+@@ -116,16 +116,47 @@
+ }
+ }
+
++#ifdef PNG_READ_TRANSFORMS_SUPPORTED
++/* Is it OK to set a transformation now? Only if png_start_read_image or
++ * png_read_update_info have not been called. It is not necessary for the IHDR
++ * to have been read in all cases; the need_IHDR parameter allows for this
++ * check too.
++ */
++static int
++png_rtran_ok(png_structrp png_ptr, int need_IHDR)
++{
++ if (png_ptr != NULL)
++ {
++ if ((png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
++ png_app_error(png_ptr,
++ "invalid after png_start_read_image or png_read_update_info");
++
++ else if (need_IHDR && (png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_app_error(png_ptr, "invalid before the PNG header has been read");
++
++ else
++ {
++ /* Turn on failure to initialize correctly for all transforms. */
++ png_ptr->flags |= PNG_FLAG_DETECT_UNINITIALIZED;
++
++ return 1; /* Ok */
++ }
++ }
++
++ return 0; /* no png_error possible! */
++}
++#endif
++
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+ /* Handle alpha and tRNS via a background color */
+ void PNGFAPI
+-png_set_background_fixed(png_structp png_ptr,
++png_set_background_fixed(png_structrp png_ptr,
+ png_const_color_16p background_color, int background_gamma_code,
+ int need_expand, png_fixed_point background_gamma)
+ {
+ png_debug(1, "in png_set_background_fixed");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0 || background_color == NULL)
+ return;
+
+ if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
+@@ -138,11 +169,10 @@
+ png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
+ png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
+
+- png_memcpy(&(png_ptr->background), background_color,
+- png_sizeof(png_color_16));
++ png_ptr->background = *background_color;
+ png_ptr->background_gamma = background_gamma;
+ png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
+- if (need_expand)
++ if (need_expand != 0)
+ png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
+ else
+ png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
+@@ -150,7 +180,7 @@
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_background(png_structp png_ptr,
++png_set_background(png_structrp png_ptr,
+ png_const_color_16p background_color, int background_gamma_code,
+ int need_expand, double background_gamma)
+ {
+@@ -166,11 +196,11 @@
+ */
+ #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ void PNGAPI
+-png_set_scale_16(png_structp png_ptr)
++png_set_scale_16(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_scale_16");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= PNG_SCALE_16_TO_8;
+@@ -180,11 +210,11 @@
+ #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+ /* Chop 16-bit depth files to 8-bit depth */
+ void PNGAPI
+-png_set_strip_16(png_structp png_ptr)
++png_set_strip_16(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_strip_16");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= PNG_16_TO_8;
+@@ -193,11 +223,11 @@
+
+ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+ void PNGAPI
+-png_set_strip_alpha(png_structp png_ptr)
++png_set_strip_alpha(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_strip_alpha");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= PNG_STRIP_ALPHA;
+@@ -206,7 +236,7 @@
+
+ #if defined(PNG_READ_ALPHA_MODE_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
+ static png_fixed_point
+-translate_gamma_flags(png_structp png_ptr, png_fixed_point output_gamma,
++translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
+ int is_screen)
+ {
+ /* Check for flag values. The main reason for having the old Mac value as a
+@@ -222,8 +252,10 @@
+ */
+ # ifdef PNG_READ_sRGB_SUPPORTED
+ png_ptr->flags |= PNG_FLAG_ASSUME_sRGB;
++# else
++ PNG_UNUSED(png_ptr)
+ # endif
+- if (is_screen)
++ if (is_screen != 0)
+ output_gamma = PNG_GAMMA_sRGB;
+ else
+ output_gamma = PNG_GAMMA_sRGB_INVERSE;
+@@ -232,7 +264,7 @@
+ else if (output_gamma == PNG_GAMMA_MAC_18 ||
+ output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18)
+ {
+- if (is_screen)
++ if (is_screen != 0)
+ output_gamma = PNG_GAMMA_MAC_OLD;
+ else
+ output_gamma = PNG_GAMMA_MAC_INVERSE;
+@@ -243,7 +275,7 @@
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ static png_fixed_point
+-convert_gamma_value(png_structp png_ptr, double output_gamma)
++convert_gamma_value(png_structrp png_ptr, double output_gamma)
+ {
+ /* The following silently ignores cases where fixed point (times 100,000)
+ * gamma values are passed to the floating point API. This is safe and it
+@@ -268,7 +300,7 @@
+
+ #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+ void PNGFAPI
+-png_set_alpha_mode_fixed(png_structp png_ptr, int mode,
++png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
+ png_fixed_point output_gamma)
+ {
+ int compose = 0;
+@@ -276,7 +308,7 @@
+
+ png_debug(1, "in png_set_alpha_mode");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
+@@ -348,8 +380,11 @@
+ * the side effect that the gamma in a second call to png_set_alpha_mode will
+ * be ignored.)
+ */
+- if (png_ptr->gamma == 0)
+- png_ptr->gamma = file_gamma;
++ if (png_ptr->colorspace.gamma == 0)
++ {
++ png_ptr->colorspace.gamma = file_gamma;
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
++ }
+
+ /* But always set the output gamma: */
+ png_ptr->screen_gamma = output_gamma;
+@@ -357,28 +392,25 @@
+ /* Finally, if pre-multiplying, set the background fields to achieve the
+ * desired result.
+ */
+- if (compose)
++ if (compose != 0)
+ {
+ /* And obtain alpha pre-multiplication by composing on black: */
+- png_memset(&png_ptr->background, 0, sizeof png_ptr->background);
+- png_ptr->background_gamma = png_ptr->gamma; /* just in case */
++ memset(&png_ptr->background, 0, (sizeof png_ptr->background));
++ png_ptr->background_gamma = png_ptr->colorspace.gamma; /* just in case */
+ png_ptr->background_gamma_type = PNG_BACKGROUND_GAMMA_FILE;
+ png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
+
+- if (png_ptr->transformations & PNG_COMPOSE)
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0)
+ png_error(png_ptr,
+ "conflicting calls to set alpha mode and background");
+
+ png_ptr->transformations |= PNG_COMPOSE;
+ }
+-
+- /* New API, make sure apps call the correct initializers: */
+- png_ptr->flags |= PNG_FLAG_DETECT_UNINITIALIZED;
+ }
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_alpha_mode(png_structp png_ptr, int mode, double output_gamma)
++png_set_alpha_mode(png_structrp png_ptr, int mode, double output_gamma)
+ {
+ png_set_alpha_mode_fixed(png_ptr, mode, convert_gamma_value(png_ptr,
+ output_gamma));
+@@ -398,31 +430,31 @@
+
+ typedef struct png_dsort_struct
+ {
+- struct png_dsort_struct FAR * next;
++ struct png_dsort_struct * next;
+ png_byte left;
+ png_byte right;
+ } png_dsort;
+-typedef png_dsort FAR * png_dsortp;
+-typedef png_dsort FAR * FAR * png_dsortpp;
++typedef png_dsort * png_dsortp;
++typedef png_dsort * * png_dsortpp;
+
+ void PNGAPI
+-png_set_quantize(png_structp png_ptr, png_colorp palette,
++png_set_quantize(png_structrp png_ptr, png_colorp palette,
+ int num_palette, int maximum_colors, png_const_uint_16p histogram,
+ int full_quantize)
+ {
+ png_debug(1, "in png_set_quantize");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= PNG_QUANTIZE;
+
+- if (!full_quantize)
++ if (full_quantize == 0)
+ {
+ int i;
+
+ png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
+- (png_uint_32)(num_palette * png_sizeof(png_byte)));
++ (png_uint_32)(num_palette * (sizeof (png_byte))));
+ for (i = 0; i < num_palette; i++)
+ png_ptr->quantize_index[i] = (png_byte)i;
+ }
+@@ -439,7 +471,7 @@
+
+ /* Initialize an array to sort colors */
+ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
+- (png_uint_32)(num_palette * png_sizeof(png_byte)));
++ (png_uint_32)(num_palette * (sizeof (png_byte))));
+
+ /* Initialize the quantize_sort array */
+ for (i = 0; i < num_palette; i++)
+@@ -472,12 +504,12 @@
+ }
+ }
+
+- if (done)
++ if (done != 0)
+ break;
+ }
+
+ /* Swap the palette around, and set up a table, if necessary */
+- if (full_quantize)
++ if (full_quantize != 0)
+ {
+ int j = num_palette;
+
+@@ -573,9 +605,9 @@
+
+ /* Initialize palette index arrays */
+ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
+- (png_uint_32)(num_palette * png_sizeof(png_byte)));
++ (png_uint_32)(num_palette * (sizeof (png_byte))));
+ png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
+- (png_uint_32)(num_palette * png_sizeof(png_byte)));
++ (png_uint_32)(num_palette * (sizeof (png_byte))));
+
+ /* Initialize the sort array */
+ for (i = 0; i < num_palette; i++)
+@@ -585,7 +617,7 @@
+ }
+
+ hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
+- png_sizeof(png_dsortp)));
++ (sizeof (png_dsortp))));
+
+ num_new_palette = num_palette;
+
+@@ -615,7 +647,7 @@
+ {
+
+ t = (png_dsortp)png_malloc_warn(png_ptr,
+- (png_uint_32)(png_sizeof(png_dsort)));
++ (png_uint_32)(sizeof (png_dsort)));
+
+ if (t == NULL)
+ break;
+@@ -660,7 +692,7 @@
+ num_new_palette--;
+ palette[png_ptr->index_to_palette[j]]
+ = palette[num_new_palette];
+- if (!full_quantize)
++ if (full_quantize == 0)
+ {
+ int k;
+
+@@ -728,7 +760,7 @@
+ }
+ png_ptr->num_palette = (png_uint_16)num_palette;
+
+- if (full_quantize)
++ if (full_quantize != 0)
+ {
+ int i;
+ png_bytep distance;
+@@ -740,12 +772,12 @@
+ png_size_t num_entries = ((png_size_t)1 << total_bits);
+
+ png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
+- (png_uint_32)(num_entries * png_sizeof(png_byte)));
++ (png_uint_32)(num_entries * (sizeof (png_byte))));
+
+ distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
+- png_sizeof(png_byte)));
+-
+- png_memset(distance, 0xff, num_entries * png_sizeof(png_byte));
++ (sizeof (png_byte))));
++
++ memset(distance, 0xff, num_entries * (sizeof (png_byte)));
+
+ for (i = 0; i < num_palette; i++)
+ {
+@@ -790,23 +822,22 @@
+ png_free(png_ptr, distance);
+ }
+ }
+-#endif /* PNG_READ_QUANTIZE_SUPPORTED */
++#endif /* READ_QUANTIZE */
+
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+ void PNGFAPI
+-png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
++png_set_gamma_fixed(png_structrp png_ptr, png_fixed_point scrn_gamma,
+ png_fixed_point file_gamma)
+ {
+ png_debug(1, "in png_set_gamma_fixed");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ /* New in libpng-1.5.4 - reserve particular negative values as flags. */
+ scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/);
+ file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/);
+
+-#if PNG_LIBPNG_VER >= 10600
+ /* Checking the gamma values for being >0 was added in 1.5.4 along with the
+ * premultiplied alpha support; this actually hides an undocumented feature
+ * of the previous implementation which allowed gamma processing to be
+@@ -815,31 +846,32 @@
+ * accept '0' for the gamma value it takes, because it isn't always used.
+ *
+ * Since this is an API change (albeit a very minor one that removes an
+- * undocumented API feature) it will not be made until libpng-1.6.0.
++ * undocumented API feature) the following checks were only enabled in
++ * libpng-1.6.0.
+ */
+ if (file_gamma <= 0)
+ png_error(png_ptr, "invalid file gamma in png_set_gamma");
+
+ if (scrn_gamma <= 0)
+ png_error(png_ptr, "invalid screen gamma in png_set_gamma");
+-#endif
+
+ /* Set the gamma values unconditionally - this overrides the value in the PNG
+ * file if a gAMA chunk was present. png_set_alpha_mode provides a
+ * different, easier, way to default the file gamma.
+ */
+- png_ptr->gamma = file_gamma;
++ png_ptr->colorspace.gamma = file_gamma;
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
+ png_ptr->screen_gamma = scrn_gamma;
+ }
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
++png_set_gamma(png_structrp png_ptr, double scrn_gamma, double file_gamma)
+ {
+ png_set_gamma_fixed(png_ptr, convert_gamma_value(png_ptr, scrn_gamma),
+ convert_gamma_value(png_ptr, file_gamma));
+ }
+-# endif /* FLOATING_POINT_SUPPORTED */
++# endif /* FLOATING_POINT */
+ #endif /* READ_GAMMA */
+
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+@@ -848,15 +880,14 @@
+ * to alpha channels.
+ */
+ void PNGAPI
+-png_set_expand(png_structp png_ptr)
++png_set_expand(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_expand");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+ }
+
+ /* GRR 19990627: the following three functions currently are identical
+@@ -879,100 +910,95 @@
+
+ /* Expand paletted images to RGB. */
+ void PNGAPI
+-png_set_palette_to_rgb(png_structp png_ptr)
++png_set_palette_to_rgb(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_palette_to_rgb");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+ }
+
+ /* Expand grayscale images of less than 8-bit depth to 8 bits. */
+ void PNGAPI
+-png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
++png_set_expand_gray_1_2_4_to_8(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= PNG_EXPAND;
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+ }
+
+-
+-
+ /* Expand tRNS chunks to alpha channels. */
+ void PNGAPI
+-png_set_tRNS_to_alpha(png_structp png_ptr)
++png_set_tRNS_to_alpha(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_tRNS_to_alpha");
+
++ if (png_rtran_ok(png_ptr, 0) == 0)
++ return;
++
+ png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+ }
+-#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
++#endif /* READ_EXPAND */
+
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+ /* Expand to 16-bit channels, expand the tRNS chunk too (because otherwise
+ * it may not work correctly.)
+ */
+ void PNGAPI
+-png_set_expand_16(png_structp png_ptr)
++png_set_expand_16(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_expand_16");
+
+- if (png_ptr == NULL)
++ if (png_rtran_ok(png_ptr, 0) == 0)
+ return;
+
+ png_ptr->transformations |= (PNG_EXPAND_16 | PNG_EXPAND | PNG_EXPAND_tRNS);
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+-
+- /* New API, make sure apps call the correct initializers: */
+- png_ptr->flags |= PNG_FLAG_DETECT_UNINITIALIZED;
+ }
+ #endif
+
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ void PNGAPI
+-png_set_gray_to_rgb(png_structp png_ptr)
++png_set_gray_to_rgb(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_gray_to_rgb");
+
+- if (png_ptr != NULL)
+- {
+- /* Because rgb must be 8 bits or more: */
+- png_set_expand_gray_1_2_4_to_8(png_ptr);
+- png_ptr->transformations |= PNG_GRAY_TO_RGB;
+- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
+- }
++ if (png_rtran_ok(png_ptr, 0) == 0)
++ return;
++
++ /* Because rgb must be 8 bits or more: */
++ png_set_expand_gray_1_2_4_to_8(png_ptr);
++ png_ptr->transformations |= PNG_GRAY_TO_RGB;
+ }
+ #endif
+
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ void PNGFAPI
+-png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
++png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
+ png_fixed_point red, png_fixed_point green)
+ {
+ png_debug(1, "in png_set_rgb_to_gray");
+
+- if (png_ptr == NULL)
++ /* Need the IHDR here because of the check on color_type below. */
++ /* TODO: fix this */
++ if (png_rtran_ok(png_ptr, 1) == 0)
+ return;
+
+- switch(error_action)
++ switch (error_action)
+ {
+- case 1:
++ case PNG_ERROR_ACTION_NONE:
+ png_ptr->transformations |= PNG_RGB_TO_GRAY;
+ break;
+
+- case 2:
++ case PNG_ERROR_ACTION_WARN:
+ png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN;
+ break;
+
+- case 3:
++ case PNG_ERROR_ACTION_ERROR:
+ png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
+ break;
+
+@@ -980,15 +1006,19 @@
+ png_error(png_ptr, "invalid error action to rgb_to_gray");
+ break;
+ }
++
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+ png_ptr->transformations |= PNG_EXPAND;
+ #else
+ {
+- png_warning(png_ptr,
++ /* Make this an error in 1.6 because otherwise the application may assume
++ * that it just worked and get a memory overwrite.
++ */
++ png_error(png_ptr,
+ "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED");
+
+- png_ptr->transformations &= ~PNG_RGB_TO_GRAY;
++ /* png_ptr->transformations &= ~PNG_RGB_TO_GRAY; */
+ }
+ #endif
+ {
+@@ -996,32 +1026,37 @@
+ {
+ png_uint_16 red_int, green_int;
+
+- red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L);
+- green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L);
++ /* NOTE: this calculation does not round, but this behavior is retained
++ * for consistency; the inaccuracy is very small. The code here always
++ * overwrites the coefficients, regardless of whether they have been
++ * defaulted or set already.
++ */
++ red_int = (png_uint_16)(((png_uint_32)red*32768)/100000);
++ green_int = (png_uint_16)(((png_uint_32)green*32768)/100000);
+
+ png_ptr->rgb_to_gray_red_coeff = red_int;
+ png_ptr->rgb_to_gray_green_coeff = green_int;
+- png_ptr->rgb_to_gray_blue_coeff =
+- (png_uint_16)(32768 - red_int - green_int);
++ png_ptr->rgb_to_gray_coefficients_set = 1;
+ }
+
+ else
+ {
+ if (red >= 0 && green >= 0)
+- png_warning(png_ptr,
++ png_app_warning(png_ptr,
+ "ignoring out of range rgb_to_gray coefficients");
+
+- /* Use the defaults, from the cHRM chunk if set, else the built in Rec
+- * 709 values (which correspond to sRGB, so we don't have to worry
+- * about the sRGB chunk!)
++ /* Use the defaults, from the cHRM chunk if set, else the historical
++ * values which are close to the sRGB/HDTV/ITU-Rec 709 values. See
++ * png_do_rgb_to_gray for more discussion of the values. In this case
++ * the coefficients are not marked as 'set' and are not overwritten if
++ * something has already provided a default.
+ */
+ if (png_ptr->rgb_to_gray_red_coeff == 0 &&
+- png_ptr->rgb_to_gray_green_coeff == 0 &&
+- png_ptr->rgb_to_gray_blue_coeff == 0)
++ png_ptr->rgb_to_gray_green_coeff == 0)
+ {
+- png_ptr->rgb_to_gray_red_coeff = 6968; /* .212671 * 32768 + .5 */
+- png_ptr->rgb_to_gray_green_coeff = 23434; /* .715160 * 32768 + .5 */
+- png_ptr->rgb_to_gray_blue_coeff = 2366;
++ png_ptr->rgb_to_gray_red_coeff = 6968;
++ png_ptr->rgb_to_gray_green_coeff = 23434;
++ /* png_ptr->rgb_to_gray_blue_coeff = 2366; */
+ }
+ }
+ }
+@@ -1033,31 +1068,25 @@
+ */
+
+ void PNGAPI
+-png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
++png_set_rgb_to_gray(png_structrp png_ptr, int error_action, double red,
+ double green)
+ {
+- if (png_ptr == NULL)
+- return;
+-
+ png_set_rgb_to_gray_fixed(png_ptr, error_action,
+ png_fixed(png_ptr, red, "rgb to gray red coefficient"),
+ png_fixed(png_ptr, green, "rgb to gray green coefficient"));
+ }
+ #endif /* FLOATING POINT */
+
+-#endif
++#endif /* RGB_TO_GRAY */
+
+ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+ void PNGAPI
+-png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
++png_set_read_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
+ read_user_transform_fn)
+ {
+ png_debug(1, "in png_set_read_user_transform_fn");
+
+- if (png_ptr == NULL)
+- return;
+-
+ #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ png_ptr->transformations |= PNG_USER_TRANSFORM;
+ png_ptr->read_user_transform_fn = read_user_transform_fn;
+@@ -1091,13 +1120,13 @@
+ * the palette.
+ */
+
+-/*For the moment 'png_init_palette_transformations' and
++/* For the moment 'png_init_palette_transformations' and
+ * 'png_init_rgb_transformations' only do some flag canceling optimizations.
+ * The intent is that these two routines should have palette or rgb operations
+ * extracted from 'png_init_read_transformations'.
+ */
+ static void /* PRIVATE */
+-png_init_palette_transformations(png_structp png_ptr)
++png_init_palette_transformations(png_structrp png_ptr)
+ {
+ /* Called to handle the (input) palette case. In png_do_read_transformations
+ * the first step is to expand the palette if requested, so this code must
+@@ -1116,25 +1145,31 @@
+
+ /* Ignore if all the entries are opaque (unlikely!) */
+ for (i=0; i<png_ptr->num_trans; ++i)
++ {
+ if (png_ptr->trans_alpha[i] == 255)
+ continue;
+ else if (png_ptr->trans_alpha[i] == 0)
+ input_has_transparency = 1;
+ else
++ {
++ input_has_transparency = 1;
+ input_has_alpha = 1;
++ break;
++ }
++ }
+ }
+
+ /* If no alpha we can optimize. */
+- if (!input_has_alpha)
++ if (input_has_alpha == 0)
+ {
+ /* Any alpha means background and associative alpha processing is
+- * required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
++ * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
+ * and ENCODE_ALPHA are irrelevant.
+ */
+ png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
+ png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
+
+- if (!input_has_transparency)
++ if (input_has_transparency == 0)
+ png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
+ }
+
+@@ -1147,8 +1182,8 @@
+ /* The following code cannot be entered in the alpha pre-multiplication case
+ * because PNG_BACKGROUND_EXPAND is cancelled below.
+ */
+- if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
+- (png_ptr->transformations & PNG_EXPAND))
++ if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0 &&
++ (png_ptr->transformations & PNG_EXPAND) != 0)
+ {
+ {
+ png_ptr->background.red =
+@@ -1159,9 +1194,9 @@
+ png_ptr->palette[png_ptr->background.index].blue;
+
+ #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_INVERT_ALPHA)
++ if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
+ {
+- if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
++ if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
+ {
+ /* Invert the alpha channel (in tRNS) unless the pixels are
+ * going to be expanded, in which case leave it for later
+@@ -1173,14 +1208,14 @@
+ png_ptr->trans_alpha[i]);
+ }
+ }
+-#endif /* PNG_READ_INVERT_ALPHA_SUPPORTED */
++#endif /* READ_INVERT_ALPHA */
+ }
+ } /* background expand and (therefore) no alpha association. */
+-#endif /* PNG_READ_EXPAND_SUPPORTED && PNG_READ_BACKGROUND_SUPPORTED */
++#endif /* READ_EXPAND && READ_BACKGROUND */
+ }
+
+ static void /* PRIVATE */
+-png_init_rgb_transformations(png_structp png_ptr)
++png_init_rgb_transformations(png_structrp png_ptr)
+ {
+ /* Added to libpng-1.5.4: check the color type to determine whether there
+ * is any alpha or transparency in the image and simply cancel the
+@@ -1190,10 +1225,10 @@
+ int input_has_transparency = png_ptr->num_trans > 0;
+
+ /* If no alpha we can optimize. */
+- if (!input_has_alpha)
++ if (input_has_alpha == 0)
+ {
+ /* Any alpha means background and associative alpha processing is
+- * required, however if the alpha is 0 or 1 throughout OPTIIMIZE_ALPHA
++ * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
+ * and ENCODE_ALPHA are irrelevant.
+ */
+ # ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+@@ -1201,7 +1236,7 @@
+ png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
+ # endif
+
+- if (!input_has_transparency)
++ if (input_has_transparency == 0)
+ png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
+ }
+
+@@ -1214,67 +1249,58 @@
+ /* The following code cannot be entered in the alpha pre-multiplication case
+ * because PNG_BACKGROUND_EXPAND is cancelled below.
+ */
+- if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
+- (png_ptr->transformations & PNG_EXPAND) &&
+- !(png_ptr->color_type & PNG_COLOR_MASK_COLOR))
++ if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0 &&
++ (png_ptr->transformations & PNG_EXPAND) != 0 &&
++ (png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
+ /* i.e., GRAY or GRAY_ALPHA */
+ {
+ {
+ /* Expand background and tRNS chunks */
++ int gray = png_ptr->background.gray;
++ int trans_gray = png_ptr->trans_color.gray;
++
+ switch (png_ptr->bit_depth)
+ {
+ case 1:
+- png_ptr->background.gray *= (png_uint_16)0xff;
+- png_ptr->background.red = png_ptr->background.green
+- = png_ptr->background.blue = png_ptr->background.gray;
+- if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
+- {
+- png_ptr->trans_color.gray *= (png_uint_16)0xff;
+- png_ptr->trans_color.red = png_ptr->trans_color.green
+- = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
+- }
++ gray *= 0xff;
++ trans_gray *= 0xff;
+ break;
+
+ case 2:
+- png_ptr->background.gray *= (png_uint_16)0x55;
+- png_ptr->background.red = png_ptr->background.green
+- = png_ptr->background.blue = png_ptr->background.gray;
+- if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
+- {
+- png_ptr->trans_color.gray *= (png_uint_16)0x55;
+- png_ptr->trans_color.red = png_ptr->trans_color.green
+- = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
+- }
++ gray *= 0x55;
++ trans_gray *= 0x55;
+ break;
+
+ case 4:
+- png_ptr->background.gray *= (png_uint_16)0x11;
+- png_ptr->background.red = png_ptr->background.green
+- = png_ptr->background.blue = png_ptr->background.gray;
+- if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
+- {
+- png_ptr->trans_color.gray *= (png_uint_16)0x11;
+- png_ptr->trans_color.red = png_ptr->trans_color.green
+- = png_ptr->trans_color.blue = png_ptr->trans_color.gray;
+- }
++ gray *= 0x11;
++ trans_gray *= 0x11;
+ break;
+
+ default:
+
+ case 8:
++ /* FALL THROUGH (Already 8 bits) */
+
+ case 16:
+- png_ptr->background.red = png_ptr->background.green
+- = png_ptr->background.blue = png_ptr->background.gray;
++ /* Already a full 16 bits */
+ break;
+ }
++
++ png_ptr->background.red = png_ptr->background.green =
++ png_ptr->background.blue = (png_uint_16)gray;
++
++ if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
++ {
++ png_ptr->trans_color.red = png_ptr->trans_color.green =
++ png_ptr->trans_color.blue = (png_uint_16)trans_gray;
++ }
+ }
+ } /* background expand and (therefore) no alpha association. */
+-#endif /* PNG_READ_EXPAND_SUPPORTED && PNG_READ_BACKGROUND_SUPPORTED */
++#endif /* READ_EXPAND && READ_BACKGROUND */
+ }
+
+ void /* PRIVATE */
+-png_init_read_transformations(png_structp png_ptr)
++png_init_read_transformations(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_init_read_transformations");
+
+@@ -1299,17 +1325,17 @@
+ */
+ int gamma_correction = 0;
+
+- if (png_ptr->gamma != 0) /* has been set */
++ if (png_ptr->colorspace.gamma != 0) /* has been set */
+ {
+ if (png_ptr->screen_gamma != 0) /* screen set too */
+- gamma_correction = png_gamma_threshold(png_ptr->gamma,
++ gamma_correction = png_gamma_threshold(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma);
+
+ else
+ /* Assume the output matches the input; a long time default behavior
+ * of libpng, although the standard has nothing to say about this.
+ */
+- png_ptr->screen_gamma = png_reciprocal(png_ptr->gamma);
++ png_ptr->screen_gamma = png_reciprocal(png_ptr->colorspace.gamma);
+ }
+
+ else if (png_ptr->screen_gamma != 0)
+@@ -1318,7 +1344,7 @@
+ * png_set_alpha_mode (even if the alpha handling mode isn't required
+ * or isn't changed from the default.)
+ */
+- png_ptr->gamma = png_reciprocal(png_ptr->screen_gamma);
++ png_ptr->colorspace.gamma = png_reciprocal(png_ptr->screen_gamma);
+
+ else /* neither are set */
+ /* Just in case the following prevents any processing - file and screen
+@@ -1326,7 +1352,10 @@
+ * third gamma value other than png_set_background with 'UNIQUE', and,
+ * prior to 1.5.4
+ */
+- png_ptr->screen_gamma = png_ptr->gamma = PNG_FP_1;
++ png_ptr->screen_gamma = png_ptr->colorspace.gamma = PNG_FP_1;
++
++ /* We have a gamma value now. */
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
+
+ /* Now turn the gamma transformation on or off as appropriate. Notice
+ * that PNG_GAMMA just refers to the file->screen correction. Alpha
+@@ -1336,7 +1365,7 @@
+ * the code immediately below if the transform can be handled outside the
+ * row loop.
+ */
+- if (gamma_correction)
++ if (gamma_correction != 0)
+ png_ptr->transformations |= PNG_GAMMA;
+
+ else
+@@ -1345,7 +1374,7 @@
+ #endif
+
+ /* Certain transformations have the effect of preventing other
+- * transformations that happen afterward in png_do_read_transformations,
++ * transformations that happen afterward in png_do_read_transformations;
+ * resolve the interdependencies here. From the code of
+ * png_do_read_transformations the order is:
+ *
+@@ -1363,19 +1392,19 @@
+ * 12) PNG_EXPAND_16
+ * 13) PNG_GRAY_TO_RGB iff PNG_BACKGROUND_IS_GRAY
+ * 14) PNG_INVERT_MONO
+- * 15) PNG_SHIFT
+- * 16) PNG_PACK
+- * 17) PNG_BGR
+- * 18) PNG_PACKSWAP
+- * 19) PNG_FILLER (includes PNG_ADD_ALPHA)
+- * 20) PNG_INVERT_ALPHA
++ * 15) PNG_INVERT_ALPHA
++ * 16) PNG_SHIFT
++ * 17) PNG_PACK
++ * 18) PNG_BGR
++ * 19) PNG_PACKSWAP
++ * 20) PNG_FILLER (includes PNG_ADD_ALPHA)
+ * 21) PNG_SWAP_ALPHA
+ * 22) PNG_SWAP_BYTES
+ * 23) PNG_USER_TRANSFORM [must be last]
+ */
+ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+- if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
+- !(png_ptr->transformations & PNG_COMPOSE))
++ if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
++ (png_ptr->transformations & PNG_COMPOSE) == 0)
+ {
+ /* Stripping the alpha channel happens immediately after the 'expand'
+ * transformations, before all other transformation, so it cancels out
+@@ -1401,16 +1430,23 @@
+ /* If the screen gamma is about 1.0 then the OPTIMIZE_ALPHA and ENCODE_ALPHA
+ * settings will have no effect.
+ */
+- if (!png_gamma_significant(png_ptr->screen_gamma))
++ if (png_gamma_significant(png_ptr->screen_gamma) == 0)
+ {
+ png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
+ png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
+ }
+ #endif
+
+-#if defined(PNG_READ_EXPAND_SUPPORTED) && \
+- defined(PNG_READ_BACKGROUND_SUPPORTED) && \
+- defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++ /* Make sure the coefficients for the rgb to gray conversion are set
++ * appropriately.
++ */
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
++ png_colorspace_set_rgb_coefficients(png_ptr);
++#endif
++
++#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
++#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
+ /* Detect gray background and attempt to enable optimization for
+ * gray --> RGB case.
+ *
+@@ -1426,23 +1462,23 @@
+ * png_set_background, along with the bit depth, then the code has a record
+ * of exactly what color space the background is currently in.
+ */
+- if (png_ptr->transformations & PNG_BACKGROUND_EXPAND)
++ if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) != 0)
+ {
+ /* PNG_BACKGROUND_EXPAND: the background is in the file color space, so if
+- * the file was greyscale the background value is gray.
++ * the file was grayscale the background value is gray.
+ */
+- if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR))
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
+ png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
+ }
+
+- else if (png_ptr->transformations & PNG_COMPOSE)
++ else if ((png_ptr->transformations & PNG_COMPOSE) != 0)
+ {
+ /* PNG_COMPOSE: png_set_background was called with need_expand false,
+ * so the color is in the color space of the output or png_set_alpha_mode
+ * was called and the color is black. Ignore RGB_TO_GRAY because that
+ * happens before GRAY_TO_RGB.
+ */
+- if (png_ptr->transformations & PNG_GRAY_TO_RGB)
++ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
+ {
+ if (png_ptr->background.red == png_ptr->background.green &&
+ png_ptr->background.red == png_ptr->background.blue)
+@@ -1452,7 +1488,8 @@
+ }
+ }
+ }
+-#endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED (etc) */
++#endif /* READ_EXPAND && READ_BACKGROUND */
++#endif /* READ_GRAY_TO_RGB */
+
+ /* For indexed PNG data (PNG_COLOR_TYPE_PALETTE) many of the transformations
+ * can be performed directly on the palette, and some (such as rgb to gray)
+@@ -1473,10 +1510,10 @@
+
+ #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
+ defined(PNG_READ_EXPAND_16_SUPPORTED)
+- if ((png_ptr->transformations & PNG_EXPAND_16) &&
+- (png_ptr->transformations & PNG_COMPOSE) &&
+- !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
+- png_ptr->bit_depth != 16)
++ if ((png_ptr->transformations & PNG_EXPAND_16) != 0 &&
++ (png_ptr->transformations & PNG_COMPOSE) != 0 &&
++ (png_ptr->transformations & PNG_BACKGROUND_EXPAND) == 0 &&
++ png_ptr->bit_depth != 16)
+ {
+ /* TODO: fix this. Because the expand_16 operation is after the compose
+ * handling the background color must be 8, not 16, bits deep, but the
+@@ -1488,14 +1525,36 @@
+ * NOTE: this discards the low 16 bits of the user supplied background
+ * color, but until expand_16 works properly there is no choice!
+ */
+-# define CHOP(x) (x)=((png_uint_16)(((png_uint_32)(x)*255+32895) >> 16))
++# define CHOP(x) (x)=((png_uint_16)PNG_DIV257(x))
+ CHOP(png_ptr->background.red);
+ CHOP(png_ptr->background.green);
+ CHOP(png_ptr->background.blue);
+ CHOP(png_ptr->background.gray);
+ # undef CHOP
+ }
+-#endif /* PNG_READ_BACKGROUND_SUPPORTED && PNG_READ_EXPAND_16_SUPPORTED */
++#endif /* READ_BACKGROUND && READ_EXPAND_16 */
++
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
++ (defined(PNG_READ_SCALE_16_TO_8_SUPPORTED) || \
++ defined(PNG_READ_STRIP_16_TO_8_SUPPORTED))
++ if ((png_ptr->transformations & (PNG_16_TO_8|PNG_SCALE_16_TO_8)) != 0 &&
++ (png_ptr->transformations & PNG_COMPOSE) != 0 &&
++ (png_ptr->transformations & PNG_BACKGROUND_EXPAND) == 0 &&
++ png_ptr->bit_depth == 16)
++ {
++ /* On the other hand, if a 16-bit file is to be reduced to 8-bits per
++ * component this will also happen after PNG_COMPOSE and so the background
++ * color must be pre-expanded here.
++ *
++ * TODO: fix this too.
++ */
++ png_ptr->background.red = (png_uint_16)(png_ptr->background.red * 257);
++ png_ptr->background.green =
++ (png_uint_16)(png_ptr->background.green * 257);
++ png_ptr->background.blue = (png_uint_16)(png_ptr->background.blue * 257);
++ png_ptr->background.gray = (png_uint_16)(png_ptr->background.gray * 257);
++ }
++#endif
+
+ /* NOTE: below 'PNG_READ_ALPHA_MODE_SUPPORTED' is presumed to also enable the
+ * background support (see the comments in scripts/pnglibconf.dfa), this
+@@ -1524,27 +1583,36 @@
+ * file gamma - if it is not 1.0 both RGB_TO_GRAY and COMPOSE need the
+ * tables.
+ */
+- if ((png_ptr->transformations & PNG_GAMMA)
+- || ((png_ptr->transformations & PNG_RGB_TO_GRAY)
+- && (png_gamma_significant(png_ptr->gamma) ||
+- png_gamma_significant(png_ptr->screen_gamma)))
+- || ((png_ptr->transformations & PNG_COMPOSE)
+- && (png_gamma_significant(png_ptr->gamma)
+- || png_gamma_significant(png_ptr->screen_gamma)
++ if ((png_ptr->transformations & PNG_GAMMA) != 0 ||
++ ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0 &&
++ (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
++ png_gamma_significant(png_ptr->screen_gamma) != 0)) ||
++ ((png_ptr->transformations & PNG_COMPOSE) != 0 &&
++ (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
++ png_gamma_significant(png_ptr->screen_gamma) != 0
+ # ifdef PNG_READ_BACKGROUND_SUPPORTED
+- || (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_UNIQUE
+- && png_gamma_significant(png_ptr->background_gamma))
++ || (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_UNIQUE &&
++ png_gamma_significant(png_ptr->background_gamma) != 0)
+ # endif
+- )) || ((png_ptr->transformations & PNG_ENCODE_ALPHA)
+- && png_gamma_significant(png_ptr->screen_gamma))
+- )
++ )) || ((png_ptr->transformations & PNG_ENCODE_ALPHA) != 0 &&
++ png_gamma_significant(png_ptr->screen_gamma) != 0))
+ {
+ png_build_gamma_table(png_ptr, png_ptr->bit_depth);
+
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+- if (png_ptr->transformations & PNG_COMPOSE)
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0)
+ {
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ /* Issue a warning about this combination: because RGB_TO_GRAY is
++ * optimized to do the gamma transform if present yet do_background has
++ * to do the same thing if both options are set a
++ * double-gamma-correction happens. This is true in all versions of
++ * libpng to date.
++ */
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
++ png_warning(png_ptr,
++ "libpng does not support gamma+background+rgb_to_gray");
++
++ if ((png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) != 0)
+ {
+ /* We don't get to here unless there is a tRNS chunk with non-opaque
+ * entries - see the checking code at the start of this function.
+@@ -1576,8 +1644,8 @@
+ break;
+
+ case PNG_BACKGROUND_GAMMA_FILE:
+- g = png_reciprocal(png_ptr->gamma);
+- gs = png_reciprocal2(png_ptr->gamma,
++ g = png_reciprocal(png_ptr->colorspace.gamma);
++ gs = png_reciprocal2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma);
+ break;
+
+@@ -1592,7 +1660,7 @@
+ break;
+ }
+
+- if (png_gamma_significant(gs))
++ if (png_gamma_significant(gs) != 0)
+ {
+ back.red = png_gamma_8bit_correct(png_ptr->background.red,
+ gs);
+@@ -1609,7 +1677,7 @@
+ back.blue = (png_byte)png_ptr->background.blue;
+ }
+
+- if (png_gamma_significant(g))
++ if (png_gamma_significant(g) != 0)
+ {
+ back_1.red = png_gamma_8bit_correct(png_ptr->background.red,
+ g);
+@@ -1663,7 +1731,7 @@
+
+ /* Prevent the transformations being done again.
+ *
+- * NOTE: this is highly dubious; it zaps the transformations in
++ * NOTE: this is highly dubious; it removes the transformations in
+ * place. This seems inconsistent with the general treatment of the
+ * transformations elsewhere.
+ */
+@@ -1673,8 +1741,9 @@
+ /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
+ else /* color_type != PNG_COLOR_TYPE_PALETTE */
+ {
+- png_fixed_point g = PNG_FP_1;
+- png_fixed_point gs = PNG_FP_1;
++ int gs_sig, g_sig;
++ png_fixed_point g = PNG_FP_1; /* Correction to linear */
++ png_fixed_point gs = PNG_FP_1; /* Correction to screen */
+
+ switch (png_ptr->background_gamma_type)
+ {
+@@ -1684,8 +1753,9 @@
+ break;
+
+ case PNG_BACKGROUND_GAMMA_FILE:
+- g = png_reciprocal(png_ptr->gamma);
+- gs = png_reciprocal2(png_ptr->gamma, png_ptr->screen_gamma);
++ g = png_reciprocal(png_ptr->colorspace.gamma);
++ gs = png_reciprocal2(png_ptr->colorspace.gamma,
++ png_ptr->screen_gamma);
+ break;
+
+ case PNG_BACKGROUND_GAMMA_UNIQUE:
+@@ -1698,34 +1768,45 @@
+ png_error(png_ptr, "invalid background gamma type");
+ }
+
+- png_ptr->background_1.gray = png_gamma_correct(png_ptr,
+- png_ptr->background.gray, g);
+-
+- png_ptr->background.gray = png_gamma_correct(png_ptr,
+- png_ptr->background.gray, gs);
++ g_sig = png_gamma_significant(g);
++ gs_sig = png_gamma_significant(gs);
++
++ if (g_sig != 0)
++ png_ptr->background_1.gray = png_gamma_correct(png_ptr,
++ png_ptr->background.gray, g);
++
++ if (gs_sig != 0)
++ png_ptr->background.gray = png_gamma_correct(png_ptr,
++ png_ptr->background.gray, gs);
+
+ if ((png_ptr->background.red != png_ptr->background.green) ||
+ (png_ptr->background.red != png_ptr->background.blue) ||
+ (png_ptr->background.red != png_ptr->background.gray))
+ {
+ /* RGB or RGBA with color background */
+- png_ptr->background_1.red = png_gamma_correct(png_ptr,
+- png_ptr->background.red, g);
+-
+- png_ptr->background_1.green = png_gamma_correct(png_ptr,
+- png_ptr->background.green, g);
+-
+- png_ptr->background_1.blue = png_gamma_correct(png_ptr,
+- png_ptr->background.blue, g);
+-
+- png_ptr->background.red = png_gamma_correct(png_ptr,
+- png_ptr->background.red, gs);
+-
+- png_ptr->background.green = png_gamma_correct(png_ptr,
+- png_ptr->background.green, gs);
+-
+- png_ptr->background.blue = png_gamma_correct(png_ptr,
+- png_ptr->background.blue, gs);
++ if (g_sig != 0)
++ {
++ png_ptr->background_1.red = png_gamma_correct(png_ptr,
++ png_ptr->background.red, g);
++
++ png_ptr->background_1.green = png_gamma_correct(png_ptr,
++ png_ptr->background.green, g);
++
++ png_ptr->background_1.blue = png_gamma_correct(png_ptr,
++ png_ptr->background.blue, g);
++ }
++
++ if (gs_sig != 0)
++ {
++ png_ptr->background.red = png_gamma_correct(png_ptr,
++ png_ptr->background.red, gs);
++
++ png_ptr->background.green = png_gamma_correct(png_ptr,
++ png_ptr->background.green, gs);
++
++ png_ptr->background.blue = png_gamma_correct(png_ptr,
++ png_ptr->background.blue, gs);
++ }
+ }
+
+ else
+@@ -1737,20 +1818,29 @@
+ png_ptr->background.red = png_ptr->background.green
+ = png_ptr->background.blue = png_ptr->background.gray;
+ }
++
++ /* The background is now in screen gamma: */
++ png_ptr->background_gamma_type = PNG_BACKGROUND_GAMMA_SCREEN;
+ } /* color_type != PNG_COLOR_TYPE_PALETTE */
+ }/* png_ptr->transformations & PNG_BACKGROUND */
+
+ else
+ /* Transformation does not include PNG_BACKGROUND */
+-#endif /* PNG_READ_BACKGROUND_SUPPORTED */
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++#endif /* READ_BACKGROUND */
++ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++ /* RGB_TO_GRAY needs to have non-gamma-corrected values! */
++ && ((png_ptr->transformations & PNG_EXPAND) == 0 ||
++ (png_ptr->transformations & PNG_RGB_TO_GRAY) == 0)
++#endif
++ )
+ {
+ png_colorp palette = png_ptr->palette;
+ int num_palette = png_ptr->num_palette;
+ int i;
+
+- /*NOTE: there are other transformations that should probably be in here
+- * too.
++ /* NOTE: there are other transformations that should probably be in
++ * here too.
+ */
+ for (i = 0; i < num_palette; i++)
+ {
+@@ -1766,11 +1856,11 @@
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+ else
+ #endif
+-#endif /* PNG_READ_GAMMA_SUPPORTED */
++#endif /* READ_GAMMA */
+
+ #ifdef PNG_READ_BACKGROUND_SUPPORTED
+ /* No GAMMA transformation (see the hanging else 4 lines above) */
+- if ((png_ptr->transformations & PNG_COMPOSE) &&
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0 &&
+ (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
+ {
+ int i;
+@@ -1805,35 +1895,53 @@
+
+ png_ptr->transformations &= ~PNG_COMPOSE;
+ }
+-#endif /* PNG_READ_BACKGROUND_SUPPORTED */
++#endif /* READ_BACKGROUND */
+
+ #ifdef PNG_READ_SHIFT_SUPPORTED
+- if ((png_ptr->transformations & PNG_SHIFT) &&
++ if ((png_ptr->transformations & PNG_SHIFT) != 0 &&
++ (png_ptr->transformations & PNG_EXPAND) == 0 &&
+ (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
+ {
+- png_uint_16 i;
+- png_uint_16 istop = png_ptr->num_palette;
+- int sr = 8 - png_ptr->sig_bit.red;
+- int sg = 8 - png_ptr->sig_bit.green;
+- int sb = 8 - png_ptr->sig_bit.blue;
+-
+- if (sr < 0 || sr > 8)
+- sr = 0;
+-
+- if (sg < 0 || sg > 8)
+- sg = 0;
+-
+- if (sb < 0 || sb > 8)
+- sb = 0;
+-
+- for (i = 0; i < istop; i++)
+- {
+- png_ptr->palette[i].red >>= sr;
+- png_ptr->palette[i].green >>= sg;
+- png_ptr->palette[i].blue >>= sb;
+- }
++ int i;
++ int istop = png_ptr->num_palette;
++ int shift = 8 - png_ptr->sig_bit.red;
++
++ png_ptr->transformations &= ~PNG_SHIFT;
++
++ /* significant bits can be in the range 1 to 7 for a meaninful result, if
++ * the number of significant bits is 0 then no shift is done (this is an
++ * error condition which is silently ignored.)
++ */
++ if (shift > 0 && shift < 8)
++ for (i=0; i<istop; ++i)
++ {
++ int component = png_ptr->palette[i].red;
++
++ component >>= shift;
++ png_ptr->palette[i].red = (png_byte)component;
++ }
++
++ shift = 8 - png_ptr->sig_bit.green;
++ if (shift > 0 && shift < 8)
++ for (i=0; i<istop; ++i)
++ {
++ int component = png_ptr->palette[i].green;
++
++ component >>= shift;
++ png_ptr->palette[i].green = (png_byte)component;
++ }
++
++ shift = 8 - png_ptr->sig_bit.blue;
++ if (shift > 0 && shift < 8)
++ for (i=0; i<istop; ++i)
++ {
++ int component = png_ptr->palette[i].blue;
++
++ component >>= shift;
++ png_ptr->palette[i].blue = (png_byte)component;
++ }
+ }
+-#endif /* PNG_READ_SHIFT_SUPPORTED */
++#endif /* READ_SHIFT */
+ }
+
+ /* Modify the info structure to reflect the transformations. The
+@@ -1841,12 +1949,12 @@
+ * assuming the transformations result in valid PNG data.
+ */
+ void /* PRIVATE */
+-png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
++png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ png_debug(1, "in png_read_transform_info");
+
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+- if (png_ptr->transformations & PNG_EXPAND)
++ if ((png_ptr->transformations & PNG_EXPAND) != 0)
+ {
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+@@ -1868,9 +1976,9 @@
+ }
+ else
+ {
+- if (png_ptr->num_trans)
++ if (png_ptr->num_trans != 0)
+ {
+- if (png_ptr->transformations & PNG_EXPAND_tRNS)
++ if ((png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
+ info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ }
+ if (info_ptr->bit_depth < 8)
+@@ -1886,7 +1994,7 @@
+ /* The following is almost certainly wrong unless the background value is in
+ * the screen space!
+ */
+- if (png_ptr->transformations & PNG_COMPOSE)
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0)
+ info_ptr->background = png_ptr->background;
+ #endif
+
+@@ -1895,20 +2003,24 @@
+ * however it seems that the code in png_init_read_transformations, which has
+ * been called before this from png_read_update_info->png_read_start_row
+ * sometimes does the gamma transform and cancels the flag.
++ *
++ * TODO: this looks wrong; the info_ptr should end up with a gamma equal to
++ * the screen_gamma value. The following probably results in weirdness if
++ * the info_ptr is used by the app after the rows have been read.
+ */
+- info_ptr->gamma = png_ptr->gamma;
++ info_ptr->colorspace.gamma = png_ptr->colorspace.gamma;
+ #endif
+
+ if (info_ptr->bit_depth == 16)
+ {
+ # ifdef PNG_READ_16BIT_SUPPORTED
+ # ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+- if (png_ptr->transformations & PNG_SCALE_16_TO_8)
++ if ((png_ptr->transformations & PNG_SCALE_16_TO_8) != 0)
+ info_ptr->bit_depth = 8;
+ # endif
+
+ # ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+- if (png_ptr->transformations & PNG_16_TO_8)
++ if ((png_ptr->transformations & PNG_16_TO_8) != 0)
+ info_ptr->bit_depth = 8;
+ # endif
+
+@@ -1926,7 +2038,7 @@
+ info_ptr->bit_depth = 8;
+ # else
+
+-# if PNG_READ_SCALE_16_TO_8_SUPPORTED
++# ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ png_ptr->transformations |= PNG_SCALE_16_TO_8;
+ info_ptr->bit_depth = 8;
+ # else
+@@ -1934,25 +2046,27 @@
+ CONFIGURATION ERROR: you must enable at least one 16 to 8 method
+ # endif
+ # endif
+-#endif /* !READ_16BIT_SUPPORTED */
++#endif /* !READ_16BIT */
+ }
+
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+- if (png_ptr->transformations & PNG_GRAY_TO_RGB)
+- info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
++ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
++ info_ptr->color_type = (png_byte)(info_ptr->color_type |
++ PNG_COLOR_MASK_COLOR);
+ #endif
+
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+- if (png_ptr->transformations & PNG_RGB_TO_GRAY)
+- info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
++ info_ptr->color_type = (png_byte)(info_ptr->color_type &
++ ~PNG_COLOR_MASK_COLOR);
+ #endif
+
+ #ifdef PNG_READ_QUANTIZE_SUPPORTED
+- if (png_ptr->transformations & PNG_QUANTIZE)
++ if ((png_ptr->transformations & PNG_QUANTIZE) != 0)
+ {
+ if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
+ (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&
+- png_ptr->palette_lookup && info_ptr->bit_depth == 8)
++ png_ptr->palette_lookup != 0 && info_ptr->bit_depth == 8)
+ {
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+ }
+@@ -1960,54 +2074,57 @@
+ #endif
+
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+- if (png_ptr->transformations & PNG_EXPAND_16 && info_ptr->bit_depth == 8 &&
+- info_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
++ if ((png_ptr->transformations & PNG_EXPAND_16) != 0 &&
++ info_ptr->bit_depth == 8 &&
++ info_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
+ {
+ info_ptr->bit_depth = 16;
+ }
+ #endif
+
+ #ifdef PNG_READ_PACK_SUPPORTED
+- if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))
++ if ((png_ptr->transformations & PNG_PACK) != 0 &&
++ (info_ptr->bit_depth < 8))
+ info_ptr->bit_depth = 8;
+ #endif
+
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ info_ptr->channels = 1;
+
+- else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
++ else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ info_ptr->channels = 3;
+
+ else
+ info_ptr->channels = 1;
+
+ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_STRIP_ALPHA)
++ if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0)
+ {
+- info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
++ info_ptr->color_type = (png_byte)(info_ptr->color_type &
++ ~PNG_COLOR_MASK_ALPHA);
+ info_ptr->num_trans = 0;
+ }
+ #endif
+
+- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
++ if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ info_ptr->channels++;
+
+ #ifdef PNG_READ_FILLER_SUPPORTED
+ /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */
+- if ((png_ptr->transformations & PNG_FILLER) &&
+- ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
+- (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)))
++ if ((png_ptr->transformations & PNG_FILLER) != 0 &&
++ (info_ptr->color_type == PNG_COLOR_TYPE_RGB ||
++ info_ptr->color_type == PNG_COLOR_TYPE_GRAY))
+ {
+ info_ptr->channels++;
+ /* If adding a true alpha channel not just filler */
+- if (png_ptr->transformations & PNG_ADD_ALPHA)
++ if ((png_ptr->transformations & PNG_ADD_ALPHA) != 0)
+ info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ }
+ #endif
+
+ #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
+ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+- if (png_ptr->transformations & PNG_USER_TRANSFORM)
++ if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
+ {
+ if (info_ptr->bit_depth < png_ptr->user_transform_depth)
+ info_ptr->bit_depth = png_ptr->user_transform_depth;
+@@ -2031,291 +2148,11 @@
+ png_ptr->info_rowbytes = info_ptr->rowbytes;
+
+ #ifndef PNG_READ_EXPAND_SUPPORTED
+- if (png_ptr)
++ if (png_ptr != NULL)
+ return;
+ #endif
+ }
+
+-/* Transform the row. The order of transformations is significant,
+- * and is very touchy. If you add a transformation, take care to
+- * decide how it fits in with the other transformations here.
+- */
+-void /* PRIVATE */
+-png_do_read_transformations(png_structp png_ptr)
+-{
+- png_debug(1, "in png_do_read_transformations");
+-
+- if (png_ptr->row_buf == NULL)
+- {
+- /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
+- * error is incredibly rare and incredibly easy to debug without this
+- * information.
+- */
+- png_error(png_ptr, "NULL row buffer");
+- }
+-
+- /* The following is debugging; prior to 1.5.4 the code was never compiled in;
+- * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
+- * PNG_WARN_UNINITIALIZED_ROW removed. In 1.5 the new flag is set only for
+- * selected new APIs to ensure that there is no API change.
+- */
+- if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
+- !(png_ptr->flags & PNG_FLAG_ROW_INIT))
+- {
+- /* Application has failed to call either png_read_start_image() or
+- * png_read_update_info() after setting transforms that expand pixels.
+- * This check added to libpng-1.2.19 (but not enabled until 1.5.4).
+- */
+- png_error(png_ptr, "Uninitialized row");
+- }
+-
+-#ifdef PNG_READ_EXPAND_SUPPORTED
+- if (png_ptr->transformations & PNG_EXPAND)
+- {
+- if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE)
+- {
+- png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
+- }
+-
+- else
+- {
+- if (png_ptr->num_trans &&
+- (png_ptr->transformations & PNG_EXPAND_tRNS))
+- png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- &(png_ptr->trans_color));
+-
+- else
+- png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- NULL);
+- }
+- }
+-#endif
+-
+-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+- if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
+- !(png_ptr->transformations & PNG_COMPOSE) &&
+- (png_ptr->row_info.color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
+- png_ptr->row_info.color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
+- png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- 0 /* at_start == false, because SWAP_ALPHA happens later */);
+-#endif
+-
+-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+- if (png_ptr->transformations & PNG_RGB_TO_GRAY)
+- {
+- int rgb_error =
+- png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info),
+- png_ptr->row_buf + 1);
+-
+- if (rgb_error)
+- {
+- png_ptr->rgb_to_gray_status=1;
+- if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
+- PNG_RGB_TO_GRAY_WARN)
+- png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
+-
+- if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
+- PNG_RGB_TO_GRAY_ERR)
+- png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
+- }
+- }
+-#endif
+-
+-/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
+- *
+- * In most cases, the "simple transparency" should be done prior to doing
+- * gray-to-RGB, or you will have to test 3x as many bytes to check if a
+- * pixel is transparent. You would also need to make sure that the
+- * transparency information is upgraded to RGB.
+- *
+- * To summarize, the current flow is:
+- * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
+- * with background "in place" if transparent,
+- * convert to RGB if necessary
+- * - Gray + alpha -> composite with gray background and remove alpha bytes,
+- * convert to RGB if necessary
+- *
+- * To support RGB backgrounds for gray images we need:
+- * - Gray + simple transparency -> convert to RGB + simple transparency,
+- * compare 3 or 6 bytes and composite with
+- * background "in place" if transparent
+- * (3x compare/pixel compared to doing
+- * composite with gray bkgrnd)
+- * - Gray + alpha -> convert to RGB + alpha, composite with background and
+- * remove alpha bytes (3x float
+- * operations/pixel compared with composite
+- * on gray background)
+- *
+- * Greg's change will do this. The reason it wasn't done before is for
+- * performance, as this increases the per-pixel operations. If we would check
+- * in advance if the background was gray or RGB, and position the gray-to-RGB
+- * transform appropriately, then it would save a lot of work/time.
+- */
+-
+-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+- /* If gray -> RGB, do so now only if background is non-gray; else do later
+- * for performance reasons
+- */
+- if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
+- !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
+- png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
+- (defined PNG_READ_ALPHA_MODE_SUPPORTED)
+- if (png_ptr->transformations & PNG_COMPOSE)
+- png_do_compose(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
+-#endif
+-
+-#ifdef PNG_READ_GAMMA_SUPPORTED
+- if ((png_ptr->transformations & PNG_GAMMA) &&
+-#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
+- (defined PNG_READ_ALPHA_MODE_SUPPORTED)
+- !((png_ptr->transformations & PNG_COMPOSE) &&
+- ((png_ptr->num_trans != 0) ||
+- (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
+-#endif
+- (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
+- png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
+-#endif
+-
+-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+- if ((png_ptr->transformations & PNG_STRIP_ALPHA) &&
+- (png_ptr->transformations & PNG_COMPOSE) &&
+- (png_ptr->row_info.color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
+- png_ptr->row_info.color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
+- png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- 0 /* at_start == false, because SWAP_ALPHA happens later */);
+-#endif
+-
+-#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
+- if ((png_ptr->transformations & PNG_ENCODE_ALPHA) &&
+- (png_ptr->row_info.color_type & PNG_COLOR_MASK_ALPHA))
+- png_do_encode_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1, png_ptr);
+-#endif
+-
+-#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+- if (png_ptr->transformations & PNG_SCALE_16_TO_8)
+- png_do_scale_16_to_8(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+- /* There is no harm in doing both of these because only one has any effect,
+- * by putting the 'scale' option first if the app asks for scale (either by
+- * calling the API or in a TRANSFORM flag) this is what happens.
+- */
+- if (png_ptr->transformations & PNG_16_TO_8)
+- png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_QUANTIZE_SUPPORTED
+- if (png_ptr->transformations & PNG_QUANTIZE)
+- {
+- png_do_quantize(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- png_ptr->palette_lookup, png_ptr->quantize_index);
+-
+- if (png_ptr->row_info.rowbytes == 0)
+- png_error(png_ptr, "png_do_quantize returned rowbytes=0");
+- }
+-#endif /* PNG_READ_QUANTIZE_SUPPORTED */
+-
+-#ifdef PNG_READ_EXPAND_16_SUPPORTED
+- /* Do the expansion now, after all the arithmetic has been done. Notice
+- * that previous transformations can handle the PNG_EXPAND_16 flag if this
+- * is efficient (particularly true in the case of gamma correction, where
+- * better accuracy results faster!)
+- */
+- if (png_ptr->transformations & PNG_EXPAND_16)
+- png_do_expand_16(&png_ptr->row_info, png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+- /*NOTE: moved here in 1.5.4 (from much later in this list.) */
+- if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
+- (png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
+- png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_INVERT_SUPPORTED
+- if (png_ptr->transformations & PNG_INVERT_MONO)
+- png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_SHIFT_SUPPORTED
+- if (png_ptr->transformations & PNG_SHIFT)
+- png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- &(png_ptr->shift));
+-#endif
+-
+-#ifdef PNG_READ_PACK_SUPPORTED
+- if (png_ptr->transformations & PNG_PACK)
+- png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_BGR_SUPPORTED
+- if (png_ptr->transformations & PNG_BGR)
+- png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_PACKSWAP)
+- png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_FILLER_SUPPORTED
+- if (png_ptr->transformations & PNG_FILLER)
+- png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- (png_uint_32)png_ptr->filler, png_ptr->flags);
+-#endif
+-
+-#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_INVERT_ALPHA)
+- png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_SWAP_ALPHA)
+- png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_READ_16BIT_SUPPORTED
+-#ifdef PNG_READ_SWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_SWAP_BYTES)
+- png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-#endif
+-
+-#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+- if (png_ptr->transformations & PNG_USER_TRANSFORM)
+- {
+- if (png_ptr->read_user_transform_fn != NULL)
+- (*(png_ptr->read_user_transform_fn)) /* User read transform function */
+- (png_ptr, /* png_ptr */
+- &(png_ptr->row_info), /* row_info: */
+- /* png_uint_32 width; width of row */
+- /* png_size_t rowbytes; number of bytes in row */
+- /* png_byte color_type; color type of pixels */
+- /* png_byte bit_depth; bit depth of samples */
+- /* png_byte channels; number of channels (1-4) */
+- /* png_byte pixel_depth; bits per pixel (depth*channels) */
+- png_ptr->row_buf + 1); /* start of pixel data for row */
+-#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+- if (png_ptr->user_transform_depth)
+- png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
+-
+- if (png_ptr->user_transform_channels)
+- png_ptr->row_info.channels = png_ptr->user_transform_channels;
+-#endif
+- png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
+- png_ptr->row_info.channels);
+-
+- png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+- png_ptr->row_info.width);
+- }
+-#endif
+-}
+-
+ #ifdef PNG_READ_PACK_SUPPORTED
+ /* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
+ * without changing the actual values. Thus, if you had a row with
+@@ -2323,7 +2160,7 @@
+ * the numbers 0 or 1. If you would rather they contain 0 and 255, use
+ * png_do_shift() after this.
+ */
+-void /* PRIVATE */
++static void
+ png_do_unpack(png_row_infop row_info, png_bytep row)
+ {
+ png_debug(1, "in png_do_unpack");
+@@ -2421,109 +2258,132 @@
+ * a row of bit depth 8, but only 5 are significant, this will shift
+ * the values back to 0 through 31.
+ */
+-void /* PRIVATE */
++static void
+ png_do_unshift(png_row_infop row_info, png_bytep row,
+ png_const_color_8p sig_bits)
+ {
++ int color_type;
++
+ png_debug(1, "in png_do_unshift");
+
+- if (
+- row_info->color_type != PNG_COLOR_TYPE_PALETTE)
++ /* The palette case has already been handled in the _init routine. */
++ color_type = row_info->color_type;
++
++ if (color_type != PNG_COLOR_TYPE_PALETTE)
+ {
+ int shift[4];
+ int channels = 0;
+- int c;
+- png_uint_16 value = 0;
+- png_uint_32 row_width = row_info->width;
+-
+- if (row_info->color_type & PNG_COLOR_MASK_COLOR)
++ int bit_depth = row_info->bit_depth;
++
++ if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+- shift[channels++] = row_info->bit_depth - sig_bits->red;
+- shift[channels++] = row_info->bit_depth - sig_bits->green;
+- shift[channels++] = row_info->bit_depth - sig_bits->blue;
++ shift[channels++] = bit_depth - sig_bits->red;
++ shift[channels++] = bit_depth - sig_bits->green;
++ shift[channels++] = bit_depth - sig_bits->blue;
+ }
+
+ else
+ {
+- shift[channels++] = row_info->bit_depth - sig_bits->gray;
++ shift[channels++] = bit_depth - sig_bits->gray;
+ }
+
+- if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
++ if ((color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ {
+- shift[channels++] = row_info->bit_depth - sig_bits->alpha;
++ shift[channels++] = bit_depth - sig_bits->alpha;
+ }
+
+- for (c = 0; c < channels; c++)
+ {
+- if (shift[c] <= 0)
+- shift[c] = 0;
+-
+- else
+- value = 1;
++ int c, have_shift;
++
++ for (c = have_shift = 0; c < channels; ++c)
++ {
++ /* A shift of more than the bit depth is an error condition but it
++ * gets ignored here.
++ */
++ if (shift[c] <= 0 || shift[c] >= bit_depth)
++ shift[c] = 0;
++
++ else
++ have_shift = 1;
++ }
++
++ if (have_shift == 0)
++ return;
+ }
+
+- if (!value)
+- return;
+-
+- switch (row_info->bit_depth)
++ switch (bit_depth)
+ {
+ default:
++ /* Must be 1bpp gray: should not be here! */
++ /* NOTREACHED */
+ break;
+
+ case 2:
++ /* Must be 2bpp gray */
++ /* assert(channels == 1 && shift[0] == 1) */
+ {
+- png_bytep bp;
+- png_size_t i;
+- png_size_t istop = row_info->rowbytes;
+-
+- for (bp = row, i = 0; i < istop; i++)
++ png_bytep bp = row;
++ png_bytep bp_end = bp + row_info->rowbytes;
++
++ while (bp < bp_end)
+ {
+- *bp >>= 1;
+- *bp++ &= 0x55;
++ int b = (*bp >> 1) & 0x55;
++ *bp++ = (png_byte)b;
+ }
+ break;
+ }
+
+ case 4:
++ /* Must be 4bpp gray */
++ /* assert(channels == 1) */
+ {
+ png_bytep bp = row;
+- png_size_t i;
+- png_size_t istop = row_info->rowbytes;
+- png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) |
+- (png_byte)((int)0xf >> shift[0]));
+-
+- for (i = 0; i < istop; i++)
++ png_bytep bp_end = bp + row_info->rowbytes;
++ int gray_shift = shift[0];
++ int mask = 0xf >> gray_shift;
++
++ mask |= mask << 4;
++
++ while (bp < bp_end)
+ {
+- *bp >>= shift[0];
+- *bp++ &= mask;
++ int b = (*bp >> gray_shift) & mask;
++ *bp++ = (png_byte)b;
+ }
+ break;
+ }
+
+ case 8:
++ /* Single byte components, G, GA, RGB, RGBA */
+ {
+ png_bytep bp = row;
+- png_uint_32 i;
+- png_uint_32 istop = row_width * channels;
+-
+- for (i = 0; i < istop; i++)
++ png_bytep bp_end = bp + row_info->rowbytes;
++ int channel = 0;
++
++ while (bp < bp_end)
+ {
+- *bp++ >>= shift[i%channels];
++ int b = *bp >> shift[channel];
++ if (++channel >= channels)
++ channel = 0;
++ *bp++ = (png_byte)b;
+ }
+ break;
+ }
+
+ #ifdef PNG_READ_16BIT_SUPPORTED
+ case 16:
++ /* Double byte components, G, GA, RGB, RGBA */
+ {
+ png_bytep bp = row;
+- png_uint_32 i;
+- png_uint_32 istop = channels * row_width;
+-
+- for (i = 0; i < istop; i++)
++ png_bytep bp_end = bp + row_info->rowbytes;
++ int channel = 0;
++
++ while (bp < bp_end)
+ {
+- value = (png_uint_16)((*bp << 8) + *(bp + 1));
+- value >>= shift[i%channels];
++ int value = (bp[0] << 8) + bp[1];
++
++ value >>= shift[channel];
++ if (++channel >= channels)
++ channel = 0;
+ *bp++ = (png_byte)(value >> 8);
+ *bp++ = (png_byte)(value & 0xff);
+ }
+@@ -2537,7 +2397,7 @@
+
+ #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
+ /* Scale rows of bit depth 16 down to 8 accurately */
+-void /* PRIVATE */
++static void
+ png_do_scale_16_to_8(png_row_infop row_info, png_bytep row)
+ {
+ png_debug(1, "in png_do_scale_16_to_8");
+@@ -2545,7 +2405,7 @@
+ if (row_info->bit_depth == 16)
+ {
+ png_bytep sp = row; /* source */
+- png_bytep dp = row; /* destinaton */
++ png_bytep dp = row; /* destination */
+ png_bytep ep = sp + row_info->rowbytes; /* end+1 */
+
+ while (sp < ep)
+@@ -2595,7 +2455,7 @@
+ #endif
+
+ #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
+-void /* PRIVATE */
++static void
+ /* Simply discard the low byte. This was the default behavior prior
+ * to libpng-1.5.4.
+ */
+@@ -2606,7 +2466,7 @@
+ if (row_info->bit_depth == 16)
+ {
+ png_bytep sp = row; /* source */
+- png_bytep dp = row; /* destinaton */
++ png_bytep dp = row; /* destination */
+ png_bytep ep = sp + row_info->rowbytes; /* end+1 */
+
+ while (sp < ep)
+@@ -2623,7 +2483,7 @@
+ #endif
+
+ #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+-void /* PRIVATE */
++static void
+ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
+ {
+ png_debug(1, "in png_do_read_swap_alpha");
+@@ -2720,7 +2580,7 @@
+ #endif
+
+ #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+-void /* PRIVATE */
++static void
+ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
+ {
+ png_uint_32 row_width;
+@@ -2822,7 +2682,7 @@
+
+ #ifdef PNG_READ_FILLER_SUPPORTED
+ /* Add filler channel if we have RGB color */
+-void /* PRIVATE */
++static void
+ png_do_read_filler(png_row_infop row_info, png_bytep row,
+ png_uint_32 filler, png_uint_32 flags)
+ {
+@@ -2841,7 +2701,7 @@
+ {
+ if (row_info->bit_depth == 8)
+ {
+- if (flags & PNG_FLAG_FILLER_AFTER)
++ if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
+ {
+ /* This changes the data from G to GX */
+ png_bytep sp = row + (png_size_t)row_width;
+@@ -2876,7 +2736,7 @@
+ #ifdef PNG_READ_16BIT_SUPPORTED
+ else if (row_info->bit_depth == 16)
+ {
+- if (flags & PNG_FLAG_FILLER_AFTER)
++ if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
+ {
+ /* This changes the data from GG to GGXX */
+ png_bytep sp = row + (png_size_t)row_width * 2;
+@@ -2918,7 +2778,7 @@
+ {
+ if (row_info->bit_depth == 8)
+ {
+- if (flags & PNG_FLAG_FILLER_AFTER)
++ if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
+ {
+ /* This changes the data from RGB to RGBX */
+ png_bytep sp = row + (png_size_t)row_width * 3;
+@@ -2957,7 +2817,7 @@
+ #ifdef PNG_READ_16BIT_SUPPORTED
+ else if (row_info->bit_depth == 16)
+ {
+- if (flags & PNG_FLAG_FILLER_AFTER)
++ if ((flags & PNG_FLAG_FILLER_AFTER) != 0)
+ {
+ /* This changes the data from RRGGBB to RRGGBBXX */
+ png_bytep sp = row + (png_size_t)row_width * 6;
+@@ -3009,7 +2869,7 @@
+
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ /* Expand grayscale files to RGB, with or without alpha */
+-void /* PRIVATE */
++static void
+ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
+ {
+ png_uint_32 i;
+@@ -3018,7 +2878,7 @@
+ png_debug(1, "in png_do_gray_to_rgb");
+
+ if (row_info->bit_depth >= 8 &&
+- !(row_info->color_type & PNG_COLOR_MASK_COLOR))
++ (row_info->color_type & PNG_COLOR_MASK_COLOR) == 0)
+ {
+ if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
+ {
+@@ -3086,7 +2946,7 @@
+ }
+ }
+ }
+- row_info->channels += (png_byte)2;
++ row_info->channels = (png_byte)(row_info->channels + 2);
+ row_info->color_type |= PNG_COLOR_MASK_COLOR;
+ row_info->pixel_depth = (png_byte)(row_info->channels *
+ row_info->bit_depth);
+@@ -3097,269 +2957,242 @@
+
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ /* Reduce RGB files to grayscale, with or without alpha
+- * using the equation given in Poynton's ColorFAQ at
+- * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
+- * New link:
+- * <http://www.poynton.com/notes/colour_and_gamma/>
++ * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
++ * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
++ * versions dated 1998 through November 2002 have been archived at
++ * http://web.archive.org/web/20000816232553/http://www.inforamp.net/
++ * ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
+ * Charles Poynton poynton at poynton.com
+ *
+ * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
+ *
+- * We approximate this with
+- *
+- * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B
+- *
+ * which can be expressed with integers as
+ *
+ * Y = (6969 * R + 23434 * G + 2365 * B)/32768
+ *
+- * The calculation is to be done in a linear colorspace.
++ * Poynton's current link (as of January 2003 through July 2011):
++ * <http://www.poynton.com/notes/colour_and_gamma/>
++ * has changed the numbers slightly:
+ *
+- * Other integer coefficents can be used via png_set_rgb_to_gray().
++ * Y = 0.2126*R + 0.7152*G + 0.0722*B
++ *
++ * which can be expressed with integers as
++ *
++ * Y = (6966 * R + 23436 * G + 2366 * B)/32768
++ *
++ * Historically, however, libpng uses numbers derived from the ITU-R Rec 709
++ * end point chromaticities and the D65 white point. Depending on the
++ * precision used for the D65 white point this produces a variety of different
++ * numbers, however if the four decimal place value used in ITU-R Rec 709 is
++ * used (0.3127,0.3290) the Y calculation would be:
++ *
++ * Y = (6968 * R + 23435 * G + 2366 * B)/32768
++ *
++ * While this is correct the rounding results in an overflow for white, because
++ * the sum of the rounded coefficients is 32769, not 32768. Consequently
++ * libpng uses, instead, the closest non-overflowing approximation:
++ *
++ * Y = (6968 * R + 23434 * G + 2366 * B)/32768
++ *
++ * Starting with libpng-1.5.5, if the image being converted has a cHRM chunk
++ * (including an sRGB chunk) then the chromaticities are used to calculate the
++ * coefficients. See the chunk handling in pngrutil.c for more information.
++ *
++ * In all cases the calculation is to be done in a linear colorspace. If no
++ * gamma information is available to correct the encoding of the original RGB
++ * values this results in an implicit assumption that the original PNG RGB
++ * values were linear.
++ *
++ * Other integer coefficents can be used via png_set_rgb_to_gray(). Because
++ * the API takes just red and green coefficients the blue coefficient is
++ * calculated to make the sum 32768. This will result in different rounding
++ * to that used above.
+ */
+-int /* PRIVATE */
+-png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
++static int
++png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
+
+ {
+- png_uint_32 i;
+-
+- png_uint_32 row_width = row_info->width;
+ int rgb_error = 0;
+
+ png_debug(1, "in png_do_rgb_to_gray");
+
+- if (!(row_info->color_type & PNG_COLOR_MASK_PALETTE) &&
+- (row_info->color_type & PNG_COLOR_MASK_COLOR))
++ if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 &&
++ (row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+- png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
+- png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
+- png_uint_32 bc = png_ptr->rgb_to_gray_blue_coeff;
+-
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
++ PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
++ PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
++ PNG_CONST png_uint_32 bc = 32768 - rc - gc;
++ PNG_CONST png_uint_32 row_width = row_info->width;
++ PNG_CONST int have_alpha =
++ (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0;
++
++ if (row_info->bit_depth == 8)
+ {
+- if (row_info->bit_depth == 8)
++#ifdef PNG_READ_GAMMA_SUPPORTED
++ /* Notice that gamma to/from 1 are not necessarily inverses (if
++ * there is an overall gamma correction). Prior to 1.5.5 this code
++ * checked the linearized values for equality; this doesn't match
++ * the documentation, the original values must be checked.
++ */
++ if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL)
+ {
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+- if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL)
++ png_bytep sp = row;
++ png_bytep dp = row;
++ png_uint_32 i;
++
++ for (i = 0; i < row_width; i++)
+ {
+- png_bytep sp = row;
+- png_bytep dp = row;
+-
+- for (i = 0; i < row_width; i++)
++ png_byte red = *(sp++);
++ png_byte green = *(sp++);
++ png_byte blue = *(sp++);
++
++ if (red != green || red != blue)
+ {
+- png_byte red = png_ptr->gamma_to_1[*(sp++)];
+- png_byte green = png_ptr->gamma_to_1[*(sp++)];
+- png_byte blue = png_ptr->gamma_to_1[*(sp++)];
+-
+- if (red != green || red != blue)
+- {
+- rgb_error |= 1;
+- *(dp++) = png_ptr->gamma_from_1[
+- (rc*red + gc*green + bc*blue)>>15];
+- }
++ red = png_ptr->gamma_to_1[red];
++ green = png_ptr->gamma_to_1[green];
++ blue = png_ptr->gamma_to_1[blue];
++
++ rgb_error |= 1;
++ *(dp++) = png_ptr->gamma_from_1[
++ (rc*red + gc*green + bc*blue + 16384)>>15];
++ }
++
++ else
++ {
++ /* If there is no overall correction the table will not be
++ * set.
++ */
++ if (png_ptr->gamma_table != NULL)
++ red = png_ptr->gamma_table[red];
++
++ *(dp++) = red;
++ }
++
++ if (have_alpha != 0)
++ *(dp++) = *(sp++);
++ }
++ }
++ else
++#endif
++ {
++ png_bytep sp = row;
++ png_bytep dp = row;
++ png_uint_32 i;
++
++ for (i = 0; i < row_width; i++)
++ {
++ png_byte red = *(sp++);
++ png_byte green = *(sp++);
++ png_byte blue = *(sp++);
++
++ if (red != green || red != blue)
++ {
++ rgb_error |= 1;
++ /* NOTE: this is the historical approach which simply
++ * truncates the results.
++ */
++ *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
++ }
++
++ else
++ *(dp++) = red;
++
++ if (have_alpha != 0)
++ *(dp++) = *(sp++);
++ }
++ }
++ }
++
++ else /* RGB bit_depth == 16 */
++ {
++#ifdef PNG_READ_GAMMA_SUPPORTED
++ if (png_ptr->gamma_16_to_1 != NULL && png_ptr->gamma_16_from_1 != NULL)
++ {
++ png_bytep sp = row;
++ png_bytep dp = row;
++ png_uint_32 i;
++
++ for (i = 0; i < row_width; i++)
++ {
++ png_uint_16 red, green, blue, w;
++
++ red = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++ green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++ blue = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++
++ if (red == green && red == blue)
++ {
++ if (png_ptr->gamma_16_table != NULL)
++ w = png_ptr->gamma_16_table[(red & 0xff)
++ >> png_ptr->gamma_shift][red >> 8];
+
+ else
+- *(dp++) = *(sp - 1);
++ w = red;
+ }
+- }
+- else
+-#endif
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
++
++ else
+ {
+- png_byte red = *(sp++);
+- png_byte green = *(sp++);
+- png_byte blue = *(sp++);
+-
+- if (red != green || red != blue)
+- {
+- rgb_error |= 1;
+- *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
+- }
+-
+- else
+- *(dp++) = *(sp - 1);
++ png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff)
++ >> png_ptr->gamma_shift][red>>8];
++ png_uint_16 green_1 =
++ png_ptr->gamma_16_to_1[(green&0xff) >>
++ png_ptr->gamma_shift][green>>8];
++ png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff)
++ >> png_ptr->gamma_shift][blue>>8];
++ png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1
++ + bc*blue_1 + 16384)>>15);
++ w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
++ png_ptr->gamma_shift][gray16 >> 8];
++ rgb_error |= 1;
++ }
++
++ *(dp++) = (png_byte)((w>>8) & 0xff);
++ *(dp++) = (png_byte)(w & 0xff);
++
++ if (have_alpha != 0)
++ {
++ *(dp++) = *(sp++);
++ *(dp++) = *(sp++);
+ }
+ }
+ }
+-
+- else /* RGB bit_depth == 16 */
++ else
++#endif
+ {
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+- if (png_ptr->gamma_16_to_1 != NULL &&
+- png_ptr->gamma_16_from_1 != NULL)
++ png_bytep sp = row;
++ png_bytep dp = row;
++ png_uint_32 i;
++
++ for (i = 0; i < row_width; i++)
+ {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
++ png_uint_16 red, green, blue, gray16;
++
++ red = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++ green = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++ blue = (png_uint_16)(((*(sp)) << 8) | *(sp + 1)); sp += 2;
++
++ if (red != green || red != blue)
++ rgb_error |= 1;
++
++ /* From 1.5.5 in the 16 bit case do the accurate conversion even
++ * in the 'fast' case - this is because this is where the code
++ * ends up when handling linear 16 bit data.
++ */
++ gray16 = (png_uint_16)((rc*red + gc*green + bc*blue + 16384) >>
++ 15);
++ *(dp++) = (png_byte)((gray16 >> 8) & 0xff);
++ *(dp++) = (png_byte)(gray16 & 0xff);
++
++ if (have_alpha != 0)
+ {
+- png_uint_16 red, green, blue, w;
+-
+- red = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- green = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- blue = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+-
+- if (red == green && red == blue)
+- w = red;
+-
+- else
+- {
+- png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff)
+- >> png_ptr->gamma_shift][red>>8];
+- png_uint_16 green_1 =
+- png_ptr->gamma_16_to_1[(green&0xff) >>
+- png_ptr->gamma_shift][green>>8];
+- png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff)
+- >> png_ptr->gamma_shift][blue>>8];
+- png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1
+- + bc*blue_1)>>15);
+- w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
+- png_ptr->gamma_shift][gray16 >> 8];
+- rgb_error |= 1;
+- }
+-
+- *(dp++) = (png_byte)((w>>8) & 0xff);
+- *(dp++) = (png_byte)(w & 0xff);
+- }
+- }
+- else
+-#endif
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
+- {
+- png_uint_16 red, green, blue, gray16;
+-
+- red = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- green = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- blue = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+-
+- if (red != green || red != blue)
+- rgb_error |= 1;
+-
+- gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
+- *(dp++) = (png_byte)((gray16>>8) & 0xff);
+- *(dp++) = (png_byte)(gray16 & 0xff);
+- }
+- }
+- }
+- }
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- {
+- if (row_info->bit_depth == 8)
+- {
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+- if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL)
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
+- {
+- png_byte red = png_ptr->gamma_to_1[*(sp++)];
+- png_byte green = png_ptr->gamma_to_1[*(sp++)];
+- png_byte blue = png_ptr->gamma_to_1[*(sp++)];
+-
+- if (red != green || red != blue)
+- rgb_error |= 1;
+-
+- *(dp++) = png_ptr->gamma_from_1
+- [(rc*red + gc*green + bc*blue)>>15];
+-
+- *(dp++) = *(sp++); /* alpha */
+- }
+- }
+- else
+-#endif
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
+- {
+- png_byte red = *(sp++);
+- png_byte green = *(sp++);
+- png_byte blue = *(sp++);
+- if (red != green || red != blue)
+- rgb_error |= 1;
+-
+- *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15);
+- *(dp++) = *(sp++); /* alpha */
+- }
+- }
+- }
+- else /* RGBA bit_depth == 16 */
+- {
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+- if (png_ptr->gamma_16_to_1 != NULL &&
+- png_ptr->gamma_16_from_1 != NULL)
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
+- {
+- png_uint_16 red, green, blue, w;
+-
+- red = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- green = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+- blue = (png_uint_16)(((*(sp))<<8) | *(sp + 1)); sp += 2;
+-
+- if (red == green && red == blue)
+- w = red;
+-
+- else
+- {
+- png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
+- png_ptr->gamma_shift][red>>8];
+-
+- png_uint_16 green_1 =
+- png_ptr->gamma_16_to_1[(green&0xff) >>
+- png_ptr->gamma_shift][green>>8];
+-
+- png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
+- png_ptr->gamma_shift][blue>>8];
+-
+- png_uint_16 gray16 = (png_uint_16)((rc * red_1
+- + gc * green_1 + bc * blue_1)>>15);
+-
+- w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
+- png_ptr->gamma_shift][gray16 >> 8];
+-
+- rgb_error |= 1;
+- }
+-
+- *(dp++) = (png_byte)((w>>8) & 0xff);
+- *(dp++) = (png_byte)(w & 0xff);
+- *(dp++) = *(sp++); /* alpha */
+ *(dp++) = *(sp++);
+- }
+- }
+- else
+-#endif
+- {
+- png_bytep sp = row;
+- png_bytep dp = row;
+- for (i = 0; i < row_width; i++)
+- {
+- png_uint_16 red, green, blue, gray16;
+- red = (png_uint_16)((*(sp)<<8) | *(sp + 1)); sp += 2;
+- green = (png_uint_16)((*(sp)<<8) | *(sp + 1)); sp += 2;
+- blue = (png_uint_16)((*(sp)<<8) | *(sp + 1)); sp += 2;
+-
+- if (red != green || red != blue)
+- rgb_error |= 1;
+-
+- gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
+- *(dp++) = (png_byte)((gray16>>8) & 0xff);
+- *(dp++) = (png_byte)(gray16 & 0xff);
+- *(dp++) = *(sp++); /* alpha */
+ *(dp++) = *(sp++);
+ }
+ }
+ }
+ }
+- row_info->channels -= 2;
++
++ row_info->channels = (png_byte)(row_info->channels - 2);
+ row_info->color_type = (png_byte)(row_info->color_type &
+ ~PNG_COLOR_MASK_COLOR);
+ row_info->pixel_depth = (png_byte)(row_info->channels *
+@@ -3369,73 +3202,15 @@
+ return rgb_error;
+ }
+ #endif
+-#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
+-
+-#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
+-/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth
+- * large of png_color. This lets grayscale images be treated as
+- * paletted. Most useful for gamma correction and simplification
+- * of code. This API is not used internally.
+- */
+-void PNGAPI
+-png_build_grayscale_palette(int bit_depth, png_colorp palette)
+-{
+- int num_palette;
+- int color_inc;
+- int i;
+- int v;
+-
+- png_debug(1, "in png_do_build_grayscale_palette");
+-
+- if (palette == NULL)
+- return;
+-
+- switch (bit_depth)
+- {
+- case 1:
+- num_palette = 2;
+- color_inc = 0xff;
+- break;
+-
+- case 2:
+- num_palette = 4;
+- color_inc = 0x55;
+- break;
+-
+- case 4:
+- num_palette = 16;
+- color_inc = 0x11;
+- break;
+-
+- case 8:
+- num_palette = 256;
+- color_inc = 1;
+- break;
+-
+- default:
+- num_palette = 0;
+- color_inc = 0;
+- break;
+- }
+-
+- for (i = 0, v = 0; i < num_palette; i++, v += color_inc)
+- {
+- palette[i].red = (png_byte)v;
+- palette[i].green = (png_byte)v;
+- palette[i].blue = (png_byte)v;
+- }
+-}
+-#endif
+-
+-
+-#ifdef PNG_READ_TRANSFORMS_SUPPORTED
+-#ifdef PNG_READ_BACKGROUND_SUPPORTED
++
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
++ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
+ /* Replace any alpha or transparency with the supplied background color.
+ * "background" is already in the screen gamma, while "background_1" is
+ * at a gamma of 1.0. Paletted files have already been taken care of.
+ */
+-void /* PRIVATE */
+-png_do_compose(png_row_infop row_info, png_bytep row, png_structp png_ptr)
++static void
++png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
+ {
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+ png_const_bytep gamma_table = png_ptr->gamma_table;
+@@ -3445,12 +3220,12 @@
+ png_const_uint_16pp gamma_16_from_1 = png_ptr->gamma_16_from_1;
+ png_const_uint_16pp gamma_16_to_1 = png_ptr->gamma_16_to_1;
+ int gamma_shift = png_ptr->gamma_shift;
++ int optimize = (png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0;
+ #endif
+
+ png_bytep sp;
+ png_uint_32 i;
+ png_uint_32 row_width = row_info->width;
+- int optimize = (png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0;
+ int shift;
+
+ png_debug(1, "in png_do_compose");
+@@ -3471,11 +3246,12 @@
+ if ((png_uint_16)((*sp >> shift) & 0x01)
+ == png_ptr->trans_color.gray)
+ {
+- *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
+- *sp |= (png_byte)(png_ptr->background.gray << shift);
++ unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
++ tmp |= png_ptr->background.gray << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+- if (!shift)
++ if (shift == 0)
+ {
+ shift = 7;
+ sp++;
+@@ -3499,20 +3275,22 @@
+ if ((png_uint_16)((*sp >> shift) & 0x03)
+ == png_ptr->trans_color.gray)
+ {
+- *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
+- *sp |= (png_byte)(png_ptr->background.gray << shift);
++ unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
++ tmp |= png_ptr->background.gray << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+ else
+ {
+- png_byte p = (png_byte)((*sp >> shift) & 0x03);
+- png_byte g = (png_byte)((gamma_table [p | (p << 2) |
+- (p << 4) | (p << 6)] >> 6) & 0x03);
+- *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
+- *sp |= (png_byte)(g << shift);
++ unsigned int p = (*sp >> shift) & 0x03;
++ unsigned int g = (gamma_table [p | (p << 2) |
++ (p << 4) | (p << 6)] >> 6) & 0x03;
++ unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
++ tmp |= g << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+- if (!shift)
++ if (shift == 0)
+ {
+ shift = 6;
+ sp++;
+@@ -3533,11 +3311,12 @@
+ if ((png_uint_16)((*sp >> shift) & 0x03)
+ == png_ptr->trans_color.gray)
+ {
+- *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
+- *sp |= (png_byte)(png_ptr->background.gray << shift);
++ unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
++ tmp |= png_ptr->background.gray << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+- if (!shift)
++ if (shift == 0)
+ {
+ shift = 6;
+ sp++;
+@@ -3562,20 +3341,22 @@
+ if ((png_uint_16)((*sp >> shift) & 0x0f)
+ == png_ptr->trans_color.gray)
+ {
+- *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
+- *sp |= (png_byte)(png_ptr->background.gray << shift);
++ unsigned int tmp = *sp & (0xf0f >> (4 - shift));
++ tmp |= png_ptr->background.gray << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+ else
+ {
+- png_byte p = (png_byte)((*sp >> shift) & 0x0f);
+- png_byte g = (png_byte)((gamma_table[p |
+- (p << 4)] >> 4) & 0x0f);
+- *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
+- *sp |= (png_byte)(g << shift);
++ unsigned int p = (*sp >> shift) & 0x0f;
++ unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
++ 0x0f;
++ unsigned int tmp = *sp & (0xf0f >> (4 - shift));
++ tmp |= g << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+- if (!shift)
++ if (shift == 0)
+ {
+ shift = 4;
+ sp++;
+@@ -3596,11 +3377,12 @@
+ if ((png_uint_16)((*sp >> shift) & 0x0f)
+ == png_ptr->trans_color.gray)
+ {
+- *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
+- *sp |= (png_byte)(png_ptr->background.gray << shift);
++ unsigned int tmp = *sp & (0xf0f >> (4 - shift));
++ tmp |= png_ptr->background.gray << shift;
++ *sp = (png_byte)(tmp & 0xff);
+ }
+
+- if (!shift)
++ if (shift == 0)
+ {
+ shift = 4;
+ sp++;
+@@ -3656,8 +3438,10 @@
+ if (v == png_ptr->trans_color.gray)
+ {
+ /* Background is already in screen gamma */
+- *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff);
+- *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
++ *sp = (png_byte)((png_ptr->background.gray >> 8)
++ & 0xff);
++ *(sp + 1) = (png_byte)(png_ptr->background.gray
++ & 0xff);
+ }
+
+ else
+@@ -3680,8 +3464,10 @@
+
+ if (v == png_ptr->trans_color.gray)
+ {
+- *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff);
+- *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
++ *sp = (png_byte)((png_ptr->background.gray >> 8)
++ & 0xff);
++ *(sp + 1) = (png_byte)(png_ptr->background.gray
++ & 0xff);
+ }
+ }
+ }
+@@ -3761,9 +3547,12 @@
+ /* Background is already in screen gamma */
+ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
+- *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff);
+- *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff);
+- *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff);
++ *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
++ & 0xff);
++ *(sp + 3) = (png_byte)(png_ptr->background.green
++ & 0xff);
++ *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
++ & 0xff);
+ *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
+ }
+
+@@ -3804,9 +3593,12 @@
+ {
+ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
+- *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff);
+- *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff);
+- *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff);
++ *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
++ & 0xff);
++ *(sp + 3) = (png_byte)(png_ptr->background.green
++ & 0xff);
++ *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
++ & 0xff);
+ *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
+ }
+ }
+@@ -3843,7 +3635,7 @@
+
+ v = gamma_to_1[*sp];
+ png_composite(w, v, a, png_ptr->background_1.gray);
+- if (!optimize)
++ if (optimize == 0)
+ w = gamma_from_1[w];
+ *sp = w;
+ }
+@@ -3861,7 +3653,7 @@
+ *sp = (png_byte)png_ptr->background.gray;
+
+ else if (a < 0xff)
+- png_composite(*sp, *sp, a, png_ptr->background_1.gray);
++ png_composite(*sp, *sp, a, png_ptr->background.gray);
+ }
+ }
+ }
+@@ -3889,7 +3681,8 @@
+ else if (a == 0)
+ {
+ /* Background is already in screen gamma */
+- *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff);
++ *sp = (png_byte)((png_ptr->background.gray >> 8)
++ & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
+ }
+
+@@ -3899,7 +3692,7 @@
+
+ g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
+ png_composite_16(v, g, a, png_ptr->background_1.gray);
+- if (optimize)
++ if (optimize != 0)
+ w = v;
+ else
+ w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
+@@ -3919,7 +3712,8 @@
+
+ if (a == 0)
+ {
+- *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff);
++ *sp = (png_byte)((png_ptr->background.gray >> 8)
++ & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff);
+ }
+
+@@ -3928,7 +3722,7 @@
+ png_uint_16 g, v;
+
+ g = (png_uint_16)(((*sp) << 8) + *(sp + 1));
+- png_composite_16(v, g, a, png_ptr->background_1.gray);
++ png_composite_16(v, g, a, png_ptr->background.gray);
+ *sp = (png_byte)((v >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(v & 0xff);
+ }
+@@ -3972,17 +3766,17 @@
+
+ v = gamma_to_1[*sp];
+ png_composite(w, v, a, png_ptr->background_1.red);
+- if (!optimize) w = gamma_from_1[w];
++ if (optimize == 0) w = gamma_from_1[w];
+ *sp = w;
+
+ v = gamma_to_1[*(sp + 1)];
+ png_composite(w, v, a, png_ptr->background_1.green);
+- if (!optimize) w = gamma_from_1[w];
++ if (optimize == 0) w = gamma_from_1[w];
+ *(sp + 1) = w;
+
+ v = gamma_to_1[*(sp + 2)];
+ png_composite(w, v, a, png_ptr->background_1.blue);
+- if (!optimize) w = gamma_from_1[w];
++ if (optimize == 0) w = gamma_from_1[w];
+ *(sp + 2) = w;
+ }
+ }
+@@ -4049,9 +3843,12 @@
+ /* Background is already in screen gamma */
+ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
+- *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff);
+- *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff);
+- *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff);
++ *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
++ & 0xff);
++ *(sp + 3) = (png_byte)(png_ptr->background.green
++ & 0xff);
++ *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
++ & 0xff);
+ *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
+ }
+
+@@ -4061,23 +3858,26 @@
+
+ v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
+ png_composite_16(w, v, a, png_ptr->background_1.red);
+- if (!optimize)
+- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
++ if (optimize == 0)
++ w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
++ 8];
+ *sp = (png_byte)((w >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(w & 0xff);
+
+ v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
+ png_composite_16(w, v, a, png_ptr->background_1.green);
+- if (!optimize)
+- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
++ if (optimize == 0)
++ w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
++ 8];
+
+ *(sp + 2) = (png_byte)((w >> 8) & 0xff);
+ *(sp + 3) = (png_byte)(w & 0xff);
+
+ v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
+ png_composite_16(w, v, a, png_ptr->background_1.blue);
+- if (!optimize)
+- w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8];
++ if (optimize == 0)
++ w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
++ 8];
+
+ *(sp + 4) = (png_byte)((w >> 8) & 0xff);
+ *(sp + 5) = (png_byte)(w & 0xff);
+@@ -4098,9 +3898,12 @@
+ {
+ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff);
+ *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff);
+- *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff);
+- *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff);
+- *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff);
++ *(sp + 2) = (png_byte)((png_ptr->background.green >> 8)
++ & 0xff);
++ *(sp + 3) = (png_byte)(png_ptr->background.green
++ & 0xff);
++ *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8)
++ & 0xff);
+ *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff);
+ }
+
+@@ -4137,7 +3940,7 @@
+ }
+ }
+ }
+-#endif
++#endif /* READ_BACKGROUND || READ_ALPHA_MODE */
+
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+ /* Gamma correct the image, avoiding the alpha channel. Make sure
+@@ -4146,8 +3949,8 @@
+ * is 16, use gamma_16_table and gamma_shift. Build these with
+ * build_gamma_table().
+ */
+-void /* PRIVATE */
+-png_do_gamma(png_row_infop row_info, png_bytep row, png_structp png_ptr)
++static void
++png_do_gamma(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
+ {
+ png_const_bytep gamma_table = png_ptr->gamma_table;
+ png_const_uint_16pp gamma_16_table = png_ptr->gamma_16_table;
+@@ -4347,14 +4150,14 @@
+ * linear.) Called only with color types that have an alpha channel. Needs the
+ * from_1 tables.
+ */
+-void /* PRIVATE */
+-png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structp png_ptr)
++static void
++png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
+ {
+ png_uint_32 row_width = row_info->width;
+
+ png_debug(1, "in png_do_encode_alpha");
+
+- if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
++ if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ {
+ if (row_info->bit_depth == 8)
+ {
+@@ -4413,7 +4216,7 @@
+ /* Expands a palette row to an RGB or RGBA row depending
+ * upon whether you supply trans and num_trans.
+ */
+-void /* PRIVATE */
++static void
+ png_do_expand_palette(png_row_infop row_info, png_bytep row,
+ png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
+ {
+@@ -4566,7 +4369,7 @@
+ /* If the bit depth < 8, it is expanded to 8. Also, if the already
+ * expanded transparency value is supplied, an alpha channel is built.
+ */
+-void /* PRIVATE */
++static void
+ png_do_expand(png_row_infop row_info, png_bytep row,
+ png_const_color_16p trans_color)
+ {
+@@ -4580,7 +4383,7 @@
+ {
+ if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
+ {
+- png_uint_16 gray = (png_uint_16)(trans_color ? trans_color->gray : 0);
++ unsigned int gray = trans_color != NULL ? trans_color->gray : 0;
+
+ if (row_info->bit_depth < 8)
+ {
+@@ -4588,7 +4391,7 @@
+ {
+ case 1:
+ {
+- gray = (png_uint_16)((gray & 0x01) * 0xff);
++ gray = (gray & 0x01) * 0xff;
+ sp = row + (png_size_t)((row_width - 1) >> 3);
+ dp = row + (png_size_t)row_width - 1;
+ shift = 7 - (int)((row_width + 7) & 0x07);
+@@ -4616,7 +4419,7 @@
+
+ case 2:
+ {
+- gray = (png_uint_16)((gray & 0x03) * 0x55);
++ gray = (gray & 0x03) * 0x55;
+ sp = row + (png_size_t)((row_width - 1) >> 2);
+ dp = row + (png_size_t)row_width - 1;
+ shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
+@@ -4641,7 +4444,7 @@
+
+ case 4:
+ {
+- gray = (png_uint_16)((gray & 0x0f) * 0x11);
++ gray = (gray & 0x0f) * 0x11;
+ sp = row + (png_size_t)((row_width - 1) >> 1);
+ dp = row + (png_size_t)row_width - 1;
+ shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
+@@ -4694,8 +4497,8 @@
+
+ else if (row_info->bit_depth == 16)
+ {
+- png_byte gray_high = (png_byte)((gray >> 8) & 0xff);
+- png_byte gray_low = (png_byte)(gray & 0xff);
++ unsigned int gray_high = (gray >> 8) & 0xff;
++ unsigned int gray_low = gray & 0xff;
+ sp = row + row_info->rowbytes - 1;
+ dp = row + (row_info->rowbytes << 1) - 1;
+ for (i = 0; i < row_width; i++)
+@@ -4724,7 +4527,8 @@
+ row_width);
+ }
+ }
+- else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_color)
++ else if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
++ trans_color != NULL)
+ {
+ if (row_info->bit_depth == 8)
+ {
+@@ -4793,10 +4597,10 @@
+ #endif
+
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+-/* If the bit depth is 8 and the colour type is not a palette type expand the
++/* If the bit depth is 8 and the color type is not a palette type expand the
+ * whole row to 16 bits. Has no effect otherwise.
+ */
+-void /* PRIVATE */
++static void
+ png_do_expand_16(png_row_infop row_info, png_bytep row)
+ {
+ if (row_info->bit_depth == 8 &&
+@@ -4824,7 +4628,7 @@
+ #endif
+
+ #ifdef PNG_READ_QUANTIZE_SUPPORTED
+-void /* PRIVATE */
++static void
+ png_do_quantize(png_row_infop row_info, png_bytep row,
+ png_const_bytep palette_lookup, png_const_bytep quantize_lookup)
+ {
+@@ -4915,70 +4719,304 @@
+ }
+ }
+ }
+-#endif /* PNG_READ_QUANTIZE_SUPPORTED */
+-#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
+-
+-#ifdef PNG_MNG_FEATURES_SUPPORTED
+-/* Undoes intrapixel differencing */
++#endif /* READ_QUANTIZE */
++
++/* Transform the row. The order of transformations is significant,
++ * and is very touchy. If you add a transformation, take care to
++ * decide how it fits in with the other transformations here.
++ */
+ void /* PRIVATE */
+-png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
++png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
+ {
+- png_debug(1, "in png_do_read_intrapixel");
+-
+- if (
+- (row_info->color_type & PNG_COLOR_MASK_COLOR))
++ png_debug(1, "in png_do_read_transformations");
++
++ if (png_ptr->row_buf == NULL)
+ {
+- int bytes_per_pixel;
+- png_uint_32 row_width = row_info->width;
+-
+- if (row_info->bit_depth == 8)
++ /* Prior to 1.5.4 this output row/pass where the NULL pointer is, but this
++ * error is incredibly rare and incredibly easy to debug without this
++ * information.
++ */
++ png_error(png_ptr, "NULL row buffer");
++ }
++
++ /* The following is debugging; prior to 1.5.4 the code was never compiled in;
++ * in 1.5.4 PNG_FLAG_DETECT_UNINITIALIZED was added and the macro
++ * PNG_WARN_UNINITIALIZED_ROW removed. In 1.6 the new flag is set only for
++ * all transformations, however in practice the ROW_INIT always gets done on
++ * demand, if necessary.
++ */
++ if ((png_ptr->flags & PNG_FLAG_DETECT_UNINITIALIZED) != 0 &&
++ (png_ptr->flags & PNG_FLAG_ROW_INIT) == 0)
++ {
++ /* Application has failed to call either png_read_start_image() or
++ * png_read_update_info() after setting transforms that expand pixels.
++ * This check added to libpng-1.2.19 (but not enabled until 1.5.4).
++ */
++ png_error(png_ptr, "Uninitialized row");
++ }
++
++#ifdef PNG_READ_EXPAND_SUPPORTED
++ if ((png_ptr->transformations & PNG_EXPAND) != 0)
++ {
++ if (row_info->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+- png_bytep rp;
+- png_uint_32 i;
+-
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+- bytes_per_pixel = 3;
+-
+- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- bytes_per_pixel = 4;
++ png_do_expand_palette(row_info, png_ptr->row_buf + 1,
++ png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
++ }
++
++ else
++ {
++ if (png_ptr->num_trans != 0 &&
++ (png_ptr->transformations & PNG_EXPAND_tRNS) != 0)
++ png_do_expand(row_info, png_ptr->row_buf + 1,
++ &(png_ptr->trans_color));
+
+ else
+- return;
+-
+- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+- {
+- *(rp) = (png_byte)((256 + *rp + *(rp + 1)) & 0xff);
+- *(rp+2) = (png_byte)((256 + *(rp + 2) + *(rp + 1)) & 0xff);
+- }
+- }
+- else if (row_info->bit_depth == 16)
+- {
+- png_bytep rp;
+- png_uint_32 i;
+-
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+- bytes_per_pixel = 6;
+-
+- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- bytes_per_pixel = 8;
+-
+- else
+- return;
+-
+- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+- {
+- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
+- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
+- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+- png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL);
+- png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL);
+- *(rp ) = (png_byte)((red >> 8) & 0xff);
+- *(rp + 1) = (png_byte)(red & 0xff);
+- *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
+- *(rp + 5) = (png_byte)(blue & 0xff);
+- }
++ png_do_expand(row_info, png_ptr->row_buf + 1,
++ NULL);
+ }
+ }
++#endif
++
++#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
++ (png_ptr->transformations & PNG_COMPOSE) == 0 &&
++ (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
++ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
++ 0 /* at_start == false, because SWAP_ALPHA happens later */);
++#endif
++
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
++ {
++ int rgb_error =
++ png_do_rgb_to_gray(png_ptr, row_info,
++ png_ptr->row_buf + 1);
++
++ if (rgb_error != 0)
++ {
++ png_ptr->rgb_to_gray_status=1;
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
++ PNG_RGB_TO_GRAY_WARN)
++ png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
++
++ if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
++ PNG_RGB_TO_GRAY_ERR)
++ png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
++ }
++ }
++#endif
++
++/* From Andreas Dilger e-mail to png-implement, 26 March 1998:
++ *
++ * In most cases, the "simple transparency" should be done prior to doing
++ * gray-to-RGB, or you will have to test 3x as many bytes to check if a
++ * pixel is transparent. You would also need to make sure that the
++ * transparency information is upgraded to RGB.
++ *
++ * To summarize, the current flow is:
++ * - Gray + simple transparency -> compare 1 or 2 gray bytes and composite
++ * with background "in place" if transparent,
++ * convert to RGB if necessary
++ * - Gray + alpha -> composite with gray background and remove alpha bytes,
++ * convert to RGB if necessary
++ *
++ * To support RGB backgrounds for gray images we need:
++ * - Gray + simple transparency -> convert to RGB + simple transparency,
++ * compare 3 or 6 bytes and composite with
++ * background "in place" if transparent
++ * (3x compare/pixel compared to doing
++ * composite with gray bkgrnd)
++ * - Gray + alpha -> convert to RGB + alpha, composite with background and
++ * remove alpha bytes (3x float
++ * operations/pixel compared with composite
++ * on gray background)
++ *
++ * Greg's change will do this. The reason it wasn't done before is for
++ * performance, as this increases the per-pixel operations. If we would check
++ * in advance if the background was gray or RGB, and position the gray-to-RGB
++ * transform appropriately, then it would save a lot of work/time.
++ */
++
++#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
++ /* If gray -> RGB, do so now only if background is non-gray; else do later
++ * for performance reasons
++ */
++ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0 &&
++ (png_ptr->mode & PNG_BACKGROUND_IS_GRAY) == 0)
++ png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
++#endif
++
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
++ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
++ if ((png_ptr->transformations & PNG_COMPOSE) != 0)
++ png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
++#endif
++
++#ifdef PNG_READ_GAMMA_SUPPORTED
++ if ((png_ptr->transformations & PNG_GAMMA) != 0 &&
++#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
++ /* Because RGB_TO_GRAY does the gamma transform. */
++ (png_ptr->transformations & PNG_RGB_TO_GRAY) == 0 &&
++#endif
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
++ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
++ /* Because PNG_COMPOSE does the gamma transform if there is something to
++ * do (if there is an alpha channel or transparency.)
++ */
++ !((png_ptr->transformations & PNG_COMPOSE) &&
++ ((png_ptr->num_trans != 0) ||
++ (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)) &&
++#endif
++ /* Because png_init_read_transformations transforms the palette, unless
++ * RGB_TO_GRAY will do the transform.
++ */
++ (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE))
++ png_do_gamma(row_info, png_ptr->row_buf + 1, png_ptr);
++#endif
++
++#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_STRIP_ALPHA) != 0 &&
++ (png_ptr->transformations & PNG_COMPOSE) != 0 &&
++ (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
++ row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
++ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
++ 0 /* at_start == false, because SWAP_ALPHA happens later */);
++#endif
++
++#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
++ if ((png_ptr->transformations & PNG_ENCODE_ALPHA) != 0 &&
++ (row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
++ png_do_encode_alpha(row_info, png_ptr->row_buf + 1, png_ptr);
++#endif
++
++#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
++ if ((png_ptr->transformations & PNG_SCALE_16_TO_8) != 0)
++ png_do_scale_16_to_8(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
++ /* There is no harm in doing both of these because only one has any effect,
++ * by putting the 'scale' option first if the app asks for scale (either by
++ * calling the API or in a TRANSFORM flag) this is what happens.
++ */
++ if ((png_ptr->transformations & PNG_16_TO_8) != 0)
++ png_do_chop(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_QUANTIZE_SUPPORTED
++ if ((png_ptr->transformations & PNG_QUANTIZE) != 0)
++ {
++ png_do_quantize(row_info, png_ptr->row_buf + 1,
++ png_ptr->palette_lookup, png_ptr->quantize_index);
++
++ if (row_info->rowbytes == 0)
++ png_error(png_ptr, "png_do_quantize returned rowbytes=0");
++ }
++#endif /* READ_QUANTIZE */
++
++#ifdef PNG_READ_EXPAND_16_SUPPORTED
++ /* Do the expansion now, after all the arithmetic has been done. Notice
++ * that previous transformations can handle the PNG_EXPAND_16 flag if this
++ * is efficient (particularly true in the case of gamma correction, where
++ * better accuracy results faster!)
++ */
++ if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
++ png_do_expand_16(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
++ /* NOTE: moved here in 1.5.4 (from much later in this list.) */
++ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0 &&
++ (png_ptr->mode & PNG_BACKGROUND_IS_GRAY) != 0)
++ png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_INVERT_SUPPORTED
++ if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
++ png_do_invert(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
++ png_do_read_invert_alpha(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_SHIFT_SUPPORTED
++ if ((png_ptr->transformations & PNG_SHIFT) != 0)
++ png_do_unshift(row_info, png_ptr->row_buf + 1,
++ &(png_ptr->shift));
++#endif
++
++#ifdef PNG_READ_PACK_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACK) != 0)
++ png_do_unpack(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ /* Added at libpng-1.5.10 */
++ if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
++ png_ptr->num_palette_max >= 0)
++ png_do_check_palette_indexes(png_ptr, row_info);
++#endif
++
++#ifdef PNG_READ_BGR_SUPPORTED
++ if ((png_ptr->transformations & PNG_BGR) != 0)
++ png_do_bgr(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_PACKSWAP_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
++ png_do_packswap(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_FILLER_SUPPORTED
++ if ((png_ptr->transformations & PNG_FILLER) != 0)
++ png_do_read_filler(row_info, png_ptr->row_buf + 1,
++ (png_uint_32)png_ptr->filler, png_ptr->flags);
++#endif
++
++#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
++ png_do_read_swap_alpha(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_READ_16BIT_SUPPORTED
++#ifdef PNG_READ_SWAP_SUPPORTED
++ if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
++ png_do_swap(row_info, png_ptr->row_buf + 1);
++#endif
++#endif
++
++#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
++ if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
++ {
++ if (png_ptr->read_user_transform_fn != NULL)
++ (*(png_ptr->read_user_transform_fn)) /* User read transform function */
++ (png_ptr, /* png_ptr */
++ row_info, /* row_info: */
++ /* png_uint_32 width; width of row */
++ /* png_size_t rowbytes; number of bytes in row */
++ /* png_byte color_type; color type of pixels */
++ /* png_byte bit_depth; bit depth of samples */
++ /* png_byte channels; number of channels (1-4) */
++ /* png_byte pixel_depth; bits per pixel (depth*channels) */
++ png_ptr->row_buf + 1); /* start of pixel data for row */
++#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
++ if (png_ptr->user_transform_depth != 0)
++ row_info->bit_depth = png_ptr->user_transform_depth;
++
++ if (png_ptr->user_transform_channels != 0)
++ row_info->channels = png_ptr->user_transform_channels;
++#endif
++ row_info->pixel_depth = (png_byte)(row_info->bit_depth *
++ row_info->channels);
++
++ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_info->width);
++ }
++#endif
+ }
+-#endif /* PNG_MNG_FEATURES_SUPPORTED */
+-#endif /* PNG_READ_SUPPORTED */
++
++#endif /* READ_TRANSFORMS */
++#endif /* READ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngrutil.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngrutil.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -46,10 +46,8 @@
+
+ #ifdef PNG_READ_SUPPORTED
+
+-#define png_strtod(p,a,b) strtod(a,b)
+-
+ png_uint_32 PNGAPI
+-png_get_uint_31(png_structp png_ptr, png_const_bytep buf)
++png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
+ {
+ png_uint_32 uval = png_get_uint_32(buf);
+
+@@ -68,7 +66,7 @@
+ #define PNG_FIXED_ERROR (-1)
+
+ static png_fixed_point /* PRIVATE */
+-png_get_fixed_point(png_structp png_ptr, png_const_bytep buf)
++png_get_fixed_point(png_structrp png_ptr, png_const_bytep buf)
+ {
+ png_uint_32 uval = png_get_uint_32(buf);
+
+@@ -115,10 +113,10 @@
+ png_get_int_32)(png_const_bytep buf)
+ {
+ png_uint_32 uval = png_get_uint_32(buf);
+- if ((uval & 0x80000000L) == 0) /* non-negative */
++ if ((uval & 0x80000000) == 0) /* non-negative */
+ return uval;
+
+- uval = (uval ^ 0xffffffffL) + 1; /* 2's complement: -x = ~x+1 */
++ uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
+ return -(png_int_32)uval;
+ }
+
+@@ -138,11 +136,11 @@
+ return (png_uint_16)val;
+ }
+
+-#endif /* PNG_READ_INT_FUNCTIONS_SUPPORTED */
++#endif /* READ_INT_FUNCTIONS */
+
+ /* Read and check the PNG file signature */
+ void /* PRIVATE */
+-png_read_sig(png_structp png_ptr, png_infop info_ptr)
++png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ png_size_t num_checked, num_to_check;
+
+@@ -161,7 +159,7 @@
+ png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
+ png_ptr->sig_bytes = 8;
+
+- if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
++ if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check) != 0)
+ {
+ if (num_checked < 4 &&
+ png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
+@@ -177,7 +175,7 @@
+ * Put the type name into png_ptr->chunk_name, and return the length.
+ */
+ png_uint_32 /* PRIVATE */
+-png_read_chunk_header(png_structp png_ptr)
++png_read_chunk_header(png_structrp png_ptr)
+ {
+ png_byte buf[8];
+ png_uint_32 length;
+@@ -193,14 +191,14 @@
+ length = png_get_uint_31(png_ptr, buf);
+
+ /* Put the chunk name into png_ptr->chunk_name. */
+- png_memcpy(png_ptr->chunk_name, buf + 4, 4);
+-
+- png_debug2(0, "Reading %s chunk, length = %u",
+- png_ptr->chunk_name, length);
++ png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
++
++ png_debug2(0, "Reading %lx chunk, length = %lu",
++ (unsigned long)png_ptr->chunk_name, (unsigned long)length);
+
+ /* Reset the crc and run it over the chunk name. */
+ png_reset_crc(png_ptr);
+- png_calculate_crc(png_ptr, png_ptr->chunk_name, 4);
++ png_calculate_crc(png_ptr, buf + 4, 4);
+
+ /* Check to see if chunk name is valid. */
+ png_check_chunk_name(png_ptr, png_ptr->chunk_name);
+@@ -214,7 +212,7 @@
+
+ /* Read data, and (optionally) run it through the CRC. */
+ void /* PRIVATE */
+-png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
++png_crc_read(png_structrp png_ptr, png_bytep buf, png_uint_32 length)
+ {
+ if (png_ptr == NULL)
+ return;
+@@ -224,41 +222,40 @@
+ }
+
+ /* Optionally skip data and then check the CRC. Depending on whether we
+- * are reading a ancillary or critical chunk, and how the program has set
++ * are reading an ancillary or critical chunk, and how the program has set
+ * things up, we may calculate the CRC on the data and print a message.
+ * Returns '1' if there was a CRC error, '0' otherwise.
+ */
+ int /* PRIVATE */
+-png_crc_finish(png_structp png_ptr, png_uint_32 skip)
++png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
+ {
+- png_size_t i;
+- png_size_t istop = png_ptr->zbuf_size;
+-
+- for (i = (png_size_t)skip; i > istop; i -= istop)
++ /* The size of the local buffer for inflate is a good guess as to a
++ * reasonable size to use for buffering reads from the application.
++ */
++ while (skip > 0)
+ {
+- png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
++ png_uint_32 len;
++ png_byte tmpbuf[PNG_INFLATE_BUF_SIZE];
++
++ len = (sizeof tmpbuf);
++ if (len > skip)
++ len = skip;
++ skip -= len;
++
++ png_crc_read(png_ptr, tmpbuf, len);
+ }
+
+- if (i)
++ if (png_crc_error(png_ptr) != 0)
+ {
+- png_crc_read(png_ptr, png_ptr->zbuf, i);
+- }
+-
+- if (png_crc_error(png_ptr))
+- {
+- if (((png_ptr->chunk_name[0] & 0x20) && /* Ancillary */
+- !(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) ||
+- (!(png_ptr->chunk_name[0] & 0x20) && /* Critical */
+- (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE)))
++ if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0 ?
++ (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0 :
++ (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE) != 0)
+ {
+ png_chunk_warning(png_ptr, "CRC error");
+ }
+
+ else
+- {
+- png_chunk_benign_error(png_ptr, "CRC error");
+- return (0);
+- }
++ png_chunk_error(png_ptr, "CRC error");
+
+ return (1);
+ }
+@@ -270,22 +267,22 @@
+ * the data it has read thus far.
+ */
+ int /* PRIVATE */
+-png_crc_error(png_structp png_ptr)
++png_crc_error(png_structrp png_ptr)
+ {
+ png_byte crc_bytes[4];
+ png_uint_32 crc;
+ int need_crc = 1;
+
+- if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
++ if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
+ {
+ if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
+ (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
+ need_crc = 0;
+ }
+
+- else /* critical */
++ else /* critical */
+ {
+- if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
++ if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
+ need_crc = 0;
+ }
+
+@@ -296,7 +293,7 @@
+ /* The chunk CRC must be serialized in a single I/O call. */
+ png_read_data(png_ptr, crc_bytes, 4);
+
+- if (need_crc)
++ if (need_crc != 0)
+ {
+ crc = png_get_uint_32(crc_bytes);
+ return ((int)(crc != png_ptr->crc));
+@@ -306,252 +303,522 @@
+ return (0);
+ }
+
++#if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
++ defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_sCAL_SUPPORTED) ||\
++ defined(PNG_READ_sPLT_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) ||\
++ defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_SEQUENTIAL_READ_SUPPORTED)
++/* Manage the read buffer; this simply reallocates the buffer if it is not small
++ * enough (or if it is not allocated). The routine returns a pointer to the
++ * buffer; if an error occurs and 'warn' is set the routine returns NULL, else
++ * it will call png_error (via png_malloc) on failure. (warn == 2 means
++ * 'silent').
++ */
++static png_bytep
++png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
++{
++ png_bytep buffer = png_ptr->read_buffer;
++
++ if (buffer != NULL && new_size > png_ptr->read_buffer_size)
++ {
++ png_ptr->read_buffer = NULL;
++ png_ptr->read_buffer = NULL;
++ png_ptr->read_buffer_size = 0;
++ png_free(png_ptr, buffer);
++ buffer = NULL;
++ }
++
++ if (buffer == NULL)
++ {
++ buffer = png_voidcast(png_bytep, png_malloc_base(png_ptr, new_size));
++
++ if (buffer != NULL)
++ {
++ png_ptr->read_buffer = buffer;
++ png_ptr->read_buffer_size = new_size;
++ }
++
++ else if (warn < 2) /* else silent */
++ {
++ if (warn != 0)
++ png_chunk_warning(png_ptr, "insufficient memory to read chunk");
++
++ else
++ png_chunk_error(png_ptr, "insufficient memory to read chunk");
++ }
++ }
++
++ return buffer;
++}
++#endif /* READ_iCCP|iTXt|pCAL|sCAL|sPLT|tEXt|zTXt|SEQUENTIAL_READ */
++
++/* png_inflate_claim: claim the zstream for some nefarious purpose that involves
++ * decompression. Returns Z_OK on success, else a zlib error code. It checks
++ * the owner but, in final release builds, just issues a warning if some other
++ * chunk apparently owns the stream. Prior to release it does a png_error.
++ */
++static int
++png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
++{
++ if (png_ptr->zowner != 0)
++ {
++ char msg[64];
++
++ PNG_STRING_FROM_CHUNK(msg, png_ptr->zowner);
++ /* So the message that results is "<chunk> using zstream"; this is an
++ * internal error, but is very useful for debugging. i18n requirements
++ * are minimal.
++ */
++ (void)png_safecat(msg, (sizeof msg), 4, " using zstream");
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++ png_chunk_warning(png_ptr, msg);
++ png_ptr->zowner = 0;
++#else
++ png_chunk_error(png_ptr, msg);
++#endif
++ }
++
++ /* Implementation note: unlike 'png_deflate_claim' this internal function
++ * does not take the size of the data as an argument. Some efficiency could
++ * be gained by using this when it is known *if* the zlib stream itself does
++ * not record the number; however, this is an illusion: the original writer
++ * of the PNG may have selected a lower window size, and we really must
++ * follow that because, for systems with with limited capabilities, we
++ * would otherwise reject the application's attempts to use a smaller window
++ * size (zlib doesn't have an interface to say "this or lower"!).
++ *
++ * inflateReset2 was added to zlib 1.2.4; before this the window could not be
++ * reset, therefore it is necessary to always allocate the maximum window
++ * size with earlier zlibs just in case later compressed chunks need it.
++ */
++ {
++ int ret; /* zlib return code */
++#if PNG_ZLIB_VERNUM >= 0x1240
++
++# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
++ int window_bits;
++
++ if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
++ PNG_OPTION_ON)
++ window_bits = 15;
++
++ else
++ window_bits = 0;
++# else
++# define window_bits 0
++# endif
++#endif
++
++ /* Set this for safety, just in case the previous owner left pointers to
++ * memory allocations.
++ */
++ png_ptr->zstream.next_in = NULL;
++ png_ptr->zstream.avail_in = 0;
++ png_ptr->zstream.next_out = NULL;
++ png_ptr->zstream.avail_out = 0;
++
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
++ {
++#if PNG_ZLIB_VERNUM < 0x1240
++ ret = inflateReset(&png_ptr->zstream);
++#else
++ ret = inflateReset2(&png_ptr->zstream, window_bits);
++#endif
++ }
++
++ else
++ {
++#if PNG_ZLIB_VERNUM < 0x1240
++ ret = inflateInit(&png_ptr->zstream);
++#else
++ ret = inflateInit2(&png_ptr->zstream, window_bits);
++#endif
++
++ if (ret == Z_OK)
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
++ }
++
++ if (ret == Z_OK)
++ png_ptr->zowner = owner;
++
++ else
++ png_zstream_error(png_ptr, ret);
++
++ return ret;
++ }
++
++#ifdef window_bits
++# undef window_bits
++#endif
++}
++
+ #ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
+-static png_size_t
+-png_inflate(png_structp png_ptr, png_bytep data, png_size_t size,
+- png_bytep output, png_size_t output_size)
++/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
++ * allow the caller to do multiple calls if required. If the 'finish' flag is
++ * set Z_FINISH will be passed to the final inflate() call and Z_STREAM_END must
++ * be returned or there has been a problem, otherwise Z_SYNC_FLUSH is used and
++ * Z_OK or Z_STREAM_END will be returned on success.
++ *
++ * The input and output sizes are updated to the actual amounts of data consumed
++ * or written, not the amount available (as in a z_stream). The data pointers
++ * are not changed, so the next input is (data+input_size) and the next
++ * available output is (output+output_size).
++ */
++static int
++png_inflate(png_structrp png_ptr, png_uint_32 owner, int finish,
++ /* INPUT: */ png_const_bytep input, png_uint_32p input_size_ptr,
++ /* OUTPUT: */ png_bytep output, png_alloc_size_t *output_size_ptr)
+ {
+- png_size_t count = 0;
+-
+- /* zlib can't necessarily handle more than 65535 bytes at once (i.e. it can't
+- * even necessarily handle 65536 bytes) because the type uInt is "16 bits or
+- * more". Consequently it is necessary to chunk the input to zlib. This
+- * code uses ZLIB_IO_MAX, from pngpriv.h, as the maximum (the maximum value
+- * that can be stored in a uInt.) It is possible to set ZLIB_IO_MAX to a
+- * lower value in pngpriv.h and this may sometimes have a performance
+- * advantage, because it forces access of the input data to be separated from
+- * at least some of the use by some period of time.
+- */
+- png_ptr->zstream.next_in = data;
+- /* avail_in is set below from 'size' */
+- png_ptr->zstream.avail_in = 0;
+-
+- while (1)
++ if (png_ptr->zowner == owner) /* Else not claimed */
+ {
+- int ret, avail;
+-
+- /* The setting of 'avail_in' used to be outside the loop, by setting it
+- * inside it is possible to chunk the input to zlib and simply rely on
+- * zlib to advance the 'next_in' pointer. This allows arbitrary amounts o
+- * data to be passed through zlib at the unavoidable cost of requiring a
+- * window save (memcpy of up to 32768 output bytes) every ZLIB_IO_MAX
+- * input bytes.
++ int ret;
++ png_alloc_size_t avail_out = *output_size_ptr;
++ png_uint_32 avail_in = *input_size_ptr;
++
++ /* zlib can't necessarily handle more than 65535 bytes at once (i.e. it
++ * can't even necessarily handle 65536 bytes) because the type uInt is
++ * "16 bits or more". Consequently it is necessary to chunk the input to
++ * zlib. This code uses ZLIB_IO_MAX, from pngpriv.h, as the maximum (the
++ * maximum value that can be stored in a uInt.) It is possible to set
++ * ZLIB_IO_MAX to a lower value in pngpriv.h and this may sometimes have
++ * a performance advantage, because it reduces the amount of data accessed
++ * at each step and that may give the OS more time to page it in.
+ */
+- if (png_ptr->zstream.avail_in == 0 && size > 0)
++ png_ptr->zstream.next_in = PNGZ_INPUT_CAST(input);
++ /* avail_in and avail_out are set below from 'size' */
++ png_ptr->zstream.avail_in = 0;
++ png_ptr->zstream.avail_out = 0;
++
++ /* Read directly into the output if it is available (this is set to
++ * a local buffer below if output is NULL).
++ */
++ if (output != NULL)
++ png_ptr->zstream.next_out = output;
++
++ do
+ {
+- if (size <= ZLIB_IO_MAX)
++ uInt avail;
++ Byte local_buffer[PNG_INFLATE_BUF_SIZE];
++
++ /* zlib INPUT BUFFER */
++ /* The setting of 'avail_in' used to be outside the loop; by setting it
++ * inside it is possible to chunk the input to zlib and simply rely on
++ * zlib to advance the 'next_in' pointer. This allows arbitrary
++ * amounts of data to be passed through zlib at the unavoidable cost of
++ * requiring a window save (memcpy of up to 32768 output bytes)
++ * every ZLIB_IO_MAX input bytes.
++ */
++ avail_in += png_ptr->zstream.avail_in; /* not consumed last time */
++
++ avail = ZLIB_IO_MAX;
++
++ if (avail_in < avail)
++ avail = (uInt)avail_in; /* safe: < than ZLIB_IO_MAX */
++
++ avail_in -= avail;
++ png_ptr->zstream.avail_in = avail;
++
++ /* zlib OUTPUT BUFFER */
++ avail_out += png_ptr->zstream.avail_out; /* not written last time */
++
++ avail = ZLIB_IO_MAX; /* maximum zlib can process */
++
++ if (output == NULL)
+ {
+- /* The value is less than ZLIB_IO_MAX so the cast is safe: */
+- png_ptr->zstream.avail_in = (uInt)size;
+- size = 0;
++ /* Reset the output buffer each time round if output is NULL and
++ * make available the full buffer, up to 'remaining_space'
++ */
++ png_ptr->zstream.next_out = local_buffer;
++ if ((sizeof local_buffer) < avail)
++ avail = (sizeof local_buffer);
+ }
+
+- else
+- {
+- png_ptr->zstream.avail_in = ZLIB_IO_MAX;
+- size -= ZLIB_IO_MAX;
+- }
+- }
+-
+- /* Reset the output buffer each time round - we empty it
+- * after every inflate call.
++ if (avail_out < avail)
++ avail = (uInt)avail_out; /* safe: < ZLIB_IO_MAX */
++
++ png_ptr->zstream.avail_out = avail;
++ avail_out -= avail;
++
++ /* zlib inflate call */
++ /* In fact 'avail_out' may be 0 at this point, that happens at the end
++ * of the read when the final LZ end code was not passed at the end of
++ * the previous chunk of input data. Tell zlib if we have reached the
++ * end of the output buffer.
++ */
++ ret = inflate(&png_ptr->zstream, avail_out > 0 ? Z_NO_FLUSH :
++ (finish ? Z_FINISH : Z_SYNC_FLUSH));
++ } while (ret == Z_OK);
++
++ /* For safety kill the local buffer pointer now */
++ if (output == NULL)
++ png_ptr->zstream.next_out = NULL;
++
++ /* Claw back the 'size' and 'remaining_space' byte counts. */
++ avail_in += png_ptr->zstream.avail_in;
++ avail_out += png_ptr->zstream.avail_out;
++
++ /* Update the input and output sizes; the updated values are the amount
++ * consumed or written, effectively the inverse of what zlib uses.
+ */
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = png_ptr->zbuf_size;
+-
+- ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
+- avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out;
+-
+- /* First copy/count any new output - but only if we didn't
+- * get an error code.
++ if (avail_out > 0)
++ *output_size_ptr -= avail_out;
++
++ if (avail_in > 0)
++ *input_size_ptr -= avail_in;
++
++ /* Ensure png_ptr->zstream.msg is set (even in the success case!) */
++ png_zstream_error(png_ptr, ret);
++ return ret;
++ }
++
++ else
++ {
++ /* This is a bad internal error. The recovery assigns to the zstream msg
++ * pointer, which is not owned by the caller, but this is safe; it's only
++ * used on errors!
+ */
+- if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
+- {
+- png_size_t space = avail; /* > 0, see above */
+-
+- if (output != 0 && output_size > count)
+- {
+- png_size_t copy = output_size - count;
+-
+- if (space < copy)
+- copy = space;
+-
+- png_memcpy(output + count, png_ptr->zbuf, copy);
+- }
+- count += space;
+- }
+-
+- if (ret == Z_OK)
+- continue;
+-
+- /* Termination conditions - always reset the zstream, it
+- * must be left in inflateInit state.
+- */
+- png_ptr->zstream.avail_in = 0;
+- inflateReset(&png_ptr->zstream);
+-
+- if (ret == Z_STREAM_END)
+- return count; /* NOTE: may be zero. */
+-
+- /* Now handle the error codes - the API always returns 0
+- * and the error message is dumped into the uncompressed
+- * buffer if available.
+- */
+-# ifdef PNG_WARNINGS_SUPPORTED
+- {
+- png_const_charp msg;
+-
+- if (png_ptr->zstream.msg != 0)
+- msg = png_ptr->zstream.msg;
+-
+- else switch (ret)
+- {
+- case Z_BUF_ERROR:
+- msg = "Buffer error in compressed datastream";
+- break;
+-
+- case Z_DATA_ERROR:
+- msg = "Data error in compressed datastream";
+- break;
+-
+- default:
+- msg = "Incomplete compressed datastream";
+- break;
+- }
+-
+- png_chunk_warning(png_ptr, msg);
+- }
+-# endif
+-
+- /* 0 means an error - notice that this code simply ignores
+- * zero length compressed chunks as a result.
+- */
+- return 0;
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed");
++ return Z_STREAM_ERROR;
+ }
+ }
+
+ /*
+- * Decompress trailing data in a chunk. The assumption is that chunkdata
++ * Decompress trailing data in a chunk. The assumption is that read_buffer
+ * points at an allocated area holding the contents of a chunk with a
+ * trailing compressed part. What we get back is an allocated area
+ * holding the original prefix part and an uncompressed version of the
+ * trailing part (the malloc area passed in is freed).
+ */
++static int
++png_decompress_chunk(png_structrp png_ptr,
++ png_uint_32 chunklength, png_uint_32 prefix_size,
++ png_alloc_size_t *newlength /* must be initialized to the maximum! */,
++ int terminate /*add a '\0' to the end of the uncompressed data*/)
++{
++ /* TODO: implement different limits for different types of chunk.
++ *
++ * The caller supplies *newlength set to the maximum length of the
++ * uncompressed data, but this routine allocates space for the prefix and
++ * maybe a '\0' terminator too. We have to assume that 'prefix_size' is
++ * limited only by the maximum chunk size.
++ */
++ png_alloc_size_t limit = PNG_SIZE_MAX;
++
++# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
++ if (png_ptr->user_chunk_malloc_max > 0 &&
++ png_ptr->user_chunk_malloc_max < limit)
++ limit = png_ptr->user_chunk_malloc_max;
++# elif PNG_USER_CHUNK_MALLOC_MAX > 0
++ if (PNG_USER_CHUNK_MALLOC_MAX < limit)
++ limit = PNG_USER_CHUNK_MALLOC_MAX;
++# endif
++
++ if (limit >= prefix_size + (terminate != 0))
++ {
++ int ret;
++
++ limit -= prefix_size + (terminate != 0);
++
++ if (limit < *newlength)
++ *newlength = limit;
++
++ /* Now try to claim the stream. */
++ ret = png_inflate_claim(png_ptr, png_ptr->chunk_name);
++
++ if (ret == Z_OK)
++ {
++ png_uint_32 lzsize = chunklength - prefix_size;
++
++ ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
++ /* input: */ png_ptr->read_buffer + prefix_size, &lzsize,
++ /* output: */ NULL, newlength);
++
++ if (ret == Z_STREAM_END)
++ {
++ /* Use 'inflateReset' here, not 'inflateReset2' because this
++ * preserves the previously decided window size (otherwise it would
++ * be necessary to store the previous window size.) In practice
++ * this doesn't matter anyway, because png_inflate will call inflate
++ * with Z_FINISH in almost all cases, so the window will not be
++ * maintained.
++ */
++ if (inflateReset(&png_ptr->zstream) == Z_OK)
++ {
++ /* Because of the limit checks above we know that the new,
++ * expanded, size will fit in a size_t (let alone an
++ * png_alloc_size_t). Use png_malloc_base here to avoid an
++ * extra OOM message.
++ */
++ png_alloc_size_t new_size = *newlength;
++ png_alloc_size_t buffer_size = prefix_size + new_size +
++ (terminate != 0);
++ png_bytep text = png_voidcast(png_bytep, png_malloc_base(png_ptr,
++ buffer_size));
++
++ if (text != NULL)
++ {
++ ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
++ png_ptr->read_buffer + prefix_size, &lzsize,
++ text + prefix_size, newlength);
++
++ if (ret == Z_STREAM_END)
++ {
++ if (new_size == *newlength)
++ {
++ if (terminate != 0)
++ text[prefix_size + *newlength] = 0;
++
++ if (prefix_size > 0)
++ memcpy(text, png_ptr->read_buffer, prefix_size);
++
++ {
++ png_bytep old_ptr = png_ptr->read_buffer;
++
++ png_ptr->read_buffer = text;
++ png_ptr->read_buffer_size = buffer_size;
++ text = old_ptr; /* freed below */
++ }
++ }
++
++ else
++ {
++ /* The size changed on the second read, there can be no
++ * guarantee that anything is correct at this point.
++ * The 'msg' pointer has been set to "unexpected end of
++ * LZ stream", which is fine, but return an error code
++ * that the caller won't accept.
++ */
++ ret = PNG_UNEXPECTED_ZLIB_RETURN;
++ }
++ }
++
++ else if (ret == Z_OK)
++ ret = PNG_UNEXPECTED_ZLIB_RETURN; /* for safety */
++
++ /* Free the text pointer (this is the old read_buffer on
++ * success)
++ */
++ png_free(png_ptr, text);
++ text = NULL;
++
++ /* This really is very benign, but it's still an error because
++ * the extra space may otherwise be used as a Trojan Horse.
++ */
++ if (ret == Z_STREAM_END &&
++ chunklength - prefix_size != lzsize)
++ png_chunk_benign_error(png_ptr, "extra compressed data");
++ }
++
++ else
++ {
++ /* Out of memory allocating the buffer */
++ ret = Z_MEM_ERROR;
++ png_zstream_error(png_ptr, Z_MEM_ERROR);
++ }
++ }
++
++ else
++ {
++ /* inflateReset failed, store the error message */
++ png_zstream_error(png_ptr, ret);
++
++ if (ret == Z_STREAM_END)
++ ret = PNG_UNEXPECTED_ZLIB_RETURN;
++ }
++ }
++
++ else if (ret == Z_OK)
++ ret = PNG_UNEXPECTED_ZLIB_RETURN;
++
++ /* Release the claimed stream */
++ png_ptr->zowner = 0;
++ }
++
++ else /* the claim failed */ if (ret == Z_STREAM_END) /* impossible! */
++ ret = PNG_UNEXPECTED_ZLIB_RETURN;
++
++ return ret;
++ }
++
++ else
++ {
++ /* Application/configuration limits exceeded */
++ png_zstream_error(png_ptr, Z_MEM_ERROR);
++ return Z_MEM_ERROR;
++ }
++}
++#endif /* READ_COMPRESSED_TEXT */
++
++#ifdef PNG_READ_iCCP_SUPPORTED
++/* Perform a partial read and decompress, producing 'avail_out' bytes and
++ * reading from the current chunk as required.
++ */
++static int
++png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
++ png_uint_32p chunk_bytes, png_bytep next_out, png_alloc_size_t *out_size,
++ int finish)
++{
++ if (png_ptr->zowner == png_ptr->chunk_name)
++ {
++ int ret;
++
++ /* next_in and avail_in must have been initialized by the caller. */
++ png_ptr->zstream.next_out = next_out;
++ png_ptr->zstream.avail_out = 0; /* set in the loop */
++
++ do
++ {
++ if (png_ptr->zstream.avail_in == 0)
++ {
++ if (read_size > *chunk_bytes)
++ read_size = (uInt)*chunk_bytes;
++ *chunk_bytes -= read_size;
++
++ if (read_size > 0)
++ png_crc_read(png_ptr, read_buffer, read_size);
++
++ png_ptr->zstream.next_in = read_buffer;
++ png_ptr->zstream.avail_in = read_size;
++ }
++
++ if (png_ptr->zstream.avail_out == 0)
++ {
++ uInt avail = ZLIB_IO_MAX;
++ if (avail > *out_size)
++ avail = (uInt)*out_size;
++ *out_size -= avail;
++
++ png_ptr->zstream.avail_out = avail;
++ }
++
++ /* Use Z_SYNC_FLUSH when there is no more chunk data to ensure that all
++ * the available output is produced; this allows reading of truncated
++ * streams.
++ */
++ ret = inflate(&png_ptr->zstream,
++ *chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
++ }
++ while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
++
++ *out_size += png_ptr->zstream.avail_out;
++ png_ptr->zstream.avail_out = 0; /* Should not be required, but is safe */
++
++ /* Ensure the error message pointer is always set: */
++ png_zstream_error(png_ptr, ret);
++ return ret;
++ }
++
++ else
++ {
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed");
++ return Z_STREAM_ERROR;
++ }
++}
++#endif
++
++/* Read and check the IDHR chunk */
++
+ void /* PRIVATE */
+-png_decompress_chunk(png_structp png_ptr, int comp_type,
+- png_size_t chunklength,
+- png_size_t prefix_size, png_size_t *newlength)
+-{
+- /* The caller should guarantee this */
+- if (prefix_size > chunklength)
+- {
+- /* The recovery is to delete the chunk. */
+- png_warning(png_ptr, "invalid chunklength");
+- prefix_size = 0; /* To delete everything */
+- }
+-
+- else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
+- {
+- png_size_t expanded_size = png_inflate(png_ptr,
+- (png_bytep)(png_ptr->chunkdata + prefix_size),
+- chunklength - prefix_size,
+- 0, /* output */
+- 0); /* output size */
+-
+- /* Now check the limits on this chunk - if the limit fails the
+- * compressed data will be removed, the prefix will remain.
+- */
+-#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
+- if (png_ptr->user_chunk_malloc_max &&
+- (prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
+-#else
+-# ifdef PNG_USER_CHUNK_MALLOC_MAX
+- if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
+- prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
+-# endif
+-#endif
+- png_warning(png_ptr, "Exceeded size limit while expanding chunk");
+-
+- /* If the size is zero either there was an error and a message
+- * has already been output (warning) or the size really is zero
+- * and we have nothing to do - the code will exit through the
+- * error case below.
+- */
+-#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
+- defined(PNG_USER_CHUNK_MALLOC_MAX)
+- else if (expanded_size > 0)
+-#else
+- if (expanded_size > 0)
+-#endif
+- {
+- /* Success (maybe) - really uncompress the chunk. */
+- png_size_t new_size = 0;
+- png_charp text = png_malloc_warn(png_ptr,
+- prefix_size + expanded_size + 1);
+-
+- if (text != NULL)
+- {
+- png_memcpy(text, png_ptr->chunkdata, prefix_size);
+- new_size = png_inflate(png_ptr,
+- (png_bytep)(png_ptr->chunkdata + prefix_size),
+- chunklength - prefix_size,
+- (png_bytep)(text + prefix_size), expanded_size);
+- text[prefix_size + expanded_size] = 0; /* just in case */
+-
+- if (new_size == expanded_size)
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = text;
+- *newlength = prefix_size + expanded_size;
+- return; /* The success return! */
+- }
+-
+- png_warning(png_ptr, "png_inflate logic error");
+- png_free(png_ptr, text);
+- }
+-
+- else
+- png_warning(png_ptr, "Not enough memory to decompress chunk");
+- }
+- }
+-
+- else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
+- {
+- PNG_WARNING_PARAMETERS(p)
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_d, comp_type);
+- png_formatted_warning(png_ptr, p, "Unknown zTXt compression type @1");
+-
+- /* The recovery is to simply drop the data. */
+- }
+-
+- /* Generic error return - leave the prefix, delete the compressed
+- * data, reallocate the chunkdata to remove the potentially large
+- * amount of compressed data.
+- */
+- {
+- png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
+-
+- if (text != NULL)
+- {
+- if (prefix_size > 0)
+- png_memcpy(text, png_ptr->chunkdata, prefix_size);
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = text;
+-
+- /* This is an extra zero in the 'uncompressed' part. */
+- *(png_ptr->chunkdata + prefix_size) = 0x00;
+- }
+- /* Ignore a malloc error here - it is safe. */
+- }
+-
+- *newlength = prefix_size;
+-}
+-#endif /* PNG_READ_COMPRESSED_TEXT_SUPPORTED */
+-
+-/* Read and check the IDHR chunk */
+-void /* PRIVATE */
+-png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte buf[13];
+ png_uint_32 width, height;
+@@ -560,12 +827,12 @@
+
+ png_debug(1, "in png_handle_IHDR");
+
+- if (png_ptr->mode & PNG_HAVE_IHDR)
+- png_error(png_ptr, "Out of place IHDR");
++ if ((png_ptr->mode & PNG_HAVE_IHDR) != 0)
++ png_chunk_error(png_ptr, "out of place");
+
+ /* Check the length */
+ if (length != 13)
+- png_error(png_ptr, "Invalid IHDR chunk");
++ png_chunk_error(png_ptr, "invalid");
+
+ png_ptr->mode |= PNG_HAVE_IHDR;
+
+@@ -614,8 +881,7 @@
+ }
+
+ /* Set up other useful info */
+- png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
+- png_ptr->channels);
++ png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels);
+ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
+ png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
+ png_debug1(3, "channels = %d", png_ptr->channels);
+@@ -626,7 +892,7 @@
+
+ /* Read and check the palette */
+ void /* PRIVATE */
+-png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_color palette[PNG_MAX_PALETTE_LENGTH];
+ int num, i;
+@@ -636,26 +902,33 @@
+
+ png_debug(1, "in png_handle_PLTE");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before PLTE");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ /* Moved to before the 'after IDAT' check below because otherwise duplicate
++ * PLTE chunks are potentially ignored (the spec says there shall not be more
++ * than one PLTE, the error is not treated as benign, so this check trumps
++ * the requirement that PLTE appears before IDAT.)
++ */
++ else if ((png_ptr->mode & PNG_HAVE_PLTE) != 0)
++ png_chunk_error(png_ptr, "duplicate");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid PLTE after IDAT");
++ /* This is benign because the non-benign error happened before, when an
++ * IDAT was encountered in a color-mapped image with no PLTE.
++ */
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- png_error(png_ptr, "Duplicate PLTE chunk");
+-
+ png_ptr->mode |= PNG_HAVE_PLTE;
+
+- if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
+ {
+- png_warning(png_ptr,
+- "Ignoring PLTE chunk in grayscale PNG");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "ignored in grayscale PNG");
+ return;
+ }
+
+@@ -669,19 +942,18 @@
+
+ if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
+ {
++ png_crc_finish(png_ptr, length);
++
+ if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
+- {
+- png_warning(png_ptr, "Invalid palette chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
++ png_chunk_benign_error(png_ptr, "invalid");
+
+ else
+- {
+- png_error(png_ptr, "Invalid palette chunk");
+- }
++ png_chunk_error(png_ptr, "invalid");
++
++ return;
+ }
+
++ /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
+ num = (int)length / 3;
+
+ #ifdef PNG_POINTER_INDEXING_SUPPORTED
+@@ -720,214 +992,196 @@
+ }
+
+ #ifndef PNG_READ_OPT_PLTE_SUPPORTED
+- else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
++ else if (png_crc_error(png_ptr) != 0) /* Only if we have a CRC error */
+ {
+ /* If we don't want to use the data from an ancillary chunk,
+ * we have two options: an error abort, or a warning and we
+ * ignore the data in this chunk (which should be OK, since
+ * it's considered ancillary for a RGB or RGBA image).
++ *
++ * IMPLEMENTATION NOTE: this is only here because png_crc_finish uses the
++ * chunk type to determine whether to check the ancillary or the critical
++ * flags.
+ */
+- if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE))
++ if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE) == 0)
+ {
+- if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)
+- {
+- png_chunk_benign_error(png_ptr, "CRC error");
+- }
++ if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) != 0)
++ return;
+
+ else
+- {
+- png_chunk_warning(png_ptr, "CRC error");
+- return;
+- }
++ png_chunk_error(png_ptr, "CRC error");
+ }
+
+ /* Otherwise, we (optionally) emit a warning and use the chunk. */
+- else if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN))
+- {
++ else if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0)
+ png_chunk_warning(png_ptr, "CRC error");
+- }
+ }
+ #endif
+
++ /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to its
++ * own copy of the palette. This has the side effect that when png_start_row
++ * is called (this happens after any call to png_read_update_info) the
++ * info_ptr palette gets changed. This is extremely unexpected and
++ * confusing.
++ *
++ * Fix this by not sharing the palette in this way.
++ */
+ png_set_PLTE(png_ptr, info_ptr, palette, num);
+
++ /* The three chunks, bKGD, hIST and tRNS *must* appear after PLTE and before
++ * IDAT. Prior to 1.6.0 this was not checked; instead the code merely
++ * checked the apparent validity of a tRNS chunk inserted before PLTE on a
++ * palette PNG. 1.6.0 attempts to rigorously follow the standard and
++ * therefore does a benign error if the erroneous condition is detected *and*
++ * cancels the tRNS if the benign error returns. The alternative is to
++ * amend the standard since it would be rather hypocritical of the standards
++ * maintainers to ignore it.
++ */
+ #ifdef PNG_READ_tRNS_SUPPORTED
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ if (png_ptr->num_trans > 0 ||
++ (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0))
+ {
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
+- {
+- if (png_ptr->num_trans > (png_uint_16)num)
+- {
+- png_warning(png_ptr, "Truncating incorrect tRNS chunk length");
+- png_ptr->num_trans = (png_uint_16)num;
+- }
+-
+- if (info_ptr->num_trans > (png_uint_16)num)
+- {
+- png_warning(png_ptr, "Truncating incorrect info tRNS chunk length");
+- info_ptr->num_trans = (png_uint_16)num;
+- }
+- }
++ /* Cancel this because otherwise it would be used if the transforms
++ * require it. Don't cancel the 'valid' flag because this would prevent
++ * detection of duplicate chunks.
++ */
++ png_ptr->num_trans = 0;
++
++ if (info_ptr != NULL)
++ info_ptr->num_trans = 0;
++
++ png_chunk_benign_error(png_ptr, "tRNS must be after");
+ }
+ #endif
+
++#ifdef PNG_READ_hIST_SUPPORTED
++ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
++ png_chunk_benign_error(png_ptr, "hIST must be after");
++#endif
++
++#ifdef PNG_READ_bKGD_SUPPORTED
++ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
++ png_chunk_benign_error(png_ptr, "bKGD must be after");
++#endif
+ }
+
+ void /* PRIVATE */
+-png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_IEND(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_debug(1, "in png_handle_IEND");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT))
+- {
+- png_error(png_ptr, "No image in file");
+- }
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0 ||
++ (png_ptr->mode & PNG_HAVE_IDAT) == 0)
++ png_chunk_error(png_ptr, "out of place");
+
+ png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
+
++ png_crc_finish(png_ptr, length);
++
+ if (length != 0)
+- {
+- png_warning(png_ptr, "Incorrect IEND chunk length");
+- }
+-
+- png_crc_finish(png_ptr, length);
+-
+- PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
++ png_chunk_benign_error(png_ptr, "invalid");
++
++ PNG_UNUSED(info_ptr)
+ }
+
+ #ifdef PNG_READ_gAMA_SUPPORTED
+ void /* PRIVATE */
+-png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_gAMA(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_fixed_point igamma;
+ png_byte buf[4];
+
+ png_debug(1, "in png_handle_gAMA");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before gAMA");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
+ {
+- png_warning(png_ptr, "Invalid gAMA after IDAT");
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ if (length != 4)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
++ return;
++ }
++
++ png_crc_read(png_ptr, buf, 4);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
++ return;
++
++ igamma = png_get_fixed_point(NULL, buf);
++
++ png_colorspace_set_gamma(png_ptr, &png_ptr->colorspace, igamma);
++ png_colorspace_sync(png_ptr, info_ptr);
++}
++#endif
++
++#ifdef PNG_READ_sBIT_SUPPORTED
++void /* PRIVATE */
++png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
++{
++ unsigned int truelen, i;
++ png_byte sample_depth;
++ png_byte buf[4];
++
++ png_debug(1, "in png_handle_sBIT");
++
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) != 0)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
++ return;
++ }
++
++ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ {
++ truelen = 3;
++ sample_depth = 8;
++ }
++
++ else
++ {
++ truelen = png_ptr->channels;
++ sample_depth = png_ptr->bit_depth;
++ }
++
++ if (length != truelen || length > 4)
++ {
++ png_chunk_benign_error(png_ptr, "invalid");
+ png_crc_finish(png_ptr, length);
+ return;
+ }
+
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- /* Should be an error, but we can cope with it */
+- png_warning(png_ptr, "Out of place gAMA chunk");
+-
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
+-#ifdef PNG_READ_sRGB_SUPPORTED
+- && !(info_ptr->valid & PNG_INFO_sRGB)
+-#endif
+- )
+- {
+- png_warning(png_ptr, "Duplicate gAMA chunk");
+- png_crc_finish(png_ptr, length);
++ buf[0] = buf[1] = buf[2] = buf[3] = sample_depth;
++ png_crc_read(png_ptr, buf, truelen);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+- }
+-
+- if (length != 4)
+- {
+- png_warning(png_ptr, "Incorrect gAMA chunk length");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- png_crc_read(png_ptr, buf, 4);
+-
+- if (png_crc_finish(png_ptr, 0))
+- return;
+-
+- igamma = png_get_fixed_point(NULL, buf);
+-
+- /* Check for zero gamma or an error. */
+- if (igamma <= 0)
+- {
+- png_warning(png_ptr,
+- "Ignoring gAMA chunk with out of range gamma");
+-
+- return;
+- }
+-
+-# ifdef PNG_READ_sRGB_SUPPORTED
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
+- {
+- if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
++
++ for (i=0; i<truelen; ++i)
++ if (buf[i] == 0 || buf[i] > sample_depth)
+ {
+- PNG_WARNING_PARAMETERS(p)
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_fixed, igamma);
+- png_formatted_warning(png_ptr, p,
+- "Ignoring incorrect gAMA value @1 when sRGB is also present");
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+- }
+-# endif /* PNG_READ_sRGB_SUPPORTED */
+-
+-# ifdef PNG_READ_GAMMA_SUPPORTED
+- /* Gamma correction on read is supported. */
+- png_ptr->gamma = igamma;
+-# endif
+- /* And set the 'info' structure members. */
+- png_set_gAMA_fixed(png_ptr, info_ptr, igamma);
+-}
+-#endif
+-
+-#ifdef PNG_READ_sBIT_SUPPORTED
+-void /* PRIVATE */
+-png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
+-{
+- png_size_t truelen;
+- png_byte buf[4];
+-
+- png_debug(1, "in png_handle_sBIT");
+-
+- buf[0] = buf[1] = buf[2] = buf[3] = 0;
+-
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before sBIT");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
+- {
+- png_warning(png_ptr, "Invalid sBIT after IDAT");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- {
+- /* Should be an error, but we can cope with it */
+- png_warning(png_ptr, "Out of place sBIT chunk");
+- }
+-
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT))
+- {
+- png_warning(png_ptr, "Duplicate sBIT chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+- truelen = 3;
+-
+- else
+- truelen = (png_size_t)png_ptr->channels;
+-
+- if (length != truelen || length > 4)
+- {
+- png_warning(png_ptr, "Incorrect sBIT chunk length");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- png_crc_read(png_ptr, buf, truelen);
+-
+- if (png_crc_finish(png_ptr, 0))
+- return;
+-
+- if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
++
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ png_ptr->sig_bit.red = buf[0];
+ png_ptr->sig_bit.green = buf[1];
+@@ -950,377 +1204,416 @@
+
+ #ifdef PNG_READ_cHRM_SUPPORTED
+ void /* PRIVATE */
+-png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_cHRM(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte buf[32];
+- png_fixed_point x_white, y_white, x_red, y_red, x_green, y_green, x_blue,
+- y_blue;
++ png_xy xy;
+
+ png_debug(1, "in png_handle_cHRM");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before cHRM");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
+ {
+- png_warning(png_ptr, "Invalid cHRM after IDAT");
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ if (length != 32)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
++ return;
++ }
++
++ png_crc_read(png_ptr, buf, 32);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
++ return;
++
++ xy.whitex = png_get_fixed_point(NULL, buf);
++ xy.whitey = png_get_fixed_point(NULL, buf + 4);
++ xy.redx = png_get_fixed_point(NULL, buf + 8);
++ xy.redy = png_get_fixed_point(NULL, buf + 12);
++ xy.greenx = png_get_fixed_point(NULL, buf + 16);
++ xy.greeny = png_get_fixed_point(NULL, buf + 20);
++ xy.bluex = png_get_fixed_point(NULL, buf + 24);
++ xy.bluey = png_get_fixed_point(NULL, buf + 28);
++
++ if (xy.whitex == PNG_FIXED_ERROR ||
++ xy.whitey == PNG_FIXED_ERROR ||
++ xy.redx == PNG_FIXED_ERROR ||
++ xy.redy == PNG_FIXED_ERROR ||
++ xy.greenx == PNG_FIXED_ERROR ||
++ xy.greeny == PNG_FIXED_ERROR ||
++ xy.bluex == PNG_FIXED_ERROR ||
++ xy.bluey == PNG_FIXED_ERROR)
++ {
++ png_chunk_benign_error(png_ptr, "invalid values");
++ return;
++ }
++
++ /* If a colorspace error has already been output skip this chunk */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
++ return;
++
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0)
++ {
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
++ png_colorspace_sync(png_ptr, info_ptr);
++ png_chunk_benign_error(png_ptr, "duplicate");
++ return;
++ }
++
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
++ (void)png_colorspace_set_chromaticities(png_ptr, &png_ptr->colorspace, &xy,
++ 1/*prefer cHRM values*/);
++ png_colorspace_sync(png_ptr, info_ptr);
++}
++#endif
++
++#ifdef PNG_READ_sRGB_SUPPORTED
++void /* PRIVATE */
++png_handle_sRGB(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
++{
++ png_byte intent;
++
++ png_debug(1, "in png_handle_sRGB");
++
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ if (length != 1)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
++ return;
++ }
++
++ png_crc_read(png_ptr, &intent, 1);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
++ return;
++
++ /* If a colorspace error has already been output skip this chunk */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
++ return;
++
++ /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
++ * this.
++ */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) != 0)
++ {
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
++ png_colorspace_sync(png_ptr, info_ptr);
++ png_chunk_benign_error(png_ptr, "too many profiles");
++ return;
++ }
++
++ (void)png_colorspace_set_sRGB(png_ptr, &png_ptr->colorspace, intent);
++ png_colorspace_sync(png_ptr, info_ptr);
++}
++#endif /* READ_sRGB */
++
++#ifdef PNG_READ_iCCP_SUPPORTED
++void /* PRIVATE */
++png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
++/* Note: this does not properly handle profiles that are > 64K under DOS */
++{
++ png_const_charp errmsg = NULL; /* error message output, or no error */
++ int finished = 0; /* crc checked */
++
++ png_debug(1, "in png_handle_iCCP");
++
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ /* Consistent with all the above colorspace handling an obviously *invalid*
++ * chunk is just ignored, so does not invalidate the color space. An
++ * alternative is to set the 'invalid' flags at the start of this routine
++ * and only clear them in they were not set before and all the tests pass.
++ * The minimum 'deflate' stream is assumed to be just the 2 byte header and
++ * 4 byte checksum. The keyword must be at least one character and there is
++ * a terminator (0) byte and the compression method.
++ */
++ if (length < 9)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "too short");
++ return;
++ }
++
++ /* If a colorspace error has already been output skip this chunk */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
++ {
+ png_crc_finish(png_ptr, length);
+ return;
+ }
+
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- /* Should be an error, but we can cope with it */
+- png_warning(png_ptr, "Missing PLTE before cHRM");
+-
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)
+-# ifdef PNG_READ_sRGB_SUPPORTED
+- && !(info_ptr->valid & PNG_INFO_sRGB)
+-# endif
+- )
++ /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
++ * this.
++ */
++ if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) == 0)
+ {
+- png_warning(png_ptr, "Duplicate cHRM chunk");
++ uInt read_length, keyword_length;
++ char keyword[81];
++
++ /* Find the keyword; the keyword plus separator and compression method
++ * bytes can be at most 81 characters long.
++ */
++ read_length = 81; /* maximum */
++ if (read_length > length)
++ read_length = (uInt)length;
++
++ png_crc_read(png_ptr, (png_bytep)keyword, read_length);
++ length -= read_length;
++
++ keyword_length = 0;
++ while (keyword_length < 80 && keyword_length < read_length &&
++ keyword[keyword_length] != 0)
++ ++keyword_length;
++
++ /* TODO: make the keyword checking common */
++ if (keyword_length >= 1 && keyword_length <= 79)
++ {
++ /* We only understand '0' compression - deflate - so if we get a
++ * different value we can't safely decode the chunk.
++ */
++ if (keyword_length+1 < read_length &&
++ keyword[keyword_length+1] == PNG_COMPRESSION_TYPE_BASE)
++ {
++ read_length -= keyword_length+2;
++
++ if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
++ {
++ Byte profile_header[132];
++ Byte local_buffer[PNG_INFLATE_BUF_SIZE];
++ png_alloc_size_t size = (sizeof profile_header);
++
++ png_ptr->zstream.next_in = (Bytef*)keyword + (keyword_length+2);
++ png_ptr->zstream.avail_in = read_length;
++ (void)png_inflate_read(png_ptr, local_buffer,
++ (sizeof local_buffer), &length, profile_header, &size,
++ 0/*finish: don't, because the output is too small*/);
++
++ if (size == 0)
++ {
++ /* We have the ICC profile header; do the basic header checks.
++ */
++ const png_uint_32 profile_length =
++ png_get_uint_32(profile_header);
++
++ if (png_icc_check_length(png_ptr, &png_ptr->colorspace,
++ keyword, profile_length) != 0)
++ {
++ /* The length is apparently ok, so we can check the 132
++ * byte header.
++ */
++ if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
++ keyword, profile_length, profile_header,
++ png_ptr->color_type) != 0)
++ {
++ /* Now read the tag table; a variable size buffer is
++ * needed at this point, allocate one for the whole
++ * profile. The header check has already validated
++ * that none of these stuff will overflow.
++ */
++ const png_uint_32 tag_count = png_get_uint_32(
++ profile_header+128);
++ png_bytep profile = png_read_buffer(png_ptr,
++ profile_length, 2/*silent*/);
++
++ if (profile != NULL)
++ {
++ memcpy(profile, profile_header,
++ (sizeof profile_header));
++
++ size = 12 * tag_count;
++
++ (void)png_inflate_read(png_ptr, local_buffer,
++ (sizeof local_buffer), &length,
++ profile + (sizeof profile_header), &size, 0);
++
++ /* Still expect a buffer error because we expect
++ * there to be some tag data!
++ */
++ if (size == 0)
++ {
++ if (png_icc_check_tag_table(png_ptr,
++ &png_ptr->colorspace, keyword, profile_length,
++ profile) != 0)
++ {
++ /* The profile has been validated for basic
++ * security issues, so read the whole thing in.
++ */
++ size = profile_length - (sizeof profile_header)
++ - 12 * tag_count;
++
++ (void)png_inflate_read(png_ptr, local_buffer,
++ (sizeof local_buffer), &length,
++ profile + (sizeof profile_header) +
++ 12 * tag_count, &size, 1/*finish*/);
++
++ if (length > 0 && !(png_ptr->flags &
++ PNG_FLAG_BENIGN_ERRORS_WARN))
++ errmsg = "extra compressed data";
++
++ /* But otherwise allow extra data: */
++ else if (size == 0)
++ {
++ if (length > 0)
++ {
++ /* This can be handled completely, so
++ * keep going.
++ */
++ png_chunk_warning(png_ptr,
++ "extra compressed data");
++ }
++
++ png_crc_finish(png_ptr, length);
++ finished = 1;
++
++# ifdef PNG_sRGB_SUPPORTED
++ /* Check for a match against sRGB */
++ png_icc_set_sRGB(png_ptr,
++ &png_ptr->colorspace, profile,
++ png_ptr->zstream.adler);
++# endif
++
++ /* Steal the profile for info_ptr. */
++ if (info_ptr != NULL)
++ {
++ png_free_data(png_ptr, info_ptr,
++ PNG_FREE_ICCP, 0);
++
++ info_ptr->iccp_name = png_voidcast(char*,
++ png_malloc_base(png_ptr,
++ keyword_length+1));
++ if (info_ptr->iccp_name != NULL)
++ {
++ memcpy(info_ptr->iccp_name, keyword,
++ keyword_length+1);
++ info_ptr->iccp_proflen =
++ profile_length;
++ info_ptr->iccp_profile = profile;
++ png_ptr->read_buffer = NULL; /*steal*/
++ info_ptr->free_me |= PNG_FREE_ICCP;
++ info_ptr->valid |= PNG_INFO_iCCP;
++ }
++
++ else
++ {
++ png_ptr->colorspace.flags |=
++ PNG_COLORSPACE_INVALID;
++ errmsg = "out of memory";
++ }
++ }
++
++ /* else the profile remains in the read
++ * buffer which gets reused for subsequent
++ * chunks.
++ */
++
++ if (info_ptr != NULL)
++ png_colorspace_sync(png_ptr, info_ptr);
++
++ if (errmsg == NULL)
++ {
++ png_ptr->zowner = 0;
++ return;
++ }
++ }
++
++ else if (size > 0)
++ errmsg = "truncated";
++
++ else
++ errmsg = png_ptr->zstream.msg;
++ }
++
++ /* else png_icc_check_tag_table output an error */
++ }
++
++ else /* profile truncated */
++ errmsg = png_ptr->zstream.msg;
++ }
++
++ else
++ errmsg = "out of memory";
++ }
++
++ /* else png_icc_check_header output an error */
++ }
++
++ /* else png_icc_check_length output an error */
++ }
++
++ else /* profile truncated */
++ errmsg = png_ptr->zstream.msg;
++
++ /* Release the stream */
++ png_ptr->zowner = 0;
++ }
++
++ else /* png_inflate_claim failed */
++ errmsg = png_ptr->zstream.msg;
++ }
++
++ else
++ errmsg = "bad compression method"; /* or missing */
++ }
++
++ else
++ errmsg = "bad keyword";
++ }
++
++ else
++ errmsg = "too many profiles";
++
++ /* Failure: the reason is in 'errmsg' */
++ if (finished == 0)
+ png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- if (length != 32)
+- {
+- png_warning(png_ptr, "Incorrect cHRM chunk length");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- png_crc_read(png_ptr, buf, 32);
+-
+- if (png_crc_finish(png_ptr, 0))
+- return;
+-
+- x_white = png_get_fixed_point(NULL, buf);
+- y_white = png_get_fixed_point(NULL, buf + 4);
+- x_red = png_get_fixed_point(NULL, buf + 8);
+- y_red = png_get_fixed_point(NULL, buf + 12);
+- x_green = png_get_fixed_point(NULL, buf + 16);
+- y_green = png_get_fixed_point(NULL, buf + 20);
+- x_blue = png_get_fixed_point(NULL, buf + 24);
+- y_blue = png_get_fixed_point(NULL, buf + 28);
+-
+- if (x_white == PNG_FIXED_ERROR ||
+- y_white == PNG_FIXED_ERROR ||
+- x_red == PNG_FIXED_ERROR ||
+- y_red == PNG_FIXED_ERROR ||
+- x_green == PNG_FIXED_ERROR ||
+- y_green == PNG_FIXED_ERROR ||
+- x_blue == PNG_FIXED_ERROR ||
+- y_blue == PNG_FIXED_ERROR)
+- {
+- png_warning(png_ptr, "Ignoring cHRM chunk with negative chromaticities");
+- return;
+- }
+-
+-#ifdef PNG_READ_sRGB_SUPPORTED
+- if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB))
+- {
+- if (PNG_OUT_OF_RANGE(x_white, 31270, 1000) ||
+- PNG_OUT_OF_RANGE(y_white, 32900, 1000) ||
+- PNG_OUT_OF_RANGE(x_red, 64000L, 1000) ||
+- PNG_OUT_OF_RANGE(y_red, 33000, 1000) ||
+- PNG_OUT_OF_RANGE(x_green, 30000, 1000) ||
+- PNG_OUT_OF_RANGE(y_green, 60000L, 1000) ||
+- PNG_OUT_OF_RANGE(x_blue, 15000, 1000) ||
+- PNG_OUT_OF_RANGE(y_blue, 6000, 1000))
+- {
+- PNG_WARNING_PARAMETERS(p)
+-
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_fixed, x_white);
+- png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_fixed, y_white);
+- png_warning_parameter_signed(p, 3, PNG_NUMBER_FORMAT_fixed, x_red);
+- png_warning_parameter_signed(p, 4, PNG_NUMBER_FORMAT_fixed, y_red);
+- png_warning_parameter_signed(p, 5, PNG_NUMBER_FORMAT_fixed, x_green);
+- png_warning_parameter_signed(p, 6, PNG_NUMBER_FORMAT_fixed, y_green);
+- png_warning_parameter_signed(p, 7, PNG_NUMBER_FORMAT_fixed, x_blue);
+- png_warning_parameter_signed(p, 8, PNG_NUMBER_FORMAT_fixed, y_blue);
+-
+- png_formatted_warning(png_ptr, p,
+- "Ignoring incorrect cHRM white(@1,@2) r(@3,@4)g(@5,@6)b(@7,@8) "
+- "when sRGB is also present");
+- }
+- return;
+- }
+-#endif /* PNG_READ_sRGB_SUPPORTED */
+-
+-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+- /* Store the _white values as default coefficients for the rgb to gray
+- * operation if it is supported.
+- */
+- if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == 0)
+- {
+- /* png_set_background has not been called, the coefficients must be in
+- * range for the following to work without overflow.
+- */
+- if (y_red <= (1<<17) && y_green <= (1<<17) && y_blue <= (1<<17))
+- {
+- /* The y values are chromaticities: Y/X+Y+Z, the weights for the gray
+- * transformation are simply the normalized Y values for red, green and
+- * blue scaled by 32768.
+- */
+- png_uint_32 w = y_red + y_green + y_blue;
+-
+- png_ptr->rgb_to_gray_red_coeff = (png_uint_16)(((png_uint_32)y_red *
+- 32768)/w);
+- png_ptr->rgb_to_gray_green_coeff = (png_uint_16)(((png_uint_32)y_green
+- * 32768)/w);
+- png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(((png_uint_32)y_blue *
+- 32768)/w);
+- }
+- }
+-#endif
+-
+- png_set_cHRM_fixed(png_ptr, info_ptr, x_white, y_white, x_red, y_red,
+- x_green, y_green, x_blue, y_blue);
++
++ png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
++ png_colorspace_sync(png_ptr, info_ptr);
++ if (errmsg != NULL) /* else already output */
++ png_chunk_benign_error(png_ptr, errmsg);
+ }
+-#endif
+-
+-#ifdef PNG_READ_sRGB_SUPPORTED
++#endif /* READ_iCCP */
++
++#ifdef PNG_READ_sPLT_SUPPORTED
+ void /* PRIVATE */
+-png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
+-{
+- int intent;
+- png_byte buf[1];
+-
+- png_debug(1, "in png_handle_sRGB");
+-
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before sRGB");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
+- {
+- png_warning(png_ptr, "Invalid sRGB after IDAT");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- /* Should be an error, but we can cope with it */
+- png_warning(png_ptr, "Out of place sRGB chunk");
+-
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
+- {
+- png_warning(png_ptr, "Duplicate sRGB chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- if (length != 1)
+- {
+- png_warning(png_ptr, "Incorrect sRGB chunk length");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- png_crc_read(png_ptr, buf, 1);
+-
+- if (png_crc_finish(png_ptr, 0))
+- return;
+-
+- intent = buf[0];
+-
+- /* Check for bad intent */
+- if (intent >= PNG_sRGB_INTENT_LAST)
+- {
+- png_warning(png_ptr, "Unknown sRGB intent");
+- return;
+- }
+-
+-#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED)
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA))
+- {
+- if (PNG_OUT_OF_RANGE(info_ptr->gamma, 45500L, 500))
+- {
+- PNG_WARNING_PARAMETERS(p)
+-
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_fixed,
+- info_ptr->gamma);
+-
+- png_formatted_warning(png_ptr, p,
+- "Ignoring incorrect gAMA value @1 when sRGB is also present");
+- }
+- }
+-#endif /* PNG_READ_gAMA_SUPPORTED */
+-
+-#ifdef PNG_READ_cHRM_SUPPORTED
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
+- if (PNG_OUT_OF_RANGE(info_ptr->x_white, 31270, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->y_white, 32900, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->x_red, 64000L, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->y_red, 33000, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->x_green, 30000, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->y_green, 60000L, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->x_blue, 15000, 1000) ||
+- PNG_OUT_OF_RANGE(info_ptr->y_blue, 6000, 1000))
+- {
+- png_warning(png_ptr,
+- "Ignoring incorrect cHRM value when sRGB is also present");
+- }
+-#endif /* PNG_READ_cHRM_SUPPORTED */
+-
+- png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent);
+-}
+-#endif /* PNG_READ_sRGB_SUPPORTED */
+-
+-#ifdef PNG_READ_iCCP_SUPPORTED
+-void /* PRIVATE */
+-png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ /* Note: this does not properly handle chunks that are > 64K under DOS */
+ {
+- png_byte compression_type;
+- png_bytep pC;
+- png_charp profile;
+- png_uint_32 skip = 0;
+- png_uint_32 profile_size;
+- png_alloc_size_t profile_length;
+- png_size_t slength, prefix_length, data_length;
+-
+- png_debug(1, "in png_handle_iCCP");
+-
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before iCCP");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
+- {
+- png_warning(png_ptr, "Invalid iCCP after IDAT");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- else if (png_ptr->mode & PNG_HAVE_PLTE)
+- /* Should be an error, but we can cope with it */
+- png_warning(png_ptr, "Out of place iCCP chunk");
+-
+- if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP))
+- {
+- png_warning(png_ptr, "Duplicate iCCP chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+-#ifdef PNG_MAX_MALLOC_64K
+- if (length > (png_uint_32)65535L)
+- {
+- png_warning(png_ptr, "iCCP chunk too large to fit in memory");
+- skip = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
+- }
+-#endif
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, skip))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- png_ptr->chunkdata[slength] = 0x00;
+-
+- for (profile = png_ptr->chunkdata; *profile; profile++)
+- /* Empty loop to find end of name */ ;
+-
+- ++profile;
+-
+- /* There should be at least one zero (the compression type byte)
+- * following the separator, and we should be on it
+- */
+- if (profile >= png_ptr->chunkdata + slength - 1)
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- png_warning(png_ptr, "Malformed iCCP chunk");
+- return;
+- }
+-
+- /* Compression_type should always be zero */
+- compression_type = *profile++;
+-
+- if (compression_type)
+- {
+- png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk");
+- compression_type = 0x00; /* Reset it to zero (libpng-1.0.6 through 1.0.8
+- wrote nonzero) */
+- }
+-
+- prefix_length = profile - png_ptr->chunkdata;
+- png_decompress_chunk(png_ptr, compression_type,
+- slength, prefix_length, &data_length);
+-
+- profile_length = data_length - prefix_length;
+-
+- if (prefix_length > data_length || profile_length < 4)
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- png_warning(png_ptr, "Profile size field missing from iCCP chunk");
+- return;
+- }
+-
+- /* Check the profile_size recorded in the first 32 bits of the ICC profile */
+- pC = (png_bytep)(png_ptr->chunkdata + prefix_length);
+- profile_size = ((*(pC )) << 24) |
+- ((*(pC + 1)) << 16) |
+- ((*(pC + 2)) << 8) |
+- ((*(pC + 3)) );
+-
+- /* NOTE: the following guarantees that 'profile_length' fits into 32 bits,
+- * because profile_size is a 32 bit value.
+- */
+- if (profile_size < profile_length)
+- profile_length = profile_size;
+-
+- /* And the following guarantees that profile_size == profile_length. */
+- if (profile_size > profile_length)
+- {
+- PNG_WARNING_PARAMETERS(p)
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+-
+- png_warning_parameter_unsigned(p, 1, PNG_NUMBER_FORMAT_u, profile_size);
+- png_warning_parameter_unsigned(p, 2, PNG_NUMBER_FORMAT_u, profile_length);
+- png_formatted_warning(png_ptr, p,
+- "Ignoring iCCP chunk with declared size = @1 and actual length = @2");
+- return;
+- }
+-
+- png_set_iCCP(png_ptr, info_ptr, png_ptr->chunkdata,
+- compression_type, (png_bytep)png_ptr->chunkdata + prefix_length,
+- profile_size);
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+-}
+-#endif /* PNG_READ_iCCP_SUPPORTED */
+-
+-#ifdef PNG_READ_sPLT_SUPPORTED
+-void /* PRIVATE */
+-png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
+-/* Note: this does not properly handle chunks that are > 64K under DOS */
+-{
+- png_bytep entry_start;
++ png_bytep entry_start, buffer;
+ png_sPLT_t new_palette;
+ png_sPLT_entryp pp;
+ png_uint_32 data_length;
+ int entry_size, i;
+ png_uint_32 skip = 0;
+- png_size_t slength;
+ png_uint_32 dl;
+ png_size_t max_dl;
+
+ png_debug(1, "in png_handle_sPLT");
+
+ #ifdef PNG_USER_LIMITS_SUPPORTED
+-
+ if (png_ptr->user_chunk_cache_max != 0)
+ {
+ if (png_ptr->user_chunk_cache_max == 1)
+@@ -1338,55 +1631,53 @@
+ }
+ #endif
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before sPLT");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid sPLT after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+ #ifdef PNG_MAX_MALLOC_64K
+- if (length > (png_uint_32)65535L)
++ if (length > 65535U)
+ {
+- png_warning(png_ptr, "sPLT chunk too large to fit in memory");
+- skip = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "too large to fit in memory");
++ return;
+ }
+ #endif
+
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
++ buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
++ if (buffer == NULL)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of memory");
++ return;
++ }
++
+
+ /* WARNING: this may break if size_t is less than 32 bits; it is assumed
+ * that the PNG_MAX_MALLOC_64K test is enabled in this case, but this is a
+ * potential breakage point if the types in pngconf.h aren't exactly right.
+ */
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, skip))
++ png_crc_read(png_ptr, buffer, length);
++
++ if (png_crc_finish(png_ptr, skip) != 0)
++ return;
++
++ buffer[length] = 0;
++
++ for (entry_start = buffer; *entry_start; entry_start++)
++ /* Empty loop to find end of name */ ;
++
++ ++entry_start;
++
++ /* A sample depth should follow the separator, and we should be on it */
++ if (entry_start > buffer + length - 2)
+ {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- png_ptr->chunkdata[slength] = 0x00;
+-
+- for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start;
+- entry_start++)
+- /* Empty loop to find end of name */ ;
+-
+- ++entry_start;
+-
+- /* A sample depth should follow the separator, and we should be on it */
+- if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2)
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+ png_warning(png_ptr, "malformed sPLT chunk");
+ return;
+ }
+@@ -1394,23 +1685,19 @@
+ new_palette.depth = *entry_start++;
+ entry_size = (new_palette.depth == 8 ? 6 : 10);
+ /* This must fit in a png_uint_32 because it is derived from the original
+- * chunk data length (and use 'length', not 'slength' here for clarity -
+- * they are guaranteed to be the same, see the tests above.)
++ * chunk data length.
+ */
+- data_length = length - (png_uint_32)(entry_start -
+- (png_bytep)png_ptr->chunkdata);
++ data_length = length - (png_uint_32)(entry_start - buffer);
+
+ /* Integrity-check the data length */
+- if (data_length % entry_size)
++ if ((data_length % entry_size) != 0)
+ {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+ png_warning(png_ptr, "sPLT chunk has bad length");
+ return;
+ }
+
+ dl = (png_int_32)(data_length / entry_size);
+- max_dl = PNG_SIZE_MAX / png_sizeof(png_sPLT_entry);
++ max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
+
+ if (dl > max_dl)
+ {
+@@ -1421,7 +1708,7 @@
+ new_palette.nentries = (png_int_32)(data_length / entry_size);
+
+ new_palette.entries = (png_sPLT_entryp)png_malloc_warn(
+- png_ptr, new_palette.nentries * png_sizeof(png_sPLT_entry));
++ png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry)));
+
+ if (new_palette.entries == NULL)
+ {
+@@ -1479,38 +1766,36 @@
+ #endif
+
+ /* Discard all chunk data except the name and stash that */
+- new_palette.name = png_ptr->chunkdata;
++ new_palette.name = (png_charp)buffer;
+
+ png_set_sPLT(png_ptr, info_ptr, &new_palette, 1);
+
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+ png_free(png_ptr, new_palette.entries);
+ }
+-#endif /* PNG_READ_sPLT_SUPPORTED */
++#endif /* READ_sPLT */
+
+ #ifdef PNG_READ_tRNS_SUPPORTED
+ void /* PRIVATE */
+-png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
+
+ png_debug(1, "in png_handle_tRNS");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before tRNS");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid tRNS after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)
+ {
+- png_warning(png_ptr, "Duplicate tRNS chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+@@ -1520,8 +1805,8 @@
+
+ if (length != 2)
+ {
+- png_warning(png_ptr, "Incorrect tRNS chunk length");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+@@ -1536,12 +1821,12 @@
+
+ if (length != 6)
+ {
+- png_warning(png_ptr, "Incorrect tRNS chunk length");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+- png_crc_read(png_ptr, buf, (png_size_t)length);
++ png_crc_read(png_ptr, buf, length);
+ png_ptr->num_trans = 1;
+ png_ptr->trans_color.red = png_get_uint_16(buf);
+ png_ptr->trans_color.green = png_get_uint_16(buf + 2);
+@@ -1550,44 +1835,43 @@
+
+ else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+- if (!(png_ptr->mode & PNG_HAVE_PLTE))
++ if ((png_ptr->mode & PNG_HAVE_PLTE) == 0)
+ {
+- /* Should be an error, but we can cope with it. */
+- png_warning(png_ptr, "Missing PLTE before tRNS");
+- }
+-
+- if (length > (png_uint_32)png_ptr->num_palette ||
+- length > PNG_MAX_PALETTE_LENGTH)
+- {
+- png_warning(png_ptr, "Incorrect tRNS chunk length");
++ /* TODO: is this actually an error in the ISO spec? */
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- if (length == 0)
++ if (length > png_ptr->num_palette || length > PNG_MAX_PALETTE_LENGTH ||
++ length == 0)
+ {
+- png_warning(png_ptr, "Zero length tRNS chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+- png_crc_read(png_ptr, readbuf, (png_size_t)length);
++ png_crc_read(png_ptr, readbuf, length);
+ png_ptr->num_trans = (png_uint_16)length;
+ }
+
+ else
+ {
+- png_warning(png_ptr, "tRNS chunk not allowed with alpha channel");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid with alpha channel");
+ return;
+ }
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ {
+ png_ptr->num_trans = 0;
+ return;
+ }
+
++ /* TODO: this is a horrible side effect in the palette case because the
++ * png_struct ends up with a pointer to the tRNS buffer owned by the
++ * png_info. Fix this.
++ */
+ png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
+ &(png_ptr->trans_color));
+ }
+@@ -1595,58 +1879,52 @@
+
+ #ifdef PNG_READ_bKGD_SUPPORTED
+ void /* PRIVATE */
+-png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+- png_size_t truelen;
++ unsigned int truelen;
+ png_byte buf[6];
+ png_color_16 background;
+
+ png_debug(1, "in png_handle_bKGD");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before bKGD");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
++ (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
++ (png_ptr->mode & PNG_HAVE_PLTE) == 0))
+ {
+- png_warning(png_ptr, "Invalid bKGD after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
+- !(png_ptr->mode & PNG_HAVE_PLTE))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
+ {
+- png_warning(png_ptr, "Missing PLTE before bKGD");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD))
++ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ truelen = 1;
++
++ else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
++ truelen = 6;
++
++ else
++ truelen = 2;
++
++ if (length != truelen)
+ {
+- png_warning(png_ptr, "Duplicate bKGD chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+- truelen = 1;
+-
+- else if (png_ptr->color_type & PNG_COLOR_MASK_COLOR)
+- truelen = 6;
+-
+- else
+- truelen = 2;
+-
+- if (length != truelen)
+- {
+- png_warning(png_ptr, "Incorrect bKGD chunk length");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+ png_crc_read(png_ptr, buf, truelen);
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ /* We convert the index value into RGB components so that we can allow
+@@ -1658,11 +1936,11 @@
+ {
+ background.index = buf[0];
+
+- if (info_ptr && info_ptr->num_palette)
++ if (info_ptr != NULL && info_ptr->num_palette != 0)
+ {
+ if (buf[0] >= info_ptr->num_palette)
+ {
+- png_warning(png_ptr, "Incorrect bKGD chunk index value");
++ png_chunk_benign_error(png_ptr, "invalid index");
+ return;
+ }
+
+@@ -1677,7 +1955,7 @@
+ background.gray = 0;
+ }
+
+- else if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) /* GRAY */
++ else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) /* GRAY */
+ {
+ background.index = 0;
+ background.red =
+@@ -1701,44 +1979,37 @@
+
+ #ifdef PNG_READ_hIST_SUPPORTED
+ void /* PRIVATE */
+-png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ unsigned int num, i;
+ png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
+
+ png_debug(1, "in png_handle_hIST");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before hIST");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
++ (png_ptr->mode & PNG_HAVE_PLTE) == 0)
+ {
+- png_warning(png_ptr, "Invalid hIST after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (!(png_ptr->mode & PNG_HAVE_PLTE))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
+ {
+- png_warning(png_ptr, "Missing PLTE before hIST");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST))
++ num = length / 2 ;
++
++ if (num != png_ptr->num_palette || num > PNG_MAX_PALETTE_LENGTH)
+ {
+- png_warning(png_ptr, "Duplicate hIST chunk");
+ png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- num = length / 2 ;
+-
+- if (num != (unsigned int)png_ptr->num_palette || num >
+- (unsigned int)PNG_MAX_PALETTE_LENGTH)
+- {
+- png_warning(png_ptr, "Incorrect hIST chunk length");
+- png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+@@ -1750,7 +2021,7 @@
+ readbuf[i] = png_get_uint_16(buf);
+ }
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ png_set_hIST(png_ptr, info_ptr, readbuf);
+@@ -1759,7 +2030,7 @@
+
+ #ifdef PNG_READ_pHYs_SUPPORTED
+ void /* PRIVATE */
+-png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_pHYs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte buf[9];
+ png_uint_32 res_x, res_y;
+@@ -1767,33 +2038,33 @@
+
+ png_debug(1, "in png_handle_pHYs");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before pHYs");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid pHYs after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0)
+ {
+- png_warning(png_ptr, "Duplicate pHYs chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+ if (length != 9)
+ {
+- png_warning(png_ptr, "Incorrect pHYs chunk length");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+ png_crc_read(png_ptr, buf, 9);
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ res_x = png_get_uint_32(buf);
+@@ -1805,7 +2076,7 @@
+
+ #ifdef PNG_READ_oFFs_SUPPORTED
+ void /* PRIVATE */
+-png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_oFFs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte buf[9];
+ png_int_32 offset_x, offset_y;
+@@ -1813,33 +2084,33 @@
+
+ png_debug(1, "in png_handle_oFFs");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before oFFs");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid oFFs after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0)
+ {
+- png_warning(png_ptr, "Duplicate oFFs chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+ if (length != 9)
+ {
+- png_warning(png_ptr, "Incorrect oFFs chunk length");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+ png_crc_read(png_ptr, buf, 9);
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ offset_x = png_get_int_32(buf);
+@@ -1852,71 +2123,64 @@
+ #ifdef PNG_READ_pCAL_SUPPORTED
+ /* Read the pCAL chunk (described in the PNG Extensions document) */
+ void /* PRIVATE */
+-png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_int_32 X0, X1;
+ png_byte type, nparams;
+- png_charp buf, units, endptr;
++ png_bytep buffer, buf, units, endptr;
+ png_charpp params;
+- png_size_t slength;
+ int i;
+
+ png_debug(1, "in png_handle_pCAL");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before pCAL");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid pCAL after IDAT");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL))
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) != 0)
+ {
+- png_warning(png_ptr, "Duplicate pCAL chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+ png_debug1(2, "Allocating and reading pCAL chunk data (%u bytes)",
+ length + 1);
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+-
+- if (png_ptr->chunkdata == NULL)
++
++ buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
++
++ if (buffer == NULL)
+ {
+- png_warning(png_ptr, "No memory for pCAL purpose");
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
+ }
+
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, 0))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_crc_read(png_ptr, buffer, length);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+- }
+-
+- png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
++
++ buffer[length] = 0; /* Null terminate the last string */
+
+ png_debug(3, "Finding end of pCAL purpose string");
+- for (buf = png_ptr->chunkdata; *buf; buf++)
++ for (buf = buffer; *buf; buf++)
+ /* Empty loop */ ;
+
+- endptr = png_ptr->chunkdata + slength;
++ endptr = buffer + length;
+
+ /* We need to have at least 12 bytes after the purpose string
+ * in order to get the parameter information.
+ */
+ if (endptr <= buf + 12)
+ {
+- png_warning(png_ptr, "Invalid pCAL data");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+@@ -1936,15 +2200,13 @@
+ (type == PNG_EQUATION_ARBITRARY && nparams != 3) ||
+ (type == PNG_EQUATION_HYPERBOLIC && nparams != 4))
+ {
+- png_warning(png_ptr, "Invalid pCAL parameters for equation type");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_chunk_benign_error(png_ptr, "invalid parameter count");
+ return;
+ }
+
+ else if (type >= PNG_EQUATION_LAST)
+ {
+- png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
++ png_chunk_benign_error(png_ptr, "unrecognized equation type");
+ }
+
+ for (buf = units; *buf; buf++)
+@@ -1952,43 +2214,37 @@
+
+ png_debug(3, "Allocating pCAL parameters array");
+
+- params = (png_charpp)png_malloc_warn(png_ptr,
+- (png_size_t)(nparams * png_sizeof(png_charp)));
++ params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
++ nparams * (sizeof (png_charp))));
+
+ if (params == NULL)
+ {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- png_warning(png_ptr, "No memory for pCAL params");
++ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
+ }
+
+ /* Get pointers to the start of each parameter string. */
+- for (i = 0; i < (int)nparams; i++)
++ for (i = 0; i < nparams; i++)
+ {
+ buf++; /* Skip the null string terminator from previous parameter. */
+
+ png_debug1(3, "Reading pCAL parameter %d", i);
+
+- for (params[i] = buf; buf <= endptr && *buf != 0x00; buf++)
++ for (params[i] = (png_charp)buf; buf <= endptr && *buf != 0; buf++)
+ /* Empty loop to move past each parameter string */ ;
+
+ /* Make sure we haven't run out of data yet */
+ if (buf > endptr)
+ {
+- png_warning(png_ptr, "Invalid pCAL data");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+ png_free(png_ptr, params);
++ png_chunk_benign_error(png_ptr, "invalid data");
+ return;
+ }
+ }
+
+- png_set_pCAL(png_ptr, info_ptr, png_ptr->chunkdata, X0, X1, type, nparams,
+- units, params);
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_set_pCAL(png_ptr, info_ptr, (png_charp)buffer, X0, X1, type, nparams,
++ (png_charp)units, params);
++
+ png_free(png_ptr, params);
+ }
+ #endif
+@@ -1996,67 +2252,61 @@
+ #ifdef PNG_READ_sCAL_SUPPORTED
+ /* Read the sCAL chunk */
+ void /* PRIVATE */
+-png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+- png_size_t slength, i;
++ png_bytep buffer;
++ png_size_t i;
+ int state;
+
+ png_debug(1, "in png_handle_sCAL");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before sCAL");
+-
+- else if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+- png_warning(png_ptr, "Invalid sCAL after IDAT");
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of place");
++ return;
++ }
++
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
++ return;
++ }
++
++ /* Need unit type, width, \0, height: minimum 4 bytes */
++ else if (length < 4)
++ {
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
++ return;
++ }
++
++ png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
++ length + 1);
++
++ buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
++
++ if (buffer == NULL)
++ {
++ png_chunk_benign_error(png_ptr, "out of memory");
+ png_crc_finish(png_ptr, length);
+ return;
+ }
+
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL))
++ png_crc_read(png_ptr, buffer, length);
++ buffer[length] = 0; /* Null terminate the last string */
++
++ if (png_crc_finish(png_ptr, 0) != 0)
++ return;
++
++ /* Validate the unit. */
++ if (buffer[0] != 1 && buffer[0] != 2)
+ {
+- png_warning(png_ptr, "Duplicate sCAL chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- /* Need unit type, width, \0, height: minimum 4 bytes */
+- else if (length < 4)
+- {
+- png_warning(png_ptr, "sCAL chunk too short");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
+- length + 1);
+-
+- png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+-
+- if (png_ptr->chunkdata == NULL)
+- {
+- png_warning(png_ptr, "Out of memory while processing sCAL chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+- png_ptr->chunkdata[slength] = 0x00; /* Null terminate the last string */
+-
+- if (png_crc_finish(png_ptr, 0))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- /* Validate the unit. */
+- if (png_ptr->chunkdata[0] != 1 && png_ptr->chunkdata[0] != 2)
+- {
+- png_warning(png_ptr, "Invalid sCAL ignored: invalid unit");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_chunk_benign_error(png_ptr, "invalid unit");
+ return;
+ }
+
+@@ -2066,70 +2316,65 @@
+ i = 1;
+ state = 0;
+
+- if (!png_check_fp_number(png_ptr->chunkdata, slength, &state, &i) ||
+- i >= slength || png_ptr->chunkdata[i++] != 0)
+- png_warning(png_ptr, "Invalid sCAL chunk ignored: bad width format");
+-
+- else if (!PNG_FP_IS_POSITIVE(state))
+- png_warning(png_ptr, "Invalid sCAL chunk ignored: non-positive width");
++ if (png_check_fp_number((png_const_charp)buffer, length, &state, &i) == 0 ||
++ i >= length || buffer[i++] != 0)
++ png_chunk_benign_error(png_ptr, "bad width format");
++
++ else if (PNG_FP_IS_POSITIVE(state) == 0)
++ png_chunk_benign_error(png_ptr, "non-positive width");
+
+ else
+ {
+ png_size_t heighti = i;
+
+ state = 0;
+- if (!png_check_fp_number(png_ptr->chunkdata, slength, &state, &i) ||
+- i != slength)
+- png_warning(png_ptr, "Invalid sCAL chunk ignored: bad height format");
+-
+- else if (!PNG_FP_IS_POSITIVE(state))
+- png_warning(png_ptr,
+- "Invalid sCAL chunk ignored: non-positive height");
++ if (png_check_fp_number((png_const_charp)buffer, length,
++ &state, &i) == 0 || i != length)
++ png_chunk_benign_error(png_ptr, "bad height format");
++
++ else if (PNG_FP_IS_POSITIVE(state) == 0)
++ png_chunk_benign_error(png_ptr, "non-positive height");
+
+ else
+ /* This is the (only) success case. */
+- png_set_sCAL_s(png_ptr, info_ptr, png_ptr->chunkdata[0],
+- png_ptr->chunkdata+1, png_ptr->chunkdata+heighti);
++ png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
++ (png_charp)buffer+1, (png_charp)buffer+heighti);
+ }
+-
+- /* Clean up - just free the temporarily allocated buffer. */
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+ }
+ #endif
+
+ #ifdef PNG_READ_tIME_SUPPORTED
+ void /* PRIVATE */
+-png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+ png_byte buf[7];
+ png_time mod_time;
+
+ png_debug(1, "in png_handle_tIME");
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Out of place tIME chunk");
+-
+- else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME))
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) != 0)
+ {
+- png_warning(png_ptr, "Duplicate tIME chunk");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "duplicate");
+ return;
+ }
+
+- if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ png_ptr->mode |= PNG_AFTER_IDAT;
+
+ if (length != 7)
+ {
+- png_warning(png_ptr, "Incorrect tIME chunk length");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "invalid");
+ return;
+ }
+
+ png_crc_read(png_ptr, buf, 7);
+
+- if (png_crc_finish(png_ptr, 0))
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+
+ mod_time.second = buf[6];
+@@ -2146,14 +2391,13 @@
+ #ifdef PNG_READ_tEXt_SUPPORTED
+ /* Note: this does not properly handle chunks that are > 64K under DOS */
+ void /* PRIVATE */
+-png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+- png_textp text_ptr;
++ png_text text_info;
++ png_bytep buffer;
+ png_charp key;
+ png_charp text;
+ png_uint_32 skip = 0;
+- png_size_t slength;
+- int ret;
+
+ png_debug(1, "in png_handle_tEXt");
+
+@@ -2168,84 +2412,59 @@
+
+ if (--png_ptr->user_chunk_cache_max == 1)
+ {
+- png_warning(png_ptr, "No space in chunk cache for tEXt");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "no space in chunk cache");
+ return;
+ }
+ }
+ #endif
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before tEXt");
+-
+- if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ png_ptr->mode |= PNG_AFTER_IDAT;
+
+ #ifdef PNG_MAX_MALLOC_64K
+- if (length > (png_uint_32)65535L)
++ if (length > 65535U)
+ {
+- png_warning(png_ptr, "tEXt chunk too large to fit in memory");
+- skip = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "too large to fit in memory");
++ return;
+ }
+ #endif
+
+- png_free(png_ptr, png_ptr->chunkdata);
+-
+- png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+-
+- if (png_ptr->chunkdata == NULL)
++ buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
++
++ if (buffer == NULL)
+ {
+- png_warning(png_ptr, "No memory to process text chunk");
++ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
+ }
+
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, skip))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
++ png_crc_read(png_ptr, buffer, length);
++
++ if (png_crc_finish(png_ptr, skip) != 0)
+ return;
+- }
+-
+- key = png_ptr->chunkdata;
+-
+- key[slength] = 0x00;
++
++ key = (png_charp)buffer;
++ key[length] = 0;
+
+ for (text = key; *text; text++)
+ /* Empty loop to find end of key */ ;
+
+- if (text != key + slength)
++ if (text != key + length)
+ text++;
+
+- text_ptr = (png_textp)png_malloc_warn(png_ptr,
+- png_sizeof(png_text));
+-
+- if (text_ptr == NULL)
+- {
+- png_warning(png_ptr, "Not enough memory to process text chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
+- text_ptr->key = key;
+- text_ptr->lang = NULL;
+- text_ptr->lang_key = NULL;
+- text_ptr->itxt_length = 0;
+- text_ptr->text = text;
+- text_ptr->text_length = png_strlen(text);
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- png_free(png_ptr, text_ptr);
+-
+- if (ret)
++ text_info.compression = PNG_TEXT_COMPRESSION_NONE;
++ text_info.key = key;
++ text_info.lang = NULL;
++ text_info.lang_key = NULL;
++ text_info.itxt_length = 0;
++ text_info.text = text;
++ text_info.text_length = strlen(text);
++
++ if (png_set_text_2(png_ptr, info_ptr, &text_info, 1) != 0)
+ png_warning(png_ptr, "Insufficient memory to process text chunk");
+ }
+ #endif
+@@ -2253,13 +2472,11 @@
+ #ifdef PNG_READ_zTXt_SUPPORTED
+ /* Note: this does not correctly handle chunks that are > 64K under DOS */
+ void /* PRIVATE */
+-png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+- png_textp text_ptr;
+- png_charp text;
+- int comp_type;
+- int ret;
+- png_size_t slength, prefix_len, data_len;
++ png_const_charp errmsg = NULL;
++ png_bytep buffer;
++ png_uint_32 keyword_length;
+
+ png_debug(1, "in png_handle_zTXt");
+
+@@ -2274,123 +2491,101 @@
+
+ if (--png_ptr->user_chunk_cache_max == 1)
+ {
+- png_warning(png_ptr, "No space in chunk cache for zTXt");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "no space in chunk cache");
+ return;
+ }
+ }
+ #endif
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before zTXt");
+-
+- if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ png_ptr->mode |= PNG_AFTER_IDAT;
+
+-#ifdef PNG_MAX_MALLOC_64K
+- /* We will no doubt have problems with chunks even half this size, but
+- * there is no hard and fast rule to tell us where to stop.
+- */
+- if (length > (png_uint_32)65535L)
++ buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
++
++ if (buffer == NULL)
+ {
+- png_warning(png_ptr, "zTXt chunk too large to fit in memory");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
+ }
+-#endif
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+-
+- if (png_ptr->chunkdata == NULL)
+- {
+- png_warning(png_ptr, "Out of memory processing zTXt chunk");
++
++ png_crc_read(png_ptr, buffer, length);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
+ return;
+- }
+-
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, 0))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- png_ptr->chunkdata[slength] = 0x00;
+-
+- for (text = png_ptr->chunkdata; *text; text++)
+- /* Empty loop */ ;
+-
+- /* zTXt must have some text after the chunkdataword */
+- if (text >= png_ptr->chunkdata + slength - 2)
+- {
+- png_warning(png_ptr, "Truncated zTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
++
++ /* TODO: also check that the keyword contents match the spec! */
++ for (keyword_length = 0;
++ keyword_length < length && buffer[keyword_length] != 0;
++ ++keyword_length)
++ /* Empty loop to find end of name */ ;
++
++ if (keyword_length > 79 || keyword_length < 1)
++ errmsg = "bad keyword";
++
++ /* zTXt must have some LZ data after the keyword, although it may expand to
++ * zero bytes; we need a '\0' at the end of the keyword, the compression type
++ * then the LZ data:
++ */
++ else if (keyword_length + 3 > length)
++ errmsg = "truncated";
++
++ else if (buffer[keyword_length+1] != PNG_COMPRESSION_TYPE_BASE)
++ errmsg = "unknown compression type";
+
+ else
+ {
+- comp_type = *(++text);
+-
+- if (comp_type != PNG_TEXT_COMPRESSION_zTXt)
+- {
+- png_warning(png_ptr, "Unknown compression type in zTXt chunk");
+- comp_type = PNG_TEXT_COMPRESSION_zTXt;
+- }
+-
+- text++; /* Skip the compression_method byte */
++ png_alloc_size_t uncompressed_length = PNG_SIZE_MAX;
++
++ /* TODO: at present png_decompress_chunk imposes a single application
++ * level memory limit, this should be split to different values for iCCP
++ * and text chunks.
++ */
++ if (png_decompress_chunk(png_ptr, length, keyword_length+2,
++ &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
++ {
++ png_text text;
++
++ /* It worked; png_ptr->read_buffer now looks like a tEXt chunk except
++ * for the extra compression type byte and the fact that it isn't
++ * necessarily '\0' terminated.
++ */
++ buffer = png_ptr->read_buffer;
++ buffer[uncompressed_length+(keyword_length+2)] = 0;
++
++ text.compression = PNG_TEXT_COMPRESSION_zTXt;
++ text.key = (png_charp)buffer;
++ text.text = (png_charp)(buffer + keyword_length+2);
++ text.text_length = uncompressed_length;
++ text.itxt_length = 0;
++ text.lang = NULL;
++ text.lang_key = NULL;
++
++ if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
++ errmsg = "insufficient memory";
++ }
++
++ else
++ errmsg = png_ptr->zstream.msg;
+ }
+
+- prefix_len = text - png_ptr->chunkdata;
+-
+- png_decompress_chunk(png_ptr, comp_type,
+- (png_size_t)length, prefix_len, &data_len);
+-
+- text_ptr = (png_textp)png_malloc_warn(png_ptr,
+- png_sizeof(png_text));
+-
+- if (text_ptr == NULL)
+- {
+- png_warning(png_ptr, "Not enough memory to process zTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- text_ptr->compression = comp_type;
+- text_ptr->key = png_ptr->chunkdata;
+- text_ptr->lang = NULL;
+- text_ptr->lang_key = NULL;
+- text_ptr->itxt_length = 0;
+- text_ptr->text = png_ptr->chunkdata + prefix_len;
+- text_ptr->text_length = data_len;
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_free(png_ptr, text_ptr);
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+-
+- if (ret)
+- png_error(png_ptr, "Insufficient memory to store zTXt chunk");
++ if (errmsg != NULL)
++ png_chunk_benign_error(png_ptr, errmsg);
+ }
+ #endif
+
+ #ifdef PNG_READ_iTXt_SUPPORTED
+ /* Note: this does not correctly handle chunks that are > 64K under DOS */
+ void /* PRIVATE */
+-png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+ {
+- png_textp text_ptr;
+- png_charp key, lang, text, lang_key;
+- int comp_flag;
+- int comp_type = 0;
+- int ret;
+- png_size_t slength, prefix_len, data_len;
++ png_const_charp errmsg = NULL;
++ png_bytep buffer;
++ png_uint_32 prefix_length;
+
+ png_debug(1, "in png_handle_iTXt");
+
+@@ -2405,274 +2600,393 @@
+
+ if (--png_ptr->user_chunk_cache_max == 1)
+ {
+- png_warning(png_ptr, "No space in chunk cache for iTXt");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "no space in chunk cache");
+ return;
+ }
+ }
+ #endif
+
+- if (!(png_ptr->mode & PNG_HAVE_IHDR))
+- png_error(png_ptr, "Missing IHDR before iTXt");
+-
+- if (png_ptr->mode & PNG_HAVE_IDAT)
++ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
++ png_chunk_error(png_ptr, "missing IHDR");
++
++ if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ png_ptr->mode |= PNG_AFTER_IDAT;
+
+-#ifdef PNG_MAX_MALLOC_64K
+- /* We will no doubt have problems with chunks even half this size, but
+- * there is no hard and fast rule to tell us where to stop.
+- */
+- if (length > (png_uint_32)65535L)
++ buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
++
++ if (buffer == NULL)
+ {
+- png_warning(png_ptr, "iTXt chunk too large to fit in memory");
+ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
+ }
+-#endif
+-
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+-
+- if (png_ptr->chunkdata == NULL)
++
++ png_crc_read(png_ptr, buffer, length);
++
++ if (png_crc_finish(png_ptr, 0) != 0)
++ return;
++
++ /* First the keyword. */
++ for (prefix_length=0;
++ prefix_length < length && buffer[prefix_length] != 0;
++ ++prefix_length)
++ /* Empty loop */ ;
++
++ /* Perform a basic check on the keyword length here. */
++ if (prefix_length > 79 || prefix_length < 1)
++ errmsg = "bad keyword";
++
++ /* Expect keyword, compression flag, compression type, language, translated
++ * keyword (both may be empty but are 0 terminated) then the text, which may
++ * be empty.
++ */
++ else if (prefix_length + 5 > length)
++ errmsg = "truncated";
++
++ else if (buffer[prefix_length+1] == 0 ||
++ (buffer[prefix_length+1] == 1 &&
++ buffer[prefix_length+2] == PNG_COMPRESSION_TYPE_BASE))
+ {
+- png_warning(png_ptr, "No memory to process iTXt chunk");
+- return;
++ int compressed = buffer[prefix_length+1] != 0;
++ png_uint_32 language_offset, translated_keyword_offset;
++ png_alloc_size_t uncompressed_length = 0;
++
++ /* Now the language tag */
++ prefix_length += 3;
++ language_offset = prefix_length;
++
++ for (; prefix_length < length && buffer[prefix_length] != 0;
++ ++prefix_length)
++ /* Empty loop */ ;
++
++ /* WARNING: the length may be invalid here, this is checked below. */
++ translated_keyword_offset = ++prefix_length;
++
++ for (; prefix_length < length && buffer[prefix_length] != 0;
++ ++prefix_length)
++ /* Empty loop */ ;
++
++ /* prefix_length should now be at the trailing '\0' of the translated
++ * keyword, but it may already be over the end. None of this arithmetic
++ * can overflow because chunks are at most 2^31 bytes long, but on 16-bit
++ * systems the available allocation may overflow.
++ */
++ ++prefix_length;
++
++ if (compressed == 0 && prefix_length <= length)
++ uncompressed_length = length - prefix_length;
++
++ else if (compressed != 0 && prefix_length < length)
++ {
++ uncompressed_length = PNG_SIZE_MAX;
++
++ /* TODO: at present png_decompress_chunk imposes a single application
++ * level memory limit, this should be split to different values for
++ * iCCP and text chunks.
++ */
++ if (png_decompress_chunk(png_ptr, length, prefix_length,
++ &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
++ buffer = png_ptr->read_buffer;
++
++ else
++ errmsg = png_ptr->zstream.msg;
++ }
++
++ else
++ errmsg = "truncated";
++
++ if (errmsg == NULL)
++ {
++ png_text text;
++
++ buffer[uncompressed_length+prefix_length] = 0;
++
++ if (compressed == 0)
++ text.compression = PNG_ITXT_COMPRESSION_NONE;
++
++ else
++ text.compression = PNG_ITXT_COMPRESSION_zTXt;
++
++ text.key = (png_charp)buffer;
++ text.lang = (png_charp)buffer + language_offset;
++ text.lang_key = (png_charp)buffer + translated_keyword_offset;
++ text.text = (png_charp)buffer + prefix_length;
++ text.text_length = 0;
++ text.itxt_length = uncompressed_length;
++
++ if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
++ errmsg = "insufficient memory";
++ }
+ }
+
+- slength = (png_size_t)length;
+- png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
+-
+- if (png_crc_finish(png_ptr, 0))
+- {
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- png_ptr->chunkdata[slength] = 0x00;
+-
+- for (lang = png_ptr->chunkdata; *lang; lang++)
+- /* Empty loop */ ;
+-
+- lang++; /* Skip NUL separator */
+-
+- /* iTXt must have a language tag (possibly empty), two compression bytes,
+- * translated keyword (possibly empty), and possibly some text after the
+- * keyword
+- */
+-
+- if (lang >= png_ptr->chunkdata + slength - 3)
+- {
+- png_warning(png_ptr, "Truncated iTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+ else
+- {
+- comp_flag = *lang++;
+- comp_type = *lang++;
+- }
+-
+- for (lang_key = lang; *lang_key; lang_key++)
+- /* Empty loop */ ;
+-
+- lang_key++; /* Skip NUL separator */
+-
+- if (lang_key >= png_ptr->chunkdata + slength)
+- {
+- png_warning(png_ptr, "Truncated iTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- for (text = lang_key; *text; text++)
+- /* Empty loop */ ;
+-
+- text++; /* Skip NUL separator */
+-
+- if (text >= png_ptr->chunkdata + slength)
+- {
+- png_warning(png_ptr, "Malformed iTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- prefix_len = text - png_ptr->chunkdata;
+-
+- key=png_ptr->chunkdata;
+-
+- if (comp_flag)
+- png_decompress_chunk(png_ptr, comp_type,
+- (size_t)length, prefix_len, &data_len);
+-
+- else
+- data_len = png_strlen(png_ptr->chunkdata + prefix_len);
+-
+- text_ptr = (png_textp)png_malloc_warn(png_ptr,
+- png_sizeof(png_text));
+-
+- if (text_ptr == NULL)
+- {
+- png_warning(png_ptr, "Not enough memory to process iTXt chunk");
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+- return;
+- }
+-
+- text_ptr->compression = (int)comp_flag + 1;
+- text_ptr->lang_key = png_ptr->chunkdata + (lang_key - key);
+- text_ptr->lang = png_ptr->chunkdata + (lang - key);
+- text_ptr->itxt_length = data_len;
+- text_ptr->text_length = 0;
+- text_ptr->key = png_ptr->chunkdata;
+- text_ptr->text = png_ptr->chunkdata + prefix_len;
+-
+- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
+-
+- png_free(png_ptr, text_ptr);
+- png_free(png_ptr, png_ptr->chunkdata);
+- png_ptr->chunkdata = NULL;
+-
+- if (ret)
+- png_error(png_ptr, "Insufficient memory to store iTXt chunk");
++ errmsg = "bad compression info";
++
++ if (errmsg != NULL)
++ png_chunk_benign_error(png_ptr, errmsg);
+ }
+ #endif
+
+-/* This function is called when we haven't found a handler for a
+- * chunk. If there isn't a problem with the chunk itself (ie bad
+- * chunk name, CRC, or a critical chunk), the chunk is silently ignored
+- * -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which
+- * case it will be saved away to be written out later.
+- */
+-void /* PRIVATE */
+-png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
++/* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
++static int
++png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
+ {
+- png_uint_32 skip = 0;
+-
+- png_debug(1, "in png_handle_unknown");
+-
+-#ifdef PNG_USER_LIMITS_SUPPORTED
+- if (png_ptr->user_chunk_cache_max != 0)
++ png_alloc_size_t limit = PNG_SIZE_MAX;
++
++ if (png_ptr->unknown_chunk.data != NULL)
+ {
+- if (png_ptr->user_chunk_cache_max == 1)
+- {
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+-
+- if (--png_ptr->user_chunk_cache_max == 1)
+- {
+- png_warning(png_ptr, "No space in chunk cache for unknown chunk");
+- png_crc_finish(png_ptr, length);
+- return;
+- }
+- }
+-#endif
+-
+- if (png_ptr->mode & PNG_HAVE_IDAT)
+- {
+- PNG_IDAT;
+-
+- if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */
+- png_ptr->mode |= PNG_AFTER_IDAT;
+- }
+-
+- if (!(png_ptr->chunk_name[0] & 0x20))
+- {
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
+- PNG_HANDLE_CHUNK_ALWAYS
+-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+- && png_ptr->read_user_chunk_fn == NULL
+-#endif
+- )
+-#endif
+- png_chunk_error(png_ptr, "unknown critical chunk");
+- }
+-
+-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+- if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
+-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+- || (png_ptr->read_user_chunk_fn != NULL)
+-#endif
+- )
+- {
+-#ifdef PNG_MAX_MALLOC_64K
+- if (length > (png_uint_32)65535L)
+- {
+- png_warning(png_ptr, "unknown chunk too large to fit in memory");
+- skip = length - (png_uint_32)65535L;
+- length = (png_uint_32)65535L;
+- }
+-#endif
+-
+- png_memcpy((png_charp)png_ptr->unknown_chunk.name,
+- (png_charp)png_ptr->chunk_name,
+- png_sizeof(png_ptr->unknown_chunk.name));
+-
+- png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1]
+- = '\0';
+-
+- png_ptr->unknown_chunk.size = (png_size_t)length;
+-
+- if (length == 0)
+- png_ptr->unknown_chunk.data = NULL;
+-
+- else
+- {
+- png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
+- png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
+- }
+-
+-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+- if (png_ptr->read_user_chunk_fn != NULL)
+- {
+- /* Callback to user unknown chunk handler */
+- int ret;
+-
+- ret = (*(png_ptr->read_user_chunk_fn))
+- (png_ptr, &png_ptr->unknown_chunk);
+-
+- if (ret < 0)
+- png_chunk_error(png_ptr, "error in user chunk");
+-
+- if (ret == 0)
+- {
+- if (!(png_ptr->chunk_name[0] & 0x20))
+- {
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
+- PNG_HANDLE_CHUNK_ALWAYS)
+-#endif
+- png_chunk_error(png_ptr, "unknown critical chunk");
+- }
+-
+- png_set_unknown_chunks(png_ptr, info_ptr,
+- &png_ptr->unknown_chunk, 1);
+- }
+- }
+-
+- else
+-#endif
+- png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
+-
+ png_free(png_ptr, png_ptr->unknown_chunk.data);
+ png_ptr->unknown_chunk.data = NULL;
+ }
+
++# ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
++ if (png_ptr->user_chunk_malloc_max > 0 &&
++ png_ptr->user_chunk_malloc_max < limit)
++ limit = png_ptr->user_chunk_malloc_max;
++
++# elif PNG_USER_CHUNK_MALLOC_MAX > 0
++ if (PNG_USER_CHUNK_MALLOC_MAX < limit)
++ limit = PNG_USER_CHUNK_MALLOC_MAX;
++# endif
++
++ if (length <= limit)
++ {
++ PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
++ /* The following is safe because of the PNG_SIZE_MAX init above */
++ png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
++ /* 'mode' is a flag array, only the bottom four bits matter here */
++ png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
++
++ if (length == 0)
++ png_ptr->unknown_chunk.data = NULL;
++
++ else
++ {
++ /* Do a 'warn' here - it is handled below. */
++ png_ptr->unknown_chunk.data = png_voidcast(png_bytep,
++ png_malloc_warn(png_ptr, length));
++ }
++ }
++
++ if (png_ptr->unknown_chunk.data == NULL && length > 0)
++ {
++ /* This is benign because we clean up correctly */
++ png_crc_finish(png_ptr, length);
++ png_chunk_benign_error(png_ptr, "unknown chunk exceeds memory limits");
++ return 0;
++ }
++
+ else
+-#endif
+- skip = length;
+-
+- png_crc_finish(png_ptr, skip);
+-
+-#ifndef PNG_READ_USER_CHUNKS_SUPPORTED
+- PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
+-#endif
++ {
++ if (length > 0)
++ png_crc_read(png_ptr, png_ptr->unknown_chunk.data, length);
++ png_crc_finish(png_ptr, 0);
++ return 1;
++ }
++}
++#endif /* READ_UNKNOWN_CHUNKS */
++
++/* Handle an unknown, or known but disabled, chunk */
++void /* PRIVATE */
++png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
++ png_uint_32 length, int keep)
++{
++ int handled = 0; /* the chunk was handled */
++
++ png_debug(1, "in png_handle_unknown");
++
++#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
++ /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing
++ * the bug which meant that setting a non-default behavior for a specific
++ * chunk would be ignored (the default was always used unless a user
++ * callback was installed).
++ *
++ * 'keep' is the value from the png_chunk_unknown_handling, the setting for
++ * this specific chunk_name, if PNG_HANDLE_AS_UNKNOWN_SUPPORTED, if not it
++ * will always be PNG_HANDLE_CHUNK_AS_DEFAULT and it needs to be set here.
++ * This is just an optimization to avoid multiple calls to the lookup
++ * function.
++ */
++# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name);
++# endif
++# endif
++
++ /* One of the following methods will read the chunk or skip it (at least one
++ * of these is always defined because this is the only way to switch on
++ * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
++ */
++# ifdef PNG_READ_USER_CHUNKS_SUPPORTED
++ /* The user callback takes precedence over the chunk keep value, but the
++ * keep value is still required to validate a save of a critical chunk.
++ */
++ if (png_ptr->read_user_chunk_fn != NULL)
++ {
++ if (png_cache_unknown_chunk(png_ptr, length) != 0)
++ {
++ /* Callback to user unknown chunk handler */
++ int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
++ &png_ptr->unknown_chunk);
++
++ /* ret is:
++ * negative: An error occured, png_chunk_error will be called.
++ * zero: The chunk was not handled, the chunk will be discarded
++ * unless png_set_keep_unknown_chunks has been used to set
++ * a 'keep' behavior for this particular chunk, in which
++ * case that will be used. A critical chunk will cause an
++ * error at this point unless it is to be saved.
++ * positive: The chunk was handled, libpng will ignore/discard it.
++ */
++ if (ret < 0)
++ png_chunk_error(png_ptr, "error in user chunk");
++
++ else if (ret == 0)
++ {
++ /* If the keep value is 'default' or 'never' override it, but
++ * still error out on critical chunks unless the keep value is
++ * 'always' While this is weird it is the behavior in 1.4.12.
++ * A possible improvement would be to obey the value set for the
++ * chunk, but this would be an API change that would probably
++ * damage some applications.
++ *
++ * The png_app_warning below catches the case that matters, where
++ * the application has not set specific save or ignore for this
++ * chunk or global save or ignore.
++ */
++ if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
++ {
++# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
++ {
++ png_chunk_warning(png_ptr, "Saving unknown chunk:");
++ png_app_warning(png_ptr,
++ "forcing save of an unhandled chunk;"
++ " please call png_set_keep_unknown_chunks");
++ /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
++ }
++# endif
++ keep = PNG_HANDLE_CHUNK_IF_SAFE;
++ }
++ }
++
++ else /* chunk was handled */
++ {
++ handled = 1;
++ /* Critical chunks can be safely discarded at this point. */
++ keep = PNG_HANDLE_CHUNK_NEVER;
++ }
++ }
++
++ else
++ keep = PNG_HANDLE_CHUNK_NEVER; /* insufficient memory */
++ }
++
++ else
++ /* Use the SAVE_UNKNOWN_CHUNKS code or skip the chunk */
++# endif /* READ_USER_CHUNKS */
++
++# ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
++ {
++ /* keep is currently just the per-chunk setting, if there was no
++ * setting change it to the global default now (not that this may
++ * still be AS_DEFAULT) then obtain the cache of the chunk if required,
++ * if not simply skip the chunk.
++ */
++ if (keep == PNG_HANDLE_CHUNK_AS_DEFAULT)
++ keep = png_ptr->unknown_default;
++
++ if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
++ (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
++ PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
++ {
++ if (png_cache_unknown_chunk(png_ptr, length) == 0)
++ keep = PNG_HANDLE_CHUNK_NEVER;
++ }
++
++ else
++ png_crc_finish(png_ptr, length);
++ }
++# else
++# ifndef PNG_READ_USER_CHUNKS_SUPPORTED
++# error no method to support READ_UNKNOWN_CHUNKS
++# endif
++
++ {
++ /* If here there is no read callback pointer set and no support is
++ * compiled in to just save the unknown chunks, so simply skip this
++ * chunk. If 'keep' is something other than AS_DEFAULT or NEVER then
++ * the app has erroneously asked for unknown chunk saving when there
++ * is no support.
++ */
++ if (keep > PNG_HANDLE_CHUNK_NEVER)
++ png_app_error(png_ptr, "no unknown chunk support available");
++
++ png_crc_finish(png_ptr, length);
++ }
++# endif
++
++# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++ /* Now store the chunk in the chunk list if appropriate, and if the limits
++ * permit it.
++ */
++ if (keep == PNG_HANDLE_CHUNK_ALWAYS ||
++ (keep == PNG_HANDLE_CHUNK_IF_SAFE &&
++ PNG_CHUNK_ANCILLARY(png_ptr->chunk_name)))
++ {
++# ifdef PNG_USER_LIMITS_SUPPORTED
++ switch (png_ptr->user_chunk_cache_max)
++ {
++ case 2:
++ png_ptr->user_chunk_cache_max = 1;
++ png_chunk_benign_error(png_ptr, "no space in chunk cache");
++ /* FALL THROUGH */
++ case 1:
++ /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
++ * chunk being skipped, now there will be a hard error below.
++ */
++ break;
++
++ default: /* not at limit */
++ --(png_ptr->user_chunk_cache_max);
++ /* FALL THROUGH */
++ case 0: /* no limit */
++# endif /* USER_LIMITS */
++ /* Here when the limit isn't reached or when limits are compiled
++ * out; store the chunk.
++ */
++ png_set_unknown_chunks(png_ptr, info_ptr,
++ &png_ptr->unknown_chunk, 1);
++ handled = 1;
++# ifdef PNG_USER_LIMITS_SUPPORTED
++ break;
++ }
++# endif
++ }
++# else /* no store support: the chunk must be handled by the user callback */
++ PNG_UNUSED(info_ptr)
++# endif
++
++ /* Regardless of the error handling below the cached data (if any) can be
++ * freed now. Notice that the data is not freed if there is a png_error, but
++ * it will be freed by destroy_read_struct.
++ */
++ if (png_ptr->unknown_chunk.data != NULL)
++ png_free(png_ptr, png_ptr->unknown_chunk.data);
++ png_ptr->unknown_chunk.data = NULL;
++
++#else /* !PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
++ /* There is no support to read an unknown chunk, so just skip it. */
++ png_crc_finish(png_ptr, length);
++ PNG_UNUSED(info_ptr)
++ PNG_UNUSED(keep)
++#endif /* !READ_UNKNOWN_CHUNKS */
++
++ /* Check for unhandled critical chunks */
++ if (handled == 0 && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
++ png_chunk_error(png_ptr, "unhandled critical chunk");
+ }
+
+ /* This function is called to verify that a chunk name is valid.
+@@ -2682,267 +2996,527 @@
+ * the chunk name itself is valid.
+ */
+
+-#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
++/* Bit hacking: the test for an invalid byte in the 4 byte chunk name is:
++ *
++ * ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
++ */
+
+ void /* PRIVATE */
+-png_check_chunk_name(png_structp png_ptr, png_const_bytep chunk_name)
++png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name)
+ {
++ int i;
++
+ png_debug(1, "in png_check_chunk_name");
+- if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) ||
+- isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3]))
++
++ for (i=1; i<=4; ++i)
+ {
+- png_chunk_error(png_ptr, "invalid chunk type");
++ int c = chunk_name & 0xff;
++
++ if (c < 65 || c > 122 || (c > 90 && c < 97))
++ png_chunk_error(png_ptr, "invalid chunk type");
++
++ chunk_name >>= 8;
+ }
+ }
+
+-/* Combines the row recently read in with the existing pixels in the
+- * row. This routine takes care of alpha and transparency if requested.
+- * This routine also handles the two methods of progressive display
+- * of interlaced images, depending on the mask value.
+- * The mask value describes which pixels are to be combined with
+- * the row. The pattern always repeats every 8 pixels, so just 8
+- * bits are needed. A one indicates the pixel is to be combined,
+- * a zero indicates the pixel is to be skipped. This is in addition
+- * to any alpha or transparency value associated with the pixel. If
+- * you want all pixels to be combined, pass 0xff (255) in mask.
++/* Combines the row recently read in with the existing pixels in the row. This
++ * routine takes care of alpha and transparency if requested. This routine also
++ * handles the two methods of progressive display of interlaced images,
++ * depending on the 'display' value; if 'display' is true then the whole row
++ * (dp) is filled from the start by replicating the available pixels. If
++ * 'display' is false only those pixels present in the pass are filled in.
+ */
+-
+ void /* PRIVATE */
+-png_combine_row(png_structp png_ptr, png_bytep row, int mask)
++png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
+ {
++ unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
++ png_const_bytep sp = png_ptr->row_buf + 1;
++ png_alloc_size_t row_width = png_ptr->width;
++ unsigned int pass = png_ptr->pass;
++ png_bytep end_ptr = 0;
++ png_byte end_byte = 0;
++ unsigned int end_mask;
++
+ png_debug(1, "in png_combine_row");
+
+- /* Added in 1.5.4: the row_info should match the information returned by any
+- * call to png_read_update_info at this point. Do not continue if we got
++ /* Added in 1.5.6: it should not be possible to enter this routine until at
++ * least one row has been read from the PNG data and transformed.
++ */
++ if (pixel_depth == 0)
++ png_error(png_ptr, "internal row logic error");
++
++ /* Added in 1.5.4: the pixel depth should match the information returned by
++ * any call to png_read_update_info at this point. Do not continue if we got
+ * this wrong.
+ */
+ if (png_ptr->info_rowbytes != 0 && png_ptr->info_rowbytes !=
+- PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width))
++ PNG_ROWBYTES(pixel_depth, row_width))
+ png_error(png_ptr, "internal row size calculation error");
+
+- if (mask == 0xff)
++ /* Don't expect this to ever happen: */
++ if (row_width == 0)
++ png_error(png_ptr, "internal row width error");
++
++ /* Preserve the last byte in cases where only part of it will be overwritten,
++ * the multiply below may overflow, we don't care because ANSI-C guarantees
++ * we get the low bits.
++ */
++ end_mask = (pixel_depth * row_width) & 7;
++ if (end_mask != 0)
+ {
+- png_memcpy(row, png_ptr->row_buf + 1,
+- PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width));
++ /* end_ptr == NULL is a flag to say do nothing */
++ end_ptr = dp + PNG_ROWBYTES(pixel_depth, row_width) - 1;
++ end_byte = *end_ptr;
++# ifdef PNG_READ_PACKSWAP_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
++ /* little-endian byte */
++ end_mask = 0xff << end_mask;
++
++ else /* big-endian byte */
++# endif
++ end_mask = 0xff >> end_mask;
++ /* end_mask is now the bits to *keep* from the destination row */
+ }
+
+- else
++ /* For non-interlaced images this reduces to a memcpy(). A memcpy()
++ * will also happen if interlacing isn't supported or if the application
++ * does not call png_set_interlace_handling(). In the latter cases the
++ * caller just gets a sequence of the unexpanded rows from each interlace
++ * pass.
++ */
++#ifdef PNG_READ_INTERLACING_SUPPORTED
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) != 0 &&
++ pass < 6 && (display == 0 ||
++ /* The following copies everything for 'display' on passes 0, 2 and 4. */
++ (display == 1 && (pass & 1) != 0)))
+ {
+- switch (png_ptr->row_info.pixel_depth)
++ /* Narrow images may have no bits in a pass; the caller should handle
++ * this, but this test is cheap:
++ */
++ if (row_width <= PNG_PASS_START_COL(pass))
++ return;
++
++ if (pixel_depth < 8)
+ {
+- case 1:
++ /* For pixel depths up to 4 bpp the 8-pixel mask can be expanded to fit
++ * into 32 bits, then a single loop over the bytes using the four byte
++ * values in the 32-bit mask can be used. For the 'display' option the
++ * expanded mask may also not require any masking within a byte. To
++ * make this work the PACKSWAP option must be taken into account - it
++ * simply requires the pixels to be reversed in each byte.
++ *
++ * The 'regular' case requires a mask for each of the first 6 passes,
++ * the 'display' case does a copy for the even passes in the range
++ * 0..6. This has already been handled in the test above.
++ *
++ * The masks are arranged as four bytes with the first byte to use in
++ * the lowest bits (little-endian) regardless of the order (PACKSWAP or
++ * not) of the pixels in each byte.
++ *
++ * NOTE: the whole of this logic depends on the caller of this function
++ * only calling it on rows appropriate to the pass. This function only
++ * understands the 'x' logic; the 'y' logic is handled by the caller.
++ *
++ * The following defines allow generation of compile time constant bit
++ * masks for each pixel depth and each possibility of swapped or not
++ * swapped bytes. Pass 'p' is in the range 0..6; 'x', a pixel index,
++ * is in the range 0..7; and the result is 1 if the pixel is to be
++ * copied in the pass, 0 if not. 'S' is for the sparkle method, 'B'
++ * for the block method.
++ *
++ * With some compilers a compile time expression of the general form:
++ *
++ * (shift >= 32) ? (a >> (shift-32)) : (b >> shift)
++ *
++ * Produces warnings with values of 'shift' in the range 33 to 63
++ * because the right hand side of the ?: expression is evaluated by
++ * the compiler even though it isn't used. Microsoft Visual C (various
++ * versions) and the Intel C compiler are known to do this. To avoid
++ * this the following macros are used in 1.5.6. This is a temporary
++ * solution to avoid destabilizing the code during the release process.
++ */
++# if PNG_USE_COMPILE_TIME_MASKS
++# define PNG_LSR(x,s) ((x)>>((s) & 0x1f))
++# define PNG_LSL(x,s) ((x)<<((s) & 0x1f))
++# else
++# define PNG_LSR(x,s) ((x)>>(s))
++# define PNG_LSL(x,s) ((x)<<(s))
++# endif
++# define S_COPY(p,x) (((p)<4 ? PNG_LSR(0x80088822,(3-(p))*8+(7-(x))) :\
++ PNG_LSR(0xaa55ff00,(7-(p))*8+(7-(x)))) & 1)
++# define B_COPY(p,x) (((p)<4 ? PNG_LSR(0xff0fff33,(3-(p))*8+(7-(x))) :\
++ PNG_LSR(0xff55ff00,(7-(p))*8+(7-(x)))) & 1)
++
++ /* Return a mask for pass 'p' pixel 'x' at depth 'd'. The mask is
++ * little endian - the first pixel is at bit 0 - however the extra
++ * parameter 's' can be set to cause the mask position to be swapped
++ * within each byte, to match the PNG format. This is done by XOR of
++ * the shift with 7, 6 or 4 for bit depths 1, 2 and 4.
++ */
++# define PIXEL_MASK(p,x,d,s) \
++ (PNG_LSL(((PNG_LSL(1U,(d)))-1),(((x)*(d))^((s)?8-(d):0))))
++
++ /* Hence generate the appropriate 'block' or 'sparkle' pixel copy mask.
++ */
++# define S_MASKx(p,x,d,s) (S_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
++# define B_MASKx(p,x,d,s) (B_COPY(p,x)?PIXEL_MASK(p,x,d,s):0)
++
++ /* Combine 8 of these to get the full mask. For the 1-bpp and 2-bpp
++ * cases the result needs replicating, for the 4-bpp case the above
++ * generates a full 32 bits.
++ */
++# define MASK_EXPAND(m,d) ((m)*((d)==1?0x01010101:((d)==2?0x00010001:1)))
++
++# define S_MASK(p,d,s) MASK_EXPAND(S_MASKx(p,0,d,s) + S_MASKx(p,1,d,s) +\
++ S_MASKx(p,2,d,s) + S_MASKx(p,3,d,s) + S_MASKx(p,4,d,s) +\
++ S_MASKx(p,5,d,s) + S_MASKx(p,6,d,s) + S_MASKx(p,7,d,s), d)
++
++# define B_MASK(p,d,s) MASK_EXPAND(B_MASKx(p,0,d,s) + B_MASKx(p,1,d,s) +\
++ B_MASKx(p,2,d,s) + B_MASKx(p,3,d,s) + B_MASKx(p,4,d,s) +\
++ B_MASKx(p,5,d,s) + B_MASKx(p,6,d,s) + B_MASKx(p,7,d,s), d)
++
++#if PNG_USE_COMPILE_TIME_MASKS
++ /* Utility macros to construct all the masks for a depth/swap
++ * combination. The 's' parameter says whether the format is PNG
++ * (big endian bytes) or not. Only the three odd-numbered passes are
++ * required for the display/block algorithm.
++ */
++# define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
++ S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
++
++# define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
++
++# define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
++
++ /* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and
++ * then pass:
++ */
++ static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
+ {
+- png_bytep sp = png_ptr->row_buf + 1;
+- png_bytep dp = row;
+- int s_inc, s_start, s_end;
+- int m = 0x80;
+- int shift;
+- png_uint_32 i;
+- png_uint_32 row_width = png_ptr->width;
+-
+-#ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_PACKSWAP)
++ /* Little-endian byte masks for PACKSWAP */
++ { S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
++ /* Normal (big-endian byte) masks - PNG format */
++ { S_MASKS(1,1), S_MASKS(2,1), S_MASKS(4,1) }
++ };
++
++ /* display_mask has only three entries for the odd passes, so index by
++ * pass>>1.
++ */
++ static PNG_CONST png_uint_32 display_mask[2][3][3] =
++ {
++ /* Little-endian byte masks for PACKSWAP */
++ { B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
++ /* Normal (big-endian byte) masks - PNG format */
++ { B_MASKS(1,1), B_MASKS(2,1), B_MASKS(4,1) }
++ };
++
++# define MASK(pass,depth,display,png)\
++ ((display)?display_mask[png][DEPTH_INDEX(depth)][pass>>1]:\
++ row_mask[png][DEPTH_INDEX(depth)][pass])
++
++#else /* !PNG_USE_COMPILE_TIME_MASKS */
++ /* This is the runtime alternative: it seems unlikely that this will
++ * ever be either smaller or faster than the compile time approach.
++ */
++# define MASK(pass,depth,display,png)\
++ ((display)?B_MASK(pass,depth,png):S_MASK(pass,depth,png))
++#endif /* !USE_COMPILE_TIME_MASKS */
++
++ /* Use the appropriate mask to copy the required bits. In some cases
++ * the byte mask will be 0 or 0xff; optimize these cases. row_width is
++ * the number of pixels, but the code copies bytes, so it is necessary
++ * to special case the end.
++ */
++ png_uint_32 pixels_per_byte = 8 / pixel_depth;
++ png_uint_32 mask;
++
++# ifdef PNG_READ_PACKSWAP_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
++ mask = MASK(pass, pixel_depth, display, 0);
++
++ else
++# endif
++ mask = MASK(pass, pixel_depth, display, 1);
++
++ for (;;)
++ {
++ png_uint_32 m;
++
++ /* It doesn't matter in the following if png_uint_32 has more than
++ * 32 bits because the high bits always match those in m<<24; it is,
++ * however, essential to use OR here, not +, because of this.
++ */
++ m = mask;
++ mask = (m >> 8) | (m << 24); /* rotate right to good compilers */
++ m &= 0xff;
++
++ if (m != 0) /* something to copy */
+ {
+- s_start = 0;
+- s_end = 7;
+- s_inc = 1;
++ if (m != 0xff)
++ *dp = (png_byte)((*dp & ~m) | (*sp & m));
++ else
++ *dp = *sp;
+ }
+
+- else
+-#endif
+- {
+- s_start = 7;
+- s_end = 0;
+- s_inc = -1;
+- }
+-
+- shift = s_start;
+-
+- for (i = 0; i < row_width; i++)
+- {
+- if (m & mask)
+- {
+- int value;
+-
+- value = (*sp >> shift) & 0x01;
+- *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff);
+- *dp |= (png_byte)(value << shift);
+- }
+-
+- if (shift == s_end)
+- {
+- shift = s_start;
+- sp++;
+- dp++;
+- }
+-
+- else
+- shift += s_inc;
+-
+- if (m == 1)
+- m = 0x80;
+-
+- else
+- m >>= 1;
+- }
+- break;
+- }
+-
+- case 2:
+- {
+- png_bytep sp = png_ptr->row_buf + 1;
+- png_bytep dp = row;
+- int s_start, s_end, s_inc;
+- int m = 0x80;
+- int shift;
+- png_uint_32 i;
+- png_uint_32 row_width = png_ptr->width;
+- int value;
+-
+-#ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_PACKSWAP)
+- {
+- s_start = 0;
+- s_end = 6;
+- s_inc = 2;
+- }
+-
+- else
+-#endif
+- {
+- s_start = 6;
+- s_end = 0;
+- s_inc = -2;
+- }
+-
+- shift = s_start;
+-
+- for (i = 0; i < row_width; i++)
+- {
+- if (m & mask)
+- {
+- value = (*sp >> shift) & 0x03;
+- *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff);
+- *dp |= (png_byte)(value << shift);
+- }
+-
+- if (shift == s_end)
+- {
+- shift = s_start;
+- sp++;
+- dp++;
+- }
+-
+- else
+- shift += s_inc;
+-
+- if (m == 1)
+- m = 0x80;
+-
+- else
+- m >>= 1;
+- }
+- break;
+- }
+-
+- case 4:
+- {
+- png_bytep sp = png_ptr->row_buf + 1;
+- png_bytep dp = row;
+- int s_start, s_end, s_inc;
+- int m = 0x80;
+- int shift;
+- png_uint_32 i;
+- png_uint_32 row_width = png_ptr->width;
+- int value;
+-
+-#ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_PACKSWAP)
+- {
+- s_start = 0;
+- s_end = 4;
+- s_inc = 4;
+- }
+-
+- else
+-#endif
+- {
+- s_start = 4;
+- s_end = 0;
+- s_inc = -4;
+- }
+- shift = s_start;
+-
+- for (i = 0; i < row_width; i++)
+- {
+- if (m & mask)
+- {
+- value = (*sp >> shift) & 0xf;
+- *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff);
+- *dp |= (png_byte)(value << shift);
+- }
+-
+- if (shift == s_end)
+- {
+- shift = s_start;
+- sp++;
+- dp++;
+- }
+-
+- else
+- shift += s_inc;
+-
+- if (m == 1)
+- m = 0x80;
+-
+- else
+- m >>= 1;
+- }
+- break;
+- }
+-
+- default:
+- {
+- png_bytep sp = png_ptr->row_buf + 1;
+- png_bytep dp = row;
+- png_size_t pixel_bytes = (png_ptr->row_info.pixel_depth >> 3);
+- png_uint_32 i;
+- png_uint_32 row_width = png_ptr->width;
+- png_byte m = 0x80;
+-
+- for (i = 0; i < row_width; i++)
+- {
+- if (m & mask)
+- {
+- png_memcpy(dp, sp, pixel_bytes);
+- }
+-
+- sp += pixel_bytes;
+- dp += pixel_bytes;
+-
+- if (m == 1)
+- m = 0x80;
+-
+- else
+- m >>= 1;
+- }
+- break;
++ /* NOTE: this may overwrite the last byte with garbage if the image
++ * is not an exact number of bytes wide; libpng has always done
++ * this.
++ */
++ if (row_width <= pixels_per_byte)
++ break; /* May need to restore part of the last byte */
++
++ row_width -= pixels_per_byte;
++ ++dp;
++ ++sp;
+ }
+ }
++
++ else /* pixel_depth >= 8 */
++ {
++ unsigned int bytes_to_copy, bytes_to_jump;
++
++ /* Validate the depth - it must be a multiple of 8 */
++ if (pixel_depth & 7)
++ png_error(png_ptr, "invalid user transform pixel depth");
++
++ pixel_depth >>= 3; /* now in bytes */
++ row_width *= pixel_depth;
++
++ /* Regardless of pass number the Adam 7 interlace always results in a
++ * fixed number of pixels to copy then to skip. There may be a
++ * different number of pixels to skip at the start though.
++ */
++ {
++ unsigned int offset = PNG_PASS_START_COL(pass) * pixel_depth;
++
++ row_width -= offset;
++ dp += offset;
++ sp += offset;
++ }
++
++ /* Work out the bytes to copy. */
++ if (display != 0)
++ {
++ /* When doing the 'block' algorithm the pixel in the pass gets
++ * replicated to adjacent pixels. This is why the even (0,2,4,6)
++ * passes are skipped above - the entire expanded row is copied.
++ */
++ bytes_to_copy = (1<<((6-pass)>>1)) * pixel_depth;
++
++ /* But don't allow this number to exceed the actual row width. */
++ if (bytes_to_copy > row_width)
++ bytes_to_copy = (unsigned int)/*SAFE*/row_width;
++ }
++
++ else /* normal row; Adam7 only ever gives us one pixel to copy. */
++ bytes_to_copy = pixel_depth;
++
++ /* In Adam7 there is a constant offset between where the pixels go. */
++ bytes_to_jump = PNG_PASS_COL_OFFSET(pass) * pixel_depth;
++
++ /* And simply copy these bytes. Some optimization is possible here,
++ * depending on the value of 'bytes_to_copy'. Special case the low
++ * byte counts, which we know to be frequent.
++ *
++ * Notice that these cases all 'return' rather than 'break' - this
++ * avoids an unnecessary test on whether to restore the last byte
++ * below.
++ */
++ switch (bytes_to_copy)
++ {
++ case 1:
++ for (;;)
++ {
++ *dp = *sp;
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ dp += bytes_to_jump;
++ sp += bytes_to_jump;
++ row_width -= bytes_to_jump;
++ }
++
++ case 2:
++ /* There is a possibility of a partial copy at the end here; this
++ * slows the code down somewhat.
++ */
++ do
++ {
++ dp[0] = sp[0], dp[1] = sp[1];
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ sp += bytes_to_jump;
++ dp += bytes_to_jump;
++ row_width -= bytes_to_jump;
++ }
++ while (row_width > 1);
++
++ /* And there can only be one byte left at this point: */
++ *dp = *sp;
++ return;
++
++ case 3:
++ /* This can only be the RGB case, so each copy is exactly one
++ * pixel and it is not necessary to check for a partial copy.
++ */
++ for (;;)
++ {
++ dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ sp += bytes_to_jump;
++ dp += bytes_to_jump;
++ row_width -= bytes_to_jump;
++ }
++
++ default:
++#if PNG_ALIGN_TYPE != PNG_ALIGN_NONE
++ /* Check for double byte alignment and, if possible, use a
++ * 16-bit copy. Don't attempt this for narrow images - ones that
++ * are less than an interlace panel wide. Don't attempt it for
++ * wide bytes_to_copy either - use the memcpy there.
++ */
++ if (bytes_to_copy < 16 /*else use memcpy*/ &&
++ png_isaligned(dp, png_uint_16) &&
++ png_isaligned(sp, png_uint_16) &&
++ bytes_to_copy % (sizeof (png_uint_16)) == 0 &&
++ bytes_to_jump % (sizeof (png_uint_16)) == 0)
++ {
++ /* Everything is aligned for png_uint_16 copies, but try for
++ * png_uint_32 first.
++ */
++ if (png_isaligned(dp, png_uint_32) != 0 &&
++ png_isaligned(sp, png_uint_32) != 0 &&
++ bytes_to_copy % (sizeof (png_uint_32)) == 0 &&
++ bytes_to_jump % (sizeof (png_uint_32)) == 0)
++ {
++ png_uint_32p dp32 = png_aligncast(png_uint_32p,dp);
++ png_const_uint_32p sp32 = png_aligncastconst(
++ png_const_uint_32p, sp);
++ size_t skip = (bytes_to_jump-bytes_to_copy) /
++ (sizeof (png_uint_32));
++
++ do
++ {
++ size_t c = bytes_to_copy;
++ do
++ {
++ *dp32++ = *sp32++;
++ c -= (sizeof (png_uint_32));
++ }
++ while (c > 0);
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ dp32 += skip;
++ sp32 += skip;
++ row_width -= bytes_to_jump;
++ }
++ while (bytes_to_copy <= row_width);
++
++ /* Get to here when the row_width truncates the final copy.
++ * There will be 1-3 bytes left to copy, so don't try the
++ * 16-bit loop below.
++ */
++ dp = (png_bytep)dp32;
++ sp = (png_const_bytep)sp32;
++ do
++ *dp++ = *sp++;
++ while (--row_width > 0);
++ return;
++ }
++
++ /* Else do it in 16-bit quantities, but only if the size is
++ * not too large.
++ */
++ else
++ {
++ png_uint_16p dp16 = png_aligncast(png_uint_16p, dp);
++ png_const_uint_16p sp16 = png_aligncastconst(
++ png_const_uint_16p, sp);
++ size_t skip = (bytes_to_jump-bytes_to_copy) /
++ (sizeof (png_uint_16));
++
++ do
++ {
++ size_t c = bytes_to_copy;
++ do
++ {
++ *dp16++ = *sp16++;
++ c -= (sizeof (png_uint_16));
++ }
++ while (c > 0);
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ dp16 += skip;
++ sp16 += skip;
++ row_width -= bytes_to_jump;
++ }
++ while (bytes_to_copy <= row_width);
++
++ /* End of row - 1 byte left, bytes_to_copy > row_width: */
++ dp = (png_bytep)dp16;
++ sp = (png_const_bytep)sp16;
++ do
++ *dp++ = *sp++;
++ while (--row_width > 0);
++ return;
++ }
++ }
++#endif /* ALIGN_TYPE code */
++
++ /* The true default - use a memcpy: */
++ for (;;)
++ {
++ memcpy(dp, sp, bytes_to_copy);
++
++ if (row_width <= bytes_to_jump)
++ return;
++
++ sp += bytes_to_jump;
++ dp += bytes_to_jump;
++ row_width -= bytes_to_jump;
++ if (bytes_to_copy > row_width)
++ bytes_to_copy = (unsigned int)/*SAFE*/row_width;
++ }
++ }
++
++ /* NOT REACHED*/
++ } /* pixel_depth >= 8 */
++
++ /* Here if pixel_depth < 8 to check 'end_ptr' below. */
+ }
++ else
++#endif /* READ_INTERLACING */
++
++ /* If here then the switch above wasn't used so just memcpy the whole row
++ * from the temporary row buffer (notice that this overwrites the end of the
++ * destination row if it is a partial byte.)
++ */
++ memcpy(dp, sp, PNG_ROWBYTES(pixel_depth, row_width));
++
++ /* Restore the overwritten bits from the last byte if necessary. */
++ if (end_ptr != NULL)
++ *end_ptr = (png_byte)((end_byte & end_mask) | (*end_ptr & ~end_mask));
+ }
+
+ #ifdef PNG_READ_INTERLACING_SUPPORTED
+ void /* PRIVATE */
+-png_do_read_interlace(png_structp png_ptr)
++png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
++ png_uint_32 transformations /* Because these may affect the byte layout */)
+ {
+- png_row_infop row_info = &(png_ptr->row_info);
+- png_bytep row = png_ptr->row_buf + 1;
+- int pass = png_ptr->pass;
+- png_uint_32 transformations = png_ptr->transformations;
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+ /* Offset to next interlace block */
+- PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ png_debug(1, "in png_do_read_interlace");
+ if (row != NULL && row_info != NULL)
+@@ -2965,7 +3539,7 @@
+ int j;
+
+ #ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (transformations & PNG_PACKSWAP)
++ if ((transformations & PNG_PACKSWAP) != 0)
+ {
+ sshift = (int)((row_info->width + 7) & 0x07);
+ dshift = (int)((final_width + 7) & 0x07);
+@@ -2989,8 +3563,9 @@
+ v = (png_byte)((*sp >> sshift) & 0x01);
+ for (j = 0; j < jstop; j++)
+ {
+- *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff);
+- *dp |= (png_byte)(v << dshift);
++ unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
++ tmp |= v << dshift;
++ *dp = (png_byte)(tmp & 0xff);
+
+ if (dshift == s_end)
+ {
+@@ -3024,7 +3599,7 @@
+ png_uint_32 i;
+
+ #ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (transformations & PNG_PACKSWAP)
++ if ((transformations & PNG_PACKSWAP) != 0)
+ {
+ sshift = (int)(((row_info->width + 3) & 0x03) << 1);
+ dshift = (int)(((final_width + 3) & 0x03) << 1);
+@@ -3051,8 +3626,9 @@
+ v = (png_byte)((*sp >> sshift) & 0x03);
+ for (j = 0; j < jstop; j++)
+ {
+- *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff);
+- *dp |= (png_byte)(v << dshift);
++ unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
++ tmp |= v << dshift;
++ *dp = (png_byte)(tmp & 0xff);
+
+ if (dshift == s_end)
+ {
+@@ -3086,7 +3662,7 @@
+ int jstop = png_pass_inc[pass];
+
+ #ifdef PNG_READ_PACKSWAP_SUPPORTED
+- if (transformations & PNG_PACKSWAP)
++ if ((transformations & PNG_PACKSWAP) != 0)
+ {
+ sshift = (int)(((row_info->width + 1) & 0x01) << 2);
+ dshift = (int)(((final_width + 1) & 0x01) << 2);
+@@ -3107,13 +3683,14 @@
+
+ for (i = 0; i < row_info->width; i++)
+ {
+- png_byte v = (png_byte)((*sp >> sshift) & 0xf);
++ png_byte v = (png_byte)((*sp >> sshift) & 0x0f);
+ int j;
+
+ for (j = 0; j < jstop; j++)
+ {
+- *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff);
+- *dp |= (png_byte)(v << dshift);
++ unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
++ tmp |= v << dshift;
++ *dp = (png_byte)(tmp & 0xff);
+
+ if (dshift == s_end)
+ {
+@@ -3136,6 +3713,7 @@
+ }
+ break;
+ }
++
+ default:
+ {
+ png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
+@@ -3150,14 +3728,14 @@
+
+ for (i = 0; i < row_info->width; i++)
+ {
+- png_byte v[8];
++ png_byte v[8]; /* SAFE; pixel_depth does not exceed 64 */
+ int j;
+
+- png_memcpy(v, sp, pixel_bytes);
++ memcpy(v, sp, pixel_bytes);
+
+ for (j = 0; j < jstop; j++)
+ {
+- png_memcpy(dp, v, pixel_bytes);
++ memcpy(dp, v, pixel_bytes);
+ dp -= pixel_bytes;
+ }
+
+@@ -3166,6 +3744,7 @@
+ break;
+ }
+ }
++
+ row_info->width = final_width;
+ row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
+ }
+@@ -3173,167 +3752,427 @@
+ PNG_UNUSED(transformations) /* Silence compiler warning */
+ #endif
+ }
+-#endif /* PNG_READ_INTERLACING_SUPPORTED */
++#endif /* READ_INTERLACING */
++
++static void
++png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row)
++{
++ png_size_t i;
++ png_size_t istop = row_info->rowbytes;
++ unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
++ png_bytep rp = row + bpp;
++
++ PNG_UNUSED(prev_row)
++
++ for (i = bpp; i < istop; i++)
++ {
++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff);
++ rp++;
++ }
++}
++
++static void
++png_read_filter_row_up(png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row)
++{
++ png_size_t i;
++ png_size_t istop = row_info->rowbytes;
++ png_bytep rp = row;
++ png_const_bytep pp = prev_row;
++
++ for (i = 0; i < istop; i++)
++ {
++ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
++ rp++;
++ }
++}
++
++static void
++png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row)
++{
++ png_size_t i;
++ png_bytep rp = row;
++ png_const_bytep pp = prev_row;
++ unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
++ png_size_t istop = row_info->rowbytes - bpp;
++
++ for (i = 0; i < bpp; i++)
++ {
++ *rp = (png_byte)(((int)(*rp) +
++ ((int)(*pp++) / 2 )) & 0xff);
++
++ rp++;
++ }
++
++ for (i = 0; i < istop; i++)
++ {
++ *rp = (png_byte)(((int)(*rp) +
++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff);
++
++ rp++;
++ }
++}
++
++static void
++png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row)
++{
++ png_bytep rp_end = row + row_info->rowbytes;
++ int a, c;
++
++ /* First pixel/byte */
++ c = *prev_row++;
++ a = *row + c;
++ *row++ = (png_byte)a;
++
++ /* Remainder */
++ while (row < rp_end)
++ {
++ int b, pa, pb, pc, p;
++
++ a &= 0xff; /* From previous iteration or start */
++ b = *prev_row++;
++
++ p = b - c;
++ pc = a - c;
++
++# ifdef PNG_USE_ABS
++ pa = abs(p);
++ pb = abs(pc);
++ pc = abs(p + pc);
++# else
++ pa = p < 0 ? -p : p;
++ pb = pc < 0 ? -pc : pc;
++ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
++# endif
++
++ /* Find the best predictor, the least of pa, pb, pc favoring the earlier
++ * ones in the case of a tie.
++ */
++ if (pb < pa) pa = pb, a = b;
++ if (pc < pa) a = c;
++
++ /* Calculate the current pixel in a, and move the previous row pixel to c
++ * for the next time round the loop
++ */
++ c = b;
++ a += *row;
++ *row++ = (png_byte)a;
++ }
++}
++
++static void
++png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row)
++{
++ int bpp = (row_info->pixel_depth + 7) >> 3;
++ png_bytep rp_end = row + bpp;
++
++ /* Process the first pixel in the row completely (this is the same as 'up'
++ * because there is only one candidate predictor for the first row).
++ */
++ while (row < rp_end)
++ {
++ int a = *row + *prev_row++;
++ *row++ = (png_byte)a;
++ }
++
++ /* Remainder */
++ rp_end += row_info->rowbytes - bpp;
++
++ while (row < rp_end)
++ {
++ int a, b, c, pa, pb, pc, p;
++
++ c = *(prev_row - bpp);
++ a = *(row - bpp);
++ b = *prev_row++;
++
++ p = b - c;
++ pc = a - c;
++
++# ifdef PNG_USE_ABS
++ pa = abs(p);
++ pb = abs(pc);
++ pc = abs(p + pc);
++# else
++ pa = p < 0 ? -p : p;
++ pb = pc < 0 ? -pc : pc;
++ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
++# endif
++
++ if (pb < pa) pa = pb, a = b;
++ if (pc < pa) a = c;
++
++ a += *row;
++ *row++ = (png_byte)a;
++ }
++}
++
++static void
++png_init_filter_functions(png_structrp pp)
++ /* This function is called once for every PNG image (except for PNG images
++ * that only use PNG_FILTER_VALUE_NONE for all rows) to set the
++ * implementations required to reverse the filtering of PNG rows. Reversing
++ * the filter is the first transformation performed on the row data. It is
++ * performed in place, therefore an implementation can be selected based on
++ * the image pixel format. If the implementation depends on image width then
++ * take care to ensure that it works correctly if the image is interlaced -
++ * interlacing causes the actual row width to vary.
++ */
++{
++ unsigned int bpp = (pp->pixel_depth + 7) >> 3;
++
++ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub;
++ pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up;
++ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg;
++ if (bpp == 1)
++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
++ png_read_filter_row_paeth_1byte_pixel;
++ else
++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
++ png_read_filter_row_paeth_multibyte_pixel;
++
++#ifdef PNG_FILTER_OPTIMIZATIONS
++ /* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to
++ * call to install hardware optimizations for the above functions; simply
++ * replace whatever elements of the pp->read_filter[] array with a hardware
++ * specific (or, for that matter, generic) optimization.
++ *
++ * To see an example of this examine what configure.ac does when
++ * --enable-arm-neon is specified on the command line.
++ */
++ PNG_FILTER_OPTIMIZATIONS(pp, bpp);
++#endif
++}
+
+ void /* PRIVATE */
+-png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
+- png_const_bytep prev_row, int filter)
++png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
++ png_const_bytep prev_row, int filter)
+ {
+- png_debug(1, "in png_read_filter_row");
+- png_debug2(2, "row = %u, filter = %d", png_ptr->row_number, filter);
+- switch (filter)
++ /* OPTIMIZATION: DO NOT MODIFY THIS FUNCTION, instead #define
++ * PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
++ * implementations. See png_init_filter_functions above.
++ */
++ if (filter > PNG_FILTER_VALUE_NONE && filter < PNG_FILTER_VALUE_LAST)
+ {
+- case PNG_FILTER_VALUE_NONE:
+- break;
+-
+- case PNG_FILTER_VALUE_SUB:
++ if (pp->read_filter[0] == NULL)
++ png_init_filter_functions(pp);
++
++ pp->read_filter[filter-1](row_info, row, prev_row);
++ }
++}
++
++#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++void /* PRIVATE */
++png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
++ png_alloc_size_t avail_out)
++{
++ /* Loop reading IDATs and decompressing the result into output[avail_out] */
++ png_ptr->zstream.next_out = output;
++ png_ptr->zstream.avail_out = 0; /* safety: set below */
++
++ if (output == NULL)
++ avail_out = 0;
++
++ do
++ {
++ int ret;
++ png_byte tmpbuf[PNG_INFLATE_BUF_SIZE];
++
++ if (png_ptr->zstream.avail_in == 0)
+ {
+- png_size_t i;
+- png_size_t istop = row_info->rowbytes;
+- unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
+- png_bytep rp = row + bpp;
+- png_bytep lp = row;
+-
+- for (i = bpp; i < istop; i++)
++ uInt avail_in;
++ png_bytep buffer;
++
++ while (png_ptr->idat_size == 0)
+ {
+- *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff);
+- rp++;
++ png_crc_finish(png_ptr, 0);
++
++ png_ptr->idat_size = png_read_chunk_header(png_ptr);
++ /* This is an error even in the 'check' case because the code just
++ * consumed a non-IDAT header.
++ */
++ if (png_ptr->chunk_name != png_IDAT)
++ png_error(png_ptr, "Not enough image data");
+ }
++
++ avail_in = png_ptr->IDAT_read_size;
++
++ if (avail_in > png_ptr->idat_size)
++ avail_in = (uInt)png_ptr->idat_size;
++
++ /* A PNG with a gradually increasing IDAT size will defeat this attempt
++ * to minimize memory usage by causing lots of re-allocs, but
++ * realistically doing IDAT_read_size re-allocs is not likely to be a
++ * big problem.
++ */
++ buffer = png_read_buffer(png_ptr, avail_in, 0/*error*/);
++
++ png_crc_read(png_ptr, buffer, avail_in);
++ png_ptr->idat_size -= avail_in;
++
++ png_ptr->zstream.next_in = buffer;
++ png_ptr->zstream.avail_in = avail_in;
++ }
++
++ /* And set up the output side. */
++ if (output != NULL) /* standard read */
++ {
++ uInt out = ZLIB_IO_MAX;
++
++ if (out > avail_out)
++ out = (uInt)avail_out;
++
++ avail_out -= out;
++ png_ptr->zstream.avail_out = out;
++ }
++
++ else /* after last row, checking for end */
++ {
++ png_ptr->zstream.next_out = tmpbuf;
++ png_ptr->zstream.avail_out = (sizeof tmpbuf);
++ }
++
++ /* Use NO_FLUSH; this gives zlib the maximum opportunity to optimize the
++ * process. If the LZ stream is truncated the sequential reader will
++ * terminally damage the stream, above, by reading the chunk header of the
++ * following chunk (it then exits with png_error).
++ *
++ * TODO: deal more elegantly with truncated IDAT lists.
++ */
++ ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
++
++ /* Take the unconsumed output back. */
++ if (output != NULL)
++ avail_out += png_ptr->zstream.avail_out;
++
++ else /* avail_out counts the extra bytes */
++ avail_out += (sizeof tmpbuf) - png_ptr->zstream.avail_out;
++
++ png_ptr->zstream.avail_out = 0;
++
++ if (ret == Z_STREAM_END)
++ {
++ /* Do this for safety; we won't read any more into this row. */
++ png_ptr->zstream.next_out = NULL;
++
++ png_ptr->mode |= PNG_AFTER_IDAT;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++
++ if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
++ png_chunk_benign_error(png_ptr, "Extra compressed data");
+ break;
+ }
+- case PNG_FILTER_VALUE_UP:
++
++ if (ret != Z_OK)
+ {
+- png_size_t i;
+- png_size_t istop = row_info->rowbytes;
+- png_bytep rp = row;
+- png_const_bytep pp = prev_row;
+-
+- for (i = 0; i < istop; i++)
++ png_zstream_error(png_ptr, ret);
++
++ if (output != NULL)
++ png_chunk_error(png_ptr, png_ptr->zstream.msg);
++
++ else /* checking */
+ {
+- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+- rp++;
++ png_chunk_benign_error(png_ptr, png_ptr->zstream.msg);
++ return;
+ }
+- break;
+ }
+- case PNG_FILTER_VALUE_AVG:
+- {
+- png_size_t i;
+- png_bytep rp = row;
+- png_const_bytep pp = prev_row;
+- png_bytep lp = row;
+- unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
+- png_size_t istop = row_info->rowbytes - bpp;
+-
+- for (i = 0; i < bpp; i++)
+- {
+- *rp = (png_byte)(((int)(*rp) +
+- ((int)(*pp++) / 2 )) & 0xff);
+-
+- rp++;
+- }
+-
+- for (i = 0; i < istop; i++)
+- {
+- *rp = (png_byte)(((int)(*rp) +
+- (int)(*pp++ + *lp++) / 2 ) & 0xff);
+-
+- rp++;
+- }
+- break;
+- }
+- case PNG_FILTER_VALUE_PAETH:
+- {
+- png_size_t i;
+- png_bytep rp = row;
+- png_const_bytep pp = prev_row;
+- png_bytep lp = row;
+- png_const_bytep cp = prev_row;
+- unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
+- png_size_t istop=row_info->rowbytes - bpp;
+-
+- for (i = 0; i < bpp; i++)
+- {
+- *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff);
+- rp++;
+- }
+-
+- for (i = 0; i < istop; i++) /* Use leftover rp,pp */
+- {
+- int a, b, c, pa, pb, pc, p;
+-
+- a = *lp++;
+- b = *pp++;
+- c = *cp++;
+-
+- p = b - c;
+- pc = a - c;
+-
+-#ifdef PNG_USE_ABS
+- pa = abs(p);
+- pb = abs(pc);
+- pc = abs(p + pc);
+-#else
+- pa = p < 0 ? -p : p;
+- pb = pc < 0 ? -pc : pc;
+- pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+-#endif
+-
+- /*
+- if (pa <= pb && pa <= pc)
+- p = a;
+-
+- else if (pb <= pc)
+- p = b;
+-
+- else
+- p = c;
+- */
+-
+- p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c;
+-
+- *rp = (png_byte)(((int)(*rp) + p) & 0xff);
+- rp++;
+- }
+- break;
+- }
+- default:
+- png_error(png_ptr, "Ignoring bad adaptive filter type");
+- /*NOT REACHED */
+- break;
++ } while (avail_out > 0);
++
++ if (avail_out > 0)
++ {
++ /* The stream ended before the image; this is the same as too few IDATs so
++ * should be handled the same way.
++ */
++ if (output != NULL)
++ png_error(png_ptr, "Not enough image data");
++
++ else /* the deflate stream contained extra data */
++ png_chunk_benign_error(png_ptr, "Too much image data");
+ }
+ }
+
+-#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ void /* PRIVATE */
+-png_read_finish_row(png_structp png_ptr)
++png_read_finish_IDAT(png_structrp png_ptr)
+ {
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
++ /* We don't need any more data and the stream should have ended, however the
++ * LZ end code may actually not have been processed. In this case we must
++ * read it otherwise stray unread IDAT data or, more likely, an IDAT chunk
++ * may still remain to be consumed.
++ */
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
++ {
++ /* The NULL causes png_read_IDAT_data to swallow any remaining bytes in
++ * the compressed stream, but the stream may be damaged too, so even after
++ * this call we may need to terminate the zstream ownership.
++ */
++ png_read_IDAT_data(png_ptr, NULL, 0);
++ png_ptr->zstream.next_out = NULL; /* safety */
++
++ /* Now clear everything out for safety; the following may not have been
++ * done.
++ */
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
++ {
++ png_ptr->mode |= PNG_AFTER_IDAT;
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++ }
++ }
++
++ /* If the zstream has not been released do it now *and* terminate the reading
++ * of the final IDAT chunk.
++ */
++ if (png_ptr->zowner == png_IDAT)
++ {
++ /* Always do this; the pointers otherwise point into the read buffer. */
++ png_ptr->zstream.next_in = NULL;
++ png_ptr->zstream.avail_in = 0;
++
++ /* Now we no longer own the zstream. */
++ png_ptr->zowner = 0;
++
++ /* The slightly weird semantics of the sequential IDAT reading is that we
++ * are always in or at the end of an IDAT chunk, so we always need to do a
++ * crc_finish here. If idat_size is non-zero we also need to read the
++ * spurious bytes at the end of the chunk now.
++ */
++ (void)png_crc_finish(png_ptr, png_ptr->idat_size);
++ }
++}
++
++void /* PRIVATE */
++png_read_finish_row(png_structrp png_ptr)
++{
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
+- PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
++ static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
+- PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+-#endif /* PNG_READ_INTERLACING_SUPPORTED */
++ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+
+ png_debug(1, "in png_read_finish_row");
+ png_ptr->row_number++;
+ if (png_ptr->row_number < png_ptr->num_rows)
+ return;
+
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
+- if (png_ptr->interlaced)
++ if (png_ptr->interlaced != 0)
+ {
+ png_ptr->row_number = 0;
+
+- png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++ /* TO DO: don't do this if prev_row isn't needed (requires
++ * read-ahead of the next row's filter byte.
++ */
++ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
+
+ do
+ {
+@@ -3347,7 +4186,7 @@
+ png_pass_start[png_ptr->pass]) /
+ png_pass_inc[png_ptr->pass];
+
+- if (!(png_ptr->transformations & PNG_INTERLACE))
++ if ((png_ptr->transformations & PNG_INTERLACE) == 0)
+ {
+ png_ptr->num_rows = (png_ptr->height +
+ png_pass_yinc[png_ptr->pass] - 1 -
+@@ -3363,108 +4202,40 @@
+ if (png_ptr->pass < 7)
+ return;
+ }
+-#endif /* PNG_READ_INTERLACING_SUPPORTED */
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
+- {
+- PNG_IDAT;
+- char extra;
+- int ret;
+-
+- png_ptr->zstream.next_out = (Byte *)&extra;
+- png_ptr->zstream.avail_out = (uInt)1;
+-
+- for (;;)
+- {
+- if (!(png_ptr->zstream.avail_in))
+- {
+- while (!png_ptr->idat_size)
+- {
+- png_crc_finish(png_ptr, 0);
+- png_ptr->idat_size = png_read_chunk_header(png_ptr);
+- if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+- png_error(png_ptr, "Not enough image data");
+- }
+-
+- png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size;
+- png_ptr->zstream.next_in = png_ptr->zbuf;
+-
+- if (png_ptr->zbuf_size > png_ptr->idat_size)
+- png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size;
+-
+- png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream.avail_in);
+- png_ptr->idat_size -= png_ptr->zstream.avail_in;
+- }
+-
+- ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
+-
+- if (ret == Z_STREAM_END)
+- {
+- if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in ||
+- png_ptr->idat_size)
+- png_warning(png_ptr, "Extra compressed data");
+-
+- png_ptr->mode |= PNG_AFTER_IDAT;
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
+- break;
+- }
+-
+- if (ret != Z_OK)
+- png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
+- "Decompression Error");
+-
+- if (!(png_ptr->zstream.avail_out))
+- {
+- png_warning(png_ptr, "Extra compressed data");
+- png_ptr->mode |= PNG_AFTER_IDAT;
+- png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
+- break;
+- }
+-
+- }
+- png_ptr->zstream.avail_out = 0;
+- }
+-
+- if (png_ptr->idat_size || png_ptr->zstream.avail_in)
+- png_warning(png_ptr, "Extra compression data");
+-
+- inflateReset(&png_ptr->zstream);
+-
+- png_ptr->mode |= PNG_AFTER_IDAT;
++
++ /* Here after at the end of the last row of the last pass. */
++ png_read_finish_IDAT(png_ptr);
+ }
+-#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
++#endif /* SEQUENTIAL_READ */
+
+ void /* PRIVATE */
+-png_read_start_row(png_structp png_ptr)
++png_read_start_row(png_structrp png_ptr)
+ {
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- PNG_CONST int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
+- PNG_CONST int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
++ static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
+- PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+-#endif
++ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+
+ int max_pixel_depth;
+ png_size_t row_bytes;
+
+ png_debug(1, "in png_read_start_row");
+- png_ptr->zstream.avail_in = 0;
++
+ #ifdef PNG_READ_TRANSFORMS_SUPPORTED
+ png_init_read_transformations(png_ptr);
+ #endif
+-#ifdef PNG_READ_INTERLACING_SUPPORTED
+- if (png_ptr->interlaced)
++ if (png_ptr->interlaced != 0)
+ {
+- if (!(png_ptr->transformations & PNG_INTERLACE))
++ if ((png_ptr->transformations & PNG_INTERLACE) == 0)
+ png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
+ png_pass_ystart[0]) / png_pass_yinc[0];
+
+@@ -3478,7 +4249,6 @@
+ }
+
+ else
+-#endif /* PNG_READ_INTERLACING_SUPPORTED */
+ {
+ png_ptr->num_rows = png_ptr->height;
+ png_ptr->iwidth = png_ptr->width;
+@@ -3486,17 +4256,27 @@
+
+ max_pixel_depth = png_ptr->pixel_depth;
+
++ /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
++ * calculations to calculate the final pixel depth, then
++ * png_do_read_transforms actually does the transforms. This means that the
++ * code which effectively calculates this value is actually repeated in three
++ * separate places. They must all match. Innocent changes to the order of
++ * transformations can and will break libpng in a way that causes memory
++ * overwrites.
++ *
++ * TODO: fix this.
++ */
+ #ifdef PNG_READ_PACK_SUPPORTED
+- if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8)
++ if ((png_ptr->transformations & PNG_PACK) != 0 && png_ptr->bit_depth < 8)
+ max_pixel_depth = 8;
+ #endif
+
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+- if (png_ptr->transformations & PNG_EXPAND)
++ if ((png_ptr->transformations & PNG_EXPAND) != 0)
+ {
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+- if (png_ptr->num_trans)
++ if (png_ptr->num_trans != 0)
+ max_pixel_depth = 32;
+
+ else
+@@ -3508,13 +4288,13 @@
+ if (max_pixel_depth < 8)
+ max_pixel_depth = 8;
+
+- if (png_ptr->num_trans)
++ if (png_ptr->num_trans != 0)
+ max_pixel_depth *= 2;
+ }
+
+ else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
+ {
+- if (png_ptr->num_trans)
++ if (png_ptr->num_trans != 0)
+ {
+ max_pixel_depth *= 4;
+ max_pixel_depth /= 3;
+@@ -3524,13 +4304,13 @@
+ #endif
+
+ #ifdef PNG_READ_EXPAND_16_SUPPORTED
+- if (png_ptr->transformations & PNG_EXPAND_16)
++ if ((png_ptr->transformations & PNG_EXPAND_16) != 0)
+ {
+ # ifdef PNG_READ_EXPAND_SUPPORTED
+ /* In fact it is an error if it isn't supported, but checking is
+ * the safe way.
+ */
+- if (png_ptr->transformations & PNG_EXPAND)
++ if ((png_ptr->transformations & PNG_EXPAND) != 0)
+ {
+ if (png_ptr->bit_depth < 16)
+ max_pixel_depth *= 2;
+@@ -3542,12 +4322,9 @@
+ #endif
+
+ #ifdef PNG_READ_FILLER_SUPPORTED
+- if (png_ptr->transformations & (PNG_FILLER))
++ if ((png_ptr->transformations & (PNG_FILLER)) != 0)
+ {
+- if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+- max_pixel_depth = 32;
+-
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
++ if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+ {
+ if (max_pixel_depth <= 8)
+ max_pixel_depth = 16;
+@@ -3556,7 +4333,8 @@
+ max_pixel_depth = 32;
+ }
+
+- else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
++ else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB ||
++ png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+ if (max_pixel_depth <= 32)
+ max_pixel_depth = 32;
+@@ -3568,14 +4346,15 @@
+ #endif
+
+ #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+- if (png_ptr->transformations & PNG_GRAY_TO_RGB)
++ if ((png_ptr->transformations & PNG_GRAY_TO_RGB) != 0)
+ {
+ if (
+ #ifdef PNG_READ_EXPAND_SUPPORTED
+- (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) ||
++ (png_ptr->num_trans != 0 &&
++ (png_ptr->transformations & PNG_EXPAND) != 0) ||
+ #endif
+ #ifdef PNG_READ_FILLER_SUPPORTED
+- (png_ptr->transformations & (PNG_FILLER)) ||
++ (png_ptr->transformations & (PNG_FILLER)) != 0 ||
+ #endif
+ png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ {
+@@ -3608,16 +4387,22 @@
+
+ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \
+ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+- if (png_ptr->transformations & PNG_USER_TRANSFORM)
++ if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
+ {
+- int user_pixel_depth = png_ptr->user_transform_depth*
++ int user_pixel_depth = png_ptr->user_transform_depth *
+ png_ptr->user_transform_channels;
+
+ if (user_pixel_depth > max_pixel_depth)
+- max_pixel_depth=user_pixel_depth;
++ max_pixel_depth = user_pixel_depth;
+ }
+ #endif
+
++ /* This value is stored in png_struct and double checked in the row read
++ * code.
++ */
++ png_ptr->maximum_pixel_depth = (png_byte)max_pixel_depth;
++ png_ptr->transformed_pixel_depth = 0; /* calculated on demand */
++
+ /* Align the width on the next larger 8 pixels. Mainly used
+ * for interlacing
+ */
+@@ -3636,28 +4421,39 @@
+ if (row_bytes + 48 > png_ptr->old_big_row_buf_size)
+ {
+ png_free(png_ptr, png_ptr->big_row_buf);
+-
+- if (png_ptr->interlaced)
++ png_free(png_ptr, png_ptr->big_prev_row);
++
++ if (png_ptr->interlaced != 0)
+ png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr,
+ row_bytes + 48);
+
+ else
+- png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr,
+- row_bytes + 48);
+-
+- png_ptr->old_big_row_buf_size = row_bytes + 48;
++ png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
++
++ png_ptr->big_prev_row = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
+
+ #ifdef PNG_ALIGNED_MEMORY_SUPPORTED
+ /* Use 16-byte aligned memory for row_buf with at least 16 bytes
+- * of padding before and after row_buf.
++ * of padding before and after row_buf; treat prev_row similarly.
++ * NOTE: the alignment is to the start of the pixels, one beyond the start
++ * of the buffer, because of the filter byte. Prior to libpng 1.5.6 this
++ * was incorrect; the filter byte was aligned, which had the exact
++ * opposite effect of that intended.
+ */
+- png_ptr->row_buf = png_ptr->big_row_buf + 32 -
+- (((png_alloc_size_t)png_ptr->big_row_buf + 15) & 0x0F);
+-
+- png_ptr->old_big_row_buf_size = row_bytes + 48;
++ {
++ png_bytep temp = png_ptr->big_row_buf + 32;
++ int extra = (int)((temp - (png_bytep)0) & 0x0f);
++ png_ptr->row_buf = temp - extra - 1/*filter byte*/;
++
++ temp = png_ptr->big_prev_row + 32;
++ extra = (int)((temp - (png_bytep)0) & 0x0f);
++ png_ptr->prev_row = temp - extra - 1/*filter byte*/;
++ }
++
+ #else
+- /* Use 32 bytes of padding before and 16 bytes after row_buf. */
+- png_ptr->row_buf = png_ptr->big_row_buf + 32;
++ /* Use 31 bytes of padding before and 17 bytes after row_buf. */
++ png_ptr->row_buf = png_ptr->big_row_buf + 31;
++ png_ptr->prev_row = png_ptr->big_prev_row + 31;
+ #endif
+ png_ptr->old_big_row_buf_size = row_bytes + 48;
+ }
+@@ -3670,16 +4466,7 @@
+ if (png_ptr->rowbytes > (PNG_SIZE_MAX - 1))
+ png_error(png_ptr, "Row has too many bytes to allocate in memory");
+
+- if (png_ptr->rowbytes + 1 > png_ptr->old_prev_row_size)
+- {
+- png_free(png_ptr, png_ptr->prev_row);
+-
+- png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, png_ptr->rowbytes + 1);
+-
+- png_ptr->old_prev_row_size = png_ptr->rowbytes + 1;
+- }
+-
+- png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
+
+ png_debug1(3, "width = %u,", png_ptr->width);
+ png_debug1(3, "height = %u,", png_ptr->height);
+@@ -3689,6 +4476,27 @@
+ png_debug1(3, "irowbytes = %lu",
+ (unsigned long)PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
+
++ /* The sequential reader needs a buffer for IDAT, but the progressive reader
++ * does not, so free the read buffer now regardless; the sequential reader
++ * reallocates it on demand.
++ */
++ if (png_ptr->read_buffer != 0)
++ {
++ png_bytep buffer = png_ptr->read_buffer;
++
++ png_ptr->read_buffer_size = 0;
++ png_ptr->read_buffer = NULL;
++ png_free(png_ptr, buffer);
++ }
++
++ /* Finally claim the zstream for the inflate of the IDAT data, use the bits
++ * value from the stream (note that this will result in a fatal error if the
++ * IDAT stream has a bogus deflate header window_bits value, but this should
++ * not be happening any longer!)
++ */
++ if (png_inflate_claim(png_ptr, png_IDAT) != Z_OK)
++ png_error(png_ptr, png_ptr->zstream.msg);
++
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
+-#endif /* PNG_READ_SUPPORTED */
++#endif /* READ */
+--- ./jdk/src/share/native/sun/awt/libpng/pngset.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngset.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -50,51 +50,84 @@
+
+ #ifdef PNG_bKGD_SUPPORTED
+ void PNGAPI
+-png_set_bKGD(png_structp png_ptr, png_infop info_ptr,
++png_set_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_const_color_16p background)
+ {
+ png_debug1(1, "in %s storage function", "bKGD");
+
+- if (png_ptr == NULL || info_ptr == NULL)
++ if (png_ptr == NULL || info_ptr == NULL || background == NULL)
+ return;
+
+- png_memcpy(&(info_ptr->background), background, png_sizeof(png_color_16));
++ info_ptr->background = *background;
+ info_ptr->valid |= PNG_INFO_bKGD;
+ }
+ #endif
+
+ #ifdef PNG_cHRM_SUPPORTED
+ void PNGFAPI
+-png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
++png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
+ png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
+ png_fixed_point blue_x, png_fixed_point blue_y)
+ {
++ png_xy xy;
++
+ png_debug1(1, "in %s storage function", "cHRM fixed");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+-# ifdef PNG_CHECK_cHRM_SUPPORTED
+- if (png_check_cHRM_fixed(png_ptr,
+- white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
+-# endif
+- {
+- info_ptr->x_white = white_x;
+- info_ptr->y_white = white_y;
+- info_ptr->x_red = red_x;
+- info_ptr->y_red = red_y;
+- info_ptr->x_green = green_x;
+- info_ptr->y_green = green_y;
+- info_ptr->x_blue = blue_x;
+- info_ptr->y_blue = blue_y;
+- info_ptr->valid |= PNG_INFO_cHRM;
+- }
++ xy.redx = red_x;
++ xy.redy = red_y;
++ xy.greenx = green_x;
++ xy.greeny = green_y;
++ xy.bluex = blue_x;
++ xy.bluey = blue_y;
++ xy.whitex = white_x;
++ xy.whitey = white_y;
++
++ if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
++ 2/* override with app values*/) != 0)
++ info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
++
++ png_colorspace_sync_info(png_ptr, info_ptr);
++}
++
++void PNGFAPI
++png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_fixed_point int_red_X, png_fixed_point int_red_Y,
++ png_fixed_point int_red_Z, png_fixed_point int_green_X,
++ png_fixed_point int_green_Y, png_fixed_point int_green_Z,
++ png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
++ png_fixed_point int_blue_Z)
++{
++ png_XYZ XYZ;
++
++ png_debug1(1, "in %s storage function", "cHRM XYZ fixed");
++
++ if (png_ptr == NULL || info_ptr == NULL)
++ return;
++
++ XYZ.red_X = int_red_X;
++ XYZ.red_Y = int_red_Y;
++ XYZ.red_Z = int_red_Z;
++ XYZ.green_X = int_green_X;
++ XYZ.green_Y = int_green_Y;
++ XYZ.green_Z = int_green_Z;
++ XYZ.blue_X = int_blue_X;
++ XYZ.blue_Y = int_blue_Y;
++ XYZ.blue_Z = int_blue_Z;
++
++ if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace,
++ &XYZ, 2) != 0)
++ info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
++
++ png_colorspace_sync_info(png_ptr, info_ptr);
+ }
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
++png_set_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
+ double white_x, double white_y, double red_x, double red_y,
+ double green_x, double green_y, double blue_x, double blue_y)
+ {
+@@ -108,41 +141,44 @@
+ png_fixed(png_ptr, blue_x, "cHRM Blue X"),
+ png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
+ }
+-# endif /* PNG_FLOATING_POINT_SUPPORTED */
+
+-#endif /* PNG_cHRM_SUPPORTED */
++void PNGAPI
++png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
++ double red_Y, double red_Z, double green_X, double green_Y, double green_Z,
++ double blue_X, double blue_Y, double blue_Z)
++{
++ png_set_cHRM_XYZ_fixed(png_ptr, info_ptr,
++ png_fixed(png_ptr, red_X, "cHRM Red X"),
++ png_fixed(png_ptr, red_Y, "cHRM Red Y"),
++ png_fixed(png_ptr, red_Z, "cHRM Red Z"),
++ png_fixed(png_ptr, green_X, "cHRM Red X"),
++ png_fixed(png_ptr, green_Y, "cHRM Red Y"),
++ png_fixed(png_ptr, green_Z, "cHRM Red Z"),
++ png_fixed(png_ptr, blue_X, "cHRM Red X"),
++ png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
++ png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
++}
++# endif /* FLOATING_POINT */
++
++#endif /* cHRM */
+
+ #ifdef PNG_gAMA_SUPPORTED
+ void PNGFAPI
+-png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
+- file_gamma)
++png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_fixed_point file_gamma)
+ {
+ png_debug1(1, "in %s storage function", "gAMA");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+- /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
+- * occur. Since the fixed point representation is assymetrical it is
+- * possible for 1/gamma to overflow the limit of 21474 and this means the
+- * gamma value must be at least 5/100000 and hence at most 20000.0. For
+- * safety the limits here are a little narrower. The values are 0.00016 to
+- * 6250.0, which are truely ridiculous gammma values (and will produce
+- * displays that are all black or all white.)
+- */
+- if (file_gamma < 16 || file_gamma > 625000000)
+- png_warning(png_ptr, "Out of range gamma value ignored");
+-
+- else
+- {
+- info_ptr->gamma = file_gamma;
+- info_ptr->valid |= PNG_INFO_gAMA;
+- }
++ png_colorspace_set_gamma(png_ptr, &info_ptr->colorspace, file_gamma);
++ png_colorspace_sync_info(png_ptr, info_ptr);
+ }
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
++png_set_gAMA(png_const_structrp png_ptr, png_inforp info_ptr, double file_gamma)
+ {
+ png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma,
+ "png_set_gAMA"));
+@@ -152,7 +188,8 @@
+
+ #ifdef PNG_hIST_SUPPORTED
+ void PNGAPI
+-png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)
++png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_const_uint_16p hist)
+ {
+ int i;
+
+@@ -175,26 +212,26 @@
+ /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
+ * version 1.2.1
+ */
+- png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
+- PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
++ info_ptr->hist = png_voidcast(png_uint_16p, png_malloc_warn(png_ptr,
++ PNG_MAX_PALETTE_LENGTH * (sizeof (png_uint_16))));
+
+- if (png_ptr->hist == NULL)
++ if (info_ptr->hist == NULL)
+ {
+ png_warning(png_ptr, "Insufficient memory for hIST chunk data");
+ return;
+ }
+
++ info_ptr->free_me |= PNG_FREE_HIST;
++
+ for (i = 0; i < info_ptr->num_palette; i++)
+- png_ptr->hist[i] = hist[i];
++ info_ptr->hist[i] = hist[i];
+
+- info_ptr->hist = png_ptr->hist;
+ info_ptr->valid |= PNG_INFO_hIST;
+- info_ptr->free_me |= PNG_FREE_HIST;
+ }
+ #endif
+
+ void PNGAPI
+-png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
++png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)
+@@ -219,32 +256,23 @@
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ info_ptr->channels = 1;
+
+- else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
++ else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ info_ptr->channels = 3;
+
+ else
+ info_ptr->channels = 1;
+
+- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
++ if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ info_ptr->channels++;
+
+ info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
+
+- /* Check for potential overflow */
+- if (width >
+- (PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
+- - 48 /* bigrowbuf hack */
+- - 1 /* filter byte */
+- - 7*8 /* rounding of width to multiple of 8 pixels */
+- - 8) /* extra max_pixel_depth pad */
+- info_ptr->rowbytes = 0;
+- else
+- info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
++ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
+ }
+
+ #ifdef PNG_oFFs_SUPPORTED
+ void PNGAPI
+-png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
++png_set_oFFs(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_int_32 offset_x, png_int_32 offset_y, int unit_type)
+ {
+ png_debug1(1, "in %s storage function", "oFFs");
+@@ -261,7 +289,7 @@
+
+ #ifdef PNG_pCAL_SUPPORTED
+ void PNGAPI
+-png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
++png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
+ int nparams, png_const_charp units, png_charpp params)
+ {
+@@ -270,10 +298,11 @@
+
+ png_debug1(1, "in %s storage function", "pCAL");
+
+- if (png_ptr == NULL || info_ptr == NULL)
++ if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
++ || (nparams > 0 && params == NULL))
+ return;
+
+- length = png_strlen(purpose) + 1;
++ length = strlen(purpose) + 1;
+ png_debug1(3, "allocating purpose for info (%lu bytes)",
+ (unsigned long)length);
+
+@@ -283,12 +312,19 @@
+ if (type < 0 || type > 3)
+ png_error(png_ptr, "Invalid pCAL equation type");
+
++ if (nparams < 0 || nparams > 255)
++ png_error(png_ptr, "Invalid pCAL parameter count");
++
+ /* Validate params[nparams] */
+ for (i=0; i<nparams; ++i)
+- if (!png_check_fp_string(params[i], png_strlen(params[i])))
++ {
++ if (params[i] == NULL ||
++ !png_check_fp_string(params[i], strlen(params[i])))
+ png_error(png_ptr, "Invalid format for pCAL parameter");
++ }
+
+- info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
++ info_ptr->pcal_purpose = png_voidcast(png_charp,
++ png_malloc_warn(png_ptr, length));
+
+ if (info_ptr->pcal_purpose == NULL)
+ {
+@@ -296,7 +332,7 @@
+ return;
+ }
+
+- png_memcpy(info_ptr->pcal_purpose, purpose, length);
++ memcpy(info_ptr->pcal_purpose, purpose, length);
+
+ png_debug(3, "storing X0, X1, type, and nparams in info");
+ info_ptr->pcal_X0 = X0;
+@@ -304,11 +340,12 @@
+ info_ptr->pcal_type = (png_byte)type;
+ info_ptr->pcal_nparams = (png_byte)nparams;
+
+- length = png_strlen(units) + 1;
++ length = strlen(units) + 1;
+ png_debug1(3, "allocating units for info (%lu bytes)",
+ (unsigned long)length);
+
+- info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
++ info_ptr->pcal_units = png_voidcast(png_charp,
++ png_malloc_warn(png_ptr, length));
+
+ if (info_ptr->pcal_units == NULL)
+ {
+@@ -316,10 +353,10 @@
+ return;
+ }
+
+- png_memcpy(info_ptr->pcal_units, units, length);
++ memcpy(info_ptr->pcal_units, units, length);
+
+- info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr,
+- (png_size_t)((nparams + 1) * png_sizeof(png_charp)));
++ info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
++ (png_size_t)((nparams + 1) * (sizeof (png_charp)))));
+
+ if (info_ptr->pcal_params == NULL)
+ {
+@@ -327,11 +364,11 @@
+ return;
+ }
+
+- png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp));
++ memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp)));
+
+ for (i = 0; i < nparams; i++)
+ {
+- length = png_strlen(params[i]) + 1;
++ length = strlen(params[i]) + 1;
+ png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
+ (unsigned long)length);
+
+@@ -343,7 +380,7 @@
+ return;
+ }
+
+- png_memcpy(info_ptr->pcal_params[i], params[i], length);
++ memcpy(info_ptr->pcal_params[i], params[i], length);
+ }
+
+ info_ptr->valid |= PNG_INFO_pCAL;
+@@ -353,7 +390,7 @@
+
+ #ifdef PNG_sCAL_SUPPORTED
+ void PNGAPI
+-png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
++png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
+ int unit, png_const_charp swidth, png_const_charp sheight)
+ {
+ png_size_t lengthw = 0, lengthh = 0;
+@@ -369,11 +406,11 @@
+ if (unit != 1 && unit != 2)
+ png_error(png_ptr, "Invalid sCAL unit");
+
+- if (swidth == NULL || (lengthw = png_strlen(swidth)) == 0 ||
++ if (swidth == NULL || (lengthw = strlen(swidth)) == 0 ||
+ swidth[0] == 45 /* '-' */ || !png_check_fp_string(swidth, lengthw))
+ png_error(png_ptr, "Invalid sCAL width");
+
+- if (sheight == NULL || (lengthh = png_strlen(sheight)) == 0 ||
++ if (sheight == NULL || (lengthh = strlen(sheight)) == 0 ||
+ sheight[0] == 45 /* '-' */ || !png_check_fp_string(sheight, lengthh))
+ png_error(png_ptr, "Invalid sCAL height");
+
+@@ -383,7 +420,8 @@
+
+ png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthw);
+
+- info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, lengthw);
++ info_ptr->scal_s_width = png_voidcast(png_charp,
++ png_malloc_warn(png_ptr, lengthw));
+
+ if (info_ptr->scal_s_width == NULL)
+ {
+@@ -391,13 +429,14 @@
+ return;
+ }
+
+- png_memcpy(info_ptr->scal_s_width, swidth, lengthw);
++ memcpy(info_ptr->scal_s_width, swidth, lengthw);
+
+ ++lengthh;
+
+ png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthh);
+
+- info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, lengthh);
++ info_ptr->scal_s_height = png_voidcast(png_charp,
++ png_malloc_warn(png_ptr, lengthh));
+
+ if (info_ptr->scal_s_height == NULL)
+ {
+@@ -408,7 +447,7 @@
+ return;
+ }
+
+- png_memcpy(info_ptr->scal_s_height, sheight, lengthh);
++ memcpy(info_ptr->scal_s_height, sheight, lengthh);
+
+ info_ptr->valid |= PNG_INFO_sCAL;
+ info_ptr->free_me |= PNG_FREE_SCAL;
+@@ -416,8 +455,8 @@
+
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
+- double height)
++png_set_sCAL(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
++ double width, double height)
+ {
+ png_debug1(1, "in %s storage function", "sCAL");
+
+@@ -434,9 +473,9 @@
+ char swidth[PNG_sCAL_MAX_DIGITS+1];
+ char sheight[PNG_sCAL_MAX_DIGITS+1];
+
+- png_ascii_from_fp(png_ptr, swidth, sizeof swidth, width,
++ png_ascii_from_fp(png_ptr, swidth, (sizeof swidth), width,
+ PNG_sCAL_PRECISION);
+- png_ascii_from_fp(png_ptr, sheight, sizeof sheight, height,
++ png_ascii_from_fp(png_ptr, sheight, (sizeof sheight), height,
+ PNG_sCAL_PRECISION);
+
+ png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
+@@ -446,7 +485,7 @@
+
+ # ifdef PNG_FIXED_POINT_SUPPORTED
+ void PNGAPI
+-png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit,
++png_set_sCAL_fixed(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
+ png_fixed_point width, png_fixed_point height)
+ {
+ png_debug1(1, "in %s storage function", "sCAL");
+@@ -464,8 +503,8 @@
+ char swidth[PNG_sCAL_MAX_DIGITS+1];
+ char sheight[PNG_sCAL_MAX_DIGITS+1];
+
+- png_ascii_from_fixed(png_ptr, swidth, sizeof swidth, width);
+- png_ascii_from_fixed(png_ptr, sheight, sizeof sheight, height);
++ png_ascii_from_fixed(png_ptr, swidth, (sizeof swidth), width);
++ png_ascii_from_fixed(png_ptr, sheight, (sizeof sheight), height);
+
+ png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
+ }
+@@ -475,7 +514,7 @@
+
+ #ifdef PNG_pHYs_SUPPORTED
+ void PNGAPI
+-png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
++png_set_pHYs(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_uint_32 res_x, png_uint_32 res_y, int unit_type)
+ {
+ png_debug1(1, "in %s storage function", "pHYs");
+@@ -491,7 +530,7 @@
+ #endif
+
+ void PNGAPI
+-png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
++png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
+ png_const_colorp palette, int num_palette)
+ {
+
+@@ -526,6 +565,9 @@
+ /* It may not actually be necessary to set png_ptr->palette here;
+ * we do it for backward compatibility with the way the png_handle_tRNS
+ * function used to do the allocation.
++ *
++ * 1.6.0: the above statement appears to be incorrect; something has to set
++ * the palette inside png_struct on read.
+ */
+ png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
+
+@@ -533,10 +575,11 @@
+ * of num_palette entries, in case of an invalid PNG file that has
+ * too-large sample values.
+ */
+- png_ptr->palette = (png_colorp)png_calloc(png_ptr,
+- PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
++ png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
++ PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
+
+- png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
++ if (num_palette > 0)
++ memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
+ info_ptr->palette = png_ptr->palette;
+ info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
+
+@@ -547,34 +590,34 @@
+
+ #ifdef PNG_sBIT_SUPPORTED
+ void PNGAPI
+-png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
++png_set_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_const_color_8p sig_bit)
+ {
+ png_debug1(1, "in %s storage function", "sBIT");
+
+- if (png_ptr == NULL || info_ptr == NULL)
++ if (png_ptr == NULL || info_ptr == NULL || sig_bit == NULL)
+ return;
+
+- png_memcpy(&(info_ptr->sig_bit), sig_bit, png_sizeof(png_color_8));
++ info_ptr->sig_bit = *sig_bit;
+ info_ptr->valid |= PNG_INFO_sBIT;
+ }
+ #endif
+
+ #ifdef PNG_sRGB_SUPPORTED
+ void PNGAPI
+-png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int srgb_intent)
++png_set_sRGB(png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
+ {
+ png_debug1(1, "in %s storage function", "sRGB");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+- info_ptr->srgb_intent = (png_byte)srgb_intent;
+- info_ptr->valid |= PNG_INFO_sRGB;
++ (void)png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent);
++ png_colorspace_sync_info(png_ptr, info_ptr);
+ }
+
+ void PNGAPI
+-png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
++png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
+ int srgb_intent)
+ {
+ png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
+@@ -582,71 +625,87 @@
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+- png_set_sRGB(png_ptr, info_ptr, srgb_intent);
++ if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace,
++ srgb_intent) != 0)
++ {
++ /* This causes the gAMA and cHRM to be written too */
++ info_ptr->colorspace.flags |=
++ PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
++ }
+
+-# ifdef PNG_gAMA_SUPPORTED
+- png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
+-# endif
+-
+-# ifdef PNG_cHRM_SUPPORTED
+- png_set_cHRM_fixed(png_ptr, info_ptr,
+- /* color x y */
+- /* white */ 31270L, 32900L,
+- /* red */ 64000L, 33000L,
+- /* green */ 30000L, 60000L,
+- /* blue */ 15000L, 6000L
+- );
+-# endif /* cHRM */
++ png_colorspace_sync_info(png_ptr, info_ptr);
+ }
+ #endif /* sRGB */
+
+
+ #ifdef PNG_iCCP_SUPPORTED
+ void PNGAPI
+-png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
++png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_const_charp name, int compression_type,
+ png_const_bytep profile, png_uint_32 proflen)
+ {
+ png_charp new_iccp_name;
+ png_bytep new_iccp_profile;
+- png_uint_32 length;
++ png_size_t length;
+
+ png_debug1(1, "in %s storage function", "iCCP");
+
+ if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
+ return;
+
+- length = png_strlen(name)+1;
+- new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
++ if (compression_type != PNG_COMPRESSION_TYPE_BASE)
++ png_app_error(png_ptr, "Invalid iCCP compression method");
++
++ /* Set the colorspace first because this validates the profile; do not
++ * override previously set app cHRM or gAMA here (because likely as not the
++ * application knows better than libpng what the correct values are.) Pass
++ * the info_ptr color_type field to png_colorspace_set_ICC because in the
++ * write case it has not yet been stored in png_ptr.
++ */
++ {
++ int result = png_colorspace_set_ICC(png_ptr, &info_ptr->colorspace, name,
++ proflen, profile, info_ptr->color_type);
++
++ png_colorspace_sync_info(png_ptr, info_ptr);
++
++ /* Don't do any of the copying if the profile was bad, or inconsistent. */
++ if (result == 0)
++ return;
++
++ /* But do write the gAMA and cHRM chunks from the profile. */
++ info_ptr->colorspace.flags |=
++ PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
++ }
++
++ length = strlen(name)+1;
++ new_iccp_name = png_voidcast(png_charp, png_malloc_warn(png_ptr, length));
+
+ if (new_iccp_name == NULL)
+ {
+- png_warning(png_ptr, "Insufficient memory to process iCCP chunk");
++ png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
+ return;
+ }
+
+- png_memcpy(new_iccp_name, name, length);
+- new_iccp_profile = (png_bytep)png_malloc_warn(png_ptr, proflen);
++ memcpy(new_iccp_name, name, length);
++ new_iccp_profile = png_voidcast(png_bytep,
++ png_malloc_warn(png_ptr, proflen));
+
+ if (new_iccp_profile == NULL)
+ {
+- png_free (png_ptr, new_iccp_name);
+- png_warning(png_ptr,
++ png_free(png_ptr, new_iccp_name);
++ new_iccp_name = NULL;
++ png_benign_error(png_ptr,
+ "Insufficient memory to process iCCP profile");
+ return;
+ }
+
+- png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
++ memcpy(new_iccp_profile, profile, proflen);
+
+ png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
+
+ info_ptr->iccp_proflen = proflen;
+ info_ptr->iccp_name = new_iccp_name;
+ info_ptr->iccp_profile = new_iccp_profile;
+- /* Compression is always zero but is here so the API and info structure
+- * does not have to change if we introduce multiple compression types
+- */
+- info_ptr->iccp_compression = (png_byte)compression_type;
+ info_ptr->free_me |= PNG_FREE_ICCP;
+ info_ptr->valid |= PNG_INFO_iCCP;
+ }
+@@ -654,74 +713,81 @@
+
+ #ifdef PNG_TEXT_SUPPORTED
+ void PNGAPI
+-png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr,
+- int num_text)
++png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_const_textp text_ptr, int num_text)
+ {
+ int ret;
+ ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
+
+- if (ret)
++ if (ret != 0)
+ png_error(png_ptr, "Insufficient memory to store text");
+ }
+
+ int /* PRIVATE */
+-png_set_text_2(png_structp png_ptr, png_infop info_ptr,
++png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
+ png_const_textp text_ptr, int num_text)
+ {
+ int i;
+
+- png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
+- png_ptr->chunk_name[0] == '\0') ?
+- "text" : (png_const_charp)png_ptr->chunk_name));
++ png_debug1(1, "in %lx storage function", png_ptr == NULL ? "unexpected" :
++ (unsigned long)png_ptr->chunk_name);
+
+- if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
++ if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
+ return(0);
+
+ /* Make sure we have enough space in the "text" array in info_struct
+- * to hold all of the incoming text_ptr objects.
++ * to hold all of the incoming text_ptr objects. This compare can't overflow
++ * because max_text >= num_text (anyway, subtract of two positive integers
++ * can't overflow in any case.)
+ */
+- if (info_ptr->num_text + num_text > info_ptr->max_text)
++ if (num_text > info_ptr->max_text - info_ptr->num_text)
+ {
+- if (info_ptr->text != NULL)
++ int old_num_text = info_ptr->num_text;
++ int max_text;
++ png_textp new_text = NULL;
++
++ /* Calculate an appropriate max_text, checking for overflow. */
++ max_text = old_num_text;
++ if (num_text <= INT_MAX - max_text)
+ {
+- png_textp old_text;
+- int old_max;
++ max_text += num_text;
+
+- old_max = info_ptr->max_text;
+- info_ptr->max_text = info_ptr->num_text + num_text + 8;
+- old_text = info_ptr->text;
+- info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
+- (png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
++ /* Round up to a multiple of 8 */
++ if (max_text < INT_MAX-8)
++ max_text = (max_text + 8) & ~0x7;
+
+- if (info_ptr->text == NULL)
+- {
+- png_free(png_ptr, old_text);
+- return(1);
+- }
++ else
++ max_text = INT_MAX;
+
+- png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
+- png_sizeof(png_text)));
+- png_free(png_ptr, old_text);
++ /* Now allocate a new array and copy the old members in; this does all
++ * the overflow checks.
++ */
++ new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
++ info_ptr->text, old_num_text, max_text-old_num_text,
++ sizeof *new_text));
+ }
+
+- else
++ if (new_text == NULL)
+ {
+- info_ptr->max_text = num_text + 8;
+- info_ptr->num_text = 0;
+- info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
+- (png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
+- if (info_ptr->text == NULL)
+- return(1);
+- info_ptr->free_me |= PNG_FREE_TEXT;
++ png_chunk_report(png_ptr, "too many text chunks",
++ PNG_CHUNK_WRITE_ERROR);
++ return 1;
+ }
+
+- png_debug1(3, "allocated %d entries for info_ptr->text",
+- info_ptr->max_text);
++ png_free(png_ptr, info_ptr->text);
++
++ info_ptr->text = new_text;
++ info_ptr->free_me |= PNG_FREE_TEXT;
++ info_ptr->max_text = max_text;
++ /* num_text is adjusted below as the entries are copied in */
++
++ png_debug1(3, "allocated %d entries for info_ptr->text", max_text);
+ }
++
+ for (i = 0; i < num_text; i++)
+ {
+- png_size_t text_length, key_len;
+- png_size_t lang_len, lang_key_len;
++ size_t text_length, key_len;
++ size_t lang_len, lang_key_len;
+ png_textp textp = &(info_ptr->text[info_ptr->num_text]);
+
+ if (text_ptr[i].key == NULL)
+@@ -730,11 +796,12 @@
+ if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE ||
+ text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
+ {
+- png_warning(png_ptr, "text compression mode is out of range");
++ png_chunk_report(png_ptr, "text compression mode is out of range",
++ PNG_CHUNK_WRITE_ERROR);
+ continue;
+ }
+
+- key_len = png_strlen(text_ptr[i].key);
++ key_len = strlen(text_ptr[i].key);
+
+ if (text_ptr[i].compression <= 0)
+ {
+@@ -748,20 +815,21 @@
+ /* Set iTXt data */
+
+ if (text_ptr[i].lang != NULL)
+- lang_len = png_strlen(text_ptr[i].lang);
++ lang_len = strlen(text_ptr[i].lang);
+
+ else
+ lang_len = 0;
+
+ if (text_ptr[i].lang_key != NULL)
+- lang_key_len = png_strlen(text_ptr[i].lang_key);
++ lang_key_len = strlen(text_ptr[i].lang_key);
+
+ else
+ lang_key_len = 0;
+ }
+ # else /* PNG_iTXt_SUPPORTED */
+ {
+- png_warning(png_ptr, "iTXt chunk not supported");
++ png_chunk_report(png_ptr, "iTXt chunk not supported",
++ PNG_CHUNK_WRITE_ERROR);
+ continue;
+ }
+ # endif
+@@ -780,32 +848,35 @@
+
+ else
+ {
+- text_length = png_strlen(text_ptr[i].text);
++ text_length = strlen(text_ptr[i].text);
+ textp->compression = text_ptr[i].compression;
+ }
+
+- textp->key = (png_charp)png_malloc_warn(png_ptr,
+- (png_size_t)
+- (key_len + text_length + lang_len + lang_key_len + 4));
++ textp->key = png_voidcast(png_charp,png_malloc_base(png_ptr,
++ key_len + text_length + lang_len + lang_key_len + 4));
+
+ if (textp->key == NULL)
+- return(1);
++ {
++ png_chunk_report(png_ptr, "text chunk: out of memory",
++ PNG_CHUNK_WRITE_ERROR);
++ return 1;
++ }
+
+ png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
+ (unsigned long)(png_uint_32)
+ (key_len + lang_len + lang_key_len + text_length + 4),
+ textp->key);
+
+- png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
++ memcpy(textp->key, text_ptr[i].key, key_len);
+ *(textp->key + key_len) = '\0';
+
+ if (text_ptr[i].compression > 0)
+ {
+ textp->lang = textp->key + key_len + 1;
+- png_memcpy(textp->lang, text_ptr[i].lang, lang_len);
++ memcpy(textp->lang, text_ptr[i].lang, lang_len);
+ *(textp->lang + lang_len) = '\0';
+ textp->lang_key = textp->lang + lang_len + 1;
+- png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
++ memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
+ *(textp->lang_key + lang_key_len) = '\0';
+ textp->text = textp->lang_key + lang_key_len + 1;
+ }
+@@ -817,9 +888,8 @@
+ textp->text = textp->key + key_len + 1;
+ }
+
+- if (text_length)
+- png_memcpy(textp->text, text_ptr[i].text,
+- (png_size_t)(text_length));
++ if (text_length != 0)
++ memcpy(textp->text, text_ptr[i].text, text_length);
+
+ *(textp->text + text_length) = '\0';
+
+@@ -840,28 +910,39 @@
+ info_ptr->num_text++;
+ png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
+ }
++
+ return(0);
+ }
+ #endif
+
+ #ifdef PNG_tIME_SUPPORTED
+ void PNGAPI
+-png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time)
++png_set_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_const_timep mod_time)
+ {
+ png_debug1(1, "in %s storage function", "tIME");
+
+- if (png_ptr == NULL || info_ptr == NULL ||
+- (png_ptr->mode & PNG_WROTE_tIME))
++ if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
++ (png_ptr->mode & PNG_WROTE_tIME) != 0)
+ return;
+
+- png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time));
++ if (mod_time->month == 0 || mod_time->month > 12 ||
++ mod_time->day == 0 || mod_time->day > 31 ||
++ mod_time->hour > 23 || mod_time->minute > 59 ||
++ mod_time->second > 60)
++ {
++ png_warning(png_ptr, "Ignoring invalid time value");
++ return;
++ }
++
++ info_ptr->mod_time = *mod_time;
+ info_ptr->valid |= PNG_INFO_tIME;
+ }
+ #endif
+
+ #ifdef PNG_tRNS_SUPPORTED
+ void PNGAPI
+-png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
++png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
+ png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
+ {
+ png_debug1(1, "in %s storage function", "tRNS");
+@@ -874,16 +955,20 @@
+ /* It may not actually be necessary to set png_ptr->trans_alpha here;
+ * we do it for backward compatibility with the way the png_handle_tRNS
+ * function used to do the allocation.
++ *
++ * 1.6.0: The above statement is incorrect; png_handle_tRNS effectively
++ * relies on png_set_tRNS storing the information in png_struct
++ * (otherwise it won't be there for the code in pngrtran.c).
+ */
+
+ png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
+
+ /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
+- png_ptr->trans_alpha = info_ptr->trans_alpha =
+- (png_bytep)png_malloc(png_ptr, (png_size_t)PNG_MAX_PALETTE_LENGTH);
++ png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep,
++ png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
+
+ if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
+- png_memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
++ memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
+ }
+
+ if (trans_color != NULL)
+@@ -891,16 +976,15 @@
+ int sample_max = (1 << info_ptr->bit_depth);
+
+ if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+- (int)trans_color->gray > sample_max) ||
++ trans_color->gray > sample_max) ||
+ (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+- ((int)trans_color->red > sample_max ||
+- (int)trans_color->green > sample_max ||
+- (int)trans_color->blue > sample_max)))
++ (trans_color->red > sample_max ||
++ trans_color->green > sample_max ||
++ trans_color->blue > sample_max)))
+ png_warning(png_ptr,
+ "tRNS chunk has out-of-range samples for bit_depth");
+
+- png_memcpy(&(info_ptr->trans_color), trans_color,
+- png_sizeof(png_color_16));
++ info_ptr->trans_color = *trans_color;
+
+ if (num_trans == 0)
+ num_trans = 1;
+@@ -918,8 +1002,8 @@
+
+ #ifdef PNG_sPLT_SUPPORTED
+ void PNGAPI
+-png_set_sPLT(png_structp png_ptr,
+- png_infop info_ptr, png_const_sPLT_tp entries, int nentries)
++png_set_sPLT(png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)
+ /*
+ * entries - array of png_sPLT_t structures
+ * to be added to the list of palettes
+@@ -930,220 +1014,455 @@
+ */
+ {
+ png_sPLT_tp np;
+- int i;
+
+- if (png_ptr == NULL || info_ptr == NULL)
++ if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
+ return;
+
+- np = (png_sPLT_tp)png_malloc_warn(png_ptr,
+- (info_ptr->splt_palettes_num + nentries) *
+- (png_size_t)png_sizeof(png_sPLT_t));
++ /* Use the internal realloc function, which checks for all the possible
++ * overflows. Notice that the parameters are (int) and (size_t)
++ */
++ np = png_voidcast(png_sPLT_tp,png_realloc_array(png_ptr,
++ info_ptr->splt_palettes, info_ptr->splt_palettes_num, nentries,
++ sizeof *np));
+
+ if (np == NULL)
+ {
+- png_warning(png_ptr, "No memory for sPLT palettes");
++ /* Out of memory or too many chunks */
++ png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
+ return;
+ }
+
+- png_memcpy(np, info_ptr->splt_palettes,
+- info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t));
++ png_free(png_ptr, info_ptr->splt_palettes);
++ info_ptr->splt_palettes = np;
++ info_ptr->free_me |= PNG_FREE_SPLT;
+
+- png_free(png_ptr, info_ptr->splt_palettes);
+- info_ptr->splt_palettes=NULL;
++ np += info_ptr->splt_palettes_num;
+
+- for (i = 0; i < nentries; i++)
++ do
+ {
+- png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
+- png_const_sPLT_tp from = entries + i;
+- png_uint_32 length;
++ png_size_t length;
+
+- length = png_strlen(from->name) + 1;
+- to->name = (png_charp)png_malloc_warn(png_ptr, (png_size_t)length);
+-
+- if (to->name == NULL)
++ /* Skip invalid input entries */
++ if (entries->name == NULL || entries->entries == NULL)
+ {
+- png_warning(png_ptr,
+- "Out of memory while processing sPLT chunk");
++ /* png_handle_sPLT doesn't do this, so this is an app error */
++ png_app_error(png_ptr, "png_set_sPLT: invalid sPLT");
++ /* Just skip the invalid entry */
+ continue;
+ }
+
+- png_memcpy(to->name, from->name, length);
+- to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
+- (png_size_t)(from->nentries * png_sizeof(png_sPLT_entry)));
++ np->depth = entries->depth;
+
+- if (to->entries == NULL)
++ /* In the event of out-of-memory just return - there's no point keeping
++ * on trying to add sPLT chunks.
++ */
++ length = strlen(entries->name) + 1;
++ np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
++
++ if (np->name == NULL)
++ break;
++
++ memcpy(np->name, entries->name, length);
++
++ /* IMPORTANT: we have memory now that won't get freed if something else
++ * goes wrong; this code must free it. png_malloc_array produces no
++ * warnings; use a png_chunk_report (below) if there is an error.
++ */
++ np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
++ entries->nentries, sizeof (png_sPLT_entry)));
++
++ if (np->entries == NULL)
+ {
+- png_warning(png_ptr,
+- "Out of memory while processing sPLT chunk");
+- png_free(png_ptr, to->name);
+- to->name = NULL;
+- continue;
++ png_free(png_ptr, np->name);
++ np->name = NULL;
++ break;
+ }
+
+- png_memcpy(to->entries, from->entries,
+- from->nentries * png_sizeof(png_sPLT_entry));
++ np->nentries = entries->nentries;
++ /* This multiply can't overflow because png_malloc_array has already
++ * checked it when doing the allocation.
++ */
++ memcpy(np->entries, entries->entries,
++ entries->nentries * sizeof (png_sPLT_entry));
+
+- to->nentries = from->nentries;
+- to->depth = from->depth;
++ /* Note that 'continue' skips the advance of the out pointer and out
++ * count, so an invalid entry is not added.
++ */
++ info_ptr->valid |= PNG_INFO_sPLT;
++ ++(info_ptr->splt_palettes_num);
++ ++np;
++ }
++ while (++entries, --nentries);
++
++ if (nentries > 0)
++ png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
++}
++#endif /* sPLT */
++
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++static png_byte
++check_location(png_const_structrp png_ptr, int location)
++{
++ location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
++
++ /* New in 1.6.0; copy the location and check it. This is an API
++ * change; previously the app had to use the
++ * png_set_unknown_chunk_location API below for each chunk.
++ */
++ if (location == 0 && (png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
++ {
++ /* Write struct, so unknown chunks come from the app */
++ png_app_warning(png_ptr,
++ "png_set_unknown_chunks now expects a valid location");
++ /* Use the old behavior */
++ location = (png_byte)(png_ptr->mode &
++ (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT));
+ }
+
+- info_ptr->splt_palettes = np;
+- info_ptr->splt_palettes_num += nentries;
+- info_ptr->valid |= PNG_INFO_sPLT;
+- info_ptr->free_me |= PNG_FREE_SPLT;
++ /* This need not be an internal error - if the app calls
++ * png_set_unknown_chunks on a read pointer it must get the location right.
++ */
++ if (location == 0)
++ png_error(png_ptr, "invalid location in png_set_unknown_chunks");
++
++ /* Now reduce the location to the top-most set bit by removing each least
++ * significant bit in turn.
++ */
++ while (location != (location & -location))
++ location &= ~(location & -location);
++
++ /* The cast is safe because 'location' is a bit mask and only the low four
++ * bits are significant.
++ */
++ return (png_byte)location;
+ }
+-#endif /* PNG_sPLT_SUPPORTED */
+
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+ void PNGAPI
+-png_set_unknown_chunks(png_structp png_ptr,
+- png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
++png_set_unknown_chunks(png_const_structrp png_ptr,
++ png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
+ {
+ png_unknown_chunkp np;
+- int i;
+
+- if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
++ if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
++ unknowns == NULL)
+ return;
+
+- np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
+- (png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) *
+- png_sizeof(png_unknown_chunk));
++ /* Check for the failure cases where support has been disabled at compile
++ * time. This code is hardly ever compiled - it's here because
++ * STORE_UNKNOWN_CHUNKS is set by both read and write code (compiling in this
++ * code) but may be meaningless if the read or write handling of unknown
++ * chunks is not compiled in.
++ */
++# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
++ defined(PNG_READ_SUPPORTED)
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
++ {
++ png_app_error(png_ptr, "no unknown chunk support on read");
++ return;
++ }
++# endif
++# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
++ defined(PNG_WRITE_SUPPORTED)
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
++ {
++ png_app_error(png_ptr, "no unknown chunk support on write");
++ return;
++ }
++# endif
++
++ /* Prior to 1.6.0 this code used png_malloc_warn; however, this meant that
++ * unknown critical chunks could be lost with just a warning resulting in
++ * undefined behavior. Now png_chunk_report is used to provide behavior
++ * appropriate to read or write.
++ */
++ np = png_voidcast(png_unknown_chunkp, png_realloc_array(png_ptr,
++ info_ptr->unknown_chunks, info_ptr->unknown_chunks_num, num_unknowns,
++ sizeof *np));
+
+ if (np == NULL)
+ {
+- png_warning(png_ptr,
+- "Out of memory while processing unknown chunk");
++ png_chunk_report(png_ptr, "too many unknown chunks",
++ PNG_CHUNK_WRITE_ERROR);
+ return;
+ }
+
+- png_memcpy(np, info_ptr->unknown_chunks,
+- (png_size_t)info_ptr->unknown_chunks_num *
+- png_sizeof(png_unknown_chunk));
++ png_free(png_ptr, info_ptr->unknown_chunks);
++ info_ptr->unknown_chunks = np; /* safe because it is initialized */
++ info_ptr->free_me |= PNG_FREE_UNKN;
+
+- png_free(png_ptr, info_ptr->unknown_chunks);
+- info_ptr->unknown_chunks = NULL;
++ np += info_ptr->unknown_chunks_num;
+
+- for (i = 0; i < num_unknowns; i++)
++ /* Increment unknown_chunks_num each time round the loop to protect the
++ * just-allocated chunk data.
++ */
++ for (; num_unknowns > 0; --num_unknowns, ++unknowns)
+ {
+- png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
+- png_const_unknown_chunkp from = unknowns + i;
++ memcpy(np->name, unknowns->name, (sizeof np->name));
++ np->name[(sizeof np->name)-1] = '\0';
++ np->location = check_location(png_ptr, unknowns->location);
+
+- png_memcpy(to->name, from->name, png_sizeof(from->name));
+- to->name[png_sizeof(to->name)-1] = '\0';
+- to->size = from->size;
+-
+- /* Note our location in the read or write sequence */
+- to->location = (png_byte)(png_ptr->mode & 0xff);
+-
+- if (from->size == 0)
+- to->data=NULL;
++ if (unknowns->size == 0)
++ {
++ np->data = NULL;
++ np->size = 0;
++ }
+
+ else
+ {
+- to->data = (png_bytep)png_malloc_warn(png_ptr,
+- (png_size_t)from->size);
++ np->data = png_voidcast(png_bytep,
++ png_malloc_base(png_ptr, unknowns->size));
+
+- if (to->data == NULL)
++ if (np->data == NULL)
+ {
+- png_warning(png_ptr,
+- "Out of memory while processing unknown chunk");
+- to->size = 0;
++ png_chunk_report(png_ptr, "unknown chunk: out of memory",
++ PNG_CHUNK_WRITE_ERROR);
++ /* But just skip storing the unknown chunk */
++ continue;
+ }
+
+- else
+- png_memcpy(to->data, from->data, from->size);
++ memcpy(np->data, unknowns->data, unknowns->size);
++ np->size = unknowns->size;
+ }
++
++ /* These increments are skipped on out-of-memory for the data - the
++ * unknown chunk entry gets overwritten if the png_chunk_report returns.
++ * This is correct in the read case (the chunk is just dropped.)
++ */
++ ++np;
++ ++(info_ptr->unknown_chunks_num);
+ }
+-
+- info_ptr->unknown_chunks = np;
+- info_ptr->unknown_chunks_num += num_unknowns;
+- info_ptr->free_me |= PNG_FREE_UNKN;
+ }
+
+ void PNGAPI
+-png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
++png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
+ int chunk, int location)
+ {
+- if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
+- info_ptr->unknown_chunks_num)
+- info_ptr->unknown_chunks[chunk].location = (png_byte)location;
++ /* This API is pretty pointless in 1.6.0 because the location can be set
++ * before the call to png_set_unknown_chunks.
++ *
++ * TODO: add a png_app_warning in 1.7
++ */
++ if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 &&
++ chunk < info_ptr->unknown_chunks_num)
++ {
++ if ((location & (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT)) == 0)
++ {
++ png_app_error(png_ptr, "invalid unknown chunk location");
++ /* Fake out the pre 1.6.0 behavior: */
++ if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
++ location = PNG_AFTER_IDAT;
++
++ else
++ location = PNG_HAVE_IHDR; /* also undocumented */
++ }
++
++ info_ptr->unknown_chunks[chunk].location =
++ check_location(png_ptr, location);
++ }
+ }
+ #endif
+
+
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+ png_uint_32 PNGAPI
+-png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
++png_permit_mng_features (png_structrp png_ptr, png_uint_32 mng_features)
+ {
+ png_debug(1, "in png_permit_mng_features");
+
+ if (png_ptr == NULL)
+- return (png_uint_32)0;
++ return 0;
+
+- png_ptr->mng_features_permitted =
+- (png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
++ png_ptr->mng_features_permitted = mng_features & PNG_ALL_MNG_FEATURES;
+
+- return (png_uint_32)png_ptr->mng_features_permitted;
++ return png_ptr->mng_features_permitted;
+ }
+ #endif
+
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
++static unsigned int
++add_one_chunk(png_bytep list, unsigned int count, png_const_bytep add, int keep)
++{
++ unsigned int i;
++
++ /* Utility function: update the 'keep' state of a chunk if it is already in
++ * the list, otherwise add it to the list.
++ */
++ for (i=0; i<count; ++i, list += 5)
++ {
++ if (memcmp(list, add, 4) == 0)
++ {
++ list[4] = (png_byte)keep;
++ return count;
++ }
++ }
++
++ if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
++ {
++ ++count;
++ memcpy(list, add, 4);
++ list[4] = (png_byte)keep;
++ }
++
++ return count;
++}
++
+ void PNGAPI
+-png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_const_bytep
+- chunk_list, int num_chunks)
++png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
++ png_const_bytep chunk_list, int num_chunks_in)
+ {
+- png_bytep new_list, p;
+- int i, old_num_chunks;
++ png_bytep new_list;
++ unsigned int num_chunks, old_num_chunks;
++
+ if (png_ptr == NULL)
+ return;
+
+- if (num_chunks == 0)
++ if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
+ {
+- if (keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE)
+- png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
+-
+- else
+- png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
+-
+- if (keep == PNG_HANDLE_CHUNK_ALWAYS)
+- png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS;
+-
+- else
+- png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS;
+-
++ png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
+ return;
+ }
+
+- if (chunk_list == NULL)
+- return;
++ if (num_chunks_in <= 0)
++ {
++ png_ptr->unknown_default = keep;
++
++ /* '0' means just set the flags, so stop here */
++ if (num_chunks_in == 0)
++ return;
++ }
++
++ if (num_chunks_in < 0)
++ {
++ /* Ignore all unknown chunks and all chunks recognized by
++ * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND
++ */
++ static PNG_CONST png_byte chunks_to_ignore[] = {
++ 98, 75, 71, 68, '\0', /* bKGD */
++ 99, 72, 82, 77, '\0', /* cHRM */
++ 103, 65, 77, 65, '\0', /* gAMA */
++ 104, 73, 83, 84, '\0', /* hIST */
++ 105, 67, 67, 80, '\0', /* iCCP */
++ 105, 84, 88, 116, '\0', /* iTXt */
++ 111, 70, 70, 115, '\0', /* oFFs */
++ 112, 67, 65, 76, '\0', /* pCAL */
++ 112, 72, 89, 115, '\0', /* pHYs */
++ 115, 66, 73, 84, '\0', /* sBIT */
++ 115, 67, 65, 76, '\0', /* sCAL */
++ 115, 80, 76, 84, '\0', /* sPLT */
++ 115, 84, 69, 82, '\0', /* sTER */
++ 115, 82, 71, 66, '\0', /* sRGB */
++ 116, 69, 88, 116, '\0', /* tEXt */
++ 116, 73, 77, 69, '\0', /* tIME */
++ 122, 84, 88, 116, '\0' /* zTXt */
++ };
++
++ chunk_list = chunks_to_ignore;
++ num_chunks = (unsigned int)/*SAFE*/(sizeof chunks_to_ignore)/5U;
++ }
++
++ else /* num_chunks_in > 0 */
++ {
++ if (chunk_list == NULL)
++ {
++ /* Prior to 1.6.0 this was silently ignored, now it is an app_error
++ * which can be switched off.
++ */
++ png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
++ return;
++ }
++
++ num_chunks = num_chunks_in;
++ }
+
+ old_num_chunks = png_ptr->num_chunk_list;
+- new_list=(png_bytep)png_malloc(png_ptr,
+- (png_size_t)(5*(num_chunks + old_num_chunks)));
++ if (png_ptr->chunk_list == NULL)
++ old_num_chunks = 0;
+
+- if (png_ptr->chunk_list != NULL)
++ /* Since num_chunks is always restricted to UINT_MAX/5 this can't overflow.
++ */
++ if (num_chunks + old_num_chunks > UINT_MAX/5)
+ {
+- png_memcpy(new_list, png_ptr->chunk_list,
+- (png_size_t)(5*old_num_chunks));
+- png_free(png_ptr, png_ptr->chunk_list);
+- png_ptr->chunk_list=NULL;
++ png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
++ return;
+ }
+
+- png_memcpy(new_list + 5*old_num_chunks, chunk_list,
+- (png_size_t)(5*num_chunks));
++ /* If these chunks are being reset to the default then no more memory is
++ * required because add_one_chunk above doesn't extend the list if the 'keep'
++ * parameter is the default.
++ */
++ if (keep != 0)
++ {
++ new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
++ 5 * (num_chunks + old_num_chunks)));
+
+- for (p = new_list + 5*old_num_chunks + 4, i = 0; i<num_chunks; i++, p += 5)
+- *p=(png_byte)keep;
++ if (old_num_chunks > 0)
++ memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
++ }
+
+- png_ptr->num_chunk_list = old_num_chunks + num_chunks;
+- png_ptr->chunk_list = new_list;
+- png_ptr->free_me |= PNG_FREE_LIST;
++ else if (old_num_chunks > 0)
++ new_list = png_ptr->chunk_list;
++
++ else
++ new_list = NULL;
++
++ /* Add the new chunks together with each one's handling code. If the chunk
++ * already exists the code is updated, otherwise the chunk is added to the
++ * end. (In libpng 1.6.0 order no longer matters because this code enforces
++ * the earlier convention that the last setting is the one that is used.)
++ */
++ if (new_list != NULL)
++ {
++ png_const_bytep inlist;
++ png_bytep outlist;
++ unsigned int i;
++
++ for (i=0; i<num_chunks; ++i)
++ {
++ old_num_chunks = add_one_chunk(new_list, old_num_chunks,
++ chunk_list+5*i, keep);
++ }
++
++ /* Now remove any spurious 'default' entries. */
++ num_chunks = 0;
++ for (i=0, inlist=outlist=new_list; i<old_num_chunks; ++i, inlist += 5)
++ {
++ if (inlist[4])
++ {
++ if (outlist != inlist)
++ memcpy(outlist, inlist, 5);
++ outlist += 5;
++ ++num_chunks;
++ }
++ }
++
++ /* This means the application has removed all the specialized handling. */
++ if (num_chunks == 0)
++ {
++ if (png_ptr->chunk_list != new_list)
++ png_free(png_ptr, new_list);
++
++ new_list = NULL;
++ }
++ }
++
++ else
++ num_chunks = 0;
++
++ png_ptr->num_chunk_list = num_chunks;
++
++ if (png_ptr->chunk_list != new_list)
++ {
++ if (png_ptr->chunk_list != NULL)
++ png_free(png_ptr, png_ptr->chunk_list);
++
++ png_ptr->chunk_list = new_list;
++ }
+ }
+ #endif
+
+ #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+ void PNGAPI
+-png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
++png_set_read_user_chunk_fn(png_structrp png_ptr, png_voidp user_chunk_ptr,
+ png_user_chunk_ptr read_user_chunk_fn)
+ {
+ png_debug(1, "in png_set_read_user_chunk_fn");
+@@ -1158,64 +1477,90 @@
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ void PNGAPI
+-png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
++png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
++ png_bytepp row_pointers)
+ {
+ png_debug1(1, "in %s storage function", "rows");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+- if (info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers))
++ if (info_ptr->row_pointers != NULL &&
++ (info_ptr->row_pointers != row_pointers))
+ png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
+
+ info_ptr->row_pointers = row_pointers;
+
+- if (row_pointers)
++ if (row_pointers != NULL)
+ info_ptr->valid |= PNG_INFO_IDAT;
+ }
+ #endif
+
+ void PNGAPI
+-png_set_compression_buffer_size(png_structp png_ptr, png_size_t size)
++png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
+ {
+ if (png_ptr == NULL)
+ return;
+
+- png_free(png_ptr, png_ptr->zbuf);
++ if (size == 0 || size > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid compression buffer size");
+
+- if (size > ZLIB_IO_MAX)
+- {
+- png_warning(png_ptr, "Attempt to set buffer size beyond max ignored");
+- png_ptr->zbuf_size = ZLIB_IO_MAX;
+- size = ZLIB_IO_MAX; /* must fit */
+- }
++# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
++ {
++ png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
++ return;
++ }
++# endif
+
+- else
+- png_ptr->zbuf_size = (uInt)size;
++# ifdef PNG_WRITE_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
++ {
++ if (png_ptr->zowner != 0)
++ {
++ png_warning(png_ptr,
++ "Compression buffer size cannot be changed because it is in use");
++ return;
++ }
+
+- png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
++ if (size > ZLIB_IO_MAX)
++ {
++ png_warning(png_ptr,
++ "Compression buffer size limited to system maximum");
++ size = ZLIB_IO_MAX; /* must fit */
++ }
+
+- /* The following ensures a relatively safe failure if this gets called while
+- * the buffer is actually in use.
+- */
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = 0;
+- png_ptr->zstream.avail_in = 0;
++ else if (size < 6)
++ {
++ /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
++ * if this is permitted.
++ */
++ png_warning(png_ptr,
++ "Compression buffer size cannot be reduced below 6");
++ return;
++ }
++
++ if (png_ptr->zbuffer_size != size)
++ {
++ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
++ png_ptr->zbuffer_size = (uInt)size;
++ }
++ }
++# endif
+ }
+
+ void PNGAPI
+-png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
++png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
+ {
+- if (png_ptr && info_ptr)
++ if (png_ptr != NULL && info_ptr != NULL)
+ info_ptr->valid &= ~mask;
+ }
+
+
+-
+ #ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ /* This function was added to libpng 1.2.6 */
+ void PNGAPI
+-png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
++png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
+ png_uint_32 user_height_max)
+ {
+ /* Images with dimensions larger than these limits will be
+@@ -1231,35 +1576,64 @@
+
+ /* This function was added to libpng 1.4.0 */
+ void PNGAPI
+-png_set_chunk_cache_max (png_structp png_ptr,
+- png_uint_32 user_chunk_cache_max)
++png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
+ {
+- if (png_ptr)
++ if (png_ptr != NULL)
+ png_ptr->user_chunk_cache_max = user_chunk_cache_max;
+ }
+
+ /* This function was added to libpng 1.4.1 */
+ void PNGAPI
+-png_set_chunk_malloc_max (png_structp png_ptr,
++png_set_chunk_malloc_max (png_structrp png_ptr,
+ png_alloc_size_t user_chunk_malloc_max)
+ {
+- if (png_ptr)
++ if (png_ptr != NULL)
+ png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
+ }
+-#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
++#endif /* ?SET_USER_LIMITS */
+
+
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ void PNGAPI
+-png_set_benign_errors(png_structp png_ptr, int allowed)
++png_set_benign_errors(png_structrp png_ptr, int allowed)
+ {
+ png_debug(1, "in png_set_benign_errors");
+
+- if (allowed)
+- png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
++ /* If allowed is 1, png_benign_error() is treated as a warning.
++ *
++ * If allowed is 0, png_benign_error() is treated as an error (which
++ * is the default behavior if png_set_benign_errors() is not called).
++ */
++
++ if (allowed != 0)
++ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
++ PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
+
+ else
+- png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
++ png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
++ PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
+ }
+-#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
+-#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
++#endif /* BENIGN_ERRORS */
++
++#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ /* Whether to report invalid palette index; added at libng-1.5.10.
++ * It is possible for an indexed (color-type==3) PNG file to contain
++ * pixels with invalid (out-of-range) indexes if the PLTE chunk has
++ * fewer entries than the image's bit-depth would allow. We recover
++ * from this gracefully by filling any incomplete palette with zeros
++ * (opaque black). By default, when this occurs libpng will issue
++ * a benign error. This API can be used to override that behavior.
++ */
++void PNGAPI
++png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
++{
++ png_debug(1, "in png_set_check_for_invalid_index");
++
++ if (allowed > 0)
++ png_ptr->num_palette_max = 0;
++
++ else
++ png_ptr->num_palette_max = -1;
++}
++#endif
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngstruct.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngstruct.h Fri Apr 10 09:21:28 2015 -0700
+@@ -29,11 +29,11 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
++ * Last changed in libpng 1.6.1 [March 28, 2013]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+@@ -52,13 +52,130 @@
+ * in this structure and is required for decompressing the LZ compressed
+ * data in PNG files.
+ */
++#ifndef ZLIB_CONST
++ /* We must ensure that zlib uses 'const' in declarations. */
++# define ZLIB_CONST
++#endif
+ #include "zlib.h"
++#ifdef const
++ /* zlib.h sometimes #defines const to nothing, undo this. */
++# undef const
++#endif
++
++/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
++ * with older builds.
++ */
++#if ZLIB_VERNUM < 0x1260
++# define PNGZ_MSG_CAST(s) png_constcast(char*,s)
++# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
++#else
++# define PNGZ_MSG_CAST(s) (s)
++# define PNGZ_INPUT_CAST(b) (b)
++#endif
++
++/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
++ * can handle at once. This type need be no larger than 16 bits (so maximum of
++ * 65535), this define allows us to discover how big it is, but limited by the
++ * maximuum for png_size_t. The value can be overriden in a library build
++ * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
++ * lower value (e.g. 255 works). A lower value may help memory usage (slightly)
++ * and may even improve performance on some systems (and degrade it on others.)
++ */
++#ifndef ZLIB_IO_MAX
++# define ZLIB_IO_MAX ((uInt)-1)
++#endif
++
++#ifdef PNG_WRITE_SUPPORTED
++/* The type of a compression buffer list used by the write code. */
++typedef struct png_compression_buffer
++{
++ struct png_compression_buffer *next;
++ png_byte output[1]; /* actually zbuf_size */
++} png_compression_buffer, *png_compression_bufferp;
++
++#define PNG_COMPRESSION_BUFFER_SIZE(pp)\
++ (offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
++#endif
++
++/* Colorspace support; structures used in png_struct, png_info and in internal
++ * functions to hold and communicate information about the color space.
++ *
++ * PNG_COLORSPACE_SUPPORTED is only required if the application will perform
++ * colorspace corrections, otherwise all the colorspace information can be
++ * skipped and the size of libpng can be reduced (significantly) by compiling
++ * out the colorspace support.
++ */
++#ifdef PNG_COLORSPACE_SUPPORTED
++/* The chromaticities of the red, green and blue colorants and the chromaticity
++ * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
++ */
++typedef struct png_xy
++{
++ png_fixed_point redx, redy;
++ png_fixed_point greenx, greeny;
++ png_fixed_point bluex, bluey;
++ png_fixed_point whitex, whitey;
++} png_xy;
++
++/* The same data as above but encoded as CIE XYZ values. When this data comes
++ * from chromaticities the sum of the Y values is assumed to be 1.0
++ */
++typedef struct png_XYZ
++{
++ png_fixed_point red_X, red_Y, red_Z;
++ png_fixed_point green_X, green_Y, green_Z;
++ png_fixed_point blue_X, blue_Y, blue_Z;
++} png_XYZ;
++#endif /* COLORSPACE */
++
++#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
++/* A colorspace is all the above plus, potentially, profile information,
++ * however at present libpng does not use the profile internally so it is only
++ * stored in the png_info struct (if iCCP is supported.) The rendering intent
++ * is retained here and is checked.
++ *
++ * The file gamma encoding information is also stored here and gamma correction
++ * is done by libpng, whereas color correction must currently be done by the
++ * application.
++ */
++typedef struct png_colorspace
++{
++#ifdef PNG_GAMMA_SUPPORTED
++ png_fixed_point gamma; /* File gamma */
++#endif
++
++#ifdef PNG_COLORSPACE_SUPPORTED
++ png_xy end_points_xy; /* End points as chromaticities */
++ png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */
++ png_uint_16 rendering_intent; /* Rendering intent of a profile */
++#endif
++
++ /* Flags are always defined to simplify the code. */
++ png_uint_16 flags; /* As defined below */
++} png_colorspace, * PNG_RESTRICT png_colorspacerp;
++
++typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
++
++/* General flags for the 'flags' field */
++#define PNG_COLORSPACE_HAVE_GAMMA 0x0001
++#define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002
++#define PNG_COLORSPACE_HAVE_INTENT 0x0004
++#define PNG_COLORSPACE_FROM_gAMA 0x0008
++#define PNG_COLORSPACE_FROM_cHRM 0x0010
++#define PNG_COLORSPACE_FROM_sRGB 0x0020
++#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
++#define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
++#define PNG_COLORSPACE_INVALID 0x8000
++#define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
++#endif /* COLORSPACE || GAMMA */
+
+ struct png_struct_def
+ {
+ #ifdef PNG_SETJMP_SUPPORTED
+- jmp_buf longjmp_buffer; /* used in png_error */
++ jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
+ png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
++ jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
++ size_t jmp_buf_size; /* size of the above, if allocated */
+ #endif
+ png_error_ptr error_fn; /* function for printing errors and aborting */
+ #ifdef PNG_WARNINGS_SUPPORTED
+@@ -91,22 +208,12 @@
+ png_uint_32 flags; /* flags indicating various things to libpng */
+ png_uint_32 transformations; /* which transformations to perform */
+
+- z_stream zstream; /* pointer to decompression structure (below) */
+- png_bytep zbuf; /* buffer for zlib */
+- uInt zbuf_size; /* size of zbuf (typically 65536) */
++ png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
++ z_stream zstream; /* decompression structure */
++
+ #ifdef PNG_WRITE_SUPPORTED
+-
+-/* Added in 1.5.4: state to keep track of whether the zstream has been
+- * initialized and if so whether it is for IDAT or some other chunk.
+- */
+-#define PNG_ZLIB_UNINITIALIZED 0
+-#define PNG_ZLIB_FOR_IDAT 1
+-#define PNG_ZLIB_FOR_TEXT 2 /* anything other than IDAT */
+-#define PNG_ZLIB_USE_MASK 3 /* bottom two bits */
+-#define PNG_ZLIB_IN_USE 4 /* a flag value */
+-
+- png_uint_32 zlib_state; /* State of zlib initialization */
+-/* End of material added at libpng 1.5.4 */
++ png_compression_bufferp zbuffer_list; /* Created on demand during write */
++ uInt zbuffer_size; /* size of the actual buffer */
+
+ int zlib_level; /* holds zlib compression level */
+ int zlib_method; /* holds zlib compression method */
+@@ -115,8 +222,7 @@
+ int zlib_strategy; /* holds zlib compression strategy */
+ #endif
+ /* Added at libpng 1.5.4 */
+-#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
+- defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
++#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
+ int zlib_text_level; /* holds zlib compression level */
+ int zlib_text_method; /* holds zlib compression method */
+ int zlib_text_window_bits; /* holds zlib compression window bits */
+@@ -124,6 +230,14 @@
+ int zlib_text_strategy; /* holds zlib compression strategy */
+ #endif
+ /* End of material added at libpng 1.5.4 */
++/* Added at libpng 1.6.0 */
++#ifdef PNG_WRITE_SUPPORTED
++ int zlib_set_level; /* Actual values set into the zstream on write */
++ int zlib_set_method;
++ int zlib_set_window_bits;
++ int zlib_set_mem_level;
++ int zlib_set_strategy;
++#endif
+
+ png_uint_32 width; /* width of image in pixels */
+ png_uint_32 height; /* height of image in pixels */
+@@ -132,21 +246,32 @@
+ png_size_t rowbytes; /* size of row in bytes */
+ png_uint_32 iwidth; /* width of current interlaced row in pixels */
+ png_uint_32 row_number; /* current row in interlace pass */
+- png_bytep prev_row; /* buffer to save previous (unfiltered) row */
+- png_bytep row_buf; /* buffer to save current (unfiltered) row */
++ png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
++ png_bytep prev_row; /* buffer to save previous (unfiltered) row.
++ * This is a pointer into big_prev_row
++ */
++ png_bytep row_buf; /* buffer to save current (unfiltered) row.
++ * This is a pointer into big_row_buf
++ */
++#ifdef PNG_WRITE_SUPPORTED
+ png_bytep sub_row; /* buffer to save "sub" row when filtering */
+ png_bytep up_row; /* buffer to save "up" row when filtering */
+ png_bytep avg_row; /* buffer to save "avg" row when filtering */
+ png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
+- png_row_info row_info; /* used for transformation routines */
++#endif
+ png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
+
+ png_uint_32 idat_size; /* current IDAT size for read */
+ png_uint_32 crc; /* current chunk CRC value */
+ png_colorp palette; /* palette from the input file */
+ png_uint_16 num_palette; /* number of color entries in palette */
++
++/* Added at libpng-1.5.10 */
++#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ int num_palette_max; /* maximum palette index found in IDAT */
++#endif
++
+ png_uint_16 num_trans; /* number of transparency values */
+- png_byte chunk_name[5]; /* null-terminated name of current chunk */
+ png_byte compression; /* file compression type (always 0) */
+ png_byte filter; /* file filter type (always 0) */
+ png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+@@ -154,12 +279,17 @@
+ png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
+ png_byte color_type; /* color type of file */
+ png_byte bit_depth; /* bit depth of file */
+- png_byte usr_bit_depth; /* bit depth of users row */
++ png_byte usr_bit_depth; /* bit depth of users row: write only */
+ png_byte pixel_depth; /* number of bits per pixel */
+ png_byte channels; /* number of channels in file */
+- png_byte usr_channels; /* channels at start of write */
++#ifdef PNG_WRITE_SUPPORTED
++ png_byte usr_channels; /* channels at start of write: write only */
++#endif
+ png_byte sig_bytes; /* magic bytes read/written from start of file */
+-
++ png_byte maximum_pixel_depth;
++ /* pixel depth used for the row buffers */
++ png_byte transformed_pixel_depth;
++ /* pixel depth after read/write transforms */
+ #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
+ png_uint_16 filler; /* filler bytes for pixel expansion */
+ #endif
+@@ -172,7 +302,7 @@
+ #ifdef PNG_READ_GAMMA_SUPPORTED
+ png_color_16 background_1; /* background normalized to gamma 1.0 */
+ #endif
+-#endif /* PNG_bKGD_SUPPORTED */
++#endif /* bKGD */
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ png_flush_ptr output_flush_fn; /* Function for flushing output */
+@@ -180,19 +310,20 @@
+ png_uint_32 flush_rows; /* number of rows written since last flush */
+ #endif
+
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
++#ifdef PNG_READ_GAMMA_SUPPORTED
+ int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
+- png_fixed_point gamma; /* file gamma value */
+ png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
+-#endif
+
+-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+ png_bytep gamma_table; /* gamma table for 8-bit depth files */
++ png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
++#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
++ defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
++ defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+ png_bytep gamma_from_1; /* converts from 1.0 to screen */
+ png_bytep gamma_to_1; /* converts from file to 1.0 */
+- png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
+ png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
+ png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
++#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+ #endif
+
+ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
+@@ -228,14 +359,7 @@
+ int process_mode; /* what push library is currently doing */
+ int cur_palette; /* current push library palette index */
+
+-# ifdef PNG_TEXT_SUPPORTED
+- png_size_t current_text_size; /* current size of text input data */
+- png_size_t current_text_left; /* how much text left to read in input */
+- png_charp current_text; /* current text chunk buffer */
+- png_charp current_text_ptr; /* current location in current_text */
+-# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
+-
+-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PROGRESSIVE_READ */
+
+ #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
+ /* For the Borland special 64K segment handler */
+@@ -251,10 +375,6 @@
+ png_bytep quantize_index; /* index translation for palette files */
+ #endif
+
+-#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
+- png_uint_16p hist; /* histogram */
+-#endif
+-
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+ png_byte heuristic_method; /* heuristic for row filter selection */
+ png_byte num_prev_filters; /* number of weights for previous rows */
+@@ -265,9 +385,17 @@
+ png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
+ #endif
+
++ /* Options */
++#ifdef PNG_SET_OPTION_SUPPORTED
++ png_byte options; /* On/off state (up to 4 options) */
++#endif
++
++#if PNG_LIBPNG_VER < 10700
++/* To do: remove this from libpng-1.7 */
+ #ifdef PNG_TIME_RFC1123_SUPPORTED
+ char time_buffer[29]; /* String to hold RFC 1123 time text */
+ #endif
++#endif
+
+ /* New members added in libpng-1.0.6 */
+
+@@ -275,27 +403,31 @@
+
+ #ifdef PNG_USER_CHUNKS_SUPPORTED
+ png_voidp user_chunk_ptr;
++#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+ png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
+ #endif
++#endif
+
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- int num_chunk_list;
+- png_bytep chunk_list;
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ int unknown_default; /* As PNG_HANDLE_* */
++ unsigned int num_chunk_list; /* Number of entries in the list */
++ png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name
++ * followed by a PNG_HANDLE_* byte */
+ #endif
+
+ /* New members added in libpng-1.0.3 */
+ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ png_byte rgb_to_gray_status;
++ /* Added in libpng 1.5.5 to record setting of coefficients: */
++ png_byte rgb_to_gray_coefficients_set;
+ /* These were changed from png_byte in libpng-1.0.6 */
+ png_uint_16 rgb_to_gray_red_coeff;
+ png_uint_16 rgb_to_gray_green_coeff;
+- png_uint_16 rgb_to_gray_blue_coeff;
++ /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
+ #endif
+
+ /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
+-#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
+- defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
+- defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
++#if defined(PNG_MNG_FEATURES_SUPPORTED)
+ /* Changed from png_byte to png_uint_32 at version 1.2.0 */
+ png_uint_32 mng_features_permitted;
+ #endif
+@@ -345,21 +477,41 @@
+ #endif
+
+ /* New member added in libpng-1.0.25 and 1.2.17 */
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+- /* Storage for unknown chunk that the library doesn't recognize. */
++#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
++ /* Temporary storage for unknown chunk that the library doesn't recognize,
++ * used while reading the chunk.
++ */
+ png_unknown_chunk unknown_chunk;
+ #endif
+
+-/* New members added in libpng-1.2.26 */
++/* New member added in libpng-1.2.26 */
+ png_size_t old_big_row_buf_size;
+- png_size_t old_prev_row_size;
+
++#ifdef PNG_READ_SUPPORTED
+ /* New member added in libpng-1.2.30 */
+- png_charp chunkdata; /* buffer for reading chunk data */
++ png_bytep read_buffer; /* buffer for reading chunk data */
++ png_alloc_size_t read_buffer_size; /* current size of the buffer */
++#endif
++#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
++ uInt IDAT_read_size; /* limit on read buffer size for IDAT */
++#endif
+
+ #ifdef PNG_IO_STATE_SUPPORTED
+ /* New member added in libpng-1.4.0 */
+ png_uint_32 io_state;
+ #endif
++
++/* New member added in libpng-1.5.6 */
++ png_bytep big_prev_row;
++
++/* New member added in libpng-1.5.7 */
++ void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
++ png_bytep row, png_const_bytep prev_row);
++
++#ifdef PNG_READ_SUPPORTED
++#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
++ png_colorspace colorspace;
++#endif
++#endif
+ };
+ #endif /* PNGSTRUCT_H */
+--- ./jdk/src/share/native/sun/awt/libpng/pngtest.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngtest.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -61,16 +61,50 @@
+
+ #define _POSIX_SOURCE 1
+
+-#include "zlib.h"
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++/* Defined so I can write to a file on gui/windowing platforms */
++/* #define STDERR stderr */
++#define STDERR stdout /* For DOS */
++
+ #include "png.h"
++
++/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
++ * simply as a result of re-ordering them. This may be fixed in 1.7
++ *
++ * pngtest allocates a single row buffer for each row and overwrites it,
++ * therefore if the write side doesn't support the writing of interlaced images
++ * nothing can be done for an interlaced image (and the code below will fail
++ * horribly trying to write extra data after writing garbage).
++ */
++#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\
++ defined PNG_READ_bKGD_SUPPORTED &&\
++ defined PNG_READ_cHRM_SUPPORTED &&\
++ defined PNG_READ_gAMA_SUPPORTED &&\
++ defined PNG_READ_oFFs_SUPPORTED &&\
++ defined PNG_READ_pCAL_SUPPORTED &&\
++ defined PNG_READ_pHYs_SUPPORTED &&\
++ defined PNG_READ_sBIT_SUPPORTED &&\
++ defined PNG_READ_sCAL_SUPPORTED &&\
++ defined PNG_READ_sRGB_SUPPORTED &&\
++ defined PNG_READ_tEXt_SUPPORTED &&\
++ defined PNG_READ_tIME_SUPPORTED &&\
++ defined PNG_READ_zTXt_SUPPORTED &&\
++ defined PNG_WRITE_INTERLACING_SUPPORTED
++
++#ifdef PNG_ZLIB_HEADER
++# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
++#else
++# include "zlib.h"
++#endif
++
+ /* Copied from pngpriv.h but only used in error messages below. */
+ #ifndef PNG_ZBUF_SIZE
+ # define PNG_ZBUF_SIZE 8192
+ #endif
+-# include <stdio.h>
+-# include <stdlib.h>
+-# include <string.h>
+-# define FCLOSE(file) fclose(file)
++#define FCLOSE(file) fclose(file)
+
+ #ifndef PNG_STDIO_SUPPORTED
+ typedef FILE * png_FILE_p;
+@@ -95,17 +129,6 @@
+ # define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
+ #endif
+
+-/* The code uses memcmp and memcpy on large objects (typically row pointers) so
+- * it is necessary to do soemthing special on certain architectures, note that
+- * the actual support for this was effectively removed in 1.4, so only the
+- * memory remains in this program:
+- */
+-#define CVT_PTR(ptr) (ptr)
+-#define CVT_PTR_NOCHECK(ptr) (ptr)
+-#define png_memcmp memcmp
+-#define png_memcpy memcpy
+-#define png_memset memset
+-
+ /* Turn on CPU timing
+ #define PNGTEST_TIMING
+ */
+@@ -126,30 +149,34 @@
+ #endif
+
+ static int verbose = 0;
+-
+-int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
+-
+-#ifdef __TURBOC__
+-#include <mem.h>
+-#endif
+-
+-/* Defined so I can write to a file on gui/windowing platforms */
+-/* #define STDERR stderr */
+-#define STDERR stdout /* For DOS */
++static int strict = 0;
++static int relaxed = 0;
++static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */
++static int error_count = 0; /* count calls to png_error */
++static int warning_count = 0; /* count calls to png_warning */
+
+ /* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
+ #ifndef png_jmpbuf
+ # define png_jmpbuf(png_ptr) png_ptr->jmpbuf
+ #endif
+
++/* Defines for unknown chunk handling if required. */
++#ifndef PNG_HANDLE_CHUNK_ALWAYS
++# define PNG_HANDLE_CHUNK_ALWAYS 3
++#endif
++#ifndef PNG_HANDLE_CHUNK_IF_SAFE
++# define PNG_HANDLE_CHUNK_IF_SAFE 2
++#endif
++
++/* Utility to save typing/errors, the argument must be a name */
++#define MEMZERO(var) ((void)memset(&var, 0, sizeof var))
++
+ /* Example of using row callbacks to make a simple progress meter */
+ static int status_pass = 1;
+ static int status_dots_requested = 0;
+ static int status_dots = 1;
+
+-void PNGCBAPI
+-read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+-void PNGCBAPI
++static void PNGCBAPI
+ read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
+ {
+ if (png_ptr == NULL || row_number > PNG_UINT_31_MAX)
+@@ -173,9 +200,8 @@
+ fprintf(stdout, "r");
+ }
+
+-void PNGCBAPI
+-write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
+-void PNGCBAPI
++#ifdef PNG_WRITE_SUPPORTED
++static void PNGCBAPI
+ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
+ {
+ if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7)
+@@ -183,6 +209,7 @@
+
+ fprintf(stdout, "w");
+ }
++#endif
+
+
+ #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+@@ -191,9 +218,7 @@
+ * 5 in case illegal filter values are present.)
+ */
+ static png_uint_32 filters_used[256];
+-void PNGCBAPI
+-count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data);
+-void PNGCBAPI
++static void PNGCBAPI
+ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
+ {
+ if (png_ptr != NULL && row_info != NULL)
+@@ -208,9 +233,7 @@
+
+ static png_uint_32 zero_samples;
+
+-void PNGCBAPI
+-count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data);
+-void PNGCBAPI
++static void PNGCBAPI
+ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
+ {
+ png_bytep dp = data;
+@@ -288,7 +311,8 @@
+ png_uint_32 n, nstop;
+ int channel;
+ int color_channels = row_info->channels;
+- if (row_info->color_type > 3)color_channels--;
++ if (row_info->color_type > 3)
++ color_channels--;
+
+ for (n = 0, nstop=row_info->width; n<nstop; n++)
+ {
+@@ -315,9 +339,7 @@
+ }
+ }
+ }
+-#endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */
+-
+-static int wrote_question = 0;
++#endif /* WRITE_USER_TRANSFORM */
+
+ #ifndef PNG_STDIO_SUPPORTED
+ /* START of code to validate stdio-free compilation */
+@@ -366,12 +388,11 @@
+ default:
+ err = 1; /* uninitialized */
+ }
+- if (err)
++ if (err != 0)
+ png_error(png_ptr, "Bad I/O state or buffer size");
+ }
+ #endif
+
+-#ifndef USE_FAR_KEYWORD
+ static void PNGCBAPI
+ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+@@ -396,59 +417,6 @@
+ pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
+ #endif
+ }
+-#else
+-/* This is the model-independent version. Since the standard I/O library
+- can't handle far buffers in the medium and small models, we have to copy
+- the data.
+-*/
+-
+-#define NEAR_BUF_SIZE 1024
+-#define MIN(a,b) (a <= b ? a : b)
+-
+-static void PNGCBAPI
+-pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+-{
+- png_size_t check;
+- png_byte *n_data;
+- png_FILE_p io_ptr;
+-
+- /* Check if data really is near. If so, use usual code. */
+- n_data = (png_byte *)CVT_PTR_NOCHECK(data);
+- io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr));
+- if ((png_bytep)n_data == data)
+- {
+- check = fread(n_data, 1, length, io_ptr);
+- }
+- else
+- {
+- png_byte buf[NEAR_BUF_SIZE];
+- png_size_t read, remaining, err;
+- check = 0;
+- remaining = length;
+-
+- do
+- {
+- read = MIN(NEAR_BUF_SIZE, remaining);
+- err = fread(buf, 1, 1, io_ptr);
+- png_memcpy(data, buf, read); /* Copy far buffer to near buffer */
+- if (err != read)
+- break;
+- else
+- check += err;
+- data += read;
+- remaining -= read;
+- }
+- while (remaining != 0);
+- }
+-
+- if (check != length)
+- png_error(png_ptr, "Read Error");
+-
+-#ifdef PNG_IO_STATE_SUPPORTED
+- pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
+-#endif
+-}
+-#endif /* USE_FAR_KEYWORD */
+
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ static void PNGCBAPI
+@@ -464,7 +432,6 @@
+ * write_data function and use it at run time with png_set_write_fn(), rather
+ * than changing the library.
+ */
+-#ifndef USE_FAR_KEYWORD
+ static void PNGCBAPI
+ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+@@ -481,81 +448,31 @@
+ pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
+ #endif
+ }
+-#else
+-/* This is the model-independent version. Since the standard I/O library
+- can't handle far buffers in the medium and small models, we have to copy
+- the data.
+-*/
+-
+-#define NEAR_BUF_SIZE 1024
+-#define MIN(a,b) (a <= b ? a : b)
+-
+-static void PNGCBAPI
+-pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
+-{
+- png_size_t check;
+- png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
+- png_FILE_p io_ptr;
+-
+- /* Check if data really is near. If so, use usual code. */
+- near_data = (png_byte *)CVT_PTR_NOCHECK(data);
+- io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr));
+-
+- if ((png_bytep)near_data == data)
+- {
+- check = fwrite(near_data, 1, length, io_ptr);
+- }
+-
+- else
+- {
+- png_byte buf[NEAR_BUF_SIZE];
+- png_size_t written, remaining, err;
+- check = 0;
+- remaining = length;
+-
+- do
+- {
+- written = MIN(NEAR_BUF_SIZE, remaining);
+- png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
+- err = fwrite(buf, 1, written, io_ptr);
+- if (err != written)
+- break;
+- else
+- check += err;
+- data += written;
+- remaining -= written;
+- }
+- while (remaining != 0);
+- }
+-
+- if (check != length)
+- {
+- png_error(png_ptr, "Write Error");
+- }
+-
+-#ifdef PNG_IO_STATE_SUPPORTED
+- pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
+-#endif
+-}
+-#endif /* USE_FAR_KEYWORD */
++#endif /* !STDIO */
+
+ /* This function is called when there is a warning, but the library thinks
+ * it can continue anyway. Replacement functions don't have to do anything
+ * here if you don't want to. In the default configuration, png_ptr is
+ * not used, but it is passed in case it may be useful.
+ */
++typedef struct
++{
++ PNG_CONST char *file_name;
++} pngtest_error_parameters;
++
+ static void PNGCBAPI
+ pngtest_warning(png_structp png_ptr, png_const_charp message)
+ {
+ PNG_CONST char *name = "UNKNOWN (ERROR!)";
+- char *test;
+- test = png_get_error_ptr(png_ptr);
++ pngtest_error_parameters *test =
++ (pngtest_error_parameters*)png_get_error_ptr(png_ptr);
+
+- if (test == NULL)
+- fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
++ ++warning_count;
+
+- else
+- fprintf(STDERR, "%s: libpng warning: %s\n", test, message);
++ if (test != NULL && test->file_name != NULL)
++ name = test->file_name;
++
++ fprintf(STDERR, "%s: libpng warning: %s\n", name, message);
+ }
+
+ /* This is the default error handling function. Note that replacements for
+@@ -566,12 +483,14 @@
+ static void PNGCBAPI
+ pngtest_error(png_structp png_ptr, png_const_charp message)
+ {
++ ++error_count;
++
+ pngtest_warning(png_ptr, message);
+ /* We can return because png_error calls the default handler, which is
+ * actually OK in this case.
+ */
+ }
+-#endif /* !PNG_STDIO_SUPPORTED */
++
+ /* END of code to validate stdio-free compilation */
+
+ /* START of code to validate memory allocation and deallocation */
+@@ -590,9 +509,9 @@
+ {
+ png_alloc_size_t size;
+ png_voidp pointer;
+- struct memory_information FAR *next;
++ struct memory_information *next;
+ } memory_information;
+-typedef memory_information FAR *memory_infop;
++typedef memory_information *memory_infop;
+
+ static memory_infop pinformation = NULL;
+ static int current_allocation = 0;
+@@ -622,7 +541,7 @@
+ memory_infop pinfo;
+ png_set_mem_fn(png_ptr, NULL, NULL, NULL);
+ pinfo = (memory_infop)png_malloc(png_ptr,
+- png_sizeof(*pinfo));
++ (sizeof *pinfo));
+ pinfo->size = size;
+ current_allocation += size;
+ total_allocation += size;
+@@ -648,9 +567,9 @@
+ pinfo->next = pinformation;
+ pinformation = pinfo;
+ /* Make sure the caller isn't assuming zeroed memory. */
+- png_memset(pinfo->pointer, 0xdd, pinfo->size);
++ memset(pinfo->pointer, 0xdd, pinfo->size);
+
+- if (verbose)
++ if (verbose != 0)
+ printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
+ pinfo->pointer);
+
+@@ -675,7 +594,7 @@
+
+ /* Unlink the element from the list. */
+ {
+- memory_infop FAR *ppinfo = &pinformation;
++ memory_infop *ppinfo = &pinformation;
+
+ for (;;)
+ {
+@@ -689,15 +608,16 @@
+ fprintf(STDERR, "Duplicate free of memory\n");
+ /* We must free the list element too, but first kill
+ the memory that is to be freed. */
+- png_memset(ptr, 0x55, pinfo->size);
+- png_free_default(png_ptr, pinfo);
++ memset(ptr, 0x55, pinfo->size);
++ if (pinfo != NULL)
++ free(pinfo);
+ pinfo = NULL;
+ break;
+ }
+
+ if (pinfo->next == NULL)
+ {
+- fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr);
++ fprintf(STDERR, "Pointer %p not found\n", ptr);
+ break;
+ }
+
+@@ -706,35 +626,84 @@
+ }
+
+ /* Finally free the data. */
+- if (verbose)
++ if (verbose != 0)
+ printf("Freeing %p\n", ptr);
+
+- png_free_default(png_ptr, ptr);
++ if (ptr != NULL)
++ free(ptr);
+ ptr = NULL;
+ }
+-#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
++#endif /* USER_MEM && DEBUG */
+ /* END of code to test memory allocation/deallocation */
+
+
++#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
+ /* Demonstration of user chunk support of the sTER and vpAg chunks */
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+
+ /* (sTER is a public chunk not yet known by libpng. vpAg is a private
+ chunk used in ImageMagick to store "virtual page" size). */
+
+-static png_uint_32 user_chunk_data[4];
++static struct user_chunk_data
++{
++ png_const_infop info_ptr;
++ png_uint_32 vpAg_width, vpAg_height;
++ png_byte vpAg_units;
++ png_byte sTER_mode;
++ int location[2];
++}
++user_chunk_data;
+
+- /* 0: sTER mode + 1
+- * 1: vpAg width
+- * 2: vpAg height
+- * 3: vpAg units
+- */
++/* Used for location and order; zero means nothing. */
++#define have_sTER 0x01
++#define have_vpAg 0x02
++#define before_PLTE 0x10
++#define before_IDAT 0x20
++#define after_IDAT 0x40
+
+-static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
+- png_unknown_chunkp chunk)
++static void
++init_callback_info(png_const_infop info_ptr)
+ {
+- png_uint_32
+- *my_user_chunk_data;
++ MEMZERO(user_chunk_data);
++ user_chunk_data.info_ptr = info_ptr;
++}
++
++static int
++set_location(png_structp png_ptr, struct user_chunk_data *data, int what)
++{
++ int location;
++
++ if ((data->location[0] & what) != 0 || (data->location[1] & what) != 0)
++ return 0; /* already have one of these */
++
++ /* Find where we are (the code below zeroes info_ptr to indicate that the
++ * chunks before the first IDAT have been read.)
++ */
++ if (data->info_ptr == NULL) /* after IDAT */
++ location = what | after_IDAT;
++
++ else if (png_get_valid(png_ptr, data->info_ptr, PNG_INFO_PLTE) != 0)
++ location = what | before_IDAT;
++
++ else
++ location = what | before_PLTE;
++
++ if (data->location[0] == 0)
++ data->location[0] = location;
++
++ else
++ data->location[1] = location;
++
++ return 1; /* handled */
++}
++
++static int PNGCBAPI
++read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
++{
++ struct user_chunk_data *my_user_chunk_data =
++ (struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
++
++ if (my_user_chunk_data == NULL)
++ png_error(png_ptr, "lost user chunk pointer");
+
+ /* Return one of the following:
+ * return (-n); chunk had an error
+@@ -759,9 +728,14 @@
+ if (chunk->data[0] != 0 && chunk->data[0] != 1)
+ return (-1); /* Invalid mode */
+
+- my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
+- my_user_chunk_data[0]=chunk->data[0]+1;
+- return (1);
++ if (set_location(png_ptr, my_user_chunk_data, have_sTER) != 0)
++ {
++ my_user_chunk_data->sTER_mode=chunk->data[0];
++ return (1);
++ }
++
++ else
++ return (0); /* duplicate sTER - give it to libpng */
+ }
+
+ if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */
+@@ -773,30 +747,126 @@
+ if (chunk->size != 9)
+ return (-1); /* Error return */
+
+- my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
++ if (set_location(png_ptr, my_user_chunk_data, have_vpAg) == 0)
++ return (0); /* duplicate vpAg */
+
+- my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data);
+- my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4);
+- my_user_chunk_data[3]=(png_uint_32)chunk->data[8];
++ my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data);
++ my_user_chunk_data->vpAg_height = png_get_uint_31(png_ptr, chunk->data + 4);
++ my_user_chunk_data->vpAg_units = chunk->data[8];
+
+ return (1);
++}
+
++#ifdef PNG_WRITE_SUPPORTED
++static void
++write_sTER_chunk(png_structp write_ptr)
++{
++ png_byte sTER[5] = {115, 84, 69, 82, '\0'};
++
++ if (verbose != 0)
++ fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
++
++ png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
+ }
++
++static void
++write_vpAg_chunk(png_structp write_ptr)
++{
++ png_byte vpAg[5] = {118, 112, 65, 103, '\0'};
++
++ png_byte vpag_chunk_data[9];
++
++ if (verbose != 0)
++ fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
++ (unsigned long)user_chunk_data.vpAg_width,
++ (unsigned long)user_chunk_data.vpAg_height,
++ user_chunk_data.vpAg_units);
++
++ png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width);
++ png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height);
++ vpag_chunk_data[8] = user_chunk_data.vpAg_units;
++ png_write_chunk(write_ptr, vpAg, vpag_chunk_data, 9);
++}
++
++static void
++write_chunks(png_structp write_ptr, int location)
++{
++ int i;
++
++ /* Notice that this preserves the original chunk order, however chunks
++ * intercepted by the callback will be written *after* chunks passed to
++ * libpng. This will actually reverse a pair of sTER chunks or a pair of
++ * vpAg chunks, resulting in an error later. This is not worth worrying
++ * about - the chunks should not be duplicated!
++ */
++ for (i=0; i<2; ++i)
++ {
++ if (user_chunk_data.location[i] == (location | have_sTER))
++ write_sTER_chunk(write_ptr);
++
++ else if (user_chunk_data.location[i] == (location | have_vpAg))
++ write_vpAg_chunk(write_ptr);
++ }
++}
++#endif /* WRITE */
++#else /* !READ_USER_CHUNKS */
++# define write_chunks(pp,loc) ((void)0)
+ #endif
+ /* END of code to demonstrate user chunk support */
+
++/* START of code to check that libpng has the required text support; this only
++ * checks for the write support because if read support is missing the chunk
++ * will simply not be reported back to pngtest.
++ */
++#ifdef PNG_TEXT_SUPPORTED
++static void
++pngtest_check_text_support(png_const_structp png_ptr, png_textp text_ptr,
++ int num_text)
++{
++ while (num_text > 0)
++ {
++ switch (text_ptr[--num_text].compression)
++ {
++ case PNG_TEXT_COMPRESSION_NONE:
++ break;
++
++ case PNG_TEXT_COMPRESSION_zTXt:
++# ifndef PNG_WRITE_zTXt_SUPPORTED
++ ++unsupported_chunks;
++# endif
++ break;
++
++ case PNG_ITXT_COMPRESSION_NONE:
++ case PNG_ITXT_COMPRESSION_zTXt:
++# ifndef PNG_WRITE_iTXt_SUPPORTED
++ ++unsupported_chunks;
++# endif
++ break;
++
++ default:
++ /* This is an error */
++ png_error(png_ptr, "invalid text chunk compression field");
++ break;
++ }
++ }
++}
++#endif
++/* END of code to check that libpng has the required text support */
++
+ /* Test one file */
+-int
++static int
+ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
+ {
+ static png_FILE_p fpin;
+ static png_FILE_p fpout; /* "static" prevents setjmp corruption */
++ pngtest_error_parameters error_parameters;
+ png_structp read_ptr;
+ png_infop read_info_ptr, end_info_ptr;
+ #ifdef PNG_WRITE_SUPPORTED
+ png_structp write_ptr;
+ png_infop write_info_ptr;
+ png_infop write_end_info_ptr;
++ int interlace_preserved = 1;
+ #else
+ png_structp write_ptr = NULL;
+ png_infop write_info_ptr = NULL;
+@@ -805,17 +875,11 @@
+ png_bytep row_buf;
+ png_uint_32 y;
+ png_uint_32 width, height;
+- int num_pass, pass;
++ int num_pass = 1, pass;
+ int bit_depth, color_type;
+-#ifdef PNG_SETJMP_SUPPORTED
+-#ifdef USE_FAR_KEYWORD
+- jmp_buf tmp_jmpbuf;
+-#endif
+-#endif
+-
+- char inbuf[256], outbuf[256];
+
+ row_buf = NULL;
++ error_parameters.file_name = inname;
+
+ if ((fpin = fopen(inname, "rb")) == NULL)
+ {
+@@ -839,20 +903,9 @@
+ read_ptr =
+ png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ #endif
+-#ifndef PNG_STDIO_SUPPORTED
+- png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
+- pngtest_warning);
+-#endif
++ png_set_error_fn(read_ptr, &error_parameters, pngtest_error,
++ pngtest_warning);
+
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+- user_chunk_data[0] = 0;
+- user_chunk_data[1] = 0;
+- user_chunk_data[2] = 0;
+- user_chunk_data[3] = 0;
+- png_set_read_user_chunk_fn(read_ptr, user_chunk_data,
+- read_user_chunk_callback);
+-
+-#endif
+ #ifdef PNG_WRITE_SUPPORTED
+ #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
+ write_ptr =
+@@ -862,10 +915,8 @@
+ write_ptr =
+ png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ #endif
+-#ifndef PNG_STDIO_SUPPORTED
+- png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
+- pngtest_warning);
+-#endif
++ png_set_error_fn(write_ptr, &error_parameters, pngtest_error,
++ pngtest_warning);
+ #endif
+ pngtest_debug("Allocating read_info, write_info and end_info structures");
+ read_info_ptr = png_create_info_struct(read_ptr);
+@@ -875,13 +926,15 @@
+ write_end_info_ptr = png_create_info_struct(write_ptr);
+ #endif
+
++#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
++ init_callback_info(read_info_ptr);
++ png_set_read_user_chunk_fn(read_ptr, &user_chunk_data,
++ read_user_chunk_callback);
++#endif
++
+ #ifdef PNG_SETJMP_SUPPORTED
+ pngtest_debug("Setting jmpbuf for read struct");
+-#ifdef USE_FAR_KEYWORD
+- if (setjmp(tmp_jmpbuf))
+-#else
+ if (setjmp(png_jmpbuf(read_ptr)))
+-#endif
+ {
+ fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
+ png_free(read_ptr, row_buf);
+@@ -895,18 +948,11 @@
+ FCLOSE(fpout);
+ return (1);
+ }
+-#ifdef USE_FAR_KEYWORD
+- png_memcpy(png_jmpbuf(read_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
+-#endif
+
+ #ifdef PNG_WRITE_SUPPORTED
+ pngtest_debug("Setting jmpbuf for write struct");
+-#ifdef USE_FAR_KEYWORD
+
+- if (setjmp(tmp_jmpbuf))
+-#else
+ if (setjmp(png_jmpbuf(write_ptr)))
+-#endif
+ {
+ fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname);
+ png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
+@@ -918,12 +964,34 @@
+ FCLOSE(fpout);
+ return (1);
+ }
++#endif
++#endif
+
+-#ifdef USE_FAR_KEYWORD
+- png_memcpy(png_jmpbuf(write_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
++ if (strict != 0)
++ {
++ /* Treat png_benign_error() as errors on read */
++ png_set_benign_errors(read_ptr, 0);
++
++#ifdef PNG_WRITE_SUPPORTED
++ /* Treat them as errors on write */
++ png_set_benign_errors(write_ptr, 0);
+ #endif
++
++ /* if strict is not set, then app warnings and errors are treated as
++ * warnings in release builds, but not in unstable builds; this can be
++ * changed with '--relaxed'.
++ */
++ }
++
++ else if (relaxed != 0)
++ {
++ /* Allow application (pngtest) errors and warnings to pass */
++ png_set_benign_errors(read_ptr, 1);
++
++#ifdef PNG_WRITE_SUPPORTED
++ png_set_benign_errors(write_ptr, 1);
+ #endif
+-#endif
++ }
+
+ pngtest_debug("Initializing input and output streams");
+ #ifdef PNG_STDIO_SUPPORTED
+@@ -943,14 +1011,6 @@
+ # endif
+ #endif
+
+-#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
+- /* Normally one would use Z_DEFAULT_STRATEGY for text compression.
+- * This is here just to make pngtest replicate the results from libpng
+- * versions prior to 1.5.4, and to test this new API.
+- */
+- png_set_text_compression_strategy(write_ptr, Z_FILTERED);
+-#endif
+-
+ if (status_dots_requested == 1)
+ {
+ #ifdef PNG_WRITE_SUPPORTED
+@@ -982,36 +1042,65 @@
+ png_set_write_user_transform_fn(write_ptr, count_zero_samples);
+ #endif
+
+-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+-# ifndef PNG_HANDLE_CHUNK_ALWAYS
+-# define PNG_HANDLE_CHUNK_ALWAYS 3
+-# endif
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ /* Preserve all the unknown chunks, if possible. If this is disabled then,
++ * even if the png_{get,set}_unknown_chunks stuff is enabled, we can't use
++ * libpng to *save* the unknown chunks on read (because we can't switch the
++ * save option on!)
++ *
++ * Notice that if SET_UNKNOWN_CHUNKS is *not* supported read will discard all
++ * unknown chunks and write will write them all.
++ */
++#ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
+ png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS,
+ NULL, 0);
+ #endif
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+-# ifndef PNG_HANDLE_CHUNK_IF_SAFE
+-# define PNG_HANDLE_CHUNK_IF_SAFE 2
+-# endif
+- png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE,
++ png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_ALWAYS,
+ NULL, 0);
+ #endif
++#endif
+
+ pngtest_debug("Reading info struct");
+ png_read_info(read_ptr, read_info_ptr);
+
++#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
++ /* This is a bit of a hack; there is no obvious way in the callback function
++ * to determine that the chunks before the first IDAT have been read, so
++ * remove the info_ptr (which is only used to determine position relative to
++ * PLTE) here to indicate that we are after the IDAT.
++ */
++ user_chunk_data.info_ptr = NULL;
++#endif
++
+ pngtest_debug("Transferring info struct");
+ {
+ int interlace_type, compression_type, filter_type;
+
+ if (png_get_IHDR(read_ptr, read_info_ptr, &width, &height, &bit_depth,
+- &color_type, &interlace_type, &compression_type, &filter_type))
++ &color_type, &interlace_type, &compression_type, &filter_type) != 0)
+ {
+ png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
+-#ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ color_type, interlace_type, compression_type, filter_type);
+-#else
+- color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
++#ifndef PNG_READ_INTERLACING_SUPPORTED
++ /* num_pass will not be set below, set it here if the image is
++ * interlaced: what happens is that write interlacing is *not* turned
++ * on an the partial interlaced rows are written directly.
++ */
++ switch (interlace_type)
++ {
++ case PNG_INTERLACE_NONE:
++ num_pass = 1;
++ break;
++
++ case PNG_INTERLACE_ADAM7:
++ num_pass = 7;
++ break;
++
++ default:
++ png_error(read_ptr, "invalid interlace type");
++ /*NOT REACHED*/
++ }
+ #endif
+ }
+ }
+@@ -1022,7 +1111,7 @@
+ blue_y;
+
+ if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
+- &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y))
++ &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y) != 0)
+ {
+ png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x,
+ red_y, green_x, green_y, blue_x, blue_y);
+@@ -1033,7 +1122,7 @@
+ {
+ png_fixed_point gamma;
+
+- if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma))
++ if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma) != 0)
+ png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma);
+ }
+ #endif
+@@ -1045,7 +1134,7 @@
+ blue_y;
+
+ if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
+- &red_y, &green_x, &green_y, &blue_x, &blue_y))
++ &red_y, &green_x, &green_y, &blue_x, &blue_y) != 0)
+ {
+ png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x,
+ red_y, green_x, green_y, blue_x, blue_y);
+@@ -1056,7 +1145,7 @@
+ {
+ double gamma;
+
+- if (png_get_gAMA(read_ptr, read_info_ptr, &gamma))
++ if (png_get_gAMA(read_ptr, read_info_ptr, &gamma) != 0)
+ png_set_gAMA(write_ptr, write_info_ptr, gamma);
+ }
+ #endif
+@@ -1070,7 +1159,7 @@
+ int compression_type;
+
+ if (png_get_iCCP(read_ptr, read_info_ptr, &name, &compression_type,
+- &profile, &proflen))
++ &profile, &proflen) != 0)
+ {
+ png_set_iCCP(write_ptr, write_info_ptr, name, compression_type,
+ profile, proflen);
+@@ -1081,7 +1170,7 @@
+ {
+ int intent;
+
+- if (png_get_sRGB(read_ptr, read_info_ptr, &intent))
++ if (png_get_sRGB(read_ptr, read_info_ptr, &intent) != 0)
+ png_set_sRGB(write_ptr, write_info_ptr, intent);
+ }
+ #endif
+@@ -1089,14 +1178,14 @@
+ png_colorp palette;
+ int num_palette;
+
+- if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
++ if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette) != 0)
+ png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
+ }
+ #ifdef PNG_bKGD_SUPPORTED
+ {
+ png_color_16p background;
+
+- if (png_get_bKGD(read_ptr, read_info_ptr, &background))
++ if (png_get_bKGD(read_ptr, read_info_ptr, &background) != 0)
+ {
+ png_set_bKGD(write_ptr, write_info_ptr, background);
+ }
+@@ -1106,7 +1195,7 @@
+ {
+ png_uint_16p hist;
+
+- if (png_get_hIST(read_ptr, read_info_ptr, &hist))
++ if (png_get_hIST(read_ptr, read_info_ptr, &hist) != 0)
+ png_set_hIST(write_ptr, write_info_ptr, hist);
+ }
+ #endif
+@@ -1116,7 +1205,7 @@
+ int unit_type;
+
+ if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y,
+- &unit_type))
++ &unit_type) != 0)
+ {
+ png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type);
+ }
+@@ -1130,7 +1219,7 @@
+ int type, nparams;
+
+ if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type,
+- &nparams, &units, &params))
++ &nparams, &units, &params) != 0)
+ {
+ png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type,
+ nparams, units, params);
+@@ -1142,7 +1231,8 @@
+ png_uint_32 res_x, res_y;
+ int unit_type;
+
+- if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type))
++ if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y,
++ &unit_type) != 0)
+ png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
+ }
+ #endif
+@@ -1150,18 +1240,19 @@
+ {
+ png_color_8p sig_bit;
+
+- if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit))
++ if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit) != 0)
+ png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
+ }
+ #endif
+ #ifdef PNG_sCAL_SUPPORTED
+-#ifdef PNG_FLOATING_POINT_SUPPORTED
++#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
++ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
+ {
+ int unit;
+ double scal_width, scal_height;
+
+ if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width,
+- &scal_height))
++ &scal_height) != 0)
+ {
+ png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height);
+ }
+@@ -1173,7 +1264,7 @@
+ png_charp scal_width, scal_height;
+
+ if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
+- &scal_height))
++ &scal_height) != 0)
+ {
+ png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width,
+ scal_height);
+@@ -1190,6 +1281,21 @@
+ if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
+ {
+ pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
++
++ pngtest_check_text_support(read_ptr, text_ptr, num_text);
++
++ if (verbose != 0)
++ {
++ int i;
++
++ printf("\n");
++ for (i=0; i<num_text; i++)
++ {
++ printf(" Text compression[%d]=%d\n",
++ i, text_ptr[i].compression);
++ }
++ }
++
+ png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
+ }
+ }
+@@ -1198,21 +1304,21 @@
+ {
+ png_timep mod_time;
+
+- if (png_get_tIME(read_ptr, read_info_ptr, &mod_time))
++ if (png_get_tIME(read_ptr, read_info_ptr, &mod_time) != 0)
+ {
+ png_set_tIME(write_ptr, write_info_ptr, mod_time);
+ #ifdef PNG_TIME_RFC1123_SUPPORTED
+- /* We have to use png_memcpy instead of "=" because the string
+- * pointed to by png_convert_to_rfc1123() gets free'ed before
+- * we use it.
+- */
+- png_memcpy(tIME_string,
+- png_convert_to_rfc1123(read_ptr, mod_time),
+- png_sizeof(tIME_string));
++ if (png_convert_to_rfc1123_buffer(tIME_string, mod_time) != 0)
++ tIME_string[(sizeof tIME_string) - 1] = '\0';
+
+- tIME_string[png_sizeof(tIME_string) - 1] = '\0';
++ else
++ {
++ strncpy(tIME_string, "*** invalid time ***", (sizeof tIME_string));
++ tIME_string[(sizeof tIME_string) - 1] = '\0';
++ }
++
+ tIME_chunk_present++;
+-#endif /* PNG_TIME_RFC1123_SUPPORTED */
++#endif /* TIME_RFC1123 */
+ }
+ }
+ #endif
+@@ -1223,7 +1329,7 @@
+ png_color_16p trans_color;
+
+ if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans,
+- &trans_color))
++ &trans_color) != 0)
+ {
+ int sample_max = (1 << bit_depth);
+ /* libpng doesn't reject a tRNS chunk with out-of-range samples */
+@@ -1244,18 +1350,22 @@
+ int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
+ &unknowns);
+
+- if (num_unknowns)
++ if (num_unknowns != 0)
+ {
+- int i;
+ png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
+ num_unknowns);
++#if PNG_LIBPNG_VER < 10600
+ /* Copy the locations from the read_info_ptr. The automatically
+- * generated locations in write_info_ptr are wrong because we
+- * haven't written anything yet.
++ * generated locations in write_end_info_ptr are wrong prior to 1.6.0
++ * because they are reset from the write pointer (removed in 1.6.0).
+ */
+- for (i = 0; i < num_unknowns; i++)
+- png_set_unknown_chunk_location(write_ptr, write_info_ptr, i,
+- unknowns[i].location);
++ {
++ int i;
++ for (i = 0; i < num_unknowns; i++)
++ png_set_unknown_chunk_location(write_ptr, write_info_ptr, i,
++ unknowns[i].location);
++ }
++#endif
+ }
+ }
+ #endif
+@@ -1263,47 +1373,16 @@
+ #ifdef PNG_WRITE_SUPPORTED
+ pngtest_debug("Writing info struct");
+
+-/* If we wanted, we could write info in two steps:
+- * png_write_info_before_PLTE(write_ptr, write_info_ptr);
+- */
++ /* Write the info in two steps so that if we write the 'unknown' chunks here
++ * they go to the correct place.
++ */
++ png_write_info_before_PLTE(write_ptr, write_info_ptr);
++
++ write_chunks(write_ptr, before_PLTE); /* before PLTE */
++
+ png_write_info(write_ptr, write_info_ptr);
+
+-#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+- if (user_chunk_data[0] != 0)
+- {
+- png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
+-
+- unsigned char
+- ster_chunk_data[1];
+-
+- if (verbose)
+- fprintf(STDERR, "\n stereo mode = %lu\n",
+- (unsigned long)(user_chunk_data[0] - 1));
+-
+- ster_chunk_data[0]=(unsigned char)(user_chunk_data[0] - 1);
+- png_write_chunk(write_ptr, png_sTER, ster_chunk_data, 1);
+- }
+-
+- if (user_chunk_data[1] != 0 || user_chunk_data[2] != 0)
+- {
+- png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'};
+-
+- unsigned char
+- vpag_chunk_data[9];
+-
+- if (verbose)
+- fprintf(STDERR, " vpAg = %lu x %lu, units = %lu\n",
+- (unsigned long)user_chunk_data[1],
+- (unsigned long)user_chunk_data[2],
+- (unsigned long)user_chunk_data[3]);
+-
+- png_save_uint_32(vpag_chunk_data, user_chunk_data[1]);
+- png_save_uint_32(vpag_chunk_data + 4, user_chunk_data[2]);
+- vpag_chunk_data[8] = (unsigned char)(user_chunk_data[3] & 0xff);
+- png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
+- }
+-
+-#endif
++ write_chunks(write_ptr, before_IDAT); /* after PLTE */
+ #endif
+
+ #ifdef SINGLE_ROWBUF_ALLOC
+@@ -1315,14 +1394,10 @@
+ #endif /* SINGLE_ROWBUF_ALLOC */
+ pngtest_debug("Writing row data");
+
+-#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
+- defined(PNG_WRITE_INTERLACING_SUPPORTED)
++#ifdef PNG_READ_INTERLACING_SUPPORTED
+ num_pass = png_set_interlace_handling(read_ptr);
+-# ifdef PNG_WRITE_SUPPORTED
+- png_set_interlace_handling(write_ptr);
+-# endif
+-#else
+- num_pass = 1;
++ if (png_set_interlace_handling(write_ptr) != num_pass)
++ png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
+ #endif
+
+ #ifdef PNGTEST_TIMING
+@@ -1337,11 +1412,12 @@
+ {
+ #ifndef SINGLE_ROWBUF_ALLOC
+ pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
++
+ row_buf = (png_bytep)png_malloc(read_ptr,
+ png_get_rowbytes(read_ptr, read_info_ptr));
+
+- pngtest_debug2("\t0x%08lx (%u bytes)", (unsigned long)row_buf,
+- png_get_rowbytes(read_ptr, read_info_ptr));
++ pngtest_debug2("\t0x%08lx (%lu bytes)", (unsigned long)row_buf,
++ (unsigned long)png_get_rowbytes(read_ptr, read_info_ptr));
+
+ #endif /* !SINGLE_ROWBUF_ALLOC */
+ png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
+@@ -1358,7 +1434,7 @@
+ t_encode += (t_stop - t_start);
+ t_start = t_stop;
+ #endif
+-#endif /* PNG_WRITE_SUPPORTED */
++#endif /* WRITE */
+
+ #ifndef SINGLE_ROWBUF_ALLOC
+ pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
+@@ -1368,11 +1444,13 @@
+ }
+ }
+
+-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+- png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
+-#endif
+-#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+- png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
++#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
++# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
++ png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
++# endif
++# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
++ png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
++# endif
+ #endif
+
+ pngtest_debug("Reading and writing end_info data");
+@@ -1386,6 +1464,21 @@
+ if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
+ {
+ pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
++
++ pngtest_check_text_support(read_ptr, text_ptr, num_text);
++
++ if (verbose != 0)
++ {
++ int i;
++
++ printf("\n");
++ for (i=0; i<num_text; i++)
++ {
++ printf(" Text compression[%d]=%d\n",
++ i, text_ptr[i].compression);
++ }
++ }
++
+ png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
+ }
+ }
+@@ -1394,20 +1487,21 @@
+ {
+ png_timep mod_time;
+
+- if (png_get_tIME(read_ptr, end_info_ptr, &mod_time))
++ if (png_get_tIME(read_ptr, end_info_ptr, &mod_time) != 0)
+ {
+ png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
+ #ifdef PNG_TIME_RFC1123_SUPPORTED
+- /* We have to use png_memcpy instead of "=" because the string
+- pointed to by png_convert_to_rfc1123() gets free'ed before
+- we use it */
+- png_memcpy(tIME_string,
+- png_convert_to_rfc1123(read_ptr, mod_time),
+- png_sizeof(tIME_string));
++ if (png_convert_to_rfc1123_buffer(tIME_string, mod_time) != 0)
++ tIME_string[(sizeof tIME_string) - 1] = '\0';
+
+- tIME_string[png_sizeof(tIME_string) - 1] = '\0';
++ else
++ {
++ strncpy(tIME_string, "*** invalid time ***", sizeof tIME_string);
++ tIME_string[(sizeof tIME_string)-1] = '\0';
++ }
++
+ tIME_chunk_present++;
+-#endif /* PNG_TIME_RFC1123_SUPPORTED */
++#endif /* TIME_RFC1123 */
+ }
+ }
+ #endif
+@@ -1417,27 +1511,48 @@
+ int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
+ &unknowns);
+
+- if (num_unknowns)
++ if (num_unknowns != 0)
+ {
+- int i;
+ png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
+ num_unknowns);
++#if PNG_LIBPNG_VER < 10600
+ /* Copy the locations from the read_info_ptr. The automatically
+- * generated locations in write_end_info_ptr are wrong because we
+- * haven't written the end_info yet.
++ * generated locations in write_end_info_ptr are wrong prior to 1.6.0
++ * because they are reset from the write pointer (removed in 1.6.0).
+ */
+- for (i = 0; i < num_unknowns; i++)
+- png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i,
+- unknowns[i].location);
++ {
++ int i;
++ for (i = 0; i < num_unknowns; i++)
++ png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i,
++ unknowns[i].location);
++ }
++#endif
+ }
+ }
+ #endif
++
+ #ifdef PNG_WRITE_SUPPORTED
++#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
++ /* Normally one would use Z_DEFAULT_STRATEGY for text compression.
++ * This is here just to make pngtest replicate the results from libpng
++ * versions prior to 1.5.4, and to test this new API.
++ */
++ png_set_text_compression_strategy(write_ptr, Z_FILTERED);
++#endif
++
++ /* When the unknown vpAg/sTER chunks are written by pngtest the only way to
++ * do it is to write them *before* calling png_write_end. When unknown
++ * chunks are written by libpng, however, they are written just before IEND.
++ * There seems to be no way round this, however vpAg/sTER are not expected
++ * after IDAT.
++ */
++ write_chunks(write_ptr, after_IDAT);
++
+ png_write_end(write_ptr, write_end_info_ptr);
+ #endif
+
+ #ifdef PNG_EASY_ACCESS_SUPPORTED
+- if (verbose)
++ if (verbose != 0)
+ {
+ png_uint_32 iwidth, iheight;
+ iwidth = png_get_image_width(write_ptr, write_info_ptr);
+@@ -1466,6 +1581,40 @@
+ FCLOSE(fpin);
+ FCLOSE(fpout);
+
++ /* Summarize any warnings or errors and in 'strict' mode fail the test.
++ * Unsupported chunks can result in warnings, in that case ignore the strict
++ * setting, otherwise fail the test on warnings as well as errors.
++ */
++ if (error_count > 0)
++ {
++ /* We don't really expect to get here because of the setjmp handling
++ * above, but this is safe.
++ */
++ fprintf(STDERR, "\n %s: %d libpng errors found (%d warnings)",
++ inname, error_count, warning_count);
++
++ if (strict != 0)
++ return (1);
++ }
++
++# ifdef PNG_WRITE_SUPPORTED
++ /* If there we no write support nothing was written! */
++ else if (unsupported_chunks > 0)
++ {
++ fprintf(STDERR, "\n %s: unsupported chunks (%d)%s",
++ inname, unsupported_chunks, strict ? ": IGNORED --strict!" : "");
++ }
++# endif
++
++ else if (warning_count > 0)
++ {
++ fprintf(STDERR, "\n %s: %d libpng warnings found",
++ inname, warning_count);
++
++ if (strict != 0)
++ return (1);
++ }
++
+ pngtest_debug("Opening files for comparison");
+ if ((fpin = fopen(inname, "rb")) == NULL)
+ {
+@@ -1480,61 +1629,84 @@
+ return (1);
+ }
+
+- for (;;)
++#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
++ if (interlace_preserved != 0) /* else the files will be changed */
+ {
+- png_size_t num_in, num_out;
++ for (;;)
++ {
++ static int wrote_question = 0;
++ png_size_t num_in, num_out;
++ char inbuf[256], outbuf[256];
+
+- num_in = fread(inbuf, 1, 1, fpin);
+- num_out = fread(outbuf, 1, 1, fpout);
++ num_in = fread(inbuf, 1, sizeof inbuf, fpin);
++ num_out = fread(outbuf, 1, sizeof outbuf, fpout);
+
+- if (num_in != num_out)
+- {
+- fprintf(STDERR, "\nFiles %s and %s are of a different size\n",
+- inname, outname);
++ if (num_in != num_out)
++ {
++ fprintf(STDERR, "\nFiles %s and %s are of a different size\n",
++ inname, outname);
+
+- if (wrote_question == 0)
+- {
+- fprintf(STDERR,
++ if (wrote_question == 0 && unsupported_chunks == 0)
++ {
++ fprintf(STDERR,
+ " Was %s written with the same maximum IDAT chunk size (%d bytes),",
+- inname, PNG_ZBUF_SIZE);
+- fprintf(STDERR,
+- "\n filtering heuristic (libpng default), compression");
+- fprintf(STDERR,
+- " level (zlib default),\n and zlib version (%s)?\n\n",
+- ZLIB_VERSION);
+- wrote_question = 1;
++ inname, PNG_ZBUF_SIZE);
++ fprintf(STDERR,
++ "\n filtering heuristic (libpng default), compression");
++ fprintf(STDERR,
++ " level (zlib default),\n and zlib version (%s)?\n\n",
++ ZLIB_VERSION);
++ wrote_question = 1;
++ }
++
++ FCLOSE(fpin);
++ FCLOSE(fpout);
++
++ if (strict != 0 && unsupported_chunks == 0)
++ return (1);
++
++ else
++ return (0);
+ }
+
+- FCLOSE(fpin);
+- FCLOSE(fpout);
+- return (0);
+- }
++ if (num_in == 0)
++ break;
+
+- if (!num_in)
+- break;
++ if (memcmp(inbuf, outbuf, num_in))
++ {
++ fprintf(STDERR, "\nFiles %s and %s are different\n", inname,
++ outname);
+
+- if (png_memcmp(inbuf, outbuf, num_in))
+- {
+- fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname);
++ if (wrote_question == 0 && unsupported_chunks == 0)
++ {
++ fprintf(STDERR,
++ " Was %s written with the same maximum IDAT chunk size (%d bytes),",
++ inname, PNG_ZBUF_SIZE);
++ fprintf(STDERR,
++ "\n filtering heuristic (libpng default), compression");
++ fprintf(STDERR,
++ " level (zlib default),\n and zlib version (%s)?\n\n",
++ ZLIB_VERSION);
++ wrote_question = 1;
++ }
+
+- if (wrote_question == 0)
+- {
+- fprintf(STDERR,
+- " Was %s written with the same maximum IDAT chunk size (%d bytes),",
+- inname, PNG_ZBUF_SIZE);
+- fprintf(STDERR,
+- "\n filtering heuristic (libpng default), compression");
+- fprintf(STDERR,
+- " level (zlib default),\n and zlib version (%s)?\n\n",
+- ZLIB_VERSION);
+- wrote_question = 1;
++ FCLOSE(fpin);
++ FCLOSE(fpout);
++
++ /* NOTE: the unsupported_chunks escape is permitted here because
++ * unsupported text chunk compression will result in the compression
++ * mode being changed (to NONE) yet, in the test case, the result
++ * can be exactly the same size!
++ */
++ if (strict != 0 && unsupported_chunks == 0)
++ return (1);
++
++ else
++ return (0);
+ }
+-
+- FCLOSE(fpin);
+- FCLOSE(fpout);
+- return (0);
+ }
+ }
++#endif /* WRITE */
+
+ FCLOSE(fpin);
+ FCLOSE(fpout);
+@@ -1614,6 +1786,24 @@
+ inname = argv[2];
+ }
+
++ else if (strcmp(argv[1], "--strict") == 0)
++ {
++ status_dots_requested = 0;
++ verbose = 1;
++ inname = argv[2];
++ strict++;
++ relaxed = 0;
++ }
++
++ else if (strcmp(argv[1], "--relaxed") == 0)
++ {
++ status_dots_requested = 0;
++ verbose = 1;
++ inname = argv[2];
++ strict = 0;
++ relaxed++;
++ }
++
+ else
+ {
+ inname = argv[1];
+@@ -1621,10 +1811,11 @@
+ }
+ }
+
+- if (!multiple && argc == 3 + verbose)
++ if (multiple == 0 && argc == 3 + verbose)
+ outname = argv[2 + verbose];
+
+- if ((!multiple && argc > 3 + verbose) || (multiple && argc < 2))
++ if ((multiple == 0 && argc > 3 + verbose) ||
++ (multiple != 0 && argc < 2))
+ {
+ fprintf(STDERR,
+ "usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",
+@@ -1636,7 +1827,7 @@
+ exit(1);
+ }
+
+- if (multiple)
++ if (multiple != 0)
+ {
+ int i;
+ #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
+@@ -1646,6 +1837,9 @@
+ {
+ int kerror;
+ fprintf(STDERR, "\n Testing %s:", argv[i]);
++#if PNG_DEBUG > 0
++ fprintf(STDERR, "\n");
++#endif
+ kerror = test_one_file(argv[i], outname);
+ if (kerror == 0)
+ {
+@@ -1660,7 +1854,7 @@
+ #endif
+ #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ for (k = 0; k<256; k++)
+- if (filters_used[k])
++ if (filters_used[k] != 0)
+ fprintf(STDERR, " Filter %d was used %lu times\n",
+ k, (unsigned long)filters_used[k]);
+ #endif
+@@ -1669,7 +1863,7 @@
+ fprintf(STDERR, " tIME = %s\n", tIME_string);
+
+ tIME_chunk_present = 0;
+-#endif /* PNG_TIME_RFC1123_SUPPORTED */
++#endif /* TIME_RFC1123 */
+ }
+
+ else
+@@ -1691,9 +1885,9 @@
+
+ while (pinfo != NULL)
+ {
+- fprintf(STDERR, " %lu bytes at %x\n",
++ fprintf(STDERR, " %lu bytes at %p\n",
+ (unsigned long)pinfo->size,
+- (unsigned int)pinfo->pointer);
++ pinfo->pointer);
+ pinfo = pinfo->next;
+ }
+ }
+@@ -1727,7 +1921,12 @@
+ status_dots_requested = 0;
+
+ if (i == 0 || verbose == 1 || ierror != 0)
++ {
+ fprintf(STDERR, "\n Testing %s:", inname);
++#if PNG_DEBUG > 0
++ fprintf(STDERR, "\n");
++#endif
++ }
+
+ kerror = test_one_file(inname, outname);
+
+@@ -1746,21 +1945,26 @@
+ #endif
+ #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ for (k = 0; k<256; k++)
+- if (filters_used[k])
++ if (filters_used[k] != 0)
+ fprintf(STDERR, " Filter %d was used %lu times\n",
+ k, (unsigned long)filters_used[k]);
+ #endif
+ #ifdef PNG_TIME_RFC1123_SUPPORTED
+ if (tIME_chunk_present != 0)
+ fprintf(STDERR, " tIME = %s\n", tIME_string);
+-#endif /* PNG_TIME_RFC1123_SUPPORTED */
++#endif /* TIME_RFC1123 */
+ }
+ }
+
+ else
+ {
+ if (verbose == 0 && i != 2)
++ {
+ fprintf(STDERR, "\n Testing %s:", inname);
++#if PNG_DEBUG > 0
++ fprintf(STDERR, "\n");
++#endif
++ }
+
+ fprintf(STDERR, " FAIL\n");
+ ierror += kerror;
+@@ -1779,8 +1983,8 @@
+
+ while (pinfo != NULL)
+ {
+- fprintf(STDERR, " %lu bytes at %x\n",
+- (unsigned long)pinfo->size, (unsigned int)pinfo->pointer);
++ fprintf(STDERR, " %lu bytes at %p\n",
++ (unsigned long)pinfo->size, pinfo->pointer);
+ pinfo = pinfo->next;
+ }
+ }
+@@ -1820,6 +2024,16 @@
+
+ return (int)(ierror != 0);
+ }
++#else
++int
++main(void)
++{
++ fprintf(STDERR,
++ " test ignored because libpng was not built with read support\n");
++ /* And skip this test */
++ return PNG_LIBPNG_VER < 10600 ? 0 : 77;
++}
++#endif
+
+ /* Generate a compiler error if there is an old png.h in the search path. */
+-typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4;
++typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
+--- ./jdk/src/share/native/sun/awt/libpng/pngtrans.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngtrans.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -46,7 +46,7 @@
+ #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
+ /* Turn on BGR-to-RGB mapping */
+ void PNGAPI
+-png_set_bgr(png_structp png_ptr)
++png_set_bgr(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_bgr");
+
+@@ -60,7 +60,7 @@
+ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
+ /* Turn on 16 bit byte swapping */
+ void PNGAPI
+-png_set_swap(png_structp png_ptr)
++png_set_swap(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_swap");
+
+@@ -75,7 +75,7 @@
+ #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
+ /* Turn on pixel packing */
+ void PNGAPI
+-png_set_packing(png_structp png_ptr)
++png_set_packing(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_packing");
+
+@@ -85,7 +85,9 @@
+ if (png_ptr->bit_depth < 8)
+ {
+ png_ptr->transformations |= PNG_PACK;
+- png_ptr->usr_bit_depth = 8;
++# ifdef PNG_WRITE_SUPPORTED
++ png_ptr->usr_bit_depth = 8;
++# endif
+ }
+ }
+ #endif
+@@ -93,7 +95,7 @@
+ #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+ /* Turn on packed pixel swapping */
+ void PNGAPI
+-png_set_packswap(png_structp png_ptr)
++png_set_packswap(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_packswap");
+
+@@ -107,7 +109,7 @@
+
+ #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
+ void PNGAPI
+-png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
++png_set_shift(png_structrp png_ptr, png_const_color_8p true_bits)
+ {
+ png_debug(1, "in png_set_shift");
+
+@@ -122,11 +124,11 @@
+ #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
+ defined(PNG_WRITE_INTERLACING_SUPPORTED)
+ int PNGAPI
+-png_set_interlace_handling(png_structp png_ptr)
++png_set_interlace_handling(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_interlace handling");
+
+- if (png_ptr && png_ptr->interlaced)
++ if (png_ptr != 0 && png_ptr->interlaced != 0)
+ {
+ png_ptr->transformations |= PNG_INTERLACE;
+ return (7);
+@@ -143,44 +145,91 @@
+ * that don't like bytes as parameters.
+ */
+ void PNGAPI
+-png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
++png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
+ {
+ png_debug(1, "in png_set_filler");
+
+ if (png_ptr == NULL)
+ return;
+
++ /* In libpng 1.6 it is possible to determine whether this is a read or write
++ * operation and therefore to do more checking here for a valid call.
++ */
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
++ {
++# ifdef PNG_READ_FILLER_SUPPORTED
++ /* On read png_set_filler is always valid, regardless of the base PNG
++ * format, because other transformations can give a format where the
++ * filler code can execute (basically an 8 or 16-bit component RGB or G
++ * format.)
++ *
++ * NOTE: usr_channels is not used by the read code! (This has led to
++ * confusion in the past.) The filler is only used in the read code.
++ */
++ png_ptr->filler = (png_uint_16)filler;
++# else
++ png_app_error(png_ptr, "png_set_filler not supported on read");
++ PNG_UNUSED(filler) /* not used in the write case */
++ return;
++# endif
++ }
++
++ else /* write */
++ {
++# ifdef PNG_WRITE_FILLER_SUPPORTED
++ /* On write the usr_channels parameter must be set correctly at the
++ * start to record the number of channels in the app-supplied data.
++ */
++ switch (png_ptr->color_type)
++ {
++ case PNG_COLOR_TYPE_RGB:
++ png_ptr->usr_channels = 4;
++ break;
++
++ case PNG_COLOR_TYPE_GRAY:
++ if (png_ptr->bit_depth >= 8)
++ {
++ png_ptr->usr_channels = 2;
++ break;
++ }
++
++ else
++ {
++ /* There simply isn't any code in libpng to strip out bits
++ * from bytes when the components are less than a byte in
++ * size!
++ */
++ png_app_error(png_ptr,
++ "png_set_filler is invalid for low bit depth gray output");
++ return;
++ }
++
++ default:
++ png_app_error(png_ptr,
++ "png_set_filler: inappropriate color type");
++ return;
++ }
++# else
++ png_app_error(png_ptr, "png_set_filler not supported on write");
++ return;
++# endif
++ }
++
++ /* Here on success - libpng supports the operation, set the transformation
++ * and the flag to say where the filler channel is.
++ */
+ png_ptr->transformations |= PNG_FILLER;
+- png_ptr->filler = (png_uint_16)filler;
+
+ if (filler_loc == PNG_FILLER_AFTER)
+ png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
+
+ else
+ png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
+-
+- /* This should probably go in the "do_read_filler" routine.
+- * I attempted to do that in libpng-1.0.1a but that caused problems
+- * so I restored it in libpng-1.0.2a
+- */
+-
+- if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
+- {
+- png_ptr->usr_channels = 4;
+- }
+-
+- /* Also I added this in libpng-1.0.2a (what happens when we expand
+- * a less-than-8-bit grayscale to GA?) */
+-
+- if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
+- {
+- png_ptr->usr_channels = 2;
+- }
+ }
+
+ /* Added to libpng-1.2.7 */
+ void PNGAPI
+-png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
++png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
+ {
+ png_debug(1, "in png_set_add_alpha");
+
+@@ -188,7 +237,9 @@
+ return;
+
+ png_set_filler(png_ptr, filler, filler_loc);
+- png_ptr->transformations |= PNG_ADD_ALPHA;
++ /* The above may fail to do anything. */
++ if ((png_ptr->transformations & PNG_FILLER) != 0)
++ png_ptr->transformations |= PNG_ADD_ALPHA;
+ }
+
+ #endif
+@@ -196,7 +247,7 @@
+ #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
+ defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+ void PNGAPI
+-png_set_swap_alpha(png_structp png_ptr)
++png_set_swap_alpha(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_swap_alpha");
+
+@@ -210,7 +261,7 @@
+ #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
+ defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+ void PNGAPI
+-png_set_invert_alpha(png_structp png_ptr)
++png_set_invert_alpha(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_invert_alpha");
+
+@@ -223,7 +274,7 @@
+
+ #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
+ void PNGAPI
+-png_set_invert_mono(png_structp png_ptr)
++png_set_invert_mono(png_structrp png_ptr)
+ {
+ png_debug(1, "in png_set_invert_mono");
+
+@@ -304,9 +355,16 @@
+
+ for (i = 0; i < istop; i++, rp += 2)
+ {
++#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
++ /* Feature added to libpng-1.6.11 for testing purposes, not
++ * enabled by default.
++ */
++ *(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
++#else
+ png_byte t = *rp;
+ *rp = *(rp + 1);
+ *(rp + 1) = t;
++#endif
+ }
+ }
+ }
+@@ -448,7 +506,7 @@
+ *rp = table[*rp];
+ }
+ }
+-#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
++#endif /* PACKSWAP || WRITE_PACKSWAP */
+
+ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
+ defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+@@ -480,7 +538,7 @@
+ {
+ if (row_info->bit_depth == 8)
+ {
+- if (at_start) /* Skip initial filler */
++ if (at_start != 0) /* Skip initial filler */
+ ++sp;
+ else /* Skip initial channel and, for sp, the filler */
+ sp += 2, ++dp;
+@@ -494,7 +552,7 @@
+
+ else if (row_info->bit_depth == 16)
+ {
+- if (at_start) /* Skip initial filler */
++ if (at_start != 0) /* Skip initial filler */
+ sp += 2;
+ else /* Skip initial channel and, for sp, the filler */
+ sp += 4, dp += 2;
+@@ -520,7 +578,7 @@
+ {
+ if (row_info->bit_depth == 8)
+ {
+- if (at_start) /* Skip initial filler */
++ if (at_start != 0) /* Skip initial filler */
+ ++sp;
+ else /* Skip initial channels and, for sp, the filler */
+ sp += 4, dp += 3;
+@@ -534,7 +592,7 @@
+
+ else if (row_info->bit_depth == 16)
+ {
+- if (at_start) /* Skip initial filler */
++ if (at_start != 0) /* Skip initial filler */
+ sp += 2;
+ else /* Skip initial channels and, for sp, the filler */
+ sp += 8, dp += 6;
+@@ -575,7 +633,7 @@
+ {
+ png_debug(1, "in png_do_bgr");
+
+- if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
++ if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ png_uint_32 row_width = row_info->width;
+ if (row_info->bit_depth == 8)
+@@ -645,19 +703,133 @@
+ #endif
+ }
+ }
+-#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
++#endif /* READ_BGR || WRITE_BGR */
++
++#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
++ defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
++/* Added at libpng-1.5.10 */
++void /* PRIVATE */
++png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
++{
++ if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
++ png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
++ {
++ /* Calculations moved outside switch in an attempt to stop different
++ * compiler warnings. 'padding' is in *bits* within the last byte, it is
++ * an 'int' because pixel_depth becomes an 'int' in the expression below,
++ * and this calculation is used because it avoids warnings that other
++ * forms produced on either GCC or MSVC.
++ */
++ int padding = (-row_info->pixel_depth * row_info->width) & 7;
++ png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
++
++ switch (row_info->bit_depth)
++ {
++ case 1:
++ {
++ /* in this case, all bytes must be 0 so we don't need
++ * to unpack the pixels except for the rightmost one.
++ */
++ for (; rp > png_ptr->row_buf; rp--)
++ {
++ if (*rp >> padding != 0)
++ png_ptr->num_palette_max = 1;
++ padding = 0;
++ }
++
++ break;
++ }
++
++ case 2:
++ {
++ for (; rp > png_ptr->row_buf; rp--)
++ {
++ int i = ((*rp >> padding) & 0x03);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ i = (((*rp >> padding) >> 2) & 0x03);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ i = (((*rp >> padding) >> 4) & 0x03);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ i = (((*rp >> padding) >> 6) & 0x03);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ padding = 0;
++ }
++
++ break;
++ }
++
++ case 4:
++ {
++ for (; rp > png_ptr->row_buf; rp--)
++ {
++ int i = ((*rp >> padding) & 0x0f);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ i = (((*rp >> padding) >> 4) & 0x0f);
++
++ if (i > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = i;
++
++ padding = 0;
++ }
++
++ break;
++ }
++
++ case 8:
++ {
++ for (; rp > png_ptr->row_buf; rp--)
++ {
++ if (*rp > png_ptr->num_palette_max)
++ png_ptr->num_palette_max = (int) *rp;
++ }
++
++ break;
++ }
++
++ default:
++ break;
++ }
++ }
++}
++#endif /* CHECK_FOR_INVALID_INDEX */
+
+ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+ #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+ void PNGAPI
+-png_set_user_transform_info(png_structp png_ptr, png_voidp
++png_set_user_transform_info(png_structrp png_ptr, png_voidp
+ user_transform_ptr, int user_transform_depth, int user_transform_channels)
+ {
+ png_debug(1, "in png_set_user_transform_info");
+
+ if (png_ptr == NULL)
+ return;
++
++#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
++ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
++ (png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
++ {
++ png_app_error(png_ptr,
++ "info change after png_start_read_image or png_read_update_info");
++ return;
++ }
++#endif
++
+ png_ptr->user_transform_ptr = user_transform_ptr;
+ png_ptr->user_transform_depth = (png_byte)user_transform_depth;
+ png_ptr->user_transform_channels = (png_byte)user_transform_channels;
+@@ -671,20 +843,20 @@
+ */
+ #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+ png_voidp PNGAPI
+-png_get_user_transform_ptr(png_const_structp png_ptr)
++png_get_user_transform_ptr(png_const_structrp png_ptr)
+ {
+ if (png_ptr == NULL)
+ return (NULL);
+
+- return ((png_voidp)png_ptr->user_transform_ptr);
++ return png_ptr->user_transform_ptr;
+ }
+ #endif
+
+ #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
+ png_uint_32 PNGAPI
+-png_get_current_row_number(png_const_structp png_ptr)
++png_get_current_row_number(png_const_structrp png_ptr)
+ {
+- /* See the comments in png.h - this is the sub-image row when reading and
++ /* See the comments in png.h - this is the sub-image row when reading an
+ * interlaced image.
+ */
+ if (png_ptr != NULL)
+@@ -694,13 +866,12 @@
+ }
+
+ png_byte PNGAPI
+-png_get_current_pass_number(png_const_structp png_ptr)
++png_get_current_pass_number(png_const_structrp png_ptr)
+ {
+ if (png_ptr != NULL)
+ return png_ptr->pass;
+ return 8; /* invalid */
+ }
+-#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
+-#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
+- PNG_WRITE_USER_TRANSFORM_SUPPORTED */
+-#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
++#endif /* USER_TRANSFORM_INFO */
++#endif /* READ_USER_TRANSFORM || WRITE_USER_TRANSFORM */
++#endif /* READ || WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngwio.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngwio.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.0 [January 6, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -58,11 +58,12 @@
+ */
+
+ void /* PRIVATE */
+-png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
++png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
+ {
+ /* NOTE: write_data_fn must not change the buffer! */
+ if (png_ptr->write_data_fn != NULL )
+- (*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
++ (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
++ length);
+
+ else
+ png_error(png_ptr, "Call to NULL write function");
+@@ -74,7 +75,6 @@
+ * write_data function and use it at run time with png_set_write_fn(), rather
+ * than changing the library.
+ */
+-#ifndef USE_FAR_KEYWORD
+ void PNGCBAPI
+ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+@@ -88,64 +88,6 @@
+ if (check != length)
+ png_error(png_ptr, "Write Error");
+ }
+-#else
+-/* This is the model-independent version. Since the standard I/O library
+- * can't handle far buffers in the medium and small models, we have to copy
+- * the data.
+- */
+-
+-#define NEAR_BUF_SIZE 1024
+-#define MIN(a,b) (a <= b ? a : b)
+-
+-void PNGCBAPI
+-png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
+-{
+- png_uint_32 check;
+- png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
+- png_FILE_p io_ptr;
+-
+- if (png_ptr == NULL)
+- return;
+-
+- /* Check if data really is near. If so, use usual code. */
+- near_data = (png_byte *)CVT_PTR_NOCHECK(data);
+- io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
+-
+- if ((png_bytep)near_data == data)
+- {
+- check = fwrite(near_data, 1, length, io_ptr);
+- }
+-
+- else
+- {
+- png_byte buf[NEAR_BUF_SIZE];
+- png_size_t written, remaining, err;
+- check = 0;
+- remaining = length;
+-
+- do
+- {
+- written = MIN(NEAR_BUF_SIZE, remaining);
+- png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
+- err = fwrite(buf, 1, written, io_ptr);
+-
+- if (err != written)
+- break;
+-
+- else
+- check += err;
+-
+- data += written;
+- remaining -= written;
+- }
+- while (remaining != 0);
+- }
+-
+- if (check != length)
+- png_error(png_ptr, "Write Error");
+-}
+-
+-#endif
+ #endif
+
+ /* This function is called to output any data pending writing (normally
+@@ -154,7 +96,7 @@
+ */
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ void /* PRIVATE */
+-png_flush(png_structp png_ptr)
++png_flush(png_structrp png_ptr)
+ {
+ if (png_ptr->output_flush_fn != NULL)
+ (*(png_ptr->output_flush_fn))(png_ptr);
+@@ -169,7 +111,7 @@
+ if (png_ptr == NULL)
+ return;
+
+- io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
++ io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr));
+ fflush(io_ptr);
+ }
+ # endif
+@@ -205,7 +147,7 @@
+ * *FILE structure.
+ */
+ void PNGAPI
+-png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
++png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
+ png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
+ {
+ if (png_ptr == NULL)
+@@ -235,8 +177,11 @@
+ # else
+ png_ptr->output_flush_fn = output_flush_fn;
+ # endif
+-#endif /* PNG_WRITE_FLUSH_SUPPORTED */
++#else
++ PNG_UNUSED(output_flush_fn)
++#endif /* WRITE_FLUSH */
+
++#ifdef PNG_READ_SUPPORTED
+ /* It is an error to read while writing a png file */
+ if (png_ptr->read_data_fn != NULL)
+ {
+@@ -246,37 +191,6 @@
+ "Can't set both read_data_fn and write_data_fn in the"
+ " same structure");
+ }
++#endif
+ }
+-
+-#ifdef USE_FAR_KEYWORD
+-# ifdef _MSC_VER
+-void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
+-{
+- void *near_ptr;
+- void FAR *far_ptr;
+- FP_OFF(near_ptr) = FP_OFF(ptr);
+- far_ptr = (void FAR *)near_ptr;
+-
+- if (check != 0)
+- if (FP_SEG(ptr) != FP_SEG(far_ptr))
+- png_error(png_ptr, "segment lost in conversion");
+-
+- return(near_ptr);
+-}
+-# else
+-void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
+-{
+- void *near_ptr;
+- void FAR *far_ptr;
+- near_ptr = (void FAR *)ptr;
+- far_ptr = (void FAR *)near_ptr;
+-
+- if (check != 0)
+- if (far_ptr != ptr)
+- png_error(png_ptr, "segment lost in conversion");
+-
+- return(near_ptr);
+-}
+-# endif
+-#endif
+-#endif /* PNG_WRITE_SUPPORTED */
++#endif /* WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngwrite.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngwrite.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -40,9 +40,65 @@
+ */
+
+ #include "pngpriv.h"
++#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
++# include <errno.h>
++#endif
+
+ #ifdef PNG_WRITE_SUPPORTED
+
++#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
++/* Write out all the unknown chunks for the current given location */
++static void
++write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr,
++ unsigned int where)
++{
++ if (info_ptr->unknown_chunks_num != 0)
++ {
++ png_const_unknown_chunkp up;
++
++ png_debug(5, "writing extra chunks");
++
++ for (up = info_ptr->unknown_chunks;
++ up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
++ ++up)
++ if ((up->location & where) != 0)
++ {
++ /* If per-chunk unknown chunk handling is enabled use it, otherwise
++ * just write the chunks the application has set.
++ */
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ int keep = png_handle_as_unknown(png_ptr, up->name);
++
++ /* NOTE: this code is radically different from the read side in the
++ * matter of handling an ancillary unknown chunk. In the read side
++ * the default behavior is to discard it, in the code below the default
++ * behavior is to write it. Critical chunks are, however, only
++ * written if explicitly listed or if the default is set to write all
++ * unknown chunks.
++ *
++ * The default handling is also slightly weird - it is not possible to
++ * stop the writing of all unsafe-to-copy chunks!
++ *
++ * TODO: REVIEW: this would seem to be a bug.
++ */
++ if (keep != PNG_HANDLE_CHUNK_NEVER &&
++ ((up->name[3] & 0x20) /* safe-to-copy overrides everything */ ||
++ keep == PNG_HANDLE_CHUNK_ALWAYS ||
++ (keep == PNG_HANDLE_CHUNK_AS_DEFAULT &&
++ png_ptr->unknown_default == PNG_HANDLE_CHUNK_ALWAYS)))
++#endif
++ {
++ /* TODO: review, what is wrong with a zero length unknown chunk? */
++ if (up->size == 0)
++ png_warning(png_ptr, "Writing zero-length unknown chunk");
++
++ png_write_chunk(png_ptr, up->name, up->data, up->size);
++ }
++ }
++ }
++}
++#endif /* WRITE_UNKNOWN_CHUNKS */
++
+ /* Writes all the PNG information. This is the suggested way to use the
+ * library. If you have a new chunk to add, make a function to write it,
+ * and put it in the correct location here. If you want the chunk written
+@@ -53,21 +109,21 @@
+ * them in png_write_end(), and compressing them.
+ */
+ void PNGAPI
+-png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
++png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ png_debug(1, "in png_write_info_before_PLTE");
+
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
+- if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
++ if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
+ {
+ /* Write PNG signature */
+ png_write_sig(png_ptr);
+
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \
+- (png_ptr->mng_features_permitted))
++ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) != 0 && \
++ png_ptr->mng_features_permitted != 0)
+ {
+ png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
+ png_ptr->mng_features_permitted = 0;
+@@ -79,75 +135,88 @@
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
+ info_ptr->filter_type,
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+- info_ptr->interlace_type);
++ info_ptr->interlace_type
+ #else
+- 0);
++ 0
+ #endif
++ );
++
+ /* The rest of these check to see if the valid field has the appropriate
+ * flag set, and if it does, writes the chunk.
++ *
++ * 1.6.0: COLORSPACE support controls the writing of these chunks too, and
++ * the chunks will be written if the WRITE routine is there and information
++ * is available in the COLORSPACE. (See png_colorspace_sync_info in png.c
++ * for where the valid flags get set.)
++ *
++ * Under certain circumstances the colorspace can be invalidated without
++ * syncing the info_struct 'valid' flags; this happens if libpng detects and
++ * error and calls png_error while the color space is being set, yet the
++ * application continues writing the PNG. So check the 'invalid' flag here
++ * too.
+ */
+-#ifdef PNG_WRITE_gAMA_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_gAMA)
+- png_write_gAMA_fixed(png_ptr, info_ptr->gamma);
+-#endif
+-#ifdef PNG_WRITE_sRGB_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_sRGB)
+- png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent);
++#ifdef PNG_GAMMA_SUPPORTED
++# ifdef PNG_WRITE_gAMA_SUPPORTED
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_gAMA) != 0 &&
++ (info_ptr->valid & PNG_INFO_gAMA) != 0)
++ png_write_gAMA_fixed(png_ptr, info_ptr->colorspace.gamma);
++# endif
+ #endif
+
+-#ifdef PNG_WRITE_iCCP_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_iCCP)
+- png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
+- (png_charp)info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
+-#endif
++#ifdef PNG_COLORSPACE_SUPPORTED
++ /* Write only one of sRGB or an ICC profile. If a profile was supplied
++ * and it matches one of the known sRGB ones issue a warning.
++ */
++# ifdef PNG_WRITE_iCCP_SUPPORTED
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
++ (info_ptr->valid & PNG_INFO_iCCP) != 0)
++ {
++# ifdef PNG_WRITE_sRGB_SUPPORTED
++ if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
++ png_app_warning(png_ptr,
++ "profile matches sRGB but writing iCCP instead");
++# endif
++
++ png_write_iCCP(png_ptr, info_ptr->iccp_name,
++ info_ptr->iccp_profile);
++ }
++# ifdef PNG_WRITE_sRGB_SUPPORTED
++ else
++# endif
++# endif
++
++# ifdef PNG_WRITE_sRGB_SUPPORTED
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
++ (info_ptr->valid & PNG_INFO_sRGB) != 0)
++ png_write_sRGB(png_ptr, info_ptr->colorspace.rendering_intent);
++# endif /* WRITE_sRGB */
++#endif /* COLORSPACE */
++
+ #ifdef PNG_WRITE_sBIT_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_sBIT)
++ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
+ png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
+ #endif
+-#ifdef PNG_WRITE_cHRM_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_cHRM)
+- png_write_cHRM_fixed(png_ptr,
+- info_ptr->x_white, info_ptr->y_white,
+- info_ptr->x_red, info_ptr->y_red,
+- info_ptr->x_green, info_ptr->y_green,
+- info_ptr->x_blue, info_ptr->y_blue);
++
++#ifdef PNG_COLORSPACE_SUPPORTED
++# ifdef PNG_WRITE_cHRM_SUPPORTED
++ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
++ (info_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0 &&
++ (info_ptr->valid & PNG_INFO_cHRM) != 0)
++ png_write_cHRM_fixed(png_ptr, &info_ptr->colorspace.end_points_xy);
++# endif
+ #endif
+
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+- if (info_ptr->unknown_chunks_num)
+- {
+- png_unknown_chunk *up;
++ write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_IHDR);
++#endif
+
+- png_debug(5, "writing extra chunks");
+-
+- for (up = info_ptr->unknown_chunks;
+- up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
+- up++)
+- {
+- int keep = png_handle_as_unknown(png_ptr, up->name);
+-
+- if (keep != PNG_HANDLE_CHUNK_NEVER &&
+- up->location &&
+- !(up->location & PNG_HAVE_PLTE) &&
+- !(up->location & PNG_HAVE_IDAT) &&
+- !(up->location & PNG_AFTER_IDAT) &&
+- ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
+- (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
+- {
+- if (up->size == 0)
+- png_warning(png_ptr, "Writing zero-length unknown chunk");
+-
+- png_write_chunk(png_ptr, up->name, up->data, up->size);
+- }
+- }
+- }
+-#endif
+ png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
+ }
+ }
+
+ void PNGAPI
+-png_write_info(png_structp png_ptr, png_infop info_ptr)
++png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
+ {
+ #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
+ int i;
+@@ -160,19 +229,19 @@
+
+ png_write_info_before_PLTE(png_ptr, info_ptr);
+
+- if (info_ptr->valid & PNG_INFO_PLTE)
++ if ((info_ptr->valid & PNG_INFO_PLTE) != 0)
+ png_write_PLTE(png_ptr, info_ptr->palette,
+ (png_uint_32)info_ptr->num_palette);
+
+- else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ else if ((info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) !=0)
+ png_error(png_ptr, "Valid palette required for paletted images");
+
+ #ifdef PNG_WRITE_tRNS_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_tRNS)
++ if ((info_ptr->valid & PNG_INFO_tRNS) !=0)
+ {
+ #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+ /* Invert the alpha channel (in tRNS) */
+- if ((png_ptr->transformations & PNG_INVERT_ALPHA) &&
++ if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
+ info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
+ {
+ int j;
+@@ -186,42 +255,42 @@
+ }
+ #endif
+ #ifdef PNG_WRITE_bKGD_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_bKGD)
++ if ((info_ptr->valid & PNG_INFO_bKGD) != 0)
+ png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
+ #endif
+
+ #ifdef PNG_WRITE_hIST_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_hIST)
++ if ((info_ptr->valid & PNG_INFO_hIST) != 0)
+ png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
+ #endif
+
+ #ifdef PNG_WRITE_oFFs_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_oFFs)
++ if ((info_ptr->valid & PNG_INFO_oFFs) != 0)
+ png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset,
+ info_ptr->offset_unit_type);
+ #endif
+
+ #ifdef PNG_WRITE_pCAL_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_pCAL)
++ if ((info_ptr->valid & PNG_INFO_pCAL) != 0)
+ png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
+ info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
+ info_ptr->pcal_units, info_ptr->pcal_params);
+ #endif
+
+ #ifdef PNG_WRITE_sCAL_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_sCAL)
++ if ((info_ptr->valid & PNG_INFO_sCAL) != 0)
+ png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit,
+ info_ptr->scal_s_width, info_ptr->scal_s_height);
+ #endif /* sCAL */
+
+ #ifdef PNG_WRITE_pHYs_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_pHYs)
++ if ((info_ptr->valid & PNG_INFO_pHYs) != 0)
+ png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit,
+ info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
+ #endif /* pHYs */
+
+ #ifdef PNG_WRITE_tIME_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_tIME)
++ if ((info_ptr->valid & PNG_INFO_tIME) != 0)
+ {
+ png_write_tIME(png_ptr, &(info_ptr->mod_time));
+ png_ptr->mode |= PNG_WROTE_tIME;
+@@ -229,7 +298,7 @@
+ #endif /* tIME */
+
+ #ifdef PNG_WRITE_sPLT_SUPPORTED
+- if (info_ptr->valid & PNG_INFO_sPLT)
++ if ((info_ptr->valid & PNG_INFO_sPLT) != 0)
+ for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
+ png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
+ #endif /* sPLT */
+@@ -251,11 +320,14 @@
+ info_ptr->text[i].lang,
+ info_ptr->text[i].lang_key,
+ info_ptr->text[i].text);
++ /* Mark this chunk as written */
++ if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
++ else
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ #else
+- png_warning(png_ptr, "Unable to write international text");
++ png_warning(png_ptr, "Unable to write international text");
+ #endif
+- /* Mark this chunk as written */
+- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
+ }
+
+ /* If we want a compressed text chunk */
+@@ -264,13 +336,12 @@
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
+ /* Write compressed chunk */
+ png_write_zTXt(png_ptr, info_ptr->text[i].key,
+- info_ptr->text[i].text, 0,
+- info_ptr->text[i].compression);
++ info_ptr->text[i].text, info_ptr->text[i].compression);
++ /* Mark this chunk as written */
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ #else
+ png_warning(png_ptr, "Unable to write compressed text");
+ #endif
+- /* Mark this chunk as written */
+- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ }
+
+ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
+@@ -291,29 +362,7 @@
+ #endif /* tEXt */
+
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+- if (info_ptr->unknown_chunks_num)
+- {
+- png_unknown_chunk *up;
+-
+- png_debug(5, "writing extra chunks");
+-
+- for (up = info_ptr->unknown_chunks;
+- up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
+- up++)
+- {
+- int keep = png_handle_as_unknown(png_ptr, up->name);
+- if (keep != PNG_HANDLE_CHUNK_NEVER &&
+- up->location &&
+- (up->location & PNG_HAVE_PLTE) &&
+- !(up->location & PNG_HAVE_IDAT) &&
+- !(up->location & PNG_AFTER_IDAT) &&
+- ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
+- (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
+- {
+- png_write_chunk(png_ptr, up->name, up->data, up->size);
+- }
+- }
+- }
++ write_unknown_chunks(png_ptr, info_ptr, PNG_HAVE_PLTE);
+ #endif
+ }
+
+@@ -323,16 +372,21 @@
+ * comments, I suggest writing them here, and compressing them.
+ */
+ void PNGAPI
+-png_write_end(png_structp png_ptr, png_infop info_ptr)
++png_write_end(png_structrp png_ptr, png_inforp info_ptr)
+ {
+ png_debug(1, "in png_write_end");
+
+ if (png_ptr == NULL)
+ return;
+
+- if (!(png_ptr->mode & PNG_HAVE_IDAT))
++ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
+ png_error(png_ptr, "No IDATs written into file");
+
++#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ if (png_ptr->num_palette_max > png_ptr->num_palette)
++ png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
++#endif
++
+ /* See if user wants us to write information chunks */
+ if (info_ptr != NULL)
+ {
+@@ -341,8 +395,8 @@
+ #endif
+ #ifdef PNG_WRITE_tIME_SUPPORTED
+ /* Check to see if user has supplied a time chunk */
+- if ((info_ptr->valid & PNG_INFO_tIME) &&
+- !(png_ptr->mode & PNG_WROTE_tIME))
++ if ((info_ptr->valid & PNG_INFO_tIME) != 0 &&
++ (png_ptr->mode & PNG_WROTE_tIME) == 0)
+ png_write_tIME(png_ptr, &(info_ptr->mod_time));
+
+ #endif
+@@ -363,11 +417,14 @@
+ info_ptr->text[i].lang,
+ info_ptr->text[i].lang_key,
+ info_ptr->text[i].text);
++ /* Mark this chunk as written */
++ if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
++ else
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ #else
+ png_warning(png_ptr, "Unable to write international text");
+ #endif
+- /* Mark this chunk as written */
+- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
+ }
+
+ else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt)
+@@ -375,13 +432,12 @@
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
+ /* Write compressed chunk */
+ png_write_zTXt(png_ptr, info_ptr->text[i].key,
+- info_ptr->text[i].text, 0,
+- info_ptr->text[i].compression);
++ info_ptr->text[i].text, info_ptr->text[i].compression);
++ /* Mark this chunk as written */
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ #else
+ png_warning(png_ptr, "Unable to write compressed text");
+ #endif
+- /* Mark this chunk as written */
+- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
+ }
+
+ else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
+@@ -390,37 +446,16 @@
+ /* Write uncompressed chunk */
+ png_write_tEXt(png_ptr, info_ptr->text[i].key,
+ info_ptr->text[i].text, 0);
++ /* Mark this chunk as written */
++ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
+ #else
+ png_warning(png_ptr, "Unable to write uncompressed text");
+ #endif
+-
+- /* Mark this chunk as written */
+- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
+ }
+ }
+ #endif
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+- if (info_ptr->unknown_chunks_num)
+- {
+- png_unknown_chunk *up;
+-
+- png_debug(5, "writing extra chunks");
+-
+- for (up = info_ptr->unknown_chunks;
+- up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
+- up++)
+- {
+- int keep = png_handle_as_unknown(png_ptr, up->name);
+- if (keep != PNG_HANDLE_CHUNK_NEVER &&
+- up->location &&
+- (up->location & PNG_AFTER_IDAT) &&
+- ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
+- (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
+- {
+- png_write_chunk(png_ptr, up->name, up->data, up->size);
+- }
+- }
+- }
++ write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
+ #endif
+ }
+
+@@ -428,6 +463,7 @@
+
+ /* Write end of PNG file */
+ png_write_IEND(png_ptr);
++
+ /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
+ * and restored again in libpng-1.2.30, may cause some applications that
+ * do not set png_ptr->output_flush_fn to crash. If your application
+@@ -443,9 +479,8 @@
+ }
+
+ #ifdef PNG_CONVERT_tIME_SUPPORTED
+-/* "tm" structure is not supported on WindowsCE */
+ void PNGAPI
+-png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm FAR * ttime)
++png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
+ {
+ png_debug(1, "in png_convert_from_struct_tm");
+
+@@ -474,103 +509,75 @@
+ png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
+ png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
+ {
+-#ifdef PNG_USER_MEM_SUPPORTED
+- return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
+- warn_fn, NULL, NULL, NULL));
++#ifndef PNG_USER_MEM_SUPPORTED
++ png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
++ error_fn, warn_fn, NULL, NULL, NULL);
++#else
++ return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
++ warn_fn, NULL, NULL, NULL);
+ }
+
+ /* Alternate initialize png_ptr structure, and allocate any memory needed */
+-static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
+-
+ PNG_FUNCTION(png_structp,PNGAPI
+ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
+ png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
+ {
+-#endif /* PNG_USER_MEM_SUPPORTED */
+- volatile int png_cleanup_needed = 0;
+-#ifdef PNG_SETJMP_SUPPORTED
+- volatile
+-#endif
+- png_structp png_ptr;
+-#ifdef PNG_SETJMP_SUPPORTED
+-#ifdef USE_FAR_KEYWORD
+- jmp_buf tmp_jmpbuf;
+-#endif
++ png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
++ error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
++#endif /* USER_MEM */
++ if (png_ptr != NULL)
++ {
++ /* Set the zlib control values to defaults; they can be overridden by the
++ * application after the struct has been created.
++ */
++ png_ptr->zbuffer_size = PNG_ZBUF_SIZE;
++
++ /* The 'zlib_strategy' setting is irrelevant because png_default_claim in
++ * pngwutil.c defaults it according to whether or not filters will be
++ * used, and ignores this setting.
++ */
++ png_ptr->zlib_strategy = PNG_Z_DEFAULT_STRATEGY;
++ png_ptr->zlib_level = PNG_Z_DEFAULT_COMPRESSION;
++ png_ptr->zlib_mem_level = 8;
++ png_ptr->zlib_window_bits = 15;
++ png_ptr->zlib_method = 8;
++
++#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
++ png_ptr->zlib_text_strategy = PNG_TEXT_Z_DEFAULT_STRATEGY;
++ png_ptr->zlib_text_level = PNG_TEXT_Z_DEFAULT_COMPRESSION;
++ png_ptr->zlib_text_mem_level = 8;
++ png_ptr->zlib_text_window_bits = 15;
++ png_ptr->zlib_text_method = 8;
++#endif /* WRITE_COMPRESSED_TEXT */
++
++ /* This is a highly dubious configuration option; by default it is off,
++ * but it may be appropriate for private builds that are testing
++ * extensions not conformant to the current specification, or of
++ * applications that must not fail to write at all costs!
++ */
++#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
++ /* In stable builds only warn if an application error can be completely
++ * handled.
++ */
++ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
+ #endif
+
+- png_debug(1, "in png_create_write_struct");
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
+- (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
+-#else
+- png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
+-#endif /* PNG_USER_MEM_SUPPORTED */
+- if (png_ptr == NULL)
+- return (NULL);
+-
+- /* Added at libpng-1.2.6 */
+-#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+- png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+- png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
++ /* App warnings are warnings in release (or release candidate) builds but
++ * are errors during development.
++ */
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++ png_ptr->flags |= PNG_FLAG_APP_WARNINGS_WARN;
+ #endif
+
+-#ifdef PNG_SETJMP_SUPPORTED
+-/* Applications that neglect to set up their own setjmp() and then
+- encounter a png_error() will longjmp here. Since the jmpbuf is
+- then meaningless we abort instead of returning. */
+-#ifdef USE_FAR_KEYWORD
+- if (setjmp(tmp_jmpbuf))
+-#else
+- if (setjmp(png_jmpbuf(png_ptr))) /* sets longjmp to match setjmp */
+-#endif
+-#ifdef USE_FAR_KEYWORD
+- png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
+-#endif
+- PNG_ABORT();
+-#endif
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
+-#endif /* PNG_USER_MEM_SUPPORTED */
+- png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
+-
+- if (!png_user_version_check(png_ptr, user_png_ver))
+- png_cleanup_needed = 1;
+-
+- /* Initialize zbuf - compression buffer */
+- png_ptr->zbuf_size = PNG_ZBUF_SIZE;
+-
+- if (!png_cleanup_needed)
+- {
+- png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
+- png_ptr->zbuf_size);
+- if (png_ptr->zbuf == NULL)
+- png_cleanup_needed = 1;
++ /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
++ * do it itself) avoiding setting the default function if it is not
++ * required.
++ */
++ png_set_write_fn(png_ptr, NULL, NULL, NULL);
+ }
+
+- if (png_cleanup_needed)
+- {
+- /* Clean up PNG structure and deallocate any memory. */
+- png_free(png_ptr, png_ptr->zbuf);
+- png_ptr->zbuf = NULL;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)png_ptr,
+- (png_free_ptr)free_fn, (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)png_ptr);
+-#endif
+- return (NULL);
+- }
+-
+- png_set_write_fn(png_ptr, NULL, NULL, NULL);
+-
+-#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+- png_reset_filter_heuristics(png_ptr);
+-#endif
+-
+- return (png_ptr);
++ return png_ptr;
+ }
+
+
+@@ -580,7 +587,7 @@
+ * "write" the image seven times.
+ */
+ void PNGAPI
+-png_write_rows(png_structp png_ptr, png_bytepp row,
++png_write_rows(png_structrp png_ptr, png_bytepp row,
+ png_uint_32 num_rows)
+ {
+ png_uint_32 i; /* row counter */
+@@ -602,7 +609,7 @@
+ * if you are writing an interlaced image.
+ */
+ void PNGAPI
+-png_write_image(png_structp png_ptr, png_bytepp image)
++png_write_image(png_structrp png_ptr, png_bytepp image)
+ {
+ png_uint_32 i; /* row index */
+ int pass, num_pass; /* pass variables */
+@@ -632,10 +639,78 @@
+ }
+ }
+
++#ifdef PNG_MNG_FEATURES_SUPPORTED
++/* Performs intrapixel differencing */
++static void
++png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
++{
++ png_debug(1, "in png_do_write_intrapixel");
++
++ if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
++ {
++ int bytes_per_pixel;
++ png_uint_32 row_width = row_info->width;
++ if (row_info->bit_depth == 8)
++ {
++ png_bytep rp;
++ png_uint_32 i;
++
++ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
++ bytes_per_pixel = 3;
++
++ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ bytes_per_pixel = 4;
++
++ else
++ return;
++
++ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
++ {
++ *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
++ *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
++ }
++ }
++
++#ifdef PNG_WRITE_16BIT_SUPPORTED
++ else if (row_info->bit_depth == 16)
++ {
++ png_bytep rp;
++ png_uint_32 i;
++
++ if (row_info->color_type == PNG_COLOR_TYPE_RGB)
++ bytes_per_pixel = 6;
++
++ else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
++ bytes_per_pixel = 8;
++
++ else
++ return;
++
++ for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
++ {
++ png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
++ png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
++ png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
++ png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
++ png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
++ *(rp ) = (png_byte)((red >> 8) & 0xff);
++ *(rp + 1) = (png_byte)(red & 0xff);
++ *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
++ *(rp + 5) = (png_byte)(blue & 0xff);
++ }
++ }
++#endif /* WRITE_16BIT */
++ }
++}
++#endif /* MNG_FEATURES */
++
+ /* Called by user to write a row of image data */
+ void PNGAPI
+-png_write_row(png_structp png_ptr, png_const_bytep row)
++png_write_row(png_structrp png_ptr, png_const_bytep row)
+ {
++ /* 1.5.6: moved from png_struct to be a local structure: */
++ png_row_info row_info;
++
+ if (png_ptr == NULL)
+ return;
+
+@@ -646,44 +721,44 @@
+ if (png_ptr->row_number == 0 && png_ptr->pass == 0)
+ {
+ /* Make sure we wrote the header info */
+- if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
++ if ((png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE) == 0)
+ png_error(png_ptr,
+ "png_write_info was never called before png_write_row");
+
+ /* Check for transforms that have been set but were defined out */
+ #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
+- if (png_ptr->transformations & PNG_INVERT_MONO)
++ if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
+ png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined");
+ #endif
+
+ #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
+- if (png_ptr->transformations & PNG_FILLER)
++ if ((png_ptr->transformations & PNG_FILLER) != 0)
+ png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined");
+ #endif
+ #if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
+ defined(PNG_READ_PACKSWAP_SUPPORTED)
+- if (png_ptr->transformations & PNG_PACKSWAP)
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
+ png_warning(png_ptr,
+ "PNG_WRITE_PACKSWAP_SUPPORTED is not defined");
+ #endif
+
+ #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
+- if (png_ptr->transformations & PNG_PACK)
++ if ((png_ptr->transformations & PNG_PACK) != 0)
+ png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined");
+ #endif
+
+ #if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED)
+- if (png_ptr->transformations & PNG_SHIFT)
++ if ((png_ptr->transformations & PNG_SHIFT) != 0)
+ png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined");
+ #endif
+
+ #if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED)
+- if (png_ptr->transformations & PNG_BGR)
++ if ((png_ptr->transformations & PNG_BGR) != 0)
+ png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined");
+ #endif
+
+ #if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED)
+- if (png_ptr->transformations & PNG_SWAP_BYTES)
++ if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
+ png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined");
+ #endif
+
+@@ -692,12 +767,13 @@
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* If interlaced and not interested in row, return */
+- if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
++ if (png_ptr->interlaced != 0 &&
++ (png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+ switch (png_ptr->pass)
+ {
+ case 0:
+- if (png_ptr->row_number & 0x07)
++ if ((png_ptr->row_number & 0x07) != 0)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -705,7 +781,7 @@
+ break;
+
+ case 1:
+- if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
++ if ((png_ptr->row_number & 0x07) != 0 || png_ptr->width < 5)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -721,7 +797,7 @@
+ break;
+
+ case 3:
+- if ((png_ptr->row_number & 0x03) || png_ptr->width < 3)
++ if ((png_ptr->row_number & 0x03) != 0 || png_ptr->width < 3)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -737,7 +813,7 @@
+ break;
+
+ case 5:
+- if ((png_ptr->row_number & 0x01) || png_ptr->width < 2)
++ if ((png_ptr->row_number & 0x01) != 0 || png_ptr->width < 2)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -745,7 +821,7 @@
+ break;
+
+ case 6:
+- if (!(png_ptr->row_number & 0x01))
++ if ((png_ptr->row_number & 0x01) == 0)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -759,36 +835,31 @@
+ #endif
+
+ /* Set up row info for transformations */
+- png_ptr->row_info.color_type = png_ptr->color_type;
+- png_ptr->row_info.width = png_ptr->usr_width;
+- png_ptr->row_info.channels = png_ptr->usr_channels;
+- png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth;
+- png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth *
+- png_ptr->row_info.channels);
++ row_info.color_type = png_ptr->color_type;
++ row_info.width = png_ptr->usr_width;
++ row_info.channels = png_ptr->usr_channels;
++ row_info.bit_depth = png_ptr->usr_bit_depth;
++ row_info.pixel_depth = (png_byte)(row_info.bit_depth * row_info.channels);
++ row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
+
+- png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
+- png_ptr->row_info.width);
+-
+- png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type);
+- png_debug1(3, "row_info->width = %u", png_ptr->row_info.width);
+- png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels);
+- png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth);
+- png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth);
+- png_debug1(3, "row_info->rowbytes = %lu",
+- (unsigned long)png_ptr->row_info.rowbytes);
++ png_debug1(3, "row_info->color_type = %d", row_info.color_type);
++ png_debug1(3, "row_info->width = %u", row_info.width);
++ png_debug1(3, "row_info->channels = %d", row_info.channels);
++ png_debug1(3, "row_info->bit_depth = %d", row_info.bit_depth);
++ png_debug1(3, "row_info->pixel_depth = %d", row_info.pixel_depth);
++ png_debug1(3, "row_info->rowbytes = %lu", (unsigned long)row_info.rowbytes);
+
+ /* Copy user's row into buffer, leaving room for filter byte. */
+- png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes);
++ memcpy(png_ptr->row_buf + 1, row, row_info.rowbytes);
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* Handle interlacing */
+ if (png_ptr->interlaced && png_ptr->pass < 6 &&
+- (png_ptr->transformations & PNG_INTERLACE))
++ (png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+- png_do_write_interlace(&(png_ptr->row_info),
+- png_ptr->row_buf + 1, png_ptr->pass);
++ png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
+ /* This should always get caught above, but still ... */
+- if (!(png_ptr->row_info.width))
++ if (row_info.width == 0)
+ {
+ png_write_finish_row(png_ptr);
+ return;
+@@ -798,10 +869,17 @@
+
+ #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
+ /* Handle other transformations */
+- if (png_ptr->transformations)
+- png_do_write_transformations(png_ptr);
++ if (png_ptr->transformations != 0)
++ png_do_write_transformations(png_ptr, &row_info);
+ #endif
+
++ /* At this point the row_info pixel depth must match the 'transformed' depth,
++ * which is also the output depth.
++ */
++ if (row_info.pixel_depth != png_ptr->pixel_depth ||
++ row_info.pixel_depth != png_ptr->transformed_pixel_depth)
++ png_error(png_ptr, "internal write transform logic error");
++
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+ /* Write filter_method 64 (intrapixel differencing) only if
+ * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
+@@ -812,16 +890,24 @@
+ * 4. The filter_method is 64 and
+ * 5. The color_type is RGB or RGBA
+ */
+- if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
++ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
+ (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
+ {
+ /* Intrapixel differencing */
+- png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
++ png_do_write_intrapixel(&row_info, png_ptr->row_buf + 1);
+ }
+ #endif
+
++/* Added at libpng-1.5.10 */
++#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
++ /* Check for out-of-range palette index */
++ if (row_info.color_type == PNG_COLOR_TYPE_PALETTE &&
++ png_ptr->num_palette_max >= 0)
++ png_do_check_palette_indexes(png_ptr, &row_info);
++#endif
++
+ /* Find a filter if necessary, filter the row and write it out. */
+- png_write_find_filter(png_ptr, &(png_ptr->row_info));
++ png_write_find_filter(png_ptr, &row_info);
+
+ if (png_ptr->write_row_fn != NULL)
+ (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
+@@ -830,7 +916,7 @@
+ #ifdef PNG_WRITE_FLUSH_SUPPORTED
+ /* Set the automatic flush interval or 0 to turn flushing off */
+ void PNGAPI
+-png_set_flush(png_structp png_ptr, int nrows)
++png_set_flush(png_structrp png_ptr, int nrows)
+ {
+ png_debug(1, "in png_set_flush");
+
+@@ -842,10 +928,8 @@
+
+ /* Flush the current output buffers now */
+ void PNGAPI
+-png_write_flush(png_structp png_ptr)
++png_write_flush(png_structrp png_ptr)
+ {
+- int wrote_IDAT;
+-
+ png_debug(1, "in png_write_flush");
+
+ if (png_ptr == NULL)
+@@ -855,146 +939,41 @@
+ if (png_ptr->row_number >= png_ptr->num_rows)
+ return;
+
+- do
+- {
+- int ret;
+-
+- /* Compress the data */
+- ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH);
+- wrote_IDAT = 0;
+-
+- /* Check for compression errors */
+- if (ret != Z_OK)
+- {
+- if (png_ptr->zstream.msg != NULL)
+- png_error(png_ptr, png_ptr->zstream.msg);
+-
+- else
+- png_error(png_ptr, "zlib error");
+- }
+-
+- if (!(png_ptr->zstream.avail_out))
+- {
+- /* Write the IDAT and reset the zlib output buffer */
+- png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
+- wrote_IDAT = 1;
+- }
+- } while (wrote_IDAT == 1);
+-
+- /* If there is any data left to be output, write it into a new IDAT */
+- if (png_ptr->zbuf_size != png_ptr->zstream.avail_out)
+- {
+- /* Write the IDAT and reset the zlib output buffer */
+- png_write_IDAT(png_ptr, png_ptr->zbuf,
+- png_ptr->zbuf_size - png_ptr->zstream.avail_out);
+- }
++ png_compress_IDAT(png_ptr, NULL, 0, Z_SYNC_FLUSH);
+ png_ptr->flush_rows = 0;
+ png_flush(png_ptr);
+ }
+-#endif /* PNG_WRITE_FLUSH_SUPPORTED */
++#endif /* WRITE_FLUSH */
+
+-/* Free all memory used by the write */
+-void PNGAPI
+-png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
+-{
+- png_structp png_ptr = NULL;
+- png_infop info_ptr = NULL;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_free_ptr free_fn = NULL;
+- png_voidp mem_ptr = NULL;
++#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
++static void png_reset_filter_heuristics(png_structrp png_ptr);/* forward decl */
+ #endif
+
+- png_debug(1, "in png_destroy_write_struct");
+-
+- if (png_ptr_ptr != NULL)
+- {
+- png_ptr = *png_ptr_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- free_fn = png_ptr->free_fn;
+- mem_ptr = png_ptr->mem_ptr;
+-#endif
+- }
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- if (png_ptr != NULL)
+- {
+- free_fn = png_ptr->free_fn;
+- mem_ptr = png_ptr->mem_ptr;
+- }
+-#endif
+-
+- if (info_ptr_ptr != NULL)
+- info_ptr = *info_ptr_ptr;
+-
+- if (info_ptr != NULL)
+- {
+- if (png_ptr != NULL)
+- {
+- png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
+-
+-#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+- if (png_ptr->num_chunk_list)
+- {
+- png_free(png_ptr, png_ptr->chunk_list);
+- png_ptr->num_chunk_list = 0;
+- }
+-#endif
+- }
+-
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
+- (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)info_ptr);
+-#endif
+- *info_ptr_ptr = NULL;
+- }
+-
+- if (png_ptr != NULL)
+- {
+- png_write_destroy(png_ptr);
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
+- (png_voidp)mem_ptr);
+-#else
+- png_destroy_struct((png_voidp)png_ptr);
+-#endif
+- *png_ptr_ptr = NULL;
+- }
+-}
+-
+-
+-/* Free any memory used in png_ptr struct (old method) */
+-void /* PRIVATE */
+-png_write_destroy(png_structp png_ptr)
++/* Free any memory used in png_ptr struct without freeing the struct itself. */
++static void
++png_write_destroy(png_structrp png_ptr)
+ {
+-#ifdef PNG_SETJMP_SUPPORTED
+- jmp_buf tmp_jmp; /* Save jump buffer */
+-#endif
+- png_error_ptr error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- png_error_ptr warning_fn;
+-#endif
+- png_voidp error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_free_ptr free_fn;
+-#endif
+-
+ png_debug(1, "in png_write_destroy");
+
+ /* Free any memory zlib uses */
+- if (png_ptr->zlib_state != PNG_ZLIB_UNINITIALIZED)
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
+ deflateEnd(&png_ptr->zstream);
+
+ /* Free our memory. png_free checks NULL for us. */
+- png_free(png_ptr, png_ptr->zbuf);
++ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
+ png_free(png_ptr, png_ptr->row_buf);
++ png_ptr->row_buf = NULL;
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
+ png_free(png_ptr, png_ptr->prev_row);
+ png_free(png_ptr, png_ptr->sub_row);
+ png_free(png_ptr, png_ptr->up_row);
+ png_free(png_ptr, png_ptr->avg_row);
+ png_free(png_ptr, png_ptr->paeth_row);
++ png_ptr->prev_row = NULL;
++ png_ptr->sub_row = NULL;
++ png_ptr->up_row = NULL;
++ png_ptr->avg_row = NULL;
++ png_ptr->paeth_row = NULL;
+ #endif
+
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+@@ -1002,41 +981,51 @@
+ png_reset_filter_heuristics(png_ptr);
+ png_free(png_ptr, png_ptr->filter_costs);
+ png_free(png_ptr, png_ptr->inv_filter_costs);
++ png_ptr->filter_costs = NULL;
++ png_ptr->inv_filter_costs = NULL;
+ #endif
+
+-#ifdef PNG_SETJMP_SUPPORTED
+- /* Reset structure */
+- png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
++#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
++ png_free(png_ptr, png_ptr->chunk_list);
++ png_ptr->chunk_list = NULL;
+ #endif
+
+- error_fn = png_ptr->error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- warning_fn = png_ptr->warning_fn;
+-#endif
+- error_ptr = png_ptr->error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- free_fn = png_ptr->free_fn;
+-#endif
++ /* The error handling and memory handling information is left intact at this
++ * point: the jmp_buf may still have to be freed. See png_destroy_png_struct
++ * for how this happens.
++ */
++}
+
+- png_memset(png_ptr, 0, png_sizeof(png_struct));
++/* Free all memory used by the write.
++ * In libpng 1.6.0 this API changed quietly to no longer accept a NULL value for
++ * *png_ptr_ptr. Prior to 1.6.0 it would accept such a value and it would free
++ * the passed in info_structs but it would quietly fail to free any of the data
++ * inside them. In 1.6.0 it quietly does nothing (it has to be quiet because it
++ * has no png_ptr.)
++ */
++void PNGAPI
++png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
++{
++ png_debug(1, "in png_destroy_write_struct");
+
+- png_ptr->error_fn = error_fn;
+-#ifdef PNG_WARNINGS_SUPPORTED
+- png_ptr->warning_fn = warning_fn;
+-#endif
+- png_ptr->error_ptr = error_ptr;
+-#ifdef PNG_USER_MEM_SUPPORTED
+- png_ptr->free_fn = free_fn;
+-#endif
++ if (png_ptr_ptr != NULL)
++ {
++ png_structrp png_ptr = *png_ptr_ptr;
+
+-#ifdef PNG_SETJMP_SUPPORTED
+- png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf));
+-#endif
++ if (png_ptr != NULL) /* added in libpng 1.6.0 */
++ {
++ png_destroy_info_struct(png_ptr, info_ptr_ptr);
++
++ *png_ptr_ptr = NULL;
++ png_write_destroy(png_ptr);
++ png_destroy_png_struct(png_ptr);
++ }
++ }
+ }
+
+ /* Allow the application to select one or more row filters to use. */
+ void PNGAPI
+-png_set_filter(png_structp png_ptr, int method, int filters)
++png_set_filter(png_structrp png_ptr, int method, int filters)
+ {
+ png_debug(1, "in png_set_filter");
+
+@@ -1044,7 +1033,7 @@
+ return;
+
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
++ if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
+ (method == PNG_INTRAPIXEL_DIFFERENCING))
+ method = PNG_FILTER_TYPE_BASE;
+
+@@ -1056,8 +1045,9 @@
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
+ case 5:
+ case 6:
+- case 7: png_warning(png_ptr, "Unknown row filter for method 0");
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++ case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
++ /* FALL THROUGH */
++#endif /* WRITE_FILTER */
+ case PNG_FILTER_VALUE_NONE:
+ png_ptr->do_filter = PNG_FILTER_NONE; break;
+
+@@ -1078,8 +1068,8 @@
+ png_ptr->do_filter = (png_byte)filters; break;
+ #else
+ default:
+- png_warning(png_ptr, "Unknown row filter for method 0");
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++ png_app_error(png_ptr, "Unknown row filter for method 0");
++#endif /* WRITE_FILTER */
+ }
+
+ /* If we have allocated the row_buf, this means we have already started
+@@ -1094,14 +1084,16 @@
+ if (png_ptr->row_buf != NULL)
+ {
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
+- if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
++ if ((png_ptr->do_filter & PNG_FILTER_SUB) != 0 &&
++ png_ptr->sub_row == NULL)
+ {
+ png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
+ (png_ptr->rowbytes + 1));
+ png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
+ }
+
+- if ((png_ptr->do_filter & PNG_FILTER_UP) && png_ptr->up_row == NULL)
++ if ((png_ptr->do_filter & PNG_FILTER_UP) != 0 &&
++ png_ptr->up_row == NULL)
+ {
+ if (png_ptr->prev_row == NULL)
+ {
+@@ -1118,7 +1110,8 @@
+ }
+ }
+
+- if ((png_ptr->do_filter & PNG_FILTER_AVG) && png_ptr->avg_row == NULL)
++ if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0 &&
++ png_ptr->avg_row == NULL)
+ {
+ if (png_ptr->prev_row == NULL)
+ {
+@@ -1135,7 +1128,7 @@
+ }
+ }
+
+- if ((png_ptr->do_filter & PNG_FILTER_PAETH) &&
++ if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0 &&
+ png_ptr->paeth_row == NULL)
+ {
+ if (png_ptr->prev_row == NULL)
+@@ -1153,7 +1146,7 @@
+ }
+
+ if (png_ptr->do_filter == PNG_NO_FILTERS)
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++#endif /* WRITE_FILTER */
+ png_ptr->do_filter = PNG_FILTER_NONE;
+ }
+ }
+@@ -1171,7 +1164,7 @@
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
+ /* Convenience reset API. */
+ static void
+-png_reset_filter_heuristics(png_structp png_ptr)
++png_reset_filter_heuristics(png_structrp png_ptr)
+ {
+ /* Clear out any old values in the 'weights' - this must be done because if
+ * the app calls set_filter_heuristics multiple times with different
+@@ -1204,7 +1197,7 @@
+ }
+
+ static int
+-png_init_filter_heuristics(png_structp png_ptr, int heuristic_method,
++png_init_filter_heuristics(png_structrp png_ptr, int heuristic_method,
+ int num_weights)
+ {
+ if (png_ptr == NULL)
+@@ -1224,7 +1217,7 @@
+ if (num_weights > 0)
+ {
+ png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
+- (png_uint_32)(png_sizeof(png_byte) * num_weights));
++ (png_uint_32)((sizeof (png_byte)) * num_weights));
+
+ /* To make sure that the weighting starts out fairly */
+ for (i = 0; i < num_weights; i++)
+@@ -1233,10 +1226,10 @@
+ }
+
+ png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
+- (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
++ (png_uint_32)((sizeof (png_uint_16)) * num_weights));
+
+ png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
+- (png_uint_32)(png_sizeof(png_uint_16) * num_weights));
++ (png_uint_32)((sizeof (png_uint_16)) * num_weights));
+
+ for (i = 0; i < num_weights; i++)
+ {
+@@ -1254,10 +1247,10 @@
+ if (png_ptr->filter_costs == NULL)
+ {
+ png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
+- (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
++ (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
+
+ png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
+- (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
++ (png_uint_32)((sizeof (png_uint_16)) * PNG_FILTER_VALUE_LAST));
+ }
+
+ for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
+@@ -1287,7 +1280,7 @@
+ /* Provide floating and fixed point APIs */
+ #ifdef PNG_FLOATING_POINT_SUPPORTED
+ void PNGAPI
+-png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
++png_set_filter_heuristics(png_structrp png_ptr, int heuristic_method,
+ int num_weights, png_const_doublep filter_weights,
+ png_const_doublep filter_costs)
+ {
+@@ -1296,7 +1289,7 @@
+ /* The internal API allocates all the arrays and ensures that the elements of
+ * those arrays are set to the default value.
+ */
+- if (!png_init_filter_heuristics(png_ptr, heuristic_method, num_weights))
++ if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
+ return;
+
+ /* If using the weighted method copy in the weights. */
+@@ -1342,7 +1335,7 @@
+
+ #ifdef PNG_FIXED_POINT_SUPPORTED
+ void PNGAPI
+-png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
++png_set_filter_heuristics_fixed(png_structrp png_ptr, int heuristic_method,
+ int num_weights, png_const_fixed_point_p filter_weights,
+ png_const_fixed_point_p filter_costs)
+ {
+@@ -1351,7 +1344,7 @@
+ /* The internal API allocates all the arrays and ensures that the elements of
+ * those arrays are set to the default value.
+ */
+- if (!png_init_filter_heuristics(png_ptr, heuristic_method, num_weights))
++ if (png_init_filter_heuristics(png_ptr, heuristic_method, num_weights) == 0)
+ return;
+
+ /* If using the weighted method copy in the weights. */
+@@ -1405,40 +1398,40 @@
+ }
+ }
+ #endif /* FIXED_POINT */
+-#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
++#endif /* WRITE_WEIGHTED_FILTER */
+
+ void PNGAPI
+-png_set_compression_level(png_structp png_ptr, int level)
++png_set_compression_level(png_structrp png_ptr, int level)
+ {
+ png_debug(1, "in png_set_compression_level");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
+ png_ptr->zlib_level = level;
+ }
+
+ void PNGAPI
+-png_set_compression_mem_level(png_structp png_ptr, int mem_level)
++png_set_compression_mem_level(png_structrp png_ptr, int mem_level)
+ {
+ png_debug(1, "in png_set_compression_mem_level");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
+ png_ptr->zlib_mem_level = mem_level;
+ }
+
+ void PNGAPI
+-png_set_compression_strategy(png_structp png_ptr, int strategy)
++png_set_compression_strategy(png_structrp png_ptr, int strategy)
+ {
+ png_debug(1, "in png_set_compression_strategy");
+
+ if (png_ptr == NULL)
+ return;
+
++ /* The flag setting here prevents the libpng dynamic selection of strategy.
++ */
+ png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
+ png_ptr->zlib_strategy = strategy;
+ }
+@@ -1447,80 +1440,81 @@
+ * smaller value of window_bits if it can do so safely.
+ */
+ void PNGAPI
+-png_set_compression_window_bits(png_structp png_ptr, int window_bits)
++png_set_compression_window_bits(png_structrp png_ptr, int window_bits)
+ {
+ if (png_ptr == NULL)
+ return;
+
++ /* Prior to 1.6.0 this would warn but then set the window_bits value, this
++ * meant that negative window bits values could be selected which would cause
++ * libpng to write a non-standard PNG file with raw deflate or gzip
++ * compressed IDAT or ancillary chunks. Such files can be read and there is
++ * no warning on read, so this seems like a very bad idea.
++ */
+ if (window_bits > 15)
++ {
+ png_warning(png_ptr, "Only compression windows <= 32k supported by PNG");
++ window_bits = 15;
++ }
+
+ else if (window_bits < 8)
++ {
+ png_warning(png_ptr, "Only compression windows >= 256 supported by PNG");
++ window_bits = 8;
++ }
+
+-#ifndef WBITS_8_OK
+- /* Avoid libpng bug with 256-byte windows */
+- if (window_bits == 8)
+- {
+- png_warning(png_ptr, "Compression window is being reset to 512");
+- window_bits = 9;
+- }
+-
+-#endif
+- png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS;
+ png_ptr->zlib_window_bits = window_bits;
+ }
+
+ void PNGAPI
+-png_set_compression_method(png_structp png_ptr, int method)
++png_set_compression_method(png_structrp png_ptr, int method)
+ {
+ png_debug(1, "in png_set_compression_method");
+
+ if (png_ptr == NULL)
+ return;
+
++ /* This would produce an invalid PNG file if it worked, but it doesn't and
++ * deflate will fault it, so it is harmless to just warn here.
++ */
+ if (method != 8)
+ png_warning(png_ptr, "Only compression method 8 is supported by PNG");
+
+- png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD;
+ png_ptr->zlib_method = method;
+ }
+
+ /* The following were added to libpng-1.5.4 */
+ #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
+ void PNGAPI
+-png_set_text_compression_level(png_structp png_ptr, int level)
++png_set_text_compression_level(png_structrp png_ptr, int level)
+ {
+ png_debug(1, "in png_set_text_compression_level");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_LEVEL;
+ png_ptr->zlib_text_level = level;
+ }
+
+ void PNGAPI
+-png_set_text_compression_mem_level(png_structp png_ptr, int mem_level)
++png_set_text_compression_mem_level(png_structrp png_ptr, int mem_level)
+ {
+ png_debug(1, "in png_set_text_compression_mem_level");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL;
+ png_ptr->zlib_text_mem_level = mem_level;
+ }
+
+ void PNGAPI
+-png_set_text_compression_strategy(png_structp png_ptr, int strategy)
++png_set_text_compression_strategy(png_structrp png_ptr, int strategy)
+ {
+ png_debug(1, "in png_set_text_compression_strategy");
+
+ if (png_ptr == NULL)
+ return;
+
+- png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_STRATEGY;
+ png_ptr->zlib_text_strategy = strategy;
+ }
+
+@@ -1528,32 +1522,28 @@
+ * smaller value of window_bits if it can do so safely.
+ */
+ void PNGAPI
+-png_set_text_compression_window_bits(png_structp png_ptr, int window_bits)
++png_set_text_compression_window_bits(png_structrp png_ptr, int window_bits)
+ {
+ if (png_ptr == NULL)
+ return;
+
+ if (window_bits > 15)
++ {
+ png_warning(png_ptr, "Only compression windows <= 32k supported by PNG");
++ window_bits = 15;
++ }
+
+ else if (window_bits < 8)
++ {
+ png_warning(png_ptr, "Only compression windows >= 256 supported by PNG");
++ window_bits = 8;
++ }
+
+-#ifndef WBITS_8_OK
+- /* Avoid libpng bug with 256-byte windows */
+- if (window_bits == 8)
+- {
+- png_warning(png_ptr, "Text compression window is being reset to 512");
+- window_bits = 9;
+- }
+-
+-#endif
+- png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS;
+ png_ptr->zlib_text_window_bits = window_bits;
+ }
+
+ void PNGAPI
+-png_set_text_compression_method(png_structp png_ptr, int method)
++png_set_text_compression_method(png_structrp png_ptr, int method)
+ {
+ png_debug(1, "in png_set_text_compression_method");
+
+@@ -1563,14 +1553,13 @@
+ if (method != 8)
+ png_warning(png_ptr, "Only compression method 8 is supported by PNG");
+
+- png_ptr->flags |= PNG_FLAG_ZTXT_CUSTOM_METHOD;
+ png_ptr->zlib_text_method = method;
+ }
+-#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
++#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
+ /* end of API added to libpng-1.5.4 */
+
+ void PNGAPI
+-png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
++png_set_write_status_fn(png_structrp png_ptr, png_write_status_ptr write_row_fn)
+ {
+ if (png_ptr == NULL)
+ return;
+@@ -1580,7 +1569,7 @@
+
+ #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+ void PNGAPI
+-png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
++png_set_write_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr
+ write_user_transform_fn)
+ {
+ png_debug(1, "in png_set_write_user_transform_fn");
+@@ -1596,88 +1585,899 @@
+
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
+ void PNGAPI
+-png_write_png(png_structp png_ptr, png_infop info_ptr,
++png_write_png(png_structrp png_ptr, png_inforp info_ptr,
+ int transforms, voidp params)
+ {
+ if (png_ptr == NULL || info_ptr == NULL)
+ return;
+
++ if ((info_ptr->valid & PNG_INFO_IDAT) == 0)
++ {
++ png_app_error(png_ptr, "no rows for png_write_image to write");
++ return;
++ }
++
+ /* Write the file header information. */
+ png_write_info(png_ptr, info_ptr);
+
+ /* ------ these transformations don't touch the info structure ------- */
+
++ /* Invert monochrome pixels */
++ if ((transforms & PNG_TRANSFORM_INVERT_MONO) != 0)
+ #ifdef PNG_WRITE_INVERT_SUPPORTED
+- /* Invert monochrome pixels */
+- if (transforms & PNG_TRANSFORM_INVERT_MONO)
+ png_set_invert_mono(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_MONO not supported");
+ #endif
+
+-#ifdef PNG_WRITE_SHIFT_SUPPORTED
+ /* Shift the pixels up to a legal bit depth and fill in
+ * as appropriate to correctly scale the image.
+ */
+- if ((transforms & PNG_TRANSFORM_SHIFT)
+- && (info_ptr->valid & PNG_INFO_sBIT))
+- png_set_shift(png_ptr, &info_ptr->sig_bit);
++ if ((transforms & PNG_TRANSFORM_SHIFT) != 0)
++#ifdef PNG_WRITE_SHIFT_SUPPORTED
++ if ((info_ptr->valid & PNG_INFO_sBIT) != 0)
++ png_set_shift(png_ptr, &info_ptr->sig_bit);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SHIFT not supported");
+ #endif
+
++ /* Pack pixels into bytes */
++ if ((transforms & PNG_TRANSFORM_PACKING) != 0)
+ #ifdef PNG_WRITE_PACK_SUPPORTED
+- /* Pack pixels into bytes */
+- if (transforms & PNG_TRANSFORM_PACKING)
+- png_set_packing(png_ptr);
++ png_set_packing(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_PACKING not supported");
+ #endif
+
++ /* Swap location of alpha bytes from ARGB to RGBA */
++ if ((transforms & PNG_TRANSFORM_SWAP_ALPHA) != 0)
+ #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+- /* Swap location of alpha bytes from ARGB to RGBA */
+- if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
+ png_set_swap_alpha(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ALPHA not supported");
+ #endif
+
++ /* Remove a filler (X) from XRGB/RGBX/AG/GA into to convert it into
++ * RGB, note that the code expects the input color type to be G or RGB; no
++ * alpha channel.
++ */
++ if ((transforms & (PNG_TRANSFORM_STRIP_FILLER_AFTER|
++ PNG_TRANSFORM_STRIP_FILLER_BEFORE)) != 0)
++ {
+ #ifdef PNG_WRITE_FILLER_SUPPORTED
+- /* Pack XRGB/RGBX/ARGB/RGBA into RGB (4 channels -> 3 channels) */
+- if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
+- png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
++ if ((transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) != 0)
++ {
++ if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
++ png_app_error(png_ptr,
++ "PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported");
+
+- else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
+- png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
++ /* Continue if ignored - this is the pre-1.6.10 behavior */
++ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
++ }
++
++ else if ((transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) != 0)
++ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_STRIP_FILLER not supported");
++#endif
++ }
++
++ /* Flip BGR pixels to RGB */
++ if ((transforms & PNG_TRANSFORM_BGR) != 0)
++#ifdef PNG_WRITE_BGR_SUPPORTED
++ png_set_bgr(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_BGR not supported");
+ #endif
+
+-#ifdef PNG_WRITE_BGR_SUPPORTED
+- /* Flip BGR pixels to RGB */
+- if (transforms & PNG_TRANSFORM_BGR)
+- png_set_bgr(png_ptr);
++ /* Swap bytes of 16-bit files to most significant byte first */
++ if ((transforms & PNG_TRANSFORM_SWAP_ENDIAN) != 0)
++#ifdef PNG_WRITE_SWAP_SUPPORTED
++ png_set_swap(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_SWAP_ENDIAN not supported");
+ #endif
+
+-#ifdef PNG_WRITE_SWAP_SUPPORTED
+- /* Swap bytes of 16-bit files to most significant byte first */
+- if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
+- png_set_swap(png_ptr);
++ /* Swap bits of 1, 2, 4 bit packed pixel formats */
++ if ((transforms & PNG_TRANSFORM_PACKSWAP) != 0)
++#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
++ png_set_packswap(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_PACKSWAP not supported");
+ #endif
+
+-#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
+- /* Swap bits of 1, 2, 4 bit packed pixel formats */
+- if (transforms & PNG_TRANSFORM_PACKSWAP)
+- png_set_packswap(png_ptr);
+-#endif
+-
++ /* Invert the alpha channel from opacity to transparency */
++ if ((transforms & PNG_TRANSFORM_INVERT_ALPHA) != 0)
+ #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+- /* Invert the alpha channel from opacity to transparency */
+- if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
++#else
++ png_app_error(png_ptr, "PNG_TRANSFORM_INVERT_ALPHA not supported");
+ #endif
+
+ /* ----------------------- end of transformations ------------------- */
+
+ /* Write the bits */
+- if (info_ptr->valid & PNG_INFO_IDAT)
+- png_write_image(png_ptr, info_ptr->row_pointers);
++ png_write_image(png_ptr, info_ptr->row_pointers);
+
+ /* It is REQUIRED to call this to finish writing the rest of the file */
+ png_write_end(png_ptr, info_ptr);
+
+- PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
+ }
+ #endif
+-#endif /* PNG_WRITE_SUPPORTED */
++
++
++#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
++#ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
++/* Initialize the write structure - general purpose utility. */
++static int
++png_image_write_init(png_imagep image)
++{
++ png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, image,
++ png_safe_error, png_safe_warning);
++
++ if (png_ptr != NULL)
++ {
++ png_infop info_ptr = png_create_info_struct(png_ptr);
++
++ if (info_ptr != NULL)
++ {
++ png_controlp control = png_voidcast(png_controlp,
++ png_malloc_warn(png_ptr, (sizeof *control)));
++
++ if (control != NULL)
++ {
++ memset(control, 0, (sizeof *control));
++
++ control->png_ptr = png_ptr;
++ control->info_ptr = info_ptr;
++ control->for_write = 1;
++
++ image->opaque = control;
++ return 1;
++ }
++
++ /* Error clean up */
++ png_destroy_info_struct(png_ptr, &info_ptr);
++ }
++
++ png_destroy_write_struct(&png_ptr, NULL);
++ }
++
++ return png_image_error(image, "png_image_write_: out of memory");
++}
++
++/* Arguments to png_image_write_main: */
++typedef struct
++{
++ /* Arguments: */
++ png_imagep image;
++ png_const_voidp buffer;
++ png_int_32 row_stride;
++ png_const_voidp colormap;
++ int convert_to_8bit;
++ /* Local variables: */
++ png_const_voidp first_row;
++ ptrdiff_t row_bytes;
++ png_voidp local_row;
++} png_image_write_control;
++
++/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
++ * do any necessary byte swapping. The component order is defined by the
++ * png_image format value.
++ */
++static int
++png_write_image_16bit(png_voidp argument)
++{
++ png_image_write_control *display = png_voidcast(png_image_write_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++
++ png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
++ display->first_row);
++ png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
++ png_uint_16p row_end;
++ const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
++ int aindex = 0;
++ png_uint_32 y = image->height;
++
++ if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
++ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ {
++ aindex = -1;
++ ++input_row; /* To point to the first component */
++ ++output_row;
++ }
++
++ else
++# endif
++ aindex = channels;
++ }
++
++ else
++ png_error(png_ptr, "png_write_image: internal call error");
++
++ /* Work out the output row end and count over this, note that the increment
++ * above to 'row' means that row_end can actually be beyond the end of the
++ * row; this is correct.
++ */
++ row_end = output_row + image->width * (channels+1);
++
++ while (y-- > 0)
++ {
++ png_const_uint_16p in_ptr = input_row;
++ png_uint_16p out_ptr = output_row;
++
++ while (out_ptr < row_end)
++ {
++ const png_uint_16 alpha = in_ptr[aindex];
++ png_uint_32 reciprocal = 0;
++ int c;
++
++ out_ptr[aindex] = alpha;
++
++ /* Calculate a reciprocal. The correct calculation is simply
++ * component/alpha*65535 << 15. (I.e. 15 bits of precision); this
++ * allows correct rounding by adding .5 before the shift. 'reciprocal'
++ * is only initialized when required.
++ */
++ if (alpha > 0 && alpha < 65535)
++ reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
++
++ c = channels;
++ do /* always at least one channel */
++ {
++ png_uint_16 component = *in_ptr++;
++
++ /* The following gives 65535 for an alpha of 0, which is fine,
++ * otherwise if 0/0 is represented as some other value there is more
++ * likely to be a discontinuity which will probably damage
++ * compression when moving from a fully transparent area to a
++ * nearly transparent one. (The assumption here is that opaque
++ * areas tend not to be 0 intensity.)
++ */
++ if (component >= alpha)
++ component = 65535;
++
++ /* component<alpha, so component/alpha is less than one and
++ * component*reciprocal is less than 2^31.
++ */
++ else if (component > 0 && alpha < 65535)
++ {
++ png_uint_32 calc = component * reciprocal;
++ calc += 16384; /* round to nearest */
++ component = (png_uint_16)(calc >> 15);
++ }
++
++ *out_ptr++ = component;
++ }
++ while (--c > 0);
++
++ /* Skip to next component (skip the intervening alpha channel) */
++ ++in_ptr;
++ ++out_ptr;
++ }
++
++ png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
++ input_row += display->row_bytes/(sizeof (png_uint_16));
++ }
++
++ return 1;
++}
++
++/* Given 16-bit input (1 to 4 channels) write 8-bit output. If an alpha channel
++ * is present it must be removed from the components, the components are then
++ * written in sRGB encoding. No components are added or removed.
++ *
++ * Calculate an alpha reciprocal to reverse pre-multiplication. As above the
++ * calculation can be done to 15 bits of accuracy; however, the output needs to
++ * be scaled in the range 0..255*65535, so include that scaling here.
++ */
++#define UNP_RECIPROCAL(alpha) ((((0xffff*0xff)<<7)+(alpha>>1))/alpha)
++
++static png_byte
++png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
++ png_uint_32 reciprocal/*from the above macro*/)
++{
++ /* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0
++ * is represented as some other value there is more likely to be a
++ * discontinuity which will probably damage compression when moving from a
++ * fully transparent area to a nearly transparent one. (The assumption here
++ * is that opaque areas tend not to be 0 intensity.)
++ *
++ * There is a rounding problem here; if alpha is less than 128 it will end up
++ * as 0 when scaled to 8 bits. To avoid introducing spurious colors into the
++ * output change for this too.
++ */
++ if (component >= alpha || alpha < 128)
++ return 255;
++
++ /* component<alpha, so component/alpha is less than one and
++ * component*reciprocal is less than 2^31.
++ */
++ else if (component > 0)
++ {
++ /* The test is that alpha/257 (rounded) is less than 255, the first value
++ * that becomes 255 is 65407.
++ * NOTE: this must agree with the PNG_DIV257 macro (which must, therefore,
++ * be exact!) [Could also test reciprocal != 0]
++ */
++ if (alpha < 65407)
++ {
++ component *= reciprocal;
++ component += 64; /* round to nearest */
++ component >>= 7;
++ }
++
++ else
++ component *= 255;
++
++ /* Convert the component to sRGB. */
++ return (png_byte)PNG_sRGB_FROM_LINEAR(component);
++ }
++
++ else
++ return 0;
++}
++
++static int
++png_write_image_8bit(png_voidp argument)
++{
++ png_image_write_control *display = png_voidcast(png_image_write_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++
++ png_const_uint_16p input_row = png_voidcast(png_const_uint_16p,
++ display->first_row);
++ png_bytep output_row = png_voidcast(png_bytep, display->local_row);
++ png_uint_32 y = image->height;
++ const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
++
++ if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ {
++ png_bytep row_end;
++ int aindex;
++
++# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
++ if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ {
++ aindex = -1;
++ ++input_row; /* To point to the first component */
++ ++output_row;
++ }
++
++ else
++# endif
++ aindex = channels;
++
++ /* Use row_end in place of a loop counter: */
++ row_end = output_row + image->width * (channels+1);
++
++ while (y-- > 0)
++ {
++ png_const_uint_16p in_ptr = input_row;
++ png_bytep out_ptr = output_row;
++
++ while (out_ptr < row_end)
++ {
++ png_uint_16 alpha = in_ptr[aindex];
++ png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
++ png_uint_32 reciprocal = 0;
++ int c;
++
++ /* Scale and write the alpha channel. */
++ out_ptr[aindex] = alphabyte;
++
++ if (alphabyte > 0 && alphabyte < 255)
++ reciprocal = UNP_RECIPROCAL(alpha);
++
++ c = channels;
++ do /* always at least one channel */
++ *out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
++ while (--c > 0);
++
++ /* Skip to next component (skip the intervening alpha channel) */
++ ++in_ptr;
++ ++out_ptr;
++ } /* while out_ptr < row_end */
++
++ png_write_row(png_ptr, png_voidcast(png_const_bytep,
++ display->local_row));
++ input_row += display->row_bytes/(sizeof (png_uint_16));
++ } /* while y */
++ }
++
++ else
++ {
++ /* No alpha channel, so the row_end really is the end of the row and it
++ * is sufficient to loop over the components one by one.
++ */
++ png_bytep row_end = output_row + image->width * channels;
++
++ while (y-- > 0)
++ {
++ png_const_uint_16p in_ptr = input_row;
++ png_bytep out_ptr = output_row;
++
++ while (out_ptr < row_end)
++ {
++ png_uint_32 component = *in_ptr++;
++
++ component *= 255;
++ *out_ptr++ = (png_byte)PNG_sRGB_FROM_LINEAR(component);
++ }
++
++ png_write_row(png_ptr, output_row);
++ input_row += display->row_bytes/(sizeof (png_uint_16));
++ }
++ }
++
++ return 1;
++}
++
++static void
++png_image_set_PLTE(png_image_write_control *display)
++{
++ const png_imagep image = display->image;
++ const void *cmap = display->colormap;
++ const int entries = image->colormap_entries > 256 ? 256 :
++ (int)image->colormap_entries;
++
++ /* NOTE: the caller must check for cmap != NULL and entries != 0 */
++ const png_uint_32 format = image->format;
++ const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
++
++# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
++ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
++ const int afirst = (format & PNG_FORMAT_FLAG_AFIRST) != 0 &&
++ (format & PNG_FORMAT_FLAG_ALPHA) != 0;
++# else
++# define afirst 0
++# endif
++
++# ifdef PNG_FORMAT_BGR_SUPPORTED
++ const int bgr = (format & PNG_FORMAT_FLAG_BGR) != 0 ? 2 : 0;
++# else
++# define bgr 0
++# endif
++
++ int i, num_trans;
++ png_color palette[256];
++ png_byte tRNS[256];
++
++ memset(tRNS, 255, (sizeof tRNS));
++ memset(palette, 0, (sizeof palette));
++
++ for (i=num_trans=0; i<entries; ++i)
++ {
++ /* This gets automatically converted to sRGB with reversal of the
++ * pre-multiplication if the color-map has an alpha channel.
++ */
++ if ((format & PNG_FORMAT_FLAG_LINEAR) != 0)
++ {
++ png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
++
++ entry += i * channels;
++
++ if ((channels & 1) != 0) /* no alpha */
++ {
++ if (channels >= 3) /* RGB */
++ {
++ palette[i].blue = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
++ entry[(2 ^ bgr)]);
++ palette[i].green = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
++ entry[1]);
++ palette[i].red = (png_byte)PNG_sRGB_FROM_LINEAR(255 *
++ entry[bgr]);
++ }
++
++ else /* Gray */
++ palette[i].blue = palette[i].red = palette[i].green =
++ (png_byte)PNG_sRGB_FROM_LINEAR(255 * *entry);
++ }
++
++ else /* alpha */
++ {
++ png_uint_16 alpha = entry[afirst ? 0 : channels-1];
++ png_byte alphabyte = (png_byte)PNG_DIV257(alpha);
++ png_uint_32 reciprocal = 0;
++
++ /* Calculate a reciprocal, as in the png_write_image_8bit code above
++ * this is designed to produce a value scaled to 255*65535 when
++ * divided by 128 (i.e. asr 7).
++ */
++ if (alphabyte > 0 && alphabyte < 255)
++ reciprocal = (((0xffff*0xff)<<7)+(alpha>>1))/alpha;
++
++ tRNS[i] = alphabyte;
++ if (alphabyte < 255)
++ num_trans = i+1;
++
++ if (channels >= 3) /* RGB */
++ {
++ palette[i].blue = png_unpremultiply(entry[afirst + (2 ^ bgr)],
++ alpha, reciprocal);
++ palette[i].green = png_unpremultiply(entry[afirst + 1], alpha,
++ reciprocal);
++ palette[i].red = png_unpremultiply(entry[afirst + bgr], alpha,
++ reciprocal);
++ }
++
++ else /* gray */
++ palette[i].blue = palette[i].red = palette[i].green =
++ png_unpremultiply(entry[afirst], alpha, reciprocal);
++ }
++ }
++
++ else /* Color-map has sRGB values */
++ {
++ png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
++
++ entry += i * channels;
++
++ switch (channels)
++ {
++ case 4:
++ tRNS[i] = entry[afirst ? 0 : 3];
++ if (tRNS[i] < 255)
++ num_trans = i+1;
++ /* FALL THROUGH */
++ case 3:
++ palette[i].blue = entry[afirst + (2 ^ bgr)];
++ palette[i].green = entry[afirst + 1];
++ palette[i].red = entry[afirst + bgr];
++ break;
++
++ case 2:
++ tRNS[i] = entry[1 ^ afirst];
++ if (tRNS[i] < 255)
++ num_trans = i+1;
++ /* FALL THROUGH */
++ case 1:
++ palette[i].blue = palette[i].red = palette[i].green =
++ entry[afirst];
++ break;
++
++ default:
++ break;
++ }
++ }
++ }
++
++# ifdef afirst
++# undef afirst
++# endif
++# ifdef bgr
++# undef bgr
++# endif
++
++ png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
++ entries);
++
++ if (num_trans > 0)
++ png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
++ num_trans, NULL);
++
++ image->colormap_entries = entries;
++}
++
++static int
++png_image_write_main(png_voidp argument)
++{
++ png_image_write_control *display = png_voidcast(png_image_write_control*,
++ argument);
++ png_imagep image = display->image;
++ png_structrp png_ptr = image->opaque->png_ptr;
++ png_inforp info_ptr = image->opaque->info_ptr;
++ png_uint_32 format = image->format;
++
++ /* The following four ints are actually booleans */
++ int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
++ int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
++ int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
++ int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
++
++# ifdef PNG_BENIGN_ERRORS_SUPPORTED
++ /* Make sure we error out on any bad situation */
++ png_set_benign_errors(png_ptr, 0/*error*/);
++# endif
++
++ /* Default the 'row_stride' parameter if required. */
++ if (display->row_stride == 0)
++ display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
++
++ /* Set the required transforms then write the rows in the correct order. */
++ if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
++ {
++ if (display->colormap != NULL && image->colormap_entries > 0)
++ {
++ png_uint_32 entries = image->colormap_entries;
++
++ png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
++ entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
++ PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
++ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++
++ png_image_set_PLTE(display);
++ }
++
++ else
++ png_error(image->opaque->png_ptr,
++ "no color-map for color-mapped image");
++ }
++
++ else
++ png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
++ write_16bit ? 16 : 8,
++ ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
++ ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
++ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++
++ /* Counter-intuitively the data transformations must be called *after*
++ * png_write_info, not before as in the read code, but the 'set' functions
++ * must still be called before. Just set the color space information, never
++ * write an interlaced image.
++ */
++
++ if (write_16bit != 0)
++ {
++ /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
++ png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
++
++ if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
++ png_set_cHRM_fixed(png_ptr, info_ptr,
++ /* color x y */
++ /* white */ 31270, 32900,
++ /* red */ 64000, 33000,
++ /* green */ 30000, 60000,
++ /* blue */ 15000, 6000
++ );
++ }
++
++ else if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
++ png_set_sRGB(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
++
++ /* Else writing an 8-bit file and the *colors* aren't sRGB, but the 8-bit
++ * space must still be gamma encoded.
++ */
++ else
++ png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
++
++ /* Write the file header. */
++ png_write_info(png_ptr, info_ptr);
++
++ /* Now set up the data transformations (*after* the header is written),
++ * remove the handled transformations from the 'format' flags for checking.
++ *
++ * First check for a little endian system if writing 16 bit files.
++ */
++ if (write_16bit != 0)
++ {
++ PNG_CONST png_uint_16 le = 0x0001;
++
++ if ((*(png_const_bytep) & le) != 0)
++ png_set_swap(png_ptr);
++ }
++
++# ifdef PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
++ if ((format & PNG_FORMAT_FLAG_BGR) != 0)
++ {
++ if (colormap == 0 && (format & PNG_FORMAT_FLAG_COLOR) != 0)
++ png_set_bgr(png_ptr);
++ format &= ~PNG_FORMAT_FLAG_BGR;
++ }
++# endif
++
++# ifdef PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
++ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
++ {
++ if (colormap == 0 && (format & PNG_FORMAT_FLAG_ALPHA) != 0)
++ png_set_swap_alpha(png_ptr);
++ format &= ~PNG_FORMAT_FLAG_AFIRST;
++ }
++# endif
++
++ /* If there are 16 or fewer color-map entries we wrote a lower bit depth
++ * above, but the application data is still byte packed.
++ */
++ if (colormap != 0 && image->colormap_entries <= 16)
++ png_set_packing(png_ptr);
++
++ /* That should have handled all (both) the transforms. */
++ if ((format & ~(png_uint_32)(PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_LINEAR |
++ PNG_FORMAT_FLAG_ALPHA | PNG_FORMAT_FLAG_COLORMAP)) != 0)
++ png_error(png_ptr, "png_write_image: unsupported transformation");
++
++ {
++ png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
++ ptrdiff_t row_bytes = display->row_stride;
++
++ if (linear != 0)
++ row_bytes *= (sizeof (png_uint_16));
++
++ if (row_bytes < 0)
++ row += (image->height-1) * (-row_bytes);
++
++ display->first_row = row;
++ display->row_bytes = row_bytes;
++ }
++
++ /* Apply 'fast' options if the flag is set. */
++ if ((image->flags & PNG_IMAGE_FLAG_FAST) != 0)
++ {
++ png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS);
++ /* NOTE: determined by experiment using pngstest, this reflects some
++ * balance between the time to write the image once and the time to read
++ * it about 50 times. The speed-up in pngstest was about 10-20% of the
++ * total (user) time on a heavily loaded system.
++ */
++ png_set_compression_level(png_ptr, 3);
++ }
++
++ /* Check for the cases that currently require a pre-transform on the row
++ * before it is written. This only applies when the input is 16-bit and
++ * either there is an alpha channel or it is converted to 8-bit.
++ */
++ if ((linear != 0 && alpha != 0 ) ||
++ (colormap == 0 && display->convert_to_8bit != 0))
++ {
++ png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
++ png_get_rowbytes(png_ptr, info_ptr)));
++ int result;
++
++ display->local_row = row;
++ if (write_16bit != 0)
++ result = png_safe_execute(image, png_write_image_16bit, display);
++ else
++ result = png_safe_execute(image, png_write_image_8bit, display);
++ display->local_row = NULL;
++
++ png_free(png_ptr, row);
++
++ /* Skip the 'write_end' on error: */
++ if (result == 0)
++ return 0;
++ }
++
++ /* Otherwise this is the case where the input is in a format currently
++ * supported by the rest of the libpng write code; call it directly.
++ */
++ else
++ {
++ png_const_bytep row = png_voidcast(png_const_bytep, display->first_row);
++ ptrdiff_t row_bytes = display->row_bytes;
++ png_uint_32 y = image->height;
++
++ while (y-- > 0)
++ {
++ png_write_row(png_ptr, row);
++ row += row_bytes;
++ }
++ }
++
++ png_write_end(png_ptr, info_ptr);
++ return 1;
++}
++
++int PNGAPI
++png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
++ const void *buffer, png_int_32 row_stride, const void *colormap)
++{
++ /* Write the image to the given (FILE*). */
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ if (file != NULL)
++ {
++ if (png_image_write_init(image) != 0)
++ {
++ png_image_write_control display;
++ int result;
++
++ /* This is slightly evil, but png_init_io doesn't do anything other
++ * than this and we haven't changed the standard IO functions so
++ * this saves a 'safe' function.
++ */
++ image->opaque->png_ptr->io_ptr = file;
++
++ memset(&display, 0, (sizeof display));
++ display.image = image;
++ display.buffer = buffer;
++ display.row_stride = row_stride;
++ display.colormap = colormap;
++ display.convert_to_8bit = convert_to_8bit;
++
++ result = png_safe_execute(image, png_image_write_main, &display);
++ png_image_free(image);
++ return result;
++ }
++
++ else
++ return 0;
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_write_to_stdio: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
++
++ else
++ return 0;
++}
++
++int PNGAPI
++png_image_write_to_file(png_imagep image, const char *file_name,
++ int convert_to_8bit, const void *buffer, png_int_32 row_stride,
++ const void *colormap)
++{
++ /* Write the image to the named file. */
++ if (image != NULL && image->version == PNG_IMAGE_VERSION)
++ {
++ if (file_name != NULL)
++ {
++ FILE *fp = fopen(file_name, "wb");
++
++ if (fp != NULL)
++ {
++ if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer,
++ row_stride, colormap) != 0)
++ {
++ int error; /* from fflush/fclose */
++
++ /* Make sure the file is flushed correctly. */
++ if (fflush(fp) == 0 && ferror(fp) == 0)
++ {
++ if (fclose(fp) == 0)
++ return 1;
++
++ error = errno; /* from fclose */
++ }
++
++ else
++ {
++ error = errno; /* from fflush or ferror */
++ (void)fclose(fp);
++ }
++
++ (void)remove(file_name);
++ /* The image has already been cleaned up; this is just used to
++ * set the error (because the original write succeeded).
++ */
++ return png_image_error(image, strerror(error));
++ }
++
++ else
++ {
++ /* Clean up: just the opened file. */
++ (void)fclose(fp);
++ (void)remove(file_name);
++ return 0;
++ }
++ }
++
++ else
++ return png_image_error(image, strerror(errno));
++ }
++
++ else
++ return png_image_error(image,
++ "png_image_write_to_file: invalid argument");
++ }
++
++ else if (image != NULL)
++ return png_image_error(image,
++ "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
++
++ else
++ return 0;
++}
++#endif /* STDIO */
++#endif /* SIMPLIFIED_WRITE */
++#endif /* WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngwtran.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngwtran.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -42,90 +42,14 @@
+ #include "pngpriv.h"
+
+ #ifdef PNG_WRITE_SUPPORTED
+-
+ #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
+-/* Transform the data according to the user's wishes. The order of
+- * transformations is significant.
+- */
+-void /* PRIVATE */
+-png_do_write_transformations(png_structp png_ptr)
+-{
+- png_debug(1, "in png_do_write_transformations");
+-
+- if (png_ptr == NULL)
+- return;
+-
+-#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+- if (png_ptr->transformations & PNG_USER_TRANSFORM)
+- if (png_ptr->write_user_transform_fn != NULL)
+- (*(png_ptr->write_user_transform_fn)) /* User write transform
+- function */
+- (png_ptr, /* png_ptr */
+- &(png_ptr->row_info), /* row_info: */
+- /* png_uint_32 width; width of row */
+- /* png_size_t rowbytes; number of bytes in row */
+- /* png_byte color_type; color type of pixels */
+- /* png_byte bit_depth; bit depth of samples */
+- /* png_byte channels; number of channels (1-4) */
+- /* png_byte pixel_depth; bits per pixel (depth*channels) */
+- png_ptr->row_buf + 1); /* start of pixel data for row */
+-#endif
+-
+-#ifdef PNG_WRITE_FILLER_SUPPORTED
+- if (png_ptr->transformations & PNG_FILLER)
+- png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
+-#endif
+-
+-#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_PACKSWAP)
+- png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_WRITE_PACK_SUPPORTED
+- if (png_ptr->transformations & PNG_PACK)
+- png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- (png_uint_32)png_ptr->bit_depth);
+-#endif
+-
+-#ifdef PNG_WRITE_SWAP_SUPPORTED
+- if (png_ptr->transformations & PNG_SWAP_BYTES)
+- png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_WRITE_SHIFT_SUPPORTED
+- if (png_ptr->transformations & PNG_SHIFT)
+- png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
+- &(png_ptr->shift));
+-#endif
+-
+-#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_SWAP_ALPHA)
+- png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+- if (png_ptr->transformations & PNG_INVERT_ALPHA)
+- png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_WRITE_BGR_SUPPORTED
+- if (png_ptr->transformations & PNG_BGR)
+- png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-
+-#ifdef PNG_WRITE_INVERT_SUPPORTED
+- if (png_ptr->transformations & PNG_INVERT_MONO)
+- png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
+-#endif
+-}
+
+ #ifdef PNG_WRITE_PACK_SUPPORTED
+ /* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
+ * row_info bit depth should be 8 (one pixel per byte). The channels
+ * should be 1 (this only happens on grayscale and paletted images).
+ */
+-void /* PRIVATE */
++static void
+ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
+ {
+ png_debug(1, "in png_do_pack");
+@@ -270,7 +194,7 @@
+ * would pass 3 as bit_depth, and this routine would translate the
+ * data to 0 to 15.
+ */
+-void /* PRIVATE */
++static void
+ png_do_shift(png_row_infop row_info, png_bytep row,
+ png_const_color_8p bit_depth)
+ {
+@@ -281,7 +205,7 @@
+ int shift_start[4], shift_dec[4];
+ int channels = 0;
+
+- if (row_info->color_type & PNG_COLOR_MASK_COLOR)
++ if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ shift_start[channels] = row_info->bit_depth - bit_depth->red;
+ shift_dec[channels] = bit_depth->red;
+@@ -303,7 +227,7 @@
+ channels++;
+ }
+
+- if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
++ if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ {
+ shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
+ shift_dec[channels] = bit_depth->alpha;
+@@ -315,7 +239,7 @@
+ {
+ png_bytep bp = row;
+ png_size_t i;
+- png_byte mask;
++ unsigned int mask;
+ png_size_t row_bytes = row_info->rowbytes;
+
+ if (bit_depth->gray == 1 && row_info->bit_depth == 2)
+@@ -329,20 +253,22 @@
+
+ for (i = 0; i < row_bytes; i++, bp++)
+ {
+- png_uint_16 v;
+ int j;
++ unsigned int v, out;
+
+ v = *bp;
+- *bp = 0;
++ out = 0;
+
+ for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
+ {
+ if (j > 0)
+- *bp |= (png_byte)((v << j) & 0xff);
++ out |= v << j;
+
+ else
+- *bp |= (png_byte)((v >> (-j)) & mask);
++ out |= (v >> (-j)) & mask;
+ }
++
++ *bp = (png_byte)(out & 0xff);
+ }
+ }
+
+@@ -355,21 +281,23 @@
+ for (i = 0; i < istop; i++, bp++)
+ {
+
+- png_uint_16 v;
++ const unsigned int c = i%channels;
+ int j;
+- int c = (int)(i%channels);
++ unsigned int v, out;
+
+ v = *bp;
+- *bp = 0;
++ out = 0;
+
+ for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
+ {
+ if (j > 0)
+- *bp |= (png_byte)((v << j) & 0xff);
++ out |= v << j;
+
+ else
+- *bp |= (png_byte)((v >> (-j)) & 0xff);
++ out |= v >> (-j);
+ }
++
++ *bp = (png_byte)(out & 0xff);
+ }
+ }
+
+@@ -381,22 +309,22 @@
+
+ for (bp = row, i = 0; i < istop; i++)
+ {
+- int c = (int)(i%channels);
+- png_uint_16 value, v;
++ const unsigned int c = i%channels;
+ int j;
++ unsigned int value, v;
+
+- v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
++ v = png_get_uint_16(bp);
+ value = 0;
+
+ for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
+ {
+ if (j > 0)
+- value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
++ value |= v << j;
+
+ else
+- value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
++ value |= v >> (-j);
+ }
+- *bp++ = (png_byte)(value >> 8);
++ *bp++ = (png_byte)((value >> 8) & 0xff);
+ *bp++ = (png_byte)(value & 0xff);
+ }
+ }
+@@ -405,7 +333,7 @@
+ #endif
+
+ #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+-void /* PRIVATE */
++static void
+ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
+ {
+ png_debug(1, "in png_do_write_swap_alpha");
+@@ -453,7 +381,7 @@
+ *(dp++) = save[1];
+ }
+ }
+-#endif /* PNG_WRITE_16BIT_SUPPORTED */
++#endif /* WRITE_16BIT */
+ }
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+@@ -492,14 +420,14 @@
+ *(dp++) = save[1];
+ }
+ }
+-#endif /* PNG_WRITE_16BIT_SUPPORTED */
++#endif /* WRITE_16BIT */
+ }
+ }
+ }
+ #endif
+
+ #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+-void /* PRIVATE */
++static void
+ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
+ {
+ png_debug(1, "in png_do_write_invert_alpha");
+@@ -549,7 +477,7 @@
+ *(dp++) = (png_byte)(255 - *(sp++));
+ }
+ }
+-#endif /* PNG_WRITE_16BIT_SUPPORTED */
++#endif /* WRITE_16BIT */
+ }
+
+ else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+@@ -587,75 +515,88 @@
+ *(dp++) = (png_byte)(255 - *(sp++));
+ }
+ }
+-#endif /* PNG_WRITE_16BIT_SUPPORTED */
++#endif /* WRITE_16BIT */
+ }
+ }
+ }
+ #endif
+-#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
+
+-#ifdef PNG_MNG_FEATURES_SUPPORTED
+-/* Undoes intrapixel differencing */
++/* Transform the data according to the user's wishes. The order of
++ * transformations is significant.
++ */
+ void /* PRIVATE */
+-png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
++png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
+ {
+- png_debug(1, "in png_do_write_intrapixel");
++ png_debug(1, "in png_do_write_transformations");
+
+- if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
+- {
+- int bytes_per_pixel;
+- png_uint_32 row_width = row_info->width;
+- if (row_info->bit_depth == 8)
+- {
+- png_bytep rp;
+- png_uint_32 i;
++ if (png_ptr == NULL)
++ return;
+
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+- bytes_per_pixel = 3;
++#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
++ if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
++ if (png_ptr->write_user_transform_fn != NULL)
++ (*(png_ptr->write_user_transform_fn)) /* User write transform
++ function */
++ (png_ptr, /* png_ptr */
++ row_info, /* row_info: */
++ /* png_uint_32 width; width of row */
++ /* png_size_t rowbytes; number of bytes in row */
++ /* png_byte color_type; color type of pixels */
++ /* png_byte bit_depth; bit depth of samples */
++ /* png_byte channels; number of channels (1-4) */
++ /* png_byte pixel_depth; bits per pixel (depth*channels) */
++ png_ptr->row_buf + 1); /* start of pixel data for row */
++#endif
+
+- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- bytes_per_pixel = 4;
++#ifdef PNG_WRITE_FILLER_SUPPORTED
++ if ((png_ptr->transformations & PNG_FILLER) != 0)
++ png_do_strip_channel(row_info, png_ptr->row_buf + 1,
++ !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
++#endif
+
+- else
+- return;
++#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
++ png_do_packswap(row_info, png_ptr->row_buf + 1);
++#endif
+
+- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+- {
+- *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
+- *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
+- }
+- }
++#ifdef PNG_WRITE_PACK_SUPPORTED
++ if ((png_ptr->transformations & PNG_PACK) != 0)
++ png_do_pack(row_info, png_ptr->row_buf + 1,
++ (png_uint_32)png_ptr->bit_depth);
++#endif
+
+-#ifdef PNG_WRITE_16BIT_SUPPORTED
+- else if (row_info->bit_depth == 16)
+- {
+- png_bytep rp;
+- png_uint_32 i;
++#ifdef PNG_WRITE_SWAP_SUPPORTED
++# ifdef PNG_16BIT_SUPPORTED
++ if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
++ png_do_swap(row_info, png_ptr->row_buf + 1);
++# endif
++#endif
+
+- if (row_info->color_type == PNG_COLOR_TYPE_RGB)
+- bytes_per_pixel = 6;
++#ifdef PNG_WRITE_SHIFT_SUPPORTED
++ if ((png_ptr->transformations & PNG_SHIFT) != 0)
++ png_do_shift(row_info, png_ptr->row_buf + 1,
++ &(png_ptr->shift));
++#endif
+
+- else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+- bytes_per_pixel = 8;
++#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
++ png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
++#endif
+
+- else
+- return;
++#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
++ if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
++ png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
++#endif
+
+- for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
+- {
+- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
+- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
+- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+- png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
+- png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
+- *(rp ) = (png_byte)((red >> 8) & 0xff);
+- *(rp + 1) = (png_byte)(red & 0xff);
+- *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
+- *(rp + 5) = (png_byte)(blue & 0xff);
+- }
+- }
+-#endif /* PNG_WRITE_16BIT_SUPPORTED */
+- }
++#ifdef PNG_WRITE_BGR_SUPPORTED
++ if ((png_ptr->transformations & PNG_BGR) != 0)
++ png_do_bgr(row_info, png_ptr->row_buf + 1);
++#endif
++
++#ifdef PNG_WRITE_INVERT_SUPPORTED
++ if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
++ png_do_invert(row_info, png_ptr->row_buf + 1);
++#endif
+ }
+-#endif /* PNG_MNG_FEATURES_SUPPORTED */
+-#endif /* PNG_WRITE_SUPPORTED */
++#endif /* WRITE_TRANSFORMS */
++#endif /* WRITE */
+--- ./jdk/src/share/native/sun/awt/libpng/pngwutil.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/awt/libpng/pngwutil.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,8 +29,8 @@
+ * However, the following notice accompanied the original version of this
+ * file and, per its terms, should not be removed:
+ *
+- * Last changed in libpng 1.5.4 [July 7, 2011]
+- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
++ * Last changed in libpng 1.6.15 [November 20, 2014]
++ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+@@ -57,23 +57,6 @@
+ buf[3] = (png_byte)(i & 0xff);
+ }
+
+-#ifdef PNG_SAVE_INT_32_SUPPORTED
+-/* The png_save_int_32 function assumes integers are stored in two's
+- * complement format. If this isn't the case, then this routine needs to
+- * be modified to write data in two's complement format. Note that,
+- * the following works correctly even if png_int_32 has more than 32 bits
+- * (compare the more complex code required on read for sign extention.)
+- */
+-void PNGAPI
+-png_save_int_32(png_bytep buf, png_int_32 i)
+-{
+- buf[0] = (png_byte)((i >> 24) & 0xff);
+- buf[1] = (png_byte)((i >> 16) & 0xff);
+- buf[2] = (png_byte)((i >> 8) & 0xff);
+- buf[3] = (png_byte)(i & 0xff);
+-}
+-#endif
+-
+ /* Place a 16-bit number into a buffer in PNG byte order.
+ * The parameter is declared unsigned int, not png_uint_16,
+ * just to avoid potential problems on pre-ANSI C compilers.
+@@ -93,7 +76,7 @@
+ * bytes have already been written.
+ */
+ void PNGAPI
+-png_write_sig(png_structp png_ptr)
++png_write_sig(png_structrp png_ptr)
+ {
+ png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+
+@@ -110,6 +93,104 @@
+ png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
+ }
+
++/* Write the start of a PNG chunk. The type is the chunk type.
++ * The total_length is the sum of the lengths of all the data you will be
++ * passing in png_write_chunk_data().
++ */
++static void
++png_write_chunk_header(png_structrp png_ptr, png_uint_32 chunk_name,
++ png_uint_32 length)
++{
++ png_byte buf[8];
++
++#if defined(PNG_DEBUG) && (PNG_DEBUG > 0)
++ PNG_CSTRING_FROM_CHUNK(buf, chunk_name);
++ png_debug2(0, "Writing %s chunk, length = %lu", buf, (unsigned long)length);
++#endif
++
++ if (png_ptr == NULL)
++ return;
++
++#ifdef PNG_IO_STATE_SUPPORTED
++ /* Inform the I/O callback that the chunk header is being written.
++ * PNG_IO_CHUNK_HDR requires a single I/O call.
++ */
++ png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_HDR;
++#endif
++
++ /* Write the length and the chunk name */
++ png_save_uint_32(buf, length);
++ png_save_uint_32(buf + 4, chunk_name);
++ png_write_data(png_ptr, buf, 8);
++
++ /* Put the chunk name into png_ptr->chunk_name */
++ png_ptr->chunk_name = chunk_name;
++
++ /* Reset the crc and run it over the chunk name */
++ png_reset_crc(png_ptr);
++
++ png_calculate_crc(png_ptr, buf + 4, 4);
++
++#ifdef PNG_IO_STATE_SUPPORTED
++ /* Inform the I/O callback that chunk data will (possibly) be written.
++ * PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls.
++ */
++ png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_DATA;
++#endif
++}
++
++void PNGAPI
++png_write_chunk_start(png_structrp png_ptr, png_const_bytep chunk_string,
++ png_uint_32 length)
++{
++ png_write_chunk_header(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), length);
++}
++
++/* Write the data of a PNG chunk started with png_write_chunk_header().
++ * Note that multiple calls to this function are allowed, and that the
++ * sum of the lengths from these calls *must* add up to the total_length
++ * given to png_write_chunk_header().
++ */
++void PNGAPI
++png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
++ png_size_t length)
++{
++ /* Write the data, and run the CRC over it */
++ if (png_ptr == NULL)
++ return;
++
++ if (data != NULL && length > 0)
++ {
++ png_write_data(png_ptr, data, length);
++
++ /* Update the CRC after writing the data,
++ * in case the user I/O routine alters it.
++ */
++ png_calculate_crc(png_ptr, data, length);
++ }
++}
++
++/* Finish a chunk started with png_write_chunk_header(). */
++void PNGAPI
++png_write_chunk_end(png_structrp png_ptr)
++{
++ png_byte buf[4];
++
++ if (png_ptr == NULL) return;
++
++#ifdef PNG_IO_STATE_SUPPORTED
++ /* Inform the I/O callback that the chunk CRC is being written.
++ * PNG_IO_CHUNK_CRC requires a single I/O function call.
++ */
++ png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_CRC;
++#endif
++
++ /* Write the crc in a single operation */
++ png_save_uint_32(buf, png_ptr->crc);
++
++ png_write_data(png_ptr, buf, (png_size_t)4);
++}
++
+ /* Write a PNG chunk all at once. The type is an array of ASCII characters
+ * representing the chunk name. The array must be at least 4 bytes in
+ * length, and does not need to be null terminated. To be safe, pass the
+@@ -119,569 +200,592 @@
+ * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end()
+ * functions instead.
+ */
+-void PNGAPI
+-png_write_chunk(png_structp png_ptr, png_const_bytep chunk_name,
++static void
++png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
+ png_const_bytep data, png_size_t length)
+ {
+ if (png_ptr == NULL)
+ return;
+
+- png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length);
+- png_write_chunk_data(png_ptr, data, (png_size_t)length);
++ /* On 64 bit architectures 'length' may not fit in a png_uint_32. */
++ if (length > PNG_UINT_31_MAX)
++ png_error(png_ptr, "length exceeds PNG maximum");
++
++ png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length);
++ png_write_chunk_data(png_ptr, data, length);
+ png_write_chunk_end(png_ptr);
+ }
+
+-/* Write the start of a PNG chunk. The type is the chunk type.
+- * The total_length is the sum of the lengths of all the data you will be
+- * passing in png_write_chunk_data().
++/* This is the API that calls the internal function above. */
++void PNGAPI
++png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
++ png_const_bytep data, png_size_t length)
++{
++ png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data,
++ length);
++}
++
++/* This is used below to find the size of an image to pass to png_deflate_claim,
++ * so it only needs to be accurate if the size is less than 16384 bytes (the
++ * point at which a lower LZ window size can be used.)
+ */
+-void PNGAPI
+-png_write_chunk_start(png_structp png_ptr, png_const_bytep chunk_name,
+- png_uint_32 length)
++static png_alloc_size_t
++png_image_size(png_structrp png_ptr)
+ {
+- png_byte buf[8];
+-
+- png_debug2(0, "Writing %s chunk, length = %lu", chunk_name,
+- (unsigned long)length);
+-
+- if (png_ptr == NULL)
+- return;
+-
+-#ifdef PNG_IO_STATE_SUPPORTED
+- /* Inform the I/O callback that the chunk header is being written.
+- * PNG_IO_CHUNK_HDR requires a single I/O call.
++ /* Only return sizes up to the maximum of a png_uint_32; do this by limiting
++ * the width and height used to 15 bits.
+ */
+- png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_HDR;
+-#endif
+-
+- /* Write the length and the chunk name */
+- png_save_uint_32(buf, length);
+- png_memcpy(buf + 4, chunk_name, 4);
+- png_write_data(png_ptr, buf, (png_size_t)8);
+-
+- /* Put the chunk name into png_ptr->chunk_name */
+- png_memcpy(png_ptr->chunk_name, chunk_name, 4);
+-
+- /* Reset the crc and run it over the chunk name */
+- png_reset_crc(png_ptr);
+-
+- png_calculate_crc(png_ptr, chunk_name, 4);
+-
+-#ifdef PNG_IO_STATE_SUPPORTED
+- /* Inform the I/O callback that chunk data will (possibly) be written.
+- * PNG_IO_CHUNK_DATA does NOT require a specific number of I/O calls.
++ png_uint_32 h = png_ptr->height;
++
++ if (png_ptr->rowbytes < 32768 && h < 32768)
++ {
++ if (png_ptr->interlaced != 0)
++ {
++ /* Interlacing makes the image larger because of the replication of
++ * both the filter byte and the padding to a byte boundary.
++ */
++ png_uint_32 w = png_ptr->width;
++ unsigned int pd = png_ptr->pixel_depth;
++ png_alloc_size_t cb_base;
++ int pass;
++
++ for (cb_base=0, pass=0; pass<=6; ++pass)
++ {
++ png_uint_32 pw = PNG_PASS_COLS(w, pass);
++
++ if (pw > 0)
++ cb_base += (PNG_ROWBYTES(pd, pw)+1) * PNG_PASS_ROWS(h, pass);
++ }
++
++ return cb_base;
++ }
++
++ else
++ return (png_ptr->rowbytes+1) * h;
++ }
++
++ else
++ return 0xffffffffU;
++}
++
++#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
++ /* This is the code to hack the first two bytes of the deflate stream (the
++ * deflate header) to correct the windowBits value to match the actual data
++ * size. Note that the second argument is the *uncompressed* size but the
++ * first argument is the *compressed* data (and it must be deflate
++ * compressed.)
+ */
+- png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_DATA;
+-#endif
+-}
+-
+-/* Write the data of a PNG chunk started with png_write_chunk_start().
+- * Note that multiple calls to this function are allowed, and that the
+- * sum of the lengths from these calls *must* add up to the total_length
+- * given to png_write_chunk_start().
+- */
+-void PNGAPI
+-png_write_chunk_data(png_structp png_ptr, png_const_bytep data,
+- png_size_t length)
++static void
++optimize_cmf(png_bytep data, png_alloc_size_t data_size)
+ {
+- /* Write the data, and run the CRC over it */
+- if (png_ptr == NULL)
+- return;
+-
+- if (data != NULL && length > 0)
++ /* Optimize the CMF field in the zlib stream. The resultant zlib stream is
++ * still compliant to the stream specification.
++ */
++ if (data_size <= 16384) /* else windowBits must be 15 */
+ {
+- png_write_data(png_ptr, data, length);
+-
+- /* Update the CRC after writing the data,
+- * in case that the user I/O routine alters it.
+- */
+- png_calculate_crc(png_ptr, data, length);
++ unsigned int z_cmf = data[0]; /* zlib compression method and flags */
++
++ if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70)
++ {
++ unsigned int z_cinfo;
++ unsigned int half_z_window_size;
++
++ z_cinfo = z_cmf >> 4;
++ half_z_window_size = 1U << (z_cinfo + 7);
++
++ if (data_size <= half_z_window_size) /* else no change */
++ {
++ unsigned int tmp;
++
++ do
++ {
++ half_z_window_size >>= 1;
++ --z_cinfo;
++ }
++ while (z_cinfo > 0 && data_size <= half_z_window_size);
++
++ z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
++
++ data[0] = (png_byte)z_cmf;
++ tmp = data[1] & 0xe0;
++ tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
++ data[1] = (png_byte)tmp;
++ }
++ }
+ }
+ }
+-
+-/* Finish a chunk started with png_write_chunk_start(). */
+-void PNGAPI
+-png_write_chunk_end(png_structp png_ptr)
++#endif /* WRITE_OPTIMIZE_CMF */
++
++/* Initialize the compressor for the appropriate type of compression. */
++static int
++png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
++ png_alloc_size_t data_size)
+ {
+- png_byte buf[4];
+-
+- if (png_ptr == NULL) return;
+-
+-#ifdef PNG_IO_STATE_SUPPORTED
+- /* Inform the I/O callback that the chunk CRC is being written.
+- * PNG_IO_CHUNK_CRC requires a single I/O function call.
+- */
+- png_ptr->io_state = PNG_IO_WRITING | PNG_IO_CHUNK_CRC;
++ if (png_ptr->zowner != 0)
++ {
++#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
++ char msg[64];
++
++ PNG_STRING_FROM_CHUNK(msg, owner);
++ msg[4] = ':';
++ msg[5] = ' ';
++ PNG_STRING_FROM_CHUNK(msg+6, png_ptr->zowner);
++ /* So the message that results is "<chunk> using zstream"; this is an
++ * internal error, but is very useful for debugging. i18n requirements
++ * are minimal.
++ */
++ (void)png_safecat(msg, (sizeof msg), 10, " using zstream");
+ #endif
+-
+- /* Write the crc in a single operation */
+- png_save_uint_32(buf, png_ptr->crc);
+-
+- png_write_data(png_ptr, buf, (png_size_t)4);
+-}
+-
+-/* Initialize the compressor for the appropriate type of compression. */
+-static void
+-png_zlib_claim(png_structp png_ptr, png_uint_32 state)
+-{
+- if (!(png_ptr->zlib_state & PNG_ZLIB_IN_USE))
++#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
++ png_warning(png_ptr, msg);
++
++ /* Attempt sane error recovery */
++ if (png_ptr->zowner == png_IDAT) /* don't steal from IDAT */
++ {
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("in use by IDAT");
++ return Z_STREAM_ERROR;
++ }
++
++ png_ptr->zowner = 0;
++#else
++ png_error(png_ptr, msg);
++#endif
++ }
++
+ {
+- /* If already initialized for 'state' do not re-init. */
+- if (png_ptr->zlib_state != state)
++ int level = png_ptr->zlib_level;
++ int method = png_ptr->zlib_method;
++ int windowBits = png_ptr->zlib_window_bits;
++ int memLevel = png_ptr->zlib_mem_level;
++ int strategy; /* set below */
++ int ret; /* zlib return code */
++
++ if (owner == png_IDAT)
+ {
+- int ret = Z_OK;
+- png_const_charp who = "-";
+-
+- /* If actually initialized for another state do a deflateEnd. */
+- if (png_ptr->zlib_state != PNG_ZLIB_UNINITIALIZED)
++ if ((png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY) != 0)
++ strategy = png_ptr->zlib_strategy;
++
++ else if (png_ptr->do_filter != PNG_FILTER_NONE)
++ strategy = PNG_Z_DEFAULT_STRATEGY;
++
++ else
++ strategy = PNG_Z_DEFAULT_NOFILTER_STRATEGY;
++ }
++
++ else
++ {
++#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
++ level = png_ptr->zlib_text_level;
++ method = png_ptr->zlib_text_method;
++ windowBits = png_ptr->zlib_text_window_bits;
++ memLevel = png_ptr->zlib_text_mem_level;
++ strategy = png_ptr->zlib_text_strategy;
++#else
++ /* If customization is not supported the values all come from the
++ * IDAT values except for the strategy, which is fixed to the
++ * default. (This is the pre-1.6.0 behavior too, although it was
++ * implemented in a very different way.)
++ */
++ strategy = Z_DEFAULT_STRATEGY;
++#endif
++ }
++
++ /* Adjust 'windowBits' down if larger than 'data_size'; to stop this
++ * happening just pass 32768 as the data_size parameter. Notice that zlib
++ * requires an extra 262 bytes in the window in addition to the data to be
++ * able to see the whole of the data, so if data_size+262 takes us to the
++ * next windowBits size we need to fix up the value later. (Because even
++ * though deflate needs the extra window, inflate does not!)
++ */
++ if (data_size <= 16384)
++ {
++ /* IMPLEMENTATION NOTE: this 'half_window_size' stuff is only here to
++ * work round a Microsoft Visual C misbehavior which, contrary to C-90,
++ * widens the result of the following shift to 64-bits if (and,
++ * apparently, only if) it is used in a test.
++ */
++ unsigned int half_window_size = 1U << (windowBits-1);
++
++ while (data_size + 262 <= half_window_size)
+ {
+- ret = deflateEnd(&png_ptr->zstream);
+- who = "end";
+- png_ptr->zlib_state = PNG_ZLIB_UNINITIALIZED;
+- }
+-
+- /* zlib itself detects an incomplete state on deflateEnd */
+- if (ret == Z_OK) switch (state)
+- {
+-# ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+- case PNG_ZLIB_FOR_TEXT:
+- ret = deflateInit2(&png_ptr->zstream,
+- png_ptr->zlib_text_level, png_ptr->zlib_text_method,
+- png_ptr->zlib_text_window_bits,
+- png_ptr->zlib_text_mem_level, png_ptr->zlib_text_strategy);
+- who = "text";
+- break;
+-# endif
+-
+- case PNG_ZLIB_FOR_IDAT:
+- ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
+- png_ptr->zlib_method, png_ptr->zlib_window_bits,
+- png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
+- who = "IDAT";
+- break;
+-
+- default:
+- png_error(png_ptr, "invalid zlib state");
+- }
+-
+- if (ret == Z_OK)
+- png_ptr->zlib_state = state;
+-
+- else /* an error in deflateEnd or deflateInit2 */
+- {
+- size_t pos = 0;
+- char msg[64];
+-
+- pos = png_safecat(msg, sizeof msg, pos,
+- "zlib failed to initialize compressor (");
+- pos = png_safecat(msg, sizeof msg, pos, who);
+-
+- switch (ret)
+- {
+- case Z_VERSION_ERROR:
+- pos = png_safecat(msg, sizeof msg, pos, ") version error");
+- break;
+-
+- case Z_STREAM_ERROR:
+- pos = png_safecat(msg, sizeof msg, pos, ") stream error");
+- break;
+-
+- case Z_MEM_ERROR:
+- pos = png_safecat(msg, sizeof msg, pos, ") memory error");
+- break;
+-
+- default:
+- pos = png_safecat(msg, sizeof msg, pos, ") unknown error");
+- break;
+- }
+-
+- png_error(png_ptr, msg);
++ half_window_size >>= 1;
++ --windowBits;
+ }
+ }
+
+- /* Here on success, claim the zstream: */
+- png_ptr->zlib_state |= PNG_ZLIB_IN_USE;
++ /* Check against the previous initialized values, if any. */
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0 &&
++ (png_ptr->zlib_set_level != level ||
++ png_ptr->zlib_set_method != method ||
++ png_ptr->zlib_set_window_bits != windowBits ||
++ png_ptr->zlib_set_mem_level != memLevel ||
++ png_ptr->zlib_set_strategy != strategy))
++ {
++ if (deflateEnd(&png_ptr->zstream) != Z_OK)
++ png_warning(png_ptr, "deflateEnd failed (ignored)");
++
++ png_ptr->flags &= ~PNG_FLAG_ZSTREAM_INITIALIZED;
++ }
++
++ /* For safety clear out the input and output pointers (currently zlib
++ * doesn't use them on Init, but it might in the future).
++ */
++ png_ptr->zstream.next_in = NULL;
++ png_ptr->zstream.avail_in = 0;
++ png_ptr->zstream.next_out = NULL;
++ png_ptr->zstream.avail_out = 0;
++
++ /* Now initialize if required, setting the new parameters, otherwise just
++ * to a simple reset to the previous parameters.
++ */
++ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
++ ret = deflateReset(&png_ptr->zstream);
++
++ else
++ {
++ ret = deflateInit2(&png_ptr->zstream, level, method, windowBits,
++ memLevel, strategy);
++
++ if (ret == Z_OK)
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
++ }
++
++ /* The return code is from either deflateReset or deflateInit2; they have
++ * pretty much the same set of error codes.
++ */
++ if (ret == Z_OK)
++ png_ptr->zowner = owner;
++
++ else
++ png_zstream_error(png_ptr, ret);
++
++ return ret;
+ }
+-
+- else
+- png_error(png_ptr, "zstream already in use (internal error)");
+ }
+
+-/* The opposite: release the stream. It is also reset, this API will warn on
+- * error but will not fail.
+- */
+-static void
+-png_zlib_release(png_structp png_ptr)
++/* Clean up (or trim) a linked list of compression buffers. */
++void /* PRIVATE */
++png_free_buffer_list(png_structrp png_ptr, png_compression_bufferp *listp)
+ {
+- if (png_ptr->zlib_state & PNG_ZLIB_IN_USE)
++ png_compression_bufferp list = *listp;
++
++ if (list != NULL)
+ {
+- int ret = deflateReset(&png_ptr->zstream);
+-
+- png_ptr->zlib_state &= ~PNG_ZLIB_IN_USE;
+-
+- if (ret != Z_OK)
++ *listp = NULL;
++
++ do
+ {
+- png_const_charp err;
+- PNG_WARNING_PARAMETERS(p)
+-
+- switch (ret)
+- {
+- case Z_VERSION_ERROR:
+- err = "version";
+- break;
+-
+- case Z_STREAM_ERROR:
+- err = "stream";
+- break;
+-
+- case Z_MEM_ERROR:
+- err = "memory";
+- break;
+-
+- default:
+- err = "unknown";
+- break;
+- }
+-
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_d, ret);
+- png_warning_parameter(p, 2, err);
+-
+- if (png_ptr->zstream.msg)
+- err = png_ptr->zstream.msg;
+- else
+- err = "[no zlib message]";
+-
+- png_warning_parameter(p, 3, err);
+-
+- png_formatted_warning(png_ptr, p,
+- "zlib failed to reset compressor: @1(@2): @3");
++ png_compression_bufferp next = list->next;
++
++ png_free(png_ptr, list);
++ list = next;
+ }
++ while (list != NULL);
+ }
+-
+- else
+- png_warning(png_ptr, "zstream not in use (internal error)");
+ }
+
+ #ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+ /* This pair of functions encapsulates the operation of (a) compressing a
+ * text string, and (b) issuing it later as a series of chunk data writes.
+ * The compression_state structure is shared context for these functions
+- * set up by the caller in order to make the whole mess thread-safe.
++ * set up by the caller to allow access to the relevant local variables.
++ *
++ * compression_buffer (new in 1.6.0) is just a linked list of zbuffer_size
++ * temporary buffers. From 1.6.0 it is retained in png_struct so that it will
++ * be correctly freed in the event of a write error (previous implementations
++ * just leaked memory.)
+ */
+-
+ typedef struct
+ {
+- png_const_bytep input; /* The uncompressed input data */
+- png_size_t input_len; /* Its length */
+- int num_output_ptr; /* Number of output pointers used */
+- int max_output_ptr; /* Size of output_ptr */
+- png_bytep *output_ptr; /* Array of pointers to output */
++ png_const_bytep input; /* The uncompressed input data */
++ png_alloc_size_t input_len; /* Its length */
++ png_uint_32 output_len; /* Final compressed length */
++ png_byte output[1024]; /* First block of output */
+ } compression_state;
+
+-/* Compress given text into storage in the png_ptr structure */
+-static int /* PRIVATE */
+-png_text_compress(png_structp png_ptr,
+- png_const_charp text, png_size_t text_len, int compression,
+- compression_state *comp)
++static void
++png_text_compress_init(compression_state *comp, png_const_bytep input,
++ png_alloc_size_t input_len)
++{
++ comp->input = input;
++ comp->input_len = input_len;
++ comp->output_len = 0;
++}
++
++/* Compress the data in the compression state input */
++static int
++png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
++ compression_state *comp, png_uint_32 prefix_len)
+ {
+ int ret;
+
+- comp->num_output_ptr = 0;
+- comp->max_output_ptr = 0;
+- comp->output_ptr = NULL;
+- comp->input = NULL;
+- comp->input_len = text_len;
+-
+- /* We may just want to pass the text right through */
+- if (compression == PNG_TEXT_COMPRESSION_NONE)
++ /* To find the length of the output it is necessary to first compress the
++ * input. The result is buffered rather than using the two-pass algorithm
++ * that is used on the inflate side; deflate is assumed to be slower and a
++ * PNG writer is assumed to have more memory available than a PNG reader.
++ *
++ * IMPLEMENTATION NOTE: the zlib API deflateBound() can be used to find an
++ * upper limit on the output size, but it is always bigger than the input
++ * size so it is likely to be more efficient to use this linked-list
++ * approach.
++ */
++ ret = png_deflate_claim(png_ptr, chunk_name, comp->input_len);
++
++ if (ret != Z_OK)
++ return ret;
++
++ /* Set up the compression buffers, we need a loop here to avoid overflowing a
++ * uInt. Use ZLIB_IO_MAX to limit the input. The output is always limited
++ * by the output buffer size, so there is no need to check that. Since this
++ * is ANSI-C we know that an 'int', hence a uInt, is always at least 16 bits
++ * in size.
++ */
+ {
+- comp->input = (png_const_bytep)text;
+- return((int)text_len);
++ png_compression_bufferp *end = &png_ptr->zbuffer_list;
++ png_alloc_size_t input_len = comp->input_len; /* may be zero! */
++ png_uint_32 output_len;
++
++ /* zlib updates these for us: */
++ png_ptr->zstream.next_in = PNGZ_INPUT_CAST(comp->input);
++ png_ptr->zstream.avail_in = 0; /* Set below */
++ png_ptr->zstream.next_out = comp->output;
++ png_ptr->zstream.avail_out = (sizeof comp->output);
++
++ output_len = png_ptr->zstream.avail_out;
++
++ do
++ {
++ uInt avail_in = ZLIB_IO_MAX;
++
++ if (avail_in > input_len)
++ avail_in = (uInt)input_len;
++
++ input_len -= avail_in;
++
++ png_ptr->zstream.avail_in = avail_in;
++
++ if (png_ptr->zstream.avail_out == 0)
++ {
++ png_compression_buffer *next;
++
++ /* Chunk data is limited to 2^31 bytes in length, so the prefix
++ * length must be counted here.
++ */
++ if (output_len + prefix_len > PNG_UINT_31_MAX)
++ {
++ ret = Z_MEM_ERROR;
++ break;
++ }
++
++ /* Need a new (malloc'ed) buffer, but there may be one present
++ * already.
++ */
++ next = *end;
++ if (next == NULL)
++ {
++ next = png_voidcast(png_compression_bufferp, png_malloc_base
++ (png_ptr, PNG_COMPRESSION_BUFFER_SIZE(png_ptr)));
++
++ if (next == NULL)
++ {
++ ret = Z_MEM_ERROR;
++ break;
++ }
++
++ /* Link in this buffer (so that it will be freed later) */
++ next->next = NULL;
++ *end = next;
++ }
++
++ png_ptr->zstream.next_out = next->output;
++ png_ptr->zstream.avail_out = png_ptr->zbuffer_size;
++ output_len += png_ptr->zstream.avail_out;
++
++ /* Move 'end' to the next buffer pointer. */
++ end = &next->next;
++ }
++
++ /* Compress the data */
++ ret = deflate(&png_ptr->zstream,
++ input_len > 0 ? Z_NO_FLUSH : Z_FINISH);
++
++ /* Claw back input data that was not consumed (because avail_in is
++ * reset above every time round the loop).
++ */
++ input_len += png_ptr->zstream.avail_in;
++ png_ptr->zstream.avail_in = 0; /* safety */
++ }
++ while (ret == Z_OK);
++
++ /* There may be some space left in the last output buffer. This needs to
++ * be subtracted from output_len.
++ */
++ output_len -= png_ptr->zstream.avail_out;
++ png_ptr->zstream.avail_out = 0; /* safety */
++ comp->output_len = output_len;
++
++ /* Now double check the output length, put in a custom message if it is
++ * too long. Otherwise ensure the z_stream::msg pointer is set to
++ * something.
++ */
++ if (output_len + prefix_len >= PNG_UINT_31_MAX)
++ {
++ png_ptr->zstream.msg = PNGZ_MSG_CAST("compressed data too long");
++ ret = Z_MEM_ERROR;
++ }
++
++ else
++ png_zstream_error(png_ptr, ret);
++
++ /* Reset zlib for another zTXt/iTXt or image data */
++ png_ptr->zowner = 0;
++
++ /* The only success case is Z_STREAM_END, input_len must be 0; if not this
++ * is an internal error.
++ */
++ if (ret == Z_STREAM_END && input_len == 0)
++ {
++#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
++ /* Fix up the deflate header, if required */
++ optimize_cmf(comp->output, comp->input_len);
++#endif
++ /* But Z_OK is returned, not Z_STREAM_END; this allows the claim
++ * function above to return Z_STREAM_END on an error (though it never
++ * does in the current versions of zlib.)
++ */
++ return Z_OK;
++ }
++
++ else
++ return ret;
+ }
+-
+- if (compression >= PNG_TEXT_COMPRESSION_LAST)
++}
++
++/* Ship the compressed text out via chunk writes */
++static void
++png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
++{
++ png_uint_32 output_len = comp->output_len;
++ png_const_bytep output = comp->output;
++ png_uint_32 avail = (sizeof comp->output);
++ png_compression_buffer *next = png_ptr->zbuffer_list;
++
++ for (;;)
++ {
++ if (avail > output_len)
++ avail = output_len;
++
++ png_write_chunk_data(png_ptr, output, avail);
++
++ output_len -= avail;
++
++ if (output_len == 0 || next == NULL)
++ break;
++
++ avail = png_ptr->zbuffer_size;
++ output = next->output;
++ next = next->next;
++ }
++
++ /* This is an internal error; 'next' must have been NULL! */
++ if (output_len > 0)
++ png_error(png_ptr, "error writing ancillary chunked compressed data");
++}
++#endif /* WRITE_COMPRESSED_TEXT */
++
++#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
++ defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
++/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
++ * and if invalid, correct the keyword rather than discarding the entire
++ * chunk. The PNG 1.0 specification requires keywords 1-79 characters in
++ * length, forbids leading or trailing whitespace, multiple internal spaces,
++ * and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
++ *
++ * The 'new_key' buffer must be 80 characters in size (for the keyword plus a
++ * trailing '\0'). If this routine returns 0 then there was no keyword, or a
++ * valid one could not be generated, and the caller must png_error.
++ */
++static png_uint_32
++png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
++{
++ png_const_charp orig_key = key;
++ png_uint_32 key_len = 0;
++ int bad_character = 0;
++ int space = 1;
++
++ png_debug(1, "in png_check_keyword");
++
++ if (key == NULL)
++ {
++ *new_key = 0;
++ return 0;
++ }
++
++ while (*key && key_len < 79)
++ {
++ png_byte ch = (png_byte)(0xff & *key++);
++
++ if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
++ *new_key++ = ch, ++key_len, space = 0;
++
++ else if (space == 0)
++ {
++ /* A space or an invalid character when one wasn't seen immediately
++ * before; output just a space.
++ */
++ *new_key++ = 32, ++key_len, space = 1;
++
++ /* If the character was not a space then it is invalid. */
++ if (ch != 32)
++ bad_character = ch;
++ }
++
++ else if (bad_character == 0)
++ bad_character = ch; /* just skip it, record the first error */
++ }
++
++ if (key_len > 0 && space != 0) /* trailing space */
++ {
++ --key_len, --new_key;
++ if (bad_character == 0)
++ bad_character = 32;
++ }
++
++ /* Terminate the keyword */
++ *new_key = 0;
++
++ if (key_len == 0)
++ return 0;
++
++#ifdef PNG_WARNINGS_SUPPORTED
++ /* Try to only output one warning per keyword: */
++ if (*key != 0) /* keyword too long */
++ png_warning(png_ptr, "keyword truncated");
++
++ else if (bad_character != 0)
+ {
+ PNG_WARNING_PARAMETERS(p)
+
+- png_warning_parameter_signed(p, 1, PNG_NUMBER_FORMAT_d,
+- compression);
+- png_formatted_warning(png_ptr, p, "Unknown compression type @1");
++ png_warning_parameter(p, 1, orig_key);
++ png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
++
++ png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
+ }
+-
+- /* We can't write the chunk until we find out how much data we have,
+- * which means we need to run the compressor first and save the
+- * output. This shouldn't be a problem, as the vast majority of
+- * comments should be reasonable, but we will set up an array of
+- * malloc'd pointers to be sure.
+- *
+- * If we knew the application was well behaved, we could simplify this
+- * greatly by assuming we can always malloc an output buffer large
+- * enough to hold the compressed text ((1001 * text_len / 1000) + 12)
+- * and malloc this directly. The only time this would be a bad idea is
+- * if we can't malloc more than 64K and we have 64K of random input
+- * data, or if the input string is incredibly large (although this
+- * wouldn't cause a failure, just a slowdown due to swapping).
+- */
+- png_zlib_claim(png_ptr, PNG_ZLIB_FOR_TEXT);
+-
+- /* Set up the compression buffers */
+- /* TODO: the following cast hides a potential overflow problem. */
+- png_ptr->zstream.avail_in = (uInt)text_len;
+-
+- /* NOTE: assume zlib doesn't overwrite the input */
+- png_ptr->zstream.next_in = (Bytef *)text;
+- png_ptr->zstream.avail_out = png_ptr->zbuf_size;
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+-
+- /* This is the same compression loop as in png_write_row() */
+- do
+- {
+- /* Compress the data */
+- ret = deflate(&png_ptr->zstream, Z_NO_FLUSH);
+-
+- if (ret != Z_OK)
+- {
+- /* Error */
+- if (png_ptr->zstream.msg != NULL)
+- png_error(png_ptr, png_ptr->zstream.msg);
+-
+- else
+- png_error(png_ptr, "zlib error");
+- }
+-
+- /* Check to see if we need more room */
+- if (!(png_ptr->zstream.avail_out))
+- {
+- /* Make sure the output array has room */
+- if (comp->num_output_ptr >= comp->max_output_ptr)
+- {
+- int old_max;
+-
+- old_max = comp->max_output_ptr;
+- comp->max_output_ptr = comp->num_output_ptr + 4;
+- if (comp->output_ptr != NULL)
+- {
+- png_bytepp old_ptr;
+-
+- old_ptr = comp->output_ptr;
+-
+- comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
+- (png_alloc_size_t)
+- (comp->max_output_ptr * png_sizeof(png_charpp)));
+-
+- png_memcpy(comp->output_ptr, old_ptr, old_max
+- * png_sizeof(png_charp));
+-
+- png_free(png_ptr, old_ptr);
+- }
+- else
+- comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
+- (png_alloc_size_t)
+- (comp->max_output_ptr * png_sizeof(png_charp)));
+- }
+-
+- /* Save the data */
+- comp->output_ptr[comp->num_output_ptr] =
+- (png_bytep)png_malloc(png_ptr,
+- (png_alloc_size_t)png_ptr->zbuf_size);
+-
+- png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
+- png_ptr->zbuf_size);
+-
+- comp->num_output_ptr++;
+-
+- /* and reset the buffer */
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- }
+- /* Continue until we don't have any more to compress */
+- } while (png_ptr->zstream.avail_in);
+-
+- /* Finish the compression */
+- do
+- {
+- /* Tell zlib we are finished */
+- ret = deflate(&png_ptr->zstream, Z_FINISH);
+-
+- if (ret == Z_OK)
+- {
+- /* Check to see if we need more room */
+- if (!(png_ptr->zstream.avail_out))
+- {
+- /* Check to make sure our output array has room */
+- if (comp->num_output_ptr >= comp->max_output_ptr)
+- {
+- int old_max;
+-
+- old_max = comp->max_output_ptr;
+- comp->max_output_ptr = comp->num_output_ptr + 4;
+- if (comp->output_ptr != NULL)
+- {
+- png_bytepp old_ptr;
+-
+- old_ptr = comp->output_ptr;
+-
+- /* This could be optimized to realloc() */
+- comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
+- (png_alloc_size_t)(comp->max_output_ptr *
+- png_sizeof(png_charp)));
+-
+- png_memcpy(comp->output_ptr, old_ptr,
+- old_max * png_sizeof(png_charp));
+-
+- png_free(png_ptr, old_ptr);
+- }
+-
+- else
+- comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
+- (png_alloc_size_t)(comp->max_output_ptr *
+- png_sizeof(png_charp)));
+- }
+-
+- /* Save the data */
+- comp->output_ptr[comp->num_output_ptr] =
+- (png_bytep)png_malloc(png_ptr,
+- (png_alloc_size_t)png_ptr->zbuf_size);
+-
+- png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
+- png_ptr->zbuf_size);
+-
+- comp->num_output_ptr++;
+-
+- /* and reset the buffer pointers */
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- }
+- }
+- else if (ret != Z_STREAM_END)
+- {
+- /* We got an error */
+- if (png_ptr->zstream.msg != NULL)
+- png_error(png_ptr, png_ptr->zstream.msg);
+-
+- else
+- png_error(png_ptr, "zlib error");
+- }
+- } while (ret != Z_STREAM_END);
+-
+- /* Text length is number of buffers plus last buffer */
+- text_len = png_ptr->zbuf_size * comp->num_output_ptr;
+-
+- if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
+- text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out;
+-
+- return((int)text_len);
++#endif /* WARNINGS */
++
++ return key_len;
+ }
+-
+-/* Ship the compressed text out via chunk writes */
+-static void /* PRIVATE */
+-png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
+-{
+- int i;
+-
+- /* Handle the no-compression case */
+- if (comp->input)
+- {
+- png_write_chunk_data(png_ptr, comp->input, comp->input_len);
+-
+- return;
+- }
+-
+-#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
+- if (comp->input_len >= 2 && comp->input_len < 16384)
+- {
+- unsigned int z_cmf; /* zlib compression method and flags */
+-
+- /* Optimize the CMF field in the zlib stream. This hack of the zlib
+- * stream is compliant to the stream specification.
+- */
+-
+- if (comp->num_output_ptr)
+- z_cmf = comp->output_ptr[0][0];
+- else
+- z_cmf = png_ptr->zbuf[0];
+-
+- if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70)
+- {
+- unsigned int z_cinfo;
+- unsigned int half_z_window_size;
+- png_size_t uncompressed_text_size = comp->input_len;
+-
+- z_cinfo = z_cmf >> 4;
+- half_z_window_size = 1 << (z_cinfo + 7);
+-
+- while (uncompressed_text_size <= half_z_window_size &&
+- half_z_window_size >= 256)
+- {
+- z_cinfo--;
+- half_z_window_size >>= 1;
+- }
+-
+- z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
+-
+- if (comp->num_output_ptr)
+- {
+-
+- if (comp->output_ptr[0][0] != z_cmf)
+- {
+- int tmp;
+-
+- comp->output_ptr[0][0] = (png_byte)z_cmf;
+- tmp = comp->output_ptr[0][1] & 0xe0;
+- tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
+- comp->output_ptr[0][1] = (png_byte)tmp;
+- }
+- }
+- else
+- {
+- int tmp;
+-
+- png_ptr->zbuf[0] = (png_byte)z_cmf;
+- tmp = png_ptr->zbuf[1] & 0xe0;
+- tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
+- png_ptr->zbuf[1] = (png_byte)tmp;
+- }
+- }
+-
+- else
+- png_error(png_ptr,
+- "Invalid zlib compression method or flags in non-IDAT chunk");
+- }
+-#endif /* PNG_WRITE_OPTIMIZE_CMF_SUPPORTED */
+-
+- /* Write saved output buffers, if any */
+- for (i = 0; i < comp->num_output_ptr; i++)
+- {
+- png_write_chunk_data(png_ptr, comp->output_ptr[i],
+- (png_size_t)png_ptr->zbuf_size);
+-
+- png_free(png_ptr, comp->output_ptr[i]);
+- }
+-
+- if (comp->max_output_ptr != 0)
+- png_free(png_ptr, comp->output_ptr);
+-
+- /* Write anything left in zbuf */
+- if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size)
+- png_write_chunk_data(png_ptr, png_ptr->zbuf,
+- (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream.avail_out));
+-
+- /* Reset zlib for another zTXt/iTXt or image data */
+- png_zlib_release(png_ptr);
+-}
+-#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
++#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
+
+ /* Write the IHDR chunk, and update the png_struct with the necessary
+ * information. Note that the rest of this code depends upon this
+ * information being correct.
+ */
+ void /* PRIVATE */
+-png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
++png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
+ int bit_depth, int color_type, int compression_type, int filter_type,
+ int interlace_type)
+ {
+- PNG_IHDR;
+-
+ png_byte buf[13]; /* Buffer to store the IHDR info */
+
+ png_debug(1, "in png_write_IHDR");
+@@ -772,8 +876,8 @@
+ */
+ if (
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+- ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
++ !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
++ ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
+ (color_type == PNG_COLOR_TYPE_RGB ||
+ color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
+ (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) &&
+@@ -823,14 +927,9 @@
+ buf[12] = (png_byte)interlace_type;
+
+ /* Write the chunk */
+- png_write_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
+-
+- /* Initialize zlib with PNG info */
+- png_ptr->zstream.zalloc = png_zalloc;
+- png_ptr->zstream.zfree = png_zfree;
+- png_ptr->zstream.opaque = (voidpf)png_ptr;
+-
+- if (!(png_ptr->do_filter))
++ png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
++
++ if ((png_ptr->do_filter) == PNG_NO_FILTERS)
+ {
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
+ png_ptr->bit_depth < 8)
+@@ -840,55 +939,6 @@
+ png_ptr->do_filter = PNG_ALL_FILTERS;
+ }
+
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY))
+- {
+- if (png_ptr->do_filter != PNG_FILTER_NONE)
+- png_ptr->zlib_strategy = Z_FILTERED;
+-
+- else
+- png_ptr->zlib_strategy = Z_DEFAULT_STRATEGY;
+- }
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_LEVEL))
+- png_ptr->zlib_level = Z_DEFAULT_COMPRESSION;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL))
+- png_ptr->zlib_mem_level = 8;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS))
+- png_ptr->zlib_window_bits = 15;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
+- png_ptr->zlib_method = 8;
+-
+-#ifdef PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
+-#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
+- if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_STRATEGY))
+- png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_LEVEL))
+- png_ptr->zlib_text_level = png_ptr->zlib_level;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL))
+- png_ptr->zlib_text_mem_level = png_ptr->zlib_mem_level;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS))
+- png_ptr->zlib_text_window_bits = png_ptr->zlib_window_bits;
+-
+- if (!(png_ptr->flags & PNG_FLAG_ZTXT_CUSTOM_METHOD))
+- png_ptr->zlib_text_method = png_ptr->zlib_method;
+-#else
+- png_ptr->zlib_text_strategy = Z_DEFAULT_STRATEGY;
+- png_ptr->zlib_text_level = png_ptr->zlib_level;
+- png_ptr->zlib_text_mem_level = png_ptr->zlib_mem_level;
+- png_ptr->zlib_text_window_bits = png_ptr->zlib_window_bits;
+- png_ptr->zlib_text_method = png_ptr->zlib_method;
+-#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
+-#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
+-
+- /* Record that the compressor has not yet been initialized. */
+- png_ptr->zlib_state = PNG_ZLIB_UNINITIALIZED;
+-
+ png_ptr->mode = PNG_HAVE_IHDR; /* not READY_FOR_ZTXT */
+ }
+
+@@ -897,10 +947,9 @@
+ * structure.
+ */
+ void /* PRIVATE */
+-png_write_PLTE(png_structp png_ptr, png_const_colorp palette,
++png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
+ png_uint_32 num_pal)
+ {
+- PNG_PLTE;
+ png_uint_32 i;
+ png_const_colorp pal_ptr;
+ png_byte buf[3];
+@@ -909,7 +958,7 @@
+
+ if ((
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
++ (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
+ #endif
+ num_pal == 0) || num_pal > 256)
+ {
+@@ -925,7 +974,7 @@
+ }
+ }
+
+- if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
++ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
+ {
+ png_warning(png_ptr,
+ "Ignoring request to write a PLTE chunk in grayscale PNG");
+@@ -936,7 +985,7 @@
+ png_ptr->num_palette = (png_uint_16)num_pal;
+ png_debug1(3, "num_palette = %d", png_ptr->num_palette);
+
+- png_write_chunk_start(png_ptr, png_PLTE, (png_uint_32)(num_pal * 3));
++ png_write_chunk_header(png_ptr, png_PLTE, (png_uint_32)(num_pal * 3));
+ #ifdef PNG_POINTER_INDEXING_SUPPORTED
+
+ for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
+@@ -966,127 +1015,192 @@
+ png_ptr->mode |= PNG_HAVE_PLTE;
+ }
+
+-/* Write an IDAT chunk */
++/* This is similar to png_text_compress, above, except that it does not require
++ * all of the data at once and, instead of buffering the compressed result,
++ * writes it as IDAT chunks. Unlike png_text_compress it *can* png_error out
++ * because it calls the write interface. As a result it does its own error
++ * reporting and does not return an error code. In the event of error it will
++ * just call png_error. The input data length may exceed 32-bits. The 'flush'
++ * parameter is exactly the same as that to deflate, with the following
++ * meanings:
++ *
++ * Z_NO_FLUSH: normal incremental output of compressed data
++ * Z_SYNC_FLUSH: do a SYNC_FLUSH, used by png_write_flush
++ * Z_FINISH: this is the end of the input, do a Z_FINISH and clean up
++ *
++ * The routine manages the acquire and release of the png_ptr->zstream by
++ * checking and (at the end) clearing png_ptr->zowner; it does some sanity
++ * checks on the 'mode' flags while doing this.
++ */
+ void /* PRIVATE */
+-png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
++png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
++ png_alloc_size_t input_len, int flush)
+ {
+- PNG_IDAT;
+-
+- png_debug(1, "in png_write_IDAT");
+-
++ if (png_ptr->zowner != png_IDAT)
++ {
++ /* First time. Ensure we have a temporary buffer for compression and
++ * trim the buffer list if it has more than one entry to free memory.
++ * If 'WRITE_COMPRESSED_TEXT' is not set the list will never have been
++ * created at this point, but the check here is quick and safe.
++ */
++ if (png_ptr->zbuffer_list == NULL)
++ {
++ png_ptr->zbuffer_list = png_voidcast(png_compression_bufferp,
++ png_malloc(png_ptr, PNG_COMPRESSION_BUFFER_SIZE(png_ptr)));
++ png_ptr->zbuffer_list->next = NULL;
++ }
++
++ else
++ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list->next);
++
++ /* It is a terminal error if we can't claim the zstream. */
++ if (png_deflate_claim(png_ptr, png_IDAT, png_image_size(png_ptr)) != Z_OK)
++ png_error(png_ptr, png_ptr->zstream.msg);
++
++ /* The output state is maintained in png_ptr->zstream, so it must be
++ * initialized here after the claim.
++ */
++ png_ptr->zstream.next_out = png_ptr->zbuffer_list->output;
++ png_ptr->zstream.avail_out = png_ptr->zbuffer_size;
++ }
++
++ /* Now loop reading and writing until all the input is consumed or an error
++ * terminates the operation. The _out values are maintained across calls to
++ * this function, but the input must be reset each time.
++ */
++ png_ptr->zstream.next_in = PNGZ_INPUT_CAST(input);
++ png_ptr->zstream.avail_in = 0; /* set below */
++ for (;;)
++ {
++ int ret;
++
++ /* INPUT: from the row data */
++ uInt avail = ZLIB_IO_MAX;
++
++ if (avail > input_len)
++ avail = (uInt)input_len; /* safe because of the check */
++
++ png_ptr->zstream.avail_in = avail;
++ input_len -= avail;
++
++ ret = deflate(&png_ptr->zstream, input_len > 0 ? Z_NO_FLUSH : flush);
++
++ /* Include as-yet unconsumed input */
++ input_len += png_ptr->zstream.avail_in;
++ png_ptr->zstream.avail_in = 0;
++
++ /* OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note
++ * that these two zstream fields are preserved across the calls, therefore
++ * there is no need to set these up on entry to the loop.
++ */
++ if (png_ptr->zstream.avail_out == 0)
++ {
++ png_bytep data = png_ptr->zbuffer_list->output;
++ uInt size = png_ptr->zbuffer_size;
++
++ /* Write an IDAT containing the data then reset the buffer. The
++ * first IDAT may need deflate header optimization.
++ */
+ #ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
+- if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
+- png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
+- {
+- /* Optimize the CMF field in the zlib stream. This hack of the zlib
+- * stream is compliant to the stream specification.
++ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
++ png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
++ optimize_cmf(data, png_image_size(png_ptr));
++#endif
++
++ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++ png_ptr->mode |= PNG_HAVE_IDAT;
++
++ png_ptr->zstream.next_out = data;
++ png_ptr->zstream.avail_out = size;
++
++ /* For SYNC_FLUSH or FINISH it is essential to keep calling zlib with
++ * the same flush parameter until it has finished output, for NO_FLUSH
++ * it doesn't matter.
++ */
++ if (ret == Z_OK && flush != Z_NO_FLUSH)
++ continue;
++ }
++
++ /* The order of these checks doesn't matter much; it just affects which
++ * possible error might be detected if multiple things go wrong at once.
+ */
+- unsigned int z_cmf = data[0]; /* zlib compression method and flags */
+-
+- if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70)
++ if (ret == Z_OK) /* most likely return code! */
+ {
+- /* Avoid memory underflows and multiplication overflows.
+- *
+- * The conditions below are practically always satisfied;
+- * however, they still must be checked.
++ /* If all the input has been consumed then just return. If Z_FINISH
++ * was used as the flush parameter something has gone wrong if we get
++ * here.
+ */
+- if (length >= 2 &&
+- png_ptr->height < 16384 && png_ptr->width < 16384)
++ if (input_len == 0)
+ {
+- /* Compute the maximum possible length of the datastream */
+-
+- /* Number of pixels, plus for each row a filter byte
+- * and possibly a padding byte, so increase the maximum
+- * size to account for these.
+- */
+- unsigned int z_cinfo;
+- unsigned int half_z_window_size;
+- png_uint_32 uncompressed_idat_size = png_ptr->height *
+- ((png_ptr->width *
+- png_ptr->channels * png_ptr->bit_depth + 15) >> 3);
+-
+- /* If it's interlaced, each block of 8 rows is sent as up to
+- * 14 rows, i.e., 6 additional rows, each with a filter byte
+- * and possibly a padding byte
+- */
+- if (png_ptr->interlaced)
+- uncompressed_idat_size += ((png_ptr->height + 7)/8) *
+- (png_ptr->bit_depth < 8 ? 12 : 6);
+-
+- z_cinfo = z_cmf >> 4;
+- half_z_window_size = 1 << (z_cinfo + 7);
+-
+- while (uncompressed_idat_size <= half_z_window_size &&
+- half_z_window_size >= 256)
+- {
+- z_cinfo--;
+- half_z_window_size >>= 1;
+- }
+-
+- z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4);
+-
+- if (data[0] != z_cmf)
+- {
+- int tmp;
+- data[0] = (png_byte)z_cmf;
+- tmp = data[1] & 0xe0;
+- tmp += 0x1f - ((z_cmf << 8) + tmp) % 0x1f;
+- data[1] = (png_byte)tmp;
+- }
++ if (flush == Z_FINISH)
++ png_error(png_ptr, "Z_OK on Z_FINISH with output space");
++
++ return;
+ }
+ }
+
++ else if (ret == Z_STREAM_END && flush == Z_FINISH)
++ {
++ /* This is the end of the IDAT data; any pending output must be
++ * flushed. For small PNG files we may still be at the beginning.
++ */
++ png_bytep data = png_ptr->zbuffer_list->output;
++ uInt size = png_ptr->zbuffer_size - png_ptr->zstream.avail_out;
++
++#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
++ if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
++ png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
++ optimize_cmf(data, png_image_size(png_ptr));
++#endif
++
++ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++ png_ptr->zstream.avail_out = 0;
++ png_ptr->zstream.next_out = NULL;
++ png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
++
++ png_ptr->zowner = 0; /* Release the stream */
++ return;
++ }
++
+ else
+- png_error(png_ptr,
+- "Invalid zlib compression method or flags in IDAT");
++ {
++ /* This is an error condition. */
++ png_zstream_error(png_ptr, ret);
++ png_error(png_ptr, png_ptr->zstream.msg);
++ }
+ }
+-#endif /* PNG_WRITE_OPTIMIZE_CMF_SUPPORTED */
+-
+- png_write_chunk(png_ptr, png_IDAT, data, length);
+- png_ptr->mode |= PNG_HAVE_IDAT;
+-
+- /* Prior to 1.5.4 this code was replicated in every caller (except at the
+- * end, where it isn't technically necessary). Since this function has
+- * flushed the data we can safely reset the zlib output buffer here.
+- */
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+ }
+
+ /* Write an IEND chunk */
+ void /* PRIVATE */
+-png_write_IEND(png_structp png_ptr)
++png_write_IEND(png_structrp png_ptr)
+ {
+- PNG_IEND;
+-
+ png_debug(1, "in png_write_IEND");
+
+- png_write_chunk(png_ptr, png_IEND, NULL, (png_size_t)0);
++ png_write_complete_chunk(png_ptr, png_IEND, NULL, (png_size_t)0);
+ png_ptr->mode |= PNG_HAVE_IEND;
+ }
+
+ #ifdef PNG_WRITE_gAMA_SUPPORTED
+ /* Write a gAMA chunk */
+ void /* PRIVATE */
+-png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
++png_write_gAMA_fixed(png_structrp png_ptr, png_fixed_point file_gamma)
+ {
+- PNG_gAMA;
+ png_byte buf[4];
+
+ png_debug(1, "in png_write_gAMA");
+
+ /* file_gamma is saved in 1/100,000ths */
+ png_save_uint_32(buf, (png_uint_32)file_gamma);
+- png_write_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
++ png_write_complete_chunk(png_ptr, png_gAMA, buf, (png_size_t)4);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_sRGB_SUPPORTED
+ /* Write a sRGB chunk */
+ void /* PRIVATE */
+-png_write_sRGB(png_structp png_ptr, int srgb_intent)
++png_write_sRGB(png_structrp png_ptr, int srgb_intent)
+ {
+- PNG_sRGB;
+ png_byte buf[1];
+
+ png_debug(1, "in png_write_sRGB");
+@@ -1096,104 +1210,79 @@
+ "Invalid sRGB rendering intent specified");
+
+ buf[0]=(png_byte)srgb_intent;
+- png_write_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
++ png_write_complete_chunk(png_ptr, png_sRGB, buf, (png_size_t)1);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_iCCP_SUPPORTED
+ /* Write an iCCP chunk */
+ void /* PRIVATE */
+-png_write_iCCP(png_structp png_ptr, png_const_charp name, int compression_type,
+- png_const_charp profile, int profile_len)
++png_write_iCCP(png_structrp png_ptr, png_const_charp name,
++ png_const_bytep profile)
+ {
+- PNG_iCCP;
+- png_size_t name_len;
+- png_charp new_name;
++ png_uint_32 name_len;
++ png_uint_32 profile_len;
++ png_byte new_name[81]; /* 1 byte for the compression byte */
+ compression_state comp;
+- int embedded_profile_len = 0;
++ png_uint_32 temp;
+
+ png_debug(1, "in png_write_iCCP");
+
+- comp.num_output_ptr = 0;
+- comp.max_output_ptr = 0;
+- comp.output_ptr = NULL;
+- comp.input = NULL;
+- comp.input_len = 0;
+-
+- if ((name_len = png_check_keyword(png_ptr, name, &new_name)) == 0)
+- return;
+-
+- if (compression_type != PNG_COMPRESSION_TYPE_BASE)
+- png_warning(png_ptr, "Unknown compression type in iCCP chunk");
+-
++ /* These are all internal problems: the profile should have been checked
++ * before when it was stored.
++ */
+ if (profile == NULL)
+- profile_len = 0;
+-
+- if (profile_len > 3)
+- embedded_profile_len =
+- ((*( (png_const_bytep)profile ))<<24) |
+- ((*( (png_const_bytep)profile + 1))<<16) |
+- ((*( (png_const_bytep)profile + 2))<< 8) |
+- ((*( (png_const_bytep)profile + 3)) );
+-
+- if (embedded_profile_len < 0)
++ png_error(png_ptr, "No profile for iCCP chunk"); /* internal error */
++
++ profile_len = png_get_uint_32(profile);
++
++ if (profile_len < 132)
++ png_error(png_ptr, "ICC profile too short");
++
++ temp = (png_uint_32) (*(profile+8));
++ if (temp > 3 && (profile_len & 0x03))
++ png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
++
+ {
+- png_warning(png_ptr,
+- "Embedded profile length in iCCP chunk is negative");
+-
+- png_free(png_ptr, new_name);
+- return;
++ png_uint_32 embedded_profile_len = png_get_uint_32(profile);
++
++ if (profile_len != embedded_profile_len)
++ png_error(png_ptr, "Profile length does not match profile");
+ }
+
+- if (profile_len < embedded_profile_len)
+- {
+- png_warning(png_ptr,
+- "Embedded profile length too large in iCCP chunk");
+-
+- png_free(png_ptr, new_name);
+- return;
+- }
+-
+- if (profile_len > embedded_profile_len)
+- {
+- png_warning(png_ptr,
+- "Truncating profile to actual length in iCCP chunk");
+-
+- profile_len = embedded_profile_len;
+- }
+-
+- if (profile_len)
+- profile_len = png_text_compress(png_ptr, profile,
+- (png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp);
++ name_len = png_check_keyword(png_ptr, name, new_name);
++
++ if (name_len == 0)
++ png_error(png_ptr, "iCCP: invalid keyword");
++
++ new_name[++name_len] = PNG_COMPRESSION_TYPE_BASE;
+
+ /* Make sure we include the NULL after the name and the compression type */
+- png_write_chunk_start(png_ptr, png_iCCP,
+- (png_uint_32)(name_len + profile_len + 2));
+-
+- new_name[name_len + 1] = 0x00;
+-
+- png_write_chunk_data(png_ptr, (png_bytep)new_name,
+- (png_size_t)(name_len + 2));
+-
+- if (profile_len)
+- {
+- comp.input_len = profile_len;
+- png_write_compressed_data_out(png_ptr, &comp);
+- }
++ ++name_len;
++
++ png_text_compress_init(&comp, profile, profile_len);
++
++ /* Allow for keyword terminator and compression byte */
++ if (png_text_compress(png_ptr, png_iCCP, &comp, name_len) != Z_OK)
++ png_error(png_ptr, png_ptr->zstream.msg);
++
++ png_write_chunk_header(png_ptr, png_iCCP, name_len + comp.output_len);
++
++ png_write_chunk_data(png_ptr, new_name, name_len);
++
++ png_write_compressed_data_out(png_ptr, &comp);
+
+ png_write_chunk_end(png_ptr);
+- png_free(png_ptr, new_name);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_sPLT_SUPPORTED
+ /* Write a sPLT chunk */
+ void /* PRIVATE */
+-png_write_sPLT(png_structp png_ptr, png_const_sPLT_tp spalette)
++png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
+ {
+- PNG_sPLT;
+- png_size_t name_len;
+- png_charp new_name;
++ png_uint_32 name_len;
++ png_byte new_name[80];
+ png_byte entrybuf[10];
+ png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
+ png_size_t palette_size = entry_size * spalette->nentries;
+@@ -1204,11 +1293,13 @@
+
+ png_debug(1, "in png_write_sPLT");
+
+- if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0)
+- return;
++ name_len = png_check_keyword(png_ptr, spalette->name, new_name);
++
++ if (name_len == 0)
++ png_error(png_ptr, "sPLT: invalid keyword");
+
+ /* Make sure we include the NULL after the name */
+- png_write_chunk_start(png_ptr, png_sPLT,
++ png_write_chunk_header(png_ptr, png_sPLT,
+ (png_uint_32)(name_len + 2 + palette_size));
+
+ png_write_chunk_data(png_ptr, (png_bytep)new_name,
+@@ -1238,7 +1329,7 @@
+ png_save_uint_16(entrybuf + 8, ep->frequency);
+ }
+
+- png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size);
++ png_write_chunk_data(png_ptr, entrybuf, entry_size);
+ }
+ #else
+ ep=spalette->entries;
+@@ -1262,28 +1353,26 @@
+ png_save_uint_16(entrybuf + 8, ep[i].frequency);
+ }
+
+- png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size);
++ png_write_chunk_data(png_ptr, entrybuf, entry_size);
+ }
+ #endif
+
+ png_write_chunk_end(png_ptr);
+- png_free(png_ptr, new_name);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_sBIT_SUPPORTED
+ /* Write the sBIT chunk */
+ void /* PRIVATE */
+-png_write_sBIT(png_structp png_ptr, png_const_color_8p sbit, int color_type)
++png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
+ {
+- PNG_sBIT;
+ png_byte buf[4];
+ png_size_t size;
+
+ png_debug(1, "in png_write_sBIT");
+
+ /* Make sure we don't depend upon the order of PNG_COLOR_8 */
+- if (color_type & PNG_COLOR_MASK_COLOR)
++ if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ png_byte maxbits;
+
+@@ -1316,7 +1405,7 @@
+ size = 1;
+ }
+
+- if (color_type & PNG_COLOR_MASK_ALPHA)
++ if ((color_type & PNG_COLOR_MASK_ALPHA) != 0)
+ {
+ if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth)
+ {
+@@ -1327,53 +1416,42 @@
+ buf[size++] = sbit->alpha;
+ }
+
+- png_write_chunk(png_ptr, png_sBIT, buf, size);
++ png_write_complete_chunk(png_ptr, png_sBIT, buf, size);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_cHRM_SUPPORTED
+ /* Write the cHRM chunk */
+ void /* PRIVATE */
+-png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
+- png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y,
+- png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x,
+- png_fixed_point blue_y)
++png_write_cHRM_fixed(png_structrp png_ptr, const png_xy *xy)
+ {
+- PNG_cHRM;
+ png_byte buf[32];
+
+ png_debug(1, "in png_write_cHRM");
+
+ /* Each value is saved in 1/100,000ths */
+-#ifdef PNG_CHECK_cHRM_SUPPORTED
+- if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
+- green_x, green_y, blue_x, blue_y))
+-#endif
+- {
+- png_save_uint_32(buf, (png_uint_32)white_x);
+- png_save_uint_32(buf + 4, (png_uint_32)white_y);
+-
+- png_save_uint_32(buf + 8, (png_uint_32)red_x);
+- png_save_uint_32(buf + 12, (png_uint_32)red_y);
+-
+- png_save_uint_32(buf + 16, (png_uint_32)green_x);
+- png_save_uint_32(buf + 20, (png_uint_32)green_y);
+-
+- png_save_uint_32(buf + 24, (png_uint_32)blue_x);
+- png_save_uint_32(buf + 28, (png_uint_32)blue_y);
+-
+- png_write_chunk(png_ptr, png_cHRM, buf, (png_size_t)32);
+- }
++ png_save_int_32(buf, xy->whitex);
++ png_save_int_32(buf + 4, xy->whitey);
++
++ png_save_int_32(buf + 8, xy->redx);
++ png_save_int_32(buf + 12, xy->redy);
++
++ png_save_int_32(buf + 16, xy->greenx);
++ png_save_int_32(buf + 20, xy->greeny);
++
++ png_save_int_32(buf + 24, xy->bluex);
++ png_save_int_32(buf + 28, xy->bluey);
++
++ png_write_complete_chunk(png_ptr, png_cHRM, buf, 32);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_tRNS_SUPPORTED
+ /* Write the tRNS chunk */
+ void /* PRIVATE */
+-png_write_tRNS(png_structp png_ptr, png_const_bytep trans_alpha,
++png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
+ png_const_color_16p tran, int num_trans, int color_type)
+ {
+- PNG_tRNS;
+ png_byte buf[6];
+
+ png_debug(1, "in png_write_tRNS");
+@@ -1382,12 +1460,14 @@
+ {
+ if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette)
+ {
+- png_warning(png_ptr, "Invalid number of transparent colors specified");
++ png_app_warning(png_ptr,
++ "Invalid number of transparent colors specified");
+ return;
+ }
+
+ /* Write the chunk out as it is */
+- png_write_chunk(png_ptr, png_tRNS, trans_alpha, (png_size_t)num_trans);
++ png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha,
++ (png_size_t)num_trans);
+ }
+
+ else if (color_type == PNG_COLOR_TYPE_GRAY)
+@@ -1395,14 +1475,14 @@
+ /* One 16 bit value */
+ if (tran->gray >= (1 << png_ptr->bit_depth))
+ {
+- png_warning(png_ptr,
++ png_app_warning(png_ptr,
+ "Ignoring attempt to write tRNS chunk out-of-range for bit_depth");
+
+ return;
+ }
+
+ png_save_uint_16(buf, tran->gray);
+- png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)2);
++ png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)2);
+ }
+
+ else if (color_type == PNG_COLOR_TYPE_RGB)
+@@ -1412,22 +1492,22 @@
+ png_save_uint_16(buf + 2, tran->green);
+ png_save_uint_16(buf + 4, tran->blue);
+ #ifdef PNG_WRITE_16BIT_SUPPORTED
+- if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
++ if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
+ #else
+- if (buf[0] | buf[2] | buf[4])
++ if ((buf[0] | buf[2] | buf[4]) != 0)
+ #endif
+ {
+- png_warning(png_ptr,
++ png_app_warning(png_ptr,
+ "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
+ return;
+ }
+
+- png_write_chunk(png_ptr, png_tRNS, buf, (png_size_t)6);
++ png_write_complete_chunk(png_ptr, png_tRNS, buf, (png_size_t)6);
+ }
+
+ else
+ {
+- png_warning(png_ptr, "Can't write tRNS with an alpha channel");
++ png_app_warning(png_ptr, "Can't write tRNS with an alpha channel");
+ }
+ }
+ #endif
+@@ -1435,9 +1515,8 @@
+ #ifdef PNG_WRITE_bKGD_SUPPORTED
+ /* Write the background chunk */
+ void /* PRIVATE */
+-png_write_bKGD(png_structp png_ptr, png_const_color_16p back, int color_type)
++png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
+ {
+- PNG_bKGD;
+ png_byte buf[6];
+
+ png_debug(1, "in png_write_bKGD");
+@@ -1446,8 +1525,8 @@
+ {
+ if (
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
+- (png_ptr->num_palette ||
+- (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
++ (png_ptr->num_palette != 0 ||
++ (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0) &&
+ #endif
+ back->index >= png_ptr->num_palette)
+ {
+@@ -1456,18 +1535,18 @@
+ }
+
+ buf[0] = back->index;
+- png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
++ png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
+ }
+
+- else if (color_type & PNG_COLOR_MASK_COLOR)
++ else if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ png_save_uint_16(buf, back->red);
+ png_save_uint_16(buf + 2, back->green);
+ png_save_uint_16(buf + 4, back->blue);
+ #ifdef PNG_WRITE_16BIT_SUPPORTED
+- if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
++ if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
+ #else
+- if (buf[0] | buf[2] | buf[4])
++ if ((buf[0] | buf[2] | buf[4]) != 0)
+ #endif
+ {
+ png_warning(png_ptr,
+@@ -1476,7 +1555,7 @@
+ return;
+ }
+
+- png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)6);
++ png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)6);
+ }
+
+ else
+@@ -1490,7 +1569,7 @@
+ }
+
+ png_save_uint_16(buf, back->gray);
+- png_write_chunk(png_ptr, png_bKGD, buf, (png_size_t)2);
++ png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)2);
+ }
+ }
+ #endif
+@@ -1498,9 +1577,8 @@
+ #ifdef PNG_WRITE_hIST_SUPPORTED
+ /* Write the histogram */
+ void /* PRIVATE */
+-png_write_hIST(png_structp png_ptr, png_const_uint_16p hist, int num_hist)
++png_write_hIST(png_structrp png_ptr, png_const_uint_16p hist, int num_hist)
+ {
+- PNG_hIST;
+ int i;
+ png_byte buf[3];
+
+@@ -1515,7 +1593,7 @@
+ return;
+ }
+
+- png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(num_hist * 2));
++ png_write_chunk_header(png_ptr, png_hIST, (png_uint_32)(num_hist * 2));
+
+ for (i = 0; i < num_hist; i++)
+ {
+@@ -1527,236 +1605,93 @@
+ }
+ #endif
+
+-#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
+- defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
+-/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
+- * and if invalid, correct the keyword rather than discarding the entire
+- * chunk. The PNG 1.0 specification requires keywords 1-79 characters in
+- * length, forbids leading or trailing whitespace, multiple internal spaces,
+- * and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
+- *
+- * The new_key is allocated to hold the corrected keyword and must be freed
+- * by the calling routine. This avoids problems with trying to write to
+- * static keywords without having to have duplicate copies of the strings.
+- */
+-png_size_t /* PRIVATE */
+-png_check_keyword(png_structp png_ptr, png_const_charp key, png_charpp new_key)
+-{
+- png_size_t key_len;
+- png_const_charp ikp;
+- png_charp kp, dp;
+- int kflag;
+- int kwarn=0;
+-
+- png_debug(1, "in png_check_keyword");
+-
+- *new_key = NULL;
+-
+- if (key == NULL || (key_len = png_strlen(key)) == 0)
+- {
+- png_warning(png_ptr, "zero length keyword");
+- return ((png_size_t)0);
+- }
+-
+- png_debug1(2, "Keyword to be checked is '%s'", key);
+-
+- *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
+-
+- if (*new_key == NULL)
+- {
+- png_warning(png_ptr, "Out of memory while procesing keyword");
+- return ((png_size_t)0);
+- }
+-
+- /* Replace non-printing characters with a blank and print a warning */
+- for (ikp = key, dp = *new_key; *ikp != '\0'; ikp++, dp++)
+- {
+- if ((png_byte)*ikp < 0x20 ||
+- ((png_byte)*ikp > 0x7E && (png_byte)*ikp < 0xA1))
+- {
+- PNG_WARNING_PARAMETERS(p)
+-
+- png_warning_parameter_unsigned(p, 1, PNG_NUMBER_FORMAT_02x,
+- (png_byte)*ikp);
+- png_formatted_warning(png_ptr, p, "invalid keyword character 0x@1");
+- *dp = ' ';
+- }
+-
+- else
+- {
+- *dp = *ikp;
+- }
+- }
+- *dp = '\0';
+-
+- /* Remove any trailing white space. */
+- kp = *new_key + key_len - 1;
+- if (*kp == ' ')
+- {
+- png_warning(png_ptr, "trailing spaces removed from keyword");
+-
+- while (*kp == ' ')
+- {
+- *(kp--) = '\0';
+- key_len--;
+- }
+- }
+-
+- /* Remove any leading white space. */
+- kp = *new_key;
+- if (*kp == ' ')
+- {
+- png_warning(png_ptr, "leading spaces removed from keyword");
+-
+- while (*kp == ' ')
+- {
+- kp++;
+- key_len--;
+- }
+- }
+-
+- png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
+-
+- /* Remove multiple internal spaces. */
+- for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
+- {
+- if (*kp == ' ' && kflag == 0)
+- {
+- *(dp++) = *kp;
+- kflag = 1;
+- }
+-
+- else if (*kp == ' ')
+- {
+- key_len--;
+- kwarn = 1;
+- }
+-
+- else
+- {
+- *(dp++) = *kp;
+- kflag = 0;
+- }
+- }
+- *dp = '\0';
+- if (kwarn)
+- png_warning(png_ptr, "extra interior spaces removed from keyword");
+-
+- if (key_len == 0)
+- {
+- png_free(png_ptr, *new_key);
+- png_warning(png_ptr, "Zero length keyword");
+- }
+-
+- if (key_len > 79)
+- {
+- png_warning(png_ptr, "keyword length must be 1 - 79 characters");
+- (*new_key)[79] = '\0';
+- key_len = 79;
+- }
+-
+- return (key_len);
+-}
+-#endif
+-
+ #ifdef PNG_WRITE_tEXt_SUPPORTED
+ /* Write a tEXt chunk */
+ void /* PRIVATE */
+-png_write_tEXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
++png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
+ png_size_t text_len)
+ {
+- PNG_tEXt;
+- png_size_t key_len;
+- png_charp new_key;
++ png_uint_32 key_len;
++ png_byte new_key[80];
+
+ png_debug(1, "in png_write_tEXt");
+
+- if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
+- return;
++ key_len = png_check_keyword(png_ptr, key, new_key);
++
++ if (key_len == 0)
++ png_error(png_ptr, "tEXt: invalid keyword");
+
+ if (text == NULL || *text == '\0')
+ text_len = 0;
+
+ else
+- text_len = png_strlen(text);
++ text_len = strlen(text);
++
++ if (text_len > PNG_UINT_31_MAX - (key_len+1))
++ png_error(png_ptr, "tEXt: text too long");
+
+ /* Make sure we include the 0 after the key */
+- png_write_chunk_start(png_ptr, png_tEXt,
+- (png_uint_32)(key_len + text_len + 1));
++ png_write_chunk_header(png_ptr, png_tEXt,
++ (png_uint_32)/*checked above*/(key_len + text_len + 1));
+ /*
+ * We leave it to the application to meet PNG-1.0 requirements on the
+ * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of
+ * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
+ * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
+ */
+- png_write_chunk_data(png_ptr, (png_bytep)new_key,
+- (png_size_t)(key_len + 1));
+-
+- if (text_len)
+- png_write_chunk_data(png_ptr, (png_const_bytep)text,
+- (png_size_t)text_len);
++ png_write_chunk_data(png_ptr, new_key, key_len + 1);
++
++ if (text_len != 0)
++ png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
+
+ png_write_chunk_end(png_ptr);
+- png_free(png_ptr, new_key);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_zTXt_SUPPORTED
+ /* Write a compressed text chunk */
+ void /* PRIVATE */
+-png_write_zTXt(png_structp png_ptr, png_const_charp key, png_const_charp text,
+- png_size_t text_len, int compression)
++png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
++ int compression)
+ {
+- PNG_zTXt;
+- png_size_t key_len;
+- png_byte buf;
+- png_charp new_key;
++ png_uint_32 key_len;
++ png_byte new_key[81];
+ compression_state comp;
+
+ png_debug(1, "in png_write_zTXt");
+
+- comp.num_output_ptr = 0;
+- comp.max_output_ptr = 0;
+- comp.output_ptr = NULL;
+- comp.input = NULL;
+- comp.input_len = 0;
+-
+- if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
++ if (compression == PNG_TEXT_COMPRESSION_NONE)
+ {
+- png_free(png_ptr, new_key);
++ png_write_tEXt(png_ptr, key, text, 0);
+ return;
+ }
+
+- if (text == NULL || *text == '\0' || compression==PNG_TEXT_COMPRESSION_NONE)
+- {
+- png_write_tEXt(png_ptr, new_key, text, (png_size_t)0);
+- png_free(png_ptr, new_key);
+- return;
+- }
+-
+- text_len = png_strlen(text);
++ if (compression != PNG_TEXT_COMPRESSION_zTXt)
++ png_error(png_ptr, "zTXt: invalid compression type");
++
++ key_len = png_check_keyword(png_ptr, key, new_key);
++
++ if (key_len == 0)
++ png_error(png_ptr, "zTXt: invalid keyword");
++
++ /* Add the compression method and 1 for the keyword separator. */
++ new_key[++key_len] = PNG_COMPRESSION_TYPE_BASE;
++ ++key_len;
+
+ /* Compute the compressed data; do it now for the length */
+- text_len = png_text_compress(png_ptr, text, text_len, compression,
+- &comp);
++ png_text_compress_init(&comp, (png_const_bytep)text,
++ text == NULL ? 0 : strlen(text));
++
++ if (png_text_compress(png_ptr, png_zTXt, &comp, key_len) != Z_OK)
++ png_error(png_ptr, png_ptr->zstream.msg);
+
+ /* Write start of chunk */
+- png_write_chunk_start(png_ptr, png_zTXt,
+- (png_uint_32)(key_len+text_len + 2));
++ png_write_chunk_header(png_ptr, png_zTXt, key_len + comp.output_len);
+
+ /* Write key */
+- png_write_chunk_data(png_ptr, (png_bytep)new_key,
+- (png_size_t)(key_len + 1));
+-
+- png_free(png_ptr, new_key);
+-
+- buf = (png_byte)compression;
+-
+- /* Write compression */
+- png_write_chunk_data(png_ptr, &buf, (png_size_t)1);
++ png_write_chunk_data(png_ptr, new_key, key_len);
+
+ /* Write the compressed data */
+- comp.input_len = text_len;
+ png_write_compressed_data_out(png_ptr, &comp);
+
+ /* Close the chunk */
+@@ -1767,104 +1702,109 @@
+ #ifdef PNG_WRITE_iTXt_SUPPORTED
+ /* Write an iTXt chunk */
+ void /* PRIVATE */
+-png_write_iTXt(png_structp png_ptr, int compression, png_const_charp key,
++png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
+ png_const_charp lang, png_const_charp lang_key, png_const_charp text)
+ {
+- PNG_iTXt;
+- png_size_t lang_len, key_len, lang_key_len, text_len;
+- png_charp new_lang;
+- png_charp new_key = NULL;
+- png_byte cbuf[2];
++ png_uint_32 key_len, prefix_len;
++ png_size_t lang_len, lang_key_len;
++ png_byte new_key[82];
+ compression_state comp;
+
+ png_debug(1, "in png_write_iTXt");
+
+- comp.num_output_ptr = 0;
+- comp.max_output_ptr = 0;
+- comp.output_ptr = NULL;
+- comp.input = NULL;
+-
+- if ((key_len = png_check_keyword(png_ptr, key, &new_key)) == 0)
+- return;
+-
+- if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang)) == 0)
++ key_len = png_check_keyword(png_ptr, key, new_key);
++
++ if (key_len == 0)
++ png_error(png_ptr, "iTXt: invalid keyword");
++
++ /* Set the compression flag */
++ switch (compression)
+ {
+- png_warning(png_ptr, "Empty language field in iTXt chunk");
+- new_lang = NULL;
+- lang_len = 0;
++ case PNG_ITXT_COMPRESSION_NONE:
++ case PNG_TEXT_COMPRESSION_NONE:
++ compression = new_key[++key_len] = 0; /* no compression */
++ break;
++
++ case PNG_TEXT_COMPRESSION_zTXt:
++ case PNG_ITXT_COMPRESSION_zTXt:
++ compression = new_key[++key_len] = 1; /* compressed */
++ break;
++
++ default:
++ png_error(png_ptr, "iTXt: invalid compression");
+ }
+
+- if (lang_key == NULL)
+- lang_key_len = 0;
+-
+- else
+- lang_key_len = png_strlen(lang_key);
+-
+- if (text == NULL)
+- text_len = 0;
+-
+- else
+- text_len = png_strlen(text);
+-
+- /* Compute the compressed data; do it now for the length */
+- text_len = png_text_compress(png_ptr, text, text_len, compression - 2,
+- &comp);
+-
+-
+- /* Make sure we include the compression flag, the compression byte,
+- * and the NULs after the key, lang, and lang_key parts
+- */
+-
+- png_write_chunk_start(png_ptr, png_iTXt, (png_uint_32)(
+- 5 /* comp byte, comp flag, terminators for key, lang and lang_key */
+- + key_len
+- + lang_len
+- + lang_key_len
+- + text_len));
++ new_key[++key_len] = PNG_COMPRESSION_TYPE_BASE;
++ ++key_len; /* for the keywod separator */
+
+ /* We leave it to the application to meet PNG-1.0 requirements on the
+ * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of
+- * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
++ * any non-Latin-1 characters except for NEWLINE. ISO PNG, however,
++ * specifies that the text is UTF-8 and this really doesn't require any
++ * checking.
++ *
+ * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
++ *
++ * TODO: validate the language tag correctly (see the spec.)
+ */
+- png_write_chunk_data(png_ptr, (png_bytep)new_key, (png_size_t)(key_len + 1));
+-
+- /* Set the compression flag */
+- if (compression == PNG_ITXT_COMPRESSION_NONE ||
+- compression == PNG_TEXT_COMPRESSION_NONE)
+- cbuf[0] = 0;
+-
+- else /* compression == PNG_ITXT_COMPRESSION_zTXt */
+- cbuf[0] = 1;
+-
+- /* Set the compression method */
+- cbuf[1] = 0;
+-
+- png_write_chunk_data(png_ptr, cbuf, (png_size_t)2);
+-
+- cbuf[0] = 0;
+- png_write_chunk_data(png_ptr, (new_lang ? (png_const_bytep)new_lang : cbuf),
+- (png_size_t)(lang_len + 1));
+-
+- png_write_chunk_data(png_ptr, (lang_key ? (png_const_bytep)lang_key : cbuf),
+- (png_size_t)(lang_key_len + 1));
+-
+- png_write_compressed_data_out(png_ptr, &comp);
++ if (lang == NULL) lang = ""; /* empty language is valid */
++ lang_len = strlen(lang)+1;
++ if (lang_key == NULL) lang_key = ""; /* may be empty */
++ lang_key_len = strlen(lang_key)+1;
++ if (text == NULL) text = ""; /* may be empty */
++
++ prefix_len = key_len;
++ if (lang_len > PNG_UINT_31_MAX-prefix_len)
++ prefix_len = PNG_UINT_31_MAX;
++ else
++ prefix_len = (png_uint_32)(prefix_len + lang_len);
++
++ if (lang_key_len > PNG_UINT_31_MAX-prefix_len)
++ prefix_len = PNG_UINT_31_MAX;
++ else
++ prefix_len = (png_uint_32)(prefix_len + lang_key_len);
++
++ png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
++
++ if (compression != 0)
++ {
++ if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
++ png_error(png_ptr, png_ptr->zstream.msg);
++ }
++
++ else
++ {
++ if (comp.input_len > PNG_UINT_31_MAX-prefix_len)
++ png_error(png_ptr, "iTXt: uncompressed text too long");
++
++ /* So the string will fit in a chunk: */
++ comp.output_len = (png_uint_32)/*SAFE*/comp.input_len;
++ }
++
++ png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len);
++
++ png_write_chunk_data(png_ptr, new_key, key_len);
++
++ png_write_chunk_data(png_ptr, (png_const_bytep)lang, lang_len);
++
++ png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
++
++ if (compression != 0)
++ png_write_compressed_data_out(png_ptr, &comp);
++
++ else
++ png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.input_len);
+
+ png_write_chunk_end(png_ptr);
+-
+- png_free(png_ptr, new_key);
+- png_free(png_ptr, new_lang);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_oFFs_SUPPORTED
+ /* Write the oFFs chunk */
+ void /* PRIVATE */
+-png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
++png_write_oFFs(png_structrp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
+ int unit_type)
+ {
+- PNG_oFFs;
+ png_byte buf[9];
+
+ png_debug(1, "in png_write_oFFs");
+@@ -1876,52 +1816,57 @@
+ png_save_int_32(buf + 4, y_offset);
+ buf[8] = (png_byte)unit_type;
+
+- png_write_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
++ png_write_complete_chunk(png_ptr, png_oFFs, buf, (png_size_t)9);
+ }
+ #endif
+ #ifdef PNG_WRITE_pCAL_SUPPORTED
+ /* Write the pCAL chunk (described in the PNG extensions document) */
+ void /* PRIVATE */
+-png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
++png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
+ png_int_32 X1, int type, int nparams, png_const_charp units,
+ png_charpp params)
+ {
+- PNG_pCAL;
+- png_size_t purpose_len, units_len, total_len;
+- png_uint_32p params_len;
++ png_uint_32 purpose_len;
++ png_size_t units_len, total_len;
++ png_size_tp params_len;
+ png_byte buf[10];
+- png_charp new_purpose;
++ png_byte new_purpose[80];
+ int i;
+
+ png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
+
+ if (type >= PNG_EQUATION_LAST)
+- png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
+-
+- purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
++ png_error(png_ptr, "Unrecognized equation type for pCAL chunk");
++
++ purpose_len = png_check_keyword(png_ptr, purpose, new_purpose);
++
++ if (purpose_len == 0)
++ png_error(png_ptr, "pCAL: invalid keyword");
++
++ ++purpose_len; /* terminator */
++
+ png_debug1(3, "pCAL purpose length = %d", (int)purpose_len);
+- units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
++ units_len = strlen(units) + (nparams == 0 ? 0 : 1);
+ png_debug1(3, "pCAL units length = %d", (int)units_len);
+ total_len = purpose_len + units_len + 10;
+
+- params_len = (png_uint_32p)png_malloc(png_ptr,
+- (png_alloc_size_t)(nparams * png_sizeof(png_uint_32)));
++ params_len = (png_size_tp)png_malloc(png_ptr,
++ (png_alloc_size_t)(nparams * (sizeof (png_size_t))));
+
+ /* Find the length of each parameter, making sure we don't count the
+ * null terminator for the last parameter.
+ */
+ for (i = 0; i < nparams; i++)
+ {
+- params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
++ params_len[i] = strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
+ png_debug2(3, "pCAL parameter %d length = %lu", i,
+ (unsigned long)params_len[i]);
+- total_len += (png_size_t)params_len[i];
++ total_len += params_len[i];
+ }
+
+ png_debug1(3, "pCAL total length = %d", (int)total_len);
+- png_write_chunk_start(png_ptr, png_pCAL, (png_uint_32)total_len);
+- png_write_chunk_data(png_ptr, (png_const_bytep)new_purpose,
+- (png_size_t)purpose_len);
++ png_write_chunk_header(png_ptr, png_pCAL, (png_uint_32)total_len);
++ png_write_chunk_data(png_ptr, new_purpose, purpose_len);
+ png_save_int_32(buf, X0);
+ png_save_int_32(buf + 4, X1);
+ buf[8] = (png_byte)type;
+@@ -1929,12 +1874,9 @@
+ png_write_chunk_data(png_ptr, buf, (png_size_t)10);
+ png_write_chunk_data(png_ptr, (png_const_bytep)units, (png_size_t)units_len);
+
+- png_free(png_ptr, new_purpose);
+-
+ for (i = 0; i < nparams; i++)
+ {
+- png_write_chunk_data(png_ptr, (png_const_bytep)params[i],
+- (png_size_t)params_len[i]);
++ png_write_chunk_data(png_ptr, (png_const_bytep)params[i], params_len[i]);
+ }
+
+ png_free(png_ptr, params_len);
+@@ -1945,17 +1887,16 @@
+ #ifdef PNG_WRITE_sCAL_SUPPORTED
+ /* Write the sCAL chunk */
+ void /* PRIVATE */
+-png_write_sCAL_s(png_structp png_ptr, int unit, png_const_charp width,
++png_write_sCAL_s(png_structrp png_ptr, int unit, png_const_charp width,
+ png_const_charp height)
+ {
+- PNG_sCAL;
+ png_byte buf[64];
+ png_size_t wlen, hlen, total_len;
+
+ png_debug(1, "in png_write_sCAL_s");
+
+- wlen = png_strlen(width);
+- hlen = png_strlen(height);
++ wlen = strlen(width);
++ hlen = strlen(height);
+ total_len = wlen + hlen + 2;
+
+ if (total_len > 64)
+@@ -1965,22 +1906,21 @@
+ }
+
+ buf[0] = (png_byte)unit;
+- png_memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */
+- png_memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */
++ memcpy(buf + 1, width, wlen + 1); /* Append the '\0' here */
++ memcpy(buf + wlen + 2, height, hlen); /* Do NOT append the '\0' here */
+
+ png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
+- png_write_chunk(png_ptr, png_sCAL, buf, total_len);
++ png_write_complete_chunk(png_ptr, png_sCAL, buf, total_len);
+ }
+ #endif
+
+ #ifdef PNG_WRITE_pHYs_SUPPORTED
+ /* Write the pHYs chunk */
+ void /* PRIVATE */
+-png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
++png_write_pHYs(png_structrp png_ptr, png_uint_32 x_pixels_per_unit,
+ png_uint_32 y_pixels_per_unit,
+ int unit_type)
+ {
+- PNG_pHYs;
+ png_byte buf[9];
+
+ png_debug(1, "in png_write_pHYs");
+@@ -1992,7 +1932,7 @@
+ png_save_uint_32(buf + 4, y_pixels_per_unit);
+ buf[8] = (png_byte)unit_type;
+
+- png_write_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
++ png_write_complete_chunk(png_ptr, png_pHYs, buf, (png_size_t)9);
+ }
+ #endif
+
+@@ -2001,9 +1941,8 @@
+ * or png_convert_from_time_t(), or fill in the structure yourself.
+ */
+ void /* PRIVATE */
+-png_write_tIME(png_structp png_ptr, png_const_timep mod_time)
++png_write_tIME(png_structrp png_ptr, png_const_timep mod_time)
+ {
+- PNG_tIME;
+ png_byte buf[7];
+
+ png_debug(1, "in png_write_tIME");
+@@ -2023,40 +1962,44 @@
+ buf[5] = mod_time->minute;
+ buf[6] = mod_time->second;
+
+- png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
++ png_write_complete_chunk(png_ptr, png_tIME, buf, (png_size_t)7);
+ }
+ #endif
+
+ /* Initializes the row writing capability of libpng */
+ void /* PRIVATE */
+-png_write_start_row(png_structp png_ptr)
++png_write_start_row(png_structrp png_ptr)
+ {
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
+- int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
++ static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
+- int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
++ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ #endif
+
+- png_size_t buf_size;
++ png_alloc_size_t buf_size;
++ int usr_pixel_depth;
+
+ png_debug(1, "in png_write_start_row");
+
+- buf_size = (png_size_t)(PNG_ROWBYTES(
+- png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1);
++ usr_pixel_depth = png_ptr->usr_channels * png_ptr->usr_bit_depth;
++ buf_size = PNG_ROWBYTES(usr_pixel_depth, png_ptr->width) + 1;
++
++ /* 1.5.6: added to allow checking in the row write code. */
++ png_ptr->transformed_pixel_depth = png_ptr->pixel_depth;
++ png_ptr->maximum_pixel_depth = (png_byte)usr_pixel_depth;
+
+ /* Set up row buffer */
+- png_ptr->row_buf = (png_bytep)png_malloc(png_ptr,
+- (png_alloc_size_t)buf_size);
++ png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, buf_size);
+
+ png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
+
+@@ -2070,13 +2013,13 @@
+ }
+
+ /* We only need to keep the previous row if we are using one of these. */
+- if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
++ if ((png_ptr->do_filter &
++ (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
+ {
+ /* Set up previous row buffer */
+- png_ptr->prev_row = (png_bytep)png_calloc(png_ptr,
+- (png_alloc_size_t)buf_size);
+-
+- if (png_ptr->do_filter & PNG_FILTER_UP)
++ png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
++
++ if ((png_ptr->do_filter & PNG_FILTER_UP) != 0)
+ {
+ png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
+ png_ptr->rowbytes + 1);
+@@ -2084,7 +2027,7 @@
+ png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
+ }
+
+- if (png_ptr->do_filter & PNG_FILTER_AVG)
++ if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0)
+ {
+ png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
+ png_ptr->rowbytes + 1);
+@@ -2092,7 +2035,7 @@
+ png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
+ }
+
+- if (png_ptr->do_filter & PNG_FILTER_PAETH)
++ if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0)
+ {
+ png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
+ png_ptr->rowbytes + 1);
+@@ -2100,13 +2043,13 @@
+ png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
+ }
+ }
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++#endif /* WRITE_FILTER */
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* If interlaced, we need to set up width and height of pass */
+- if (png_ptr->interlaced)
++ if (png_ptr->interlaced != 0)
+ {
+- if (!(png_ptr->transformations & PNG_INTERLACE))
++ if ((png_ptr->transformations & PNG_INTERLACE) == 0)
+ {
+ png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
+ png_pass_ystart[0]) / png_pass_yinc[0];
+@@ -2128,34 +2071,28 @@
+ png_ptr->num_rows = png_ptr->height;
+ png_ptr->usr_width = png_ptr->width;
+ }
+-
+- png_zlib_claim(png_ptr, PNG_ZLIB_FOR_IDAT);
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+ }
+
+ /* Internal use only. Called when finished processing a row of data. */
+ void /* PRIVATE */
+-png_write_finish_row(png_structp png_ptr)
++png_write_finish_row(png_structrp png_ptr)
+ {
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ /* Start of interlace block in the y direction */
+- int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
++ static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+
+ /* Offset to next interlace block in the y direction */
+- int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
++ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ #endif
+
+- int ret;
+-
+ png_debug(1, "in png_write_finish_row");
+
+ /* Next row */
+@@ -2167,10 +2104,10 @@
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+ /* If interlaced, go to next pass */
+- if (png_ptr->interlaced)
++ if (png_ptr->interlaced != 0)
+ {
+ png_ptr->row_number = 0;
+- if (png_ptr->transformations & PNG_INTERLACE)
++ if ((png_ptr->transformations & PNG_INTERLACE) != 0)
+ {
+ png_ptr->pass++;
+ }
+@@ -2195,7 +2132,7 @@
+ png_pass_ystart[png_ptr->pass]) /
+ png_pass_yinc[png_ptr->pass];
+
+- if (png_ptr->transformations & PNG_INTERLACE)
++ if ((png_ptr->transformations & PNG_INTERLACE) != 0)
+ break;
+
+ } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);
+@@ -2206,7 +2143,7 @@
+ if (png_ptr->pass < 7)
+ {
+ if (png_ptr->prev_row != NULL)
+- png_memset(png_ptr->prev_row, 0,
++ memset(png_ptr->prev_row, 0,
+ (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels*
+ png_ptr->usr_bit_depth, png_ptr->width)) + 1);
+
+@@ -2217,42 +2154,7 @@
+
+ /* If we get here, we've just written the last row, so we need
+ to flush the compressor */
+- do
+- {
+- /* Tell the compressor we are done */
+- ret = deflate(&png_ptr->zstream, Z_FINISH);
+-
+- /* Check for an error */
+- if (ret == Z_OK)
+- {
+- /* Check to see if we need more room */
+- if (!(png_ptr->zstream.avail_out))
+- {
+- png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
+- png_ptr->zstream.next_out = png_ptr->zbuf;
+- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
+- }
+- }
+-
+- else if (ret != Z_STREAM_END)
+- {
+- if (png_ptr->zstream.msg != NULL)
+- png_error(png_ptr, png_ptr->zstream.msg);
+-
+- else
+- png_error(png_ptr, "zlib error");
+- }
+- } while (ret != Z_STREAM_END);
+-
+- /* Write any extra space */
+- if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
+- {
+- png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size -
+- png_ptr->zstream.avail_out);
+- }
+-
+- png_zlib_release(png_ptr);
+- png_ptr->zstream.data_type = Z_BINARY;
++ png_compress_IDAT(png_ptr, NULL, 0, Z_FINISH);
+ }
+
+ #ifdef PNG_WRITE_INTERLACING_SUPPORTED
+@@ -2269,10 +2171,10 @@
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+
+ /* Start of interlace block */
+- int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
++ static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+
+ /* Offset to next interlace block */
+- int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
++ static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+
+ png_debug(1, "in png_do_write_interlace");
+
+@@ -2416,7 +2318,7 @@
+
+ /* Move the pixel */
+ if (dp != sp)
+- png_memcpy(dp, sp, pixel_bytes);
++ memcpy(dp, sp, pixel_bytes);
+
+ /* Next pixel */
+ dp += pixel_bytes;
+@@ -2440,14 +2342,16 @@
+ * been specified by the application, and then writes the row out with the
+ * chosen filter.
+ */
+-static void png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row);
++static void
++png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
++ png_size_t row_bytes);
+
+ #define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
+ #define PNG_HISHIFT 10
+ #define PNG_LOMASK ((png_uint_32)0xffffL)
+ #define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT))
+ void /* PRIVATE */
+-png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
++png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
+ {
+ png_bytep best_row;
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
+@@ -2456,7 +2360,7 @@
+ png_byte filter_to_do = png_ptr->do_filter;
+ png_size_t row_bytes = row_info->rowbytes;
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+- int num_p_filters = (int)png_ptr->num_prev_filters;
++ int num_p_filters = png_ptr->num_prev_filters;
+ #endif
+
+ png_debug(1, "in png_write_find_filter");
+@@ -2507,7 +2411,7 @@
+ /* We don't need to test the 'no filter' case if this is the only filter
+ * that has been chosen, as it doesn't actually do anything to the data.
+ */
+- if ((filter_to_do & PNG_FILTER_NONE) && filter_to_do != PNG_FILTER_NONE)
++ if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
+ {
+ png_bytep rp;
+ png_uint_32 sum = 0;
+@@ -2583,7 +2487,7 @@
+ best_row = png_ptr->sub_row;
+ }
+
+- else if (filter_to_do & PNG_FILTER_SUB)
++ else if ((filter_to_do & PNG_FILTER_SUB) != 0)
+ {
+ png_bytep rp, dp, lp;
+ png_uint_32 sum = 0, lmins = mins;
+@@ -2704,7 +2608,7 @@
+ best_row = png_ptr->up_row;
+ }
+
+- else if (filter_to_do & PNG_FILTER_UP)
++ else if ((filter_to_do & PNG_FILTER_UP) != 0)
+ {
+ png_bytep rp, dp, pp;
+ png_uint_32 sum = 0, lmins = mins;
+@@ -2818,7 +2722,7 @@
+ best_row = png_ptr->avg_row;
+ }
+
+- else if (filter_to_do & PNG_FILTER_AVG)
++ else if ((filter_to_do & PNG_FILTER_AVG) != 0)
+ {
+ png_bytep rp, dp, pp, lp;
+ png_uint_32 sum = 0, lmins = mins;
+@@ -2920,7 +2824,7 @@
+ }
+
+ /* Paeth filter */
+- if (filter_to_do == PNG_FILTER_PAETH)
++ if ((filter_to_do == PNG_FILTER_PAETH) != 0)
+ {
+ png_bytep rp, dp, pp, cp, lp;
+ png_size_t i;
+@@ -2959,7 +2863,7 @@
+ best_row = png_ptr->paeth_row;
+ }
+
+- else if (filter_to_do & PNG_FILTER_PAETH)
++ else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
+ {
+ png_bytep rp, dp, pp, cp, lp;
+ png_uint_32 sum = 0, lmins = mins;
+@@ -3029,7 +2933,7 @@
+ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+ #endif
+ p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
+-#else /* PNG_SLOW_PAETH */
++#else /* SLOW_PAETH */
+ p = a + b - c;
+ pa = abs(p - a);
+ pb = abs(p - b);
+@@ -3043,7 +2947,7 @@
+
+ else
+ p = c;
+-#endif /* PNG_SLOW_PAETH */
++#endif /* SLOW_PAETH */
+
+ v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
+
+@@ -3092,10 +2996,10 @@
+ best_row = png_ptr->paeth_row;
+ }
+ }
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++#endif /* WRITE_FILTER */
++
+ /* Do the actual writing of the filtered row data from the chosen filter. */
+-
+- png_write_filtered_row(png_ptr, best_row);
++ png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
+
+ #ifdef PNG_WRITE_FILTER_SUPPORTED
+ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+@@ -3112,74 +3016,20 @@
+ png_ptr->prev_filters[j] = best_row[0];
+ }
+ #endif
+-#endif /* PNG_WRITE_FILTER_SUPPORTED */
++#endif /* WRITE_FILTER */
+ }
+
+
+ /* Do the actual writing of a previously filtered row. */
+ static void
+-png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
++png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
++ png_size_t full_row_length/*includes filter byte*/)
+ {
+- png_size_t avail;
+-
+ png_debug(1, "in png_write_filtered_row");
+
+ png_debug1(2, "filter = %d", filtered_row[0]);
+- /* Set up the zlib input buffer */
+-
+- png_ptr->zstream.next_in = filtered_row;
+- png_ptr->zstream.avail_in = 0;
+- avail = png_ptr->row_info.rowbytes + 1;
+- /* Repeat until we have compressed all the data */
+- do
+- {
+- int ret; /* Return of zlib */
+-
+- /* Record the number of bytes available - zlib supports at least 65535
+- * bytes at one step, depending on the size of the zlib type 'uInt', the
+- * maximum size zlib can write at once is ZLIB_IO_MAX (from pngpriv.h).
+- * Use this because on 16 bit systems 'rowbytes' can be up to 65536 (i.e.
+- * one more than 16 bits) and, in this case 'rowbytes+1' can overflow a
+- * uInt. ZLIB_IO_MAX can be safely reduced to cause zlib to be called
+- * with smaller chunks of data.
+- */
+- if (png_ptr->zstream.avail_in == 0)
+- {
+- if (avail > ZLIB_IO_MAX)
+- {
+- png_ptr->zstream.avail_in = ZLIB_IO_MAX;
+- avail -= ZLIB_IO_MAX;
+- }
+-
+- else
+- {
+- /* So this will fit in the available uInt space: */
+- png_ptr->zstream.avail_in = (uInt)avail;
+- avail = 0;
+- }
+- }
+-
+- /* Compress the data */
+- ret = deflate(&png_ptr->zstream, Z_NO_FLUSH);
+-
+- /* Check for compression errors */
+- if (ret != Z_OK)
+- {
+- if (png_ptr->zstream.msg != NULL)
+- png_error(png_ptr, png_ptr->zstream.msg);
+-
+- else
+- png_error(png_ptr, "zlib error");
+- }
+-
+- /* See if it is time to write another IDAT */
+- if (!(png_ptr->zstream.avail_out))
+- {
+- /* Write the IDAT and reset the zlib output buffer */
+- png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
+- }
+- /* Repeat until all data has been compressed */
+- } while (avail > 0 || png_ptr->zstream.avail_in > 0);
++
++ png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
+
+ /* Swap the current and previous rows */
+ if (png_ptr->prev_row != NULL)
+@@ -3202,6 +3052,6 @@
+ {
+ png_write_flush(png_ptr);
+ }
+-#endif
++#endif /* WRITE_FLUSH */
+ }
+-#endif /* PNG_WRITE_SUPPORTED */
++#endif /* WRITE */
+--- ./jdk/src/share/native/sun/font/layout/LETableReference.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/LETableReference.h Fri Apr 10 09:21:28 2015 -0700
+@@ -151,8 +151,8 @@
+ if(isEmpty()) {
+ //err = LE_MISSING_FONT_TABLE_ERROR;
+ clear(); // it's just empty. Not an error.
+- } else if(offset >= fParent->fLength) {
+- LE_DEBUG_TR3("offset out of range: (%p) +%d", NULL, offset);
++ } else if(offset >= fParent->fLength || (offset & 0x01)) {
++ LE_DEBUG_TR3("offset out of range or odd alignment: (%p) +%d", NULL, offset);
+ err = LE_INDEX_OUT_OF_BOUNDS_ERROR;
+ clear();
+ } else {
+--- ./jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/LigatureSubstProc.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -115,7 +115,7 @@
+ LE_DEBUG_BAD_FONT("off end of ligature substitution header");
+ return newState; // get out! bad font
+ }
+- if(componentGlyph > glyphStorage.getGlyphCount()) {
++ if(componentGlyph >= glyphStorage.getGlyphCount()) {
+ LE_DEBUG_BAD_FONT("preposterous componentGlyph");
+ currGlyph++;
+ return newState; // get out! bad font
+--- ./jdk/src/share/native/sun/font/layout/LigatureSubstProc2.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/LigatureSubstProc2.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -119,7 +119,7 @@
+
+ offset = action & lafComponentOffsetMask;
+ if (offset != 0) {
+- if(componentGlyph > glyphStorage.getGlyphCount()) {
++ if(componentGlyph >= glyphStorage.getGlyphCount()) {
+ LE_DEBUG_BAD_FONT("preposterous componentGlyph");
+ currGlyph+= dir;
+ return nextStateIndex; // get out! bad font
+--- ./jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/LigatureSubstSubtables.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -58,7 +58,7 @@
+ if( LE_FAILURE(success) ) { return 0; }
+ le_uint16 ligCount = SWAPW(ligSetTable->ligatureCount);
+
+- LEReferenceTo<Offset> ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount);
++ LEReferenceToArrayOf<Offset> ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount);
+ for (le_uint16 lig = 0; LE_SUCCESS(success) && lig < ligCount; lig += 1) {
+ Offset ligTableOffset = SWAPW(ligSetTable->ligatureTableOffsetArray[lig]);
+ LEReferenceTo<LigatureTable> ligTable(ligSetTable, success, ligTableOffset);
+--- ./jdk/src/share/native/sun/font/layout/LookupProcessor.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/LookupProcessor.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -255,6 +255,7 @@
+
+ if (requiredFeatureIndex != 0xFFFF) {
+ requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success);
++ if (LE_FAILURE(success)) return;
+ featureReferences += SWAPW(requiredFeatureTable->lookupCount);
+ }
+
+@@ -292,7 +293,7 @@
+ }
+
+ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
+-
++ if (LE_FAILURE(success)) continue;
+ if (featureTag == fm.tag) {
+ count += selectLookups(featureTable, fm.mask, order + count, success);
+ }
+@@ -319,7 +320,7 @@
+ #endif
+
+ featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
+-
++ if (LE_FAILURE(success)) continue;
+ if (featureTag == fm.tag) {
+ order += selectLookups(featureTable, fm.mask, order, success);
+ }
+--- ./jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/font/layout/MultipleSubstSubtables.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -71,7 +71,12 @@
+ if (coverageIndex >= 0 && coverageIndex < seqCount) {
+ Offset sequenceTableOffset = SWAPW(sequenceTableOffsetArray[coverageIndex]);
+ LEReferenceTo<SequenceTable> sequenceTable(base, success, sequenceTableOffset);
++ if (LE_FAILURE(success)) {
++ return 0;
++ }
+ le_uint16 glyphCount = SWAPW(sequenceTable->glyphCount);
++ LEReferenceToArrayOf<Offset>
++ substituteArrayRef(base, success, sequenceTable->substituteArray, glyphCount);
+
+ if (glyphCount == 0) {
+ glyphIterator->setCurrGlyphID(0xFFFF);
+--- ./jdk/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h Fri Apr 10 09:21:28 2015 -0700
+@@ -30,6 +30,8 @@
+ extern "C" {
+ #endif
+
++#include <stddef.h>
++
+ #include "java_awt_AlphaComposite.h"
+
+ #include "SurfaceData.h"
+@@ -484,7 +486,9 @@
+ #define ArraySize(A) (sizeof(A) / sizeof(A[0]))
+
+ #define PtrAddBytes(p, b) ((void *) (((intptr_t) (p)) + (b)))
+-#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, (y)*(yinc) + (x)*(xinc))
++#define PtrCoord(p, x, xinc, y, yinc) PtrAddBytes(p, \
++ ((ptrdiff_t)(y))*(yinc) + \
++ ((ptrdiff_t)(x))*(xinc))
+
+ /*
+ * The function to call with an array of NativePrimitive structures
+--- ./jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c Fri Apr 10 09:21:28 2015 -0700
+@@ -110,6 +110,7 @@
+ emit_inet("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IP, IP_MULTICAST_LOOP);
+
+ #ifdef AF_INET6
++ emit_inet6("StandardSocketOptions.IP_TOS", IPPROTO_IPV6, IPV6_TCLASS);
+ emit_inet6("StandardSocketOptions.IP_MULTICAST_IF", IPPROTO_IPV6, IPV6_MULTICAST_IF);
+ emit_inet6("StandardSocketOptions.IP_MULTICAST_TTL", IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
+ emit_inet6("StandardSocketOptions.IP_MULTICAST_LOOP", IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
+--- ./jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c Fri Apr 10 09:21:28 2015 -0700
+@@ -26,6 +26,7 @@
+ #include "sun_security_jgss_wrapper_GSSLibStub.h"
+ #include "NativeUtil.h"
+ #include "NativeFunc.h"
++#include "jlong.h"
+
+ /* Constants for indicating what type of info is needed for inqueries */
+ const int TYPE_CRED_NAME = 10;
+@@ -75,14 +76,14 @@
+ jclass jcls,
+ jbyteArray jbytes) {
+ gss_OID cOid;
+- int i, len;
++ unsigned int i, len;
+ jbyte* bytes;
+ jthrowable gssEx;
+ jboolean found;
+
+ if (jbytes != NULL) {
+ found = JNI_FALSE;
+- len = (*env)->GetArrayLength(env, jbytes) - 2;
++ len = (unsigned int)((*env)->GetArrayLength(env, jbytes) - 2);
+ bytes = (*env)->GetByteArrayElements(env, jbytes, NULL);
+ if (bytes != NULL) {
+ for (i = 0; i < ftab->mechs->count; i++) {
+@@ -98,9 +99,9 @@
+ }
+ if (found != JNI_TRUE) {
+ checkStatus(env, NULL, GSS_S_BAD_MECH, 0, "[GSSLibStub_getMechPtr]");
+- return NULL;
+- } else return cOid;
+- } else return GSS_C_NO_OID;
++ return ptr_to_jlong(NULL);
++ } else return ptr_to_jlong(cOid);
++ } else return ptr_to_jlong(GSS_C_NO_OID);
+ }
+
+
+@@ -244,7 +245,7 @@
+
+ if (ftab->inquireNamesForMech != NULL) {
+
+- mech = (gss_OID) (*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech);
++ mech = (gss_OID)jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+ nameTypes = GSS_C_NO_OID_SET;
+
+ /* gss_inquire_names_for_mech(...) => N/A */
+@@ -273,7 +274,7 @@
+ OM_uint32 minor, major;
+ gss_name_t nameHdl;
+
+- nameHdl = (gss_name_t) pName;
++ nameHdl = (gss_name_t) jlong_to_ptr(pName);
+
+ sprintf(debugBuf, "[GSSLibStub_releaseName] %ld", (long) pName);
+ debug(env, debugBuf);
+@@ -319,7 +320,7 @@
+ resetGSSBuffer(env, jnameVal, &nameVal);
+
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_importName]");
+- return (jlong) nameHdl;
++ return ptr_to_jlong(nameHdl);
+ }
+
+
+@@ -339,8 +340,8 @@
+ int isEqual;
+
+ isEqual = 0;
+- nameHdl1 = (gss_name_t) pName1;
+- nameHdl2 = (gss_name_t) pName2;
++ nameHdl1 = (gss_name_t) jlong_to_ptr(pName1);
++ nameHdl2 = (gss_name_t) jlong_to_ptr(pName2);
+
+ sprintf(debugBuf, "[GSSLibStub_compareName] %ld %ld", (long) pName1,
+ (long) pName2);
+@@ -370,12 +371,12 @@
+ gss_name_t nameHdl, mnNameHdl;
+ gss_OID mech;
+
+- nameHdl = (gss_name_t) pName;
++ nameHdl = (gss_name_t) jlong_to_ptr(pName);
+ sprintf(debugBuf, "[GSSLibStub_canonicalizeName] %ld", (long) pName);
+ debug(env, debugBuf);
+
+ if (nameHdl != GSS_C_NO_NAME) {
+- mech = (gss_OID) (*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech);
++ mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+ mnNameHdl = GSS_C_NO_NAME;
+
+ /* gss_canonicalize_name(...) may return GSS_S_BAD_NAMETYPE,
+@@ -391,7 +392,7 @@
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_canonicalizeName]");
+ } else mnNameHdl = GSS_C_NO_NAME;
+
+- return (jlong) mnNameHdl;
++ return ptr_to_jlong(mnNameHdl);
+ }
+
+ /*
+@@ -408,7 +409,7 @@
+ gss_buffer_desc outBuf;
+ jbyteArray jresult;
+
+- nameHdl = (gss_name_t) pName;
++ nameHdl = (gss_name_t) jlong_to_ptr(pName);
+ sprintf(debugBuf, "[GSSLibStub_exportName] %ld", (long) pName);
+ debug(env, debugBuf);
+
+@@ -420,16 +421,16 @@
+ if (major == GSS_S_NAME_NOT_MN) {
+ debug(env, "[GSSLibStub_exportName] canonicalize and re-try");
+
+- mNameHdl = (gss_name_t)
++ mNameHdl = (gss_name_t)jlong_to_ptr(
+ Java_sun_security_jgss_wrapper_GSSLibStub_canonicalizeName
+- (env, jobj, pName);
++ (env, jobj, pName));
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+ return NULL;
+ }
+ major = (*ftab->exportName)(&minor, mNameHdl, &outBuf);
+ Java_sun_security_jgss_wrapper_GSSLibStub_releaseName
+- (env, jobj, (jlong) mNameHdl);
++ (env, jobj, ptr_to_jlong(mNameHdl));
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+ return NULL;
+@@ -460,7 +461,7 @@
+ jobject jtype;
+ jobjectArray jresult;
+
+- nameHdl = (gss_name_t) pName;
++ nameHdl = (gss_name_t) jlong_to_ptr(pName);
+ sprintf(debugBuf, "[GSSLibStub_displayName] %ld", (long) pName);
+ debug(env, debugBuf);
+
+@@ -512,10 +513,10 @@
+ debug(env, "[GSSLibStub_acquireCred]");
+
+
+- mech = (gss_OID) (*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech);
++ mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+ mechs = newGSSOIDSet(env, mech);
+ credUsage = (gss_cred_usage_t) usage;
+- nameHdl = (gss_name_t) pName;
++ nameHdl = (gss_name_t) jlong_to_ptr(pName);
+ credHdl = GSS_C_NO_CREDENTIAL;
+
+ sprintf(debugBuf, "[GSSLibStub_acquireCred] pName=%ld, usage=%d",
+@@ -534,7 +535,7 @@
+ debug(env, debugBuf);
+
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_acquireCred]");
+- return (jlong) credHdl;
++ return ptr_to_jlong(credHdl);
+ }
+
+ /*
+@@ -550,9 +551,9 @@
+ OM_uint32 minor, major;
+ gss_cred_id_t credHdl;
+
+- credHdl = (gss_cred_id_t) pCred;
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
+
+- sprintf(debugBuf, "[GSSLibStub_releaseCred] %ld", pCred);
++ sprintf(debugBuf, "[GSSLibStub_releaseCred] %ld", (long int)pCred);
+ debug(env, debugBuf);
+
+ if (credHdl != GSS_C_NO_CREDENTIAL) {
+@@ -562,7 +563,7 @@
+
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_releaseCred]");
+ }
+- return (jlong) credHdl;
++ return ptr_to_jlong(credHdl);
+ }
+
+ /*
+@@ -570,7 +571,7 @@
+ */
+ void inquireCred(JNIEnv *env, jobject jobj, gss_cred_id_t pCred,
+ jint type, void *result) {
+- OM_uint32 minor, major;
++ OM_uint32 minor, major=GSS_C_QOP_DEFAULT;
+ OM_uint32 routineErr;
+ gss_cred_id_t credHdl;
+
+@@ -617,9 +618,9 @@
+ gss_name_t nameHdl;
+ gss_cred_id_t credHdl;
+
+- credHdl = (gss_cred_id_t) pCred;
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
+
+- sprintf(debugBuf, "[GSSLibStub_getCredName] %ld", pCred);
++ sprintf(debugBuf, "[GSSLibStub_getCredName] %ld", (long int)pCred);
+ debug(env, debugBuf);
+
+ nameHdl = GSS_C_NO_NAME;
+@@ -633,7 +634,7 @@
+ sprintf(debugBuf, "[GSSLibStub_getCredName] pName=%ld", (long) nameHdl);
+ debug(env, debugBuf);
+
+- return (jlong) nameHdl;
++ return ptr_to_jlong(nameHdl);
+ }
+
+ /*
+@@ -649,9 +650,9 @@
+ gss_cred_id_t credHdl;
+ OM_uint32 lifetime;
+
+- credHdl = (gss_cred_id_t) pCred;
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
+
+- sprintf(debugBuf, "[GSSLibStub_getCredTime] %ld", pCred);
++ sprintf(debugBuf, "[GSSLibStub_getCredTime] %ld", (long int)pCred);
+ debug(env, debugBuf);
+
+ lifetime = 0;
+@@ -677,9 +678,9 @@
+ gss_cred_usage_t usage;
+ gss_cred_id_t credHdl;
+
+- credHdl = (gss_cred_id_t) pCred;
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
+
+- sprintf(debugBuf, "[GSSLibStub_getCredUsage] %ld", pCred);
++ sprintf(debugBuf, "[GSSLibStub_getCredUsage] %ld", (long int)pCred);
+ debug(env, debugBuf);
+
+ inquireCred(env, jobj, credHdl, TYPE_CRED_USAGE, &usage);
+@@ -738,13 +739,13 @@
+ return NULL;
+ }
+
+- mech2 = (gss_OID) (*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech);
++ mech2 = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+
+ if (sameMech(env, mech, mech2) == JNI_TRUE) {
+ /* mech match - return the context object */
+ return (*env)->NewObject(env, CLS_NativeGSSContext,
+ MID_NativeGSSContext_ctor,
+- (jlong) contextHdl, jobj);
++ ptr_to_jlong(contextHdl), jobj);
+ } else {
+ /* mech mismatch - clean up then return null */
+ major = (*ftab->deleteSecContext)(&minor, &contextHdl, GSS_C_NO_BUFFER);
+@@ -784,11 +785,11 @@
+ */
+ debug(env, "[GSSLibStub_initContext]");
+
+- credHdl = (gss_cred_id_t) pCred;
+- contextHdl = (gss_ctx_id_t)
+- (*env)->GetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext);
+- targetName = (gss_name_t) pName;
+- mech = (gss_OID) (*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech);
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(
++ (*env)->GetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext));
++ targetName = (gss_name_t) jlong_to_ptr(pName);
++ mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jobj, FID_GSSLibStub_pMech));
+ flags = (OM_uint32) (*env)->GetIntField(env, jcontextSpi,
+ FID_NativeGSSContext_flags);
+ time = getGSSTime((*env)->GetIntField(env, jcontextSpi,
+@@ -821,7 +822,7 @@
+ if (GSS_ERROR(major) == GSS_S_COMPLETE) {
+ /* update member values if needed */
+ (*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
+- (jlong) contextHdl);
++ ptr_to_jlong(contextHdl));
+ (*env)->SetIntField(env, jcontextSpi, FID_NativeGSSContext_flags, aFlags);
+ sprintf(debugBuf, "[GSSLibStub_initContext] set flags=0x%x", aFlags);
+ debug(env, debugBuf);
+@@ -879,7 +880,7 @@
+ OM_uint32 aFlags;
+ OM_uint32 aTime;
+ gss_cred_id_t delCred;
+- jobject jsrcName;
++ jobject jsrcName=GSS_C_NO_NAME;
+ jobject jdelCred;
+ jobject jMech;
+ jbyteArray jresult;
+@@ -889,9 +890,9 @@
+
+ debug(env, "[GSSLibStub_acceptContext]");
+
+- contextHdl = (gss_ctx_id_t)
+- (*env)->GetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext);
+- credHdl = (gss_cred_id_t) pCred;
++ contextHdl = (gss_ctx_id_t)jlong_to_ptr(
++ (*env)->GetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext));
++ credHdl = (gss_cred_id_t) jlong_to_ptr(pCred);
+ initGSSBuffer(env, jinToken, &inToken);
+ cb = getGSSCB(env, jcb);
+ srcName = GSS_C_NO_NAME;
+@@ -922,7 +923,7 @@
+ if (GSS_ERROR(major) == GSS_S_COMPLETE) {
+ /* update member values if needed */
+ (*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
+- (jlong) contextHdl);
++ ptr_to_jlong(contextHdl));
+ sprintf(debugBuf, "[GSSLibStub_acceptContext] set pContext=%ld",
+ (long)contextHdl);
+ debug(env, debugBuf);
+@@ -940,7 +941,7 @@
+ NULL, NULL);
+ jtargetName = (*env)->NewObject(env, CLS_GSSNameElement,
+ MID_GSSNameElement_ctor,
+- (jlong) targetName, jobj);
++ ptr_to_jlong(targetName), jobj);
+
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+@@ -955,7 +956,7 @@
+ if (srcName != GSS_C_NO_NAME) {
+ jsrcName = (*env)->NewObject(env, CLS_GSSNameElement,
+ MID_GSSNameElement_ctor,
+- (jlong) srcName, jobj);
++ ptr_to_jlong(srcName), jobj);
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+ return NULL;
+@@ -981,7 +982,7 @@
+ if (delCred != GSS_C_NO_CREDENTIAL) {
+ jdelCred = (*env)->NewObject(env, CLS_GSSCredElement,
+ MID_GSSCredElement_ctor,
+- (jlong) delCred, jsrcName, jMech);
++ ptr_to_jlong(delCred), jsrcName, jMech);
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+ return NULL;
+@@ -1031,7 +1032,7 @@
+ jlong result[6];
+ jlongArray jresult;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+
+ sprintf(debugBuf, "[GSSLibStub_inquireContext] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+@@ -1051,8 +1052,8 @@
+ (long)targetName);
+ debug(env, debugBuf);
+
+- result[0] = (jlong) srcName;
+- result[1] = (jlong) targetName;
++ result[0] = ptr_to_jlong(srcName);
++ result[1] = ptr_to_jlong(targetName);
+ result[2] = (jlong) isInitiator;
+ result[3] = (jlong) isEstablished;
+ result[4] = (jlong) flags;
+@@ -1081,9 +1082,9 @@
+ gss_OID mech;
+ gss_ctx_id_t contextHdl;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+
+- sprintf(debugBuf, "[GSSLibStub_getContextMech] %ld", pContext);
++ sprintf(debugBuf, "[GSSLibStub_getContextMech] %ld", (long int)pContext);
+ debug(env, debugBuf);
+
+ major = (*ftab->inquireContext)(&minor, contextHdl, NULL, NULL,
+@@ -1111,7 +1112,7 @@
+ gss_name_t nameHdl;
+ gss_ctx_id_t contextHdl;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+
+ sprintf(debugBuf, "[GSSLibStub_getContextName] %ld, isSrc=%d",
+ (long)contextHdl, isSrc);
+@@ -1129,13 +1130,13 @@
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireContextAll]");
+ /* return immediately if an exception has occurred */
+ if ((*env)->ExceptionCheck(env)) {
+- return (long)NULL;
++ return ptr_to_jlong(NULL);
+ }
+
+ sprintf(debugBuf, "[GSSLibStub_getContextName] pName=%ld", (long) nameHdl);
+ debug(env, debugBuf);
+
+- return (jlong) nameHdl;
++ return ptr_to_jlong(nameHdl);
+ }
+
+ /*
+@@ -1151,7 +1152,7 @@
+ gss_ctx_id_t contextHdl;
+ OM_uint32 time;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_getContextTime] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1180,17 +1181,17 @@
+ OM_uint32 minor, major;
+ gss_ctx_id_t contextHdl;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_deleteContext] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+- if (contextHdl == GSS_C_NO_CONTEXT) return GSS_C_NO_CONTEXT;
++ if (contextHdl == GSS_C_NO_CONTEXT) return ptr_to_jlong(GSS_C_NO_CONTEXT);
+
+ /* gss_delete_sec_context(...) => GSS_S_NO_CONTEXT(!) */
+ major = (*ftab->deleteSecContext)(&minor, &contextHdl, GSS_C_NO_BUFFER);
+
+ checkStatus(env, jobj, major, minor, "[GSSLibStub_deleteContext]");
+- return (jlong) contextHdl;
++ return (jlong) ptr_to_jlong(contextHdl);
+ }
+
+ /*
+@@ -1211,7 +1212,7 @@
+ OM_uint32 outSize, maxInSize;
+ gss_qop_t qop;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_wrapSizeLimit] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1244,7 +1245,7 @@
+ gss_buffer_desc interProcToken;
+ jbyteArray jresult;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_exportContext] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1281,7 +1282,7 @@
+ gss_buffer_desc msgToken;
+ jbyteArray jresult;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_getMic] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1290,7 +1291,7 @@
+ checkStatus(env, jobj, GSS_S_CONTEXT_EXPIRED, 0, "[GSSLibStub_getMic]");
+ return NULL;
+ }
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ qop = (gss_qop_t) jqop;
+ initGSSBuffer(env, jmsg, &msg);
+
+@@ -1326,7 +1327,7 @@
+ gss_buffer_desc msgToken;
+ gss_qop_t qop;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_verifyMic] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1376,7 +1377,7 @@
+ gss_ctx_id_t contextHdl;
+ jbyteArray jresult;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_wrap] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+@@ -1427,7 +1428,7 @@
+ gss_qop_t qop;
+ jbyteArray jresult;
+
+- contextHdl = (gss_ctx_id_t) pContext;
++ contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
+ sprintf(debugBuf, "[GSSLibStub_unwrap] %ld", (long)contextHdl);
+ debug(env, debugBuf);
+
+--- ./jdk/src/share/native/sun/security/jgss/wrapper/NativeUtil.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/jgss/wrapper/NativeUtil.c Fri Apr 10 09:21:28 2015 -0700
+@@ -25,6 +25,7 @@
+
+ #include "NativeUtil.h"
+ #include "NativeFunc.h"
++#include "jlong.h"
+
+ const int JAVA_DUPLICATE_TOKEN_CODE = 19; /* DUPLICATE_TOKEN */
+ const int JAVA_OLD_TOKEN_CODE = 20; /* OLD_TOKEN */
+@@ -412,7 +413,7 @@
+ OM_uint32 result;
+
+ /* special handle values equal to JAVA_MAX */
+- if (jtime == JAVA_MAX) {
++ if (jtime == (jint)JAVA_MAX) {
+ result = GSS_C_INDEFINITE;
+ } else {
+ result = jtime;
+@@ -482,7 +483,7 @@
+
+ messageContext = 0;
+ if (jstub != NULL) {
+- mech = (gss_OID) (*env)->GetLongField(env, jstub, FID_GSSLibStub_pMech);
++ mech = (gss_OID) jlong_to_ptr((*env)->GetLongField(env, jstub, FID_GSSLibStub_pMech));
+ } else {
+ mech = GSS_C_NO_OID;
+ }
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_convert.c Fri Apr 10 09:21:28 2015 -0700
+@@ -422,6 +422,7 @@
+ jfieldID jFieldID;
+ jlong jType;
+ jobject jPValue;
++ memset(&ckAttribute, 0, sizeof(CK_ATTRIBUTE));
+
+ // TBD: what if jAttribute == NULL?!
+
+@@ -1577,6 +1578,7 @@
+ CK_RSA_PKCS_PSS_PARAMS ckParam;
+ jfieldID fieldID;
+ jlong jHashAlg, jMgf, jSLen;
++ memset(&ckParam, 0, sizeof(CK_RSA_PKCS_PSS_PARAMS));
+
+ /* get hashAlg */
+ jRsaPkcsPssParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_PSS_PARAMS);
+@@ -1617,6 +1619,7 @@
+ jfieldID fieldID;
+ jlong jLong;
+ jobject jSharedData, jPublicData;
++ memset(&ckParam, 0, sizeof(CK_ECDH1_DERIVE_PARAMS));
+
+ /* get kdf */
+ jEcdh1DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH1_DERIVE_PARAMS);
+@@ -1663,6 +1666,7 @@
+ jfieldID fieldID;
+ jlong jKdf, jPrivateDataLen, jPrivateData;
+ jobject jSharedData, jPublicData, jPublicData2;
++ memset(&ckParam, 0, sizeof(CK_ECDH2_DERIVE_PARAMS));
+
+ /* get kdf */
+ jEcdh2DeriveParamsClass = (*env)->FindClass(env, CLASS_ECDH2_DERIVE_PARAMS);
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_crypt.c Fri Apr 10 09:21:28 2015 -0700
+@@ -180,14 +180,14 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directIn != 0) {
+- inBufP = (CK_BYTE_PTR) directIn;
++ inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
+ } else {
+ inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+ if (inBufP == NULL) { return 0; }
+ }
+
+ if (directOut != 0) {
+- outBufP = (CK_BYTE_PTR) directOut;
++ outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut);
+ } else {
+ outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
+ if (outBufP == NULL) {
+@@ -249,7 +249,7 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directOut != 0) {
+- outBufP = (CK_BYTE_PTR) directOut;
++ outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut);
+ } else {
+ outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
+ if (outBufP == NULL) { return 0; }
+@@ -401,14 +401,14 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directIn != 0) {
+- inBufP = (CK_BYTE_PTR) directIn;
++ inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn);
+ } else {
+ inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL);
+ if (inBufP == NULL) { return 0; }
+ }
+
+ if (directOut != 0) {
+- outBufP = (CK_BYTE_PTR) directOut;
++ outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut);
+ } else {
+ outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
+ if (outBufP == NULL) {
+@@ -465,7 +465,7 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directOut != 0) {
+- outBufP = (CK_BYTE_PTR) directOut;
++ outBufP = (CK_BYTE_PTR) jlong_to_ptr(directOut);
+ } else {
+ outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL);
+ if (outBufP == NULL) { return 0; }
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_digest.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_digest.c Fri Apr 10 09:21:28 2015 -0700
+@@ -51,6 +51,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
++#include "jlong.h"
+
+ #include "sun_security_pkcs11_wrapper_PKCS11.h"
+
+@@ -178,7 +179,7 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directIn != 0) {
+- rv = (*ckpFunctions->C_DigestUpdate)(ckSessionHandle, (CK_BYTE_PTR)directIn, jInLen);
++ rv = (*ckpFunctions->C_DigestUpdate)(ckSessionHandle, (CK_BYTE_PTR)jlong_to_ptr(directIn), jInLen);
+ ckAssertReturnValueOK(env, rv);
+ return;
+ }
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_general.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_general.c Fri Apr 10 09:21:28 2015 -0700
+@@ -250,10 +250,12 @@
+ (JNIEnv *env, jobject obj)
+ {
+ CK_INFO ckLibInfo;
+- jobject jInfoObject;
++ jobject jInfoObject=NULL;
+ CK_RV rv;
++ CK_FUNCTION_LIST_PTR ckpFunctions;
++ memset(&ckLibInfo, 0, sizeof(CK_INFO));
+
+- CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
++ ckpFunctions = getFunctionList(env, obj);
+ if (ckpFunctions == NULL) { return NULL; }
+
+ rv = (*ckpFunctions->C_GetInfo)(&ckLibInfo);
+@@ -381,7 +383,7 @@
+ {
+ CK_SLOT_ID ckSlotID;
+ CK_SLOT_INFO ckSlotInfo;
+- jobject jSlotInfoObject;
++ jobject jSlotInfoObject=NULL;
+ CK_RV rv;
+
+ CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
+@@ -393,7 +395,7 @@
+ if (ckAssertReturnValueOK(env, rv) == CK_ASSERT_OK) {
+ jSlotInfoObject = ckSlotInfoPtrToJSlotInfo(env, &ckSlotInfo);
+ }
+- return jSlotInfoObject ;
++ return jSlotInfoObject;
+ }
+
+ /*
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sessmgmt.c Fri Apr 10 09:21:28 2015 -0700
+@@ -256,7 +256,7 @@
+ {
+ CK_SESSION_HANDLE ckSessionHandle;
+ CK_SESSION_INFO ckSessionInfo;
+- jobject jSessionInfo;
++ jobject jSessionInfo=NULL;
+ CK_RV rv;
+
+ CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sign.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_sign.c Fri Apr 10 09:21:28 2015 -0700
+@@ -51,6 +51,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
++#include "jlong.h"
+
+ #include "sun_security_pkcs11_wrapper_PKCS11.h"
+
+@@ -198,7 +199,7 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directIn != 0) {
+- rv = (*ckpFunctions->C_SignUpdate)(ckSessionHandle, (CK_BYTE_PTR)directIn, jInLen);
++ rv = (*ckpFunctions->C_SignUpdate)(ckSessionHandle, (CK_BYTE_PTR) jlong_to_ptr(directIn), jInLen);
+ ckAssertReturnValueOK(env, rv);
+ return;
+ }
+@@ -262,7 +263,7 @@
+
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+- if ((jExpectedLength > 0) && (jExpectedLength < ckSignatureLength)) {
++ if ((jExpectedLength > 0) && ((CK_ULONG)jExpectedLength < ckSignatureLength)) {
+ ckSignatureLength = jExpectedLength;
+ }
+
+@@ -496,7 +497,7 @@
+ ckSessionHandle = jLongToCKULong(jSessionHandle);
+
+ if (directIn != 0) {
+- rv = (*ckpFunctions->C_VerifyUpdate)(ckSessionHandle, (CK_BYTE_PTR)directIn, jInLen);
++ rv = (*ckpFunctions->C_VerifyUpdate)(ckSessionHandle, (CK_BYTE_PTR)jlong_to_ptr(directIn), jInLen);
+ ckAssertReturnValueOK(env, rv);
+ return;
+ }
+--- ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_util.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/share/native/sun/security/pkcs11/wrapper/p11_util.c Fri Apr 10 09:21:28 2015 -0700
+@@ -106,7 +106,7 @@
+ if (moduleData == NULL) {
+ return ;
+ }
+- (*env)->SetLongField(env, pkcs11Implementation, pNativeDataID, (jlong)moduleData);
++ (*env)->SetLongField(env, pkcs11Implementation, pNativeDataID, ptr_to_jlong(moduleData));
+ }
+
+
+@@ -120,7 +120,7 @@
+ return NULL;
+ }
+ jData = (*env)->GetLongField(env, pkcs11Implementation, pNativeDataID);
+- return (ModuleData*)jData;
++ return (ModuleData*)jlong_to_ptr(jData);
+ }
+
+ CK_FUNCTION_LIST_PTR getFunctionList(JNIEnv *env, jobject pkcs11Implementation) {
+--- ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.bsd Fri Apr 10 09:21:28 2015 -0700
+@@ -35,6 +35,7 @@
+ import java.io.InputStream;
+ import java.io.OutputStream;
+ import java.util.Arrays;
++import java.util.Locale;
+ import java.util.concurrent.Executors;
+ import java.util.concurrent.Executor;
+ import java.util.concurrent.ThreadFactory;
+@@ -99,7 +100,7 @@
+ "jdk.lang.Process.launchMechanism", "posix_spawn");
+
+ try {
+- return LaunchMechanism.valueOf(s.toUpperCase());
++ return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
+ } catch (IllegalArgumentException e) {
+ throw new Error(s + " is not a supported " +
+ "process launch mechanism on this platform.");
+--- ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux Fri Apr 10 09:21:28 2015 -0700
+@@ -35,6 +35,7 @@
+ import java.io.InputStream;
+ import java.io.OutputStream;
+ import java.util.Arrays;
++import java.util.Locale;
+ import java.util.concurrent.Executors;
+ import java.util.concurrent.Executor;
+ import java.util.concurrent.ThreadFactory;
+@@ -100,7 +101,7 @@
+ "jdk.lang.Process.launchMechanism", "vfork");
+
+ try {
+- return LaunchMechanism.valueOf(s.toUpperCase());
++ return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
+ } catch (IllegalArgumentException e) {
+ throw new Error(s + " is not a supported " +
+ "process launch mechanism on this platform.");
+--- ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/java/lang/UNIXProcess.java.solaris Fri Apr 10 09:21:28 2015 -0700
+@@ -26,6 +26,7 @@
+ package java.lang;
+
+ import java.io.*;
++import java.util.Locale;
+ import java.security.AccessController;
+ import java.security.PrivilegedAction;
+
+@@ -89,7 +90,7 @@
+ "jdk.lang.Process.launchMechanism", "fork");
+
+ try {
+- return LaunchMechanism.valueOf(s.toUpperCase());
++ return LaunchMechanism.valueOf(s.toUpperCase(Locale.ENGLISH));
+ } catch (IllegalArgumentException e) {
+ throw new Error(s + " is not a supported " +
+ "process launch mechanism on this platform.");
+--- ./jdk/src/solaris/classes/java/net/PlainDatagramSocketImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/java/net/PlainDatagramSocketImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -25,6 +25,11 @@
+ package java.net;
+
+ import java.io.IOException;
++import java.util.Set;
++import java.util.HashSet;
++import java.util.Collections;
++import jdk.net.*;
++import static sun.net.ExtendedOptionsImpl.*;
+
+ /*
+ * On Unix systems we simply delegate to native methods.
+@@ -38,6 +43,32 @@
+ init();
+ }
+
++ protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
++ if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
++ super.setOption(name, value);
++ } else {
++ if (isClosed()) {
++ throw new SocketException("Socket closed");
++ }
++ checkSetOptionPermission(name);
++ checkValueType(value, SocketFlow.class);
++ setFlowOption(getFileDescriptor(), (SocketFlow)value);
++ }
++ }
++
++ protected <T> T getOption(SocketOption<T> name) throws IOException {
++ if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
++ return super.getOption(name);
++ }
++ if (isClosed()) {
++ throw new SocketException("Socket closed");
++ }
++ checkGetOptionPermission(name);
++ SocketFlow flow = SocketFlow.create();
++ getFlowOption(getFileDescriptor(), flow);
++ return (T)flow;
++ }
++
+ protected synchronized native void bind0(int lport, InetAddress laddr)
+ throws SocketException;
+
+--- ./jdk/src/solaris/classes/java/net/PlainSocketImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/java/net/PlainSocketImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -26,6 +26,12 @@
+
+ import java.io.IOException;
+ import java.io.FileDescriptor;
++import java.util.Set;
++import java.util.HashSet;
++import java.util.Collections;
++import jdk.net.*;
++
++import static sun.net.ExtendedOptionsImpl.*;
+
+ /*
+ * On Unix systems we simply delegate to native methods.
+@@ -51,6 +57,32 @@
+ this.fd = fd;
+ }
+
++ protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
++ if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
++ super.setOption(name, value);
++ } else {
++ if (isClosedOrPending()) {
++ throw new SocketException("Socket closed");
++ }
++ checkSetOptionPermission(name);
++ checkValueType(value, SocketFlow.class);
++ setFlowOption(getFileDescriptor(), (SocketFlow)value);
++ }
++ }
++
++ protected <T> T getOption(SocketOption<T> name) throws IOException {
++ if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
++ return super.getOption(name);
++ }
++ if (isClosedOrPending()) {
++ throw new SocketException("Socket closed");
++ }
++ checkGetOptionPermission(name);
++ SocketFlow flow = SocketFlow.create();
++ getFlowOption(getFileDescriptor(), flow);
++ return (T)flow;
++ }
++
+ native void socketCreate(boolean isServer) throws IOException;
+
+ native void socketConnect(InetAddress address, int port, int timeout)
+@@ -77,5 +109,4 @@
+ native int socketGetOption(int opt, Object iaContainerObj) throws SocketException;
+
+ native void socketSendUrgentData(int data) throws IOException;
+-
+ }
+--- ./jdk/src/solaris/classes/sun/awt/X11/XButtonPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XButtonPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -82,9 +82,15 @@
+ return true;
+ }
+
+- public void setLabel(java.lang.String label) {
+- this.label = label;
+- repaint();
++ @Override
++ public void setLabel(String label) {
++ if (label == null) {
++ label = "";
++ }
++ if (!label.equals(this.label)) {
++ this.label = label;
++ repaint();
++ }
+ }
+
+ public void paint(Graphics g) {
+@@ -277,10 +283,6 @@
+ drawMotif3DRect(g, x, y, w-1, h-1, pressed);
+ }
+
+- public void setFont(Font f) {
+- super.setFont(f);
+- target.repaint();
+- }
+ protected void paintFocus(Graphics g, int x, int y, int w, int h){
+ g.setColor(focusColor);
+ g.drawRect(x,y,w,h);
+--- ./jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -103,15 +103,4 @@
+ protected boolean doEraseBackground() {
+ return !eraseBackgroundDisabled;
+ }
+- public void setBackground(Color c) {
+- boolean doRepaint = false;
+- if( getPeerBackground() == null ||
+- !getPeerBackground().equals( c ) ) {
+- doRepaint = true;
+- }
+- super.setBackground(c);
+- if( doRepaint ) {
+- target.repaint();
+- }
+- }
+ }
+--- ./jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XCheckboxPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,6 +31,7 @@
+ import java.awt.image.BufferedImage;
+ import javax.swing.plaf.basic.BasicGraphicsUtils;
+ import java.awt.geom.AffineTransform;
++import java.util.Objects;
+
+ import sun.util.logging.PlatformLogger;
+
+@@ -135,14 +136,15 @@
+
+ public void keyReleased(KeyEvent e) {}
+
+- public void setLabel(java.lang.String label) {
+- if ( label == null ) {
+- this.label = "";
+- } else {
++ public void setLabel(String label) {
++ if (label == null) {
++ label = "";
++ }
++ if (!label.equals(this.label)) {
+ this.label = label;
++ layout();
++ repaint();
+ }
+- layout();
+- repaint();
+ }
+
+ void handleJavaMouseEvent(MouseEvent e) {
+@@ -384,10 +386,6 @@
+ g.drawImage(buffer, x, y, null);
+ }
+ }
+- public void setFont(Font f) {
+- super.setFont(f);
+- target.repaint();
+- }
+
+ public void paintRadioButton(Graphics g, int x, int y, int w, int h) {
+
+@@ -437,10 +435,12 @@
+ repaint();
+ }
+ }
+- public void setCheckboxGroup(CheckboxGroup g) {
+- // If changed from grouped/ungrouped, need to repaint()
+- checkBoxGroup = g;
+- repaint();
++ public void setCheckboxGroup(final CheckboxGroup g) {
++ if (!Objects.equals(g, checkBoxGroup)) {
++ // If changed from grouped/ungrouped, need to repaint()
++ checkBoxGroup = g;
++ repaint();
++ }
+ }
+
+ // NOTE: This method is called by privileged threads.
+--- ./jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -63,6 +63,7 @@
+ import java.lang.reflect.*;
+ import java.security.*;
+ import java.util.Collection;
++import java.util.Objects;
+ import java.util.HashSet;
+ import java.util.Set;
+ import java.util.Vector;
+@@ -647,18 +648,26 @@
+ g.drawLine(x+width, y+height, x+width, y+1); // right
+ }
+
++ @Override
+ public void setBackground(Color c) {
+ if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set background to " + c);
+ synchronized (getStateLock()) {
++ if (Objects.equals(background, c)) {
++ return;
++ }
+ background = c;
+ }
+ super.setBackground(c);
+ repaint();
+ }
+
++ @Override
+ public void setForeground(Color c) {
+ if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set foreground to " + c);
+ synchronized (getStateLock()) {
++ if (Objects.equals(foreground, c)) {
++ return;
++ }
+ foreground = c;
+ }
+ repaint();
+@@ -680,18 +689,21 @@
+ return sun.font.FontDesignMetrics.getMetrics(font);
+ }
+
++ @Override
+ public void setFont(Font f) {
++ if (f == null) {
++ f = XWindow.getDefaultFont();
++ }
+ synchronized (getStateLock()) {
+- if (f == null) {
+- f = XWindow.getDefaultFont();
++ if (f.equals(font)) {
++ return;
+ }
+ font = f;
+ }
+- // as it stands currently we dont need to do layout or repaint since
++ // as it stands currently we dont need to do layout since
+ // layout is done in the Component upon setFont.
+ //layout();
+- // target.repaint();
+- //repaint()?
++ repaint();
+ }
+
+ public Font getFont() {
+--- ./jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java Fri Apr 10 09:21:28 2015 -0700
+@@ -140,7 +140,7 @@
+ }
+
+
+- public void handleExposeEvent(Component target, int x, int y, int w, int h) {
++ public void postPaintEvent(Component target, int x, int y, int w, int h) {
+ // TODO: ?
+ // get rid of 'istanceof' by subclassing:
+ // XContentWindow -> XFrameContentWindow
+@@ -158,13 +158,13 @@
+ iconifiedExposeEvents.add(new SavedExposeEvent(target, x, y, w, h));
+ } else {
+ // Normal case: [it is not a frame or] the frame is not iconified.
+- super.handleExposeEvent(target, x, y, w, h);
++ super.postPaintEvent(target, x, y, w, h);
+ }
+ }
+
+ void purgeIconifiedExposeEvents() {
+ for (SavedExposeEvent evt : iconifiedExposeEvents) {
+- super.handleExposeEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
++ super.postPaintEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
+ }
+ iconifiedExposeEvents.clear();
+ }
+--- ./jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2013, 2014, 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
+@@ -97,6 +97,7 @@
+ * @param handler the synthetic error handler to set
+ */
+ public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
++ XSync();
+ saved_error = null;
+ current_error_handler = handler;
+ }
+@@ -105,15 +106,9 @@
+ * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
+ */
+ public static void RESTORE_XERROR_HANDLER() {
+- RESTORE_XERROR_HANDLER(true);
+- }
+-
+- private static void RESTORE_XERROR_HANDLER(boolean doXSync) {
+- if (doXSync) {
+- // Wait until all requests are processed by the X server
+- // and only then uninstall the error handler.
+- XSync();
+- }
++ // Wait until all requests are processed by the X server
++ // and only then uninstall the error handler.
++ XSync();
+ current_error_handler = null;
+ }
+
+--- ./jdk/src/solaris/classes/sun/awt/X11/XLabelPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XLabelPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -131,20 +131,22 @@
+ }
+ }
+
+- public void setText(String text) {
+- label = text;
++ @Override
++ public void setText(String label) {
+ if (label == null) {
+ label = "";
+ }
+- repaint();
+- }
+- public void setFont(Font f) {
+- super.setFont(f);
+- repaint();
++ if (!label.equals(this.label)) {
++ this.label = label;
++ repaint();
++ }
+ }
+
+- public void setAlignment(int align) {
+- alignment = align;
+- repaint();
++ @Override
++ public void setAlignment(final int alignment) {
++ if (this.alignment != alignment) {
++ this.alignment = alignment;
++ repaint();
++ }
+ }
+ }
+--- ./jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -31,8 +31,8 @@
+ import java.awt.*;
+ import java.awt.event.*;
+ import java.awt.peer.*;
++import java.util.Objects;
+ import java.util.Vector;
+-import java.awt.geom.*;
+ import java.awt.image.*;
+ import sun.util.logging.PlatformLogger;
+
+@@ -413,6 +413,7 @@
+ Graphics g = getGraphics();
+ try {
+ painter.paint(g, firstItem, lastItem, options, source, distance);
++ postPaintEvent(target, 0, 0, getWidth(), getHeight());
+ } finally {
+ g.dispose();
+ }
+@@ -1659,11 +1660,13 @@
+ * The bug is due to incorrent caching of the list item size
+ * So we should recalculate font metrics on setFont
+ */
+- public void setFont(Font f){
+- super.setFont(f);
+- initFontMetrics();
+- layout();
+- repaint();
++ public void setFont(Font f) {
++ if (!Objects.equals(getFont(), f)) {
++ super.setFont(f);
++ initFontMetrics();
++ layout();
++ repaint();
++ }
+ }
+
+ /**
+--- ./jdk/src/solaris/classes/sun/awt/X11/XRootWindow.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XRootWindow.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2014, 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
+@@ -46,7 +46,8 @@
+ }
+
+ private XRootWindow() {
+- super(new XCreateWindowParams(new Object[] {DELAYED, Boolean.TRUE}));
++ super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
++ EVENT_MASK, XConstants.StructureNotifyMask }));
+ }
+
+ public void postInit(XCreateWindowParams params){
+--- ./jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Fri Apr 10 09:21:28 2015 -0700
+@@ -2291,9 +2291,7 @@
+
+ private static XEventDispatcher oops_waiter;
+ private static boolean oops_updated;
+- private static boolean oops_failed;
+- private XAtom oops;
+- private static final long WORKAROUND_SLEEP = 100;
++ private static boolean oops_move;
+
+ /**
+ * @inheritDoc
+@@ -2304,51 +2302,34 @@
+ if (oops_waiter == null) {
+ oops_waiter = new XEventDispatcher() {
+ public void dispatchEvent(XEvent e) {
+- if (e.get_type() == XConstants.SelectionNotify) {
+- XSelectionEvent pe = e.get_xselection();
+- if (pe.get_property() == oops.getAtom()) {
+- oops_updated = true;
+- awtLockNotifyAll();
+- } else if (pe.get_selection() == XAtom.get("WM_S0").getAtom() &&
+- pe.get_target() == XAtom.get("VERSION").getAtom() &&
+- pe.get_property() == 0 &&
+- XlibWrapper.XGetSelectionOwner(getDisplay(), XAtom.get("WM_S0").getAtom()) == 0)
+- {
+- // WM forgot to acquire selection or there is no WM
+- oops_failed = true;
+- awtLockNotifyAll();
+- }
+-
++ if (e.get_type() == XConstants.ConfigureNotify) {
++ // OOPS ConfigureNotify event catched
++ oops_updated = true;
++ awtLockNotifyAll();
+ }
+ }
+ };
+ }
+
+- if (oops == null) {
+- oops = XAtom.get("OOPS");
+- }
+-
+ awtLock();
+ try {
+ addEventDispatcher(win.getWindow(), oops_waiter);
+
+ oops_updated = false;
+- oops_failed = false;
+- // Wait for selection notify for oops on win
+ long event_number = getEventNumber();
+- XAtom atom = XAtom.get("WM_S0");
+- eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
+- XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
+- XAtom.get("VERSION").getAtom(), oops.getAtom(),
+- win.getWindow(), XConstants.CurrentTime);
++ // Generate OOPS ConfigureNotify event
++ XlibWrapper.XMoveWindow(getDisplay(), win.getWindow(), oops_move ? 0 : 1, 0);
++ // Change win position each time to avoid system optimization
++ oops_move = !oops_move;
+ XSync();
+
+
+- eventLog.finer("Requested OOPS");
++ eventLog.finer("Generated OOPS ConfigureNotify event");
+
+ long start = System.currentTimeMillis();
+- while (!oops_updated && !oops_failed) {
++ while (!oops_updated) {
+ try {
++ // Wait for OOPS ConfigureNotify event
+ awtLockWait(timeout);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+@@ -2359,20 +2340,8 @@
+ throw new OperationTimedOut(Long.toString(System.currentTimeMillis() - start));
+ }
+ }
+- if (oops_failed && getEventNumber() - event_number == 1) {
+- // If selection update failed we can simply wait some time
+- // hoping some events will arrive
+- awtUnlock();
+- eventLog.finest("Emergency sleep");
+- try {
+- Thread.sleep(WORKAROUND_SLEEP);
+- } catch (InterruptedException ie) {
+- throw new RuntimeException(ie);
+- } finally {
+- awtLock();
+- }
+- }
+- return getEventNumber() - event_number > 2;
++ // Don't take into account OOPS ConfigureNotify event
++ return getEventNumber() - event_number > 1;
+ } finally {
+ removeEventDispatcher(win.getWindow(), oops_waiter);
+ eventLog.finer("Exiting syncNativeQueue");
+--- ./jdk/src/solaris/classes/sun/awt/X11/XWindow.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/awt/X11/XWindow.java Fri Apr 10 09:21:28 2015 -0700
+@@ -32,7 +32,6 @@
+
+ import java.lang.ref.WeakReference;
+
+-import java.lang.reflect.Field;
+ import java.lang.reflect.Method;
+
+ import sun.util.logging.PlatformLogger;
+@@ -491,14 +490,14 @@
+ return embedded;
+ }
+
+- public void repaint(int x,int y, int width, int height) {
++ public final void repaint(int x,int y, int width, int height) {
+ if (!isVisible()) {
+ return;
+ }
+ Graphics g = getGraphics();
+ if (g != null) {
+ try {
+- g.setClip(x,y,width,height);
++ g.setClip(x, y, width, height);
+ paint(g);
+ } finally {
+ g.dispose();
+@@ -507,17 +506,7 @@
+ }
+
+ public void repaint() {
+- if (!isVisible()) {
+- return;
+- }
+- Graphics g = getGraphics();
+- if (g != null) {
+- try {
+- paint(g);
+- } finally {
+- g.dispose();
+- }
+- }
++ repaint(0, 0, getWidth(), getHeight());
+ }
+
+ void paint(Graphics g) {
+@@ -556,11 +545,11 @@
+ && compAccessor.getWidth(target) != 0
+ && compAccessor.getHeight(target) != 0)
+ {
+- handleExposeEvent(target, x, y, w, h);
++ postPaintEvent(target, x, y, w, h);
+ }
+ }
+
+- public void handleExposeEvent(Component target, int x, int y, int w, int h) {
++ public void postPaintEvent(Component target, int x, int y, int w, int h) {
+ PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
+ createPaintEvent(target, x, y, w, h);
+ if (event != null) {
+--- ./jdk/src/solaris/classes/sun/nio/ch/FileDispatcherImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/classes/sun/nio/ch/FileDispatcherImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -25,10 +25,10 @@
+
+ package sun.nio.ch;
+
+-import java.io.*;
++import java.io.FileDescriptor;
++import java.io.IOException;
+
+-class FileDispatcherImpl extends FileDispatcher
+-{
++class FileDispatcherImpl extends FileDispatcher {
+
+ static {
+ Util.load();
+@@ -108,6 +108,14 @@
+ return new FileDescriptor();
+ }
+
++ boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
++ return true;
++ }
++
++ boolean transferToDirectlyNeedsPositionLock() {
++ return false;
++ }
++
+ // -- Native methods --
+
+ static native int read0(FileDescriptor fd, long address, int len)
+--- ./jdk/src/solaris/native/java/io/io_util_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/java/io/io_util_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -118,3 +118,18 @@
+ JNU_ThrowIOExceptionWithLastError(env, "close failed");
+ }
+ }
++
++size_t
++getLastErrorString(char *buf, size_t len)
++{
++ if (errno == 0 || len < 1) return 0;
++
++ const char *err = strerror(errno);
++ size_t n = strlen(err);
++ if (n >= len)
++ n = len - 1;
++
++ strncpy(buf, err, n);
++ buf[n] = '\0';
++ return n;
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/solaris/native/java/net/ExtendedOptionsImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,335 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++#include <jni.h>
++#include <string.h>
++
++#include "net_util.h"
++#include "jdk_net_SocketFlow.h"
++
++static jclass sf_status_class; /* Status enum type */
++
++static jfieldID sf_status;
++static jfieldID sf_priority;
++static jfieldID sf_bandwidth;
++
++static jfieldID sf_fd_fdID; /* FileDescriptor.fd */
++
++/* References to the literal enum values */
++
++static jobject sfs_NOSTATUS;
++static jobject sfs_OK;
++static jobject sfs_NOPERMISSION;
++static jobject sfs_NOTCONNECTED;
++static jobject sfs_NOTSUPPORTED;
++static jobject sfs_ALREADYCREATED;
++static jobject sfs_INPROGRESS;
++static jobject sfs_OTHER;
++
++static jobject getEnumField(JNIEnv *env, char *name);
++static void setStatus(JNIEnv *env, jobject obj, int errval);
++
++/* OS specific code is implemented in these three functions */
++
++static jboolean flowSupported0() ;
++
++/*
++ * Class: sun_net_ExtendedOptionsImpl
++ * Method: init
++ * Signature: ()V
++ */
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_init
++ (JNIEnv *env, jclass UNUSED) {
++
++ static int initialized = 0;
++ jclass c;
++
++ /* Global class references */
++
++ if (initialized) {
++ return;
++ }
++
++ c = (*env)->FindClass(env, "jdk/net/SocketFlow$Status");
++ CHECK_NULL(c);
++ sf_status_class = (*env)->NewGlobalRef(env, c);
++ CHECK_NULL(sf_status_class);
++
++ /* int "fd" field of java.io.FileDescriptor */
++
++ c = (*env)->FindClass(env, "java/io/FileDescriptor");
++ CHECK_NULL(c);
++ sf_fd_fdID = (*env)->GetFieldID(env, c, "fd", "I");
++ CHECK_NULL(sf_fd_fdID);
++
++
++ /* SocketFlow fields */
++
++ c = (*env)->FindClass(env, "jdk/net/SocketFlow");
++
++ /* status */
++
++ sf_status = (*env)->GetFieldID(env, c, "status",
++ "Ljdk/net/SocketFlow$Status;");
++ CHECK_NULL(sf_status);
++
++ /* priority */
++
++ sf_priority = (*env)->GetFieldID(env, c, "priority", "I");
++ CHECK_NULL(sf_priority);
++
++ /* bandwidth */
++
++ sf_bandwidth = (*env)->GetFieldID(env, c, "bandwidth", "J");
++ CHECK_NULL(sf_bandwidth);
++
++ /* Initialize the static enum values */
++
++ sfs_NOSTATUS = getEnumField(env, "NO_STATUS");
++ CHECK_NULL(sfs_NOSTATUS);
++ sfs_OK = getEnumField(env, "OK");
++ CHECK_NULL(sfs_OK);
++ sfs_NOPERMISSION = getEnumField(env, "NO_PERMISSION");
++ CHECK_NULL(sfs_NOPERMISSION);
++ sfs_NOTCONNECTED = getEnumField(env, "NOT_CONNECTED");
++ CHECK_NULL(sfs_NOTCONNECTED);
++ sfs_NOTSUPPORTED = getEnumField(env, "NOT_SUPPORTED");
++ CHECK_NULL(sfs_NOTSUPPORTED);
++ sfs_ALREADYCREATED = getEnumField(env, "ALREADY_CREATED");
++ CHECK_NULL(sfs_ALREADYCREATED);
++ sfs_INPROGRESS = getEnumField(env, "IN_PROGRESS");
++ CHECK_NULL(sfs_INPROGRESS);
++ sfs_OTHER = getEnumField(env, "OTHER");
++ CHECK_NULL(sfs_OTHER);
++ initialized = JNI_TRUE;
++}
++
++static jobject getEnumField(JNIEnv *env, char *name) {
++ jobject f;
++ jfieldID fID = (*env)->GetStaticFieldID(env, sf_status_class, name,
++ "Ljdk/net/SocketFlow$Status;");
++ CHECK_NULL_RETURN(fID, NULL);
++
++ f = (*env)->GetStaticObjectField(env, sf_status_class, fID);
++ CHECK_NULL_RETURN(f, NULL);
++ f = (*env)->NewGlobalRef(env, f);
++ CHECK_NULL_RETURN(f, NULL);
++ return f;
++}
++
++/*
++ * Retrieve the int file-descriptor from a public socket type object.
++ * Gets impl, then the FileDescriptor from the impl, and then the fd
++ * from that.
++ */
++static int getFD(JNIEnv *env, jobject fileDesc) {
++ return (*env)->GetIntField(env, fileDesc, sf_fd_fdID);
++}
++
++/**
++ * Sets the status field of a SocketFlow to one of the
++ * canned enum values
++ */
++static void setStatus (JNIEnv *env, jobject obj, int errval) {
++ switch (errval) {
++ case 0: /* OK */
++ (*env)->SetObjectField(env, obj, sf_status, sfs_OK);
++ break;
++ case EPERM:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_NOPERMISSION);
++ break;
++ case ENOTCONN:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_NOTCONNECTED);
++ break;
++ case EOPNOTSUPP:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_NOTSUPPORTED);
++ break;
++ case EALREADY:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_ALREADYCREATED);
++ break;
++ case EINPROGRESS:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_INPROGRESS);
++ break;
++ default:
++ (*env)->SetObjectField(env, obj, sf_status, sfs_OTHER);
++ break;
++ }
++}
++
++#ifdef __solaris__
++
++/*
++ * Class: sun_net_ExtendedOptionsImpl
++ * Method: setFlowOption
++ * Signature: (Ljava/io/FileDescriptor;Ljdk/net/SocketFlow;)V
++ */
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ int fd = getFD(env, fileDesc);
++
++ if (fd < 0) {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException", "socket closed");
++ return;
++ } else {
++ sock_flow_props_t props;
++ jlong bandwidth;
++ int rv;
++
++ jint priority = (*env)->GetIntField(env, flow, sf_priority);
++ memset(&props, 0, sizeof(props));
++ props.sfp_version = SOCK_FLOW_PROP_VERSION1;
++
++ if (priority != jdk_net_SocketFlow_UNSET) {
++ props.sfp_mask |= SFP_PRIORITY;
++ props.sfp_priority = priority;
++ }
++ bandwidth = (*env)->GetLongField(env, flow, sf_bandwidth);
++ if (bandwidth > -1) {
++ props.sfp_mask |= SFP_MAXBW;
++ props.sfp_maxbw = (uint64_t) bandwidth;
++ }
++ rv = setsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
++ if (rv < 0) {
++ if (errno == ENOPROTOOPT) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++ } else if (errno == EACCES || errno == EPERM) {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
++ "Permission denied");
++ } else {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
++ "set option SO_FLOW_SLA failed");
++ }
++ return;
++ }
++ setStatus(env, flow, props.sfp_status);
++ }
++}
++
++/*
++ * Class: sun_net_ExtendedOptionsImpl
++ * Method: getFlowOption
++ * Signature: (Ljava/io/FileDescriptor;Ljdk/net/SocketFlow;)V
++ */
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ int fd = getFD(env, fileDesc);
++
++ if (fd < 0) {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException", "socket closed");
++ return;
++ } else {
++ sock_flow_props_t props;
++ int status;
++ socklen_t sz = sizeof(props);
++
++ int rv = getsockopt(fd, SOL_SOCKET, SO_FLOW_SLA, &props, &sz);
++ if (rv < 0) {
++ if (errno == ENOPROTOOPT) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++ } else if (errno == EACCES || errno == EPERM) {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
++ "Permission denied");
++ } else {
++ NET_ERROR(env, JNU_JAVANETPKG "SocketException",
++ "set option SO_FLOW_SLA failed");
++ }
++ return;
++ }
++ /* first check status to see if flow exists */
++ status = props.sfp_status;
++ setStatus(env, flow, status);
++ if (status == 0) { /* OK */
++ /* can set the other fields now */
++ if (props.sfp_mask & SFP_PRIORITY) {
++ (*env)->SetIntField(env, flow, sf_priority, props.sfp_priority);
++ }
++ if (props.sfp_mask & SFP_MAXBW) {
++ (*env)->SetLongField(env, flow, sf_bandwidth,
++ (jlong)props.sfp_maxbw);
++ }
++ }
++ }
++}
++
++static jboolean flowsupported;
++static jboolean flowsupported_set = JNI_FALSE;
++
++static jboolean flowSupported0() {
++ /* Do a simple dummy call, and try to figure out from that */
++ sock_flow_props_t props;
++ int rv, s;
++ if (flowsupported_set) {
++ return flowsupported;
++ }
++ s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
++ if (s < 0) {
++ flowsupported = JNI_FALSE;
++ flowsupported_set = JNI_TRUE;
++ return JNI_FALSE;
++ }
++ memset(&props, 0, sizeof(props));
++ props.sfp_version = SOCK_FLOW_PROP_VERSION1;
++ props.sfp_mask |= SFP_PRIORITY;
++ props.sfp_priority = SFP_PRIO_NORMAL;
++ rv = setsockopt(s, SOL_SOCKET, SO_FLOW_SLA, &props, sizeof(props));
++ if (rv != 0 && errno == ENOPROTOOPT) {
++ rv = JNI_FALSE;
++ } else {
++ rv = JNI_TRUE;
++ }
++ close(s);
++ flowsupported = rv;
++ flowsupported_set = JNI_TRUE;
++ return flowsupported;
++}
++
++#else /* __solaris__ */
++
++/* Non Solaris. Functionality is not supported. So, throw UnsupportedOpExc */
++
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++}
++
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++}
++
++static jboolean flowSupported0() {
++ return JNI_FALSE;
++}
++
++#endif /* __solaris__ */
++
++JNIEXPORT jboolean JNICALL Java_sun_net_ExtendedOptionsImpl_flowSupported
++ (JNIEnv *env, jclass UNUSED) {
++ return flowSupported0();
++}
+--- ./jdk/src/solaris/native/java/net/Inet4AddressImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/java/net/Inet4AddressImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2000, 2015, 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
+@@ -51,7 +51,33 @@
+ #define HAS_GLIBC_GETHOSTBY_R 1
+ #endif
+
++static jclass ni_iacls;
++static jclass ni_ia4cls;
++static jmethodID ni_ia4ctrID;
++
++static jboolean initializeInetClasses(JNIEnv *env)
++{
++ static int initialized = 0;
++ if (!initialized) {
++ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
++ CHECK_NULL_RETURN(ni_iacls, JNI_FALSE);
++ ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
++ CHECK_NULL_RETURN(ni_iacls, JNI_FALSE);
++ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
++ CHECK_NULL_RETURN(ni_ia4cls, JNI_FALSE);
++ ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
++ CHECK_NULL_RETURN(ni_ia4cls, JNI_FALSE);
++ ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia4ctrID, JNI_FALSE);
++ initialized = 1;
++ }
++ return JNI_TRUE;
++}
++
++
+ #if defined(_ALLBSD_SOURCE) && !defined(HAS_GLIBC_GETHOSTBY_R)
++extern jobjectArray lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6);
++
+ /* Use getaddrinfo(3), which is thread safe */
+ /************************************************************************
+ * Inet4AddressImpl
+@@ -99,11 +125,6 @@
+ return (*env)->NewStringUTF(env, hostname);
+ }
+
+-static jclass ni_iacls;
+-static jclass ni_ia4cls;
+-static jmethodID ni_ia4ctrID;
+-static int initialized = 0;
+-
+ /*
+ * Find an internet address for a given hostname. Note that this
+ * code only works for addresses of type INET. The translation
+@@ -126,14 +147,8 @@
+ int error=0;
+ struct addrinfo hints, *res, *resNew = NULL;
+
+- if (!initialized) {
+- ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+- ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+- ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+- ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+- ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+- initialized = 1;
+- }
++ if (!initializeInetClasses(env))
++ return NULL;
+
+ if (IS_NULL(host)) {
+ JNU_ThrowNullPointerException(env, "host is null");
+@@ -157,12 +172,22 @@
+ return NULL;
+ }
+
++#ifdef MACOSX
++ /* If we're looking up the local machine, bypass DNS lookups and get
++ * address from getifaddrs.
++ */
++ ret = lookupIfLocalhost(env, hostname, JNI_FALSE);
++ if (ret != NULL || (*env)->ExceptionCheck(env)) {
++ JNU_ReleaseStringPlatformChars(env, host, hostname);
++ return ret;
++ }
++#endif
++
+ error = getaddrinfo(hostname, NULL, &hints, &res);
+
+ if (error) {
+ /* report error */
+- JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
+- (char *)hostname);
++ ThrowUnknownHostExceptionWithGaiError(env, hostname, error);
+ JNU_ReleaseStringPlatformChars(env, host, hostname);
+ return NULL;
+ } else {
+@@ -385,11 +410,6 @@
+ return (*env)->NewStringUTF(env, hostname);
+ }
+
+-static jclass ni_iacls;
+-static jclass ni_ia4cls;
+-static jmethodID ni_ia4ctrID;
+-static int initialized = 0;
+-
+ /*
+ * Find an internet address for a given hostname. Note that this
+ * code only works for addresses of type INET. The translation
+@@ -415,14 +435,8 @@
+ char *tmp = NULL;
+ int h_error=0;
+
+- if (!initialized) {
+- ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+- ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+- ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+- ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+- ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+- initialized = 1;
+- }
++ if (!initializeInetClasses(env))
++ return NULL;
+
+ if (IS_NULL(host)) {
+ JNU_ThrowNullPointerException(env, "host is null");
+--- ./jdk/src/solaris/native/java/net/Inet6AddressImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/java/net/Inet6AddressImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2000, 2013, 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,7 +33,9 @@
+ #include <strings.h>
+ #include <stdlib.h>
+ #include <ctype.h>
+-#ifdef _ALLBSD_SOURCE
++#ifdef MACOSX
++#include <ifaddrs.h>
++#include <net/if.h>
+ #include <unistd.h> /* gethostname */
+ #endif
+
+@@ -122,7 +124,156 @@
+ static jclass ni_ia6cls;
+ static jmethodID ni_ia4ctrID;
+ static jmethodID ni_ia6ctrID;
+-static int initialized = 0;
++static jboolean preferIPv6Address;
++
++static jboolean initializeInetClasses(JNIEnv *env)
++{
++ jfieldID ni_preferIPv6AddressID;
++ static int initialized = 0;
++ if (!initialized) {
++ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
++ CHECK_NULL_RETURN(ni_iacls, JNI_FALSE);
++ ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
++ CHECK_NULL_RETURN(ni_iacls, JNI_FALSE);
++ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
++ CHECK_NULL_RETURN(ni_ia4cls, JNI_FALSE);
++ ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
++ CHECK_NULL_RETURN(ni_ia4cls, JNI_FALSE);
++ ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
++ CHECK_NULL_RETURN(ni_ia6cls, JNI_FALSE);
++ ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
++ CHECK_NULL_RETURN(ni_ia6cls, JNI_FALSE);
++ ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia4ctrID, JNI_FALSE);
++ ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia6ctrID, JNI_FALSE);
++ ni_preferIPv6AddressID =
++ (*env)->GetStaticFieldID(env, ni_iacls, "preferIPv6Address", "Z");
++ CHECK_NULL_RETURN(ni_preferIPv6AddressID, JNI_FALSE);
++ preferIPv6Address =
++ (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
++ initialized = 1;
++ }
++ return JNI_TRUE;
++}
++
++#ifdef MACOSX
++/* also called from Inet4AddressImpl.c */
++__private_extern__ jobjectArray
++lookupIfLocalhost(JNIEnv *env, const char *hostname, jboolean includeV6)
++{
++ jobjectArray result = NULL;
++ char myhostname[NI_MAXHOST+1];
++ struct ifaddrs *ifa = NULL;
++ int familyOrder = 0;
++ int count = 0, i, j;
++ int addrs4 = 0, addrs6 = 0, numV4Loopbacks = 0, numV6Loopbacks = 0;
++ jboolean includeLoopback = JNI_FALSE;
++ jobject name;
++
++ // Make sure static variables we need are set.
++ initializeInetClasses(env);
++
++ /* If the requested name matches this host's hostname, return IP addresses
++ * from all attached interfaces. (#2844683 et al) This prevents undesired
++ * PPP dialup, but may return addresses that don't actually correspond to
++ * the name (if the name actually matches something in DNS etc.
++ */
++ myhostname[0] = '\0';
++ if (JVM_GetHostName(myhostname, NI_MAXHOST)) {
++ /* Something went wrong, maybe networking is not setup? */
++ return NULL;
++ }
++ myhostname[NI_MAXHOST] = '\0';
++
++ if (strcmp(myhostname, hostname) != 0) {
++ // Non-self lookup
++ return NULL;
++ }
++
++ if (getifaddrs(&ifa) != 0) {
++ NET_ThrowNew(env, errno, "Can't get local interface addresses");
++ return NULL;
++ }
++
++ name = (*env)->NewStringUTF(env, hostname);
++
++ /* Iterate over the interfaces, and total up the number of IPv4 and IPv6
++ * addresses we have. Also keep a count of loopback addresses. We need to
++ * exclude them in the normal case, but return them if we don't get an IP
++ * address.
++ */
++ struct ifaddrs *iter = ifa;
++ while (iter) {
++ int family = iter->ifa_addr->sa_family;
++ if (iter->ifa_name[0] != '\0' && iter->ifa_addr)
++ {
++ jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
++ if (family == AF_INET) {
++ addrs4++;
++ if (isLoopback) numV4Loopbacks++;
++ } else if (family == AF_INET6 && includeV6) {
++ addrs6++;
++ if (isLoopback) numV6Loopbacks++;
++ } else {
++ /* We don't care e.g. AF_LINK */
++ }
++ }
++ iter = iter->ifa_next;
++ }
++
++ if (addrs4 == numV4Loopbacks && addrs6 == numV6Loopbacks) {
++ // We don't have a real IP address, just loopback. We need to include
++ // loopback in our results.
++ includeLoopback = JNI_TRUE;
++ }
++
++ /* Create and fill the Java array. */
++ int arraySize = addrs4 + addrs6 -
++ (includeLoopback ? 0 : (numV4Loopbacks + numV6Loopbacks));
++ result = (*env)->NewObjectArray(env, arraySize, ni_iacls, NULL);
++ if (!result) goto done;
++
++ if (preferIPv6Address) {
++ i = includeLoopback ? addrs6 : (addrs6 - numV6Loopbacks);
++ j = 0;
++ } else {
++ i = 0;
++ j = includeLoopback ? addrs4 : (addrs4 - numV4Loopbacks);
++ }
++
++ // Now loop around the ifaddrs
++ iter = ifa;
++ while (iter != NULL) {
++ jboolean isLoopback = iter->ifa_flags & IFF_LOOPBACK;
++ int family = iter->ifa_addr->sa_family;
++
++ if (iter->ifa_name[0] != '\0' && iter->ifa_addr
++ && (family == AF_INET || (family == AF_INET6 && includeV6))
++ && (!isLoopback || includeLoopback))
++ {
++ int port;
++ int index = (family == AF_INET) ? i++ : j++;
++ jobject o = NET_SockaddrToInetAddress(env, iter->ifa_addr, &port);
++ if (!o) {
++ freeifaddrs(ifa);
++ if (!(*env)->ExceptionCheck(env))
++ JNU_ThrowOutOfMemoryError(env, "Object allocation failed");
++ return NULL;
++ }
++ setInetAddress_hostName(env, o, name);
++ (*env)->SetObjectArrayElement(env, result, index, o);
++ (*env)->DeleteLocalRef(env, o);
++ }
++ iter = iter->ifa_next;
++ }
++
++ done:
++ freeifaddrs(ifa);
++
++ return result;
++}
++#endif
+
+ /*
+ * Find an internet address for a given hostname. Note that this
+@@ -141,24 +292,13 @@
+ const char *hostname;
+ jobjectArray ret = 0;
+ int retLen = 0;
+- jboolean preferIPv6Address;
+
+ int error=0;
+ #ifdef AF_INET6
+ struct addrinfo hints, *res, *resNew = NULL;
+ #endif /* AF_INET6 */
+
+- if (!initialized) {
+- ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
+- ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
+- ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
+- ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
+- ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
+- ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
+- ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
+- ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
+- initialized = 1;
+- }
++ initializeInetClasses(env);
+
+ if (IS_NULL(host)) {
+ JNU_ThrowNullPointerException(env, "host is null");
+@@ -167,24 +307,21 @@
+ hostname = JNU_GetStringPlatformChars(env, host, JNI_FALSE);
+ CHECK_NULL_RETURN(hostname, NULL);
+
++#ifdef MACOSX
++ /*
++ * If we're looking up the local machine, attempt to get the address
++ * from getifaddrs. This ensures we get an IPv6 address for the local
++ * machine.
++ */
++ ret = lookupIfLocalhost(env, hostname, JNI_TRUE);
++ if (ret != NULL || (*env)->ExceptionCheck(env)) {
++ JNU_ReleaseStringPlatformChars(env, host, hostname);
++ return ret;
++ }
++#endif
++
+ #ifdef AF_INET6
+ if (NET_addrtransAvailable()) {
+- static jfieldID ia_preferIPv6AddressID;
+- if (ia_preferIPv6AddressID == NULL) {
+- jclass c = (*env)->FindClass(env,"java/net/InetAddress");
+- if (c) {
+- ia_preferIPv6AddressID =
+- (*env)->GetStaticFieldID(env, c, "preferIPv6Address", "Z");
+- }
+- if (ia_preferIPv6AddressID == NULL) {
+- JNU_ReleaseStringPlatformChars(env, host, hostname);
+- return NULL;
+- }
+- }
+- /* get the address preference */
+- preferIPv6Address
+- = (*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID);
+-
+ /* Try once, with our static buffer. */
+ bzero(&hints, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+--- ./jdk/src/solaris/native/java/net/net_util_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/java/net/net_util_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -809,6 +809,12 @@
+ }
+ #endif
+ }
++
++JNIEXPORT jint JNICALL
++NET_EnableFastTcpLoopback(int fd) {
++ return 0;
++}
++
+ /* In the case of an IPv4 Inetaddress this method will return an
+ * IPv4 mapped address where IPv6 is available and v4MappedAddress is TRUE.
+ * Otherwise it will return a sockaddr_in structure for an IPv4 InetAddress.
+@@ -1351,7 +1357,7 @@
+ * or sending UDP packet.
+ * 2. IPv6 on Linux: By default Linux ignores flowinfo
+ * field so enable IPV6_FLOWINFO_SEND so that flowinfo
+- * will be examined.
++ * will be examined. We also set the IPv4 TOS option in this case.
+ * 3. IPv4: set socket option based on ToS and Precedence
+ * fields (otherwise get invalid argument)
+ */
+@@ -1367,8 +1373,10 @@
+ #if defined(AF_INET6) && defined(__linux__)
+ if (ipv6_available()) {
+ int optval = 1;
+- return setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
+- (void *)&optval, sizeof(optval));
++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_FLOWINFO_SEND,
++ (void *)&optval, sizeof(optval)) < 0) {
++ return -1;
++ }
+ }
+ #endif
+
+--- ./jdk/src/solaris/native/java/net/net_util_md.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/java/net/net_util_md.h Fri Apr 10 09:21:28 2015 -0700
+@@ -83,7 +83,46 @@
+
+ #ifdef __solaris__
+ extern int net_getParam(char *driver, char *param);
+-#endif
++
++#ifndef SO_FLOW_SLA
++#define SO_FLOW_SLA 0x1018
++
++#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
++#pragma pack(4)
++ #endif
++
++/*
++ * Used with the setsockopt(SO_FLOW_SLA, ...) call to set
++ * per socket service level properties.
++ * When the application uses per-socket API, we will enforce the properties
++ * on both outbound and inbound packets.
++ *
++ * For now, only priority and maxbw are supported in SOCK_FLOW_PROP_VERSION1.
++ */
++typedef struct sock_flow_props_s {
++ int sfp_version;
++ uint32_t sfp_mask;
++ int sfp_priority; /* flow priority */
++ uint64_t sfp_maxbw; /* bandwidth limit in bps */
++ int sfp_status; /* flow create status for getsockopt */
++} sock_flow_props_t;
++
++#define SOCK_FLOW_PROP_VERSION1 1
++
++/* bit mask values for sfp_mask */
++#define SFP_MAXBW 0x00000001 /* Flow Bandwidth Limit */
++#define SFP_PRIORITY 0x00000008 /* Flow priority */
++
++/* possible values for sfp_priority */
++#define SFP_PRIO_NORMAL 1
++#define SFP_PRIO_HIGH 2
++
++#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
++#pragma pack()
++#endif /* _LONG_LONG_ALIGNMENT */
++
++#endif /* SO_FLOW_SLA */
++#endif /* __solaris__ */
+
+ /* needed from libsocket on Solaris 8 */
+
+--- ./jdk/src/solaris/native/sun/awt/awt_util.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/awt/awt_util.h Fri Apr 10 09:21:28 2015 -0700
+@@ -115,6 +115,8 @@
+
+ extern int xerror_ignore_bad_window(Display *dpy, XErrorEvent *err);
+
++Window get_xawt_root_shell(JNIEnv *env);
++
+ #endif /* !HEADLESS */
+
+ #ifndef INTERSECTS
+--- ./jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2005, 2014, 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
+@@ -281,9 +281,7 @@
+ /* for changing the visible shape of a window to an nonrectangular form */
+ void
+ SplashUpdateShape(Splash * splash) {
+- if (!shapeSupported)
+- return;
+- if (!splash->maskRequired) {
++ if (splash->currentFrame < 0 || !shapeSupported || !splash->maskRequired) {
+ return;
+ }
+ XShapeCombineRectangles(splash->display, splash->window, ShapeClip, 0, 0,
+@@ -324,6 +322,10 @@
+
+ void
+ SplashRedrawWindow(Splash * splash) {
++ if (splash->currentFrame < 0) {
++ return;
++ }
++
+ XImage *ximage;
+
+ // making this method redraw a part of the image does not make
+--- ./jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -152,10 +152,13 @@
+
+ JNIEXPORT jlong JNICALL
+ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
+- jint srcFD,
++ jobject srcFDO,
+ jlong position, jlong count,
+- jint dstFD)
++ jobject dstFDO)
+ {
++ jint srcFD = fdval(env, srcFDO);
++ jint dstFD = fdval(env, dstFDO);
++
+ #if defined(__linux__)
+ off64_t offset = (off64_t)position;
+ jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
+--- ./jdk/src/solaris/native/sun/nio/ch/Net.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/nio/ch/Net.c Fri Apr 10 09:21:28 2015 -0700
+@@ -151,7 +151,7 @@
+
+ JNIEXPORT int JNICALL
+ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
+- jboolean stream, jboolean reuse)
++ jboolean stream, jboolean reuse, jboolean ignored)
+ {
+ int fd;
+ int type = (stream ? SOCK_STREAM : SOCK_DGRAM);
+@@ -382,7 +382,8 @@
+
+ JNIEXPORT void JNICALL
+ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
+- jboolean mayNeedConversion, jint level, jint opt, jint arg)
++ jboolean mayNeedConversion, jint level,
++ jint opt, jint arg, jboolean isIPv6)
+ {
+ int result;
+ struct linger linger;
+@@ -425,6 +426,12 @@
+ JNU_JAVANETPKG "SocketException",
+ "sun.nio.ch.Net.setIntOption");
+ }
++#ifdef __linux__
++ if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS && isIPv6) {
++ // set the V4 option also
++ setsockopt(fdval(env, fdo), IPPROTO_IP, IP_TOS, parg, arglen);
++ }
++#endif
+ }
+
+ JNIEXPORT jint JNICALL
+--- ./jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Fri Apr 10 09:21:28 2015 -0700
+@@ -278,7 +278,7 @@
+ int res = -1;
+
+ RESTARTABLE(dup((int)fd), res);
+- if (fd == -1) {
++ if (res == -1) {
+ throwUnixException(env, errno);
+ }
+ return (jint)res;
+@@ -306,13 +306,14 @@
+ JNIEXPORT void JNICALL
+ Java_sun_nio_fs_UnixNativeDispatcher_fclose(JNIEnv* env, jclass this, jlong stream)
+ {
+- int res;
+ FILE* fp = jlong_to_ptr(stream);
+
+- do {
+- res = fclose(fp);
+- } while (res == EOF && errno == EINTR);
+- if (res == EOF) {
++ /* NOTE: fclose() wrapper is only used with read-only streams.
++ * If it ever is used with write streams, it might be better to add
++ * RESTARTABLE(fflush(fp)) before closing, to make sure the stream
++ * is completely written even if fclose() failed.
++ */
++ if (fclose(fp) == EOF && errno != EINTR) {
+ throwUnixException(env, errno);
+ }
+ }
+@@ -610,11 +611,9 @@
+
+ JNIEXPORT void JNICALL
+ Java_sun_nio_fs_UnixNativeDispatcher_closedir(JNIEnv* env, jclass this, jlong dir) {
+- int err;
+ DIR* dirp = jlong_to_ptr(dir);
+
+- RESTARTABLE(closedir(dirp), err);
+- if (errno == -1) {
++ if (closedir(dirp) == -1 && errno != EINTR) {
+ throwUnixException(env, errno);
+ }
+ }
+--- ./jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/security/pkcs11/j2secmod_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -34,7 +34,7 @@
+ #include "j2secmod.h"
+
+ void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
+- void *hModule = (void*)jHandle;
++ void *hModule = (void*)jlong_to_ptr(jHandle);
+ void *fAddress = dlsym(hModule, functionName);
+ if (fAddress == NULL) {
+ char errorMessage[256];
+@@ -53,7 +53,7 @@
+ void *hModule = dlopen(libName, RTLD_NOLOAD);
+ dprintf2("-handle for %s: %u\n", libName, hModule);
+ (*env)->ReleaseStringUTFChars(env, jLibName, libName);
+- return (jlong)hModule;
++ return ptr_to_jlong(hModule);
+ }
+
+ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_Secmod_nssLoadLibrary
+@@ -72,5 +72,5 @@
+ return 0;
+ }
+
+- return (jlong)hModule;
++ return ptr_to_jlong(hModule);
+ }
+--- ./jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -79,7 +79,7 @@
+ {
+ void *hModule;
+ char *error;
+- CK_C_GetFunctionList C_GetFunctionList;
++ CK_C_GetFunctionList C_GetFunctionList=NULL;
+ CK_RV rv;
+ ModuleData *moduleData;
+ jobject globalPKCS11ImplementationReference;
+--- ./jdk/src/solaris/native/sun/xawt/XlibWrapper.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/solaris/native/sun/xawt/XlibWrapper.c Fri Apr 10 09:21:28 2015 -0700
+@@ -1942,10 +1942,14 @@
+ * Toolkit thread to process PropertyNotify or SelectionNotify events.
+ */
+ static Bool
+-secondary_loop_event(Display* dpy, XEvent* event, char* arg) {
+- return (event->type == SelectionNotify ||
+- event->type == SelectionClear ||
+- event->type == PropertyNotify) ? True : False;
++secondary_loop_event(Display* dpy, XEvent* event, XPointer xawt_root_window) {
++ return (
++ event->type == SelectionNotify ||
++ event->type == SelectionClear ||
++ event->type == PropertyNotify ||
++ (event->type == ConfigureNotify
++ && event->xany.window == *(Window*) xawt_root_window)
++ ) ? True : False;
+ }
+
+
+@@ -1956,8 +1960,11 @@
+
+ AWT_CHECK_HAVE_LOCK();
+ exitSecondaryLoop = False;
++ Window xawt_root_window = get_xawt_root_shell(env);
++
+ while (!exitSecondaryLoop) {
+- if (XCheckIfEvent((Display*) jlong_to_ptr(display), (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, NULL)) {
++ if (XCheckIfEvent((Display*) jlong_to_ptr(display),
++ (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, (XPointer) &xawt_root_window)) {
+ return JNI_TRUE;
+ }
+ timeout = (timeout < AWT_SECONDARY_LOOP_TIMEOUT) ? (timeout << 1) : AWT_SECONDARY_LOOP_TIMEOUT;
+--- ./jdk/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/classes/sun/nio/ch/FileDispatcherImpl.java Fri Apr 10 09:21:28 2015 -0700
+@@ -25,15 +25,16 @@
+
+ package sun.nio.ch;
+
+-import java.io.*;
++import java.io.FileDescriptor;
++import java.io.IOException;
++import java.security.PrivilegedAction;
+ import sun.misc.SharedSecrets;
+ import sun.misc.JavaIOFileDescriptorAccess;
+
+-class FileDispatcherImpl extends FileDispatcher
+-{
+- static {
+- Util.load();
+- }
++class FileDispatcherImpl extends FileDispatcher {
++
++ // set to true if fast file transmission (TransmitFile) is enabled
++ private static final boolean fastFileTransfer;
+
+ /**
+ * Indicates if the dispatcher should first advance the file position
+@@ -120,6 +121,36 @@
+ return result;
+ }
+
++ boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
++ return fastFileTransfer && sc.isBlocking();
++ }
++
++ boolean transferToDirectlyNeedsPositionLock() {
++ return true;
++ }
++
++ static boolean isFastFileTransferRequested() {
++ String fileTransferProp = java.security.AccessController.doPrivileged(
++ new PrivilegedAction<String>() {
++ @Override
++ public String run() {
++ return System.getProperty("jdk.nio.enableFastFileTransfer");
++ }
++ });
++ boolean enable;
++ if ("".equals(fileTransferProp)) {
++ enable = true;
++ } else {
++ enable = Boolean.parseBoolean(fileTransferProp);
++ }
++ return enable;
++ }
++
++ static {
++ Util.load();
++ fastFileTransfer = isFastFileTransferRequested();
++ }
++
+ //-- Native methods
+
+ static native int read0(FileDescriptor fd, long address, int len)
+--- ./jdk/src/windows/lib/tzmappings Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/lib/tzmappings Fri Apr 10 09:21:28 2015 -0700
+@@ -137,8 +137,8 @@
+ Central Standard Time:36,37::America/Chicago:
+ Eastern:38,39::America/New_York:
+ Eastern Standard Time:38,39::America/New_York:
+-E. Europe:4,5:BY:Europe/Minsk:
+-E. Europe Standard Time:4,5:BY:Europe/Minsk:
++E. Europe:4,5::EET:
++E. Europe Standard Time:4,5::EET:
+ Egypt:4,68::Africa/Cairo:
+ Egypt Standard Time:4,68::Africa/Cairo:
+ South Africa:4,69::Africa/Harare:
+@@ -192,5 +192,11 @@
+ Kaliningrad Standard Time:925,925:RU:Europe/Kaliningrad:
+ Turkey Standard Time:926,926::Asia/Istanbul:
+ Bahia Standard Time:927,927::America/Bahia:
+-Western Brazilian Standard Time:928,928:BR:America/Rio_Branco:
+-Armenian Standard Time:929,929:AM:Asia/Yerevan:
++Libya Standard Time:928,928:LY:Africa/Tripoli:
++Belarus Standard Time:929,929:BY:Europe/Minsk:
++Line Islands Standard Time:930,930::Pacific/Kiritimati:
++Russia Time Zone 10:931,931::Asia/Srednekolymsk:
++Russia Time Zone 11:932,932::Asia/Anadyr:
++Russia Time Zone 3:933,933::Europe/Samara:
++Western Brazilian Standard Time:934,934:BR:America/Rio_Branco:
++Armenian Standard Time:935,935:AM:Asia/Yerevan:
+--- ./jdk/src/windows/native/java/io/io_util_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/io/io_util_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,6 +29,7 @@
+ #include "io_util.h"
+ #include "io_util_md.h"
+ #include <stdio.h>
++#include <windows.h>
+
+ #include <wchar.h>
+ #include <io.h>
+@@ -589,3 +590,77 @@
+ }
+ return long_to_jlong(pos.QuadPart);
+ }
++
++size_t
++getLastErrorString(char *utf8_jvmErrorMsg, size_t cbErrorMsg)
++{
++ size_t n = 0;
++ if (cbErrorMsg > 0) {
++ BOOLEAN noError = FALSE;
++ WCHAR *utf16_osErrorMsg = (WCHAR *)malloc(cbErrorMsg*sizeof(WCHAR));
++ if (utf16_osErrorMsg == NULL) {
++ // OOM accident
++ strncpy(utf8_jvmErrorMsg, "Out of memory", cbErrorMsg);
++ // truncate if too long
++ utf8_jvmErrorMsg[cbErrorMsg - 1] = '\0';
++ n = strlen(utf8_jvmErrorMsg);
++ } else {
++ DWORD errval = GetLastError();
++ if (errval != 0) {
++ // WIN32 error
++ n = (size_t)FormatMessageW(
++ FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
++ NULL,
++ errval,
++ 0,
++ utf16_osErrorMsg,
++ (DWORD)cbErrorMsg,
++ NULL);
++ if (n > 3) {
++ // Drop final '.', CR, LF
++ if (utf16_osErrorMsg[n - 1] == L'\n') --n;
++ if (utf16_osErrorMsg[n - 1] == L'\r') --n;
++ if (utf16_osErrorMsg[n - 1] == L'.') --n;
++ utf16_osErrorMsg[n] = L'\0';
++ }
++ } else if (errno != 0) {
++ // C runtime error that has no corresponding WIN32 error code
++ const WCHAR *rtError = _wcserror(errno);
++ if (rtError != NULL) {
++ wcsncpy(utf16_osErrorMsg, rtError, cbErrorMsg);
++ // truncate if too long
++ utf16_osErrorMsg[cbErrorMsg - 1] = L'\0';
++ n = wcslen(utf16_osErrorMsg);
++ }
++ } else
++ noError = TRUE; //OS has no error to report
++
++ if (!noError) {
++ if (n > 0) {
++ n = WideCharToMultiByte(
++ CP_UTF8,
++ 0,
++ utf16_osErrorMsg,
++ n,
++ utf8_jvmErrorMsg,
++ cbErrorMsg,
++ NULL,
++ NULL);
++
++ // no way to die
++ if (n > 0)
++ utf8_jvmErrorMsg[min(cbErrorMsg - 1, n)] = '\0';
++ }
++
++ if (n <= 0) {
++ strncpy(utf8_jvmErrorMsg, "Secondary error while OS message extraction", cbErrorMsg);
++ // truncate if too long
++ utf8_jvmErrorMsg[cbErrorMsg - 1] = '\0';
++ n = strlen(utf8_jvmErrorMsg);
++ }
++ }
++ free(utf16_osErrorMsg);
++ }
++ }
++ return n;
++}
+--- ./jdk/src/windows/native/java/lang/ProcessImpl_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/lang/ProcessImpl_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -112,20 +112,70 @@
+ return newFlag;
+ }
+
++/* We have THREE locales in action:
++ * 1. Thread default locale - dictates UNICODE-to-8bit conversion
++ * 2. System locale that defines the message localization
++ * 3. The file name locale
++ * Each locale could be an extended locale, that means that text cannot be
++ * mapped to 8bit sequence without multibyte encoding.
++ * VM is ready for that, if text is UTF-8.
++ * Here we make the work right from the beginning.
++ */
++size_t os_error_message(int errnum, WCHAR* utf16_OSErrorMsg, size_t maxMsgLength) {
++ size_t n = (size_t)FormatMessageW(
++ FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
++ NULL,
++ (DWORD)errnum,
++ 0,
++ utf16_OSErrorMsg,
++ (DWORD)maxMsgLength,
++ NULL);
++ if (n > 3) {
++ // Drop final '.', CR, LF
++ if (utf16_OSErrorMsg[n - 1] == L'\n') --n;
++ if (utf16_OSErrorMsg[n - 1] == L'\r') --n;
++ if (utf16_OSErrorMsg[n - 1] == L'.') --n;
++ utf16_OSErrorMsg[n] = L'\0';
++ }
++ return n;
++}
++
++#define MESSAGE_LENGTH (256 + 100)
++#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x))
++
+ static void
+-win32Error(JNIEnv *env, const char *functionName)
++win32Error(JNIEnv *env, const WCHAR *functionName)
+ {
+- static const char * const format = "%s error=%d, %s";
+- static const char * const fallbackFormat = "%s failed, error=%d";
+- char buf[256];
+- char errmsg[sizeof(buf) + 100];
+- const int errnum = GetLastError();
+- const int n = JVM_GetLastErrorString(buf, sizeof(buf));
+- if (n > 0)
+- sprintf(errmsg, format, functionName, errnum, buf);
+- else
+- sprintf(errmsg, fallbackFormat, functionName, errnum);
+- JNU_ThrowIOException(env, errmsg);
++ WCHAR utf16_OSErrorMsg[MESSAGE_LENGTH - 100];
++ WCHAR utf16_javaMessage[MESSAGE_LENGTH];
++ /*Good suggestion about 2-bytes-per-symbol in localized error reports*/
++ char utf8_javaMessage[MESSAGE_LENGTH*2];
++ const int errnum = (int)GetLastError();
++ int n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg));
++ n = (n > 0)
++ ? swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s error=%d, %s", functionName, errnum, utf16_OSErrorMsg)
++ : swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s failed, error=%d", functionName, errnum);
++
++ if (n > 0) /*terminate '\0' is not a part of conversion procedure*/
++ n = WideCharToMultiByte(
++ CP_UTF8,
++ 0,
++ utf16_javaMessage,
++ n, /*by creation n <= MESSAGE_LENGTH*/
++ utf8_javaMessage,
++ MESSAGE_LENGTH*2,
++ NULL,
++ NULL);
++
++ /*no way to die*/
++ {
++ const char *errorMessage = "Secondary error while OS message extraction";
++ if (n > 0) {
++ utf8_javaMessage[min(MESSAGE_LENGTH*2 - 1, n)] = '\0';
++ errorMessage = utf8_javaMessage;
++ }
++ JNU_ThrowIOException(env, errorMessage);
++ }
+ }
+
+ static void
+@@ -193,7 +243,7 @@
+ instead of 'Everybody' access */
+ PIPE_SIZE))
+ {
+- win32Error(env, "CreatePipe");
++ win32Error(env, L"CreatePipe");
+ return FALSE;
+ } else {
+ /* [thisProcessEnd] has no the inherit flag because
+@@ -349,7 +399,7 @@
+ &si, /* (in) startup information */
+ &pi)) /* (out) process information */
+ {
+- win32Error(env, "CreateProcess");
++ win32Error(env, L"CreateProcess");
+ } else {
+ closeSafely(pi.hThread);
+ ret = (jlong)pi.hProcess;
+@@ -410,7 +460,7 @@
+ {
+ DWORD exit_code;
+ if (GetExitCodeProcess((HANDLE) handle, &exit_code) == 0)
+- win32Error(env, "GetExitCodeProcess");
++ win32Error(env, L"GetExitCodeProcess");
+ return exit_code;
+ }
+
+@@ -431,7 +481,7 @@
+ FALSE, /* Wait for ANY event */
+ INFINITE) /* Wait forever */
+ == WAIT_FAILED)
+- win32Error(env, "WaitForMultipleObjects");
++ win32Error(env, L"WaitForMultipleObjects");
+ }
+
+ JNIEXPORT void JNICALL
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/src/windows/native/java/net/ExtendedOptionsImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,62 @@
++/*
++ * Copyright (c) 2014, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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.
++ */
++
++#include <jni.h>
++#include <string.h>
++
++#include "net_util.h"
++
++/*
++ * Class: sun_net_ExtendedOptionsImpl
++ * Method: init
++ * Signature: ()V
++ */
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_init
++ (JNIEnv *env, jclass UNUSED)
++{
++}
++
++/* Non Solaris. Functionality is not supported. So, throw UnsupportedOpExc */
++
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++}
++
++JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption
++ (JNIEnv *env, jclass UNUSED, jobject fileDesc, jobject flow) {
++ JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
++ "unsupported socket option");
++}
++
++static jboolean flowSupported0() {
++ return JNI_FALSE;
++}
++
++JNIEXPORT jboolean JNICALL Java_sun_net_ExtendedOptionsImpl_flowSupported
++ (JNIEnv *env, jclass UNUSED) {
++ return JNI_FALSE;
++}
+--- ./jdk/src/windows/native/java/net/Inet4AddressImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/net/Inet4AddressImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -142,10 +142,15 @@
+
+ if (!initialized) {
+ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
++ CHECK_NULL_RETURN(ni_iacls, NULL);
+ ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
++ CHECK_NULL_RETURN(ni_iacls, NULL);
+ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
++ CHECK_NULL_RETURN(ni_ia4cls, NULL);
+ ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
++ CHECK_NULL_RETURN(ni_ia4cls, NULL);
+ ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia4ctrID, NULL);
+ initialized = 1;
+ }
+
+@@ -241,6 +246,10 @@
+ addrp++;
+ i++;
+ }
++ } else if (WSAGetLastError() == WSATRY_AGAIN) {
++ NET_ThrowByNameWithLastError(env,
++ JNU_JAVANETPKG "UnknownHostException",
++ hostname);
+ } else {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException", hostname);
+ }
+--- ./jdk/src/windows/native/java/net/Inet6AddressImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/net/Inet6AddressImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -93,13 +93,21 @@
+
+ if (!initialized) {
+ ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
++ CHECK_NULL_RETURN(ni_iacls, NULL);
+ ni_iacls = (*env)->NewGlobalRef(env, ni_iacls);
++ CHECK_NULL_RETURN(ni_iacls, NULL);
+ ni_ia4cls = (*env)->FindClass(env, "java/net/Inet4Address");
++ CHECK_NULL_RETURN(ni_ia4cls, NULL);
+ ni_ia4cls = (*env)->NewGlobalRef(env, ni_ia4cls);
++ CHECK_NULL_RETURN(ni_ia4cls, NULL);
+ ni_ia6cls = (*env)->FindClass(env, "java/net/Inet6Address");
++ CHECK_NULL_RETURN(ni_ia6cls, NULL);
+ ni_ia6cls = (*env)->NewGlobalRef(env, ni_ia6cls);
++ CHECK_NULL_RETURN(ni_ia6cls, NULL);
+ ni_ia4ctrID = (*env)->GetMethodID(env, ni_ia4cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia4ctrID, NULL);
+ ni_ia6ctrID = (*env)->GetMethodID(env, ni_ia6cls, "<init>", "()V");
++ CHECK_NULL_RETURN(ni_ia6ctrID, NULL);
+ initialized = 1;
+ }
+ if (IS_NULL(host)) {
+@@ -131,7 +139,13 @@
+
+ error = getaddrinfo(hostname, NULL, &hints, &res);
+
+- if (error) {
++ if (WSAGetLastError() == WSATRY_AGAIN) {
++ NET_ThrowByNameWithLastError(env,
++ JNU_JAVANETPKG "UnknownHostException",
++ hostname);
++ JNU_ReleaseStringPlatformChars(env, host, hostname);
++ return NULL;
++ } else if (error) {
+ /* report error */
+ JNU_ThrowByName(env, JNU_JAVANETPKG "UnknownHostException",
+ (char *)hostname);
+--- ./jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -489,6 +489,9 @@
+ }
+ }
+ } else {
++ /* NET_BindV6() closes both sockets upon a failure */
++ (*env)->SetObjectField(env, this, pdsi_fdID, NULL);
++ (*env)->SetObjectField(env, this, pdsi_fd1ID, NULL);
+ NET_ThrowCurrent (env, "Cannot bind");
+ return;
+ }
+--- ./jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/net/TwoStacksPlainSocketImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -468,6 +468,10 @@
+ (*env)->SetIntField(env, fd1Obj, IO_fd_fdID, fd1);
+ }
+ }
++ } else {
++ /* NET_BindV6() closes both sockets upon a failure */
++ (*env)->SetObjectField(env, this, psi_fdID, NULL);
++ (*env)->SetObjectField(env, this, psi_fd1ID, NULL);
+ }
+ } else {
+ rv = NET_WinBind(fd, (struct sockaddr *)&him, len, exclBind);
+--- ./jdk/src/windows/native/java/net/net_util_md.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/java/net/net_util_md.c Fri Apr 10 09:21:28 2015 -0700
+@@ -29,6 +29,9 @@
+ #include "net_util.h"
+ #include "jni.h"
+
++// Taken from mstcpip.h in Windows SDK 8.0 or newer.
++#define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16)
++
+ #ifndef IPTOS_TOS_MASK
+ #define IPTOS_TOS_MASK 0x1e
+ #endif
+@@ -443,6 +446,13 @@
+ {
+ int rv;
+
++ if (level == IPPROTO_IPV6 && optname == IPV6_TCLASS) {
++ int *intopt = (int *)optval;
++ *intopt = 0;
++ *optlen = sizeof(*intopt);
++ return 0;
++ }
++
+ rv = getsockopt(s, level, optname, optval, optlen);
+
+
+@@ -620,7 +630,7 @@
+ * and returns SOCKET_ERROR. Used in NET_BindV6 only.
+ */
+
+-#define CLOSE_SOCKETS_AND_RETURN { \
++#define CLOSE_SOCKETS_AND_RETURN do { \
+ if (fd != -1) { \
+ closesocket (fd); \
+ fd = -1; \
+@@ -639,7 +649,7 @@
+ } \
+ b->ipv4_fd = b->ipv6_fd = -1; \
+ return SOCKET_ERROR; \
+-}
++} while(0)
+
+ /*
+ * if ipv6 is available, call NET_BindV6 to bind to the required address/port.
+@@ -837,6 +847,25 @@
+ }
+ }
+
++/**
++ * Enables SIO_LOOPBACK_FAST_PATH
++ */
++JNIEXPORT jint JNICALL
++NET_EnableFastTcpLoopback(int fd) {
++ int enabled = 1;
++ DWORD result_byte_count = -1;
++ int result = WSAIoctl(fd,
++ SIO_LOOPBACK_FAST_PATH,
++ &enabled,
++ sizeof(enabled),
++ NULL,
++ 0,
++ &result_byte_count,
++ NULL,
++ NULL);
++ return result == SOCKET_ERROR ? WSAGetLastError() : 0;
++}
++
+ /* If address types is IPv6, then IPv6 must be available. Otherwise
+ * no address can be generated. In the case of an IPv4 Inetaddress this
+ * method will return an IPv4 mapped address where IPv6 is available and
+--- ./jdk/src/windows/native/sun/nio/ch/FileChannelImpl.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/nio/ch/FileChannelImpl.c Fri Apr 10 09:21:28 2015 -0700
+@@ -31,6 +31,11 @@
+ #include "nio.h"
+ #include "nio_util.h"
+ #include "sun_nio_ch_FileChannelImpl.h"
++#include "java_lang_Integer.h"
++
++#include <winsock2.h>
++#include <Mswsock.h>
++#pragma comment(lib, "Mswsock.lib")
+
+ static jfieldID chan_fd; /* id for jobject 'fd' in java.io.FileChannel */
+
+@@ -174,9 +179,42 @@
+
+ JNIEXPORT jlong JNICALL
+ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
+- jint srcFD,
++ jobject srcFD,
+ jlong position, jlong count,
+- jint dstFD)
++ jobject dstFD)
+ {
+- return IOS_UNSUPPORTED;
++ const int PACKET_SIZE = 524288;
++
++ HANDLE src = (HANDLE)(handleval(env, srcFD));
++ SOCKET dst = (SOCKET)(fdval(env, dstFD));
++ DWORD chunkSize = (count > java_lang_Integer_MAX_VALUE) ?
++ java_lang_Integer_MAX_VALUE : (DWORD)count;
++ BOOL result = 0;
++
++ jlong pos = Java_sun_nio_ch_FileChannelImpl_position0(env, this, srcFD, position);
++ if (pos == IOS_THROWN) {
++ return IOS_THROWN;
++ }
++
++ result = TransmitFile(
++ dst,
++ src,
++ chunkSize,
++ PACKET_SIZE,
++ NULL,
++ NULL,
++ TF_USE_KERNEL_APC
++ );
++ if (!result) {
++ int error = WSAGetLastError();
++ if (WSAEINVAL == error && count >= 0) {
++ return IOS_UNSUPPORTED_CASE;
++ }
++ if (WSAENOTSOCK == error) {
++ return IOS_UNSUPPORTED_CASE;
++ }
++ JNU_ThrowIOExceptionWithLastError(env, "transfer failed");
++ return IOS_THROWN;
++ }
++ return chunkSize;
+ }
+--- ./jdk/src/windows/native/sun/nio/ch/Net.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/nio/ch/Net.c Fri Apr 10 09:21:28 2015 -0700
+@@ -126,7 +126,7 @@
+
+ JNIEXPORT jint JNICALL
+ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
+- jboolean stream, jboolean reuse)
++ jboolean stream, jboolean reuse, jboolean fastLoopback)
+ {
+ SOCKET s;
+ int domain = (preferIPv6) ? AF_INET6 : AF_INET;
+@@ -151,6 +151,20 @@
+ NET_ThrowNew(env, WSAGetLastError(), "socket");
+ }
+
++ if (stream && fastLoopback) {
++ static int loopback_available = 1;
++ if (loopback_available) {
++ int rv = NET_EnableFastTcpLoopback((jint)s);
++ if (rv) {
++ if (rv == WSAEOPNOTSUPP || rv == WSAEINVAL) {
++ loopback_available = 0;
++ } else {
++ NET_ThrowNew(env, rv, "fastLoopback");
++ }
++ }
++ }
++ }
++
+ return (jint)s;
+ }
+
+@@ -294,9 +308,9 @@
+ /**
+ * HACK: IP_TOS is deprecated on Windows and querying the option
+ * returns a protocol error. NET_GetSockOpt handles this and uses
+- * a fallback mechanism.
++ * a fallback mechanism. Same applies to IPV6_TCLASS
+ */
+- if (level == IPPROTO_IP && opt == IP_TOS) {
++ if ((level == IPPROTO_IP && opt == IP_TOS) || (level == IPPROTO_IPV6 && opt == IPV6_TCLASS)) {
+ mayNeedConversion = JNI_TRUE;
+ }
+
+@@ -318,7 +332,7 @@
+
+ JNIEXPORT void JNICALL
+ Java_sun_nio_ch_Net_setIntOption0(JNIEnv *env, jclass clazz, jobject fdo,
+- jboolean mayNeedConversion, jint level, jint opt, jint arg)
++ jboolean mayNeedConversion, jint level, jint opt, jint arg, jboolean ipv6)
+ {
+ struct linger linger;
+ char *parg;
+@@ -339,6 +353,11 @@
+ arglen = sizeof(arg);
+ }
+
++ if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS) {
++ /* No op */
++ return;
++ }
++
+ if (mayNeedConversion) {
+ n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen);
+ } else {
+--- ./jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c Fri Apr 10 09:21:28 2015 -0700
+@@ -23,6 +23,7 @@
+ * questions.
+ */
+ #include <windows.h>
++#include <Sddl.h>
+ #include <string.h>
+
+ #include "jni.h"
+@@ -258,6 +259,25 @@
+ HANDLE hPipe;
+ char name[MAX_PIPE_NAME_LENGTH];
+
++ SECURITY_ATTRIBUTES sa;
++ LPSECURITY_ATTRIBUTES lpSA = NULL;
++ // Custom Security Descriptor is required here to "get" Medium Integrity Level.
++ // In order to allow Medium Integrity Level clients to open
++ // and use a NamedPipe created by an High Integrity Level process.
++ TCHAR *szSD = TEXT("D:") // Discretionary ACL
++ TEXT("(A;OICI;GRGW;;;WD)") // Allow read/write to Everybody
++ TEXT("(A;OICI;GA;;;SY)") // Allow full control to System
++ TEXT("(A;OICI;GA;;;BA)"); // Allow full control to Administrators
++
++ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
++ sa.bInheritHandle = FALSE;
++ sa.lpSecurityDescriptor = NULL;
++
++ if (ConvertStringSecurityDescriptorToSecurityDescriptor
++ (szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) {
++ lpSA = &sa;
++ }
++
+ jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH);
+
+ hPipe = CreateNamedPipe(
+@@ -270,7 +290,9 @@
+ 128, // output buffer size
+ 8192, // input buffer size
+ NMPWAIT_USE_DEFAULT_WAIT, // client time-out
+- NULL); // default security attribute
++ lpSA); // security attributes
++
++ LocalFree(sa.lpSecurityDescriptor);
+
+ if (hPipe == INVALID_HANDLE_VALUE) {
+ JNU_ThrowIOExceptionWithLastError(env, "CreateNamedPipe failed");
+--- ./jdk/src/windows/native/sun/windows/WPrinterJob.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/WPrinterJob.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2000, 2014, 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
+@@ -927,14 +927,7 @@
+ if (type == GETJOBCOUNT) {
+ ret = pPrinterInfo->cJobs;
+ } else if (type == ACCEPTJOB) {
+- if (pPrinterInfo->Status &
+- (PRINTER_STATUS_ERROR |
+- PRINTER_STATUS_NOT_AVAILABLE |
+- PRINTER_STATUS_NO_TONER |
+- PRINTER_STATUS_OUT_OF_MEMORY |
+- PRINTER_STATUS_OFFLINE |
+- PRINTER_STATUS_USER_INTERVENTION |
+- PRINTER_STATUS_DOOR_OPEN)) {
++ if (pPrinterInfo->Status & PRINTER_STATUS_PENDING_DELETION) {
+ ret = 0;
+ }
+ else {
+--- ./jdk/src/windows/native/sun/windows/awt_Component.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_Component.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -3523,8 +3523,12 @@
+ if (ops == SAVE) {
+ transTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
+ reinterpret_cast<void*>(static_cast<INT_PTR>(translation)));
+- deadKeyFlagTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
+- reinterpret_cast<void*>(static_cast<INT_PTR>(deadKeyFlag)));
++ if (deadKeyFlag) {
++ deadKeyFlagTable.put(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)),
++ reinterpret_cast<void*>(static_cast<INT_PTR>(deadKeyFlag)));
++ } else {
++ deadKeyFlagTable.remove(reinterpret_cast<void*>(static_cast<INT_PTR>(wkey)));
++ }
+ }
+
+ isDeadKey = deadKeyFlag;
+--- ./jdk/src/windows/native/sun/windows/awt_TextArea.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_TextArea.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -47,16 +47,12 @@
+
+ jfieldID AwtTextArea::scrollbarVisibilityID;
+
+-WNDPROC AwtTextArea::sm_pDefWindowProc = NULL;
+-
+ /************************************************************************
+ * AwtTextArea methods
+ */
+
+ AwtTextArea::AwtTextArea() {
+- m_bIgnoreEnChange = FALSE;
+ m_bCanUndo = FALSE;
+- m_hEditCtrl = NULL;
+ m_lHDeltaAccum = 0;
+ m_lVDeltaAccum = 0;
+ }
+@@ -67,10 +63,6 @@
+
+ void AwtTextArea::Dispose()
+ {
+- if (m_hEditCtrl != NULL) {
+- VERIFY(::DestroyWindow(m_hEditCtrl));
+- m_hEditCtrl = NULL;
+- }
+ AwtTextComponent::Dispose();
+ }
+
+@@ -91,10 +83,6 @@
+ }
+ }
+
+-void AwtTextArea::EditGetSel(CHARRANGE &cr) {
+- SendMessage(EM_EXGETSEL, 0, reinterpret_cast<LPARAM>(&cr));
+-}
+-
+ /* Count how many '\n's are there in jStr */
+ size_t AwtTextArea::CountNewLines(JNIEnv *env, jstring jStr, size_t maxlen)
+ {
+@@ -149,159 +137,6 @@
+ return retValue;
+ }
+
+-/*
+- * This routine is a window procedure for the subclass of the standard edit control
+- * used to generate context menu. RichEdit controls don't have built-in context menu.
+- * To implement this functionality we have to create an invisible edit control and
+- * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
+- * While the edit control context menu is active we intercept the message generated in
+- * response to particular item selection and forward it back to the RichEdit control.
+- * (See AwtTextArea::WmContextMenu for more details).
+- */
+-LRESULT
+-AwtTextArea::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
+-
+- static BOOL bContextMenuActive = FALSE;
+-
+- LRESULT retValue = 0;
+- MsgRouting mr = mrDoDefault;
+-
+- DASSERT(::IsWindow(::GetParent(hWnd)));
+-
+- switch (message) {
+- case WM_UNDO:
+- case WM_CUT:
+- case WM_COPY:
+- case WM_PASTE:
+- case WM_CLEAR:
+- case EM_SETSEL:
+- if (bContextMenuActive) {
+- ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
+- mr = mrConsume;
+- }
+- break;
+- case WM_CONTEXTMENU:
+- bContextMenuActive = TRUE;
+- break;
+- }
+-
+- if (mr == mrDoDefault) {
+- DASSERT(sm_pDefWindowProc != NULL);
+- retValue = ::CallWindowProc(sm_pDefWindowProc,
+- hWnd, message, wParam, lParam);
+- }
+-
+- if (message == WM_CONTEXTMENU) {
+- bContextMenuActive = FALSE;
+- }
+-
+- return retValue;
+-}
+-
+-MsgRouting
+-AwtTextArea::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
+- /* Use the system provided edit control class to generate context menu. */
+- if (m_hEditCtrl == NULL) {
+- DWORD dwStyle = WS_CHILD;
+- DWORD dwExStyle = 0;
+- m_hEditCtrl = ::CreateWindowEx(dwExStyle,
+- L"EDIT",
+- L"TEXT",
+- dwStyle,
+- 0, 0, 0, 0,
+- GetHWnd(),
+- reinterpret_cast<HMENU>(
+- static_cast<INT_PTR>(
+- CreateControlID())),
+- AwtToolkit::GetInstance().GetModuleHandle(),
+- NULL);
+- DASSERT(m_hEditCtrl != NULL);
+- if (sm_pDefWindowProc == NULL) {
+- sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
+- GWLP_WNDPROC);
+- }
+- ::SetLastError(0);
+- INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
+- (INT_PTR)AwtTextArea::EditProc);
+- DASSERT(ret != 0 || ::GetLastError() == 0);
+- }
+-
+- /*
+- * Tricks on the edit control to ensure that its context menu has
+- * the correct set of enabled items according to the RichEdit state.
+- */
+- ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
+-
+- if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
+- /* Enable 'Undo' item. */
+- ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
+- }
+-
+- {
+- /*
+- * Initial selection for the edit control - (0,1).
+- * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
+- */
+- INT nStart = 0;
+- INT nEnd = 1;
+- if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
+- /*
+- * RichEdit selection is empty - clear selection of the edit control.
+- * This disables 'Cut', 'Copy' and 'Delete'.
+- */
+- nStart = -1;
+- nEnd = 0;
+- } else {
+-
+- CHARRANGE cr;
+- EditGetSel(cr);
+- /* Check if all the text is selected. */
+- if (cr.cpMin == 0) {
+-
+- int len = ::GetWindowTextLength(GetHWnd());
+- if (cr.cpMin == 0 && cr.cpMax >= len) {
+- /*
+- * All the text is selected in RichEdit - select all the
+- * text in the edit control. This disables 'Select All'.
+- */
+- nStart = 0;
+- nEnd = -1;
+- }
+- }
+- }
+- ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
+- }
+-
+- /* Disable 'Paste' item if the RichEdit control is read-only. */
+- ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
+- GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
+-
+- POINT p;
+- p.x = xPos;
+- p.y = yPos;
+-
+- /*
+- * If the context menu is requested with SHIFT+F10 or VK_APPS key,
+- * we position its top left corner to the center of the RichEdit
+- * client rect.
+- */
+- if (p.x == -1 && p.y == -1) {
+- RECT r;
+- VERIFY(::GetClientRect(GetHWnd(), &r));
+- p.x = (r.left + r.right) / 2;
+- p.y = (r.top + r.bottom) / 2;
+- VERIFY(::ClientToScreen(GetHWnd(), &p));
+- }
+-
+- // The context menu steals focus from the proxy.
+- // So, set the focus-restore flag up.
+- SetRestoreFocus(TRUE);
+- ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
+- SetRestoreFocus(FALSE);
+-
+- return mrConsume;
+-}
+-
+ MsgRouting
+ AwtTextArea::WmNcHitTest(UINT x, UINT y, LRESULT& retVal)
+ {
+@@ -314,27 +149,8 @@
+
+
+ MsgRouting
+-AwtTextArea::WmNotify(UINT notifyCode)
+-{
+- if (notifyCode == EN_CHANGE) {
+- /*
+- * Ignore notifications if the text hasn't been changed.
+- * EN_CHANGE sent on character formatting changes as well.
+- */
+- if (m_bIgnoreEnChange == FALSE) {
+- m_bCanUndo = TRUE;
+- DoCallback("valueChanged", "()V");
+- } else {
+- m_bCanUndo = FALSE;
+- }
+- }
+- return mrDoDefault;
+-}
+-
+-MsgRouting
+ AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
+ {
+- MsgRouting returnVal;
+ /*
+ * RichEdit 1.0 control starts internal message loop if the
+ * left mouse button is pressed while the cursor is not over
+@@ -486,26 +302,6 @@
+ }
+ delete msg;
+ return mrConsume;
+- } else if (msg->message == WM_RBUTTONUP ||
+- (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
+- HIBYTE(::GetKeyState(VK_SHIFT)))) {
+- POINT p;
+- if (msg->message == WM_RBUTTONUP) {
+- VERIFY(::GetCursorPos(&p));
+- } else {
+- p.x = -1;
+- p.y = -1;
+- }
+-
+- if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
+- MAKELPARAM(p.x, p.y))) {
+- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+- JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
+- env->ExceptionDescribe();
+- env->ExceptionClear();
+- }
+- delete msg;
+- return mrConsume;
+ } else if (msg->message == WM_MOUSEWHEEL) {
+ // 4417236: If there is an old version of RichEd32.dll which
+ // does not provide the mouse wheel scrolling we have to
+@@ -596,15 +392,7 @@
+ // 4417236: end of fix
+ }
+
+- /*
+- * Store the 'synthetic' parameter so that the WM_PASTE security check
+- * happens only for synthetic events.
+- */
+- m_synthetic = synthetic;
+- returnVal = AwtComponent::HandleEvent(msg, synthetic);
+- m_synthetic = FALSE;
+-
+- return returnVal;
++ return AwtTextComponent::HandleEvent(msg, synthetic);
+ }
+
+
+--- ./jdk/src/windows/native/sun/windows/awt_TextArea.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_TextArea.h Fri Apr 10 09:21:28 2015 -0700
+@@ -57,17 +57,11 @@
+ static size_t GetALength(JNIEnv* env, jstring jStr, size_t maxlen);
+
+ LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+- static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
+- WPARAM wParam, LPARAM lParam);
+
+ MsgRouting WmEnable(BOOL fEnabled);
+- MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
+- MsgRouting WmNotify(UINT notifyCode);
+ MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT &retVal);
+ MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
+
+- INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
+-
+ virtual BOOL InheritsNativeMouseWheelBehavior();
+ virtual void Reshape(int x, int y, int w, int h);
+
+@@ -81,22 +75,7 @@
+ protected:
+
+ void EditSetSel(CHARRANGE &cr);
+- void EditGetSel(CHARRANGE &cr);
+ private:
+- // RichEdit 1.0 control generates EN_CHANGE notifications not only
+- // on text changes, but also on any character formatting change.
+- // This flag is true when the latter case is detected.
+- BOOL m_bIgnoreEnChange;
+-
+- // RichEdit 1.0 control undoes a character formatting change
+- // if it is the latest. We don't create our own undo buffer,
+- // but just prohibit undo in case if the latest operation
+- // is a formatting change.
+- BOOL m_bCanUndo;
+-
+- HWND m_hEditCtrl;
+- static WNDPROC sm_pDefWindowProc;
+-
+ LONG m_lHDeltaAccum;
+ LONG m_lVDeltaAccum;
+
+--- ./jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -66,6 +66,8 @@
+ m_lLastPos = -1;
+ m_isLFonly = FALSE;
+ m_EOLchecked = FALSE;
++ m_hEditCtrl = NULL;
++ m_bIgnoreEnChange = FALSE;
+ // javaEventsMask = 0; // accessibility support
+ }
+
+@@ -213,6 +215,16 @@
+ return c;
+ }
+
++void AwtTextComponent::Dispose()
++{
++ if (m_hEditCtrl != NULL) {
++ VERIFY(::DestroyWindow(m_hEditCtrl));
++ m_hEditCtrl = NULL;
++ }
++ AwtComponent::Dispose();
++}
++
++
+ LRESULT
+ AwtTextComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
+
+@@ -322,7 +334,16 @@
+ AwtTextComponent::WmNotify(UINT notifyCode)
+ {
+ if (notifyCode == EN_CHANGE) {
+- DoCallback("valueChanged", "()V");
++ /*
++ * Ignore notifications if the text hasn't been changed.
++ * EN_CHANGE sent on character formatting changes as well.
++ */
++ if (m_bIgnoreEnChange == FALSE) {
++ m_bCanUndo = TRUE;
++ DoCallback("valueChanged", "()V");
++ } else {
++ m_bCanUndo = FALSE;
++ }
+ }
+ return mrDoDefault;
+ }
+@@ -337,6 +358,28 @@
+ {
+ MsgRouting returnVal;
+
++ if (msg->message == WM_RBUTTONUP ||
++ (msg->message == WM_SYSKEYDOWN && msg->wParam == VK_F10 &&
++ HIBYTE(::GetKeyState(VK_SHIFT)))) {
++ POINT p;
++ if (msg->message == WM_RBUTTONUP) {
++ VERIFY(::GetCursorPos(&p));
++ } else {
++ p.x = -1;
++ p.y = -1;
++ }
++
++ if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
++ MAKELPARAM(p.x, p.y))) {
++ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
++ JNU_ThrowInternalError(env, "Message not posted, native event queue may be full.");
++ env->ExceptionDescribe();
++ env->ExceptionClear();
++ }
++ delete msg;
++ return mrConsume;
++ }
++
+ /*
+ * Store the 'synthetic' parameter so that the WM_PASTE security check
+ * happens only for synthetic events.
+@@ -701,6 +744,10 @@
+ SendMessage(EM_SETBKGNDCOLOR, (WPARAM)FALSE, (LPARAM)GetBackgroundColor());
+ }
+
++void AwtTextComponent::EditGetSel(CHARRANGE &cr) {
++ SendMessage(EM_EXGETSEL, 0, reinterpret_cast<LPARAM>(&cr));
++}
++
+
+ /************************************************************************
+ * WTextComponentPeer native methods
+@@ -982,6 +1029,161 @@
+ }
+
+
++/*
++ * This routine is a window procedure for the subclass of the standard edit control
++ * used to generate context menu. RichEdit controls don't have built-in context menu.
++ * To implement this functionality we have to create an invisible edit control and
++ * forward WM_CONTEXTMENU messages from a RichEdit control to this helper edit control.
++ * While the edit control context menu is active we intercept the message generated in
++ * response to particular item selection and forward it back to the RichEdit control.
++ * (See AwtTextArea::WmContextMenu for more details).
++ */
++
++WNDPROC AwtTextComponent::sm_pDefWindowProc = NULL;
++
++LRESULT
++AwtTextComponent::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
++
++ static BOOL bContextMenuActive = FALSE;
++
++ LRESULT retValue = 0;
++ MsgRouting mr = mrDoDefault;
++
++ DASSERT(::IsWindow(::GetParent(hWnd)));
++
++ switch (message) {
++ case WM_UNDO:
++ case WM_CUT:
++ case WM_COPY:
++ case WM_PASTE:
++ case WM_CLEAR:
++ case EM_SETSEL:
++ if (bContextMenuActive) {
++ ::SendMessage(::GetParent(hWnd), message, wParam, lParam);
++ mr = mrConsume;
++ }
++ break;
++ case WM_CONTEXTMENU:
++ bContextMenuActive = TRUE;
++ break;
++ }
++
++ if (mr == mrDoDefault) {
++ DASSERT(sm_pDefWindowProc != NULL);
++ retValue = ::CallWindowProc(sm_pDefWindowProc,
++ hWnd, message, wParam, lParam);
++ }
++
++ if (message == WM_CONTEXTMENU) {
++ bContextMenuActive = FALSE;
++ }
++
++ return retValue;
++}
++
++MsgRouting
++AwtTextComponent::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
++ /* Use the system provided edit control class to generate context menu. */
++ if (m_hEditCtrl == NULL) {
++ DWORD dwStyle = WS_CHILD;
++ DWORD dwExStyle = 0;
++ m_hEditCtrl = ::CreateWindowEx(dwExStyle,
++ L"EDIT",
++ L"TEXT",
++ dwStyle,
++ 0, 0, 0, 0,
++ GetHWnd(),
++ reinterpret_cast<HMENU>(
++ static_cast<INT_PTR>(
++ CreateControlID())),
++ AwtToolkit::GetInstance().GetModuleHandle(),
++ NULL);
++ DASSERT(m_hEditCtrl != NULL);
++ if (sm_pDefWindowProc == NULL) {
++ sm_pDefWindowProc = (WNDPROC)::GetWindowLongPtr(m_hEditCtrl,
++ GWLP_WNDPROC);
++ }
++ ::SetLastError(0);
++ INT_PTR ret = ::SetWindowLongPtr(m_hEditCtrl, GWLP_WNDPROC,
++ (INT_PTR)AwtTextArea::EditProc);
++ DASSERT(ret != 0 || ::GetLastError() == 0);
++ }
++
++ /*
++ * Tricks on the edit control to ensure that its context menu has
++ * the correct set of enabled items according to the RichEdit state.
++ */
++ ::SetWindowText(m_hEditCtrl, TEXT("TEXT"));
++
++ if (m_bCanUndo == TRUE && SendMessage(EM_CANUNDO)) {
++ /* Enable 'Undo' item. */
++ ::SendMessage(m_hEditCtrl, WM_CHAR, 'A', 0);
++ }
++
++ {
++ /*
++ * Initial selection for the edit control - (0,1).
++ * This enables 'Cut', 'Copy' and 'Delete' and 'Select All'.
++ */
++ INT nStart = 0;
++ INT nEnd = 1;
++ if (SendMessage(EM_SELECTIONTYPE) == SEL_EMPTY) {
++ /*
++ * RichEdit selection is empty - clear selection of the edit control.
++ * This disables 'Cut', 'Copy' and 'Delete'.
++ */
++ nStart = -1;
++ nEnd = 0;
++ } else {
++
++ CHARRANGE cr;
++ EditGetSel(cr);
++ /* Check if all the text is selected. */
++ if (cr.cpMin == 0) {
++
++ int len = ::GetWindowTextLength(GetHWnd());
++ if (cr.cpMin == 0 && cr.cpMax >= len) {
++ /*
++ * All the text is selected in RichEdit - select all the
++ * text in the edit control. This disables 'Select All'.
++ */
++ nStart = 0;
++ nEnd = -1;
++ }
++ }
++ }
++ ::SendMessage(m_hEditCtrl, EM_SETSEL, (WPARAM)nStart, (LPARAM)nEnd);
++ }
++
++ /* Disable 'Paste' item if the RichEdit control is read-only. */
++ ::SendMessage(m_hEditCtrl, EM_SETREADONLY,
++ GetStyle() & ES_READONLY ? TRUE : FALSE, 0);
++
++ POINT p;
++ p.x = xPos;
++ p.y = yPos;
++
++ /*
++ * If the context menu is requested with SHIFT+F10 or VK_APPS key,
++ * we position its top left corner to the center of the RichEdit
++ * client rect.
++ */
++ if (p.x == -1 && p.y == -1) {
++ RECT r;
++ VERIFY(::GetClientRect(GetHWnd(), &r));
++ p.x = (r.left + r.right) / 2;
++ p.y = (r.top + r.bottom) / 2;
++ VERIFY(::ClientToScreen(GetHWnd(), &p));
++ }
++
++ // The context menu steals focus from the proxy.
++ // So, set the focus-restore flag up.
++ SetRestoreFocus(TRUE);
++ ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
++ SetRestoreFocus(FALSE);
++
++ return mrConsume;
++}
+
+ //
+ // Accessibility support
+--- ./jdk/src/windows/native/sun/windows/awt_TextComponent.h Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_TextComponent.h Fri Apr 10 09:21:28 2015 -0700
+@@ -48,6 +48,8 @@
+
+ static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
+
++ virtual void Dispose();
++
+ virtual LPCTSTR GetClassName();
+ LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+@@ -84,6 +86,8 @@
+ MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
+ MsgRouting WmPaste();
+
++ INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
++
+ virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
+
+ /* To be fully implemented in a future release
+@@ -116,11 +120,24 @@
+ INLINE VOID SetEndSelectionPos(LONG lPos) { m_lEndPos = lPos; }
+ INLINE VOID SetLastSelectionPos(LONG lPos) { m_lLastPos = lPos; }
+
++ void EditGetSel(CHARRANGE &cr);
++
+ // Used to prevent untrusted code from synthesizing a WM_PASTE message
+ // by posting a <CTRL>-V KeyEvent
+ BOOL m_synthetic;
+ LONG EditGetCharFromPos(POINT& pt);
+
++ // RichEdit 1.0 control generates EN_CHANGE notifications not only
++ // on text changes, but also on any character formatting change.
++ // This flag is true when the latter case is detected.
++ BOOL m_bIgnoreEnChange;
++
++ // RichEdit 1.0 control undoes a character formatting change
++ // if it is the latest. We don't create our own undo buffer,
++ // but just prohibit undo in case if the latest operation
++ // is a formatting change.
++ BOOL m_bCanUndo;
++
+ /*****************************************************************
+ * Inner class OleCallback declaration.
+ */
+@@ -167,6 +184,13 @@
+
+ static OleCallback sm_oleCallback;
+
++ static WNDPROC sm_pDefWindowProc;
++ HWND m_hEditCtrl;
++
++ static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
++ WPARAM wParam, LPARAM lParam);
++ MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
++
+ //
+ // Accessibility support
+ //
+--- ./jdk/src/windows/native/sun/windows/awt_TextField.cpp Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/src/windows/native/sun/windows/awt_TextField.cpp Fri Apr 10 09:21:28 2015 -0700
+@@ -238,13 +238,8 @@
+ break;
+ }
+ }
+- /*
+- * Store the 'synthetic' parameter so that the WM_PASTE security check
+- * happens only for synthetic events.
+- */
+- m_synthetic = synthetic;
+- returnVal = AwtComponent::HandleEvent(msg, synthetic);
+- m_synthetic = FALSE;
++
++ returnVal = AwtTextComponent::HandleEvent(msg, synthetic);
+
+ if(systemBeeperEnabled){
+ SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
+--- ./jdk/test/Makefile Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/Makefile Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 1995, 2014, 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
+@@ -524,7 +524,7 @@
+
+ # Stable samevm testruns (minus items from PROBLEM_LIST)
+ JDK_ALL_TARGETS += jdk_net
+-jdk_net: $(call TestDirs, com/sun/net java/net sun/net com/oracle/net)
++jdk_net: $(call TestDirs, com/sun/net java/net jdk/net sun/net com/oracle/net)
+ $(call RunAgentvmBatch)
+
+ # Stable samevm testruns (minus items from PROBLEM_LIST)
+@@ -550,21 +550,41 @@
+ # Stable othervm testruns (minus items from PROBLEM_LIST)
+ # Using samevm has serious problems with these tests
+ JDK_ALL_TARGETS += jdk_security2
+-jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto)
++jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto javax/xml/crypto)
+ $(call RunAgentvmBatch)
+
+ # Stable othervm testruns (minus items from PROBLEM_LIST)
+ # Using samevm has serious problems with these tests
+ JDK_ALL_TARGETS += jdk_security3
+-jdk_security3: $(call TestDirs, com/sun/security lib/security \
+- javax/security sun/security \
++jdk_security3: $(call TestDirs, com/sun/security/auth \
++ com/sun/security/sasl lib/security javax/net \
++ javax/security/sasl javax/security/auth/login \
++ javax/security/auth/PrivateCredentialPermission \
++ javax/security/auth/Subject \
++ javax/security/auth/SubjectDomainCombiner \
++ javax/security/auth/x500 sun/security/acl \
++ sun/security/action sun/security/ec sun/security/mscapi \
++ sun/security/pkcs sun/security/pkcs11 sun/security/pkcs12 \
++ sun/security/provider sun/security/rsa sun/security/ssl \
++ sun/security/smartcardio sun/security/tools \
++ sun/security/util sun/security/validator sun/security/x509 \
+ com/sun/org/apache/xml/internal/security \
+ com/oracle/security)
+ $(call SharedLibraryPermissions,sun/security)
+ $(call RunAgentvmBatch)
+
++# Stable othervm testruns (minus items from PROBLEM_LIST)
++# Using samevm has serious problems with these tests
++JDK_ALL_TARGETS += jdk_security4
++jdk_security4: $(call TestDirs, com/sun/security/jgss \
++ javax/security/auth/kerberos \
++ sun/security/krb5 \
++ sun/security/jgss)
++ $(call SharedLibraryPermissions,sun/security)
++ $(call RunAgentvmBatch)
++
+ # All security tests
+-jdk_security: jdk_security1 jdk_security2 jdk_security3
++jdk_security: jdk_security1 jdk_security2 jdk_security3 jdk_security4
+ @$(SummaryInfo)
+
+ # Stable samevm testruns (minus items from PROBLEM_LIST)
+@@ -616,8 +636,8 @@
+
+ # ------------------------------------------------------------------
+
+-# Default JTREG to run (win32 script works for everybody)
+-JTREG = $(JT_HOME)/win32/bin/jtreg
++# Default JTREG to run
++JTREG = $(JT_HOME)/bin/jtreg
+ # Add any extra options (agentvm etc.)
+ JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+ # Only run automatic tests
+--- ./jdk/test/ProblemList.txt Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/ProblemList.txt Fri Apr 10 09:21:28 2015 -0700
+@@ -387,9 +387,6 @@
+ # Filed 6986875
+ sun/tools/jps/jps-Vvml.sh generic-all
+
+-# Filed 6979016
+-sun/tools/jconsole/ResourceCheckTest.sh generic-all
+-
+ # 7132203
+ sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
+
+--- ./jdk/test/com/sun/crypto/provider/Mac/MacClone.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/com/sun/crypto/provider/Mac/MacClone.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2012, 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
+@@ -23,7 +23,7 @@
+
+ /*
+ * @test
+- * @bug 0000000
++ * @bug 7087021
+ * @summary MacClone
+ * @author Jan Luehe
+ */
+@@ -56,7 +56,7 @@
+ KeyGenerator kgen = KeyGenerator.getInstance("DES");
+ SecretKey skey = kgen.generateKey();
+
+- mac = Mac.getInstance("HmacSHA1");
++ mac = Mac.getInstance("HmacSHA1", "SunJCE");
+ mac.init(skey);
+ macClone = (Mac)mac.clone();
+ System.out.println(macClone.getProvider().toString());
+--- ./jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -23,6 +23,7 @@
+
+ /**
+ * @test
++ * @run main/othervm LdapTimeoutTest
+ * @bug 7094377 8000487 6176036 7056489
+ * @summary Timeout tests for ldap
+ */
+@@ -33,141 +34,56 @@
+ import java.io.*;
+ import javax.naming.*;
+ import javax.naming.directory.*;
++import java.util.List;
+ import java.util.Hashtable;
++import java.util.ArrayList;
+ import java.util.concurrent.Callable;
++import java.util.concurrent.ExecutionException;
+ import java.util.concurrent.Executors;
++import java.util.concurrent.ExecutorService;
++import java.util.concurrent.Future;
+ import java.util.concurrent.ScheduledExecutorService;
+ import java.util.concurrent.ScheduledFuture;
++import java.util.concurrent.TimeoutException;
+ import java.util.concurrent.TimeUnit;
+
+-public class LdapTimeoutTest {
+- private static final ScheduledExecutorService pool =
+- Executors.newScheduledThreadPool(1);
+- static volatile int passed = 0, failed = 0;
+- static void pass() {passed++;}
+- static void fail() {failed++; Thread.dumpStack();}
++import static java.util.concurrent.TimeUnit.MILLISECONDS;
++import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+- public static void main(String[] args) throws Exception {
+- ServerSocket serverSock = new ServerSocket(0);
+- Server s = new Server(serverSock);
+- s.start();
+- Thread.sleep(200);
+
+- Hashtable env = new Hashtable(11);
+- env.put(Context.INITIAL_CONTEXT_FACTORY,
+- "com.sun.jndi.ldap.LdapCtxFactory");
+- env.put(Context.PROVIDER_URL, "ldap://localhost:" +
+- serverSock.getLocalPort());
++abstract class LdapTest implements Callable {
+
+- env.put(Context.SECURITY_AUTHENTICATION,"simple");
++ Hashtable env;
++ TestServer server;
++ ScheduledExecutorService killSwitchPool;
++ boolean passed = false;
++ private int HANGING_TEST_TIMEOUT = 20_000;
+
+- env.put(Context.SECURITY_PRINCIPAL, "user");
+- env.put(Context.SECURITY_CREDENTIALS, "password");
+-
+- InitialContext ctx = null;
+- try {
+- new LdapTimeoutTest().deadServerNoTimeout(env);
+-
+- env.put("com.sun.jndi.ldap.connect.timeout", "10");
+- env.put("com.sun.jndi.ldap.read.timeout", "3000");
+- new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
+- new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
+- new LdapTimeoutTest().simpleAuthConnectTest(env);
+- } finally {
+- s.interrupt();
+- LdapTimeoutTest.pool.shutdown();
+- }
+-
+- System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
+- if (failed > 0) throw new AssertionError("Some tests failed");
++ public LdapTest (TestServer server, Hashtable env) {
++ this.server = server;
++ this.env = env;
+ }
+
+- void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
+- InitialContext ctx = null;
+- if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
+- ScheduledFuture killer = killSwitch(5000);
+- long start = System.nanoTime();
+- try {
+- ctx = new InitialDirContext(env);
+- SearchControls scl = new SearchControls();
+- scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+- NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+- .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+- // shouldn't reach here
+- fail();
+- } catch (NamingException e) {
+- if (ssl) {
+- if (e.getCause() instanceof SocketTimeoutException) {
+- pass();
+- } else if (e.getCause() instanceof InterruptedIOException) {
+- Thread.interrupted();
+- fail();
+- }
+- } else {
+- pass();
+- }
+- } finally {
+- if (!shutItDown(killer, ctx)) fail();
+- }
++ public LdapTest(TestServer server, Hashtable env,
++ ScheduledExecutorService killSwitchPool)
++ {
++ this(server, env);
++ this.killSwitchPool = killSwitchPool;
+ }
+
+- void simpleAuthConnectTest(Hashtable env) {
+- InitialContext ctx = null;
+- ScheduledFuture killer = killSwitch(5000);
+- long start = System.nanoTime();
+- try {
+- ctx = new InitialDirContext(env);
+- // shouldn't reach here
+- System.err.println("Fail: InitialDirContext succeeded");
+- fail();
+- } catch (NamingException e) {
+- long end = System.nanoTime();
+- if (e.getCause() instanceof SocketTimeoutException) {
+- if (TimeUnit.NANOSECONDS.toMillis(end - start) < 2900) {
+- pass();
+- } else {
+- System.err.println("Fail: Waited too long");
+- fail();
+- }
+- } else if (e.getCause() instanceof InterruptedIOException) {
+- Thread.interrupted();
+- fail();
+- } else {
+- fail();
+- }
+- } finally {
+- if (!shutItDown(killer, ctx)) fail();
+- }
++ public abstract void performOp(InitialContext ctx) throws NamingException;
++ public abstract void handleNamingException(
++ NamingException e, long start, long end);
++
++ public void pass() {
++ this.passed = true;
+ }
+
+- void deadServerNoTimeout(Hashtable env) {
+- InitialContext ctx = null;
+- ScheduledFuture killer = killSwitch(30000);
+- long start = System.nanoTime();
+- try {
+- ctx = new InitialDirContext(env);
+- SearchControls scl = new SearchControls();
+- scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+- NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+- .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+- // shouldn't reach here
+- fail();
+- } catch (NamingException e) {
+- long end = System.nanoTime();
+- if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
+- System.err.println("fail: timeout should be at least 15 seconds, actual time: "
+- + TimeUnit.NANOSECONDS.toMillis(end - start));
+- fail();
+- } else {
+- pass();
+- }
+- } finally {
+- if (!shutItDown(killer, ctx)) fail();
+- }
++ public void fail() {
++ throw new RuntimeException("Test failed");
+ }
+
+- boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
+- killer.cancel(true);
++ boolean shutItDown(InitialContext ctx) {
+ try {
+ if (ctx != null) ctx.close();
+ return true;
+@@ -176,29 +92,376 @@
+ }
+ }
+
+- ScheduledFuture killSwitch(int ms) {
+- final Thread current = Thread.currentThread();
+- return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
+- public Void call() throws Exception {
+- System.err.println("Fail: killSwitch()");
+- System.exit(0);
+- return null;
++ public Boolean call() {
++ InitialContext ctx = null;
++ ScheduledFuture killer = null;
++ long start = System.nanoTime();
++
++ try {
++ while(!server.accepting())
++ Thread.sleep(200); // allow the server to start up
++ Thread.sleep(200); // to be sure
++
++ // if this is a hanging test, scheduled a thread to
++ // interrupt after a certain time
++ if (killSwitchPool != null) {
++ final Thread current = Thread.currentThread();
++ killer = killSwitchPool.schedule(
++ new Callable<Void>() {
++ public Void call() throws Exception {
++ current.interrupt();
++ return null;
++ }
++ }, HANGING_TEST_TIMEOUT, MILLISECONDS);
+ }
+- }, ms, TimeUnit.MILLISECONDS);
+- }
+
+- static class Server extends Thread {
+- final ServerSocket serverSock;
++ env.put(Context.PROVIDER_URL, "ldap://localhost:" +
++ server.getLocalPort());
+
+- Server(ServerSocket serverSock) {
+- this.serverSock = serverSock;
+- }
+-
+- public void run() {
+ try {
+- Socket socket = serverSock.accept();
+- } catch (IOException e) {}
++ ctx = new InitialDirContext(env);
++ performOp(ctx);
++ fail();
++ } catch (NamingException e) {
++ long end = System.nanoTime();
++ System.out.println(this.getClass().toString() + " - elapsed: "
++ + NANOSECONDS.toMillis(end - start));
++ handleNamingException(e, start, end);
++ } finally {
++ if (killer != null && !killer.isDone())
++ killer.cancel(true);
++ shutItDown(ctx);
++ server.close();
++ }
++ return passed;
++ } catch (IOException|InterruptedException e) {
++ throw new RuntimeException(e);
+ }
+ }
+ }
+
++abstract class ReadServerTest extends LdapTest {
++
++ public ReadServerTest(Hashtable env) throws IOException {
++ super(new BindableServer(), env);
++ }
++
++ public ReadServerTest(Hashtable env,
++ ScheduledExecutorService killSwitchPool)
++ throws IOException
++ {
++ super(new BindableServer(), env, killSwitchPool);
++ }
++
++ public void performOp(InitialContext ctx) throws NamingException {
++ SearchControls scl = new SearchControls();
++ scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
++ NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
++ .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
++ }
++}
++
++abstract class DeadServerTest extends LdapTest {
++
++ public DeadServerTest(Hashtable env) throws IOException {
++ super(new DeadServer(), env);
++ }
++
++ public DeadServerTest(Hashtable env,
++ ScheduledExecutorService killSwitchPool)
++ throws IOException
++ {
++ super(new DeadServer(), env, killSwitchPool);
++ }
++
++ public void performOp(InitialContext ctx) throws NamingException {}
++}
++
++class DeadServerNoTimeoutTest extends DeadServerTest {
++
++ public DeadServerNoTimeoutTest(Hashtable env,
++ ScheduledExecutorService killSwitchPool)
++ throws IOException
++ {
++ super(env, killSwitchPool);
++ }
++
++ public void handleNamingException(NamingException e, long start, long end) {
++ if (e instanceof InterruptedNamingException) Thread.interrupted();
++
++ if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
++ System.err.printf("DeadServerNoTimeoutTest fail: timeout should be " +
++ "at least %s ms, actual time is %s ms%n",
++ LdapTimeoutTest.MIN_TIMEOUT,
++ NANOSECONDS.toMillis(end - start));
++ fail();
++ } else {
++ pass();
++ }
++ }
++}
++
++class DeadServerTimeoutTest extends DeadServerTest {
++
++ public DeadServerTimeoutTest(Hashtable env) throws IOException {
++ super(env);
++ }
++
++ public void handleNamingException(NamingException e, long start, long end)
++ {
++ // non SSL connect will timeout via readReply using connectTimeout
++ if (NANOSECONDS.toMillis(end - start) < 2_900) {
++ pass();
++ } else {
++ System.err.println("Fail: Waited too long");
++ fail();
++ }
++ }
++}
++
++class DeadServerTimeoutSSLTest extends DeadServerTest {
++
++ public DeadServerTimeoutSSLTest(Hashtable env) throws IOException {
++ super(env);
++ }
++
++ public void handleNamingException(NamingException e, long start, long end) {
++ if (e.getCause() instanceof SocketTimeoutException) {
++ // SSL connect will timeout via readReply using
++ // SocketTimeoutException
++ pass();
++ } else {
++ fail();
++ }
++ }
++}
++
++
++class ReadServerNoTimeoutTest extends ReadServerTest {
++
++ public ReadServerNoTimeoutTest(Hashtable env,
++ ScheduledExecutorService killSwitchPool)
++ throws IOException
++ {
++ super(env, killSwitchPool);
++ }
++
++ public void handleNamingException(NamingException e, long start, long end) {
++ if (e instanceof InterruptedNamingException) Thread.interrupted();
++
++ if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
++ System.err.printf("ReadServerNoTimeoutTest fail: timeout should be " +
++ "at least %s ms, actual time is %s ms%n",
++ LdapTimeoutTest.MIN_TIMEOUT,
++ NANOSECONDS.toMillis(end - start));
++ fail();
++ } else {
++ pass();
++ }
++ }
++}
++
++class ReadServerTimeoutTest extends ReadServerTest {
++
++ public ReadServerTimeoutTest(Hashtable env) throws IOException {
++ super(env);
++ }
++
++ public void handleNamingException(NamingException e, long start, long end) {
++ if (NANOSECONDS.toMillis(end - start) < 2_900) {
++ fail();
++ } else {
++ pass();
++ }
++ }
++}
++
++class TestServer extends Thread {
++ ServerSocket serverSock;
++ boolean accepting = false;
++
++ public TestServer() throws IOException {
++ this.serverSock = new ServerSocket(0);
++ start();
++ }
++
++ public int getLocalPort() {
++ return serverSock.getLocalPort();
++ }
++
++ public boolean accepting() {
++ return accepting;
++ }
++
++ public void close() throws IOException {
++ serverSock.close();
++ }
++}
++
++class BindableServer extends TestServer {
++
++ public BindableServer() throws IOException {
++ super();
++ }
++
++ private byte[] bindResponse = {
++ 0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
++ 0x01, 0x00, 0x04, 0x00, 0x04, 0x00
++ };
++
++ public void run() {
++ try {
++ accepting = true;
++ Socket socket = serverSock.accept();
++ InputStream in = socket.getInputStream();
++ OutputStream out = socket.getOutputStream();
++
++ // Read the LDAP BindRequest
++ while (in.read() != -1) {
++ in.skip(in.available());
++ break;
++ }
++
++ // Write an LDAP BindResponse
++ out.write(bindResponse);
++ out.flush();
++ } catch (IOException e) {
++ // ignore
++ }
++ }
++}
++
++class DeadServer extends TestServer {
++
++ public DeadServer() throws IOException {
++ super();
++ }
++
++ public void run() {
++ while(true) {
++ try {
++ accepting = true;
++ Socket socket = serverSock.accept();
++ } catch (Exception e) {
++ break;
++ }
++ }
++ }
++}
++
++public class LdapTimeoutTest {
++
++ private static final ExecutorService testPool =
++ Executors.newFixedThreadPool(3);
++ private static final ScheduledExecutorService killSwitchPool =
++ Executors.newScheduledThreadPool(3);
++ public static int MIN_TIMEOUT = 18_000;
++
++ static Hashtable createEnv() {
++ Hashtable env = new Hashtable(11);
++ env.put(Context.INITIAL_CONTEXT_FACTORY,
++ "com.sun.jndi.ldap.LdapCtxFactory");
++ return env;
++ }
++
++ public static void main(String[] args) throws Exception {
++
++ InitialContext ctx = null;
++ List<Future> results = new ArrayList<>();
++
++ try {
++ // run the DeadServerTest with no timeouts set
++ // this should get stuck indefinitely, so we need to kill
++ // it after a timeout
++ System.out.println("Running connect timeout test with 20s kill switch");
++ Hashtable env = createEnv();
++ results.add(
++ testPool.submit(new DeadServerNoTimeoutTest(env, killSwitchPool)));
++
++ // run the ReadServerTest with connect timeout set
++ // this should get stuck indefinitely so we need to kill
++ // it after a timeout
++ System.out.println("Running read timeout test with 10ms connect timeout & 20s kill switch");
++ Hashtable env1 = createEnv();
++ env1.put("com.sun.jndi.ldap.connect.timeout", "10");
++ results.add(testPool.submit(
++ new ReadServerNoTimeoutTest(env1, killSwitchPool)));
++
++ // run the ReadServerTest with no timeouts set
++ // this should get stuck indefinitely, so we need to kill
++ // it after a timeout
++ System.out.println("Running read timeout test with 20s kill switch");
++ Hashtable env2 = createEnv();
++ results.add(testPool.submit(
++ new ReadServerNoTimeoutTest(env2, killSwitchPool)));
++
++ // run the DeadServerTest with connect / read timeouts set
++ // this should exit after the connect timeout expires
++ System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout");
++ Hashtable env3 = createEnv();
++ env3.put("com.sun.jndi.ldap.connect.timeout", "10");
++ env3.put("com.sun.jndi.ldap.read.timeout", "3000");
++ results.add(testPool.submit(new DeadServerTimeoutTest(env3)));
++
++
++ // run the ReadServerTest with connect / read timeouts set
++ // this should exit after the connect timeout expires
++ System.out.println("Running read timeout test with 10ms connect timeout, 3000ms read timeout");
++ Hashtable env4 = createEnv();
++ env4.put("com.sun.jndi.ldap.connect.timeout", "10");
++ env4.put("com.sun.jndi.ldap.read.timeout", "3000");
++ results.add(testPool.submit(new ReadServerTimeoutTest(env4)));
++
++ // run the DeadServerTest with connect timeout set
++ // this should exit after the connect timeout expires
++ System.out.println("Running connect timeout test with 10ms connect timeout");
++ Hashtable env5 = createEnv();
++ env5.put("com.sun.jndi.ldap.connect.timeout", "10");
++ results.add(testPool.submit(new DeadServerTimeoutTest(env5)));
++
++ // 8000487: Java JNDI connection library on ldap conn is
++ // not honoring configured timeout
++ System.out.println("Running simple auth connection test");
++ Hashtable env6 = createEnv();
++ env6.put("com.sun.jndi.ldap.connect.timeout", "10");
++ env6.put("com.sun.jndi.ldap.read.timeout", "3000");
++ env6.put(Context.SECURITY_AUTHENTICATION, "simple");
++ env6.put(Context.SECURITY_PRINCIPAL, "user");
++ env6.put(Context.SECURITY_CREDENTIALS, "password");
++ results.add(testPool.submit(new DeadServerTimeoutTest(env6)));
++
++ boolean testFailed = false;
++ for (Future test : results) {
++ while (!test.isDone()) {
++ if ((Boolean) test.get() == false)
++ testFailed = true;
++ }
++ }
++
++ //
++ // Running this test serially as it seems to tickle a problem
++ // on older kernels
++ //
++ // run the DeadServerTest with connect / read timeouts set
++ // and ssl enabled
++ // this should exit with a SocketTimeoutException as the root cause
++ // it should also use the connect timeout instead of the read timeout
++ System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL");
++ Hashtable sslenv = createEnv();
++ sslenv.put("com.sun.jndi.ldap.connect.timeout", "10");
++ sslenv.put("com.sun.jndi.ldap.read.timeout", "3000");
++ sslenv.put(Context.SECURITY_PROTOCOL, "ssl");
++ testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true;
++
++ if (testFailed) {
++ throw new AssertionError("some tests failed");
++ }
++
++ } finally {
++ LdapTimeoutTest.killSwitchPool.shutdown();
++ LdapTimeoutTest.testPool.shutdown();
++ }
++ }
++
++}
++
+--- ./jdk/test/com/sun/net/httpserver/bugs/B6373555.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/com/sun/net/httpserver/bugs/B6373555.java Fri Apr 10 09:21:28 2015 -0700
+@@ -43,14 +43,12 @@
+ private static int port;
+
+ private static volatile boolean error = false;
+- private static Object lock;
+ static HttpServer httpServer;
+ static ExecutorService pool, execs;
+ static int NUM = 1000;
+
+ public static void main(String[] args) throws Exception {
+ try {
+- lock = new Object();
+ if (args.length > 0) {
+ NUM = Integer.parseInt (args[0]);
+ }
+@@ -117,12 +115,6 @@
+ System.out.println("Doesn't match");
+ error = true;
+ }
+- synchronized(lock) {
+- ++received;
+- if ((received % 1000) == 0) {
+- System.out.println("Received="+received);
+- }
+- }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+@@ -150,18 +142,12 @@
+ private static HttpServer createHttpServer(ExecutorService execs)
+ throws Exception {
+ InetSocketAddress inetAddress = new InetSocketAddress(0);
+- HttpServer testServer = HttpServer.create(inetAddress, 5);
++ HttpServer testServer = HttpServer.create(inetAddress, 15);
+ testServer.setExecutor(execs);
+ HttpContext context = testServer.createContext("/test");
+ context.setHandler(new HttpHandler() {
+ public void handle(HttpExchange msg) {
+ try {
+- synchronized(lock) {
+- ++s_received;
+- if ((s_received % 1000) == 0) {
+- System.out.println("Received="+s_received);
+- }
+- }
+ String method = msg.getRequestMethod();
+ if (method.equals("POST")) {
+ InputStream is = msg.getRequestBody();
+@@ -172,12 +158,6 @@
+ System.out.println("****** METHOD not handled ***** "+method);
+ System.out.println("Received="+s_received);
+ }
+- synchronized(lock) {
+- ++sent;
+- if ((sent % 1000) == 0) {
+- System.out.println("sent="+sent);
+- }
+- }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+--- ./jdk/test/java/awt/Focus/SortingFPT/JDK8048887.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/awt/Focus/SortingFPT/JDK8048887.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2014, 2015, 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
+@@ -22,13 +22,12 @@
+ */
+
+ /*
+- @test
+- @bug 8048887
+- @summary Tests SortingFTP for an exception caused by the tim-sort algo.
+- @author anton.tarasov: area=awt.focus
+- @run main JDK8040632
+-*/
+-
++ @test
++ @bug 8048887
++ @summary Tests SortingFTP for an exception caused by the tim-sort algo.
++ @author anton.tarasov: area=awt.focus
++ @run main JDK8048887
++ */
+ import javax.swing.JFrame;
+ import javax.swing.JPanel;
+ import javax.swing.SwingUtilities;
+@@ -53,28 +52,31 @@
+ public void start() {
+ final CountDownLatch latch = new CountDownLatch(1);
+
+- SwingUtilities.invokeLater(() -> {
++ SwingUtilities.invokeLater(new Runnable() {
++ @Override
++ public void run() {
+ // Catch the original exception which sounds like:
+ // java.lang.IllegalArgumentException: Comparison method violates its general contract!
+ Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+- public void uncaughtException(Thread t, Throwable e) {
+- e.printStackTrace();
+- if (e instanceof IllegalArgumentException) {
+- passed = false;
+- latch.countDown();
+- }
++ public void uncaughtException(Thread t, Throwable e) {
++ e.printStackTrace();
++ if (e instanceof IllegalArgumentException) {
++ passed = false;
++ latch.countDown();
+ }
+- });
++ }
++ });
+
+ TestDialog d = new TestDialog();
+ // It's expected that the dialog is focused on start.
+ // The listener is called after the FTP completes processing and the bug is reproduced or not.
+ d.addWindowFocusListener(new WindowAdapter() {
+- public void windowGainedFocus(WindowEvent e) {
+- latch.countDown();
+- }
++ public void windowGainedFocus(WindowEvent e) {
++ latch.countDown();
++ }
+ });
+ d.setVisible(true);
++ }
+ });
+
+ try {
+@@ -83,10 +85,11 @@
+ e.printStackTrace();
+ }
+
+- if (passed)
++ if (passed) {
+ System.out.println("Test passed.");
+- else
++ } else {
+ throw new RuntimeException("Test failed!");
++ }
+ }
+ }
+
+@@ -94,20 +97,19 @@
+
+ // The layout of the components reproduces the transitivity issue
+ // with SortingFocusTraversalPolicy relying on the tim-sort algo.
+-
+- private static int[] Xs = new int[] {71, 23, 62, 4, 79, 39, 34, 9, 84, 58, 30, 34, 38, 15, 69, 10, 44, 95, 70, 54,
+- 44, 62, 77, 64, 70, 83, 31, 48, 96, 54, 40, 3, 60, 58, 3, 20, 94, 54, 26, 19, 48, 47, 12, 70, 86, 43, 71, 97, 19,
+- 69, 90, 22, 43, 76, 10, 60, 29, 49, 9, 9, 15, 73, 85, 80, 81, 35, 87, 43, 17, 57, 38, 44, 29, 86, 96, 15, 57, 26,
+- 27, 78, 26, 87, 43, 6, 4, 16, 57, 99, 32, 86, 96, 5, 50, 69, 12, 4, 36, 84, 71, 60, 22, 46, 11, 44, 87, 3, 23, 14,
+- 43, 25, 32, 44, 11, 18, 77, 2, 51, 87, 88, 53, 69, 37, 14, 10, 25, 73, 39, 33, 91, 51, 96, 9, 74, 66, 70, 42, 72,
+- 7, 82, 40, 91, 33, 83, 54, 33, 50, 83, 1, 81, 32, 66, 11, 75, 56, 53, 45, 1, 69, 46, 31, 79, 58, 12, 20, 92, 49,
+- 50, 90, 33, 8, 43, 93, 72, 78, 9, 56, 84, 60, 30, 39, 33, 88, 84, 56, 49, 47, 4, 90, 57, 6, 23, 96, 37, 88, 22, 79,
+- 35, 80, 45, 55};
++ private static int[] Xs = new int[]{71, 23, 62, 4, 79, 39, 34, 9, 84, 58, 30, 34, 38, 15, 69, 10, 44, 95, 70, 54,
++ 44, 62, 77, 64, 70, 83, 31, 48, 96, 54, 40, 3, 60, 58, 3, 20, 94, 54, 26, 19, 48, 47, 12, 70, 86, 43, 71, 97, 19,
++ 69, 90, 22, 43, 76, 10, 60, 29, 49, 9, 9, 15, 73, 85, 80, 81, 35, 87, 43, 17, 57, 38, 44, 29, 86, 96, 15, 57, 26,
++ 27, 78, 26, 87, 43, 6, 4, 16, 57, 99, 32, 86, 96, 5, 50, 69, 12, 4, 36, 84, 71, 60, 22, 46, 11, 44, 87, 3, 23, 14,
++ 43, 25, 32, 44, 11, 18, 77, 2, 51, 87, 88, 53, 69, 37, 14, 10, 25, 73, 39, 33, 91, 51, 96, 9, 74, 66, 70, 42, 72,
++ 7, 82, 40, 91, 33, 83, 54, 33, 50, 83, 1, 81, 32, 66, 11, 75, 56, 53, 45, 1, 69, 46, 31, 79, 58, 12, 20, 92, 49,
++ 50, 90, 33, 8, 43, 93, 72, 78, 9, 56, 84, 60, 30, 39, 33, 88, 84, 56, 49, 47, 4, 90, 57, 6, 23, 96, 37, 88, 22, 79,
++ 35, 80, 45, 55};
+
+ public TestDialog() {
+ JPanel panel = new JPanel(new GridBagLayout());
+ GridBagConstraints gbc = new GridBagConstraints();
+- for (int i=0; i < Xs.length; i++) {
++ for (int i = 0; i < Xs.length; i++) {
+ gbc.gridx = Xs[i];
+ gbc.gridy = 100 - gbc.gridx;
+ panel.add(new MyComponent(), gbc);
+@@ -117,7 +119,8 @@
+ }
+
+ public static class MyComponent extends JPanel {
+- private final static Dimension SIZE = new Dimension(1,1);
++
++ private final static Dimension SIZE = new Dimension(1, 1);
+
+ public MyComponent() {
+ setBackground(Color.BLACK);
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.html Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,21 @@
++<html>
++<!--
++ @test
++ @bug 4051487 4145670
++ @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
++ while it is being created does not crash the VM.
++ @author dpm area=Threads
++ @run applet/timeout=7200 DisposeStressTest.html
++ -->
++<head>
++<title>DisposeStressTest</title>
++</head>
++<body>
++
++<h1>DisposeStressTest<br>Bug ID: 4051487, 4145670</h1>
++
++<p> This is an AUTOMATIC test, simply wait for completion </p>
++
++<APPLET CODE="DisposeStressTest.class" WIDTH=200 HEIGHT=200></APPLET>
++</body>
++</html>
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Frame/DisposeStressTest/DisposeStressTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,247 @@
++/*
++ * Copyright (c) 2014, 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 4051487 4145670 8062021
++ @summary Tests that disposing of an empty Frame or a Frame with a MenuBar
++ while it is being created does not crash the VM.
++ @author dpm area=Threads
++ @run applet/timeout=7200 DisposeStressTest.html
++*/
++
++// Note there is no @ in front of test above. This is so that the
++// harness will not mistake this file as a test file. It should
++// only see the html file as a test file. (the harness runs all
++// valid test files, so it would run this test twice if this file
++// were valid as well as the html file.)
++// Also, note the area= after Your Name in the author tag. Here, you
++// should put which functional area the test falls in. See the
++// AWT-core home page -> test areas and/or -> AWT team for a list of
++// areas.
++// Note also the 'DisposeStressTest.html' in the run tag. This should
++// be changed to the name of the test.
++
++
++/**
++ * DisposeStressTest.java
++ *
++ * summary:
++ */
++
++import java.applet.Applet;
++import java.awt.*;
++
++
++//Automated tests should run as applet tests if possible because they
++// get their environments cleaned up, including AWT threads, any
++// test created threads, and any system resources used by the test
++// such as file descriptors. (This is normally not a problem as
++// main tests usually run in a separate VM, however on some platforms
++// such as the Mac, separate VMs are not possible and non-applet
++// tests will cause problems). Also, you don't have to worry about
++// synchronisation stuff in Applet tests they way you do in main
++// tests...
++
++
++public class DisposeStressTest extends Applet
++ {
++ //Declare things used in the test, like buttons and labels here
++
++ public void init()
++ {
++ //Create instructions for the user here, as well as set up
++ // the environment -- set the layout manager, add buttons,
++ // etc.
++
++ this.setLayout (new BorderLayout ());
++
++ String[] instructions =
++ {
++ "This is an AUTOMATIC test",
++ "simply wait until it is done"
++ };
++ Sysout.createDialog( );
++ Sysout.printInstructions( instructions );
++
++ }//End init()
++
++ public void start ()
++ {
++ for (int i = 0; i < 1000; i++) {
++ Frame f = new Frame();
++ f.setBounds(10, 10, 10, 10);
++ f.show();
++ f.dispose();
++
++ Frame f2 = new Frame();
++ f2.setBounds(10, 10, 100, 100);
++ MenuBar bar = new MenuBar();
++ Menu menu = new Menu();
++ menu.add(new MenuItem("foo"));
++ bar.add(menu);
++ f2.setMenuBar(bar);
++ f2.show();
++ f2.dispose();
++ }
++ }// start()
++
++ }// class DisposeStressTest
++
++
++/****************************************************
++ Standard Test Machinery
++ DO NOT modify anything below -- it's a standard
++ chunk of code whose purpose is to make user
++ interaction uniform, and thereby make it simpler
++ to read and understand someone else's test.
++ ****************************************************/
++
++/**
++ This is part of the standard test machinery.
++ It creates a dialog (with the instructions), and is the interface
++ for sending text messages to the user.
++ To print the instructions, send an array of strings to Sysout.createDialog
++ WithInstructions method. Put one line of instructions per array entry.
++ To display a message for the tester to see, simply call Sysout.println
++ with the string to be displayed.
++ This mimics System.out.println but works within the test harness as well
++ as standalone.
++ */
++
++class Sysout
++ {
++ private static TestDialog dialog;
++
++ public static void createDialogWithInstructions( String[] instructions )
++ {
++ dialog = new TestDialog( new Frame(), "Instructions" );
++ dialog.printInstructions( instructions );
++ dialog.show();
++ println( "Any messages for the tester will display here." );
++ }
++
++ public static void createDialog( )
++ {
++ dialog = new TestDialog( new Frame(), "Instructions" );
++ String[] defInstr = { "Instructions will appear here. ", "" } ;
++ dialog.printInstructions( defInstr );
++ dialog.show();
++ println( "Any messages for the tester will display here." );
++ }
++
++
++ public static void printInstructions( String[] instructions )
++ {
++ dialog.printInstructions( instructions );
++ }
++
++
++ public static void println( String messageIn )
++ {
++ dialog.displayMessage( messageIn );
++ }
++
++ }// Sysout class
++
++/**
++ This is part of the standard test machinery. It provides a place for the
++ test instructions to be displayed, and a place for interactive messages
++ to the user to be displayed.
++ To have the test instructions displayed, see Sysout.
++ To have a message to the user be displayed, see Sysout.
++ Do not call anything in this dialog directly.
++ */
++class TestDialog extends Dialog
++ {
++
++ TextArea instructionsText;
++ TextArea messageText;
++ int maxStringLength = 80;
++
++ //DO NOT call this directly, go through Sysout
++ public TestDialog( Frame frame, String name )
++ {
++ super( frame, name );
++ int scrollBoth = TextArea.SCROLLBARS_BOTH;
++ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
++ add( "North", instructionsText );
++
++ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
++ add("South", messageText);
++
++ pack();
++
++ show();
++ }// TestDialog()
++
++ //DO NOT call this directly, go through Sysout
++ public void printInstructions( String[] instructions )
++ {
++ //Clear out any current instructions
++ instructionsText.setText( "" );
++
++ //Go down array of instruction strings
++
++ String printStr, remainingStr;
++ for( int i=0; i < instructions.length; i++ )
++ {
++ //chop up each into pieces maxSringLength long
++ remainingStr = instructions[ i ];
++ while( remainingStr.length() > 0 )
++ {
++ //if longer than max then chop off first max chars to print
++ if( remainingStr.length() >= maxStringLength )
++ {
++ //Try to chop on a word boundary
++ int posOfSpace = remainingStr.
++ lastIndexOf( ' ', maxStringLength - 1 );
++
++ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
++
++ printStr = remainingStr.substring( 0, posOfSpace + 1 );
++ remainingStr = remainingStr.substring( posOfSpace + 1 );
++ }
++ //else just print
++ else
++ {
++ printStr = remainingStr;
++ remainingStr = "";
++ }
++
++ instructionsText.append( printStr + "\n" );
++
++ }// while
++
++ }// for
++
++ }//printInstructions()
++
++ //DO NOT call this directly, go through Sysout
++ public void displayMessage( String messageIn )
++ {
++ messageText.append( messageIn + "\n" );
++ }
++
++ }// TestDialog class
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,162 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++
++import java.awt.Color;
++import java.awt.Font;
++import java.awt.Graphics2D;
++import java.awt.RenderingHints;
++import java.awt.geom.AffineTransform;
++import java.awt.image.BufferedImage;
++import java.io.File;
++import java.io.IOException;
++
++import javax.imageio.ImageIO;
++
++import static java.awt.image.BufferedImage.TYPE_INT_RGB;
++import static java.lang.Math.toRadians;
++
++/**
++ * @test
++ * @bug 8065373
++ * @summary Verifies that we get correct direction, when draw rotated string.
++ * @author Sergey Bylokhov
++ * @run main DrawRotatedStringUsingRotatedFont
++ */
++public final class DrawRotatedStringUsingRotatedFont {
++
++ private static final int SIZE = 500;
++ private static final String STR = "MMMMMMMMMMMMMMMM";
++
++ private static AffineTransform[] txs = {
++ AffineTransform.getRotateInstance(toRadians(00)),
++ AffineTransform.getRotateInstance(toRadians(45)),
++ AffineTransform.getRotateInstance(toRadians(-45)),
++ AffineTransform.getRotateInstance(toRadians(90)),
++ AffineTransform.getRotateInstance(toRadians(-90)),
++ AffineTransform.getRotateInstance(toRadians(135)),
++ AffineTransform.getRotateInstance(toRadians(-135)),
++ AffineTransform.getRotateInstance(toRadians(180)),
++ AffineTransform.getRotateInstance(toRadians(-180)),
++ AffineTransform.getRotateInstance(toRadians(225)),
++ AffineTransform.getRotateInstance(toRadians(-225)),
++ AffineTransform.getRotateInstance(toRadians(270)),
++ AffineTransform.getRotateInstance(toRadians(-270)),
++ AffineTransform.getRotateInstance(toRadians(315)),
++ AffineTransform.getRotateInstance(toRadians(-315)),
++ AffineTransform.getRotateInstance(toRadians(360)),
++ AffineTransform.getRotateInstance(toRadians(-360))
++ };
++
++ public static void main(final String[] args) throws IOException {
++ for (final AffineTransform tx2 : txs) {
++ for (final AffineTransform tx1 : txs) {
++ for (final boolean aa : new boolean[]{true, false}) {
++ final BufferedImage bi1 = createImage(aa, tx1, tx2);
++ final BufferedImage bi2 = createImage(aa, tx2, tx1);
++ compareImage(bi1, bi2);
++ fillTextArea(bi1, tx1, tx2);
++ fillTextArea(bi2, tx2, tx1);
++ checkColors(bi1, bi2);
++ }
++ }
++ }
++ System.out.println("Passed");
++ }
++
++ /**
++ * Compares two images.
++ */
++ private static void compareImage(final BufferedImage bi1,
++ final BufferedImage bi2)
++ throws IOException {
++ for (int i = 0; i < SIZE; ++i) {
++ for (int j = 0; j < SIZE; ++j) {
++ if (bi1.getRGB(i, j) != bi2.getRGB(i, j)) {
++ ImageIO.write(bi1, "png", new File("image1.png"));
++ ImageIO.write(bi2, "png", new File("image2.png"));
++ throw new RuntimeException("Failed: wrong text location");
++ }
++ }
++ }
++ }
++
++ /**
++ * Checks an image color. RED and GREEN are allowed only.
++ */
++ private static void checkColors(final BufferedImage bi1,
++ final BufferedImage bi2)
++ throws IOException {
++ for (int i = 0; i < SIZE; ++i) {
++ for (int j = 0; j < SIZE; ++j) {
++ final int rgb1 = bi1.getRGB(i, j);
++ final int rgb2 = bi2.getRGB(i, j);
++ if (rgb1 != rgb2 || rgb1 != 0xFFFF0000 && rgb1 != 0xFF00FF00) {
++ ImageIO.write(bi1, "png", new File("image1.png"));
++ ImageIO.write(bi2, "png", new File("image2.png"));
++ throw new RuntimeException("Failed: wrong text location");
++ }
++ }
++ }
++ }
++
++ /**
++ * Creates an BufferedImage and draws a text, using two transformations,
++ * one for graphics and one for font.
++ */
++ private static BufferedImage createImage(final boolean aa,
++ final AffineTransform gtx,
++ final AffineTransform ftx) {
++ final BufferedImage bi = new BufferedImage(SIZE, SIZE, TYPE_INT_RGB);
++ final Graphics2D bg = bi.createGraphics();
++ bg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
++ aa ? RenderingHints.VALUE_ANTIALIAS_ON
++ : RenderingHints.VALUE_ANTIALIAS_OFF);
++ bg.setColor(Color.RED);
++ bg.fillRect(0, 0, SIZE, SIZE);
++ bg.translate(100, 100);
++ bg.transform(gtx);
++ bg.setColor(Color.BLACK);
++ bg.setFont(bg.getFont().deriveFont(20.0f).deriveFont(ftx));
++ bg.drawString(STR, 0, 0);
++ bg.dispose();
++ return bi;
++ }
++
++ /**
++ * Fills the area of text using green solid color.
++ */
++ private static void fillTextArea(final BufferedImage bi,
++ final AffineTransform tx1,
++ final AffineTransform tx2) {
++ final Graphics2D bg = bi.createGraphics();
++ bg.translate(100, 100);
++ bg.transform(tx1);
++ bg.transform(tx2);
++ bg.setColor(Color.GREEN);
++ final Font font = bg.getFont().deriveFont(20.0f);
++ bg.setFont(font);
++ bg.fill(font.getStringBounds(STR, bg.getFontRenderContext()));
++ bg.dispose();
++ }
++}
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/MouseInfo/JContainerMousePositionTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,162 @@
++/*
++ * Copyright (c) 2013, 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
++ @summary unit test for a new method in Container class: getMousePosition(boolean)
++ @author dav@sparc.spb.su: area=
++ @bug 4009555
++ @run main JContainerMousePositionTest
++*/
++
++import javax.swing.*;
++import java.awt.*;
++import java.util.concurrent.atomic.AtomicReference;
++
++// this test looks at mouse pointer when it
++// 1 over component
++// 2 over Container, but not over one of its child Components.
++// out of bounds of Container
++// two values of paramater allowChildren are considered.
++
++public class JContainerMousePositionTest {
++ //Declare things used in the test, like buttons and labels here
++ private static JButton jButton1;
++ private static JButton jButton4;
++ private static JFrame frame1;
++ private static Container contentPane;
++
++ public static void main(final String[] args) throws Exception {
++ Robot robot = new Robot();
++ robot.setAutoDelay(200);
++ robot.setAutoWaitForIdle(true);
++
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ JContainerMousePositionTest.init();
++ }
++ });
++
++ robot.delay(500);
++ robot.waitForIdle();
++
++ final AtomicReference<Point> centerC4 = new AtomicReference<>();
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ centerC4.set(jButton4.getLocation());
++ contentPane.remove(jButton4);
++ contentPane.validate();
++ contentPane.repaint();
++ }
++ });
++ robot.waitForIdle();
++
++ final AtomicReference<Rectangle> frameBounds = new AtomicReference<>();
++ final AtomicReference<Dimension> button1Size = new AtomicReference<>();
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ frameBounds.set(frame1.getBounds());
++ button1Size.set(jButton1.getSize());
++ }
++ });
++
++//point mouse to center of top-left Component (button1)
++ robot.mouseMove(frameBounds.get().x + button1Size.get().width / 2,
++ frameBounds.get().y + button1Size.get().height / 2);
++
++ final AtomicReference<Point> pFalse = new AtomicReference<>();
++ final AtomicReference<Point> pTrue = new AtomicReference<>();
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ pFalse.set(frame1.getMousePosition(false));
++ pTrue.set(frame1.getMousePosition(true));
++ }
++ });
++ robot.waitForIdle();
++ if (pFalse.get() != null) {
++ throw new RuntimeException("Test failed: Container.getMousePosition(false) returned non-null over one of children.");
++ }
++ System.out.println("Test stage completed: Container.getMousePosition(false) returned null result over child Component. Passed.");
++
++ if (pTrue.get() == null) {
++ throw new RuntimeException("Test failed: Container.getMousePosition(true) returned null result over child Component");
++ }
++ System.out.println("Test stage compelted: Container.getMousePosition(true) returned non-null result over child Component. Passed.");
++
++//point mouse out from Container's area
++ robot.mouseMove(frameBounds.get().x + frameBounds.get().width + 10,
++ frameBounds.get().y + frameBounds.get().height + 10);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ pFalse.set(frame1.getMousePosition(false));
++ pTrue.set(frame1.getMousePosition(true));
++ }
++ });
++ robot.waitForIdle();
++ if (pFalse.get() != null || pTrue.get() != null) {
++ throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned incorrect result outside Container");
++ }
++ System.out.println("Test stage completed: Container.getMousePosition(boolean) returned null result outside Container. Passed.");
++
++//point mouse in place free from child components (right-botton component)
++ robot.mouseMove(frameBounds.get().x + centerC4.get().x,
++ frameBounds.get().y + centerC4.get().y);
++
++ robot.delay(3000);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ pFalse.set(contentPane.getMousePosition(false));
++ pTrue.set(frame1.getMousePosition(true));
++ }
++ });
++ robot.waitForIdle();
++
++ if (pFalse.get() == null || pTrue.get() == null) {
++ throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned null result inside Container.");
++ }
++ System.out.println("Test stage completed: Container.getMousePosition(boolean) returned non-null results inside Container. Passed.");
++
++ if (pTrue.get().x != centerC4.get().x || pTrue.get().y != centerC4.get().y) {
++ throw new RuntimeException("Test failed: Container.getMousePosition(true) returned incorrect result inside Container.");
++ }
++ System.out.println("Test stage completed: Container.getMousePosition(true) returned correct result inside Container. Passed.");
++
++ System.out.println("TEST PASSED");
++ }
++
++ private static void init() {
++ frame1 = new JFrame("Testing getMousePosition() on LWs");
++ jButton1 = new JButton("C1");
++ jButton4 = new JButton("C4");
++ contentPane = frame1.getContentPane();
++ contentPane.setLayout(new GridLayout(2, 2, 25, 25));
++ contentPane.add(jButton1);
++ contentPane.add(new JButton("C2"));
++ contentPane.add(new JButton("C3"));
++ contentPane.add(jButton4);
++ frame1.setSize(200, 200);
++ frame1.setVisible(true);
++ }
++}
++
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Paint/ButtonRepaint.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,88 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++
++import java.awt.*;
++import java.awt.peer.ButtonPeer;
++
++/**
++ * @test
++ * @bug 7090424
++ * @author Sergey Bylokhov
++ */
++public final class ButtonRepaint extends Button {
++
++ public static void main(final String[] args) {
++ for (int i = 0; i < 10; ++i) {
++ final Frame frame = new Frame();
++ frame.setSize(300, 300);
++ frame.setLocationRelativeTo(null);
++ ButtonRepaint button = new ButtonRepaint();
++ frame.add(button);
++ frame.setVisible(true);
++ sleep();
++ button.test();
++ frame.dispose();
++ }
++ }
++
++ private static void sleep() {
++ try {
++ Thread.sleep(2000);
++ } catch (InterruptedException ignored) {
++ }
++ }
++
++ @Override
++ public void paint(final Graphics g) {
++ super.paint(g);
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ test();
++ }
++
++ void test() {
++ setLabel("");
++ setLabel(null);
++ setLabel(getLabel());
++ ((ButtonPeer) getPeer()).setLabel("");
++ ((ButtonPeer) getPeer()).setLabel(null);
++ ((ButtonPeer) getPeer()).setLabel(getLabel());
++
++ setFont(null);
++ setFont(getFont());
++ getPeer().setFont(getFont());
++
++ setBackground(null);
++ setBackground(getBackground());
++ getPeer().setBackground(getBackground());
++
++ setForeground(null);
++ setForeground(getForeground());
++ getPeer().setForeground(getForeground());
++
++ setEnabled(isEnabled());
++ getPeer().setEnabled(isEnabled());
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Paint/CheckboxRepaint.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.awt.*;
++import java.awt.peer.CheckboxPeer;
++
++/**
++ * @test
++ * @bug 7090424
++ * @author Sergey Bylokhov
++ */
++public final class CheckboxRepaint extends Checkbox {
++
++ public static void main(final String[] args) {
++ for (int i = 0; i < 10; ++i) {
++ final Frame frame = new Frame();
++ frame.setSize(300, 300);
++ frame.setLocationRelativeTo(null);
++ CheckboxRepaint checkbox = new CheckboxRepaint();
++ frame.add(checkbox);
++ frame.setVisible(true);
++ sleep();
++ checkbox.test();
++ frame.dispose();
++ }
++ }
++
++ private static void sleep() {
++ try {
++ Thread.sleep(2000);
++ } catch (InterruptedException ignored) {
++ }
++ }
++
++ @Override
++ public void paint(final Graphics g) {
++ super.paint(g);
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ test();
++ }
++
++ void test() {
++ setState(getState());
++ ((CheckboxPeer) getPeer()).setState(getState());
++
++ setCheckboxGroup(getCheckboxGroup());
++ ((CheckboxPeer) getPeer()).setCheckboxGroup(getCheckboxGroup());
++
++ setLabel("");
++ setLabel(null);
++ setLabel(getLabel());
++ ((CheckboxPeer) getPeer()).setLabel("");
++ ((CheckboxPeer) getPeer()).setLabel(null);
++ ((CheckboxPeer) getPeer()).setLabel(getLabel());
++
++ setFont(null);
++ setFont(getFont());
++ getPeer().setFont(getFont());
++
++ setBackground(null);
++ setBackground(getBackground());
++ getPeer().setBackground(getBackground());
++
++ setForeground(null);
++ setForeground(getForeground());
++ getPeer().setForeground(getForeground());
++
++ setEnabled(isEnabled());
++ getPeer().setEnabled(isEnabled());
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Paint/ExposeOnEDT.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,293 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++
++import sun.awt.SunToolkit;
++
++import java.awt.*;
++
++/**
++ * @test
++ * @bug 7090424
++ * @author Sergey Bylokhov
++ * @run main ExposeOnEDT
++ */
++public final class ExposeOnEDT {
++
++ private static final Button buttonStub = new Button() {
++ @Override
++ public void paint(final Graphics g) {
++ buttonPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Canvas canvasStub = new Canvas() {
++ @Override
++ public void paint(final Graphics g) {
++ canvasPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Checkbox checkboxStub = new Checkbox() {
++ @Override
++ public void paint(final Graphics g) {
++ checkboxPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Choice choiceStub = new Choice() {
++ @Override
++ public void paint(final Graphics g) {
++ choicePainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Component lwComponentStub = new Component() {
++ @Override
++ public void paint(final Graphics g) {
++ lwPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Container containerStub = new Container() {
++ @Override
++ public void paint(final Graphics g) {
++ containerPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Frame frame = new Frame() {
++ @Override
++ public void paint(final Graphics g) {
++ super.paint(g);
++ framePainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Label labelStub = new Label() {
++ @Override
++ public void paint(final Graphics g) {
++ labelPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final List listStub = new List() {
++ @Override
++ public void paint(final Graphics g) {
++ listPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Panel panelStub = new Panel() {
++ @Override
++ public void paint(final Graphics g) {
++ panelPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final Scrollbar scrollbarStub = new Scrollbar() {
++ @Override
++ public void paint(final Graphics g) {
++ scrollbarPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final ScrollPane scrollPaneStub = new ScrollPane() {
++ @Override
++ public void paint(final Graphics g) {
++ scrollPanePainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final TextArea textAreaStub = new TextArea() {
++ @Override
++ public void paint(final Graphics g) {
++ textAreaPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static final TextField textFieldStub = new TextField() {
++ @Override
++ public void paint(final Graphics g) {
++ textFieldPainted = true;
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ }
++ };
++ private static volatile boolean lwPainted;
++ private static volatile boolean buttonPainted;
++ private static volatile boolean canvasPainted;
++ private static volatile boolean checkboxPainted;
++ private static volatile boolean choicePainted;
++ private static volatile boolean containerPainted;
++ private static volatile boolean framePainted;
++ private static volatile boolean labelPainted;
++ private static volatile boolean listPainted;
++ private static volatile boolean panelPainted;
++ private static volatile boolean scrollbarPainted;
++ private static volatile boolean scrollPanePainted;
++ private static volatile boolean textAreaPainted;
++ private static volatile boolean textFieldPainted;
++
++ public static void main(final String[] args) throws Exception {
++ //Frame initialisation
++ frame.setLayout(new GridLayout());
++ frame.setSize(new Dimension(200, 200));
++ frame.setLocationRelativeTo(null);
++ frame.setVisible(true);
++ sleep();
++
++ frame.add(buttonStub);
++ frame.add(canvasStub);
++ frame.add(checkboxStub);
++ frame.add(choiceStub);
++ frame.add(lwComponentStub);
++ frame.add(containerStub);
++ frame.add(labelStub);
++ frame.add(listStub);
++ frame.add(panelStub);
++ frame.add(scrollbarStub);
++ frame.add(scrollPaneStub);
++ frame.add(textAreaStub);
++ frame.add(textFieldStub);
++ frame.validate();
++ sleep();
++
++ // Force expose event from the native system.
++ initPaintedFlags();
++ frame.setSize(300, 300);
++ frame.validate();
++ sleep();
++
++ //Check results.
++ validation();
++
++ cleanup();
++ }
++
++ private static void initPaintedFlags() {
++ lwPainted = false;
++ buttonPainted = false;
++ canvasPainted = false;
++ checkboxPainted = false;
++ choicePainted = false;
++ containerPainted = false;
++ framePainted = false;
++ labelPainted = false;
++ listPainted = false;
++ panelPainted = false;
++ scrollbarPainted = false;
++ scrollPanePainted = false;
++ textAreaPainted = false;
++ textFieldPainted = false;
++ }
++
++ private static void validation() {
++ if (!buttonPainted) {
++ fail("Paint is not called a Button ");
++ }
++ if (!canvasPainted) {
++ fail("Paint is not called a Canvas ");
++ }
++ if (!checkboxPainted) {
++ fail("Paint is not called a Checkbox ");
++ }
++ if (!choicePainted) {
++ fail("Paint is not called a Choice ");
++ }
++ if (!lwPainted) {
++ fail("Paint is not called on a lightweight");
++ }
++ if (!containerPainted) {
++ fail("Paint is not called on a Container");
++ }
++ if (!labelPainted) {
++ fail("Paint is not called on a Label");
++ }
++ if (!listPainted) {
++ fail("Paint is not called on a List");
++ }
++ if (!panelPainted) {
++ fail("Paint is not called on a Panel");
++ }
++ if (!scrollbarPainted) {
++ fail("Paint is not called on a Scrollbar");
++ }
++ if (!scrollPanePainted) {
++ fail("Paint is not called on a ScrollPane");
++ }
++ if (!textAreaPainted) {
++ fail("Paint is not called on a TextArea");
++ }
++ if (!textFieldPainted) {
++ fail("Paint is not called on a TextField");
++ }
++ if (!framePainted) {
++ fail("Paint is not called on a Frame when paintAll()");
++ }
++ }
++
++ private static void sleep() {
++ ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
++ try {
++ Thread.sleep(1000L);
++ } catch (InterruptedException ignored) {
++ }
++ }
++
++ private static void fail(final String message) {
++ cleanup();
++ throw new RuntimeException(message);
++ }
++
++ private static void cleanup() {
++ frame.dispose();
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Paint/LabelRepaint.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.awt.EventQueue;
++import java.awt.Frame;
++import java.awt.Graphics;
++import java.awt.Label;
++import java.awt.peer.LabelPeer;
++
++/**
++ * @test
++ * @bug 7090424
++ * @author Sergey Bylokhov
++ */
++public final class LabelRepaint extends Label {
++
++ public static void main(final String[] args) {
++ for (int i = 0; i < 10; ++i) {
++ final Frame frame = new Frame();
++ frame.setSize(300, 300);
++ frame.setLocationRelativeTo(null);
++ LabelRepaint label = new LabelRepaint();
++ frame.add(label);
++ frame.setVisible(true);
++ sleep();
++ label.test();
++ frame.dispose();
++ }
++ }
++
++ private static void sleep() {
++ try {
++ Thread.sleep(2000);
++ } catch (InterruptedException ignored) {
++ }
++ }
++
++ @Override
++ public void paint(final Graphics g) {
++ super.paint(g);
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ test();
++ }
++
++ void test() {
++ setAlignment(getAlignment());
++ ((LabelPeer) getPeer()).setAlignment(getAlignment());
++
++ setText("");
++ setText(null);
++ setText(getText());
++ ((LabelPeer) getPeer()).setText("");
++ ((LabelPeer) getPeer()).setText(null);
++ ((LabelPeer) getPeer()).setText(getText());
++
++ setFont(null);
++ setFont(getFont());
++ getPeer().setFont(getFont());
++
++ setBackground(null);
++ setBackground(getBackground());
++ getPeer().setBackground(getBackground());
++
++ setForeground(null);
++ setForeground(getForeground());
++ getPeer().setForeground(getForeground());
++
++ setEnabled(isEnabled());
++ getPeer().setEnabled(isEnabled());
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/Paint/ListRepaint.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,91 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.awt.EventQueue;
++import java.awt.Frame;
++import java.awt.Graphics;
++import java.awt.List;
++import java.awt.peer.ListPeer;
++
++/**
++ * @test
++ * @bug 7090424
++ * @author Sergey Bylokhov
++ */
++public final class ListRepaint extends List {
++
++ public static void main(final String[] args) {
++ for (int i = 0; i < 10; ++i) {
++ final Frame frame = new Frame();
++ frame.setSize(300, 300);
++ frame.setLocationRelativeTo(null);
++ ListRepaint list = new ListRepaint();
++ list.add("1");
++ list.add("2");
++ list.add("3");
++ list.add("4");
++ list.select(0);
++ frame.add(list);
++ frame.setVisible(true);
++ sleep();
++ list.test();
++ frame.dispose();
++ }
++ }
++
++ private static void sleep() {
++ try {
++ Thread.sleep(2000);
++ } catch (InterruptedException ignored) {
++ }
++ }
++
++ @Override
++ public void paint(final Graphics g) {
++ super.paint(g);
++ if (!EventQueue.isDispatchThread()) {
++ throw new RuntimeException("Wrong thread");
++ }
++ test();
++ }
++
++ void test() {
++ select(0);
++ ((ListPeer) getPeer()).select(getSelectedIndex());
++
++ setFont(null);
++ setFont(getFont());
++ getPeer().setFont(getFont());
++
++ setBackground(null);
++ setBackground(getBackground());
++ getPeer().setBackground(getBackground());
++
++ setForeground(null);
++ setForeground(getForeground());
++ getPeer().setForeground(getForeground());
++
++ setEnabled(isEnabled());
++ getPeer().setEnabled(isEnabled());
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/event/KeyEvent/DeadKey/DeadKeySystemAssertionDialog.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,65 @@
++/*
++ * Copyright (c) 2012, 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.
++ */
++
++import java.awt.Frame;
++import java.awt.Robot;
++import java.awt.TextField;
++import java.awt.Toolkit;
++import java.awt.event.KeyEvent;
++import sun.awt.SunToolkit;
++/*
++ * @test
++ * @bug 8013849
++ * @summary Awt assert on Hashtable.cpp:124
++ * @author alexandr.scherbatiy area=awt.event
++ * @run main/timeout=5 DeadKeySystemAssertionDialog
++ */
++
++public class DeadKeySystemAssertionDialog {
++
++ public static void main(String[] args) throws Exception {
++
++ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
++ Frame frame = new Frame();
++ frame.setSize(300, 200);
++
++ TextField textField = new TextField();
++ frame.add(textField);
++
++ frame.setVisible(true);
++ toolkit.realSync();
++
++ textField.requestFocus();
++ toolkit.realSync();
++
++ // Check that the system assertion dialog does not block Java
++ Robot robot = new Robot();
++ robot.setAutoDelay(50);
++ robot.keyPress(KeyEvent.VK_A);
++ robot.keyRelease(KeyEvent.VK_A);
++ toolkit.realSync();
++
++ frame.setVisible(false);
++ frame.dispose();
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/awt/print/PrinterJob/PrintToDir.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,144 @@
++/*
++ * Copyright (c) 2013, 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 4973278 8015586
++ @run main PrintToDir
++ @summary Must throw exception when printing to an invalid filename - a dir.
++*/
++import java.io.*;
++import java.net.*;
++import java.awt.*;
++import java.awt.geom.*;
++import java.awt.print.*;
++import javax.print.PrintService;
++import javax.print.attribute.*;
++import javax.print.attribute.standard.*;
++import java.util.PropertyPermission;
++
++public class PrintToDir extends Frame implements Printable {
++
++ boolean firstTime = true;
++ double sx, sy;
++ Shape clip, firstClip;
++
++ TextField tf = new TextField();
++ Label tfLabel = new Label ("File Name");
++ Panel p = new Panel (new GridLayout(2,2));
++ Button b = new Button("Print");
++
++ PrintToDir() {
++ add("South", p);
++ p.add(tfLabel);
++ p.add(tf);
++ p.add(b);
++ setSize(300, 300);
++ setVisible(true);
++ }
++
++ public int print(Graphics g, PageFormat pf, int pageIndex) {
++ Graphics2D g2 = (Graphics2D)g;
++ if (pageIndex>=1) {
++ return Printable.NO_SUCH_PAGE;
++ }
++ g2.drawString("hello world", 100, 100);
++ return Printable.PAGE_EXISTS;
++ }
++
++ void doPrintJob(String fileStr) {
++ PageAttributes pa = new PageAttributes();
++ JobAttributes ja = new JobAttributes();
++ ja.setDialog(JobAttributes.DialogType.NONE);
++ ja.setDestination(JobAttributes.DestinationType.FILE);
++ ja.setFileName(fileStr);
++ try {
++ PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(this,
++ "PrintDialog Testing", ja, pa);
++ if (pjob != null) {
++ System.out.println("Printjob successfully created: " + pjob);
++ Graphics g = pjob.getGraphics();
++ this.printAll(g);
++ g.dispose();
++ pjob.end();
++ }
++ System.out.println("Printing completed");
++ } catch (IllegalArgumentException e) {
++ System.out.println("PrintJob passed.");
++ return;
++ }
++ throw new RuntimeException("PrintJob::IllegalArgumentException expected but not thrown. \nTEST FAILED");
++ }
++
++ public static void doPrinterJob(String fileStr, OrientationRequested o) {
++ PrinterJob pj = PrinterJob.getPrinterJob();
++ PrintService ps = pj.getPrintService();
++ if (ps == null) {
++ System.out.println("No print service found.");
++ return;
++ }
++ pj.setPrintable(new PrintToDir());
++ PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
++ aset.add(o);
++ File f = new File(fileStr);
++ // f.deleteOnExit();
++ URI dest = f.toURI();
++ Destination d = new Destination(dest);
++ if (ps.isAttributeValueSupported(d, null, null)) {
++ aset.add(d);
++ try {
++ pj.print(aset);
++ } catch (PrinterException e) {
++ System.out.println("PrinterJob passed.");
++ return;
++ }
++ throw new RuntimeException("PrinterJob:PrinterException expected but not thrown. \nTEST FAILED");
++ } else {
++ System.out.println("Destination attribute is not a supported value. PrinterJob passed.");
++ }
++ }
++
++
++ public static void main(String arg[]) {
++ SecurityManager security = System.getSecurityManager();
++ if (security != null) {
++ System.out.println("Security manager detected");
++ try {
++ security.checkPermission(new FilePermission("<<ALL FILES>>", "read,write"));
++ security.checkPermission(new PropertyPermission("user.dir", "read"));
++ } catch (SecurityException se) {
++ System.out.println("Security requirement not obtained. TEST PASSED");
++ return;
++ }
++ }
++ String[] testStr = {".", ""};
++ for (int i=0; i<testStr.length; i++) {
++ System.out.println("Testing file name = \""+testStr[i]+"\"");
++ doPrinterJob(testStr[i], OrientationRequested.PORTRAIT);
++ PrintToDir ptd = new PrintToDir();
++ ptd.doPrintJob(testStr[i]);
++ ptd.dispose();
++ }
++ System.out.println("TEST PASSED");
++ }
++
++}
+--- ./jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java Fri Apr 10 09:21:28 2015 -0700
+@@ -81,7 +81,7 @@
+ public static ProcessResults executeChildProcess(final Class classToExecute,
+ final String [] args)
+ {
+- return executeChildProcess(classToExecute, " ", args);
++ return executeChildProcess(classToExecute, System.getProperty("java.class.path"), args);
+ }
+
+ /**
+--- ./jdk/test/java/io/pathNames/General.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/io/pathNames/General.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, 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
+@@ -28,6 +28,7 @@
+
+ import java.io.*;
+ import java.util.*;
++import java.nio.file.*;
+
+
+ public class General {
+@@ -38,12 +39,40 @@
+
+ private static int gensymCounter = 0;
+
++ protected static final String userDir = System.getProperty("user.dir");
++
++ protected static String baseDir = null;
++ protected static String relative = null;
+
+ /* Generate a filename unique to this run */
+ private static String gensym() {
+ return "x." + ++gensymCounter;
+ }
+
++ /**
++ * Create files and folders in the test working directory.
++ * The purpose is to make sure the test will not go out of
++ * its user dir when walking the file tree.
++ *
++ * @param depth The number of directory levels to be created under
++ * the user directory. It should be the maximum value
++ * of the depths passed to checkNames method (including
++ * direct or indirect calling) in a whole test.
++ */
++ protected static void initTestData(int depth) throws IOException {
++ File parent = new File(userDir);
++ for (int i = 0; i < depth; i++) {
++ File tmp = new File(parent, gensym());
++ tmp.createNewFile();
++ tmp = new File(parent, gensym());
++ if (tmp.mkdir())
++ parent = tmp;
++ else
++ throw new IOException("Fail to create directory, " + tmp);
++ }
++ baseDir = parent.getAbsolutePath();
++ relative = baseDir.substring(userDir.length() + 1);
++ }
+
+ /**
+ * Find a file in the given subdirectory, or descend into further
+@@ -57,7 +86,7 @@
+ for (int i = 0; i < dl.length; i++) {
+ File f = new File(subdir, dl[i]);
+ File df = new File(dir, f.getPath());
+- if (df.exists() && df.isFile()) {
++ if (Files.isRegularFile(df.toPath(), LinkOption.NOFOLLOW_LINKS)) {
+ return f.getPath();
+ }
+ }
+@@ -65,7 +94,7 @@
+ File f = (subdir.length() == 0) ? new File(dl[i])
+ : new File(subdir, dl[i]);
+ File df = new File(dir, f.getPath());
+- if (df.exists() && df.isDirectory()) {
++ if (Files.isDirectory(df.toPath(), LinkOption.NOFOLLOW_LINKS)) {
+ String[] dl2 = df.list();
+ if (dl2 != null) {
+ String ff = findSomeFile(dir, f.getPath(), dl2);
+@@ -90,7 +119,7 @@
+ }
+ for (int i = 0; i < dl.length; i++) {
+ File f = new File(dir, dl[i]);
+- if (f.isFile()) {
++ if (Files.isRegularFile(f.toPath(), LinkOption.NOFOLLOW_LINKS)) {
+ return dl[i];
+ }
+ }
+@@ -127,9 +156,9 @@
+ }
+ for (int i = 0; i < dl.length; i++) {
+ File f = new File(d, dl[i]);
+- if (f.isDirectory() && f.canRead()) {
++ if (Files.isDirectory(f.toPath(), LinkOption.NOFOLLOW_LINKS)) {
+ String[] dl2 = f.list();
+- if (dl2.length >= 250) {
++ if (dl2 == null || dl2.length >= 250) {
+ /* Heuristic to avoid scanning huge directories */
+ continue;
+ }
+@@ -213,7 +242,7 @@
+
+
+ /** Hash table of input pathnames, used to detect duplicates */
+- private static Hashtable checked = new Hashtable();
++ private static Hashtable<String, String> checked = new Hashtable<>();
+
+ /**
+ * Check the given pathname. Its canonical pathname should be the given
+@@ -271,7 +300,7 @@
+
+
+ /** Check a single slash case, plus its children */
+- public static void checkSlash(int depth, boolean create,
++ private static void checkSlash(int depth, boolean create,
+ String ans, String ask, String slash)
+ throws Exception
+ {
+@@ -314,7 +343,7 @@
+
+ /* Normal name */
+ if (f.exists()) {
+- if (f.isDirectory() && f.canRead()) {
++ if (Files.isDirectory(f.toPath(), LinkOption.NOFOLLOW_LINKS) && f.list() != null) {
+ if ((n = findSomeFile(ans, create)) != null)
+ checkSlashes(d, create, ans + n, ask + n);
+ if ((n = findSomeDir(ans, create)) != null)
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/io/pathNames/GeneralSolaris.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,78 @@
++/*
++ * Copyright (c) 2013, 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 4035924 4095767
++ @summary General exhaustive test of solaris pathname handling
++ @author Mark Reinhold
++
++ @build General GeneralSolaris
++ @run main GeneralSolaris
++ */
++
++import java.io.*;
++import java.util.*;
++import java.nio.file.*;
++import java.nio.file.attribute.*;
++
++public class GeneralSolaris extends General {
++
++ private static void checkUnreadable() throws Exception {
++ Path file = Paths.get(baseDir, "unreadableFile");
++ Path dir = Paths.get(baseDir, "unreadableDir");
++ Set<PosixFilePermission> perms = PosixFilePermissions.fromString("---------");
++ FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);
++ Files.createFile(file, attr);
++ Files.createDirectory(dir, attr);
++
++ String unreadableFile = file.toString();
++ String unreadableDir = dir.toString();
++
++ checkSlashes(2, false, unreadableDir, unreadableDir);
++ checkSlashes(2, false, unreadableFile, unreadableFile);
++
++ Files.delete(file);
++ Files.delete(dir);
++ }
++
++ private static void checkPaths() throws Exception {
++ // Make sure that an empty relative path is tested
++ checkNames(1, true, userDir + File.separator, "");
++ checkNames(3, true, baseDir + File.separator,
++ relative + File.separator);
++
++ checkSlashes(2, true, baseDir, baseDir);
++ }
++
++ public static void main(String[] args) throws Exception {
++ if (File.separatorChar != '/') {
++ /* This test is only valid on Unix systems */
++ return;
++ }
++ if (args.length > 0) debug = true;
++
++ initTestData(3);
++ checkUnreadable();
++ checkPaths();
++ }
++}
+--- ./jdk/test/java/io/pathNames/GeneralWin32.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/io/pathNames/GeneralWin32.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, 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
+@@ -22,7 +22,7 @@
+ */
+
+ /* @test
+- @bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520
++ @bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520 8009258
+ @summary General exhaustive test of win32 pathname handling
+ @author Mark Reinhold
+
+@@ -31,8 +31,6 @@
+ */
+
+ import java.io.*;
+-import java.util.*;
+-
+
+ public class GeneralWin32 extends General {
+
+@@ -50,10 +48,9 @@
+ private static final String NONEXISTENT_UNC_HOST = "non-existent-unc-host";
+ private static final String NONEXISTENT_UNC_SHARE = "bogus-share";
+
+-
+ /* Pathnames relative to working directory */
+
+- private static void checkCaseLookup(String ud) throws IOException {
++ private static void checkCaseLookup() throws IOException {
+ /* Use long names here to avoid 8.3 format, which Samba servers often
+ force to lowercase */
+ File d = new File("XyZzY0123", "FOO_bar_BAZ");
+@@ -75,7 +72,7 @@
+
+ /* Computing the canonical path of a Win32 file should expose the true
+ case of filenames, rather than just using the input case */
+- File y = new File(ud, f.getPath());
++ File y = new File(userDir, f.getPath());
+ String ans = y.getPath();
+ check(ans, "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
+ check(ans, "xyzzy0123\\foo_bar_baz\\glorpified");
+@@ -91,18 +88,20 @@
+ throw new Exception("Wildcard path not rejected: " + f);
+ }
+
+- private static void checkWildCards(String ud) throws Exception {
+- File d = new File(ud).getCanonicalFile();
++ private static void checkWildCards() throws Exception {
++ File d = new File(userDir).getCanonicalFile();
+ checkWild(new File(d, "*.*"));
+ checkWild(new File(d, "*.???"));
+ checkWild(new File(new File(d, "*.*"), "foo"));
+ }
+
+- private static void checkRelativePaths() throws Exception {
+- String ud = System.getProperty("user.dir").replace('/', '\\');
+- checkCaseLookup(ud);
+- checkWildCards(ud);
+- checkNames(3, true, ud + "\\", "");
++ private static void checkRelativePaths(int depth) throws Exception {
++ checkCaseLookup();
++ checkWildCards();
++ // Make sure that an empty relative path is tested
++ checkNames(1, true, userDir + File.separator, "");
++ checkNames(depth, true, baseDir + File.separator,
++ relative + File.separator);
+ }
+
+
+@@ -137,19 +136,19 @@
+ checkNames(depth, false, ans, d);
+ }
+
+- private static void checkDrivePaths() throws Exception {
+- checkDrive(2, findActiveDrive(), true);
+- checkDrive(2, findInactiveDrive(), false);
++ private static void checkDrivePaths(int depth) throws Exception {
++ checkDrive(depth, findActiveDrive(), true);
++ checkDrive(depth, findInactiveDrive(), false);
+ }
+
+
+ /* UNC pathnames */
+
+- private static void checkUncPaths() throws Exception {
++ private static void checkUncPaths(int depth) throws Exception {
+ String s = ("\\\\" + NONEXISTENT_UNC_HOST
+ + "\\" + NONEXISTENT_UNC_SHARE);
+ ensureNon(s);
+- checkSlashes(2, false, s, s);
++ checkSlashes(depth, false, s, s);
+
+ s = "\\\\" + EXISTENT_UNC_HOST + "\\" + EXISTENT_UNC_SHARE;
+ if (!(new File(s)).exists()) {
+@@ -158,7 +157,7 @@
+ return;
+ }
+
+- checkSlashes(2, false, s, s);
++ checkSlashes(depth, false, s, s);
+ }
+
+
+@@ -168,9 +167,11 @@
+ return;
+ }
+ if (args.length > 0) debug = true;
+- checkRelativePaths();
+- checkDrivePaths();
+- checkUncPaths();
++
++ initTestData(3);
++
++ checkRelativePaths(3);
++ checkDrivePaths(2);
++ checkUncPaths(2);
+ }
+-
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,205 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++
++import java.lang.reflect.Field;
++import java.lang.reflect.ReflectPermission;
++import java.security.CodeSource;
++import java.security.Permission;
++import java.security.PermissionCollection;
++import java.security.Permissions;
++import java.security.Policy;
++import java.security.ProtectionDomain;
++import java.util.Arrays;
++import java.util.Enumeration;
++import java.util.concurrent.atomic.AtomicBoolean;
++
++/**
++ * @test
++ * @bug 8065552
++ * @summary test that all fields returned by getDeclaredFields() can be
++ * set accessible if the right permission is granted; this test
++ * also verifies that Class.classLoader final private field is
++ * hidden from reflection access.
++ * @run main/othervm ClassDeclaredFieldsTest UNSECURE
++ * @run main/othervm ClassDeclaredFieldsTest SECURE
++ *
++ * @author danielfuchs
++ */
++public class ClassDeclaredFieldsTest {
++
++ // Test with or without a security manager
++ public static enum TestCase {
++ UNSECURE, SECURE;
++ public void run() throws Exception {
++ System.out.println("Running test case: " + name());
++ Configure.setUp(this);
++ test(this);
++ }
++ }
++ /**
++ * @param args the command line arguments
++ */
++ public static void main(String[] args) throws Exception {
++ System.out.println(System.getProperty("java.version"));
++ if (args == null || args.length == 0) {
++ args = new String[] { "SECURE" };
++ } else if (args.length != 1) {
++ throw new IllegalArgumentException("Only one arg expected: "
++ + Arrays.asList(args));
++ }
++ TestCase.valueOf(args[0]).run();
++ }
++
++ static void test(TestCase test) {
++ for (Field f : Class.class.getDeclaredFields()) {
++ f.setAccessible(true);
++ System.out.println("Field "+f.getName()+" is now accessible.");
++ if (f.getName().equals("classLoader")) {
++ throw new RuntimeException("Found "+f.getName()+" field!");
++ }
++ }
++ try {
++ Class.class.getDeclaredField("classLoader");
++ throw new RuntimeException("Expected NoSuchFieldException for"
++ + " 'classLoader' field not raised");
++ } catch(NoSuchFieldException x) {
++ System.out.println("Got expected exception: " + x);
++ }
++ System.out.println("Passed "+test);
++ }
++
++ // A helper class to configure the security manager for the test,
++ // and bypass it when needed.
++ static class Configure {
++ static Policy policy = null;
++ static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
++ @Override
++ protected AtomicBoolean initialValue() {
++ return new AtomicBoolean(false);
++ }
++ };
++ static void setUp(TestCase test) {
++ switch (test) {
++ case SECURE:
++ if (policy == null && System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ } else if (policy == null) {
++ policy = new SimplePolicy(TestCase.SECURE, allowAll);
++ Policy.setPolicy(policy);
++ System.setSecurityManager(new SecurityManager());
++ }
++ if (System.getSecurityManager() == null) {
++ throw new IllegalStateException("No SecurityManager.");
++ }
++ if (policy == null) {
++ throw new IllegalStateException("policy not configured");
++ }
++ break;
++ case UNSECURE:
++ if (System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ }
++ break;
++ default:
++ throw new InternalError("No such testcase: " + test);
++ }
++ }
++ static void doPrivileged(Runnable run) {
++ allowAll.get().set(true);
++ try {
++ run.run();
++ } finally {
++ allowAll.get().set(false);
++ }
++ }
++ }
++
++ // A Helper class to build a set of permissions.
++ final static class PermissionsBuilder {
++ final Permissions perms;
++ public PermissionsBuilder() {
++ this(new Permissions());
++ }
++ public PermissionsBuilder(Permissions perms) {
++ this.perms = perms;
++ }
++ public PermissionsBuilder add(Permission p) {
++ perms.add(p);
++ return this;
++ }
++ public PermissionsBuilder addAll(PermissionCollection col) {
++ if (col != null) {
++ for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
++ perms.add(e.nextElement());
++ }
++ }
++ return this;
++ }
++ public Permissions toPermissions() {
++ final PermissionsBuilder builder = new PermissionsBuilder();
++ builder.addAll(perms);
++ return builder.perms;
++ }
++ }
++
++ // Policy for the test...
++ public static class SimplePolicy extends Policy {
++
++ final Permissions permissions;
++ final Permissions allPermissions;
++ final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
++ public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
++ this.allowAll = allowAll;
++ // we don't actually need any permission to create our
++ // FileHandlers because we're passing invalid parameters
++ // which will make the creation fail...
++ permissions = new Permissions();
++ permissions.add(new RuntimePermission("accessDeclaredMembers"));
++ permissions.add(new ReflectPermission("suppressAccessChecks"));
++
++ // these are used for configuring the test itself...
++ allPermissions = new Permissions();
++ allPermissions.add(new java.security.AllPermission());
++
++ }
++
++ @Override
++ public boolean implies(ProtectionDomain domain, Permission permission) {
++ if (allowAll.get().get()) return allPermissions.implies(permission);
++ return permissions.implies(permission);
++ }
++
++ @Override
++ public PermissionCollection getPermissions(CodeSource codesource) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++
++ @Override
++ public PermissionCollection getPermissions(ProtectionDomain domain) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,393 @@
++/*
++ * Copyright (c) 2015, 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 8065552
++ * @summary test that all fields returned by getDeclaredFields() can be
++ * set accessible if the right permission is granted; this test
++ * loads all the classes in the BCL, get their declared fields,
++ * and call setAccessible(false) followed by setAccessible(true);
++ *
++ * @run main/othervm -XX:PermSize=128m FieldSetAccessibleTest UNSECURE
++ * @run main/othervm -XX:PermSize=128m FieldSetAccessibleTest SECURE
++ *
++ * @author danielfuchs
++ */
++
++import java.io.File;
++import java.io.FilePermission;
++import java.io.IOException;
++import java.lang.reflect.Field;
++import java.lang.reflect.ReflectPermission;
++import java.security.CodeSource;
++import java.security.Permission;
++import java.security.PermissionCollection;
++import java.security.Permissions;
++import java.security.Policy;
++import java.security.ProtectionDomain;
++import java.util.ArrayList;
++import java.util.Arrays;
++import java.util.Collections;
++import java.util.Enumeration;
++import java.util.Iterator;
++import java.util.List;
++import java.util.PropertyPermission;
++import java.util.concurrent.atomic.AtomicBoolean;
++import java.util.concurrent.atomic.AtomicLong;
++import java.util.jar.JarEntry;
++import java.util.jar.JarFile;
++
++public class FieldSetAccessibleTest {
++
++ static final List<String> skipped = new ArrayList<>();
++ static final List<String> cantread = new ArrayList<>();
++ static final List<String> failed = new ArrayList<>();
++ static final AtomicLong classCount = new AtomicLong();
++ static final AtomicLong fieldCount = new AtomicLong();
++ static long startIndex = 0;
++ static long maxSize = Long.MAX_VALUE;
++ static long maxIndex = Long.MAX_VALUE;
++
++
++ // Test that all fields for any given class can be made accessibles
++ static void testSetFieldsAccessible(Class<?> c) {
++ for (Field f : c.getDeclaredFields()) {
++ fieldCount.incrementAndGet();
++ f.setAccessible(false);
++ f.setAccessible(true);
++ }
++ }
++
++ // Performs a series of test on the given class.
++ // At this time, we only call testSetFieldsAccessible(c)
++ public static boolean test(Class<?> c) {
++ //System.out.println(c.getName());
++ classCount.incrementAndGet();
++
++ // Call getDeclaredFields() and try to set their accessible flag.
++ testSetFieldsAccessible(c);
++
++ // add more tests here...
++
++ return c == Class.class;
++ }
++
++ // Prints a summary at the end of the test.
++ static void printSummary(long secs, long millis, long nanos) {
++ System.out.println("Tested " + fieldCount.get() + " fields of "
++ + classCount.get() + " classes in "
++ + secs + "s " + millis + "ms " + nanos + "ns");
++ }
++
++ public static void main(String[] args) throws Exception {
++ TestCase.valueOf(args[0]).run();
++ }
++
++ public static void run(TestCase test) {
++ System.out.println("Testing " + test);
++ test(listAllClassNames());
++ System.out.println("Passed " + test);
++ }
++
++ static Iterable<String> listAllClassNames() {
++ boolean sort = startIndex != 0 || maxIndex != Long.MAX_VALUE;
++ return new ClassNameListBuilder(sort);
++ }
++
++ static void test(Iterable<String> iterable) {
++ final long start = System.nanoTime();
++ boolean classFound = false;
++ int index = 0;
++ for (String s: iterable) {
++ if (index == maxIndex) break;
++ try {
++ if (index < startIndex) continue;
++ if (test(s)) {
++ classFound = true;
++ }
++ } finally {
++ index++;
++ }
++ }
++ long elapsed = System.nanoTime() - start;
++ long secs = elapsed / 1000_000_000;
++ long millis = (elapsed % 1000_000_000) / 1000_000;
++ long nanos = elapsed % 1000_000;
++ System.out.println("Unreadable path elements: " + cantread);
++ System.out.println("Skipped path elements: " + skipped);
++ System.out.println("Failed path elements: " + failed);
++ printSummary(secs, millis, nanos);
++
++ if (!failed.isEmpty()) {
++ throw new RuntimeException("Test failed for the following classes: " + failed);
++ }
++ if (!classFound && startIndex == 0 && index < maxIndex) {
++ // this is just to verify that we have indeed parsed rt.jar
++ // (or the java.base module)
++ throw new RuntimeException("Test failed: Class.class not found...");
++ }
++ if (classCount.get() == 0 && startIndex == 0) {
++ throw new RuntimeException("Test failed: no class found?");
++ }
++ }
++
++ static boolean test(String s) {
++ try {
++ if (s.startsWith("WrapperGenerator")) {
++ System.out.println("Skipping "+ s);
++ return false;
++ }
++ final Class<?> c = Class.forName(
++ s.replace('/', '.').substring(0, s.length() - 6),
++ false,
++ null);
++ return test(c);
++ } catch (Exception t) {
++ t.printStackTrace(System.err);
++ failed.add(s);
++ } catch (NoClassDefFoundError e) {
++ e.printStackTrace(System.err);
++ failed.add(s);
++ }
++ return false;
++ }
++
++ static class ClassNameListBuilder implements Iterable<String> {
++ String[] bcp;
++ boolean sort;
++ ClassNameListBuilder(boolean sort) {
++ bcp = System.getProperty("sun.boot.class.path").split(File.pathSeparator);
++ this.sort = sort;
++ }
++
++ public List<String> build() {
++ return findClasses();
++ }
++
++ List<String> findClasses() {
++ List<String> list = new ArrayList<>();
++
++ for (String s : bcp) {
++ System.out.println("boot class path element: " + s);
++ if (s.endsWith(".jar")) {
++ addJarEntries(s, list);
++ } else {
++ addFolderEntries(new File(s), s, list);
++ }
++ }
++
++ if (sort) {
++ System.out.println("Sorting class names...");
++ Collections.sort(list);
++ System.out.println("\t... Sorted.");
++ }
++ return list;
++ }
++
++ void addJarEntries(String jarName, List<String> classNames) {
++ File f = new File(jarName);
++ if (f.canRead() && f.isFile()) {
++ try {
++ JarFile jarFile = new JarFile(f);
++ for (Enumeration<JarEntry> entries = jarFile.entries() ; entries.hasMoreElements() ;) {
++ JarEntry e = entries.nextElement();
++ if (e.isDirectory()) {
++ continue;
++ }
++ if (e.getName().endsWith(".class")) {
++ classNames.add(e.getName());
++ }
++ }
++ } catch (IOException e) {
++ e.printStackTrace();
++ skipped.add(jarName);
++ }
++ } else {
++ cantread.add(jarName);
++ }
++ }
++
++ void addFolderEntries(File root, String folderName, List<String> classNames) {
++ File f = new File(folderName);
++ if (f.canRead()) {
++ if (f.isDirectory()) {
++ for (String child : f.list()) {
++ addFolderEntries(root, new File(f,child).getPath(), classNames);
++ }
++ } else if (f.isFile() && f.getName().endsWith(".class")) {
++ String className = root.toPath().relativize(f.toPath()).toString()
++ .replace(File.separatorChar, '/');
++ System.out.println("adding: " + className);
++ classNames.add(className);
++ }
++ } else {
++ cantread.add(folderName);
++ }
++ }
++
++ @Override
++ public Iterator<String> iterator() {
++ return build().iterator();
++ }
++
++ }
++
++ // Test with or without a security manager
++ public static enum TestCase {
++ UNSECURE, SECURE;
++ public void run() throws Exception {
++ System.out.println("Running test case: " + name());
++ Configure.setUp(this);
++ FieldSetAccessibleTest.run(this);
++ }
++ }
++
++ // A helper class to configure the security manager for the test,
++ // and bypass it when needed.
++ static class Configure {
++ static Policy policy = null;
++ static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
++ @Override
++ protected AtomicBoolean initialValue() {
++ return new AtomicBoolean(false);
++ }
++ };
++ static void setUp(TestCase test) {
++ switch (test) {
++ case SECURE:
++ if (policy == null && System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ } else if (policy == null) {
++ policy = new SimplePolicy(TestCase.SECURE, allowAll);
++ Policy.setPolicy(policy);
++ System.setSecurityManager(new SecurityManager());
++ }
++ if (System.getSecurityManager() == null) {
++ throw new IllegalStateException("No SecurityManager.");
++ }
++ if (policy == null) {
++ throw new IllegalStateException("policy not configured");
++ }
++ break;
++ case UNSECURE:
++ if (System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ }
++ break;
++ default:
++ throw new InternalError("No such testcase: " + test);
++ }
++ }
++ static void doPrivileged(Runnable run) {
++ allowAll.get().set(true);
++ try {
++ run.run();
++ } finally {
++ allowAll.get().set(false);
++ }
++ }
++ }
++
++ // A Helper class to build a set of permissions.
++ final static class PermissionsBuilder {
++ final Permissions perms;
++ public PermissionsBuilder() {
++ this(new Permissions());
++ }
++ public PermissionsBuilder(Permissions perms) {
++ this.perms = perms;
++ }
++ public PermissionsBuilder add(Permission p) {
++ perms.add(p);
++ return this;
++ }
++ public PermissionsBuilder addAll(PermissionCollection col) {
++ if (col != null) {
++ for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
++ perms.add(e.nextElement());
++ }
++ }
++ return this;
++ }
++ public Permissions toPermissions() {
++ final PermissionsBuilder builder = new PermissionsBuilder();
++ builder.addAll(perms);
++ return builder.perms;
++ }
++ }
++
++ // Policy for the test...
++ public static class SimplePolicy extends Policy {
++
++ final Permissions permissions;
++ final Permissions allPermissions;
++ final ThreadLocal<AtomicBoolean> allowAll;
++ public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
++ this.allowAll = allowAll;
++
++ // Permission needed by the tested code exercised in the test
++ permissions = new Permissions();
++ permissions.add(new RuntimePermission("fileSystemProvider"));
++ permissions.add(new RuntimePermission("createClassLoader"));
++ permissions.add(new RuntimePermission("closeClassLoader"));
++ permissions.add(new RuntimePermission("getClassLoader"));
++ permissions.add(new RuntimePermission("accessDeclaredMembers"));
++ permissions.add(new ReflectPermission("suppressAccessChecks"));
++ permissions.add(new PropertyPermission("*", "read"));
++ permissions.add(new FilePermission("<<ALL FILES>>", "read"));
++
++ // these are used for configuring the test itself...
++ allPermissions = new Permissions();
++ allPermissions.add(new java.security.AllPermission());
++ }
++
++ @Override
++ public boolean implies(ProtectionDomain domain, Permission permission) {
++ if (allowAll.get().get()) return allPermissions.implies(permission);
++ if (permissions.implies(permission)) return true;
++ if (permission instanceof java.lang.RuntimePermission) {
++ if (permission.getName().startsWith("accessClassInPackage.")) {
++ // add these along to the set of permission we have, when we
++ // discover that we need them.
++ permissions.add(permission);
++ return true;
++ }
++ }
++ return false;
++ }
++
++ @Override
++ public PermissionCollection getPermissions(CodeSource codesource) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++
++ @Override
++ public PermissionCollection getPermissions(ProtectionDomain domain) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++ }
++
++}
+--- ./jdk/test/java/lang/ProcessBuilder/Basic.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/lang/ProcessBuilder/Basic.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2014, 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
+@@ -26,10 +26,11 @@
+ * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
+ * 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
+ * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
+- * 4947220 7018606 7034570
++ * 4947220 7018606 7034570 8047340
+ * @summary Basic tests for Process and Environment Variable code
+ * @run main/othervm/timeout=300 Basic
+ * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
++ * @run main/othervm/timeout=300 -DTurkeyTest Basic
+ * @author Martin Buchholz
+ */
+
+@@ -1083,6 +1084,11 @@
+ }
+
+ private static void realMain(String[] args) throws Throwable {
++ if (System.getProperty("TurkeyTest") != null) {
++ // static initializer test, set this early.
++ System.out.println("Testing with Turkish locale.");
++ Locale.setDefault(new Locale("tr", ""));
++ }
+ if (Windows.is())
+ System.out.println("This appears to be a Windows system.");
+ if (Unix.is())
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/lang/reflect/Generics/ThreadSafety.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,129 @@
++/*
++ * Copyright 2014 Google Inc. 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 8062771 8016236
++ * @summary Test publication of Class objects via a data race
++ * @run testng ThreadSafety
++ */
++
++import java.net.URL;
++import java.net.URLClassLoader;
++import java.util.Collections;
++import java.util.concurrent.BrokenBarrierException;
++import java.util.concurrent.Callable;
++import java.util.concurrent.CyclicBarrier;
++import java.util.concurrent.ExecutionException;
++import java.util.concurrent.ExecutorService;
++import java.util.concurrent.Executors;
++import java.util.concurrent.Future;
++import java.util.concurrent.TimeoutException;
++import static java.util.concurrent.TimeUnit.SECONDS;
++import static org.testng.Assert.*;
++import org.testng.annotations.Test;
++
++/**
++ * A test resulting from an attempt to repro this failure (in guice):
++ *
++ * java.lang.NullPointerException
++ * at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
++ * at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
++ * at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:84)
++ * at java.lang.Class.getGenericSuperclass(Class.java:692)
++ * at com.google.inject.TypeLiteral.getSuperclassTypeParameter(TypeLiteral.java:99)
++ * at com.google.inject.TypeLiteral.<init>(TypeLiteral.java:79)
++ *
++ * However, as one would expect with thread safety problems in reflection, these
++ * are very hard to reproduce. This very test has never been observed to fail,
++ * but a similar test has been observed to fail about once in 2000 executions
++ * (about once every 6 CPU-hours), in jdk7 only. It appears to be fixed in jdk8+ by:
++ *
++ * 8016236: Class.getGenericInterfaces performance improvement.
++ * (by making Class.genericInfo volatile)
++ */
++public class ThreadSafety {
++ public static class EmptyClass {
++ public static class EmptyGenericSuperclass<T> {}
++ public static class EmptyGenericSubclass<T> extends EmptyGenericSuperclass<T> {}
++ }
++
++ /** published via data race */
++ private Class<?> racyClass = Object.class;
++
++ private URL[] urls = ((URLClassLoader) ThreadSafety.class.getClassLoader()).getURLs();
++
++ private Class<?> createNewEmptyGenericSubclassClass() throws Exception {
++ URLClassLoader ucl = new URLClassLoader(urls, null);
++ return Class.forName("ThreadSafety$EmptyClass$EmptyGenericSubclass", true, ucl);
++ }
++
++ @Test
++ public void testRacy_getGenericSuperclass() throws Exception {
++ final int nThreads = 10;
++ final int iterations = 30;
++ final int timeout = 10;
++ final CyclicBarrier newCycle = new CyclicBarrier(nThreads);
++ final Callable<Void> task = new Callable<Void>() {
++ public Void call() throws Exception {
++ for (int i = 0; i < iterations; i++) {
++ final int threadId;
++ try {
++ threadId = newCycle.await(timeout, SECONDS);
++ } catch (BrokenBarrierException e) {
++ return null;
++ }
++ for (int j = 0; j < iterations; j++) {
++ // one thread publishes the class object via a data
++ // race, for the other threads to consume.
++ if (threadId == 0) {
++ racyClass = createNewEmptyGenericSubclassClass();
++ } else {
++ racyClass.getGenericSuperclass();
++ }
++ }
++ }
++ return null;
++ }};
++
++ final ExecutorService pool = Executors.newFixedThreadPool(nThreads);
++ try {
++ for (Future<Void> future :
++ pool.invokeAll(Collections.nCopies(nThreads, task))) {
++ try {
++ future.get(iterations * timeout, SECONDS);
++ } catch (ExecutionException e) {
++ // ignore "collateral damage"
++ if (!(e.getCause() instanceof BrokenBarrierException)
++ &&
++ !(e.getCause() instanceof TimeoutException)) {
++ throw e;
++ }
++ }
++ }
++ } finally {
++ pool.shutdownNow();
++ assertTrue(pool.awaitTermination(2 * timeout, SECONDS));
++ }
++ }
++}
+--- ./jdk/test/java/lang/reflect/Method/GenericStringTest.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/lang/reflect/Method/GenericStringTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -47,10 +47,18 @@
+ if (egs != null) {
+ String actual = method.toGenericString();
+ System.out.println(actual);
+- if (! egs.value().equals(actual)) {
+- failures++;
+- System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
+- egs.value(), actual);
++ if (method.isBridge()) {
++ if (! egs.bridgeValue().equals(actual)) {
++ failures++;
++ System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
++ egs.value(), actual);
++ }
++ } else {
++ if (! egs.value().equals(actual)) {
++ failures++;
++ System.err.printf("ERROR: Expected ''%s''; got ''%s''.\n",
++ egs.value(), actual);
++ }
+ }
+ }
+
+@@ -116,7 +124,8 @@
+
+ class Roebling implements Comparable<Roebling> {
+ @ExpectedGenericString(
+- "public int Roebling.compareTo(Roebling)")
++ value="public int Roebling.compareTo(Roebling)",
++ bridgeValue="public int Roebling.compareTo(java.lang.Object)")
+ public int compareTo(Roebling r) {
+ throw new IllegalArgumentException();
+ }
+@@ -132,9 +141,11 @@
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface ExpectedGenericString {
+ String value();
++ String bridgeValue() default "";
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface ExpectedString {
+ String value();
+ }
++
+--- ./jdk/test/java/net/InetAddress/GetLocalHostWithSM.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/net/InetAddress/GetLocalHostWithSM.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2002, 2015, 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
+@@ -23,9 +23,11 @@
+
+ /**
+ * @test
+- * @bug 4531817
++ * @bug 4531817 8026245
+ * @summary Inet[46]Address.localHost need doPrivileged
+ * @run main/othervm GetLocalHostWithSM
++ * @run main/othervm -Djava.net.preferIPv4Stack=true GetLocalHostWithSM
++ * @run main/othervm -Djava.net.preferIPv6Addresses=true GetLocalHostWithSM
+ * files needed: GetLocalHostWithSM.java, MyPrincipal.java, and policy.file
+ */
+
+--- ./jdk/test/java/net/InetAddress/IPv4Formats.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/net/InetAddress/IPv4Formats.java Fri Apr 10 09:21:28 2015 -0700
+@@ -27,6 +27,7 @@
+ * @summary InetAddress.getByName behaves differently on windows
+ */
+ import java.net.*;
++import java.util.UUID;
+
+ public class IPv4Formats {
+ public static void main(String[] args) {
+@@ -36,7 +37,7 @@
+ {"126.1", "126.0.0.1"},
+ {"128.50.65534", "128.50.255.254"},
+ {"192.168.1.2", "192.168.1.2"},
+- {"hello.foo.bar", null},
++ {"invalidhost.invalid", null},
+ {"1024.1.2.3", null},
+ {"128.14.66000", null }
+ };
+--- ./jdk/test/java/net/Socket/GetLocalAddress.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/net/Socket/GetLocalAddress.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1998, 2013, 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
+@@ -23,7 +23,10 @@
+
+ /*
+ * @test
+- * @bug 4106601
++ * @bug 4106601 8026245
++ * @run main/othervm GetLocalAddress
++ * @run main/othervm -Djava.net.preferIPv4Stack=true GetLocalAddress
++ * @run main/othervm -Djava.net.preferIPv6Addresses=true GetLocalAddress
+ * @summary Test the java.net.socket.GetLocalAddress method
+ *
+ */
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/net/Socks/BadProxySelector.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,85 @@
++/*
++ * Copyright (c) 2015, 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 7178362
++ * @run main/othervm BadProxySelector
++ */
++
++import java.net.InetSocketAddress;
++import java.net.Proxy;
++import java.net.ProxySelector;
++import java.net.Socket;
++import java.net.SocketAddress;
++import java.net.ServerSocket;
++import java.net.URI;
++import java.util.ArrayList;
++import java.util.List;
++import java.io.*;
++
++public class BadProxySelector {
++ public static void main(String[] args) throws Exception {
++ ProxySelector.setDefault(new HTTPProxySelector());
++ try (ServerSocket ss = new ServerSocket(0);
++ Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
++ Socket s2 = ss.accept()) {
++ }
++
++ ProxySelector.setDefault(new NullHTTPProxySelector());
++ try (ServerSocket ss = new ServerSocket(0);
++ Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
++ Socket s2 = ss.accept()) {
++ }
++ }
++
++ // always returns bogus HTTP proxies
++ private static class HTTPProxySelector extends ProxySelector {
++ @Override
++ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
++
++ @Override
++ public List<Proxy> select(URI uri) {
++ List<Proxy> proxies = new ArrayList<>();
++ proxies.add(new Proxy(Proxy.Type.HTTP,
++ new InetSocketAddress("localhost", 0)));
++ proxies.add(new Proxy(Proxy.Type.HTTP,
++ new InetSocketAddress("localhost", 0)));
++ return proxies;
++ }
++ }
++
++ private static class NullHTTPProxySelector extends ProxySelector {
++ @Override
++ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
++
++ @Override
++ public List<Proxy> select(URI uri) {
++ List<Proxy> proxies = new ArrayList<>();
++ proxies.add(null);
++ proxies.add(new Proxy(Proxy.Type.HTTP,
++ new InetSocketAddress("localhost", 0)));
++ return proxies;
++ }
++ }
++}
+--- ./jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java Fri Apr 10 09:21:28 2015 -0700
+@@ -24,6 +24,8 @@
+ /* @test
+ * @bug 6834246 6842687
+ * @summary Stress test connections through the loopback interface
++ * @run main StressLoopback
++ * @run main/othervm -Djdk.net.useFastTcpLoopback StressLoopback
+ */
+
+ import java.nio.ByteBuffer;
+--- ./jdk/test/java/nio/channels/FileChannel/TransferToChannel.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/nio/channels/FileChannel/TransferToChannel.java Fri Apr 10 09:21:28 2015 -0700
+@@ -22,8 +22,10 @@
+ */
+
+ /* @test
+- * @bug 4652496
++ * @bug 4652496 8064407 8068507
+ * @summary Test transferTo with different target channels
++ * @run main TransferToChannel
++ * @run main/othervm -Djdk.nio.enableFastFileTransfer TransferToChannel
+ */
+
+ import java.nio.channels.FileChannel;
+--- ./jdk/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/java/security/cert/CertificateFactory/invalidEncodedCerts/DetectInvalidEncoding.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2003, 2014, 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
+@@ -23,27 +23,548 @@
+
+ /**
+ * @test
+- * @bug 4776466
++ * @bug 4776466 8032573
+ * @summary check that CertificateFactory rejects invalid encoded X.509 certs
+ */
+
+ import java.io.*;
++import java.util.Collection;
++import java.util.List;
++import java.util.LinkedList;
++import javax.security.auth.x500.X500Principal;
++import java.security.GeneralSecurityException;
+ import java.security.cert.*;
+
+ public class DetectInvalidEncoding {
+
++ // Originally found in the test file:
++ // java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem
++ // The first character of the PEM encoding has been changed from "M" to
++ // "X" to force a failure during decoding.
++ private static final String INVALID_CERT =
++ "-----BEGIN CERTIFICATE-----\n" +
++ "XIICJjCCAdCgAwIBAgIBITANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCVVMx\n" +
++ "EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xFTAT\n" +
++ "BgNVBAoTDEJFQSBXZWJMb2dpYzERMA8GA1UECxMIU2VjdXJpdHkxIzAhBgNVBAMT\n" +
++ "GkRlbW8gQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9zdXBw\n" +
++ "b3J0QGJlYS5jb20wHhcNMDAwNTMwMjEzODAxWhcNMDQwNTEzMjEzODAxWjCBjDEL\n" +
++ "MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\n" +
++ "cmFuY2lzY28xFTATBgNVBAoTDEJFQSBXZWJMb2dpYzEZMBcGA1UEAxMQd2VibG9n\n" +
++ "aWMuYmVhLmNvbTEeMBwGCSqGSIb3DQEJARYPc3VwcG9ydEBiZWEuY29tMFwwDQYJ\n" +
++ "KoZIhvcNAQEBBQADSwAwSAJBALdsXEHqKHgs6zj0hU5sXMAUHzoT8kgWXmNkKHXH\n" +
++ "79qbPh6EfdlriW9G/AbRF/pKrCQu7hhllAxREbqTuSlf2EMCAwEAATANBgkqhkiG\n" +
++ "9w0BAQQFAANBACgmqflL5m5LNeJGpWx9aIoABCiuDcpw1fFyegsqGX7CBhffcruS\n" +
++ "1p8h5vkHVbMu1frD1UgGnPlOO/K7Ig/KrsU=\n" +
++ "-----END CERTIFICATE-----";
++
++ // Created with keytool:
++ // keytool -genkeypair -keyalg rsa -keysize 2048 -keystore <KS_FILE>
++ // -alias root -sigalg SHA256withRSA -dname "CN=Root, O=SomeCompany"
++ // -validity 730 -ext bc:critical=ca:true
++ // -ext ku:critical=keyCertSign,cRLSign
++ private static final String SINGLE_ROOT_CERT =
++ "-----BEGIN CERTIFICATE-----\n" +
++ "MIIDCjCCAfKgAwIBAgIEDUiw+DANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
++ "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMTI5MjZaFw0xNjA4\n" +
++ "MjcyMTI5MjZaMCUxFDASBgNVBAoTC1NvbWVDb21wYW55MQ0wCwYDVQQDEwRSb290\n" +
++ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0VFecSNdH6CJhPOSG127\n" +
++ "tuvld4y7GGJ0kQf3Q0b8qgprsXAmn0/bQR+YX7PfS408cFW+q2SWXeY2kC/3chvi\n" +
++ "2syMsGdUJrDzuMbYsbvKPKyuJ2GJskX3mSbLMJj5Tzhg4qmwbzDTFIJ51yGa1Wmh\n" +
++ "i2+4PhltqT0TohvSVJlBrOWNhmvwv5UWsF4e2i04rebDZQoWkmD3MpImZXF/HYre\n" +
++ "9P8NP97vN0xZmh5PySHy2ILXN3ZhTn3tq0YxNSQTaMUfhgoyzWFvZKAnm/tZIh/1\n" +
++ "oswwEQPIZJ25AUTm9r3YPQXl1hsNdLU0asEVYRsgzGSTX5gCuUY+KzhStzisOcUY\n" +
++ "uQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" +
++ "HQ4EFgQUz1FBNixG/KCgcn6FOWzxP1hujG0wDQYJKoZIhvcNAQELBQADggEBAL60\n" +
++ "ZaNc6eIMbKntGVE/pdxxyKwPdDyAAeEevX23KRWoLbQjHXo5jrfDPhI5k45ztlyU\n" +
++ "+tIQbc81LlCl88I4dIx0fvEbxjNaAYhFNXwwSQBs2CuEAdRK8hodXbRcEeI+G10F\n" +
++ "ARIVs2C7JNm/RhxskCWgj6tFIOGaTZ9gHyvlQUEM18sr5fXZlXTqspZCmz3t5XPi\n" +
++ "5/wYLv6vk7k3G8WzMHbBE0bYI+61cCc8rbMHldtymbwSwiqfKC9y7oPEfRCbzVUe\n" +
++ "fgrKcOyVWDuw0y0hhsQL/oONjPp4uK/bl9B7T84t4+ihxdocWKx6eyhFvOvZH9t2\n" +
++ "kUylb9yBUYStwGExMHg=\n" +
++ "-----END CERTIFICATE-----";
++
++ // Created with keytool:
++ // keytool -genkeypair -keyalg rsa -keysize 2048 -keystore <KS_FILE>
++ // -alias root -sigalg SHA256withRSA
++ // -dname "CN=Intermed, O=SomeCompany" -validity 730
++ // -ext bc:critical=ca:true -ext ku:critical=keyCertSign,cRLSign
++ // keytool -certreq -keystore <KS_FILE> -sigalg SHA256withRSA
++ // -alias intermed -dname "CN=Intermed, O=SomeCompany"
++ // keytool -gencert -keystore <KS_FILE> -alias intermed
++ // -sigalg SHA256withRSA -validity 730
++ // -ext bc:critical=ca:true -ext ku:critical=keyCertSign,cRLSign
++ private static final String INTERMED_CA_CERT =
++ "-----BEGIN CERTIFICATE-----\n" +
++ "MIIDLzCCAhegAwIBAgIEIIgOyDANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
++ "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjUyNDJaFw0xNjA4\n" +
++ "MDcyMjUyNDJaMCkxFDASBgNVBAoTC1NvbWVDb21wYW55MREwDwYDVQQDEwhJbnRl\n" +
++ "cm1lZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJEecvTWla8kdWx+\n" +
++ "HHu5ryfBpJ95I7V4MEajnmzJVZcwvKhDjlDgABDMuVwFEUUSyeOdbWJF3DLKnyMD\n" +
++ "KTx6/58kuVak3NX2TJ8cmmIlKf1upFbdrEtjYViSnNrApprfO8B3ORdBbO6QDYza\n" +
++ "IkAWdI5GllFnVkb4yhMUBg3zfhglF+bl3D3lVRlp9bCrUZoNRs+mZjhVbcMn22ej\n" +
++ "TfG5Y3VpNM4SN8dFIxPQLLk/aao+cmWEQdbQ0R6ydemRukqrw170olSVLeoGGala\n" +
++ "3D4oJckde8EgNPcghcsdQ6tpGhkpFhmoyzEsuToR7Gq9UT5V2kkqJneiKXqQg4wz\n" +
++ "vMAlUGECAwEAAaNjMGEwHwYDVR0jBBgwFoAUOw+92bevFoJz96pR1DrAkPPUKb0w\n" +
++ "DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLbnErBs\n" +
++ "q/Mhci5XElfjjLZp3GRyMA0GCSqGSIb3DQEBCwUAA4IBAQAq8y2DpkSV31IXZ1vr\n" +
++ "/Ye+Nj/2NvBydFeHVRGMAN1LJv6/Q42TCSXbr6cDQ4NWQUtPm90yZBYJSznkbShx\n" +
++ "HOJEE6R8PRJvoUtMm7fJrNtkybTt6jX4j50Lw8gdYB/rgZb4z8ZQZVEo/0zpW4HV\n" +
++ "Gs+q4z8TkdmLR18hl39sUEsxt99AOBk8NtKKVNfBWq9b0QDhRkXfmqhyeXdDsHOV\n" +
++ "8ksulsa7hseheHhdjziEOpQugh8qzSea2kFPrLB53VjWfa4qDzEPaNhahho9piCu\n" +
++ "82XDnOrcEk9KyHWM7sa7vtK7++W+0MXD/p9nkZ6NHrJXweLriU0DXO6ZY3mzNKJK\n" +
++ "435M\n" +
++ "-----END CERTIFICATE-----";
++
++ // Subordinate cert created using keytool, both certs exported to
++ // files individually, then use openssl to place in a PKCS#7:
++ // openssl crl2pkcs7 -nocrl -certfile <INTERMED-CERT-PEM>
++ // -certfile <ROOT-CERT-PEM> -out <P7-DEST-PEM-FILE>
++ private static final String PKCS7_INTERMED_ROOT_CERTS =
++ "-----BEGIN PKCS7-----\n" +
++ "MIIGbgYJKoZIhvcNAQcCoIIGXzCCBlsCAQExADALBgkqhkiG9w0BBwGgggZBMIID\n" +
++ "LzCCAhegAwIBAgIEIIgOyDANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtTb21l\n" +
++ "Q29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjUyNDJaFw0xNjA4MDcy\n" +
++ "MjUyNDJaMCkxFDASBgNVBAoTC1NvbWVDb21wYW55MREwDwYDVQQDEwhJbnRlcm1l\n" +
++ "ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJEecvTWla8kdWx+HHu5\n" +
++ "ryfBpJ95I7V4MEajnmzJVZcwvKhDjlDgABDMuVwFEUUSyeOdbWJF3DLKnyMDKTx6\n" +
++ "/58kuVak3NX2TJ8cmmIlKf1upFbdrEtjYViSnNrApprfO8B3ORdBbO6QDYzaIkAW\n" +
++ "dI5GllFnVkb4yhMUBg3zfhglF+bl3D3lVRlp9bCrUZoNRs+mZjhVbcMn22ejTfG5\n" +
++ "Y3VpNM4SN8dFIxPQLLk/aao+cmWEQdbQ0R6ydemRukqrw170olSVLeoGGala3D4o\n" +
++ "Jckde8EgNPcghcsdQ6tpGhkpFhmoyzEsuToR7Gq9UT5V2kkqJneiKXqQg4wzvMAl\n" +
++ "UGECAwEAAaNjMGEwHwYDVR0jBBgwFoAUOw+92bevFoJz96pR1DrAkPPUKb0wDwYD\n" +
++ "VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLbnErBsq/Mh\n" +
++ "ci5XElfjjLZp3GRyMA0GCSqGSIb3DQEBCwUAA4IBAQAq8y2DpkSV31IXZ1vr/Ye+\n" +
++ "Nj/2NvBydFeHVRGMAN1LJv6/Q42TCSXbr6cDQ4NWQUtPm90yZBYJSznkbShxHOJE\n" +
++ "E6R8PRJvoUtMm7fJrNtkybTt6jX4j50Lw8gdYB/rgZb4z8ZQZVEo/0zpW4HVGs+q\n" +
++ "4z8TkdmLR18hl39sUEsxt99AOBk8NtKKVNfBWq9b0QDhRkXfmqhyeXdDsHOV8ksu\n" +
++ "lsa7hseheHhdjziEOpQugh8qzSea2kFPrLB53VjWfa4qDzEPaNhahho9piCu82XD\n" +
++ "nOrcEk9KyHWM7sa7vtK7++W+0MXD/p9nkZ6NHrJXweLriU0DXO6ZY3mzNKJK435M\n" +
++ "MIIDCjCCAfKgAwIBAgIEdffjKTANBgkqhkiG9w0BAQsFADAlMRQwEgYDVQQKEwtT\n" +
++ "b21lQ29tcGFueTENMAsGA1UEAxMEUm9vdDAeFw0xNDA4MjgyMjQ2MzZaFw0xNjA4\n" +
++ "MjcyMjQ2MzZaMCUxFDASBgNVBAoTC1NvbWVDb21wYW55MQ0wCwYDVQQDEwRSb290\n" +
++ "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhnXc8Avv54Gk2xjVa2yA\n" +
++ "lBL/Cug1nyvKl5wqmN+foT6cMOX6bneCkJOJ4lSbch3gvl4ctlX/9hm3pB/+HhSr\n" +
++ "em2NcLQrLEq8l9Ar4RnqfoXQR4Uy+4P6wj9OcVV7e/v/+ZPnStOoEAtb5nAwsR2b\n" +
++ "hOC/tIFNwflrsmsmtMSoOiNftpYLFF4eOAdpDrXYMrqNu6ZxZsOQ7WZl4SsVOx1N\n" +
++ "/IINXwBLyoHJDzLZ0iJEV0O6mh846s0n6QXeK1P5d0uLcoZaZ1k8Q4sRcdoLA6rS\n" +
++ "e1WffipBFMvIuoDIigkHZIKVYRLG828rO+PFnRah0ybybkVsN6s3oLxfhswZDvut\n" +
++ "OwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV\n" +
++ "HQ4EFgQUOw+92bevFoJz96pR1DrAkPPUKb0wDQYJKoZIhvcNAQELBQADggEBACBN\n" +
++ "wEaV70FKKBINHtNwesd7TB6fgSaVgDZOO08aseHbXnm7AUhtDV3P5rQR2AsKtbg4\n" +
++ "COhlKw2/Ki18D4DfdCccFKFTRZBjqj2PxNmn6C68l1/bT4PuUXuM7rW++53RcOA7\n" +
++ "TbgLuzA25kSz7XinRvR8L4VwHtppu5tSYEthMIMgLZLGGV9r7kBfpY8lXdxQM8vb\n" +
++ "xZUIysasvVtVUFPOTV6g2dfn8QCoqLOmxyzTLdXe4M6acP6f7lmhgr3LMqDtB6K9\n" +
++ "pN+OImr77zNdZ+jTB+5e9a8gAvc5ZfG7Nk5RfwUatYTAFZ6Uggy2cKmIRpXCia18\n" +
++ "If78mc7goS1+lHkGCs2hADEA\n" +
++ "-----END PKCS7-----";
++
++ // Empty PKCS#7 in DER form can be created with openssl:
++ // openssl crl2pkcs7 -nocrl -outform DER
++ private static final byte[] PKCS7_BER_EMPTY = {
++ 48, 39, 6, 9, 42, -122, 72, -122,
++ -9, 13, 1, 7, 2, -96, 26, 48,
++ 24, 2, 1, 1, 49, 0, 48, 11,
++ 6, 9, 42, -122, 72, -122, -9, 13,
++ 1, 7, 1, -96, 0, -95, 0, 49,
++ 0
++ };
++
++ private static final String JTEST_ROOT_CRL =
++ "-----BEGIN X509 CRL-----\n" +
++ "MIICoTCBigIBATANBgkqhkiG9w0BAQsFADA1MQ4wDAYDVQQKEwVKVGVzdDELMAkG\n" +
++ "A1UECxMCSVQxFjAUBgNVBAMTDUpUZXN0IFJvb3QgQ0EXDTE0MDkwNDE4NDIyMVqg\n" +
++ "MDAuMB8GA1UdIwQYMBaAFO6bllCV6kctH77MfqAtefNeRdsmMAsGA1UdFAQEAgIA\n" +
++ "jjANBgkqhkiG9w0BAQsFAAOCAgEAmp8ihtiRthknDC+VzehmlQw5u8MftMZYQYk5\n" +
++ "EI04SwyzY9JTL8QHb4u7fXjnZAyN89aYPypI5OSyDsyyGP/JDNsBt2Um/fl0aaCl\n" +
++ "Z4Np6x+dB9+oIU1XY7y2+uyQUC5MHivQ5ddbGPoAvK/msbugTGAjHvZpM+l0okiV\n" +
++ "3SofDrii5BSosFEkXfkf2oG9ZLO3YamsFMEZaOj/eWDyGhTyJMGsq2/8NeTF21Tp\n" +
++ "YkeDcTHqR5KHoYXjOIaS7NjmErm+uDpKH9Lq+JUcYrbUhmjnq5z04EsPF2F2L7Vb\n" +
++ "THI+awQAUQit16lXGuz7fFRZi2vPyiaRP5n2QT5D+ac1dAs+oWLDJw6Tf2v9KVTe\n" +
++ "OmW62yd6zQqCwBg+n57UcNu3sv/Sq3t7iRuN0AmWlIhu659POPQv7Np6bEo6dIpp\n" +
++ "u7Ze6D2KPtM177ETHYlCx2a3g9VEZYKrVhQ2749St0Cp5szVq691jFZAWYOzcfEO\n" +
++ "XfK1y25pmlBjvhNIIVRlU+T5rjNb8GaleYKVYnKOcv700K32QxFzcPf7nbNKwW99\n" +
++ "tcaNHFNP+LW/XP8I3CJ8toXLLcOITKVwMA+0GlO5eL7eX5POc+vE9+7IzGuybmU4\n" +
++ "uslxoLdJ0NSZWpYmf6a6qrJ67cj5i3706H+eBsWQcShfSYreh+TyWQaGk+fkEiUV\n" +
++ "iy4QdJ0=\n" +
++ "-----END X509 CRL-----";
++
++ private static final String JTEST_INTERMED_CRL =
++ "-----BEGIN X509 CRL-----\n" +
++ "MIICzzCBuAIBATANBgkqhkiG9w0BAQsFADA/MQ4wDAYDVQQKEwVKVGVzdDELMAkG\n" +
++ "A1UECxMCSVQxIDAeBgNVBAMTF0pUZXN0IEludGVybWVkaWF0ZSBDQSAxFw0xNDA5\n" +
++ "MDQyMjE2NTRaMCIwIAIBBhcNMTQwOTA0MjIxNjU0WjAMMAoGA1UdFQQDCgEFoDAw\n" +
++ "LjAfBgNVHSMEGDAWgBSvRdjbkSMJ3A7s5H6EWghQ+lkw/zALBgNVHRQEBAICAJsw\n" +
++ "DQYJKoZIhvcNAQELBQADggIBALJmikMwil8oywhenoO8o9xxCOIU0xrt3KdfiSXw\n" +
++ "8MtQXZHT9d1C6tlLAsYkWAfmfTvM2OU6wquFCLLsFmDZszbbCqmn4JhYBSKQMqlm\n" +
++ "IHnsiOFPvITW2FU08fWNLM+FtQzPnTFmx/CJo+wfGpq5tZMIbsccsCJ5uvZVAWGh\n" +
++ "0KbPmYcJG/O384+kzr/2H2IaoZoMMABec5c5FEF/tpp8jawzY+0VFyaVrumKWdan\n" +
++ "+3OvRQxT1wLxfNi2vdxB2rmNPo423qanXZAoVv260um3LYlmXBNK1jwQ9lp78jkT\n" +
++ "B7zMVa4hOUWVxdWc/LE6fUYgPsNqZd+hWy/PolIRp5TS21B5hkc5K87LT59GkexK\n" +
++ "vNVKQennOLGtH+Q7htK4UeY4Gm/W7UydOQ0k7hZzyfMDkCfLfNfK0l63qKwUku36\n" +
++ "UdeI1LXqulPEvb/d7rRAAM9p5Sm+RsECj2bcrZBMdIGXcSo26A5tzZpTEC79i4S1\n" +
++ "yxYIooeBnouUkDJ9+VBsJTSKY5fpU8JSkQPRyHKt+trGAkBt2Ka5MqrHtITzQ1vP\n" +
++ "5q4tNr45JGEXllH83NlBpWURfsdtkDHa3lxTD/pkrywOCyzz7wQ22D8Kul7EN8nT\n" +
++ "7LDbN+O3G9GHICxvWlJHp6HMsqGTuH1MIUR+5uZFOJa1S0IzorUIEieLncDUPgzO\n" +
++ "M4JA\n" +
++ "-----END X509 CRL-----";
++
++ // PKCS#7 CRL Set containing JTEST root and intermediate CRLs
++ private static final String PKCS7_CRL_SET =
++ "-----BEGIN PKCS7-----\n" +
++ "MIIFpQYJKoZIhvcNAQcCoIIFljCCBZICAQExADALBgkqhkiG9w0BBwGgAKGCBXgw\n" +
++ "ggKhMIGKAgEBMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNVBAoTBUpUZXN0MQswCQYD\n" +
++ "VQQLEwJJVDEWMBQGA1UEAxMNSlRlc3QgUm9vdCBDQRcNMTQwOTA0MTg0MjIxWqAw\n" +
++ "MC4wHwYDVR0jBBgwFoAU7puWUJXqRy0fvsx+oC15815F2yYwCwYDVR0UBAQCAgCO\n" +
++ "MA0GCSqGSIb3DQEBCwUAA4ICAQCanyKG2JG2GScML5XN6GaVDDm7wx+0xlhBiTkQ\n" +
++ "jThLDLNj0lMvxAdvi7t9eOdkDI3z1pg/Kkjk5LIOzLIY/8kM2wG3ZSb9+XRpoKVn\n" +
++ "g2nrH50H36ghTVdjvLb67JBQLkweK9Dl11sY+gC8r+axu6BMYCMe9mkz6XSiSJXd\n" +
++ "Kh8OuKLkFKiwUSRd+R/agb1ks7dhqawUwRlo6P95YPIaFPIkwayrb/w15MXbVOli\n" +
++ "R4NxMepHkoehheM4hpLs2OYSub64Okof0ur4lRxittSGaOernPTgSw8XYXYvtVtM\n" +
++ "cj5rBABRCK3XqVca7Pt8VFmLa8/KJpE/mfZBPkP5pzV0Cz6hYsMnDpN/a/0pVN46\n" +
++ "ZbrbJ3rNCoLAGD6fntRw27ey/9Kre3uJG43QCZaUiG7rn0849C/s2npsSjp0imm7\n" +
++ "tl7oPYo+0zXvsRMdiULHZreD1URlgqtWFDbvj1K3QKnmzNWrr3WMVkBZg7Nx8Q5d\n" +
++ "8rXLbmmaUGO+E0ghVGVT5PmuM1vwZqV5gpVico5y/vTQrfZDEXNw9/uds0rBb321\n" +
++ "xo0cU0/4tb9c/wjcIny2hcstw4hMpXAwD7QaU7l4vt5fk85z68T37sjMa7JuZTi6\n" +
++ "yXGgt0nQ1JlaliZ/prqqsnrtyPmLfvTof54GxZBxKF9Jit6H5PJZBoaT5+QSJRWL\n" +
++ "LhB0nTCCAs8wgbgCAQEwDQYJKoZIhvcNAQELBQAwPzEOMAwGA1UEChMFSlRlc3Qx\n" +
++ "CzAJBgNVBAsTAklUMSAwHgYDVQQDExdKVGVzdCBJbnRlcm1lZGlhdGUgQ0EgMRcN\n" +
++ "MTQwOTA0MjIxNjU0WjAiMCACAQYXDTE0MDkwNDIyMTY1NFowDDAKBgNVHRUEAwoB\n" +
++ "BaAwMC4wHwYDVR0jBBgwFoAUr0XY25EjCdwO7OR+hFoIUPpZMP8wCwYDVR0UBAQC\n" +
++ "AgCbMA0GCSqGSIb3DQEBCwUAA4ICAQCyZopDMIpfKMsIXp6DvKPccQjiFNMa7dyn\n" +
++ "X4kl8PDLUF2R0/XdQurZSwLGJFgH5n07zNjlOsKrhQiy7BZg2bM22wqpp+CYWAUi\n" +
++ "kDKpZiB57IjhT7yE1thVNPH1jSzPhbUMz50xZsfwiaPsHxqaubWTCG7HHLAiebr2\n" +
++ "VQFhodCmz5mHCRvzt/OPpM6/9h9iGqGaDDAAXnOXORRBf7aafI2sM2PtFRcmla7p\n" +
++ "ilnWp/tzr0UMU9cC8XzYtr3cQdq5jT6ONt6mp12QKFb9utLpty2JZlwTStY8EPZa\n" +
++ "e/I5Ewe8zFWuITlFlcXVnPyxOn1GID7DamXfoVsvz6JSEaeU0ttQeYZHOSvOy0+f\n" +
++ "RpHsSrzVSkHp5zixrR/kO4bSuFHmOBpv1u1MnTkNJO4Wc8nzA5Any3zXytJet6is\n" +
++ "FJLt+lHXiNS16rpTxL2/3e60QADPaeUpvkbBAo9m3K2QTHSBl3EqNugObc2aUxAu\n" +
++ "/YuEtcsWCKKHgZ6LlJAyfflQbCU0imOX6VPCUpED0chyrfraxgJAbdimuTKqx7SE\n" +
++ "80Nbz+auLTa+OSRhF5ZR/NzZQaVlEX7HbZAx2t5cUw/6ZK8sDgss8+8ENtg/Crpe\n" +
++ "xDfJ0+yw2zfjtxvRhyAsb1pSR6ehzLKhk7h9TCFEfubmRTiWtUtCM6K1CBIni53A\n" +
++ "1D4MzjOCQDEA\n" +
++ "-----END PKCS7-----";
++
+ public static void main(String[] args) throws Exception {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+- File f = new File
+- (System.getProperty("test.src", "."), "invalidcert.pem");
+- InputStream inStream = new FileInputStream(f);
+- try {
+- X509Certificate cert =
+- (X509Certificate) cf.generateCertificate(inStream);
+- } catch (CertificateParsingException ce) {
+- return;
++ List<DecodeTest> validTests = new LinkedList<>();
++ List<DecodeTest> invalidTests = new LinkedList<>();
++
++ // Load up positive test cases (for sanity checks)
++ StringBuilder sb = new StringBuilder();
++
++ validTests.add(new GenMultiCertTest("Single, valid certificate",
++ SINGLE_ROOT_CERT.getBytes(), null,
++ new X500Principal("CN=Root, O=SomeCompany")));
++ validTests.add(new GenMultiCertTest("PEM-encoded PKCS#7 chain",
++ PKCS7_INTERMED_ROOT_CERTS.getBytes(), null,
++ new X500Principal("CN=Intermed, O=SomeCompany"),
++ new X500Principal("CN=Root, O=SomeCompany")));
++ validTests.add(new GenMultiCertTest("Two PEM-encoded X509 certs",
++ (INTERMED_CA_CERT + "\n" + SINGLE_ROOT_CERT).getBytes(),
++ null,
++ new X500Principal("CN=Intermed, O=SomeCompany"),
++ new X500Principal("CN=Root, O=SomeCompany")));
++ validTests.add(new GenMultiCertTest("Empty data", new byte[0], null));
++
++ sb.append("Certificate 1: CN=Root, O=SomeCompany\n");
++ sb.append(SINGLE_ROOT_CERT).append("\n");
++ sb.append("Certificate 2: CN=Intermed, O=SomeCompany\n");
++ sb.append(INTERMED_CA_CERT).append("\n");
++ sb.append("Extra trailing data\n");
++ validTests.add(new GenMultiCertTest(
++ "Two PEM-encoded certs with leading/trailing " +
++ "text data around each.", sb.toString().getBytes(), null,
++ new X500Principal("CN=Root, O=SomeCompany"),
++ new X500Principal("CN=Intermed, O=SomeCompany")));
++ validTests.add(new GenMultiCertTest(
++ "BER-encoded PKCS#7 with empty certificates segment",
++ PKCS7_BER_EMPTY, null));
++ validTests.add(new GenMultiCRLTest(
++ "CRL with leading and trailing text data",
++ ("This is a CRL\n" + JTEST_ROOT_CRL +
++ "\nSee? Told you so\n\n").getBytes(), null,
++ new X500Principal("CN=JTest Root CA,OU=IT,O=JTest")));
++ validTests.add(new GenMultiCRLTest(
++ "Two CRLs, one after the other with leading/trailing text",
++ ("This is a CRL\n" + JTEST_ROOT_CRL +
++ "\nAnd this is another CRL\n" + JTEST_INTERMED_CRL +
++ "\nAnd this is trailing text\n").getBytes(), null,
++ new X500Principal("CN=JTest Root CA,OU=IT,O=JTest"),
++ new X500Principal(
++ "CN=JTest Intermediate CA 1,OU=IT,O=JTest")));
++ validTests.add(new GenMultiCRLTest("Two CRLs in a PKCS#7 CRL set",
++ PKCS7_CRL_SET.getBytes(), null,
++ new X500Principal("CN=JTest Root CA,OU=IT,O=JTest"),
++ new X500Principal("CN=JTest Intermediate CA 1,OU=IT,O=JTest")));
++
++ // Load up all test cases where we expect failures
++ invalidTests.add(new GenSingleCertTest("Invalid PEM encoding",
++ INVALID_CERT.getBytes(),
++ new CertificateParsingException()));
++ invalidTests.add(new GenMultiCertTest("Invalid PEM encoding",
++ INVALID_CERT.getBytes(),
++ new CertificateParsingException()));
++ invalidTests.add(new GenMultiCertTest(
++ "Two cert sequence, one valid and one invalid",
++ (INTERMED_CA_CERT + "\n" + INVALID_CERT).getBytes(),
++ new CertificateParsingException()));
++ invalidTests.add(new GenMultiCertTest("Non-certificate text",
++ "This is not a certificate".getBytes(),
++ new CertificateException()));
++ invalidTests.add(new GenMultiCertTest(
++ "Non-certificate text with partial PEM header (4 hyphens)",
++ "----This is not a valid x509 certificate".getBytes(),
++ new CertificateException()));
++ invalidTests.add(new GenMultiCertTest(
++ "Leading non-certificate text plus valid PEM header, " +
++ "but not on new line",
++ "This is not valid -----BEGIN CERTIFICATE-----".getBytes(),
++ new CertificateException()));
++ byte[] emptyCString = {0};
++ invalidTests.add(new GenMultiCertTest("Empty C-style string",
++ emptyCString, new CertificateException()));
++ invalidTests.add(new GenMultiCRLTest("Non-CRL text",
++ "This is not a CRL".getBytes(), new CRLException()));
++ invalidTests.add(new GenMultiCRLTest("Valid headers, but not a CRL",
++ INTERMED_CA_CERT.getBytes(), new CRLException()));
++
++ System.out.println("===== Valid Tests =====");
++ for (DecodeTest dt : validTests) {
++ dt.passTest();
+ }
+- throw new Exception("CertificateFactory.generateCertificate() did not "
+- + "throw CertificateParsingException on invalid X.509 cert data");
++ System.out.print("\n");
++
++ System.out.println("===== Invalid Tests =====");
++ for (DecodeTest dt : invalidTests) {
++ dt.failTest();
++ }
++ }
++
++ public static abstract class DecodeTest {
++ protected String testName;
++ protected byte[] testData;
++ protected Throwable expectedException;
++ protected X500Principal[] principals;
++ protected CertificateFactory cf;
++
++ /**
++ * Construct a DecodeTest
++ *
++ * @param name The test name
++ * @param input A byte array consisting of the input for this test
++ * @param failType An exception whose class should match the expected
++ * exception that will be thrown when this test is run
++ * @param princs Zero of more X500Principals which will be used
++ * to compare the output in a success case.
++ */
++ DecodeTest(String name, byte[] input, Throwable failType,
++ X500Principal... princs) throws CertificateException {
++ testName = name;
++ testData = input.clone();
++ expectedException = failType;
++ principals = princs;
++ cf = CertificateFactory.getInstance("X.509");
++ }
++
++ public abstract void passTest() throws GeneralSecurityException;
++
++ public abstract void failTest() throws GeneralSecurityException;
++ }
++
++ public static class GenMultiCertTest extends DecodeTest {
++ public GenMultiCertTest(String name, byte[] input, Throwable failType,
++ X500Principal... princs) throws CertificateException {
++ super(name, input, failType, princs);
++ }
++
++ @Override
++ public void passTest() throws GeneralSecurityException {
++ Collection<? extends Certificate> certs;
++
++ System.out.println("generateCertificates(): " + testName);
++ certs = cf.generateCertificates(new ByteArrayInputStream(testData));
++
++ // Walk the certs Collection and do a comparison of subject names
++ int i = 0;
++ if (certs.size() == principals.length) {
++ for (Certificate crt : certs) {
++ X509Certificate xc = (X509Certificate)crt;
++ if (!xc.getSubjectX500Principal().equals(
++ principals[i])) {
++ throw new RuntimeException("Name mismatch: " +
++ "cert: " + xc.getSubjectX500Principal() +
++ ", expected: " + principals[i]);
++ }
++ i++;
++ }
++ } else {
++ throw new RuntimeException("Size mismatch: certs = " +
++ certs.size() + ", expected = " +
++ principals.length);
++ }
++ }
++
++ @Override
++ public void failTest() throws GeneralSecurityException {
++ Throwable caughtException = null;
++ Collection<? extends Certificate> certs = null;
++
++ System.out.println("generateCertificates(): " + testName);
++ if (expectedException == null) {
++ throw new RuntimeException("failTest requires non-null " +
++ "expectedException");
++ }
++
++ try {
++ certs =
++ cf.generateCertificates(new ByteArrayInputStream(testData));
++ } catch (CertificateException ce) {
++ caughtException = ce;
++ }
++
++ if (caughtException != null) {
++ // It has to be the right kind of exception though...
++ if (!caughtException.getClass().equals(
++ expectedException.getClass())) {
++ System.err.println("Unexpected exception thrown. " +
++ "Received: " + caughtException + ", Expected: " +
++ expectedException.getClass());
++ throw new RuntimeException(caughtException);
++ }
++ } else {
++ // For a failure test, we'd expect some kind of exception
++ // to be thrown.
++ throw new RuntimeException("Failed to catch expected " +
++ "exception " + expectedException.getClass());
++ }
++ }
++ }
++
++ public static class GenSingleCertTest extends DecodeTest {
++ public GenSingleCertTest(String name, byte[] input, Throwable failType,
++ X500Principal... princs) throws CertificateException {
++ super(name, input, failType, princs);
++ }
++
++ @Override
++ public void passTest() throws GeneralSecurityException {
++ X509Certificate cert;
++
++ System.out.println("generateCertificate(): " + testName);
++ cert = (X509Certificate)cf.generateCertificate(
++ new ByteArrayInputStream(testData));
++
++ // Compare the cert's subject name against the expected value
++ // provided in the test. If multiple X500Principals were provided
++ // just use the first one as the expected value.
++ if (!cert.getSubjectX500Principal().equals(principals[0])) {
++ throw new RuntimeException("Name mismatch: " +
++ "cert: " + cert.getSubjectX500Principal() +
++ ", expected: " + principals[0]);
++ }
++ }
++
++ @Override
++ public void failTest() throws GeneralSecurityException {
++ Throwable caughtException = null;
++ X509Certificate cert = null;
++ System.out.println("generateCertificate(): " + testName);
++
++ if (expectedException == null) {
++ throw new RuntimeException("failTest requires non-null " +
++ "expectedException");
++ }
++
++ try {
++ cert = (X509Certificate)cf.generateCertificate(
++ new ByteArrayInputStream(testData));
++ } catch (CertificateException e) {
++ caughtException = e;
++ }
++
++ if (caughtException != null) {
++ // It has to be the right kind of exception though...
++ if (!caughtException.getClass().equals(
++ expectedException.getClass())) {
++ System.err.println("Unexpected exception thrown. " +
++ "Received: " + caughtException + ", Expected: " +
++ expectedException.getClass());
++ throw new RuntimeException(caughtException);
++ }
++ } else {
++ // For a failure test, we'd expect some kind of exception
++ // to be thrown.
++ throw new RuntimeException("Failed to catch expected " +
++ "exception " + expectedException.getClass());
++ }
++ }
++ }
++
++ public static class GenMultiCRLTest extends DecodeTest {
++ public GenMultiCRLTest(String name, byte[] input, Throwable failType,
++ X500Principal... princs) throws CertificateException {
++ super(name, input, failType, princs);
++ }
++
++ @Override
++ public void passTest() throws GeneralSecurityException {
++ Collection<? extends CRL> crls;
++
++ System.out.println("generateCRLs(): " + testName);
++ crls = cf.generateCRLs(new ByteArrayInputStream(testData));
++
++ // Walk the crls Collection and do a comparison of issuer names
++ int i = 0;
++ if (crls.size() == principals.length) {
++ for (CRL revlist : crls) {
++ X509CRL xc = (X509CRL)revlist;
++ if (!xc.getIssuerX500Principal().equals(principals[i])) {
++ throw new RuntimeException("Name mismatch: " +
++ "CRL: " + xc.getIssuerX500Principal() +
++ ", expected: " + principals[i]);
++ }
++ i++;
++ }
++ } else {
++ throw new RuntimeException("Size mismatch: crls = " +
++ crls.size() + ", expected = " +
++ principals.length);
++ }
++ }
++
++ @Override
++ public void failTest() throws GeneralSecurityException {
++ Throwable caughtException = null;
++ Collection<? extends CRL> crls = null;
++
++ System.out.println("generateCRLs(): " + testName);
++ if (expectedException == null) {
++ throw new RuntimeException("failTest requires non-null " +
++ "expectedException");
++ }
++
++ try {
++ crls =
++ cf.generateCRLs(new ByteArrayInputStream(testData));
++ } catch (CRLException e) {
++ caughtException = e;
++ }
++
++ if (caughtException != null) {
++ // It has to be the right kind of exception though...
++ if (!caughtException.getClass().equals(
++ expectedException.getClass())) {
++ System.err.println("Unexpected exception thrown. " +
++ "Received: " + caughtException + ", Expected: " +
++ expectedException.getClass());
++ throw new RuntimeException(caughtException);
++ }
++ } else {
++ // For a failure test, we'd expect some kind of exception
++ // to be thrown.
++ throw new RuntimeException("Failed to catch expected " +
++ "exception " + expectedException.getClass());
++ }
++ }
+ }
+ }
+--- ./jdk/test/java/security/cert/CertificateFactory/invalidEncodedCerts/invalidcert.pem Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,14 +0,0 @@
+------BEGIN CERTIFICATE-----
+-XIICJjCCAdCgAwIBAgIBITANBgkqhkiG9w0BAQQFADCBqTELMAkGA1UEBhMCVVMx
+-EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xFTAT
+-BgNVBAoTDEJFQSBXZWJMb2dpYzERMA8GA1UECxMIU2VjdXJpdHkxIzAhBgNVBAMT
+-GkRlbW8gQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9zdXBw
+-b3J0QGJlYS5jb20wHhcNMDAwNTMwMjEzODAxWhcNMDQwNTEzMjEzODAxWjCBjDEL
+-MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
+-cmFuY2lzY28xFTATBgNVBAoTDEJFQSBXZWJMb2dpYzEZMBcGA1UEAxMQd2VibG9n
+-aWMuYmVhLmNvbTEeMBwGCSqGSIb3DQEJARYPc3VwcG9ydEBiZWEuY29tMFwwDQYJ
+-KoZIhvcNAQEBBQADSwAwSAJBALdsXEHqKHgs6zj0hU5sXMAUHzoT8kgWXmNkKHXH
+-79qbPh6EfdlriW9G/AbRF/pKrCQu7hhllAxREbqTuSlf2EMCAwEAATANBgkqhkiG
+-9w0BAQQFAANBACgmqflL5m5LNeJGpWx9aIoABCiuDcpw1fFyegsqGX7CBhffcruS
+-1p8h5vkHVbMu1frD1UgGnPlOO/K7Ig/KrsU=
+------END CERTIFICATE-----
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,400 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.lang.management.ManagementFactory;
++import java.lang.management.ThreadInfo;
++import java.security.CodeSource;
++import java.security.Permission;
++import java.security.PermissionCollection;
++import java.security.Permissions;
++import java.security.Policy;
++import java.security.ProtectionDomain;
++import java.util.Enumeration;
++import java.util.concurrent.Semaphore;
++import java.util.concurrent.atomic.AtomicBoolean;
++import java.util.concurrent.atomic.AtomicInteger;
++import java.util.logging.LogManager;
++import java.util.logging.Logger;
++
++/**
++ * @test
++ * @bug 8065991 8071591
++ * @summary check that when LogManager is initialized, a deadlock similar
++ * to that described in 8065709 will not occur.
++ * @run main/othervm LogManagerAppContextDeadlock UNSECURE
++ * @run main/othervm LogManagerAppContextDeadlock SECURE
++ *
++ * @author danielfuchs
++ */
++public class LogManagerAppContextDeadlock {
++
++ public static final Semaphore sem = new Semaphore(0);
++ public static final Semaphore sem2 = new Semaphore(0);
++ public static final Semaphore sem3 = new Semaphore(-2);
++ public static volatile boolean goOn = true;
++ public static volatile Exception thrown;
++
++ // Emulate EventQueue
++ static class FakeEventQueue {
++ static final Logger logger = Logger.getLogger("foo");
++ }
++
++ // Emulate AppContext
++ static class FakeAppContext {
++
++ final static AtomicInteger numAppContexts = new AtomicInteger(0);
++ static final class FakeAppContextLock {}
++ static final FakeAppContextLock lock = new FakeAppContextLock();
++ static volatile FakeAppContext appContext;
++
++ final FakeEventQueue queue;
++ FakeAppContext() {
++ appContext = this;
++ numAppContexts.incrementAndGet();
++ // release sem2 to let Thread t2 call Logger.getLogger().
++ sem2.release();
++ try {
++ // Wait until we JavaAWTAccess is called by LogManager.
++ // Thread 2 will call Logger.getLogger() which will
++ // trigger a call to JavaAWTAccess - which will release
++ // sem, thus ensuring that Thread #2 is where we want it.
++ sem.acquire();
++ System.out.println("Sem acquired: Thread #2 has called JavaAWTAccess");
++ } catch(InterruptedException x) {
++ Thread.interrupted();
++ }
++ queue = new FakeEventQueue();
++ }
++
++ static FakeAppContext getAppContext() {
++ synchronized (lock) {
++ if (numAppContexts.get() == 0) {
++ return new FakeAppContext();
++ }
++ return appContext;
++ }
++ }
++
++ static {
++ sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
++ @Override
++ public Object getAppletContext() {
++ if (numAppContexts.get() == 0) return null;
++ // We are in JavaAWTAccess, we can release sem and let
++ // FakeAppContext constructor proceeed.
++ System.out.println("Releasing Sem");
++ sem.release();
++ return getAppContext();
++ }
++
++ @Override
++ public Object get(Object key) {
++ return null;
++ }
++
++ @Override
++ public void put(Object key, Object value) {
++
++ }
++
++ @Override
++ public void remove(Object key) {
++
++ }
++
++ @Override
++ public boolean isDisposed() {
++ return false;
++ }
++
++ @Override
++ public boolean isMainAppContext() {
++ return false;
++ }
++
++ });
++ }
++
++ }
++
++
++ // Test with or without a security manager
++ public static enum TestCase {
++ UNSECURE, SECURE;
++ public void run() throws Exception {
++ System.out.println("Running test case: " + name());
++ Configure.setUp(this);
++ test(this);
++ }
++ }
++
++ public static void test(final TestCase test) throws Exception {
++ Thread t1 = new Thread() {
++ @Override
++ public void run() {
++ sem3.release();
++ System.out.println("FakeAppContext.getAppContext()");
++ FakeAppContext.getAppContext();
++ System.out.println("Done: FakeAppContext.getAppContext()");
++ }
++ };
++ t1.setDaemon(true);
++ t1.start();
++ Thread t2 = new Thread() {
++ public void run() {
++ sem3.release();
++ try {
++ // Wait until Thread1 is in FakeAppContext constructor
++ sem2.acquire();
++ System.out.println("Sem2 acquired: Thread #1 will be waiting to acquire Sem");
++ } catch (InterruptedException ie) {
++ Thread.interrupted();
++ }
++ System.out.println("Logger.getLogger(name).info(name)");
++ Logger.getLogger(test.name());//.info(name);
++ System.out.println("Done: Logger.getLogger(name).info(name)");
++ }
++ };
++ t2.setDaemon(true);
++ t2.start();
++ System.out.println("Should exit now...");
++ Thread detector = new DeadlockDetector();
++ detector.start();
++
++ // Wait for the 3 threads to start
++ sem3.acquire();
++
++ // Now wait for t1 & t2 to finish, or for a deadlock to be detected.
++ while (goOn && (t1.isAlive() || t2.isAlive())) {
++ if (t2.isAlive()) t2.join(1000);
++ if (test == TestCase.UNSECURE && System.getSecurityManager() == null) {
++ // if there's no security manager, AppContext.getAppContext() is
++ // not called - so Thread t2 will not end up calling
++ // sem.release(). In that case we must release the semaphore here
++ // so that t1 can proceed.
++ if (LogManager.getLogManager().getLogger(TestCase.UNSECURE.name()) != null) {
++ // means Thread t2 has created the logger
++ sem.release();
++ }
++ }
++ if (t1.isAlive()) t1.join(1000);
++ }
++ if (thrown != null) {
++ throw thrown;
++ }
++ }
++
++ // Thrown by the deadlock detector
++ static final class DeadlockException extends RuntimeException {
++ public DeadlockException(String message) {
++ super(message);
++ }
++ @Override
++ public void printStackTrace() {
++ }
++ }
++
++ public static void main(String[] args) throws Exception {
++
++ if (args.length == 0) {
++ args = new String[] { "SECURE" };
++ }
++
++ // If we don't initialize LogManager here, there will be
++ // a deadlock.
++ // See <https://bugs.openjdk.java.net/browse/JDK-8065709?focusedCommentId=13582038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13582038>
++ // for more details.
++ Logger.getLogger("main").info("starting...");
++ try {
++ TestCase.valueOf(args[0]).run();
++ System.out.println("Test "+args[0]+" Passed");
++ } catch(Throwable t) {
++ System.err.println("Test " + args[0] +" failed: " + t);
++ t.printStackTrace();
++ }
++ }
++
++ // Called by the deadlock detector when a deadlock is found.
++ static void fail(Exception x) {
++ x.printStackTrace();
++ if (thrown == null) {
++ thrown = x;
++ }
++ goOn = false;
++ }
++
++ // A thread that detect deadlocks.
++ final static class DeadlockDetector extends Thread {
++
++ public DeadlockDetector() {
++ this.setDaemon(true);
++ }
++
++ @Override
++ public void run() {
++ sem3.release();
++ Configure.doPrivileged(new Runnable() {
++ @Override
++ public void run() {
++ DeadlockDetector.this.loop();
++ }
++ });
++ }
++ public void loop() {
++ while(goOn) {
++ try {
++ long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
++ ids = ids == null ? new long[0] : ids;
++ if (ids.length == 1) {
++ throw new RuntimeException("Found 1 deadlocked thread: "+ids[0]);
++ } else if (ids.length > 0) {
++ ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(ids, Integer.MAX_VALUE);
++ System.err.println("Found "+ids.length+" deadlocked threads: ");
++ for (ThreadInfo inf : infos) {
++ System.err.println(inf);
++ }
++ throw new DeadlockException("Found "+ids.length+" deadlocked threads");
++ }
++ Thread.sleep(100);
++ } catch(InterruptedException | RuntimeException x) {
++ fail(x);
++ }
++ }
++ }
++
++ }
++
++ // A helper class to configure the security manager for the test,
++ // and bypass it when needed.
++ static class Configure {
++ static Policy policy = null;
++ static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
++ @Override
++ protected AtomicBoolean initialValue() {
++ return new AtomicBoolean(false);
++ }
++ };
++ static void setUp(TestCase test) {
++ switch (test) {
++ case SECURE:
++ if (policy == null && System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ } else if (policy == null) {
++ policy = new SimplePolicy(TestCase.SECURE, allowAll);
++ Policy.setPolicy(policy);
++ System.setSecurityManager(new SecurityManager());
++ }
++ if (System.getSecurityManager() == null) {
++ throw new IllegalStateException("No SecurityManager.");
++ }
++ if (policy == null) {
++ throw new IllegalStateException("policy not configured");
++ }
++ break;
++ case UNSECURE:
++ if (System.getSecurityManager() != null) {
++ throw new IllegalStateException("SecurityManager already set");
++ }
++ break;
++ default:
++ new InternalError("No such testcase: " + test);
++ }
++ }
++ static void doPrivileged(Runnable run) {
++ allowAll.get().set(true);
++ try {
++ run.run();
++ } finally {
++ allowAll.get().set(false);
++ }
++ }
++ }
++
++ // A Helper class to build a set of permissions.
++ final static class PermissionsBuilder {
++ final Permissions perms;
++ public PermissionsBuilder() {
++ this(new Permissions());
++ }
++ public PermissionsBuilder(Permissions perms) {
++ this.perms = perms;
++ }
++ public PermissionsBuilder add(Permission p) {
++ perms.add(p);
++ return this;
++ }
++ public PermissionsBuilder addAll(PermissionCollection col) {
++ if (col != null) {
++ for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
++ perms.add(e.nextElement());
++ }
++ }
++ return this;
++ }
++ public Permissions toPermissions() {
++ final PermissionsBuilder builder = new PermissionsBuilder();
++ builder.addAll(perms);
++ return builder.perms;
++ }
++ }
++
++ // Policy for the test...
++ public static class SimplePolicy extends Policy {
++
++ final Permissions permissions;
++ final Permissions allPermissions;
++ final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
++ public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
++ this.allowAll = allowAll;
++ // we don't actually need any permission to create our
++ // FileHandlers because we're passing invalid parameters
++ // which will make the creation fail...
++ permissions = new Permissions();
++ permissions.add(new RuntimePermission("accessClassInPackage.sun.misc"));
++
++ // these are used for configuring the test itself...
++ allPermissions = new Permissions();
++ allPermissions.add(new java.security.AllPermission());
++
++ }
++
++ @Override
++ public boolean implies(ProtectionDomain domain, Permission permission) {
++ if (allowAll.get().get()) return allPermissions.implies(permission);
++ return permissions.implies(permission);
++ }
++
++ @Override
++ public PermissionCollection getPermissions(CodeSource codesource) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++
++ @Override
++ public PermissionCollection getPermissions(ProtectionDomain domain) {
++ return new PermissionsBuilder().addAll(allowAll.get().get()
++ ? allPermissions : permissions).toPermissions();
++ }
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/net/ssl/TLSv12/ProtocolFilter.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,318 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++
++// SunJSSE does not support dynamic system properties, no way to re-use
++// system properties in samevm/agentvm mode.
++
++/*
++ * @test
++ * @bug 8052406
++ * @summary SSLv2Hello protocol may be filter out unexpectedly
++ * @run main/othervm ProtocolFilter
++ */
++
++import java.io.*;
++import java.net.*;
++import javax.net.ssl.*;
++
++public class ProtocolFilter {
++
++ /*
++ * =============================================================
++ * Set the various variables needed for the tests, then
++ * specify what tests to run on each side.
++ */
++
++ /*
++ * Should we run the client or server in a separate thread?
++ * Both sides can throw exceptions, but do you have a preference
++ * as to which side should be the main thread.
++ */
++ static boolean separateServerThread = false;
++
++ /*
++ * Where do we find the keystores?
++ */
++ static String pathToStores = "../../../../sun/security/ssl/etc";
++ static String keyStoreFile = "keystore";
++ static String trustStoreFile = "truststore";
++ static String passwd = "passphrase";
++
++ /*
++ * Is the server ready to serve?
++ */
++ volatile static boolean serverReady = false;
++
++ /*
++ * Turn on SSL debugging?
++ */
++ static boolean debug = false;
++
++ /*
++ * If the client or server is doing some kind of object creation
++ * that the other side depends on, and that thread prematurely
++ * exits, you may experience a hang. The test harness will
++ * terminate all hung threads after its timeout has expired,
++ * currently 3 minutes by default, but you might try to be
++ * smart about it....
++ */
++
++ /*
++ * Define the server side of the test.
++ *
++ * If the server prematurely exits, serverReady will be set to true
++ * to avoid infinite hangs.
++ */
++ void doServerSide() throws Exception {
++ SSLServerSocketFactory sslssf =
++ (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
++ SSLServerSocket sslServerSocket =
++ (SSLServerSocket) sslssf.createServerSocket(serverPort);
++
++ // Only enable cipher suites for TLS v1.2.
++ sslServerSocket.setEnabledCipherSuites(
++ new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA256"});
++
++ serverPort = sslServerSocket.getLocalPort();
++
++ /*
++ * Signal Client, we're ready for his connect.
++ */
++ serverReady = true;
++
++ SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
++ InputStream sslIS = sslSocket.getInputStream();
++ OutputStream sslOS = sslSocket.getOutputStream();
++
++ sslIS.read();
++ sslOS.write(85);
++ sslOS.flush();
++
++ sslSocket.close();
++ }
++
++ /*
++ * Define the client side of the test.
++ *
++ * If the server prematurely exits, serverReady will be set to true
++ * to avoid infinite hangs.
++ */
++ void doClientSide() throws Exception {
++
++ /*
++ * Wait for server to get started.
++ */
++ while (!serverReady) {
++ Thread.sleep(50);
++ }
++
++ SSLSocketFactory sslsf =
++ (SSLSocketFactory) SSLSocketFactory.getDefault();
++ SSLSocket sslSocket = (SSLSocket)
++ sslsf.createSocket("localhost", serverPort);
++
++ // Enable all supported protocols, including SSLv2Hello.
++ sslSocket.setEnabledProtocols(sslSocket.getSupportedProtocols());
++
++ String[] ciphers = sslSocket.getSupportedCipherSuites();
++ sslSocket.setEnabledCipherSuites(ciphers);
++
++ InputStream sslIS = sslSocket.getInputStream();
++ OutputStream sslOS = sslSocket.getOutputStream();
++
++ sslOS.write(280);
++ sslOS.flush();
++ sslIS.read();
++
++ sslSocket.close();
++ }
++
++ /*
++ * =============================================================
++ * The remainder is just support stuff
++ */
++
++ // use any free port by default
++ volatile int serverPort = 0;
++
++ volatile Exception serverException = null;
++ volatile Exception clientException = null;
++
++ public static void main(String[] args) throws Exception {
++ String keyFilename =
++ System.getProperty("test.src", ".") + "/" + pathToStores +
++ "/" + keyStoreFile;
++ String trustFilename =
++ System.getProperty("test.src", ".") + "/" + pathToStores +
++ "/" + trustStoreFile;
++
++ System.setProperty("javax.net.ssl.keyStore", keyFilename);
++ System.setProperty("javax.net.ssl.keyStorePassword", passwd);
++ System.setProperty("javax.net.ssl.trustStore", trustFilename);
++ System.setProperty("javax.net.ssl.trustStorePassword", passwd);
++
++ if (debug)
++ System.setProperty("javax.net.debug", "all");
++
++ /*
++ * Start the tests.
++ */
++ new ProtocolFilter();
++ }
++
++ Thread clientThread = null;
++ Thread serverThread = null;
++
++ /*
++ * Primary constructor, used to drive remainder of the test.
++ *
++ * Fork off the other side, then do your work.
++ */
++ ProtocolFilter() throws Exception {
++ Exception startException = null;
++ try {
++ if (separateServerThread) {
++ startServer(true);
++ startClient(false);
++ } else {
++ startClient(true);
++ startServer(false);
++ }
++ } catch (Exception e) {
++ startException = e;
++ }
++
++ /*
++ * Wait for other side to close down.
++ */
++ if (separateServerThread) {
++ if (serverThread != null) {
++ serverThread.join();
++ }
++ } else {
++ if (clientThread != null) {
++ clientThread.join();
++ }
++ }
++
++ /*
++ * When we get here, the test is pretty much over.
++ * Which side threw the error?
++ */
++ Exception local;
++ Exception remote;
++
++ if (separateServerThread) {
++ remote = serverException;
++ local = clientException;
++ } else {
++ remote = clientException;
++ local = serverException;
++ }
++
++ Exception exception = null;
++
++ /*
++ * Check various exception conditions.
++ */
++ if ((local != null) && (remote != null)) {
++ // If both failed, return the curthread's exception.
++ local.initCause(remote);
++ exception = local;
++ } else if (local != null) {
++ exception = local;
++ } else if (remote != null) {
++ exception = remote;
++ } else if (startException != null) {
++ exception = startException;
++ }
++
++ /*
++ * If there was an exception *AND* a startException,
++ * output it.
++ */
++ if (exception != null) {
++ if (exception != startException && startException != null) {
++ exception.addSuppressed(startException);
++ }
++ throw exception;
++ }
++
++ // Fall-through: no exception to throw!
++ }
++
++ void startServer(boolean newThread) throws Exception {
++ if (newThread) {
++ serverThread = new Thread() {
++ public void run() {
++ try {
++ doServerSide();
++ } catch (Exception e) {
++ /*
++ * Our server thread just died.
++ *
++ * Release the client, if not active already...
++ */
++ System.err.println("Server died...");
++ serverReady = true;
++ serverException = e;
++ }
++ }
++ };
++ serverThread.start();
++ } else {
++ try {
++ doServerSide();
++ } catch (Exception e) {
++ serverException = e;
++ } finally {
++ serverReady = true;
++ }
++ }
++ }
++
++ void startClient(boolean newThread) throws Exception {
++ if (newThread) {
++ clientThread = new Thread() {
++ public void run() {
++ try {
++ doClientSide();
++ } catch (Exception e) {
++ /*
++ * Our client thread just died.
++ */
++ System.err.println("Client died...");
++ clientException = e;
++ }
++ }
++ };
++ clientThread.start();
++ } else {
++ try {
++ doClientSide();
++ } catch (Exception e) {
++ clientException = e;
++ }
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/JColorChooser/8065098/JColorChooserDnDTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,54 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++import javax.swing.BorderFactory;
++import javax.swing.JColorChooser;
++import javax.swing.JFrame;
++import javax.swing.JPanel;
++import javax.swing.SwingUtilities;
++
++/*
++ * @bug 8065098
++ * @summary JColorChooser no longer supports drag and drop
++ * between two JVM instances
++ */
++public class JColorChooserDnDTest {
++
++ public static void main(String[] args) {
++ SwingUtilities.invokeLater(new Runnable() {
++
++ @Override
++ public void run() {
++ JFrame frame = new JFrame();
++ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
++ JPanel panel = new JPanel();
++ JColorChooser colorChooser = new JColorChooser();
++ colorChooser.setDragEnabled(true);
++ panel.setBorder(BorderFactory.createTitledBorder("JColorChoosers"));
++ panel.add(colorChooser);
++ frame.setContentPane(panel);
++ frame.pack();
++ frame.setVisible(true);
++ }
++ });
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/JColorChooser/8065098/bug8065098.html Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,40 @@
++<!--
++ Copyright (c) 2014, 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.
++-->
++
++<html>
++ <body>
++ 1. Compile the java test JColorChooserDnDTest.java:
++ > <path-to-the-tested-jdk>/bin/javac JColorChooserDnDTest.java
++ 2. Run the first instance of the java test:
++ > <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
++ 3. Select a color in the color chooser
++ 4. Run the second instance of the java test:
++ > <path-to-the-tested-jdk>/bin/java JColorChooserDnDTest
++ 5. Drag and drop the selected color from the first color chooser
++ preview panel to the second color chooser preview panel
++ 6. If the color is dragged to the second color chooser then the test passes.
++
++ <applet width="500" height="1" code="bug8065098.class">
++ </applet>
++</body>
++</html>
+\ No newline at end of file
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/JColorChooser/8065098/bug8065098.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,34 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++import javax.swing.JApplet;
++
++/*
++ * @test
++ * @bug 8065098
++ * @summary JColorChooser no longer supports drag and drop
++ * between two JVM instances
++ * @run applet/manual=yesno bug8065098.html
++ */
++public class bug8065098 extends JApplet {
++
++}
+--- ./jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/javax/swing/JFileChooser/8046391/bug8046391.java Fri Apr 10 09:21:28 2015 -0700
+@@ -47,15 +47,18 @@
+ return;
+ }
+
+- SwingUtilities.invokeAndWait(() -> {
+- try {
+- UIManager.setLookAndFeel(new WindowsLookAndFeel());
+- } catch (UnsupportedLookAndFeelException e) {
+- e.printStackTrace();
++ SwingUtilities.invokeAndWait(new Runnable() {
++ @Override
++ public void run() {
++ try {
++ UIManager.setLookAndFeel(new WindowsLookAndFeel());
++ } catch (UnsupportedLookAndFeelException e) {
++ e.printStackTrace();
++ }
++ System.out.println("Creating JFileChooser...");
++ JFileChooser fileChooser = new JFileChooser();
++ System.out.println("Test passed: chooser = " + fileChooser);
+ }
+- System.out.println("Creating JFileChooser...");
+- JFileChooser fileChooser = new JFileChooser();
+- System.out.println("Test passed: chooser = " + fileChooser);
+ });
+ // Test fails if creating JFileChooser hangs
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/JRadioButton/8033699/bug8033699.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,255 @@
++/*
++ * Copyright (c) 2014, 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
++ * @library ../../regtesthelpers
++ * @build Util
++ * @bug 8033699
++ * @summary Incorrect radio button behavior when pressing tab key
++ * @author Vivi An
++ * @run main bug8033699
++ */
++
++import javax.swing.*;
++import javax.swing.event.*;
++import java.awt.event.*;
++import java.awt.*;
++import sun.awt.SunToolkit;
++
++public class bug8033699 {
++ private static Robot robot;
++ private static SunToolkit toolkit;
++
++ private static JButton btnStart;
++ private static ButtonGroup btnGrp;
++ private static JButton btnEnd;
++ private static JButton btnMiddle;
++ private static JRadioButton radioBtn1;
++ private static JRadioButton radioBtn2;
++ private static JRadioButton radioBtn3;
++ private static JRadioButton radioBtnSingle;
++
++ public static void main(String args[]) throws Throwable {
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ createAndShowGUI();
++ }
++ });
++
++ robot = new Robot();
++ Thread.sleep(100);
++
++ robot.setAutoDelay(100);
++ toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
++
++ // tab key test grouped radio button
++ runTest1();
++
++ // tab key test non-grouped radio button
++ runTest2();
++
++ // shift tab key test grouped and non grouped radio button
++ runTest3();
++
++ // left/up key test in grouped radio button
++ runTest4();
++
++ // down/right key test in grouped radio button
++ runTest5();
++
++ // tab from radio button in group to next component in the middle of button group layout
++ runTest6();
++
++ // tab to radio button in group from component in the middle of button group layout
++ runTest7();
++
++ // down key circle back to first button in grouped radio button
++ runTest8();
++ }
++
++ private static void createAndShowGUI() {
++ JFrame mainFrame = new JFrame("Bug 8033699 - 8 Tests for Grouped/Non Group Radio Buttons");
++
++ btnStart = new JButton("Start");
++ btnEnd = new JButton("End");
++ btnMiddle = new JButton("Middle");
++
++ JPanel box = new JPanel();
++ box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));
++ box.setBorder(BorderFactory.createTitledBorder("Grouped Radio Buttons"));
++ radioBtn1 = new JRadioButton("A");
++ radioBtn2 = new JRadioButton("B");
++ radioBtn3 = new JRadioButton("C");
++
++ ButtonGroup btnGrp = new ButtonGroup();
++ btnGrp.add(radioBtn1);
++ btnGrp.add(radioBtn2);
++ btnGrp.add(radioBtn3);
++ radioBtn1.setSelected(true);
++
++ box.add(radioBtn1);
++ box.add(radioBtn2);
++ box.add(btnMiddle);
++ box.add(radioBtn3);
++
++ radioBtnSingle = new JRadioButton("Not Grouped");
++ radioBtnSingle.setSelected(true);
++
++ mainFrame.getContentPane().add(btnStart);
++ mainFrame.getContentPane().add(box);
++ mainFrame.getContentPane().add(radioBtnSingle);
++ mainFrame.getContentPane().add(btnEnd);
++
++ mainFrame.getRootPane().setDefaultButton(btnStart);
++ btnStart.requestFocus();
++
++ mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
++ mainFrame.setLayout(new BoxLayout(mainFrame.getContentPane(), BoxLayout.Y_AXIS));
++
++ mainFrame.setSize(300, 300);
++ mainFrame.setLocation(200, 200);
++ mainFrame.setVisible(true);
++ mainFrame.toFront();
++ }
++
++ // Radio button Group as a single component when traversing through tab key
++ private static void runTest1() throws Exception{
++ hitKey(robot, KeyEvent.VK_TAB);
++ hitKey(robot, KeyEvent.VK_TAB);
++
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtnSingle) {
++ System.out.println("Radio Button Group Go To Next Component through Tab Key failed");
++ throw new RuntimeException("Focus is not on Radio Button Single as Expected");
++ }
++ }
++ });
++ }
++
++ // Non-Grouped Radio button as a single component when traversing through tab key
++ private static void runTest2() throws Exception{
++ hitKey(robot, KeyEvent.VK_TAB);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnEnd) {
++ System.out.println("Non Grouped Radio Button Go To Next Component through Tab Key failed");
++ throw new RuntimeException("Focus is not on Button End as Expected");
++ }
++ }
++ });
++ }
++
++ // Non-Grouped Radio button and Group Radio button as a single component when traversing through shift-tab key
++ private static void runTest3() throws Exception{
++ hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
++ hitKey(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
++ System.out.println("Radio button Group/Non Grouped Radio Button SHIFT-Tab Key Test failed");
++ throw new RuntimeException("Focus is not on Radio Button C as Expected");
++ }
++ }
++ });
++ }
++
++ // Using arrow key to move focus in radio button group
++ private static void runTest4() throws Exception{
++ hitKey(robot, KeyEvent.VK_UP);
++ hitKey(robot, KeyEvent.VK_LEFT);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn1) {
++ System.out.println("Radio button Group UP/LEFT Arrow Key Move Focus Failed");
++ throw new RuntimeException("Focus is not on Radio Button A as Expected");
++ }
++ }
++ });
++ }
++
++ private static void runTest5() throws Exception{
++ hitKey(robot, KeyEvent.VK_DOWN);
++ hitKey(robot, KeyEvent.VK_RIGHT);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
++ System.out.println("Radio button Group Left/Up Arrow Key Move Focus Failed");
++ throw new RuntimeException("Focus is not on Radio Button C as Expected");
++ }
++ }
++ });
++ }
++
++ private static void runTest6() throws Exception{
++ hitKey(robot, KeyEvent.VK_DOWN);
++ hitKey(robot, KeyEvent.VK_DOWN);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn2) {
++ System.out.println("Radio button Group Circle Back To First Button Test");
++ throw new RuntimeException("Focus is not on Radio Button A as Expected");
++ }
++ }
++ });
++ }
++
++ private static void runTest7() throws Exception{
++ hitKey(robot, KeyEvent.VK_TAB);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != btnMiddle) {
++ System.out.println("Separate Component added in button group layout");
++ throw new RuntimeException("Focus is not on Middle Button as Expected");
++ }
++ }
++ });
++ }
++
++ private static void runTest8() throws Exception{
++ hitKey(robot, KeyEvent.VK_TAB);
++ SwingUtilities.invokeAndWait(new Runnable() {
++ public void run() {
++ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != radioBtn3) {
++ System.out.println("Separate Component added in button group layout");
++ throw new RuntimeException("Focus is not on Radio Button C as Expected");
++ }
++ }
++ });
++ }
++
++ private static void hitKey(Robot robot, int keycode) {
++ robot.keyPress(keycode);
++ robot.keyRelease(keycode);
++ toolkit.realSync();
++ }
++
++ private static void hitKey(Robot robot, int mode, int keycode) {
++ robot.keyPress(mode);
++ robot.keyPress(keycode);
++ robot.keyRelease(mode);
++ robot.keyRelease(keycode);
++ toolkit.realSync();
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/plaf/windows/WindowsRootPaneUI/AltKeyProccessingNPETest/AltKeyProccessingNPETest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,65 @@
++/*
++ * Copyright (c) 2014, 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 8001633
++ @summary Wrong alt processing during switching between windows
++ @author mikhail.cherkasov@oracle.com
++ @run main AltKeyProccessingNPETest
++*/
++import sun.awt.SunToolkit;
++
++import java.awt.*;
++import java.awt.event.KeyEvent;
++import javax.swing.UIManager;
++
++public class AltKeyProccessingNPETest {
++
++ private static Robot robot;
++
++ public static void initRobot() throws AWTException {
++ robot = new Robot();
++ robot.setAutoDelay(100);
++ }
++
++ public static void sync() {
++ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
++ toolkit.realSync();
++ }
++
++ public static void main(String args[]) throws Exception {
++
++ initRobot();
++
++ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
++
++ Frame frame = new Frame();
++ frame.setSize(400,400);
++ frame.setVisible(true);
++
++ sync();
++
++ robot.keyPress(KeyEvent.VK_ALT);
++ robot.keyRelease(KeyEvent.VK_ALT);
++ }
++}
+\ No newline at end of file
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/text/View/8048110/bug8048110.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,121 @@
++/*
++ * Copyright (c) 2014, 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 8048110
++ * @summary Using tables in JTextPane leads to infinite loop in FlowLayout.layoutRow
++ * @author Dmitry Markov
++ * @run main bug8048110
++ */
++
++import sun.awt.SunToolkit;
++
++import javax.swing.*;
++import javax.swing.text.Element;
++import javax.swing.text.html.HTMLDocument;
++import javax.swing.text.html.HTMLEditorKit;
++import java.awt.*;
++
++public class bug8048110 {
++ private static SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
++ private static Object lock = new Object();
++ private static boolean isRealSyncPerformed = false;
++ private static final String htmlText = "<table width=\"100%\" cellpadding=\"10\" cellspacing=\"5\" align=\"center\">" +
++ "<tr><th align=\"left\" bgcolor=\"#bec3c6\">Devices</th><th align=\"left\" bgcolor=\"#bec3c6\">State</th></tr>" +
++ "<tr><td align=\"left\" bgcolor=\"#bec3c6\">PC</td><td align=\"left\" bgcolor=\"#46a055\">Ok</td></tr></table>";
++
++ public static void main(String[] args) throws Exception {
++ SwingUtilities.invokeAndWait(new Runnable() {
++ @Override
++ public void run() {
++ createAndShowGUI();
++ }
++ });
++
++ Thread thread = new Thread() {
++ @Override
++ public void run() {
++ toolkit.realSync();
++ synchronized (lock) {
++ isRealSyncPerformed = true;
++ lock.notifyAll();
++ }
++ }
++ };
++ thread.start();
++
++ synchronized (lock) {
++ if (!isRealSyncPerformed) {
++ lock.wait(5000);
++ }
++ }
++
++ if (!isRealSyncPerformed) {
++ throw new RuntimeException("Test Failed!");
++ }
++ }
++
++ private static void createAndShowGUI() {
++ try {
++ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
++ } catch (Exception ex) {
++ throw new RuntimeException(ex);
++ }
++ HTMLEditorKit editorKit = new HTMLEditorKit();
++ JTextPane textPane = new JTextPane();
++ textPane.setContentType("text/html");
++ textPane.setEditorKit(editorKit);
++ textPane.setText("Initial text without table");
++
++ JFrame frame = new JFrame("bug8048110");
++ frame.getContentPane().add(textPane, BorderLayout.CENTER);
++ frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
++ frame.setSize(500, 200);
++ frame.setVisible(true);
++
++ textPane.setDocument(textPane.getEditorKit().createDefaultDocument());
++ HTMLDocument htmlDocument = (HTMLDocument) textPane.getDocument();
++ Element firstParagraph = findFirstElement(textPane.getDocument().getDefaultRootElement(), "p");
++
++ try {
++ htmlDocument.setInnerHTML(firstParagraph, htmlText);
++ } catch (Exception ex) {
++ throw new RuntimeException(ex);
++ }
++ }
++
++ private static Element findFirstElement(Element e, String name) {
++ String elementName = e.getName();
++ if (elementName != null && elementName.equalsIgnoreCase(name)) {
++ return e;
++ }
++ for (int i = 0; i < e.getElementCount(); i++) {
++ Element result = findFirstElement(e.getElement(i), name);
++ if (result != null) {
++ return result;
++ }
++ }
++ return null;
++ }
++}
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,109 @@
++/*
++ * Copyright (c) 2014, 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 8058120
++ * @summary Rendering / caret errors with HTMLDocument
++ * @author Dmitry Markov
++ * @run main bug8058120
++ */
++
++import sun.awt.SunToolkit;
++
++import javax.swing.*;
++import javax.swing.text.Element;
++import javax.swing.text.html.HTML;
++import javax.swing.text.html.HTMLDocument;
++import javax.swing.text.html.HTMLEditorKit;
++import java.awt.*;
++
++public class bug8058120 {
++ private static SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
++ private static HTMLDocument document = null;
++ private static final String text = "<p id = 'ab'>ab</p>";
++ private static final String textToInsert = "c";
++
++ public static void main(String[] args) {
++ SwingUtilities.invokeLater(new Runnable() {
++ @Override
++ public void run() {
++ createAndShowGUI();
++ }
++ });
++
++ toolkit.realSync();
++
++ SwingUtilities.invokeLater(new Runnable() {
++ @Override
++ public void run() {
++ try {
++ document.insertAfterEnd(document.getElement("ab"), textToInsert);
++ } catch (Exception ex) {
++ throw new RuntimeException(ex);
++ }
++ }
++ });
++
++ toolkit.realSync();
++
++ SwingUtilities.invokeLater(new Runnable() {
++ @Override
++ public void run() {
++ Element parent = document.getElement("ab").getParentElement();
++ int count = parent.getElementCount();
++ if (count != 2) {
++ throw new RuntimeException("Test Failed! Unexpected Element count = "+count);
++ }
++ Element insertedElement = parent.getElement(count - 1);
++ if (!HTML.Tag.IMPLIED.toString().equals(insertedElement.getName())) {
++ throw new RuntimeException("Test Failed! Inserted text is not wrapped by " + HTML.Tag.IMPLIED + " tag");
++ }
++ }
++ });
++ }
++
++ private static void createAndShowGUI() {
++ try {
++ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
++ } catch (Exception ex) {
++ throw new RuntimeException(ex);
++ }
++
++ JFrame frame = new JFrame("bug8058120");
++ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
++
++ JEditorPane editorPane = new JEditorPane();
++ editorPane.setContentType("text/html");
++ editorPane.setEditorKit(new HTMLEditorKit());
++
++ document = (HTMLDocument) editorPane.getDocument();
++
++ editorPane.setText(text);
++
++ frame.add(editorPane);
++ frame.setSize(200, 200);
++ frame.setVisible(true);
++ }
++}
++
++
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,86 @@
++/*
++ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
++ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
++ */
++
++/**
++ * @test
++ * @bug 8062923 8062924
++ * @run testng XslSubstringTest
++ * @summary Test xsl substring function with negative, Inf and
++ * NaN length and few other use cases
++ */
++
++import java.io.StringReader;
++import java.io.StringWriter;
++import javax.xml.transform.Source;
++import javax.xml.transform.Templates;
++import javax.xml.transform.Transformer;
++import javax.xml.transform.TransformerFactory;
++import javax.xml.transform.stream.StreamResult;
++import javax.xml.transform.stream.StreamSource;
++
++import static org.testng.Assert.assertEquals;
++import org.testng.annotations.Test;
++
++public class XslSubstringTest {
++
++ final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><test></test>";
++ final String xslPre = "<xsl:stylesheet version='1.0'"
++ + " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
++ + "<xsl:output method='xml' indent='yes' omit-xml-declaration='yes'/>"
++ + "<xsl:template match='/'><t>";
++ final String xslPost = "</t></xsl:template></xsl:stylesheet>";
++
++ private String testTransform(String xsl) throws Exception {
++ //Prepare sources for transormation
++ Source src = new StreamSource(new StringReader(xml));
++ Source xslsrc = new StreamSource(new StringReader(xslPre + xsl + xslPost));
++ //Create factory, template and transformer
++ TransformerFactory tf = TransformerFactory.newInstance();
++ Templates tmpl = tf.newTemplates(xslsrc);
++ Transformer t = tmpl.newTransformer();
++ //Prepare output stream
++ StringWriter xmlResultString = new StringWriter();
++ StreamResult xmlResultStream = new StreamResult(xmlResultString);
++ //Transform
++ t.transform(src, xmlResultStream);
++ return xmlResultString.toString().trim();
++ }
++
++ @Test
++ public void test8062923() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2,-1)\"/>|"),
++ "<t>||</t>");
++ }
++
++ @Test
++ public void test8062924() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2,-1 div 0)\"/>|"),
++ "<t>||</t>");
++ }
++
++ @Test
++ public void testGeneral1() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|"),
++ "<t>|s|</t>");
++ }
++
++ @Test
++ public void testGeneral2() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|"),
++ "<t>|sdf|</t>");
++ }
++
++ @Test
++ public void testGeneral3() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|"),
++ "<t>||</t>");
++ }
++
++ @Test
++ public void testGeneral4() throws Exception {
++ assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 0 div 0)\"/>|"),
++ "<t>||</t>");
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/jdk/net/Sockets/SupportedOptions.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,45 @@
++/*
++ * Copyright (c) 2014, 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 8062744
++ * @run main SupportedOptions
++ */
++
++import java.net.*;
++import java.io.IOException;
++import jdk.net.*;
++
++public class SupportedOptions {
++
++ public static void main(String[] args) throws Exception {
++ if (!Sockets.supportedOptions(ServerSocket.class)
++ .contains(StandardSocketOptions.IP_TOS)) {
++ throw new RuntimeException("Test failed");
++ }
++ // Now set the option
++ ServerSocket ss = new ServerSocket();
++ Sockets.setOption(ss, java.net.StandardSocketOptions.IP_TOS, 128);
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/jdk/net/Sockets/Test.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,299 @@
++/*
++ * Copyright (c) 2014, 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 8032808
++ * @run main/othervm -Xcheck:jni Test
++ * @run main/othervm/policy=policy.fail -Xcheck:jni Test fail
++ * @run main/othervm/policy=policy.success -Xcheck:jni Test success
++ */
++
++import java.net.*;
++import java.io.IOException;
++import java.nio.channels.*;
++import java.util.concurrent.*;
++import java.util.Set;
++import jdk.net.*;
++
++public class Test {
++
++ static boolean security;
++ static boolean success;
++ static int udp_port;
++ static InetAddress loop;
++ static InetSocketAddress loopad;
++ static SocketFlow flowIn;
++ static SocketChannel sc;
++ static Socket s;
++
++ public static void main(String[] args) throws Exception {
++
++ // quick check to see if supportedOptions() working before
++ // creating any sockets and libnet loaded
++
++ Sockets.supportedOptions(Socket.class);
++
++ security = System.getSecurityManager() != null;
++ success = security && args[0].equals("success");
++
++ // Main thing is to check for JNI problems
++ // Doesn't matter if current system does not support the option
++ // and currently setting the option with the loopback interface
++ // doesn't work either
++
++ System.out.println ("Security Manager enabled: " + security);
++ if (security) {
++ System.out.println ("Success expected: " + success);
++ }
++
++ flowIn = SocketFlow.create()
++ .bandwidth(1000)
++ .priority(SocketFlow.HIGH_PRIORITY);
++
++ ServerSocket ss = new ServerSocket(0);
++ int tcp_port = ss.getLocalPort();
++ loop = InetAddress.getByName("127.0.0.1");
++ loopad = new InetSocketAddress(loop, tcp_port);
++
++ DatagramSocket dg = new DatagramSocket(0);
++ udp_port = dg.getLocalPort();
++
++ // If option not available, end test
++ Set<SocketOption<?>> options = Sockets.supportedOptions(
++ DatagramSocket.class
++ );
++
++ if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) {
++ System.out.println("SO_FLOW_SLA not supported");
++ return;
++ }
++
++ s = new Socket("127.0.0.1", tcp_port);
++ sc = SocketChannel.open();
++ sc.connect (new InetSocketAddress("127.0.0.1", tcp_port));
++
++ // Do some standard options tests first. Since JDK 8 doesn't have java.net API
++ Sockets.setOption(s, StandardSocketOptions.SO_SNDBUF, 8000);
++ System.out.println ("Set SO_SNDBUF to 8000\ngetting returns: ");
++ System.out.println (Sockets.getOption(s, StandardSocketOptions.SO_SNDBUF));
++
++ Sockets.setOption(ss, StandardSocketOptions.SO_RCVBUF, 5000);
++ System.out.println ("Set SO_RCVBUF to 5000\ngetting returns: ");
++ System.out.println (Sockets.getOption(s, StandardSocketOptions.SO_RCVBUF));
++
++ try {
++ Sockets.setOption(ss, StandardSocketOptions.TCP_NODELAY, true);
++ throw new RuntimeException("TCP_NODELAY should not be supported for ServerSocket");
++ } catch (UnsupportedOperationException e) {}
++ try {
++ Sockets.setOption(dg, StandardSocketOptions.IP_MULTICAST_LOOP, true);
++ throw new RuntimeException("IP_MULTICAST_LOOP should not be supported for DatagramSocket");
++ } catch (UnsupportedOperationException e) {}
++
++ MulticastSocket mc0 = new MulticastSocket(0);
++ Sockets.setOption(mc0, StandardSocketOptions.IP_MULTICAST_LOOP, true);
++ System.out.println ("Expect true: " + Sockets.getOption(mc0, StandardSocketOptions.IP_MULTICAST_LOOP));
++
++ // Now the specific tests for SO_FLOW_SLA
++
++ doTest1();
++ doTest2();
++ doTest3();
++ doTest4();
++ doTest5();
++ doTest6();
++ doTest7();
++ doTest8();
++ }
++
++ static void doTest1() throws Exception {
++ try {
++ Sockets.setOption(s, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest2() throws Exception {
++ try {
++ Sockets.getOption(s, ExtendedSocketOptions.SO_FLOW_SLA);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest3() throws Exception {
++ try {
++ sc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest4() throws Exception {
++ try {
++ sc.getOption(ExtendedSocketOptions.SO_FLOW_SLA);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest5() throws Exception {
++ try {
++ DatagramSocket dg1 = new DatagramSocket(0);
++ dg1.connect(loop, udp_port);
++ Sockets.setOption(dg1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest6() throws Exception {
++ try {
++ DatagramChannel dg2 = DatagramChannel.open();
++ dg2.bind(new InetSocketAddress(loop, 0));
++ dg2.connect(new InetSocketAddress(loop, udp_port));
++ dg2.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest7() throws Exception {
++ try {
++ MulticastSocket mc1 = new MulticastSocket(0);
++ mc1.connect(loop, udp_port);
++ Sockets.setOption(mc1, ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++
++ static void doTest8() throws Exception {
++ try {
++ AsynchronousSocketChannel asc = AsynchronousSocketChannel.open();
++ Future<Void> f = asc.connect(loopad);
++ f.get();
++ asc.setOption(ExtendedSocketOptions.SO_FLOW_SLA, flowIn);
++ if (security && !success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (SecurityException e) {
++ if (success) {
++ throw new RuntimeException("Test failed");
++ }
++ } catch (UnsupportedOperationException e) {
++ System.out.println (e);
++ } catch (IOException e) {
++ // Probably a permission error, but we're not
++ // going to check unless a specific permission exception
++ // is defined.
++ System.out.println (e);
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/jdk/net/Sockets/policy.fail Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,4 @@
++grant {
++ permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
++ permission java.net.SocketPermission "localhost", "listen" ;
++};
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/jdk/net/Sockets/policy.success Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,6 @@
++grant {
++ permission java.net.SocketPermission "127.0.0.1", "connect,accept" ;
++ permission java.net.SocketPermission "localhost", "listen" ;
++ permission jdk.net.NetworkPermission "setOption.SO_FLOW_SLA";
++ permission jdk.net.NetworkPermission "getOption.SO_FLOW_SLA";
++};
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/awt/datatransfer/DataFlavorComparatorTest1.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,115 @@
++/*
++ * Copyright (c) 2014, 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 8058473
++ @summary "Comparison method violates its general contract" when using Clipboard
++ Ensure that DataTransferer.DataFlavorComparator conforms to Comparator contract
++ @author Anton Nashatyrev
++ @run main DataFlavorComparatorTest1
++*/
++import sun.awt.datatransfer.DataTransferer;
++
++import java.awt.datatransfer.DataFlavor;
++import java.util.Comparator;
++
++public class DataFlavorComparatorTest1 {
++
++ public static void main(String[] args) throws Exception {
++ String[] mimes = new String[] {
++ "text/plain",
++ "text/plain; charset=unicode",
++ "text/plain; charset=cp1251",
++ "text/plain; charset=unicode; class=java.io.InputStream",
++ "text/plain; charset=unicode; class=java.io.Serializable",
++ "text/plain; charset=unicode; class=java.lang.Object",
++ "text/plain; class=java.lang.String",
++ "text/plain; class=java.io.Reader",
++ "text/plain; class=java.lang.Object",
++ "text/html",
++ "text/html; charset=unicode",
++ "text/html; charset=cp1251",
++ "text/html; charset=unicode; class=java.io.InputStream",
++ "text/html; charset=unicode; class=java.io.Serializable",
++ "text/html; charset=unicode; class=java.lang.Object",
++ "text/html; class=java.lang.String",
++ "text/html; class=java.io.Reader",
++ "text/html; class=java.lang.Object",
++ "text/unknown",
++ "text/unknown; charset=unicode",
++ "text/unknown; charset=cp1251",
++ "text/unknown; charset=unicode; class=java.io.InputStream",
++ "text/unknown; charset=unicode; class=java.io.Serializable",
++ "text/unknown; charset=unicode; class=java.lang.Object",
++ "text/unknown; class=java.lang.String",
++ "text/unknown; class=java.io.Reader",
++ "text/unknown; class=java.lang.Object",
++ "application/unknown; class=java.io.InputStream",
++ "application/unknown; class=java.lang.Object",
++ "application/unknown",
++ "application/x-java-jvm-local-objectref; class=java.io.InputStream",
++ "application/x-java-jvm-local-objectref; class=java.lang.Object",
++ "application/x-java-jvm-local-objectref",
++ "unknown/flavor",
++ "unknown/flavor; class=java.io.InputStream",
++ "unknown/flavor; class=java.lang.Object",
++ };
++
++ DataFlavor[] flavors = new DataFlavor[mimes.length];
++ for (int i = 0; i < flavors.length; i++) {
++ flavors[i] = new DataFlavor(mimes[i]);
++ }
++
++ testComparator(new DataTransferer.DataFlavorComparator(true), flavors);
++ testComparator(new DataTransferer.DataFlavorComparator(false), flavors);
++
++ }
++
++ private static void testComparator(Comparator cmp, DataFlavor[] flavs)
++ throws ClassNotFoundException {
++
++ for (DataFlavor x: flavs) {
++ for (DataFlavor y: flavs) {
++ if (Math.signum(cmp.compare(x,y)) != -Math.signum(cmp.compare(y,x))) {
++ throw new RuntimeException("Antisymmetry violated: " + x + ", " + y);
++ }
++ if (cmp.compare(x,y) == 0 && !x.equals(y)) {
++ throw new RuntimeException("Equals rule violated: " + x + ", " + y);
++ }
++ for (DataFlavor z: flavs) {
++ if (cmp.compare(x,y) == 0) {
++ if (Math.signum(cmp.compare(x, z)) != Math.signum(cmp.compare(y, z))) {
++ throw new RuntimeException("Transitivity (1) violated: " + x + ", " + y + ", " + z);
++ }
++ } else {
++ if (Math.signum(cmp.compare(x, y)) == Math.signum(cmp.compare(y, z))) {
++ if (Math.signum(cmp.compare(x, y)) != Math.signum(cmp.compare(x, z))) {
++ throw new RuntimeException("Transitivity (2) violated: " + x + ", " + y + ", " + z);
++ }
++ }
++ }
++ }
++ }
++ }
++ }
++}
+--- ./jdk/test/sun/awt/dnd/8024061/bug8024061.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/awt/dnd/8024061/bug8024061.java Fri Apr 10 09:21:28 2015 -0700
+@@ -277,9 +277,6 @@
+ try {
+ Transferable t = dtde.getTransferable();
+ Object data = t.getTransferData(DropObjectFlavor);
+- if (data != null) {
+- throw new Exception("getTransferData returned non-null");
+- }
+ } catch (Exception e) {
+ dragEnterException = e;
+ e.printStackTrace();
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/misc/ProxyGenerator/SaveProxyClassFileTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,69 @@
++/*
++ * Copyright (c) 2014, 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 8059563
++ * @summary ProxyGenerator should create intermediate directories
++ * for the generated class file
++ * @build SaveProxyClassFileTest
++ * @run main/othervm -Dsun.misc.ProxyGenerator.saveGeneratedFiles=true SaveProxyClassFileTest
++ */
++
++import java.io.File;
++import sun.misc.ProxyGenerator;
++
++public class SaveProxyClassFileTest {
++
++ static final File dir1 = new File("a");
++ static final File dir2 = new File(dir1, "b");
++ static final File cf = new File(dir2, "c.class");
++
++ public static void main(String[] args) throws Throwable {
++ // remove the files in case they were left from
++ // the previous run
++ deleteFiles();
++
++ try {
++ ProxyGenerator.generateProxyClass("a.b.c",
++ new Class[] {Inf.class});
++
++ if (!cf.exists()) {
++ throw new RuntimeException(cf + " wasn't created");
++ }
++ } finally {
++ deleteFiles();
++ }
++ }
++
++ static interface Inf {
++ }
++
++ /**
++ * Removes generated file and directories
++ */
++ private static void deleteFiles() {
++ cf.delete();
++ dir2.delete();
++ dir1.delete();
++ }
++}
+--- ./jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2010, 2015, 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
+@@ -23,8 +23,8 @@
+
+ /*
+ * @test
+- * @bug 6672144
+- * @summary HttpURLConnection.getInputStream sends POST request after failed chunked send
++ * @bug 6672144 8050983
++ * @summary Do not retry failed request with a streaming body.
+ */
+
+ import java.net.HttpURLConnection;
+@@ -33,31 +33,41 @@
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.OutputStream;
++import static java.lang.System.out;
+
+ public class StreamingRetry implements Runnable {
+ static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds
+- ServerSocket ss;
++ volatile ServerSocket ss;
+
+- public static void main(String[] args) throws IOException {
++ public static void main(String[] args) throws Exception {
+ (new StreamingRetry()).instanceMain();
+ }
+
+- void instanceMain() throws IOException {
+- test();
++ void instanceMain() throws Exception {
++ out.println("Test with default method");
++ test(null);
++ out.println("Test with POST method");
++ test("POST");
++ out.println("Test with PUT method");
++ test("PUT");
++
+ if (failed > 0) throw new RuntimeException("Some tests failed");
+ }
+
+- void test() throws IOException {
++ void test(String method) throws Exception {
+ ss = new ServerSocket(0);
+ ss.setSoTimeout(ACCEPT_TIMEOUT);
+ int port = ss.getLocalPort();
+
+- (new Thread(this)).start();
++ Thread otherThread = new Thread(this);
++ otherThread.start();
+
+ try {
+ URL url = new URL("http://localhost:" + port + "/");
+ HttpURLConnection uc = (HttpURLConnection) url.openConnection();
+ uc.setDoOutput(true);
++ if (method != null)
++ uc.setRequestMethod(method);
+ uc.setChunkedStreamingMode(4096);
+ OutputStream os = uc.getOutputStream();
+ os.write("Hello there".getBytes());
+@@ -68,6 +78,7 @@
+ //expected.printStackTrace();
+ } finally {
+ ss.close();
++ otherThread.join();
+ }
+ }
+
+@@ -79,7 +90,7 @@
+ ss.close();
+ fail("The server shouldn't accept a second connection");
+ } catch (IOException e) {
+- //OK, the clien will close the server socket if successfull
++ //OK, the client will close the server socket if successful
+ }
+ }
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/net/www/protocol/http/B8012625.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,100 @@
++/*
++ * Copyright (c) 2013, 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 8012625
++ * @run main B8012625
++ */
++
++import java.net.*;
++import java.io.*;
++
++import java.net.*;
++import java.io.*;
++import java.util.concurrent.*;
++import com.sun.net.httpserver.*;
++
++public class B8012625 implements HttpHandler {
++
++ public static void main (String[] args) throws Exception {
++ B8012625 test = new B8012625();
++ test.run();
++ }
++
++ public void run() throws Exception {
++ String u = "http://127.0.0.1:" + port + "/foo";
++ URL url = new URL(u);
++ HttpURLConnection uc = (HttpURLConnection)url.openConnection();
++ uc.setDoOutput(true);
++ uc.setRequestMethod("POST");
++ uc.addRequestProperty("Expect", "100-Continue");
++ //uc.setFixedLengthStreamingMode(256);
++ System.out.println ("Client: getting outputstream");
++ long before = System.currentTimeMillis();
++ OutputStream os = uc.getOutputStream();
++ long after = System.currentTimeMillis();
++ System.out.println ("Client: writing to outputstream");
++ byte[] buf = new byte[256];
++ os.write(buf);
++ System.out.println ("Client: done writing ");
++ int r = uc.getResponseCode();
++ System.out.println ("Client: received response code " + r);
++ server.stop(1);
++ ex.shutdownNow();
++ if (after - before >= 5000) {
++ throw new RuntimeException("Error: 5 second delay seen");
++ }
++ }
++
++ int port;
++ HttpServer server;
++ ExecutorService ex;
++
++ public B8012625 () throws Exception {
++ server = HttpServer.create(new InetSocketAddress(0), 10);
++ HttpContext ctx = server.createContext("/", this);
++ ex = Executors.newFixedThreadPool(5);
++ server.setExecutor(ex);
++ server.start();
++ port = server.getAddress().getPort();
++ }
++
++ public void handle(HttpExchange ex) throws IOException {
++ String s = ex.getRequestMethod();
++ if (!s.equals("POST")) {
++ ex.getResponseHeaders().set("Allow", "POST");
++ ex.sendResponseHeaders(500, -1);
++ ex.close();
++ return;
++ }
++ System.out.println ("Server: reading request body");
++ InputStream is = ex.getRequestBody();
++ // read request
++ byte[] buf = new byte [1024];
++ while (is.read(buf) != -1) ;
++ is.close();
++ ex.sendResponseHeaders(200, -1);
++ ex.close();
++ }
++}
+--- ./jdk/test/sun/nio/cs/TestIBMBugs.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/nio/cs/TestIBMBugs.java Fri Apr 10 09:21:28 2015 -0700
+@@ -147,16 +147,17 @@
+ }
+
+ private static void bug6569191 () throws Exception {
+- byte[] bs = new byte[] { (byte)0x81, (byte)0xad,
+- (byte)0x81, (byte)0xae,
+- (byte)0x81, (byte)0xaf,
+- (byte)0x81, (byte)0xb0,
+- (byte)0x85, (byte)0x81,
+- (byte)0x85, (byte)0x87,
+- (byte)0x85, (byte)0xe0,
+- (byte)0x85, (byte)0xf0 };
++ byte[] bs = new byte[] { (byte)0x81, (byte)0xad, // fffd ff6d
++ (byte)0x81, (byte)0xae, // fffd ff6e
++ (byte)0x81, (byte)0xaf, // fffd ff6f
++ (byte)0x81, (byte)0xb0, // fffd ff70
++ (byte)0x85, (byte)0x81, // fffd ->
++ (byte)0x85, (byte)0x87, // 2266 ->
++ (byte)0x85, (byte)0xe0, // 32a4 ->
++ (byte)0x85, (byte)0xf0 };// 7165 fffd
+ String s = new String(bs, "Cp943");
+- if (!"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd"
++ // see DoubleByte for how the unmappables are handled
++ if (!"\ufffd\uff6d\ufffd\uff6e\ufffd\uff6f\ufffd\uff70\ufffd\u2266\u32a4\u7165\ufffd"
+ .equals(s))
+ throw new Exception("Cp943 failed");
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/nio/cs/TestUnmappable.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,89 @@
++/*
++ * Copyright (c) 2015, 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
++ * particular file as subject to the "Classpath" exception as provided
++ * by Oracle in the LICENSE file that accompanied this code.
++ *
++ * 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 8008386
++ * @summary (cs) Unmappable leading should be decoded to replacement.
++ * Tests for Shift_JIS and MS932 decoding
++ * @run main TestUnmappable
++ */
++
++import java.nio.*;
++import java.nio.charset.*;
++
++public class TestUnmappable {
++ public static void main(String args[]) throws Exception {
++
++ // illegal leading character test
++ byte[][] inputBytes = {
++ // Shift_JIS
++ {(byte)0xce, (byte)0xa0, (byte)0xce, (byte)0x7a},
++ // MS932
++ {(byte)0x3c, (byte)0x21, (byte)0x2d, (byte)0x2d,
++ (byte)0xe5, (byte)0xaf, (byte)0xbe, (byte)0xe5,
++ (byte)0xbf, (byte)0x9c, (byte)0x2d, (byte)0x2d,
++ (byte)0x3e, (byte)0xd, (byte)0xa },
++ {(byte)0x81, (byte)0xad},
++ // PCK
++ {(byte)0xef, (byte)0x90},
++ {(byte)0x91, (byte)0xfd}
++ };
++
++ String[] charsets = { "Shift_JIS", "MS932", "MS932", "PCK", "PCK" };
++ String[] expectedStrings = {
++ // Shift_JIS
++ "0xce 0x3f 0xce 0x7a ",
++ // MS932
++ "0x3c 0x21 0x2d 0x2d 0xe5 0xaf 0xbe 0xe5 0xbf " +
++ "0x3f 0x2d 0x2d 0x3e 0xd 0xa ",
++ "0x3f 0xad ",
++ // PCK
++ "0x3f 0x3f ",
++ "0x3f "};
++
++ for (int i = 0; i < charsets.length; i++) {
++ String ret = new String(inputBytes[i], charsets[i]);
++ System.out.println(charsets[i]);
++ System.out.println("Expected:" + expectedStrings[i]);
++ String bString = getByteString(ret.getBytes(Charset.forName(charsets[i])));
++ if (expectedStrings[i].length() != bString.length()
++ || ! expectedStrings[i].equals(bString)){
++ throw new Exception("ByteToChar for " + charsets[i]
++ + " does not work correctly.\n" +
++ "Expected: " + expectedStrings[i] + "\n" +
++ "Received: " + bString);
++ }
++ }
++ }
++
++ private static String getByteString(byte[] bytes) {
++ StringBuffer sb = new StringBuffer();
++ for (int i = 0; i < bytes.length; i++) {
++ sb.append("0x" + Integer.toHexString((int)(bytes[i] & 0xFF)) + " ");
++ }
++ return sb.toString();
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/krb5/EncTypeTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (c) 2015, 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 8058608
++ * @summary JVM crash during Kerberos logins using des3-cbc-md5 on OSX
++ * @compile -XDignore.symbol.file EncTypeTest.java
++ * @run main/othervm EncTypeTest
++ */
++
++import java.io.File;
++import java.io.FileOutputStream;
++import sun.security.krb5.Config;
++import sun.security.krb5.Credentials;
++import sun.security.krb5.PrincipalName;
++import sun.security.krb5.internal.ccache.CredentialsCache;
++
++public class EncTypeTest {
++ public static void main(String[] args) throws Exception {
++ File f = new File("krb5-8058608.conf");
++ try (FileOutputStream fos = new FileOutputStream(f)) {
++ fos.write(
++ "[libdefaults]\ndefault_tkt_enctypes = des3-cbc-md5".getBytes("UTF-8"));
++ }
++ f.deleteOnExit();
++ System.setProperty("java.security.krb5.conf", "krb5-8058608.conf");
++ Config.refresh();
++ sun.security.krb5.Credentials.acquireTGTFromCache(null,null);
++
++ }
++}
+--- ./jdk/test/sun/security/krb5/ParseConfig.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/krb5/ParseConfig.java Fri Apr 10 09:21:28 2015 -0700
+@@ -22,7 +22,7 @@
+ */
+ /*
+ * @test
+- * @bug 6319046
++ * @bug 6319046 8055045
+ * @run main/othervm ParseConfig
+ * @summary Problem with parsing krb5.conf
+ */
+@@ -31,7 +31,8 @@
+
+ public class ParseConfig {
+ public static void main(String[] args) throws Exception {
+- System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") +"/krb5.conf");
++ System.setProperty("java.security.krb5.conf",
++ System.getProperty("test.src", ".") + "/krb5.conf");
+ Config config = Config.getInstance();
+ config.listTable();
+
+@@ -43,5 +44,11 @@
+ expected + "\"");
+ }
+ }
++
++ // JDK-8055045: IOOBE when reading an empty value
++ config.getDefault("empty1", "NOVAL.COM");
++ config.getDefault("empty2", "NOVAL.COM");
++ config.getDefault("quote1", "NOVAL.COM");
++ config.getDefault("quote2", "NOVAL.COM");
+ }
+ }
+--- ./jdk/test/sun/security/krb5/auto/DynamicKeytab.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/krb5/auto/DynamicKeytab.java Fri Apr 10 09:21:28 2015 -0700
+@@ -110,11 +110,13 @@
+ throw new Exception("Should not success");
+ } catch (GSSException gsse) {
+ System.out.println(gsse);
+- KrbException ke = (KrbException)gsse.getCause();
+- if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
+- throw new Exception("Not expected failure code: " +
+- ke.returnCode());
+- }
++ // Since 7197159, different kvno is accepted, this return code
++ // will never be thrown out again.
++ //KrbException ke = (KrbException)gsse.getCause();
++ //if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
++ // throw new Exception("Not expected failure code: " +
++ // ke.returnCode());
++ //}
+ }
+
+ // Test 8: an empty KDC means revoke all
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/krb5/auto/KeyPermissions.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,56 @@
++/*
++ * Copyright (c) 2012, 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 8004488
++ * @summary wrong permissions checked in krb5
++ * @compile -XDignore.symbol.file KeyPermissions.java
++ * @run main/othervm KeyPermissions
++ */
++
++import java.security.AccessControlException;
++import java.security.Permission;
++import javax.security.auth.PrivateCredentialPermission;
++import sun.security.jgss.GSSUtil;
++
++public class KeyPermissions extends SecurityManager {
++
++ @Override
++ public void checkPermission(Permission perm) {
++ if (perm instanceof PrivateCredentialPermission) {
++ if (!perm.getName().startsWith("javax.security.auth.kerberos.")) {
++ throw new AccessControlException(
++ "I don't like this", perm);
++ }
++ }
++ }
++
++ public static void main(String[] args) throws Exception {
++ System.setSecurityManager(new KeyPermissions());
++ new OneKDC(null).writeJAASConf();
++ Context s = Context.fromJAAS("server");
++ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
++ }
++}
++
+--- ./jdk/test/sun/security/krb5/auto/KeyTabCompat.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/krb5/auto/KeyTabCompat.java Fri Apr 10 09:21:28 2015 -0700
+@@ -24,6 +24,7 @@
+ /*
+ * @test
+ * @bug 6894072
++ * @bug 8004488
+ * @compile -XDignore.symbol.file KeyTabCompat.java
+ * @run main/othervm KeyTabCompat
+ * @summary always refresh keytab
+@@ -70,21 +71,8 @@
+ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+ s.status();
+
+- if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
+- throw new Exception("There should be one KerberosKey");
++ if (s.s().getPrivateCredentials(KerberosKey.class).size() != 0) {
++ throw new Exception("There should be no KerberosKey");
+ }
+-
+- Thread.sleep(2000); // make sure ktab timestamp is different
+-
+- kdc.addPrincipal(OneKDC.SERVER, "pass2".toCharArray());
+- kdc.writeKtab(OneKDC.KTAB);
+-
+- Context.handshake(c, s);
+- s.status();
+-
+- if (s.s().getPrivateCredentials(KerberosKey.class).size() != 1) {
+- throw new Exception("There should be only one KerberosKey");
+ }
+-
+ }
+-}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/krb5/auto/KvnoNA.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,72 @@
++/*
++ * Copyright (c) 2012, 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 7197159
++ * @compile -XDignore.symbol.file KvnoNA.java
++ * @run main/othervm KvnoNA
++ * @summary accept different kvno if there no match
++ */
++
++import org.ietf.jgss.GSSException;
++import sun.security.jgss.GSSUtil;
++import sun.security.krb5.KrbException;
++import sun.security.krb5.PrincipalName;
++import sun.security.krb5.internal.ktab.KeyTab;
++import sun.security.krb5.internal.Krb5;
++
++public class KvnoNA {
++
++ public static void main(String[] args)
++ throws Exception {
++
++ OneKDC kdc = new OneKDC(null);
++ kdc.writeJAASConf();
++
++ // In KDC, it's 2
++ char[] pass = "pass2".toCharArray();
++ kdc.addPrincipal(OneKDC.SERVER, pass);
++
++ // In ktab, kvno is 1 or 3, 3 has the same password
++ KeyTab ktab = KeyTab.create(OneKDC.KTAB);
++ PrincipalName p = new PrincipalName(
++ OneKDC.SERVER+"@"+OneKDC.REALM, PrincipalName.KRB_NT_SRV_HST);
++ ktab.addEntry(p, "pass1".toCharArray(), 1, true);
++ ktab.addEntry(p, "pass2".toCharArray(), 3, true);
++ ktab.save();
++
++ Context c, s;
++
++ c = Context.fromUserPass("dummy", "bogus".toCharArray(), false);
++ s = Context.fromJAAS("server");
++
++ c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID);
++ s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
++
++ Context.handshake(c, s);
++
++ s.dispose();
++ c.dispose();
++ }
++}
+--- ./jdk/test/sun/security/krb5/auto/MoreKvno.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/krb5/auto/MoreKvno.java Fri Apr 10 09:21:28 2015 -0700
+@@ -23,8 +23,7 @@
+
+ /*
+ * @test
+- * @bug 6893158
+- * @bug 6907425
++ * @bug 6893158 6907425 7197159
+ * @run main/othervm MoreKvno
+ * @summary AP_REQ check should use key version number
+ */
+@@ -69,11 +68,13 @@
+ go(OneKDC.SERVER, "com.sun.security.jgss.krb5.accept", pass);
+ throw new Exception("This test should fail");
+ } catch (GSSException gsse) {
+- KrbException ke = (KrbException)gsse.getCause();
+- if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
+- throw new Exception("Not expected failure code: " +
+- ke.returnCode());
+- }
++ // Since 7197159, different kvno is accepted, this return code
++ // will never be thrown out again.
++ //KrbException ke = (KrbException)gsse.getCause();
++ //if (ke.returnCode() != Krb5.KRB_AP_ERR_BADKEYVER) {
++ // throw new Exception("Not expected failure code: " +
++ // ke.returnCode());
++ //}
+ }
+ }
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/krb5/ccache/DefaultFile.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,47 @@
++/*
++ * Copyright (c) 2014, 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 8054817
++ * @summary File ccache only recognizes Linux and Solaris defaults
++ */
++
++import sun.security.krb5.internal.ccache.FileCredentialsCache;
++
++public class DefaultFile {
++ public static void main(String[] args) throws Exception {
++ // There are 2 cases where default ccache name is not
++ // /tmp/krb5cc_uid.
++ if (System.getenv("KRB5CCNAME") != null) {
++ return;
++ }
++ if (System.getProperty("os.name").startsWith("Windows")) {
++ return;
++ }
++ String name = FileCredentialsCache.getDefaultCacheName();
++ if (!name.startsWith("/tmp/krb5cc_")) {
++ throw new Exception("default name is " + name);
++ }
++ }
++}
+--- ./jdk/test/sun/security/krb5/krb5.conf Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/krb5/krb5.conf Fri Apr 10 09:21:28 2015 -0700
+@@ -27,3 +27,9 @@
+ }
+ }
+
++ NOVAL.COM = {
++ empty1 =
++ empty2 =.
++ quote1 = "
++ quote2 = '
++ }
+--- ./jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/pkcs11/Provider/ConfigShortPath.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2010, 2014, 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
+@@ -22,8 +22,8 @@
+ */
+ /**
+ * @test
+- * @bug 6581254 6986789
+- * @summary Allow '~' and '+' in config file
++ * @bug 6581254 6986789 7196009 8062170
++ * @summary Allow '~', '+', and quoted paths in config file
+ * @author Valerie Peng
+ */
+
+@@ -33,7 +33,9 @@
+
+ public class ConfigShortPath {
+
+- private static final String[] configNames = { "csp.cfg", "cspPlus.cfg" };
++ private static final String[] configNames = {
++ "csp.cfg", "cspPlus.cfg", "cspSpace.cfg", "cspQuotedPath.cfg"
++ };
+
+ public static void main(String[] args) throws Exception {
+ Constructor cons = null;
+@@ -53,12 +55,22 @@
+ Object obj = cons.newInstance(configFile);
+ } catch (InvocationTargetException ite) {
+ Throwable cause = ite.getCause();
++ System.out.println(cause);
+ if (cause instanceof ProviderException) {
+- String causeMsg = cause.getCause().getMessage();
+- // Indicate failure if due to parsing config
+- if (causeMsg.indexOf("Unexpected token") != -1) {
+- throw (ProviderException) cause;
++ while ((cause = cause.getCause()) != null) {
++ System.out.println(cause);
++ String causeMsg = cause.getMessage();
++ // Indicate failure if due to parsing config
++ if (causeMsg.indexOf("Unexpected") != -1) {
++ throw (ProviderException) cause;
++ }
+ }
++ // Consider the test passes if the exception is
++ // thrown after parsing, i.e. due to the absolute
++ // path requirement or the non-existent path.
++ } else {
++ // unexpected exception
++ throw new RuntimeException("Unexpected Exception", cause);
+ }
+ }
+ }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/pkcs11/Provider/cspQuotedPath.cfg Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,6 @@
++showInfo = false
++name=GemPlusPKCS11
++library="C:\\Program Files (x86)\\Gemalto\\Classic Client\\BIN\\gclib.dll"
++attributes(*,CKO_PRIVATE_KEY,*) = {
++ CKA_SIGN = true
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/pkcs11/Provider/cspSpace.cfg Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,5 @@
++showInfo = false
++name = test
++library = C:\pki DLL\x64\acpkcs211.dll
++
++
+--- ./jdk/test/sun/security/smartcardio/TestDirect.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/smartcardio/TestDirect.java Fri Apr 10 09:21:28 2015 -0700
+@@ -30,6 +30,7 @@
+
+ // This test requires special hardware.
+
++import java.util.List;
+ import javax.smartcardio.Card;
+ import javax.smartcardio.CardTerminal;
+ import javax.smartcardio.CardTerminals;
+@@ -38,8 +39,12 @@
+ public class TestDirect {
+ public static void main(String[] args) throws Exception {
+ TerminalFactory terminalFactory = TerminalFactory.getDefault();
+- CardTerminals cardTerminals = terminalFactory.terminals();
+- CardTerminal cardTerminal = cardTerminals.list().get(0);
++ List<CardTerminal> cardTerminals = terminalFactory.terminals().list();
++ System.out.println("Terminals: " + cardTerminals);
++ if (cardTerminals.isEmpty()) {
++ throw new Exception("No card terminals available");
++ }
++ CardTerminal cardTerminal = cardTerminals.get(0);
+ Card card = cardTerminal.connect("DIRECT");
+ card.disconnect(true);
+
+--- ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineBadBufferArrayAccess.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineBadBufferArrayAccess.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2011, 2012, 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
+@@ -146,14 +146,14 @@
+ "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2" };
+
+ for (String protocol : protocols) {
+- log("Testing " + protocol);
+ /*
+ * Run the tests with direct and indirect buffers.
+ */
+- SSLEngineBadBufferArrayAccess test =
+- new SSLEngineBadBufferArrayAccess(protocol);
+- test.runTest(true);
+- test.runTest(false);
++ log("Testing " + protocol + ":true");
++ new SSLEngineBadBufferArrayAccess(protocol).runTest(true);
++
++ log("Testing " + protocol + ":false");
++ new SSLEngineBadBufferArrayAccess(protocol).runTest(false);
+ }
+
+ System.out.println("Test Passed.");
+@@ -287,18 +287,27 @@
+ if (serverClose) {
+ serverEngine.closeOutbound();
+ }
++ }
++
++ if (closed && isEngineClosed(serverEngine)) {
+ serverIn.flip();
+
+ /*
+ * A sanity check to ensure we got what was sent.
+ */
+ if (serverIn.remaining() != clientMsg.length) {
+- throw new Exception("Client: Data length error");
++ throw new Exception("Client: Data length error -" +
++ " IF THIS FAILS, PLEASE REPORT THIS TO THE" +
++ " SECURITY TEAM. WE HAVE BEEN UNABLE TO" +
++ " RELIABLY DUPLICATE.");
+ }
+
+ for (int i = 0; i < clientMsg.length; i++) {
+ if (clientMsg[i] != serverIn.get()) {
+- throw new Exception("Client: Data content error");
++ throw new Exception("Client: Data content error -" +
++ " IF THIS FAILS, PLEASE REPORT THIS TO THE" +
++ " SECURITY TEAM. WE HAVE BEEN UNABLE TO" +
++ " RELIABLY DUPLICATE.");
+ }
+ }
+ serverIn.compact();
+--- ./jdk/test/sun/security/tools/keytool/ListKeychainStore.sh Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/tools/keytool/ListKeychainStore.sh Fri Apr 10 09:21:28 2015 -0700
+@@ -22,7 +22,7 @@
+ #
+
+ # @test
+-# @bug 7133495
++# @bug 7133495 8041740
+ # @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry
+
+ if [ "${TESTJAVA}" = "" ] ; then
+@@ -49,8 +49,10 @@
+ KEYTOOL="${TESTJAVA}/bin/keytool -storetype KeychainStore -keystore NONE -storepass $PWD"
+ TEMPORARY_P12="$TESTCLASSES/7133495.p12"
+ TEMPORARY_KC="$TESTCLASSES/7133495.keychain"
++TEMPORARY_LIST="$TESTCLASSES/7133495.tmp"
+ CLEANUP_P12="rm -f $TEMPORARY_P12"
+ CLEANUP_KC="security delete-keychain $TEMPORARY_KC"
++CLEANUP_LIST="rm -f $TEMPORARY_LIST"
+
+ # Count the number of private key entries in the Keychain keystores
+
+@@ -115,6 +117,15 @@
+ fi
+ echo "Imported keypairs from PKCS12 keystore into the keychain"
+
++# Adjust the keychain search order
++
++echo "\"$TEMPORARY_KC\"" > $TEMPORARY_LIST
++security list-keychains >> $TEMPORARY_LIST
++security list-keychains -s `xargs < ${TEMPORARY_LIST}`
++`$CLEANUP_LIST`
++echo "Temporary keychain search order:"
++security list-keychains
++
+ # Recount the number of private key entries in the Keychain keystores
+
+ COUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l`
+--- ./jdk/test/sun/security/util/HostnameMatcher/TestHostnameChecker.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/security/util/HostnameMatcher/TestHostnameChecker.java Fri Apr 10 09:21:28 2015 -0700
+@@ -187,6 +187,9 @@
+ in = new FileInputStream(new File(PATH, "cert4.crt"));
+ X509Certificate cert4 = (X509Certificate)cf.generateCertificate(in);
+ in.close();
++ in = new FileInputStream(new File(PATH, "cert5.crt"));
++ X509Certificate cert5 = (X509Certificate)cf.generateCertificate(in);
++ in.close();
+
+ HostnameChecker checker = HostnameChecker.getInstance(
+ HostnameChecker.TYPE_TLS);
+@@ -202,6 +205,9 @@
+ check(checker, "5.6.7.8", cert3, true);
+ check(checker, "foo.bar.com", cert4, true);
+ check(checker, "altfoo.bar.com", cert4, true);
++ check(checker, "2001:db8:3c4d:15::1a2f:1a2b", cert5, true);
++ check(checker, "2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b", cert5, true);
++ check(checker, "2002:db8:3c4d:15::1a2f:1a2b", cert5, false);
+
+ checker = HostnameChecker.getInstance(
+ HostnameChecker.TYPE_LDAP);
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/security/util/HostnameMatcher/cert5.crt Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,24 @@
++-----BEGIN CERTIFICATE-----
++MIIECDCCAvCgAwIBAgIJAJaBmuUlfY8sMA0GCSqGSIb3DQEBBQUAMIGmMQswCQYD
++VQQGEwJVUzETMBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJU29tZS1DaXR5
++MSowKAYDVQQKDCFVbmNvbmZpZ3VyZWQgT3BlblNTTCBJbnN0YWxsYXRpb24xEDAO
++BgNVBAsMB3NlY3Rpb24xMDAuBgNVBAMMJzIwMDE6MGRiODozYzRkOjAwMTU6MDAw
++MDowMDAwOjFhMmY6MWEyYjAeFw0xNTAyMTAxODMzMjBaFw0xNTAzMTIxODMzMjBa
++MIGmMQswCQYDVQQGEwJVUzETMBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJ
++U29tZS1DaXR5MSowKAYDVQQKDCFVbmNvbmZpZ3VyZWQgT3BlblNTTCBJbnN0YWxs
++YXRpb24xEDAOBgNVBAsMB3NlY3Rpb24xMDAuBgNVBAMMJzIwMDE6MGRiODozYzRk
++OjAwMTU6MDAwMDowMDAwOjFhMmY6MWEyYjCCASIwDQYJKoZIhvcNAQEBBQADggEP
++ADCCAQoCggEBAMcigWxmeF6Dmo3xAw3y/8d3vB8Th4YsmvwXb9DxwNWV+B3vxJgq
++ww6T6VBxrle1bgu/RtZDJwLf5vMhVElxuuE86di2qyurKFbpe29C9xnCxuMlXpje
++X2pNknz4ZzOqD4opmIAFjXZ2Xp1kLt+HJX7ABoz7Uga+IbVfDRPPf2KOqYNpBQkp
++dgI5VOZDQNVNb+8vdXDwyanMQ0TgPXKL4BQIkGB4RM8sgpPMUvB+tEB7zmUtgSco
++2a5M84wIhxv85CmFFoTVSzXsRCDhVAZj0aHRkkmAsMSmzPa4HiPnuVRV740oQjDy
++oMGLndaEs2nxIqckUFHOHcSTf0/wmcvPbIsCAwEAAaM3MDUwCQYDVR0TBAIwADAL
++BgNVHQ8EBAMCBeAwGwYDVR0RBBQwEocQIAENuDxNABUAAAAAGi8aKzANBgkqhkiG
++9w0BAQUFAAOCAQEAtnelRbYPPZRgTd4oxOiPqwc01EE9JgtkFWlooCwVUDChOR2k
++us1qlhKsvbN2Tcsm1Ss3p0Uxk/g1o2/mY8rA/dJ8qiN6jbfjpEi8b2MirP5tQSE0
++QNXbVGr5FnLbuUmn+82pB0vBSaq7gxehbV6S7dteyQUnb2imltC5wS9PwYb8wWx7
++IpyXWt0jkYkC8KJEevVYI7qtwpjYhyc1FqwzUiPmdqGz2AFLQ4RgTXJi93SPoyKM
++s65oPV+r6/0qwnslScxVfszHxxFn1Yfsc5Oseare1MnlNzH69PmWs523C/fBvnB2
++MsHKLPdoN7uSpBLB7j46g5jQG/ceri/cquZKYA==
++-----END CERTIFICATE-----
+--- ./jdk/test/sun/text/resources/LocaleData Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/text/resources/LocaleData Fri Apr 10 09:21:28 2015 -0700
+@@ -7027,3 +7027,9 @@
+
+ # bug 8021121
+ CurrencyNames/lv_LV/EUR=\u20AC
++
++# bug 6931564
++LocaleNames/sv/ZA=Sydafrika
++
++# bug 8027695
++FormatData/sv_SE/NumberPatterns/2=#,##0 %
+--- ./jdk/test/sun/text/resources/LocaleDataTest.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/text/resources/LocaleDataTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -34,7 +34,7 @@
+ * 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
+ * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
+ * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7189611
+- * 7171028 8013836 7028073 7195759 7085757
++ * 7171028 8013836 7028073 7195759 7085757 6931564 8027695
+ * @summary Verify locale data
+ *
+ */
+--- ./jdk/test/sun/tools/jconsole/ResourceCheckTest.java Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/tools/jconsole/ResourceCheckTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2004, 2014, 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
+@@ -27,377 +27,134 @@
+ * This isn't the test case: ResourceCheckTest.sh is.
+ * Refer to ResourceCheckTest.sh when running this test.
+ *
+- * @bug 5008856 5023573 5024917 5062569
++ * @bug 5008856 5023573 5024917 5062569 7172176
+ * @summary 'missing resource key' error for key = "Operating system"
+ */
+
+-import java.awt.event.KeyEvent;
++import java.lang.reflect.Field;
++import java.lang.reflect.Modifier;
++import java.util.ArrayList;
++import java.util.Collections;
++import java.util.List;
++import java.util.Locale;
++import java.util.ResourceBundle;
+
++import sun.tools.jconsole.Messages;
+ import sun.tools.jconsole.Resources;
+
++/*
++ * Ensures that there is a one-to-one mapping between constants in the
++ * Message class and the keys in the sun.tools.jconsole.resources.messages
++ * bundle.
++ *
++ * An error will be thrown if there is a:
++ *
++ * - key in the resource bundle that doesn't have a public static field with
++ * the same name in the Message class.
++ *
++ * - public static field in the Message class that doesn't have a key with
++ * the same name in the resource bundle.
++ *
++ * - message with a mnemonic identifier(&) for which a mnemonic can't
++ * be looked up using Resources#getMnemonicInt().
++ *
++ */
+ public class ResourceCheckTest {
++ private static final String MISSING_RESOURCE_KEY_PREFIX = "missing message for";
++ private static final String RESOURCE_BUNDLE = "sun.tools.jconsole.resources.messages";
++ private static final String NEW_LINE = String.format("%n");
+
+- public static void main(String[] args){
+- Object [][] testData = {
+- {"<", "", "", "", ""},
+- {"<<", "", "", "", ""},
+- {">", "", "", "", ""},
+- {" 1 day", "", "", "", ""},
+- {" 1 hour", "", "", "", ""},
+- {" 1 min", "", "", "", ""},
+- {" 1 month", "", "", "", ""},
+- {" 1 year", "", "", "", ""},
+- {" 2 hours", "", "", "", ""},
+- {" 3 hours", "", "", "", ""},
+- {" 3 months", "", "", "", ""},
+- {" 5 min", "", "", "", ""},
+- {" 6 hours", "", "", "", ""},
+- {" 6 months", "", "", "", ""},
+- {" 7 days", "", "", "", ""},
+- {"10 min", "", "", "", ""},
+- {"12 hours", "", "", "", ""},
+- {"30 min", "", "", "", ""},
+- {"ACTION", "", "", "", ""},
+- {"ACTION_INFO", "", "", "", ""},
+- {"All", "", "", "", ""},
+- {"Architecture", "", "", "", ""},
+- {"Attribute", "", "", "", ""},
+- {"Attribute value", "", "", "", ""},
+- {"Attribute values", "", "", "", ""},
+- {"Attributes", "", "", "", ""},
+- {"Blank", "", "", "", ""},
+- {"BlockedCount WaitedCount", "BlockedCount", "WaitedCount", "", ""},
+- {"Boot class path", "", "", "", ""},
+- {"BorderedComponent.moreOrLessButton.toolTip", "", "", "", ""},
+- {"Close", "", "", "", ""},
+- {"CPU Usage", "", "", "", ""},
+- {"CPUUsageFormat","PhonyPercentage", "", "", ""},
+- {"Cancel", "", "", "", ""},
+- {"Cascade", "", "", "", ""},
+- {"Cascade.mnemonic", "", "", "", ""},
+- {"Chart:", "", "", "", ""},
+- {"Chart:.mnemonic", "", "", "", ""},
+- {"ClassTab.infoLabelFormat", "LoadedCount", "UnloadedCount", "TotalCount", ""},
+- {"ClassTab.loadedClassesPlotter.accessibleName", "", "", "", ""},
+- {"Class path", "", "", "", ""},
+- {"Classes", "", "", "", ""},
+- {"ClassName", "", "", "", ""},
+- {"Column.Name", "", "", "", ""},
+- {"Column.PID", "", "", "", ""},
+- {"Committed", "", "", "", ""},
+- {"Committed memory", "", "", "", ""},
+- {"Committed virtual memory", "", "", "", ""},
+- {"Compiler", "", "", "", ""},
+- {"Connect...", "", "", "", ""},
+- {"Connect", "", "", "", ""},
+- {"Connect.mnemonic", "", "", "", ""},
+- {"ConnectDialog.connectButton.toolTip", "", "", "", ""},
+- {"ConnectDialog.accessibleDescription", "", "", "", ""},
+- {"ConnectDialog.masthead.accessibleName", "", "", "", ""},
+- {"ConnectDialog.masthead.title", "", "", "", ""},
+- {"ConnectDialog.statusBar.accessibleName", "", "", "", ""},
+- {"ConnectDialog.title", "", "", "", ""},
+- {"Connected. Click to disconnect.", "", "", "", ""},
+- {"connectingTo1", "PhonyConnectionName", "", "", ""},
+- {"connectingTo2", "PhonyConnectionName", "", "", ""},
+- {"connectionFailed1", "", "", "", ""},
+- {"connectionFailed2", "PhonyConnectionName", "", "", ""},
+- {"connectionLost1", "", "", "", ""},
+- {"connectionLost2", "PhonyConnectionName", "", "", ""},
+- {"Connection failed", "", "", "", ""},
+- {"Connection", "", "", "", ""},
+- {"Connection.mnemonic", "", "", "", ""},
+- {"Connection name", "", "", "", ""},
+- {"ConnectionName (disconnected)", "Phony", "Phony", "", ""},
+- {"Constructor", "", "", "", ""},
+- {"Create", "Phony", "Phony", "", ""},
+- {"Current classes loaded", "", "", "", ""},
+- {"Current heap size", "", "", "", ""},
+- {"Current value", "PhonyValue", "", "", ""},
+- {"Daemon threads", "", "", "", ""},
+- {"deadlockAllTab", "", "", "", ""},
+- {"deadlockTab", "", "", "", ""},
+- {"deadlockTabN", "PhonyInt", "", "", ""},
+- {"Description", "", "", "", ""},
+- {"Descriptor", "", "", "", ""},
+- {"Details", "", "", "", ""},
+- {"Detect Deadlock", "", "", "", ""},
+- {"Detect Deadlock.mnemonic", "", "", "", ""},
+- {"Detect Deadlock.toolTip", "", "", "", ""},
+- {"Dimension is not supported:", "", "", "", ""},
+- {"Discard chart", "", "", "", ""},
+- {"Disconnected. Click to connect.", "", "", "", ""},
+- {"Double click to expand/collapse", "", "", "", ""},
+- {"Double click to visualize", "", "", "", ""},
+- {"DurationDaysHoursMinutes", 0, 13, 54, ""},
+- {"DurationDaysHoursMinutes", 1, 13, 54, ""},
+- {"DurationDaysHoursMinutes", 2, 13, 54, ""},
+- {"DurationDaysHoursMinutes", 1024, 13, 45, ""},
+- {"DurationHoursMinutes", 0, 13, "", ""},
+- {"DurationHoursMinutes", 1, 0, "", ""},
+- {"DurationHoursMinutes", 1, 1, "", ""},
+- {"DurationHoursMinutes", 2, 42, "", ""},
+- {"DurationMinutes", 0, "", "", ""},
+- {"DurationMinutes", 1, "", "", ""},
+- {"DurationMinutes", 2, "", "", ""},
+- {"DurationSeconds", 0, "", "", ""},
+- {"DurationSeconds", 1, "", "", ""},
+- {"DurationSeconds", 2, "", "", ""},
+- {"Empty array", "", "", "", ""},
+- {"Error", "", "", "", ""},
+- {"Error: MBeans already exist", "", "", "", ""},
+- {"Error: MBeans do not exist", "", "", "", ""},
+- {"Event", "", "", "", ""},
+- {"Exit", "", "", "", ""},
+- {"Exit.mnemonic", "", "", "", ""},
+- {"expand", "", "", "", ""},
+- {"Fail to load plugin", "", "", "", ""},
+- {"FileChooser.fileExists.cancelOption", "", "", "", ""},
+- {"FileChooser.fileExists.message", "PhonyFileName", "", "", ""},
+- {"FileChooser.fileExists.okOption", "", "", "", ""},
+- {"FileChooser.fileExists.title", "", "", "", ""},
+- {"FileChooser.savedFile", "PhonyFilePath", "PhonyFileSize", "", ""},
+- {"FileChooser.saveFailed.message", "PhonyFilePath", "PhonyMessage", "", ""},
+- {"FileChooser.saveFailed.title", "", "", "", ""},
+- {"Free physical memory", "", "", "", ""},
+- {"Free swap space", "", "", "", ""},
+- {"Garbage collector", "", "", "", ""},
+- {"GC time", "", "", "", ""},
+- {"GC time details", 54, "Phony", 11, ""},
+- {"GcInfo", "Phony", -1, 768, ""},
+- {"GcInfo", "Phony", 0, 768, ""},
+- {"GcInfo", "Phony", 1, 768, ""},
+- {"Heap", "", "", "", ""},
+- {"Heap Memory Usage", "", "", "", ""},
+- {"Help.AboutDialog.accessibleDescription", "", "", "", ""},
+- {"Help.AboutDialog.jConsoleVersion", "DummyVersion", "", "", ""},
+- {"Help.AboutDialog.javaVersion", "DummyVersion", "", "", ""},
+- {"Help.AboutDialog.masthead.accessibleName", "", "", "", ""},
+- {"Help.AboutDialog.masthead.title", "", "", "", ""},
+- {"Help.AboutDialog.title", "", "", "", ""},
+- {"Help.AboutDialog.userGuideLink", "DummyMessage", "", "", ""},
+- {"Help.AboutDialog.userGuideLink.mnemonic", "", "", "", ""},
+- {"Help.AboutDialog.userGuideLink.url", "DummyURL", "", "", ""},
+- {"HelpMenu.About.title", "", "", "", ""},
+- {"HelpMenu.About.title.mnemonic", "", "", "", ""},
+- {"HelpMenu.UserGuide.title", "", "", "", ""},
+- {"HelpMenu.UserGuide.title.mnemonic", "", "", "", ""},
+- {"HelpMenu.title", "", "", "", ""},
+- {"HelpMenu.title.mnemonic", "", "", "", ""},
+- {"Hotspot MBeans...", "", "", "", ""},
+- {"Hotspot MBeans....mnemonic", "", "", "", ""},
+- {"Hotspot MBeans.dialog.accessibleDescription", "", "", "", ""},
+- {"Impact", "", "", "", ""},
+- {"Info", "", "", "", ""},
+- {"INFO", "", "", "", ""},
+- {"Invalid plugin path", "", "", "", ""},
+- {"Invalid URL", "", "", "", ""},
+- {"Is", "", "", "", ""},
+- {"Java Monitoring & Management Console", "", "", "", ""},
+- {"Java Virtual Machine", "", "", "", ""},
+- {"JConsole: ", "", "", "", ""},
+- {"JConsole.accessibleDescription", "", "", "", ""},
+- {"JConsole version", "PhonyVersion", "", "", ""},
+- {"JIT compiler", "", "", "", ""},
+- {"Library path", "", "", "", ""},
+- {"Live Threads", "", "", "", ""},
+- {"Loaded", "", "", "", ""},
+- {"Local Process:", "", "", "", ""},
+- {"Local Process:.mnemonic", "", "", "", ""},
+- {"Manage Hotspot MBeans in: ", "", "", "", ""},
+- {"Management Not Enabled", "", "", "", ""},
+- {"Management Will Be Enabled", "", "", "", ""},
+- {"Masthead.font", "", "", "", ""},
+- {"Max", "", "", "", ""},
+- {"Max", "", "", "", ""},
+- {"Maximum heap size", "", "", "", ""},
+- {"MBeanAttributeInfo", "", "", "", ""},
+- {"MBeanInfo", "", "", "", ""},
+- {"MBeanNotificationInfo", "", "", "", ""},
+- {"MBeanOperationInfo", "", "", "", ""},
+- {"MBeans", "", "", "", ""},
+- {"MBeansTab.clearNotificationsButton", "", "", "", ""},
+- {"MBeansTab.clearNotificationsButton.mnemonic", "", "", "", ""},
+- {"MBeansTab.clearNotificationsButton.toolTip", "", "", "", ""},
+- {"MBeansTab.compositeNavigationMultiple", 0, 0, "", ""},
+- {"MBeansTab.compositeNavigationSingle", "", "", "", ""},
+- {"MBeansTab.refreshAttributesButton", "", "", "", ""},
+- {"MBeansTab.refreshAttributesButton.mnemonic", "", "", "", ""},
+- {"MBeansTab.refreshAttributesButton.toolTip", "", "", "", ""},
+- {"MBeansTab.subscribeNotificationsButton", "", "", "", ""},
+- {"MBeansTab.subscribeNotificationsButton.mnemonic", "", "", "", ""},
+- {"MBeansTab.subscribeNotificationsButton.toolTip", "", "", "", ""},
+- {"MBeansTab.tabularNavigationMultiple", 0, 0, "", ""},
+- {"MBeansTab.tabularNavigationSingle", "", "", "", ""},
+- {"MBeansTab.unsubscribeNotificationsButton", "", "", "", ""},
+- {"MBeansTab.unsubscribeNotificationsButton.mnemonic", "", "", "", ""},
+- {"MBeansTab.unsubscribeNotificationsButton.toolTip", "", "", "", ""},
+- {"Memory", "", "", "", ""},
+- {"MemoryPoolLabel", "PhonyMemoryPool", "", "", ""},
+- {"MemoryTab.heapPlotter.accessibleName", "", "", "", ""},
+- {"MemoryTab.infoLabelFormat", "UsedCount", "CommittedCount", "MaxCount", ""},
+- {"MemoryTab.nonHeapPlotter.accessibleName", "", "", "", ""},
+- {"MemoryTab.poolChart.aboveThreshold", "Threshold", "", "", ""},
+- {"MemoryTab.poolChart.accessibleName", "", "", "", ""},
+- {"MemoryTab.poolChart.belowThreshold", "Threshold", "", "", ""},
+- {"MemoryTab.poolPlotter.accessibleName", "PhonyMemoryPool", "", "", ""},
+- {"Message", "", "", "", ""},
+- {"Method successfully invoked", "", "", "", ""},
+- {"Monitor locked", "", "", "", ""},
+- {"Minimize All", "", "", "", ""},
+- {"Minimize All.mnemonic", "", "", "", ""},
+- {"Name", "", "", "", ""},
+- {"Name and Build", "PhonyName", "PhonyBuild", "", ""},
+- {"Name Build and Mode", "PhonyName", "PhonyBuild", "PhonyMode", ""},
+- {"Name State", "PhonyName", "PhonyState", "", ""},
+- {"Name State LockName", "PhonyName", "PhonyState", "PhonyLock", ""},
+- {"Name State LockName LockOwner", "PhonyName", "PhonyState", "PhonyLock", "PhonyOwner"},
+- {"New Connection...", "", "", "", ""},
+- {"New Connection....mnemonic", "", "", "", ""},
+- {"No deadlock detected", "", "", "", ""},
+- {"Non-Heap", "", "", "", ""},
+- {"Non-Heap Memory Usage", "", "", "", ""},
+- {"Notification", "", "", "", ""},
+- {"Notification buffer", "", "", "", ""},
+- {"Notifications", "", "", "", ""},
+- {"NotifTypes", "", "", "", ""},
+- {"Number of Loaded Classes", "", "", "", ""},
+- {"Number of processors", "", "", "", ""},
+- {"Number of Threads", "", "", "", ""},
+- {"ObjectName", "", "", "", ""},
+- {"Operating System", "", "", "", ""},
+- {"Operation", "", "", "", ""},
+- {"Operation invocation", "", "", "", ""},
+- {"Operation return value", "", "", "", ""},
+- {"Operations", "", "", "", ""},
+- {"Overview", "", "", "", ""},
+- {"OverviewPanel.plotter.accessibleName", "PhonyPlotter", "", "", ""},
+- {"Parameter", "", "", "", ""},
+- {"Password: ", "", "", "", ""},
+- {"Password: .mnemonic", "", "", "", ""},
+- {"Password.accessibleName", "", "", "", ""},
+- {"Peak", "", "", "", ""},
+- {"Perform GC", "", "", "", ""},
+- {"Perform GC.mnemonic", "", "", "", ""},
+- {"Perform GC.toolTip", "", "", "", ""},
+- {"Plotter.accessibleName", "", "", "", ""},
+- {"Plotter.accessibleName.keyAndValue", "Key", "Value", "", ""},
+- {"Plotter.accessibleName.noData", "", "", "", ""},
+- {"Plotter.saveAsMenuItem", "", "", "", ""},
+- {"Plotter.saveAsMenuItem.mnemonic", "", "", "", ""},
+- {"Plotter.timeRangeMenu", "", "", "", ""},
+- {"Plotter.timeRangeMenu.mnemonic", "", "", "", ""},
+- {"plot", "", "", "", ""},
+- {"Problem adding listener", "", "", "", ""},
+- {"Problem displaying MBean", "", "", "", ""},
+- {"Problem invoking", "", "", "", ""},
+- {"Problem removing listener", "", "", "", ""},
+- {"Problem setting attribute", "", "", "", ""},
+- {"Process CPU time", "", "", "", ""},
+- {"Readable", "", "", "", ""},
+- {"Reconnect", "", "", "", ""},
+- {"Remote Process:", "", "", "", ""},
+- {"Remote Process:.mnemonic", "", "", "", ""},
+- {"Remote Process.textField.accessibleName", "", "", "", ""},
+- {"remoteTF.usage", "", "", "", ""},
+- {"Restore All", "", "", "", ""},
+- {"Restore All.mnemonic", "", "", "", ""},
+- {"ReturnType", "", "", "", ""},
+- {"SeqNum", "", "", "", ""},
+- {"Size Bytes", 512, "", "", ""},
+- {"Size Gb", 512, "", "", ""},
+- {"Size Kb", 512, "", "", ""},
+- {"Size Mb", 512, "", "", ""},
+- {"Source", "", "", "", ""},
+- {"Stack trace", "", "", "", ""},
+- {"SummaryTab.headerDateTimeFormat", "", "", "", ""},
+- {"SummaryTab.pendingFinalization.label", "", "", "", ""},
+- {"SummaryTab.pendingFinalization.value", "ObjectCount", "", "", ""},
+- {"SummaryTab.tabName", "", "", "", ""},
+- {"SummaryTab.vmVersion", "VMName", "VMVersion", "", ""},
+- {"ThreadTab.infoLabelFormat", "LiveCount", "PeakCount", "TotalCount", ""},
+- {"ThreadTab.threadInfo.accessibleName", "", "", "", ""},
+- {"ThreadTab.threadPlotter.accessibleName", "", "", "", ""},
+- {"Threads", "", "", "", ""},
+- {"Threshold", "", "", "", ""},
+- {"Tile", "", "", "", ""},
+- {"Tile.mnemonic", "", "", "", ""},
+- {"Time", "", "", "", ""},
+- {"Time Range:", "", "", "", ""},
+- {"Time Range:.mnemonic", "", "", "", ""},
+- {"TimeStamp", "", "", "", ""},
+- {"Total classes loaded", "", "", "", ""},
+- {"Total classes unloaded", "", "", "", ""},
+- {"Total compile time", "", "", "", ""},
+- {"Total Loaded", "", "", "", ""},
+- {"Total physical memory", "", "", "", ""},
+- {"Total swap space", "", "", "", ""},
+- {"Total threads started", "", "", "", ""},
+- {"Type", "", "", "", ""},
+- {"Unavailable", "", "", "", ""},
+- {"UNKNOWN", "", "", "", ""},
+- {"Unregister", "", "", "", ""},
+- {"Uptime", "", "", "", ""},
+- {"Usage Threshold", "", "", "", ""},
+- {"Used", "", "", "", ""},
+- {"Username: ", "", "", "", ""},
+- {"Username: .mnemonic", "", "", "", ""},
+- {"Username.accessibleName", "", "", "", ""},
+- {"UserData", "", "", "", ""},
+- {"Value", "", "", "", ""},
+- {"Vendor", "", "", "", ""},
+- {"Verbose Output", "", "", "", ""},
+- {"Verbose Output.toolTip", "", "", "", ""},
+- {"visualize", "", "", "", ""},
+- {"VM", "", "", "", ""},
+- {"VMInternalFrame.accessibleDescription", "", "", "", ""},
+- {"VM arguments", "", "", "", ""},
+- {"Virtual Machine", "", "", "", ""},
+- {"Window", "", "", "", ""},
+- {"Window.mnemonic", "", "", "", ""},
+- {"Writable", "", "", "", ""},
+- {"zz usage text", "PhonyName", "", "", ""},
+- };
+- //boolean verbose = false;
+- boolean verbose = true;
+-
+- long badLookups = 0;
+- System.out.println("Start...");
+- for (int ii = 0; ii < testData.length; ii++) {
+- String key = (String)testData[ii][0];
+-
+- if (key.endsWith(".mnemonic")) {
+- String baseKey = key.substring(0, key.length() - ".mnemonic".length());
+- int mnemonic = Resources.getMnemonicInt(baseKey);
+- if (mnemonic == 0) {
+- badLookups++;
+- System.out.println("****lookup failed for key = " + key);
++ public static void main(String... args) {
++ List<String> errors = new ArrayList<>();
++ // Ensure that all Message fields have a corresponding key/value
++ // in the resource bundle and that mnemonics can be looked
++ // up where applicable.
++ ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_BUNDLE);
++ for (Field field : Messages.class.getFields()) {
++ if (isResourceKeyField(field)) {
++ String resourceKey = field.getName();
++ String message = readField(field);
++ if (message.startsWith(MISSING_RESOURCE_KEY_PREFIX)) {
++ errors.add("Can't find message (and perhaps mnemonic) for "
++ + Messages.class.getSimpleName() + "."
++ + resourceKey + " in resource bundle.");
+ } else {
+- if (verbose) {
+- System.out.println(" mnemonic: " + KeyEvent.getKeyText(mnemonic));
++ String resourceMessage = rb.getString(resourceKey);
++ if (hasMnemonicIdentifier(resourceMessage)) {
++ int mi = Resources.getMnemonicInt(message);
++ if (mi == 0) {
++ errors.add("Could not look up mnemonic for message '"
++ + message + "'.");
++ }
+ }
+ }
+- continue;
+- }
+-
+- String ss = Resources.getText(key,
+- testData[ii][1],
+- testData[ii][2],
+- testData[ii][3],
+- testData[ii][4]);
+- if (ss.startsWith("missing resource key")) {
+- badLookups++;
+- System.out.println("****lookup failed for key = " + key);
+- } else {
+- if (verbose) {
+- System.out.println(" " + ss);
+- }
+ }
+ }
+- if (badLookups > 0) {
+- throw new Error ("Resource lookup failed " + badLookups +
+- " time(s); Test failed");
++
++ // Ensure that there is Message class field for every resource key.
++ for (String key : Collections.list(rb.getKeys())) {
++ try {
++ Messages.class.getField(key);
++ } catch (NoSuchFieldException nfe) {
++ errors.add("Can't find static field ("
++ + Messages.class.getSimpleName() + "." + key
++ + ") matching '" + key
++ + "' in resource bundle. Unused message?");
++ }
+ }
+- System.out.println("...Finished.");
++
++ if (errors.size() > 0) {
++ throwError(errors);
++ }
++ }
++
++ private static String readField(Field field) {
++ try {
++ return (String) field.get(null);
++ } catch (IllegalArgumentException | IllegalAccessException e) {
++ throw new Error("Could not access field " + field.getName()
++ + " when trying to read resource message.");
++ }
++ }
++
++ private static boolean isResourceKeyField(Field field) {
++ int modifiers = field.getModifiers();
++ return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers);
++ }
++
++ private static boolean hasMnemonicIdentifier(String s) {
++ for (int i = 0; i < s.length() - 1; i++) {
++ if (s.charAt(i) == '&') {
++ if (s.charAt(i + 1) != '&') {
++ return true;
++ } else {
++ i++;
++ }
++ }
++ }
++ return false;
++ }
++
++ private static void throwError(List<String> errors) {
++ StringBuffer buffer = new StringBuffer();
++ buffer.append("Found ");
++ buffer.append(errors.size());
++ buffer.append(" error(s) when checking one-to-one mapping ");
++ buffer.append("between Message and resource bundle keys in ");
++ buffer.append(RESOURCE_BUNDLE);
++ buffer.append(" with ");
++ buffer.append(Locale.getDefault());
++ buffer.append(" locale.");
++ buffer.append(NEW_LINE);
++ int errorIndex = 1;
++ for (String error : errors) {
++ buffer.append("Error ");
++ buffer.append(errorIndex);
++ buffer.append(": ");
++ buffer.append(error);
++ buffer.append(NEW_LINE);
++ errorIndex++;
++ }
++ throw new Error(buffer.toString());
+ }
+ }
+--- ./jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Mon Jan 05 11:57:27 2015 -0800
++++ ./jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Fri Apr 10 09:21:28 2015 -0700
+@@ -1,5 +1,5 @@
+ #
+-# Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
++# Copyright (c) 2004, 2014, 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
+@@ -54,7 +54,7 @@
+
+ OS=`uname -s`
+ case "$OS" in
+- SunOS | Linux )
++ SunOS | Linux | Darwin)
+ PATHSEP=":"
+ ;;
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/JstatGCUtilParser.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,155 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.util.Arrays;
++
++import jdk.testlibrary.Utils;
++import static jdk.testlibrary.Asserts.*;
++
++/**
++ * The helper class for parsing following output from command 'jstat -gcutil':
++ *
++ * S0 S1 E O P YGC YGCT FGC FGCT GCT
++ * 100.00 0.00 25.07 10.96 26.17 2 0.008 1 0.032 0.040
++ * 100.00 0.00 31.34 10.96 26.17 2 0.008 1 0.032 0.040
++ * 100.00 0.00 34.29 10.96 26.17 2 0.008 1 0.032 0.040
++ * 100.00 0.00 35.33 10.96 26.17 2 0.008 1 0.032 0.040
++ * 100.00 0.00 36.37 10.96 26.17 2 0.008 1 0.032 0.040
++ *
++ * It will be verified that numerical values have defined types and are reasonable,
++ * for example percentage should fit within 0-100 interval.
++ */
++public class JstatGCUtilParser {
++
++ public enum GcStatisticsType {
++ INTEGER, DOUBLE, PERCENTAGE, PERCENTAGE_OR_DASH;
++ }
++
++ public enum GcStatistics {
++ S0(GcStatisticsType.PERCENTAGE),
++ S1(GcStatisticsType.PERCENTAGE),
++ E(GcStatisticsType.PERCENTAGE),
++ O(GcStatisticsType.PERCENTAGE),
++ P(GcStatisticsType.PERCENTAGE),
++ YGC(GcStatisticsType.INTEGER),
++ YGCT(GcStatisticsType.DOUBLE),
++ FGC(GcStatisticsType.INTEGER),
++ FGCT(GcStatisticsType.DOUBLE),
++ GCT(GcStatisticsType.DOUBLE);
++
++ private final GcStatisticsType type;
++
++ private GcStatistics(GcStatisticsType type) {
++ this.type = type;
++ }
++
++ private GcStatisticsType getType() {
++ return type;
++ }
++
++ public static boolean isHeadline(String... valueArray) {
++ if (valueArray.length != values().length) {
++ return false;
++ }
++ int headersCount = 0;
++ for (int i = 0; i < values().length; i++) {
++ if (valueArray[i].equals(values()[i].toString())) {
++ headersCount++;
++ }
++ }
++ if (headersCount != values().length) {
++ return false;
++ }
++ return true;
++ }
++
++ private static void verifyLength(String... valueArray) throws Exception {
++ assertEquals(valueArray.length, values().length,
++ "Invalid number of data columns: " + Arrays.toString(valueArray));
++ }
++
++ public static void verify(String... valueArray) throws Exception {
++ verifyLength(valueArray);
++ for (int i = 0; i < values().length; i++) {
++ GcStatisticsType type = values()[i].getType();
++ String value = valueArray[i].trim();
++ if (type.equals(GcStatisticsType.INTEGER)) {
++ Integer.parseInt(value);
++ break;
++ }
++ if (type.equals(GcStatisticsType.DOUBLE)) {
++ Double.parseDouble(value);
++ break;
++ }
++ if (type.equals(GcStatisticsType.PERCENTAGE_OR_DASH) &&
++ value.equals("-")) {
++ break;
++ }
++ double percentage = Double.parseDouble(value);
++ assertTrue(0 <= percentage && percentage <= 100,
++ "Not a percentage: " + value);
++ }
++ }
++
++ }
++
++ private final String output;
++
++ public JstatGCUtilParser(String output) {
++ this.output = output;
++ }
++
++ public String getOutput() {
++ return output;
++ }
++
++ /**
++ * The function will discard any lines that come before the header line.
++ * This can happen if the JVM outputs a warning message for some reason
++ * before running jstat.
++ */
++ public void parse(int samples) throws Exception {
++ boolean headlineFound = false;
++ int datalineCount = 0;
++
++ String[] lines = output.split(Utils.NEW_LINE);
++ for (String line : lines) {
++ line = line.replaceAll("\\s+", " ").trim();
++ String[] valueArray = line.split(" ");
++
++ if (!headlineFound) {
++ headlineFound = GcStatistics.isHeadline(valueArray);
++ continue;
++ }
++
++ GcStatistics.verify(valueArray);
++ datalineCount++;
++ }
++
++ assertTrue(headlineFound, "No or invalid headline found, expected: " +
++ Utils.NEW_LINE + Arrays.toString(GcStatistics.values()).replaceAll(",", " "));
++ assertEquals(samples, datalineCount,
++ "Expected " + samples + " samples, got " + datalineCount);
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/JstatdTest.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,356 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import java.io.File;
++import java.net.UnknownHostException;
++import java.rmi.RemoteException;
++import java.rmi.registry.LocateRegistry;
++import java.rmi.registry.Registry;
++import java.util.Arrays;
++
++import static jdk.testlibrary.Asserts.*;
++import jdk.testlibrary.JDKToolLauncher;
++import jdk.testlibrary.OutputAnalyzer;
++import jdk.testlibrary.ProcessThread;
++import jdk.testlibrary.TestThread;
++import jdk.testlibrary.Utils;
++
++/**
++ * The base class for tests of jstatd.
++ *
++ * The test sequence for TestJstatdDefaults for example is:
++ * <pre>
++ * {@code
++ * // start jstatd process
++ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
++ *
++ * // run jps and verify its output
++ * jps -J-XX:+UsePerfData hostname
++ *
++ * // run jstat and verify its output
++ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname 250 5
++ *
++ * // stop jstatd process and verify that no unexpected exceptions have been thrown
++ * }
++ * </pre>
++ */
++public final class JstatdTest {
++
++ /**
++ * jstat gcutil option: takes JSTAT_GCUTIL_SAMPLES samples at
++ * JSTAT_GCUTIL_INTERVAL_MS millisecond intervals
++ */
++ private static final int JSTAT_GCUTIL_SAMPLES = 5;
++ private static final int JSTAT_GCUTIL_INTERVAL_MS = 250;
++ private static final String JPS_OUTPUT_REGEX = "^\\d+\\s*.*";
++
++ private boolean useDefaultPort = true;
++ private String port;
++ private String serverName;
++ private String jstatdPid;
++ private boolean withExternalRegistry = false;
++
++ public void setServerName(String serverName) {
++ this.serverName = serverName;
++ }
++
++ public void setUseDefaultPort(boolean useDefaultPort) {
++ this.useDefaultPort = useDefaultPort;
++ }
++
++ public void setWithExternalRegistry(boolean withExternalRegistry) {
++ this.withExternalRegistry = withExternalRegistry;
++ }
++
++ /**
++ * Parse pid from jps output
++ */
++ private String parsePid(String tool, OutputAnalyzer output) throws Exception {
++ String[] lines = output.getOutput().split(Utils.NEW_LINE);
++ String pid = null;
++ int count = 0;
++ String processName = tool;
++ if (tool == "rmiregistry") {
++ processName = "registryimpl";
++ }
++ for (String line : lines) {
++ if (line.toLowerCase().matches("^\\d+\\s{1}" + processName + "$")) {
++ pid = line.split(" ")[0];
++ count++;
++ }
++ }
++ if (count > 1) {
++ throw new Exception("Expected one " + tool
++ + " process, got " + count + ". Test will be canceled.");
++ }
++
++ return pid;
++ }
++
++ private String getToolPid(String tool)
++ throws Exception {
++ OutputAnalyzer output = runJps();
++ return parsePid(tool, output);
++ }
++
++ private String waitOnTool(String tool, TestThread thread) throws Throwable {
++ while (true) {
++ String pid = getToolPid(tool);
++
++ if (pid != null) {
++ System.out.println(tool + " pid: " + pid);
++ return pid;
++ }
++
++ Throwable t = thread.getUncaught();
++ if (t != null) {
++ if (t.getMessage().contains(
++ "java.rmi.server.ExportException: Port already in use")) {
++ System.out.println("Port already in use. Trying to restart with a new one...");
++ Thread.sleep(100);
++ return null;
++ } else {
++ // Something unexpected has happened
++ throw new Throwable(t);
++ }
++ }
++
++ System.out.println("Waiting until " + tool + " is running...");
++ Thread.sleep(100);
++ }
++ }
++
++ private void log(String caption, String... cmd) {
++ System.out.println(Utils.NEW_LINE + caption + ":");
++ System.out.println(Arrays.toString(cmd).replace(",", ""));
++ }
++
++ private String getDestination() throws UnknownHostException {
++ String option = Utils.getHostname();
++ if (port != null) {
++ option += ":" + port;
++ }
++ if (serverName != null) {
++ option += "/" + serverName;
++ }
++ return option;
++ }
++
++ /**
++ * Depending on test settings command line can look like:
++ *
++ * jps -J-XX:+UsePerfData hostname
++ * jps -J-XX:+UsePerfData hostname:port
++ * jps -J-XX:+UsePerfData hostname/serverName
++ * jps -J-XX:+UsePerfData hostname:port/serverName
++ */
++ private OutputAnalyzer runJps() throws Exception {
++ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
++ launcher.addVMArg("-XX:+UsePerfData");
++ launcher.addToolArg(getDestination());
++
++ String[] cmd = launcher.getCommand();
++ log("Start jps", cmd);
++
++ ProcessBuilder processBuilder = new ProcessBuilder(cmd);
++ OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
++ System.out.println(output.getOutput());
++
++ return output;
++ }
++
++ /**
++ * Verifies output form jps contains pids and programs' name information.
++ * The function will discard any lines that come before the first line with pid.
++ * This can happen if the JVM outputs a warning message for some reason
++ * before running jps.
++ *
++ * The output can look like:
++ * 35536 Jstatd
++ * 35417 Main
++ * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
++ */
++ private void verifyJpsOutput(OutputAnalyzer output) throws Exception {
++ output.shouldHaveExitValue(0);
++ assertFalse(output.getOutput().isEmpty(), "Output should not be empty");
++
++ boolean foundFirstLineWithPid = false;
++ String[] lines = output.getOutput().split(Utils.NEW_LINE);
++ for (String line : lines) {
++ if (!foundFirstLineWithPid) {
++ foundFirstLineWithPid = line.matches(JPS_OUTPUT_REGEX);
++ continue;
++ }
++ assertTrue(line.matches(JPS_OUTPUT_REGEX),
++ "Output does not match the pattern" + Utils.NEW_LINE + line);
++ }
++ assertTrue(foundFirstLineWithPid, "Invalid output");
++ }
++
++ /**
++ * Depending on test settings command line can look like:
++ *
++ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname 250 5
++ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname:port 250 5
++ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname/serverName 250 5
++ * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil pid@hostname:port/serverName 250 5
++ */
++ private OutputAnalyzer runJstat() throws Exception {
++ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
++ launcher.addVMArg("-XX:+UsePerfData");
++ launcher.addVMArg("-Duser.language=en");
++ launcher.addToolArg("-gcutil");
++ launcher.addToolArg(jstatdPid + "@" + getDestination());
++ launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
++ launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));
++
++ String[] cmd = launcher.getCommand();
++ log("Start jstat", cmd);
++
++ ProcessBuilder processBuilder = new ProcessBuilder(cmd);
++ OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
++ System.out.println(output.getOutput());
++
++ return output;
++ }
++
++ private void verifyJstatOutput(OutputAnalyzer output)
++ throws Exception {
++ output.shouldHaveExitValue(0);
++ assertFalse(output.getOutput().isEmpty(), "Output should not be empty");
++
++ JstatGCUtilParser gcUtilParser = new JstatGCUtilParser(
++ output.getOutput());
++ gcUtilParser.parse(JSTAT_GCUTIL_SAMPLES);
++ }
++
++ private void runToolsAndVerify() throws Exception {
++ OutputAnalyzer output = runJps();
++ verifyJpsOutput(output);
++
++ output = runJstat();
++ verifyJstatOutput(output);
++ }
++
++ private Registry startRegistry()
++ throws InterruptedException, RemoteException {
++ Registry registry = null;
++ try {
++ System.out.println("Start rmiregistry on port " + port);
++ registry = LocateRegistry
++ .createRegistry(Integer.parseInt(port));
++ } catch (RemoteException e) {
++ if (e.getMessage().contains("Port already in use")) {
++ System.out.println("Port already in use. Trying to restart with a new one...");
++ Thread.sleep(100);
++ return null;
++ } else {
++ throw e;
++ }
++ }
++ return registry;
++ }
++
++ private void cleanUpThread(ProcessThread thread) throws Throwable {
++ if (thread != null) {
++ thread.stopProcess();
++ thread.joinAndThrow();
++ }
++ }
++
++ /**
++ * Depending on test settings command line can look like:
++ *
++ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
++ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
++ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
++ * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
++ */
++ private String[] getJstatdCmd() throws UnknownHostException {
++ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
++ launcher.addVMArg("-XX:+UsePerfData");
++ String testSrc = System.getProperty("test.src");
++ File policy = new File(testSrc, "all.policy");
++ launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
++ if (port != null) {
++ launcher.addToolArg("-p");
++ launcher.addToolArg(port);
++ }
++ if (serverName != null) {
++ launcher.addToolArg("-n");
++ launcher.addToolArg(serverName);
++ }
++
++ String[] cmd = launcher.getCommand();
++ log("Start jstatd", cmd);
++ return cmd;
++ }
++
++ private ProcessThread tryToSetupJstatdProcess() throws Throwable {
++ ProcessThread jstatdThread = new ProcessThread("Jstatd-Thread",
++ getJstatdCmd());
++ try {
++ jstatdThread.start();
++ // Make sure jstatd is up and running
++ jstatdPid = waitOnTool("jstatd", jstatdThread);
++ if (jstatdPid == null) {
++ // The port is already in use. Cancel and try with new one.
++ jstatdThread.stopProcess();
++ jstatdThread.join();
++ return null;
++ }
++ } catch (Throwable t) {
++ // Something went wrong in the product - clean up!
++ cleanUpThread(jstatdThread);
++ throw t;
++ }
++
++ return jstatdThread;
++ }
++
++ public void doTest() throws Throwable {
++ ProcessThread jstatdThread = null;
++ try {
++ while (jstatdThread == null) {
++ if (!useDefaultPort || withExternalRegistry) {
++ port = Integer.toString(Utils.getFreePort());
++ }
++
++ if (withExternalRegistry) {
++ Registry registry = startRegistry();
++ if (registry == null) {
++ // The port is already in use. Cancel and try with new one.
++ continue;
++ }
++ }
++
++ jstatdThread = tryToSetupJstatdProcess();
++ }
++
++ runToolsAndVerify();
++ } finally {
++ cleanUpThread(jstatdThread);
++ }
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdDefaults.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,38 @@
++/*
++ * Copyright (c) 2013, 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 4990825
++ * @library /lib/testlibrary
++ * @build JstatdTest JstatGCUtilParser
++ * @run main/timeout=60 TestJstatdDefaults
++ */
++public class TestJstatdDefaults {
++
++ public static void main(String[] args) throws Throwable {
++ JstatdTest test = new JstatdTest();
++ test.doTest();
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,39 @@
++/*
++ * Copyright (c) 2013, 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 4990825 7092186
++ * @library /lib/testlibrary
++ * @build JstatdTest JstatGCUtilParser
++ * @run main/timeout=60 TestJstatdExternalRegistry
++ */
++public class TestJstatdExternalRegistry {
++
++ public static void main(String[] args) throws Throwable {
++ JstatdTest test = new JstatdTest();
++ test.setWithExternalRegistry(true);
++ test.doTest();
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdPort.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,39 @@
++/*
++ * Copyright (c) 2013, 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 4990825
++ * @library /lib/testlibrary
++ * @build JstatdTest JstatGCUtilParser
++ * @run main/timeout=60 TestJstatdPort
++ */
++public class TestJstatdPort {
++
++ public static void main(String[] args) throws Throwable {
++ JstatdTest test = new JstatdTest();
++ test.setUseDefaultPort(false);
++ test.doTest();
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,40 @@
++/*
++ * Copyright (c) 2013, 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 4990825
++ * @library /lib/testlibrary
++ * @build JstatdTest JstatGCUtilParser
++ * @run main/timeout=60 TestJstatdPortAndServer
++ */
++public class TestJstatdPortAndServer {
++
++ public static void main(String[] args) throws Throwable {
++ JstatdTest test = new JstatdTest();
++ test.setUseDefaultPort(false);
++ test.setServerName("TestJstatdServer");
++ test.doTest();
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdServer.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,39 @@
++/*
++ * Copyright (c) 2013, 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 4990825
++ * @library /lib/testlibrary
++ * @build JstatdTest JstatGCUtilParser
++ * @run main/timeout=60 TestJstatdServer
++ */
++public class TestJstatdServer {
++
++ public static void main(String[] args) throws Throwable {
++ JstatdTest test = new JstatdTest();
++ test.setServerName("TestJstatdServer");
++ test.doTest();
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./jdk/test/sun/tools/jstatd/TestJstatdUsage.java Fri Apr 10 09:21:28 2015 -0700
+@@ -0,0 +1,51 @@
++/*
++ * Copyright (c) 2013, 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.
++ */
++
++import jdk.testlibrary.JDKToolLauncher;
++import jdk.testlibrary.OutputAnalyzer;
++
++/*
++ * @test
++ * @bug 4990825
++ * @library /lib/testlibrary
++ * @build jdk.testlibrary.JDKToolLauncher jdk.testlibrary.OutputAnalyzer
++ * @run main TestJstatdUsage
++ */
++public class TestJstatdUsage {
++
++ public static void main(String[] args) throws Exception {
++ testUsage("-help");
++ testUsage("-?");
++ }
++
++ private static void testUsage(String option) throws Exception {
++ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
++ launcher.addToolArg(option);
++ ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
++ OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
++
++ output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
++ output.shouldHaveExitValue(1);
++ }
++
++}
+--- ./jdk/test/sun/tools/jstatd/jpsOutput1.awk Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,27 +0,0 @@
+-#
+-BEGIN {
+- totallines=0; matched=0
+- }
+-
+-/^[0-9]+ [a-z|A-Z][a-z|A-Z|0-9|\$|\.]*$/ {
+- matched++;
+- }
+-
+-/^[0-9]+ -- .*$/ {
+- matched++;
+- }
+-
+-/^[0-9]+ $/ {
+- matched++;
+- }
+-
+- { totallines++; print $0 }
+-
+-END {
+- if ((totallines > 0) && (matched == totallines)) {
+- exit 0
+- }
+- else {
+- exit 1
+- }
+- }
+--- ./jdk/test/sun/tools/jstatd/jstatGcutilOutput1.awk Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,34 +0,0 @@
+-#
+-# matching the following output specified as a pattern that verifies
+-# that the numerical values conform to a specific pattern, rather than
+-# specific values.
+-#
+-# S0 S1 E O P YGC YGCT FGC FGCT GCT
+-# 0.00 100.00 68.87 1.24 27.75 1 0.044 0 0.000 0.044
+-# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044
+-# 0.00 100.00 68.87 1.24 27.84 1 0.044 0 0.000 0.044
+-# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044
+-# 0.00 100.00 70.89 1.24 27.84 1 0.044 0 0.000 0.044
+-
+-BEGIN {
+- headerlines=0; datalines=0; totallines=0
+- }
+-
+-/^ S0 S1 E O P YGC YGCT FGC FGCT GCT $/ {
+- headerlines++;
+- }
+-
+-/^[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+\.[0-9]+$/ {
+- datalines++;
+- }
+-
+- { totallines++; print $0 }
+-
+-END {
+- if ((headerlines == 1) && (datalines == 5) && (totallines == 6)) {
+- exit 0
+- }
+- else {
+- exit 1
+- }
+- }
+--- ./jdk/test/sun/tools/jstatd/jstatdDefaults.sh Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,79 +0,0 @@
+-#
+-# Copyright (c) 2004, 2012, 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 4990825
+-# @run shell/timeout=60 jstatdDefaults.sh
+-# @summary Test functionality of 'jstatd &'
+-
+-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+-
+-setup
+-verify_os
+-
+-cleanup() {
+- kill_proc ${JSTATD_PID}
+-}
+-
+-trap 'cleanup' 0 HUP INT QUIT TERM
+-
+-JSTATD="${TESTJAVA}/bin/jstatd"
+-JPS="${TESTJAVA}/bin/jps"
+-JSTAT="${TESTJAVA}/bin/jstat"
+-
+-HOSTNAME=`uname -n`
+-
+-JSTATD_OUT="jstatd_$$.out"
+-
+-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy 2>&1 > ${JSTATD_OUT} &
+-JSTATD_PID=$!
+-
+-echo "jstatd started as pid ${JSTATD_PID}"
+-sleep 3
+-
+-${JPS} -J-XX:+UsePerfData ${HOSTNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
+-
+-if [ $? -ne 0 ]
+-then
+- echo "Output of jps differs from expected output. Failed."
+- cleanup
+- exit 1
+-fi
+-
+-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+-RC=$?
+-
+-if [ ${RC} -ne 0 ]
+-then
+- echo "jstat output differs from expected output"
+-fi
+-
+-if [ -s ${JSTATD_OUT} ]
+-then
+- echo "jstatd generated the following, unexpected output:"
+- RC=1
+-fi
+-
+-cleanup
+-
+-exit ${RC}
+--- ./jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,96 +0,0 @@
+-#
+-# Copyright (c) 2004, 2012, 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 4990825 7092186
+-# @run shell/timeout=90 jstatdExternalRegistry.sh
+-# @summary Test functionality of 'jstatd -p<port>&' with an external RMI registry
+-
+-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+-
+-setup
+-verify_os
+-
+-cleanup() {
+- kill_proc ${RMIREGISTRY_PID}
+- kill_proc ${JSTATD_PID}
+-}
+-
+-trap 'cleanup' 0 HUP INT QUIT TERM
+-
+-RMIREGISTRY="${TESTJAVA}/bin/rmiregistry"
+-JSTATD="${TESTJAVA}/bin/jstatd"
+-JPS="${TESTJAVA}/bin/jps"
+-JSTAT="${TESTJAVA}/bin/jstat"
+-
+-HOSTNAME=`uname -n`
+-PORT=`freePort`
+-if [ "${PORT}" = "0" ] ; then
+- echo "Cannot get free port"
+- exit 1
+-fi
+-
+-RMIREGISTRY_OUT="rmiregistry_$$.out"
+-JSTATD_OUT="jstatd_$$.out"
+-
+-${RMIREGISTRY} -J-XX:+UsePerfData ${PORT} > ${RMIREGISTRY_OUT} 2>&1 &
+-RMIREGISTRY_PID=$!
+-
+-echo "rmiregistry started on port ${PORT} as pid ${RMIREGISTRY_PID}"
+-sleep 3
+-
+-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} > ${JSTATD_OUT} 2>&1 &
+-JSTATD_PID=$!
+-
+-echo "jstatd started as pid ${JSTATD_PID}"
+-sleep 3
+-
+-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
+-
+-if [ $? -ne 0 ]
+-then
+- echo "Output of jps differs from expected output. Failed."
+- exit 1
+-fi
+-
+-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+-RC=$?
+-
+-if [ ${RC} -ne 0 ]
+-then
+- echo "jstat output differs from expected output"
+-fi
+-
+-if [ -s ${JSTATD_OUT} ]
+-then
+- echo "jstatd generated unexpected output: see ${JSTATD_OUT}"
+- RC=1
+-fi
+-
+-if [ -s ${RMIREGISTRY_OUT} ]
+-then
+- echo "rmiregistry generated unexpected output: see ${RMIREGISTRY_OUT}"
+- RC=1
+-fi
+-
+-exit ${RC}
+--- ./jdk/test/sun/tools/jstatd/jstatdPort.sh Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,84 +0,0 @@
+-#
+-# Copyright (c) 2004, 2012, 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 4990825
+-# @run shell/timeout=60 jstatdPort.sh
+-# @summary Test functionality of 'jstatd -p <port>&'
+-
+-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+-
+-setup
+-verify_os
+-
+-cleanup() {
+- kill_proc ${JSTATD_PID}
+-}
+-
+-trap 'cleanup' 0 HUP INT QUIT TERM
+-
+-JSTATD="${TESTJAVA}/bin/jstatd"
+-JPS="${TESTJAVA}/bin/jps"
+-JSTAT="${TESTJAVA}/bin/jstat"
+-
+-HOSTNAME=`uname -n`
+-PORT=`freePort`
+-if [ "${PORT}" = "0" ] ; then
+- echo "Cannot get free port"
+- exit 1
+-fi
+-
+-JSTATD_OUT="jstatd_$$.out"
+-
+-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} 2>&1 > ${JSTATD_OUT} &
+-JSTATD_PID=$!
+-
+-echo "jstatd started as pid ${JSTATD_PID} on port ${PORT}"
+-sleep 3
+-
+-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT} 2>&1 | tee jps.out | awk -f ${TESTSRC}/jpsOutput1.awk
+-
+-if [ $? -ne 0 ]
+-then
+- echo "Output of jps differs from expected output. Failed."
+- cleanup
+- exit 1
+-fi
+-
+-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+-RC=$?
+-
+-if [ ${RC} -ne 0 ]
+-then
+- echo "jstat output differs from expected output"
+-fi
+-
+-if [ -s ${JSTATD_OUT} ]
+-then
+- echo "jstatd generated the following, unexpected output:"
+- RC=1
+-fi
+-
+-cleanup
+-
+-exit ${RC}
+--- ./jdk/test/sun/tools/jstatd/jstatdServerName.sh Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,121 +0,0 @@
+-#
+-# Copyright (c) 2004, 2012, 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 4990825
+-# @run shell/timeout=90 jstatdServerName.sh
+-# @summary Test functionality of 'jstatd -p <port> -n <servername>&'
+-
+-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+-
+-setup
+-verify_os
+-
+-cleanup() {
+- kill_proc ${JSTATD_1_PID}
+- kill_proc ${JSTATD_2_PID}
+-}
+-
+-trap 'cleanup' 0 HUP INT QUIT TERM
+-
+-JSTATD="${TESTJAVA}/bin/jstatd"
+-JPS="${TESTJAVA}/bin/jps"
+-JSTAT="${TESTJAVA}/bin/jstat"
+-
+-HOSTNAME=`uname -n`
+-PORT_1=`freePort`
+-if [ "${PORT_1}" = "0" ] ; then
+- echo "ERROR: No free port"
+- exit 1
+-fi
+-PORT_2=`expr ${PORT_1} '+' 1`
+-SERVERNAME="SecondJstatdServer"
+-
+-JSTATD_1_OUT="jstatd_$$_1.out"
+-JSTATD_2_OUT="jstatd_$$_2.out"
+-
+-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_1} 2>&1 > ${JSTATD_1_OUT} &
+-JSTATD_1_PID=$!
+-
+-echo "first jstatd started as pid ${JSTATD_1_PID} on port ${PORT_1} with default server name"
+-sleep 3
+-
+-${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_2} -n ${SERVERNAME} 2>&1 > ${JSTATD_2_OUT} &
+-JSTATD_2_PID=$!
+-
+-echo "second jstatd started as pid ${JSTATD_2_PID} on port ${PORT_2} with name ${SERVERNAME}"
+-sleep 3
+-
+-echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1}"
+-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
+-
+-if [ $? -ne 0 ]
+-then
+- echo "Output of jps differs from expected output. Failed."
+- cleanup
+- exit 1
+-fi
+-
+-echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME}"
+-${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
+-
+-if [ $? -ne 0 ]
+-then
+- echo "Output of jps differs from expected output. Failed."
+- cleanup
+- exit 1
+-fi
+-
+-echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
+-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+-RC=$?
+-
+-if [ ${RC} -ne 0 ]
+-then
+- echo "jstat output differs from expected output"
+-fi
+-
+-echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
+-${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+-RC=$?
+-
+-if [ ${RC} -ne 0 ]
+-then
+- echo "jstat output differs from expected output"
+-fi
+-
+-if [ -s ${JSTATD_1_OUT} ]
+-then
+- echo "first jstatd generated the following, unexpected output:"
+- RC=1
+-fi
+-
+-if [ -s ${JSTATD_2_OUT} ]
+-then
+- echo "second jstatd generated the following, unexpected output:"
+- RC=1
+-fi
+-
+-cleanup
+-
+-exit ${RC}
+--- ./jdk/test/sun/tools/jstatd/jstatdUsage1.sh Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,56 +0,0 @@
+-#
+-# Copyright (c) 2004, 2010, 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 4990825
+-# @run shell jstatdUsage1.sh
+-# @summary Test that output of 'jstatd -help' matches the usage.out file
+-
+-. ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
+-
+-setup
+-
+-JSTATD="${TESTJAVA}/bin/jstatd"
+-
+-JSTATD_1_OUT="jstatd_$$_1.out"
+-JSTATD_2_OUT="jstatd_$$_2.out"
+-
+-${JSTATD} -? > ${JSTATD_1_OUT} 2>&1
+-
+-diff -w ${JSTATD_1_OUT} ${TESTSRC}/usage.out
+-if [ $? != 0 ]
+-then
+- echo "Output of jstatd -? differs from expected output. Failed."
+- exit 1
+-fi
+-
+-${JSTATD} -help > ${JSTATD_2_OUT} 2>&1
+-
+-diff -w ${JSTATD_2_OUT} ${TESTSRC}/usage.out
+-if [ $? != 0 ]
+-then
+- echo "Output of jstatd -help differs from expected output. Failed."
+- exit 1
+-fi
+-
+-exit 0
+--- ./jdk/test/sun/tools/jstatd/usage.out Mon Jan 05 11:57:27 2015 -0800
++++ /dev/null Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +0,0 @@
+-usage: jstatd [-nr] [-p port] [-n rminame]
+--- ./langtools/.hgtags Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/.hgtags Fri Apr 10 09:22:56 2015 -0700
+@@ -527,6 +527,10 @@
+ 6106b56a874e19e603660a09d506fe8afcde9e14 jdk7u72-b14
+ 7a09f7596c8bb17d3b25b4506dd76425f6efb15e jdk7u72-b30
+ de0088aaf97fa861be8c17e97b57139287068c86 jdk7u72-b31
++2a4f0a3ead7dca917132e0bb55157fca5f85e109 jdk7u72-b32
++a01a26976001088d402da55635e00737b529a961 jdk7u72-b33
++1aef1c42bb783a25b54ea786e9bd112a4744e464 jdk7u72-b34
++8fa35635fddba4b0ea01c841c118a841bd6ff34a jdk7u72-b35
+ 0138c5f55af0c700882deeac4411fbd9118b4d6e jdk7u75-b00
+ 7ecfdbf693cfc14d648ebdf2cc87716068569e8d jdk7u75-b01
+ 688a304d3215af8104336ecce50b7f4edfb88d36 jdk7u75-b02
+@@ -558,3 +562,37 @@
+ f0a6f4f62959a43e21d377436e3e60f6431ee5b4 jdk7u76-b12
+ d9e79541170f453dda964319f268fdad80dce9d7 jdk7u76-b13
+ 24f0420bb212b05d572689bae8ec2d232b9ac5a0 jdk7u76-b30
++f260514e9d6fa7d8c9ee96eb7b5496c61f27d830 jdk7u76-b31
++9c4eaa276d52892371ae4adc79234e8f44c084d2 jdk7u76-b32
++bdbe862f8846558c83f8bc15518446ab0495a173 jdk7u79-b00
++a5f66b87b6c4c14375e8a1aa0405ddb4c63e7014 jdk7u79-b01
++0747b795b08a7de0fbe724cc7042d0e8ebccc4f8 jdk7u79-b02
++421c914fbf030014497053ae58ed7c182043211a jdk7u79-b03
++f6453624f39f9f0922b2746b6f56dcf600a15a4a jdk7u79-b06
++7c626c9382b7705feefb7acfe508ec82d53d7957 jdk7u79-b07
++3a870689bd136b326476a6f21475adc941e33afa jdk7u79-b08
++04176e60f5f58de621a75e5a5c3b59e2d8d00ef7 jdk7u79-b09
++2ea5521a55a35b9700e95d98dc2cf560834b1df6 jdk7u79-b10
++e0d3d80136d7cd11fd26f22fead1f78068fdddaf jdk7u79-b11
++a5f2b51a4ea77cd5471d03501a460c80b375379a jdk7u79-b12
++525562d90c3c06ddc9ef6c266db2d2aa8177b7e0 jdk7u79-b13
++185113eafdbffa675b5db5859ccdd16cfd19ae6f jdk7u79-b14
++79923da8c058124a3a181b9d000753f9b573db35 jdk7u79-b30
++e5e807700ff84f7bd9159ebc828891ae3ddb859c jdk7u79-b15
++772aad4e9681828b8ee193b9ed971cbfe6c7f347 jdk7u80-b00
++6c307a0b7a94e002d8a2532ffd8146d6c53f42d3 jdk7u80-b01
++5bd6f3adf690dc2de8881b6f9f48336db4af7865 jdk7u80-b02
++bcbd241df6cd0a643480c8de183c541a662dd506 jdk7u80-b03
++04b56f4312b62d8bdf4eb1159132de8437994d34 jdk7u80-b04
++f40fb76025c798cab4fb0e1966be1bceb8234527 jdk7u80-b05
++335ee524dc68a42863f3fa3f081b781586e7ba2d jdk7u80-b06
++6f7b359c4e9f82cbd399edc93c3275c3e668d2ea jdk7u80-b07
++e6db2a97b3696fb5e7786b23f77af346a935a370 jdk7u80-b08
++88b7f1ad17d20eace30d0ab83d4e7413c0c863ff jdk7u80-b09
++55f4bb77c71c8e0b9be2ac6484c7a3838203d53a jdk7u80-b10
++ae5ecf167fb7d70f98aa117ea6a053307db98b14 jdk7u80-b11
++c084fb3e386393774886645aee8ef57b22854c08 jdk7u80-b12
++e6845c405f95b6336e000f054f87a964a33927d9 jdk7u80-b13
++242015274be21260757835134fcfb9bfa5ba6a81 jdk7u80-b14
++d0cc1c8ace99283d7b2354d2c0e5cd58787163c8 jdk7u80-b30
++f2b4d5e42318ed93d35006ff7d1b3b0313b5a71f jdk7u80-b15
+--- ./langtools/THIRD_PARTY_README Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/THIRD_PARTY_README Fri Apr 10 09:22:56 2015 -0700
+@@ -1001,7 +1001,7 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to libpng 1.5.4, which is
++%% This notice is provided with respect to libpng 1.6.16, which is
+ included with JRE 7, JDK 7, and OpenJDK 7.
+
+ --- begin of LICENSE ---
+@@ -1017,7 +1017,7 @@
+
+ This code is released under the libpng license.
+
+-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
++libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+ Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ distributed according to the same disclaimer and license as libpng-1.2.5
+ with the following individual added to the list of Contributing Authors
+@@ -1115,7 +1115,7 @@
+
+ Glenn Randers-Pehrson
+ glennrp at users.sourceforge.net
+-July 7, 2011
++December 22, 2014
+
+ --- end of LICENSE ---
+
+@@ -1912,35 +1912,6 @@
+
+ -------------------------------------------------------------------------------
+
+-%% This notice is provided with respect to Sparkle v.1.5,
+-which is included with JRE 7 on Mac OS X.
+-
+---- begin of LICENSE ---
+-
+-Copyright (c) 2012 Sparkle.org and Andy Matuschak
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all
+-copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+-SOFTWARE.
+-
+---- end of LICENSE ---
+-
+--------------------------------------------------------------------------------
+-
+ %% Portions licensed from Taligent, Inc.
+
+ -------------------------------------------------------------------------------
+@@ -3198,12 +3169,12 @@
+ %% This notice is provided with respect to the following which is
+ included with JRE 7, JDK 7, and OpenJDK 7, except where noted:
+
+- Apache Derby 10.8.3.0 [included with JDK 7 only]
++ Apache Derby 10.8.1.2 [included with JDK 7 only]
+ Apache Jakarta BCEL 5.2
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XMLSec-Java 1.4.2
+ Apache Xalan-Java 2.7.1
+- Apache Xerces2 Java 2.11.0
++ Apache Xerces2 Java 2.10.0
+ Apache XML Resolver 1.1
+
+
+--- ./langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Apr 10 09:22:56 2015 -0700
+@@ -2400,9 +2400,9 @@
+ }
+ });
+ for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
+- e != null;
+- e = e.sibling)
+- if (e.sym.kind == MTH)
++ e != null;
++ e = e.sibling)
++ if (e.sym.kind == MTH && e.sym.name != names.clinit)
+ members.add((MethodSymbol) e.sym);
+
+ // count them off as they're annotated
+--- ./langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 2014, 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
+@@ -223,6 +223,12 @@
+ meth.name,
+ bridgeType,
+ origin);
++ /* once JDK-6996415 is solved it should be checked if this approach can
++ * be applied to method addOverrideBridgesIfNeeded
++ */
++ bridge.params = createBridgeParams(impl, bridge, bridgeType);
++ bridge.attributes_field = impl.attributes_field;
++
+ if (!hypothetical) {
+ JCMethodDecl md = make.MethodDef(bridge, null);
+
+@@ -257,6 +263,26 @@
+ overridden.put(bridge, meth);
+ }
+
++ private List<VarSymbol> createBridgeParams(MethodSymbol impl, MethodSymbol bridge,
++ Type bridgeType) {
++ List<VarSymbol> bridgeParams = null;
++ if (impl.params != null) {
++ bridgeParams = List.nil();
++ List<VarSymbol> implParams = impl.params;
++ Type.MethodType mType = (Type.MethodType)bridgeType;
++ List<Type> argTypes = mType.argtypes;
++ while (implParams.nonEmpty() && argTypes.nonEmpty()) {
++ VarSymbol param = new VarSymbol(implParams.head.flags() | SYNTHETIC | PARAMETER,
++ implParams.head.name, argTypes.head, bridge);
++ param.attributes_field = implParams.head.attributes_field;
++ bridgeParams = bridgeParams.append(param);
++ implParams = implParams.tail;
++ argTypes = argTypes.tail;
++ }
++ }
++ return bridgeParams;
++ }
++
+ /** Add bridge if given symbol is a non-private, non-static member
+ * of the given class, which is either defined in the class or non-final
+ * inherited, and one of the two following conditions holds:
+--- ./langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 1999, 2015, 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
+@@ -1541,15 +1541,17 @@
+ // The method wasn't found: emit a warning and recover
+ JavaFileObject prevSource = log.useSource(requestingOwner.classfile);
+ try {
+- if (failure == null) {
+- log.warning("annotation.method.not.found",
+- container,
+- name);
+- } else {
+- log.warning("annotation.method.not.found.reason",
+- container,
+- name,
+- failure.getDetailValue());//diagnostic, if present
++ if (lintClassfile) {
++ if (failure == null) {
++ log.warning("annotation.method.not.found",
++ container,
++ name);
++ } else {
++ log.warning("annotation.method.not.found.reason",
++ container,
++ name,
++ failure.getDetailValue()); //diagnostic, if present
++ }
+ }
+ } finally {
+ log.useSource(prevSource);
+--- ./langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1012,25 +1012,29 @@
+
+ if (code.varBufferSize > 0) {
+ int alenIdx = writeAttr(names.LocalVariableTable);
+- databuf.appendChar(code.varBufferSize);
++ databuf.appendChar(code.getLVTSize());
+
+ for (int i=0; i<code.varBufferSize; i++) {
+ Code.LocalVar var = code.varBuffer[i];
+-
+- // write variable info
+- Assert.check(var.start_pc >= 0
+- && var.start_pc <= code.cp);
+- databuf.appendChar(var.start_pc);
+- Assert.check(var.length >= 0
+- && (var.start_pc + var.length) <= code.cp);
+- databuf.appendChar(var.length);
+- VarSymbol sym = var.sym;
+- databuf.appendChar(pool.put(sym.name));
+- Type vartype = sym.erasure(types);
+- if (needsLocalVariableTypeEntry(sym.type))
+- nGenericVars++;
+- databuf.appendChar(pool.put(typeSig(vartype)));
+- databuf.appendChar(var.reg);
++ for (Code.LocalVar.Range r: var.aliveRanges) {
++ // write variable info
++ if (!(r.start_pc >= 0 && r.start_pc <= code.cp)) {
++ throw new AssertionError();
++ }
++ databuf.appendChar(r.start_pc);
++ if (!(r.length >= 0 && (r.start_pc + r.length) <= code.cp)) {
++ throw new AssertionError();
++ }
++ databuf.appendChar(r.length);
++ VarSymbol sym = var.sym;
++ databuf.appendChar(pool.put(sym.name));
++ Type vartype = sym.erasure(types);
++ databuf.appendChar(pool.put(typeSig(vartype)));
++ databuf.appendChar(var.reg);
++ if (needsLocalVariableTypeEntry(var.sym.type)) {
++ nGenericVars++;
++ }
++ }
+ }
+ endAttr(alenIdx);
+ acount++;
+@@ -1046,13 +1050,15 @@
+ VarSymbol sym = var.sym;
+ if (!needsLocalVariableTypeEntry(sym.type))
+ continue;
+- count++;
+- // write variable info
+- databuf.appendChar(var.start_pc);
+- databuf.appendChar(var.length);
+- databuf.appendChar(pool.put(sym.name));
+- databuf.appendChar(pool.put(typeSig(sym.type)));
+- databuf.appendChar(var.reg);
++ for (Code.LocalVar.Range r : var.aliveRanges) {
++ // write variable info
++ databuf.appendChar(r.start_pc);
++ databuf.appendChar(r.length);
++ databuf.appendChar(pool.put(sym.name));
++ databuf.appendChar(pool.put(typeSig(sym.type)));
++ databuf.appendChar(var.reg);
++ count++;
++ }
+ }
+ Assert.check(count == nGenericVars);
+ endAttr(alenIdx);
+--- ./langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1151,7 +1151,9 @@
+ public int entryPoint(State state) {
+ int pc = curPc();
+ alive = true;
+- this.state = state.dup();
++ State newState = state.dup();
++ setDefined(newState.defined);
++ this.state = newState;
+ Assert.check(state.stacksize <= max_stack);
+ if (debugCode) System.err.println("entry point " + state);
+ pendingStackMap = needStackMap;
+@@ -1164,7 +1166,9 @@
+ public int entryPoint(State state, Type pushed) {
+ int pc = curPc();
+ alive = true;
+- this.state = state.dup();
++ State newState = state.dup();
++ setDefined(newState.defined);
++ this.state = newState;
+ Assert.check(state.stacksize <= max_stack);
+ this.state.push(pushed);
+ if (debugCode) System.err.println("entry point " + state);
+@@ -1452,6 +1456,10 @@
+ chain.pc + 3 == target && target == cp && !fixedPc) {
+ // If goto the next instruction, the jump is not needed:
+ // compact the code.
++ if (varDebugInfo) {
++ adjustAliveRanges(cp, -3);
++ }
++
+ cp = cp - 3;
+ target = target - 3;
+ if (chain.next == null) {
+@@ -1736,8 +1744,7 @@
+ sym = sym.clone(sym.owner);
+ sym.type = newtype;
+ LocalVar newlv = lvar[i] = new LocalVar(sym);
+- // should the following be initialized to cp?
+- newlv.start_pc = lv.start_pc;
++ newlv.aliveRanges = lv.aliveRanges;
+ }
+ }
+ }
+@@ -1825,18 +1832,118 @@
+ static class LocalVar {
+ final VarSymbol sym;
+ final char reg;
+- char start_pc = Character.MAX_VALUE;
+- char length = Character.MAX_VALUE;
++
++ class Range {
++ char start_pc = Character.MAX_VALUE;
++ char length = Character.MAX_VALUE;
++
++ Range() {}
++
++ Range(char start) {
++ this.start_pc = start;
++ }
++
++ Range(char start, char length) {
++ this.start_pc = start;
++ this.length = length;
++ }
++
++ boolean closed() {
++ return start_pc != Character.MAX_VALUE && length != Character.MAX_VALUE;
++ }
++
++ @Override
++ public String toString() {
++ int currentStartPC = start_pc;
++ int currentLength = length;
++ return "startpc = " + currentStartPC + " length " + currentLength;
++ }
++ }
++
++ java.util.List<Range> aliveRanges = new java.util.ArrayList<Range>();
++
+ LocalVar(VarSymbol v) {
+ this.sym = v;
+ this.reg = (char)v.adr;
+ }
++
+ public LocalVar dup() {
+ return new LocalVar(sym);
+ }
++
++ Range firstRange() {
++ return aliveRanges.isEmpty() ? null : aliveRanges.get(0);
++ }
++
++ Range lastRange() {
++ return aliveRanges.isEmpty() ? null : aliveRanges.get(aliveRanges.size() - 1);
++ }
++
++ void removeLastRange() {
++ Range lastRange = lastRange();
++ if (lastRange != null) {
++ aliveRanges.remove(lastRange);
++ }
++ }
++
++ @Override
+ public String toString() {
+- return "" + sym + " in register " + ((int)reg) + " starts at pc=" + ((int)start_pc) + " length=" + ((int)length);
++ if (aliveRanges == null) {
++ return "empty local var";
++ }
++ StringBuilder sb = new StringBuilder().append(sym)
++ .append(" in register ").append((int)reg).append(" \n");
++ for (Range r : aliveRanges) {
++ sb.append(" starts at pc=").append(Integer.toString(((int)r.start_pc)))
++ .append(" length=").append(Integer.toString(((int)r.length)))
++ .append("\n");
++ }
++ return sb.toString();
+ }
++
++ public void openRange(char start) {
++ if (!hasOpenRange()) {
++ aliveRanges.add(new Range(start));
++ }
++ }
++
++ public void closeRange(char length) {
++ if (isLastRangeInitialized() && length > 0) {
++ Range range = lastRange();
++ if (range != null) {
++ if (range.length == Character.MAX_VALUE) {
++ range.length = length;
++ }
++ }
++ } else {
++ removeLastRange();
++ }
++ }
++
++ public boolean hasOpenRange() {
++ if (aliveRanges.isEmpty()) {
++ return false;
++ }
++ return lastRange().length == Character.MAX_VALUE;
++ }
++
++ public boolean isLastRangeInitialized() {
++ if (aliveRanges.isEmpty()) {
++ return false;
++ }
++ return lastRange().start_pc != Character.MAX_VALUE;
++ }
++
++ public Range getWidestRange() {
++ if (aliveRanges.isEmpty()) {
++ return new Range();
++ } else {
++ Range firstRange = firstRange();
++ Range lastRange = lastRange();
++ char length = (char)(lastRange.length + (lastRange.start_pc - firstRange.start_pc));
++ return new Range(firstRange.start_pc, length);
++ }
++ }
+ };
+
+ /** Local variables, indexed by register. */
+@@ -1858,6 +1965,30 @@
+ state.defined.excl(adr);
+ }
+
++ void adjustAliveRanges(int oldCP, int delta) {
++ for (LocalVar localVar: lvar) {
++ if (localVar != null) {
++ for (LocalVar.Range range: localVar.aliveRanges) {
++ if (range.closed() && range.start_pc + range.length >= oldCP) {
++ range.length += delta;
++ }
++ }
++ }
++ }
++ }
++
++ /**
++ * Calculates the size of the LocalVariableTable.
++ */
++ public int getLVTSize() {
++ int result = varBufferSize;
++ for (int i = 0; i < varBufferSize; i++) {
++ LocalVar var = varBuffer[i];
++ result += var.aliveRanges.size() - 1;
++ }
++ return result;
++ }
++
+ /** Set the current variable defined state. */
+ public void setDefined(Bits newDefined) {
+ if (alive && newDefined != state.defined) {
+@@ -1883,8 +2014,7 @@
+ } else {
+ state.defined.incl(adr);
+ if (cp < Character.MAX_VALUE) {
+- if (v.start_pc == Character.MAX_VALUE)
+- v.start_pc = (char)cp;
++ v.openRange((char)cp);
+ }
+ }
+ }
+@@ -1894,15 +2024,15 @@
+ state.defined.excl(adr);
+ if (adr < lvar.length &&
+ lvar[adr] != null &&
+- lvar[adr].start_pc != Character.MAX_VALUE) {
++ lvar[adr].isLastRangeInitialized()) {
+ LocalVar v = lvar[adr];
+- char length = (char)(curPc() - v.start_pc);
++ char length = (char)(curPc()- v.lastRange().start_pc);
+ if (length > 0 && length < Character.MAX_VALUE) {
+ lvar[adr] = v.dup();
+- v.length = length;
++ v.closeRange(length);
+ putVar(v);
+ } else {
+- v.start_pc = Character.MAX_VALUE;
++ v.removeLastRange();
+ }
+ }
+ }
+@@ -1912,10 +2042,10 @@
+ LocalVar v = lvar[adr];
+ if (v != null) {
+ lvar[adr] = null;
+- if (v.start_pc != Character.MAX_VALUE) {
+- char length = (char)(curPc() - v.start_pc);
++ if (v.isLastRangeInitialized()) {
++ char length = (char)(curPc()- v.lastRange().start_pc);
+ if (length < Character.MAX_VALUE) {
+- v.length = length;
++ v.closeRange(length);
+ putVar(v);
+ }
+ }
+--- ./langtools/test/tools/javac/6889255/T6889255.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/test/tools/javac/6889255/T6889255.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2009, 2014, 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
+@@ -429,9 +429,9 @@
+ // -- no Code attribute for the LocalVariableTable attribute
+ if ((v.owner.flags() & Flags.ABSTRACT) != 0)
+ return "arg" + (i - 1);
+- // bridge methods use xN
++ // bridge methods use argN. No LVT for them anymore
+ if ((v.owner.flags() & Flags.BRIDGE) != 0)
+- return "x" + (i - 1);
++ return "arg" + (i - 1);
+
+ // The rest of this method assumes the local conventions in the test program
+ Type t = v.type;
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,103 @@
++/*
++ * Copyright (c) 2014, 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 6695379
++ * @summary Copy method annotations and parameter annotations to synthetic
++ * bridge methods
++ * @run main AnnotationsAreNotCopiedToBridgeMethodsTest
++ */
++
++import java.lang.annotation.ElementType;
++import java.lang.annotation.Target;
++import java.io.BufferedInputStream;
++import java.lang.annotation.Retention;
++import java.lang.annotation.RetentionPolicy;
++import java.nio.file.Files;
++import java.nio.file.Path;
++import java.nio.file.Paths;
++
++import com.sun.tools.classfile.AccessFlags;
++import com.sun.tools.classfile.Attribute;
++import com.sun.tools.classfile.Attributes;
++import com.sun.tools.classfile.ClassFile;
++import com.sun.tools.classfile.Method;
++import com.sun.tools.javac.util.Assert;
++
++public class AnnotationsAreNotCopiedToBridgeMethodsTest {
++
++ public static void main(String[] args) throws Exception {
++ new AnnotationsAreNotCopiedToBridgeMethodsTest().run();
++ }
++
++ void run() throws Exception {
++ checkClassFile(Paths.get(System.getProperty("test.classes"),
++ this.getClass().getSimpleName() + "$CovariantReturnType.class"));
++ checkClassFile(Paths.get(System.getProperty("test.classes"),
++ this.getClass().getSimpleName() +
++ "$CovariantReturnType$VisibilityChange.class"));
++ }
++
++ void checkClassFile(final Path cfilePath) throws Exception {
++ ClassFile classFile = ClassFile.read(
++ new BufferedInputStream(Files.newInputStream(cfilePath)));
++ for (Method method : classFile.methods) {
++ if (method.access_flags.is(AccessFlags.ACC_BRIDGE)) {
++ checkForAttr(method.attributes,
++ "Annotations hasn't been copied to bridge method",
++ Attribute.RuntimeVisibleAnnotations,
++ Attribute.RuntimeVisibleParameterAnnotations);
++ }
++ }
++ }
++
++ void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
++ for (String attrName : attrNames) {
++ Assert.checkNonNull(attrs.get(attrName), errorMsg);
++ }
++ }
++
++ @Target(value = {ElementType.PARAMETER})
++ @Retention(RetentionPolicy.RUNTIME)
++ @interface ParamAnnotation {}
++
++ @Target(value = {ElementType.METHOD})
++ @Retention(RetentionPolicy.RUNTIME)
++ @interface MethodAnnotation {}
++
++ abstract class T<A,B> {
++ B m(A a){return null;}
++ }
++
++ class CovariantReturnType extends T<Integer, Integer> {
++ @MethodAnnotation
++ Integer m(@ParamAnnotation Integer i) {
++ return i;
++ }
++
++ public class VisibilityChange extends CovariantReturnType {}
++
++ }
++
++}
+--- ./langtools/test/tools/javac/annotations/6214965/T6214965.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/test/tools/javac/annotations/6214965/T6214965.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2005, 2015, 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
+@@ -23,9 +23,10 @@
+
+ /**
+ * @test
+- * @bug 6214965 6365854
++ * @bug 6214965 6365854 8068639
+ * @summary Compiler crash on redefing nested annotation types
+ * @compile CompilerAnnotationTest.java CompilerAnnotationTest2.java
+ * @compile CompilerAnnotationTest2bad.java
+- * @compile/ref=T6214965.out -XDrawDiagnostics CompilerAnnotationTest2bad.java
++ * @compile/ref=T6214965.out -XDrawDiagnostics -Xlint:classfile CompilerAnnotationTest2bad.java
++ * @compile -Werror CompilerAnnotationTest2bad.java
+ */
+--- ./langtools/test/tools/javac/annotations/6365854/T6365854.java Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/test/tools/javac/annotations/6365854/T6365854.java Fri Apr 10 09:22:56 2015 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2005, 2015, 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
+@@ -23,7 +23,7 @@
+
+ /**
+ * @test
+- * @bug 6365854
++ * @bug 6365854 8068639
+ * @summary javac crashes when compiling against an annotated class
+ * @compile TestAnnotation.java TestCore.java
+ * @clean test.annotation.TestAnnotation
+@@ -33,11 +33,11 @@
+ *
+ * @compile TestAnnotation.java TestCore.java
+ * @clean test.annotation.TestAnnotation
+- * @compile/ref=test1.out -XDrawDiagnostics T6365854.java
++ * @compile/ref=test1.out -XDrawDiagnostics -Xlint:classfile T6365854.java
+ * @run main T6365854
+- * @compile/ref=test2.out -XDrawDiagnostics evolve/TestAnnotation.java T6365854.java
++ * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile evolve/TestAnnotation.java T6365854.java
+ * @run main T6365854
+- * @compile/ref=test2.out -XDrawDiagnostics T6365854.java
++ * @compile/ref=test2.out -XDrawDiagnostics -Xlint:classfile T6365854.java
+ * @run main T6365854
+ */
+
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/annotations/clinit/AnnoWithClinit1.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (c) 2013, 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 8013485
++ * @summary Annotations that gets a clinit can't be verified for correct elements in a second compilation unit
++ * @compile AnnoWithClinit1.java
++ */
++
++public @interface AnnoWithClinit1 {
++ Foo f = new Foo();
++
++ @AnnoWithClinit1
++ static class C {} // this is in the same CU so there wont be a
++ // <clinit> when the this anno instance is checked
++
++ class Foo {}
++}
++
++
++@AnnoWithClinit1
++class BarAnnoClinit1 {}
++
++@interface AAnnoClinit1 {
++ Runnable r2 = new Runnable() { public void run() { }};
++ String str1();
++ String str2withdefault() default "bar";
++}
++
++@AAnnoClinit1(str1="value")
++class TestAnnoClinit1 { }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/annotations/clinit/AnnoWithClinitFail.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,45 @@
++/*
++ * Copyright (c) 2013, 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 8013485
++ * @summary Annotations that gets a clinit can't be verified for correct elements in a second compilation unit
++ * @compile/fail/ref=AnnoWithClinitFail.out -XDrawDiagnostics AnnoWithClinitFail.java
++ */
++
++public @interface AnnoWithClinitFail {
++ Foo f = new Foo();
++
++ String foo();
++ String bar() default "bar";
++
++ @AnnoWithClinitFail
++ static class C {} // this is in the same CU so there wont be a
++ // <clinit> when the this anno instance is checked
++
++ class Foo {}
++}
++
++@AnnoWithClinitFail
++class TestAnnoWithClinitFail { }
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/annotations/clinit/AnnoWithClinitFail.out Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,3 @@
++AnnoWithClinitFail.java:37:5: compiler.err.annotation.missing.default.value: AnnoWithClinitFail, foo
++AnnoWithClinitFail.java:44:1: compiler.err.annotation.missing.default.value: AnnoWithClinitFail, foo
++2 errors
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/DARanges.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,33 @@
++/*
++ * Copyright (c) 2014, 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.
++ */
++import java.lang.annotation.*;
++
++@Target({ElementType.METHOD})
++@interface DARange {
++ String varName();
++ int bytecodeStart();
++ int bytecodeLength();
++}
++
++@Target({ElementType.METHOD})
++@interface DARanges {DARange[] value();}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/LVTHarness.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,290 @@
++/*
++ * Copyright (c) 2014, 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 8058708
++ * @summary The LVT is not generated correctly during some try/catch scenarios
++ * javac crash while creating LVT entry for a local variable defined in
++ * an inner block
++ * @library /tools/javac/lib
++ * @build JavacTestingAbstractProcessor LVTHarness
++ * @run main LVTHarness
++ */
++
++import java.io.File;
++import java.io.IOException;
++import java.lang.annotation.Annotation;
++import java.util.Set;
++import java.util.Arrays;
++import java.util.ArrayList;
++import java.util.Collections;
++import java.util.HashMap;
++import java.util.HashSet;
++import java.util.List;
++import java.util.Map;
++
++import javax.annotation.processing.RoundEnvironment;
++import javax.lang.model.element.Element;
++import javax.lang.model.element.TypeElement;
++import javax.tools.JavaCompiler;
++import javax.tools.JavaFileObject;
++import javax.tools.StandardJavaFileManager;
++import javax.tools.ToolProvider;
++
++import com.sun.source.util.JavacTask;
++import com.sun.tools.classfile.Attribute;
++import com.sun.tools.classfile.ClassFile;
++import com.sun.tools.classfile.ConstantPool;
++import com.sun.tools.classfile.ConstantPoolException;
++import com.sun.tools.classfile.Code_attribute;
++import com.sun.tools.classfile.ConstantPool.InvalidIndex;
++import com.sun.tools.classfile.ConstantPool.UnexpectedEntry;
++import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
++import com.sun.tools.classfile.LocalVariableTable_attribute;
++import com.sun.tools.classfile.Method;
++
++import static javax.tools.StandardLocation.*;
++import static com.sun.tools.classfile.LocalVariableTable_attribute.Entry;
++import static javax.tools.JavaFileObject.Kind.SOURCE;
++
++public class LVTHarness {
++
++ static int nerrors = 0;
++
++ static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
++ static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
++
++ public static void main(String[] args) throws Exception {
++
++ String testDir = System.getProperty("test.src");
++ fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
++
++ // Make sure classes are written to scratch dir.
++ fm.setLocation(CLASS_OUTPUT, Arrays.asList(new File(".")));
++
++ for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(SOURCE), true)) {
++ new LVTHarness(jfo).check();
++ }
++ if (nerrors > 0) {
++ throw new AssertionError("Errors were found");
++ }
++ }
++
++
++ JavaFileObject jfo;
++ Map<ElementKey, DARanges> aliveRangeMap = new HashMap<ElementKey, DARanges>();
++ Set<String> declaredKeys = new HashSet<String>();
++ List<ElementKey> seenDARanges = new ArrayList<ElementKey>();
++
++ protected LVTHarness(JavaFileObject jfo) {
++ this.jfo = jfo;
++ }
++
++ protected void check() throws Exception {
++
++ JavacTask ct = (JavacTask) comp.getTask(null, fm, null, Arrays.asList("-g"),
++ null, Arrays.asList(jfo));
++ System.err.println("compiling code " + jfo);
++ ct.setProcessors(Collections.singleton(new DARangeFinder()));
++ if (!ct.call()) {
++ throw new AssertionError("Error during compilation");
++ }
++
++
++ File javaFile = new File(jfo.getName());
++ File classFile = new File(javaFile.getName().replace(".java", ".class"));
++ checkClassFile(classFile);
++
++ //check all candidates have been used up
++ for (Map.Entry<ElementKey, DARanges> entry : aliveRangeMap.entrySet()) {
++ if (!seenDARanges.contains(entry.getKey())) {
++ error("Redundant @DARanges annotation on method " +
++ entry.getKey().elem + " with key " + entry.getKey());
++ }
++ }
++ }
++
++ void checkClassFile(File file)
++ throws IOException, ConstantPoolException, InvalidDescriptor {
++ ClassFile classFile = ClassFile.read(file);
++ ConstantPool constantPool = classFile.constant_pool;
++
++ //lets get all the methods in the class file.
++ for (Method method : classFile.methods) {
++ for (ElementKey elementKey: aliveRangeMap.keySet()) {
++ String methodDesc = method.getName(constantPool) +
++ method.descriptor.getParameterTypes(constantPool).replace(" ", "");
++ if (methodDesc.equals(elementKey.elem.toString())) {
++ checkMethod(constantPool, method, aliveRangeMap.get(elementKey));
++ seenDARanges.add(elementKey);
++ }
++ }
++ }
++ }
++
++ void checkMethod(ConstantPool constantPool, Method method, DARanges ranges)
++ throws InvalidIndex, UnexpectedEntry {
++ Code_attribute code = (Code_attribute) method.attributes.get(Attribute.Code);
++ LocalVariableTable_attribute lvt =
++ (LocalVariableTable_attribute) (code.attributes.get(Attribute.LocalVariableTable));
++ List<String> infoFromRanges = convertToStringList(ranges);
++ List<String> infoFromLVT = convertToStringList(constantPool, lvt);
++
++ // infoFromRanges most be contained in infoFromLVT
++ int i = 0;
++ int j = 0;
++ while (i < infoFromRanges.size() && j < infoFromLVT.size()) {
++ int comparison = infoFromRanges.get(i).compareTo(infoFromLVT.get(j));
++ if (comparison == 0) {
++ i++; j++;
++ } else if (comparison > 0) {
++ j++;
++ } else {
++ break;
++ }
++ }
++
++ if (i < infoFromRanges.size()) {
++ error(infoFromLVT, infoFromRanges);
++ }
++ }
++
++ List<String> convertToStringList(DARanges ranges) {
++ List<String> result = new ArrayList<String>();
++ for (Annotation anno : ranges.value()) {
++ DARange range = (DARange)anno;
++ String str = formatLocalVariableData(range.varName(),
++ range.bytecodeStart(), range.bytecodeLength());
++ result.add(str);
++ }
++ Collections.sort(result);
++ return result;
++ }
++
++ List<String> convertToStringList(ConstantPool constantPool,
++ LocalVariableTable_attribute lvt) throws InvalidIndex, UnexpectedEntry {
++ List<String> result = new ArrayList<String>();
++ for (Entry entry : lvt.local_variable_table) {
++ String str = formatLocalVariableData(constantPool.getUTF8Value(entry.name_index),
++ entry.start_pc, entry.length);
++ result.add(str);
++ }
++ Collections.sort(result);
++ return result;
++ }
++
++ String formatLocalVariableData(String varName, int start, int length) {
++ StringBuilder sb = new StringBuilder()
++ .append("var name: ").append(varName)
++ .append(" start: ").append(start)
++ .append(" length: ").append(length);
++ return sb.toString();
++ }
++
++ protected void error(List<String> infoFromLVT, List<String> infoFromRanges) {
++ nerrors++;
++ System.err.printf("Error occurred while checking file: %s\n", jfo.getName());
++ System.err.println("The range info from the annotations is");
++ printStringListToErrOutput(infoFromRanges);
++ System.err.println();
++ System.err.println("And the range info from the class file is");
++ printStringListToErrOutput(infoFromLVT);
++ System.err.println();
++ }
++
++ void printStringListToErrOutput(List<String> list) {
++ for (String s : list) {
++ System.err.println("\t" + s);
++ }
++ }
++
++ protected void error(String msg) {
++ nerrors++;
++ System.err.printf("Error occurred while checking file: %s\nreason: %s\n",
++ jfo.getName(), msg);
++ }
++
++ class DARangeFinder extends JavacTestingAbstractProcessor {
++
++ @Override
++ public boolean process(Set<? extends TypeElement> annotations,
++ RoundEnvironment roundEnv) {
++ if (roundEnv.processingOver())
++ return true;
++
++ TypeElement aliveRangeAnno = elements.getTypeElement("DARanges");
++
++ if (!annotations.contains(aliveRangeAnno)) {
++ error("no @DARanges annotation found in test class");
++ }
++
++ for (Element elem: roundEnv.getElementsAnnotatedWith(aliveRangeAnno)) {
++ Annotation annotation = elem.getAnnotation(DARanges.class);
++ aliveRangeMap.put(new ElementKey(elem), (DARanges)annotation);
++ }
++ return true;
++ }
++ }
++
++ class ElementKey {
++
++ String key;
++ Element elem;
++
++ public ElementKey(Element elem) {
++ this.elem = elem;
++ this.key = computeKey(elem);
++ }
++
++ @Override
++ public boolean equals(Object obj) {
++ if (obj instanceof ElementKey) {
++ ElementKey other = (ElementKey)obj;
++ return other.key.equals(key);
++ }
++ return false;
++ }
++
++ @Override
++ public int hashCode() {
++ return key.hashCode();
++ }
++
++ String computeKey(Element e) {
++ StringBuilder buf = new StringBuilder();
++ while (e != null) {
++ buf.append(e.toString());
++ e = e.getEnclosingElement();
++ }
++ buf.append(jfo.getName());
++ return buf.toString();
++ }
++
++ @Override
++ public String toString() {
++ return "Key{" + key + "}";
++ }
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseConditional.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,15 @@
++public class TestCaseConditional {
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=5, bytecodeLength=33),
++ @DARange(varName="oo", bytecodeStart=23, bytecodeLength=15)
++ })
++ void m(String[] args) {
++ Boolean o;
++ Boolean oo = ((o = Boolean.TRUE).booleanValue()) ?
++ o = Boolean.TRUE :
++ Boolean.FALSE;
++ oo.hashCode();
++ o = Boolean.FALSE;
++ o.hashCode();
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseDoLoop.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,15 @@
++public class TestCaseDoLoop {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=3, bytecodeLength=15),
++ @DARange(varName="args", bytecodeStart=0, bytecodeLength=18)
++ })
++ void m(String[] args) {
++ Object o;
++ do {
++ o = "";
++ o.hashCode();
++ } while (args[0] != null);
++ o = "";
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseFor.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,29 @@
++public class TestCaseFor {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=11),
++ @DARange(varName="o", bytecodeStart=24, bytecodeLength=1)
++ })
++ void m1(String[] args) {
++ Object o;
++ for (int i = 0; i < 5; i++) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=11),
++ @DARange(varName="o", bytecodeStart=24, bytecodeLength=1)
++ })
++ void m2(String[] args) {
++ Object o;
++ for (int i = 0; i < 5; i++) {
++ o = "";
++ o.hashCode();
++ continue;
++ }
++ o = "";
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseForEach.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,15 @@
++public class TestCaseForEach {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=25, bytecodeLength=11),
++ @DARange(varName="o", bytecodeStart=39, bytecodeLength=1)
++ })
++ void m(String[] args) {
++ Object o;
++ for (String s : args) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseIf.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,84 @@
++public class TestCaseIf {
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=9, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=17, bytecodeLength=1)
++ })
++ void m0(String[] args) {
++ Object o;
++ if (args[0] != null) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=18, bytecodeLength=1)
++ })
++ void m1() {
++ Object o;
++ int i = 5;
++ if (i == 5) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=18, bytecodeLength=1)
++ })
++ void m2() {
++ Object o;
++ int i = 5;
++ if (!(i == 5)) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=15, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=23, bytecodeLength=1)
++ })
++ void m3(String[] args) {
++ Object o;
++ if (args[0] != null && args[1] != null) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=15, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=23, bytecodeLength=1)
++ })
++ void m4(String[] args) {
++ Object o;
++ if (args[0] != null || args[1] != null) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="finalLocal", bytecodeStart=11, bytecodeLength=6),
++ @DARange(varName="used", bytecodeStart=13, bytecodeLength=4)
++ })
++ void m5(Object o) {
++ if (o != null) {
++ Object notUsed;
++ Object used;
++ if (o != null) {
++ final Object finalLocal = null;
++ used = null;
++ if (o == null) {}
++ }
++ }
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseIfElse.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,69 @@
++public class TestCaseIfElse {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=9, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=20, bytecodeLength=9)
++ })
++ void m0(String[] args) {
++ Object o;
++ if (args[0] != null) {
++ o = "then";
++ o.hashCode();
++ } else {
++ o = "else";
++ o.hashCode();
++ }
++ o = "finish";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=21, bytecodeLength=9)
++ })
++ void m1() {
++ Object o;
++ int i = 5;
++ if (i == 5) {
++ o = "then";
++ o.hashCode();
++ } else {
++ o = "else";
++ o.hashCode();
++ }
++ o = "finish";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=10, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=21, bytecodeLength=9)
++ })
++ void m2() {
++ Object o;
++ int i = 5;
++ if (i != 5) {
++ o = "then";
++ o.hashCode();
++ } else {
++ o = "else";
++ o.hashCode();
++ }
++ o = "finish";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=11, bytecodeLength=3),
++ @DARange(varName="o", bytecodeStart=17, bytecodeLength=2)
++ })
++ Object m3(boolean cond1, boolean cond2) {
++ Object o;
++ if (cond1) {
++ if (cond2) {
++ o = "then";
++ } else {
++ o = "else";
++ return null;
++ }
++ }
++ return null;
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseLocalInInnerBlock.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,20 @@
++public class TestCaseLocalInInnerBlock {
++
++ @DARanges({
++ @DARange(varName="fm", bytecodeStart=23, bytecodeLength=10),
++ @DARange(varName="newWidth", bytecodeStart=2, bytecodeLength=33),
++ @DARange(varName="tc", bytecodeStart=5, bytecodeLength=30)
++ })
++ int m() {
++ int newWidth = 0;
++ String tc = "b";
++ if (tc != null) {
++ String fm;
++ if (tc.trim() != null) {
++ } else if ((fm = "b") != null) {
++ newWidth += fm.length();
++ }
++ }
++ return newWidth;
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseSwitch.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,86 @@
++public class TestCaseSwitch {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=31, bytecodeLength=16),
++ @DARange(varName="o", bytecodeStart=50, bytecodeLength=15),
++ @DARange(varName="o", bytecodeStart=68, bytecodeLength=1),
++ @DARange(varName="oo", bytecodeStart=39, bytecodeLength=8),
++ @DARange(varName="uu", bytecodeStart=59, bytecodeLength=6)
++ })
++ void m1(String[] args) {
++ Object o;
++ switch (args.length) {
++ case 0:
++ o = "0";
++ o.hashCode();
++ Object oo = "oo";
++ oo.hashCode();
++ break;
++ case 1:
++ o = "1";
++ o.hashCode();
++ Object uu = "uu";
++ uu.hashCode();
++ break;
++ }
++ o = "return";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=35, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=46, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=78, bytecodeLength=5),
++ @DARange(varName="o", bytecodeStart=86, bytecodeLength=1),
++ @DARange(varName="oo", bytecodeStart=56, bytecodeLength=16)
++ })
++ void m3(int i) {
++ Object o;
++ switch (i) {
++ case 0:
++ o = "0";
++ o.hashCode();
++ break;
++ case 1:
++ o = "1";
++ o.hashCode();
++ break;
++ case 2:
++ int oo = i;
++ if (oo > 1) {
++ System.out.println("greater");
++ }
++ break;
++ case 3:
++ int uu = i;
++ default:
++ o = "default";
++ o.hashCode();
++ }
++ o = "finish";
++ }
++
++ @DARanges({
++ @DARange(varName="oCache", bytecodeStart=30, bytecodeLength=6),
++ @DARange(varName="cache", bytecodeStart=41, bytecodeLength=3),
++ @DARange(varName="cache", bytecodeStart=54, bytecodeLength=2),
++ @DARange(varName="service", bytecodeStart=39, bytecodeLength=5)
++ })
++ public Object m(int i) {
++ Object cache;
++ switch (i) {
++ case 0:
++ Object oCache = null;
++ if (oCache != null) {
++ return oCache;
++ }
++ case 1:
++ Object service = null;
++ cache = null;
++ break;
++ default:
++ throw new AssertionError("");
++ }
++ return cache;
++ }
++
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseTry.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,55 @@
++public class TestCaseTry {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=3, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=15, bytecodeLength=1)
++ })
++ void m0(String[] args) {
++ Object o;
++ try {
++ o = "";
++ o.hashCode();
++ } catch (RuntimeException e) {}
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=3, bytecodeLength=16),
++ @DARange(varName="o", bytecodeStart=23, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=35, bytecodeLength=11)
++ })
++ void m1() {
++ Object o;
++ try {
++ o = "";
++ o.hashCode();
++ } catch (RuntimeException e) {
++ }
++ finally {
++ o = "finally";
++ o.hashCode();
++ }
++ o = "";
++ }
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=3, bytecodeLength=16),
++ @DARange(varName="o", bytecodeStart=23, bytecodeLength=16),
++ @DARange(varName="o", bytecodeStart=43, bytecodeLength=11)
++ })
++ void m2() {
++ Object o;
++ try {
++ o = "";
++ o.hashCode();
++ } catch (RuntimeException e) {
++ o = "catch";
++ o.hashCode();
++ }
++ finally {
++ o = "finally";
++ o.hashCode();
++ }
++ o = "";
++ }
++}
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ ./langtools/test/tools/javac/flow/tests/TestCaseWhile.java Fri Apr 10 09:22:56 2015 -0700
+@@ -0,0 +1,15 @@
++public class TestCaseWhile {
++
++ @DARanges({
++ @DARange(varName="o", bytecodeStart=9, bytecodeLength=8),
++ @DARange(varName="o", bytecodeStart=20, bytecodeLength=1)
++ })
++ void m(String[] args) {
++ Object o;
++ while (args[0] != null) {
++ o = "";
++ o.hashCode();
++ }
++ o = "";
++ }
++}
+--- ./langtools/test/tools/javac/innerClassFile/Driver.sh Mon Jan 05 12:00:55 2015 -0800
++++ ./langtools/test/tools/javac/innerClassFile/Driver.sh Fri Apr 10 09:22:56 2015 -0700
+@@ -71,4 +71,5 @@
+ "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/x/B.java src/x/C.java src/y/Main.java
+ rm y/R3.class
+ "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/y/Main.java
++chmod -R u+w src
+ rm -fr src